Source for file 01.php

Documentation is available at 01.php

  1. <?php
  2. /*
  3. * This file is part of Sylar.
  4. *
  5. * Sylar is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * Sylar is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public License
  16. * along with Sylar. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * @copyright Copyright Sylar Development Team
  19. * @license http://www.gnu.org/licenses/ GNU Public License V2.0
  20. * @see https://launchpad.net/sylar/
  21. * @see http://www.giano-solutions.com
  22. */
  23.  
  24. /**
  25. * Example Sylar File
  26. * Some files that shows how sylar works
  27. *
  28. * @package Sylar
  29. * @version 1.0
  30. * @since 02-2008
  31. * @author Gianluca Giusti [brdp] <g.giusti@giano-solutions.com>
  32. * @copyright Sylar Development Team
  33. */
  34.  
  35. #
  36. # Include the bas Application settings
  37. #
  38.  
  39. require_once 'config/appConfig.php';
  40. ?>
  41.  
  42.  
  43. <html>
  44. <head>
  45. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  46. <title>Insert title here</title>
  47. </head>
  48.  
  49. <body>
  50. <p>Test Connessione al DB e LOG</p>
  51.  
  52. <a href='02.php'>TEST Session &raquo;</a><br><br>
  53. <textarea style='width: 100%; height: 500px;'>
  54. <?php
  55.  
  56. #
  57. # TEST Import Sylar Class
  58. #
  59. import('sylar.common.sylar.db.mysql.MysqlDriver');
  60. import('sylar.common.system.SylarUtils');
  61. import('sylar.common.security.Session');
  62. echo "\nTest Session Value: ";
  63. $session = new Sylar_Session();
  64. if($session->isUserLogged()){
  65. echo "User Logged!";
  66. echo "\nlogged as: ".$session->getSessionParam("name")." ".$session->getSessionParam("surname")." [".$session->getSessionParam("username")."]";
  67. echo "\nUneque ID: ".$session->getUniqueID()." another: ".$session->getUniqueID();
  68. }else{
  69. echo "User not logged.";
  70. }
  71. try{
  72. $db = new Sylar_MysqlDriver();
  73. echo "\n\nConnessione.....";
  74. $db->connect();
  75. echo "OK!\n";
  76. $sql = "select * from SYLAR_event_log";
  77. $db->execSmartQuery($sql);
  78. $db->disconnect();
  79. if($db->resultRows() > 0){
  80. while($row=$db->fetchArrayByName() ) {
  81. echo "\n";
  82. print_r( $row );
  83. }
  84. }else{
  85. echo "No rows found.";
  86. }
  87. echo "\nLOGGING<br>";
  88. $Log->logEvent("Log Evento di prova", "VERBOSE");
  89. }catch (ExceptionInSylar $ex){
  90. echo "\n\n".__FILE__." Exception: ".$ex->getMessage();
  91. }
  92. echo "\n\n\n-----------------------";
  93. echo "\nSylar included Files:\n";
  94. Sylar_SylarUtils::showIncludedFiles();
  95. echo "\n\nSylar Defined Costants:\n";
  96. Sylar_SylarUtils::showDefinedCostant();
  97. ?>
  98.  
  99. </textarea>
  100. </body>
  101. </html>

Documentation generated on Thu, 24 Apr 2008 16:14:12 +0200 by phpDocumentor 1.3.0RC3