Source for file 03.php

Documentation is available at 03.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. <html>
  43. <head>
  44.  
  45. </head>
  46.  
  47. <body>
  48. <p>Test exception</p>
  49. <a href='04.php'>TEST DataContainer &raquo;</a><br><br>
  50. <textarea style='width: 100%; height: 500px;'>
  51. <?php
  52. import('sylar.common.system.SylarUtils');
  53. import('sylar.common.security.Session');
  54. import('sylar.common.db.mysql.MysqlDriver');
  55. echo "\nTest Session Value: ";
  56. $session = new Sylar_Session();
  57. if($session->isUserLogged()){
  58. echo "User Logged!";
  59. echo "\nlogged as: ".$session->getSessionParam("name")." ".$session->getSessionParam("surname")." [".$session->getSessionParam("username")."]";
  60. echo "\nUneque ID: ".$session->getUniqueID()." another: ".$session->getUniqueID();
  61. }else{
  62. echo "User not logged.";
  63. }
  64. echo "\n\nWrong DB connection... ";
  65. try{
  66. $db = new Sylar_MysqlDriver(new Sylar_DataBaseConfiguration("SylarDefaultDb", array() ));
  67. $db->connect();
  68. }catch (ExceptionInSylar $ex){
  69. echo "\n".$ex->getMessage();
  70. }
  71. echo "\n\nother DB connection...";
  72. try{
  73. $db2 = new Sylar_MysqlDriver(new Sylar_DataBaseConfiguration("SylarDefaultDb", array() ));
  74. $db2->connect();
  75. }catch (ExceptionInSylar $ex){
  76. echo "\n".$ex->getMessage();
  77. }
  78. echo "\n\nNow... Togheter! the exception on the first connection error stop the execution of the block code... but it continue after catch statment!!!";
  79. try{
  80. $db3 = new Sylar_MysqlDriver(new Sylar_DataBaseConfiguration("SylarDefaultDb", array() ));
  81. $db3->connect();
  82. $db4 = new Sylar_MysqlDriver(new Sylar_DataBaseConfiguration("SylarDefaultDb", array() ));
  83. $db4->connect();
  84. }catch (ExceptionInSylar $ex){
  85. echo "\n".$ex->getMessage();
  86. }
  87. echo "\n\nContinues after catch... etc... etc...";
  88. echo "\n\n\n-----------------------";
  89. echo "\nSylar included Files:\n";
  90. Sylar_SylarUtils::showIncludedFiles();
  91. echo "\n\nSylar Defined Costants:\n";
  92. Sylar_SylarUtils::showDefinedCostant();
  93. ?>
  94. </textarea>
  95. </body>
  96. </html>

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