Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Warning! do poprawy, Wyświetla się warning. Pomoc w poprawie
r3pilc3
post
Post #1





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 22.07.2012

Ostrzeżenie: (0%)
-----


Witam
Mam stronę napisaną w php (na zasadzie frameworka czyli wiele plików.php połączonych ze sobą), która poprawnie działa w XAMPP 1.7.7 (php wersja 5.3.8).
Pragnę zainstalować na swoim PC, najnowszy XAMPP 1.8.0, który ma wersję php 5.4.4.
(i oto moja obietnica dla wtajemniczonych z poprzedniego tematu - to już jest ostatnia wersja XAMPPa na jaką chce zamienić i jak pojawi się nowsza wersja to już nie będę zamieniał na nowszego XAMPP i od nowa prosił o pomoc)

Napotykam w sowiej stronie następujące błędy:

1) Strona główna mojej strony zawiera 2 (strzelam krytyczne) błędy:
http://i48.tinypic.com/349c45x.png

2) posiadam w projekcie tylko stronę główną oraz stronę logowania w której występują następujące błędy:
http://i45.tinypic.com/287jl8m.png


Proszę bardzo o pomoc w rozwiązaniu tych błędów.

Oto plik controller_base.php:
(błędy w 13 i 17 linii)
  1. <?php
  2. Abstract Class Controller_Base {
  3. protected $registry;
  4. function __construct($registry, $models, $addons, $layout, $controller) {
  5. $this->registry = $registry;
  6. $this->session = $registry->session;
  7. $this->error = $registry->error;
  8. $this->text = $registry->text;
  9. $this->router = $registry->router;
  10. $this->template = $registry->template;
  11. $this->db = $registry->db;
  12. foreach($models as $model){
  13. $this->model->$model = $registry->model->$model;
  14. }
  15. if($addons)
  16. foreach($addons as $addon){
  17. $this->addon->$addon = $registry->addon->$addon;
  18. }
  19. $this->template->layout = $layout;
  20. $this->here = $controller;
  21. }
  22. abstract function index($args=null,$post=null);
  23. function addon($addon){
  24. return 'http://'.server_addr.site_addr.'core/addons/'.$addon;
  25. }
  26. }
  27. ?>


plik: router.php:
(błędy w 118 i 131 linii)
  1. <?php
  2.  
  3. Class Router {
  4. private $registry;
  5. private $path;
  6. private $args = array();
  7.  
  8.  
  9. function __construct($registry) {
  10. $this->registry = $registry;
  11. }
  12.  
  13.  
  14. function setPath($path) {
  15. $path .= DIRSEP;
  16.  
  17. if (is_dir($path) == false) {
  18.  
  19. throw new Exception ('Invalid controller path: `' . $path . '`');
  20. }
  21.  
  22. $this->path = $path;
  23.  
  24. }
  25.  
  26.  
  27.  
  28. private function getController(&$file, &$controller, &$action, &$args) {
  29. $route = (empty($_GET['route'])) ? '' : $_GET['route'];
  30. if (empty($route)) { $route = 'home'; }
  31.  
  32. // Get separate parts
  33. $route = trim($route, '/\\');
  34. $parts = explode('/', $route);
  35. // Find right controller
  36. $cmd_path = $this->path;
  37. foreach ($parts as $part) {
  38. $fullpath = $cmd_path . $part;
  39.  
  40. // Is there a dir with this path?
  41. if (is_dir($fullpath)) {
  42. $cmd_path .= $part . DIRSEP;
  43. array_shift($parts);
  44. continue;
  45. }
  46.  
  47. // Find the file
  48. if (is_file($fullpath . iext)) {
  49. $controller = $part;
  50. array_shift($parts);
  51. break;
  52. }
  53. }
  54.  
  55. if (empty($controller)) { $controller = 'home'; };
  56.  
  57. // Get action
  58. $action = array_shift($parts);
  59. if (empty($action)) { $action = 'index'; }
  60.  
  61. $file = $cmd_path . $controller . iext;
  62. $args = $parts;
  63. }
  64.  
  65.  
  66.  
  67. function delegate() {
  68. // Analyze route
  69.  
  70. $this->getController($file, $controller, $action, $args);
  71. // File available?
  72. $controller_name=$controller;
  73. if (is_readable($file) == false) {
  74. die ('404 - Controller File Not Found');
  75. }
  76.  
  77. // Include the file
  78. include ($file);
  79. // Initiate the class
  80. $class = 'Controller_' . $controller;
  81.  
  82.  
  83. /// LANGUAGE
  84. if($controller=="admin")
  85. $name='pl';
  86. else
  87. $name=$_SESSION['language'];
  88. end;
  89.  
  90. if($name=="") $name="eng";
  91.  
  92. $mfile=site_path . 'views' . DIRSEP . 'texts' . DIRSEP . $name . iext;
  93.  
  94. if (is_readable($mfile) == false) {
  95. die ('404 - Texts File Not Found: '.$mfile);
  96. }
  97.  
  98. include($mfile);
  99. $text_name='Text_'.$name;
  100.  
  101. $text = new $text_name($this->registry);
  102. $this->registry->text = $text;
  103.  
  104. ////////////
  105.  
  106. if($addons)
  107. foreach($addons as $addon){
  108. $mfile=core_path . 'addons' . DIRSEP .$addon . iext;
  109.  
  110. if (is_readable($mfile) == false) {
  111. die ('404 - Addon File Not Found');
  112. }
  113.  
  114. include($mfile);
  115. $addon_name='Addon_' . $addon;
  116.  
  117. $addon2 = new $addon_name($this->registry);
  118. $this->registry->addon->$addon = $addon2;
  119. }
  120.  
  121. foreach($models as $name){
  122. $mfile=site_path . 'models' . DIRSEP . $name . iext;
  123. if (is_readable($mfile) == false) {
  124. die ('404 - Model File Not Found');
  125. }
  126.  
  127. include($mfile);
  128. $model_name='Model_' . $name;
  129.  
  130. $model = new $model_name($this->registry);
  131. $this->registry->model->$name = $model;
  132. }
  133.  
  134.  
  135. $controller = new $class($this->registry, $models, $addons, $layout, $controller);
  136.  
  137.  
  138. // Action available?
  139. if (is_callable(array($controller, $action)) == false) {
  140.  
  141. $this->redirect('home/deadend/'.$controller_name.'/'.$action);
  142. die ('404 - Controller Action Not Found');
  143. }
  144.  
  145. // Run action
  146. if(is_callable(array($controller, 'BeforeFilter')) == true)
  147. $controller->BeforeFilter($action,$controller_name,$args,$_POST);
  148.  
  149. $controller->$action($args,$_POST);
  150. }
  151.  
  152. function redirect($route){
  153. header("Location: ".site_addr.$route);
  154. }
  155.  
  156.  
  157.  
  158. }
  159.  
  160. ?>


Proszę o pomoc co dokładnie znaczą te komunikat i co trzeba w takim wypadku podjąć za kroki... (nie chodzi mi o wyłożenie wszystkiego na tacy - tylko chociaż pomoc w nakierowaniu mnie na właściwy trop próby poprawy)

-Opcja wyłączenia błędów:
error_reporting ('E_ALL ^E_DEPRECATED ^E_NOTICE');
Odpada, ponieważ mój projekt musi być OK. Ale jak ją włączę to nie ma niepożądanych efektów na stronie.

Ten post edytował r3pilc3 29.07.2012, 11:40:15
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 6.10.2025 - 12:48