public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
Search Repo:
Changed api so that warning messages are swallowed and only spit out if 
debug is on
Removed the xajax call from the installer
Fixed the install script check in index.php
Put some more error handling into the orm so things fail more gracefully
Made the debug flag in CmsDatabase work again

Signed-off-by: Ted Kulp <ted@cmsmadesimple.org>


git-svn-id: http://svn.cmsmadesimple.org/svn/cmsmadesimple/trunk@4447 
3d254a34-79dc-0310-9e5f-be208747d8a0
tedkulp (author)
Fri Apr 25 11:15:55 -0700 2008
commit  bec9faa82c799dcd33e7f32e164bd0d6edeab96b
tree    37dec144afb673de069be88430d306d35c82422f
parent  58916600f460ef1c4935d93d6a64d984eb49956c
...
53
54
55
56
 
57
58
 
59
60
61
...
53
54
55
 
56
57
 
58
59
60
61
0
@@ -53,9 +53,9 @@
0
 $config_location = CmsConfig::get_config_filename();
0
 if (!file_exists($config_location) || filesize($config_location) < 800)
0
 {
0
- if (FALSE == is_file($dirname.'/install/install.php'))
0
+ if (FALSE == is_file($dirname.'/install/index.php'))
0
   {
0
- die ('There is no config.php file or install/install.php please correct one these errors!');
0
+ die ('There is no config.php file or install/index.php please correct one these errors!');
0
     }
0
   else
0
   {
...
41
42
43
44
45
46
47
48
 
 
 
 
 
49
50
51
...
41
42
43
 
 
 
 
 
44
45
46
47
48
49
50
51
0
@@ -41,11 +41,11 @@
0
 $smarty->template_dir = cms_join_path(dirname(dirname(__FILE__)),'install','templates'.DS);
0
 $smarty->plugins_dir = array(cms_join_path(dirname(dirname(__FILE__)),'lib','smarty','plugins'.DS), cms_join_path(dirname(__FILE__),'plugins'.DS));
0
 
0
-require_once(cms_join_path(dirname(dirname(__FILE__)), 'lib', 'xajax', 'xajax.inc.php'));
0
-$xajax = new xajax();
0
-$xajax->registerFunction('test_connection');
0
-$xajax->processRequests();
0
-$smarty->assign('xajax_header', $xajax->getJavascript('../lib/xajax'));
0
+//require_once(cms_join_path(dirname(dirname(__FILE__)), 'lib', 'xajax', 'xajax.inc.php'));
0
+//$xajax = new xajax();
0
+//$xajax->registerFunction('test_connection');
0
+//$xajax->processRequests();
0
+//$smarty->assign('xajax_header', $xajax->getJavascript('../lib/xajax'));
0
 
0
 display_page($smarty);
0
 
...
129
130
131
132
133
 
134
135
136
...
129
130
131
 
 
132
133
134
135
0
@@ -129,8 +129,7 @@
0
     }
0
 
0
     $dbinstance->SetFetchMode(ADODB_FETCH_ASSOC);
0
- //$dbinstance->debug = $debug;
0
- $dbinstance->debug = true;
0
+ $dbinstance->debug = $debug;
0
     
0
    if ($dbms == 'sqlite')
0
    {
...
628
629
630
631
632
633
634
635
 
636
637
638
639
 
 
 
640
641
642
 
 
 
 
 
 
643
644
 
645
646
647
648
649
 
 
 
 
650
651
652
653
 
 
 
 
654
 
 
 
 
655
656
657
658
659
660
661
662
663
664
...
692
693
694
695
696
697
698
699
700
 
701
702
703
704
705
706
707
708
709
 
710
711
 
712
 
713
714
 
 
 
 
 
 
715
716
717
718
719
720
 
 
 
 
 
 
 
 
 
 
721
722
 
 
 
 
 
 
723
724
725
...
628
629
630
 
 
 
 
 
631
632
 
 
 
633
634
635
636
 
 
637
638
639
640
641
642
643
 
644
645
 
 
 
 
646
647
648
649
650
 
 
 
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
...
697
698
699
 
 
700
 
 
 
701
702
 
 
 
 
 
 
 
 
703
704
 
705
706
707
708
 
709
710
711
712
713
714
715
 
 
 
 
 
716
717
718
719
720
721
722
723
724
725
726
 
727
728
729
730
731
732
733
734
735
0
@@ -628,30 +628,35 @@
0
     
0
     $classname = get_class($this);
0
 
0
- $row = $db->GetRow($query, $queryparams);
0
-
0
- //var_dump($query, $queryparams, $row, '<br />');
0
-
0
- if($row)
0
+ try
0
     {
0
- //Basically give before_load a chance to load that class type if necessary
0
- $newclassname = $classname;
0
- if ($this->type_field != '' && isset($row[$this->type_field]))
0
+ $row = $db->GetRow($query, $queryparams);
0
+
0
+ if($row)
0
       {
0
- $newclassname = $row[$this->type_field];
0
- }
0
+ //Basically give before_load a chance to load that class type if necessary
0
+ $newclassname = $classname;
0
+ if ($this->type_field != '' && isset($row[$this->type_field]))
0
+ {
0
+ $newclassname = $row[$this->type_field];
0
+ }
0
       
0
- $this->before_load_caller($newclassname, $row);
0
+ $this->before_load_caller($newclassname, $row);
0
       
0
- if (!($newclassname != $classname && class_exists($newclassname)))
0
- {
0
- $newclassname = $classname;
0
- }
0
+ if (!($newclassname != $classname && class_exists($newclassname)))
0
+ {
0
+ $newclassname = $classname;
0
+ }
0
 
0
- $oneobj = new $newclassname;
0
- $oneobj = $this->fill_object($row, $oneobj);
0
- return $oneobj;
0
+ $oneobj = new $newclassname;
0
+ $oneobj = $this->fill_object($row, $oneobj);
0
+ return $oneobj;
0
+ }
0
     }
0
+ catch (Exception $e)
0
+ {
0
+ //Don't do anything
0
+ }
0
 
0
     return null;
0
   }
0
0
0
0
0
0
0
0
@@ -692,34 +697,39 @@
0
     $classname = get_class($this);
0
 
0
     $result = array();
0
-
0
- $dbresult = $db->SelectLimit($query, $numrows, $offset, $queryparams);
0
     
0
- //var_dump($query, $queryparams, $dbresult->EOF, '<br />');
0
-
0
- while ($dbresult && !$dbresult->EOF)
0
+ try
0
     {
0
- //Basically give before_load a chance to load that class type if necessary
0
- $newclassname = $classname;
0
- if ($this->type_field != '' && isset($dbresult->fields[$this->type_field]))
0
- {
0
- $newclassname = $dbresult->fields[$this->type_field];
0
- }
0
-
0
- $this->before_load_caller($newclassname, $dbresult->fields);
0
+ $dbresult = $db->SelectLimit($query, $numrows, $offset, $queryparams);
0
 
0
- if (!($newclassname != $classname && class_exists($newclassname)))
0
+ while ($dbresult && !$dbresult->EOF)
0
       {
0
+ //Basically give before_load a chance to load that class type if necessary
0
         $newclassname = $classname;
0
- }
0
+ if ($this->type_field != '' && isset($dbresult->fields[$this->type_field]))
0
+ {
0
+ $newclassname = $dbresult->fields[$this->type_field];
0
+ }
0
+
0
+ $this->before_load_caller($newclassname, $dbresult->fields);
0
 
0
- $oneobj = new $newclassname;
0
- $oneobj = $this->fill_object($dbresult->fields, $oneobj);
0
- $result[] = $oneobj;
0
- $dbresult->MoveNext();
0
- }
0
+ if (!($newclassname != $classname && class_exists($newclassname)))
0
+ {
0
+ $newclassname = $classname;
0
+ }
0
+
0
+ $oneobj = new $newclassname;
0
+ $oneobj = $this->fill_object($dbresult->fields, $oneobj);
0
+ $result[] = $oneobj;
0
+ $dbresult->MoveNext();
0
+ }
0
     
0
- if ($dbresult) $dbresult->Close();
0
+ if ($dbresult) $dbresult->Close();
0
+ }
0
+ catch (Exception $e)
0
+ {
0
+ //Nothing again
0
+ }
0
     
0
     return $result;
0
   }
...
37
38
39
 
 
40
41
42
...
347
348
349
 
 
 
 
 
 
 
 
 
 
 
 
 
 
350
351
352
...
37
38
39
40
41
42
43
44
...
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
0
@@ -37,6 +37,8 @@
0
 require_once(ROOT_DIR.DS.'lib'.DS.'classes'.DS.'class.cms_config.php');
0
 require_once(ROOT_DIR.DS.'lib'.DS.'classes'.DS.'class.cms_cache.php');
0
 
0
+set_error_handler('cms_warning_handler', E_WARNING | E_USER_WARNING);
0
+
0
 /**
0
  * The one and only autoload function for the system. This basically allows us
0
  * to remove a lot of the require_once BS and keep the file loading to as much
0
@@ -347,6 +349,20 @@
0
 function in_debug()
0
 {
0
   return CmsConfig::get("debug") == true;
0
+}
0
+
0
+/**
0
+ * Error handler so that we can swallow warning messages unless the
0
+ * debug flag is on.
0
+ *
0
+ * @author Ted Kulp
0
+ */
0
+function cms_warning_handler($errno, $errstr, $errfile = '', $errline = -1, $errcontext = array())
0
+{
0
+ if (in_debug())
0
+ {
0
+ trigger_error($errstr, E_USER_WARNING);
0
+ }
0
 }
0
 
0
 ?>

Comments

    No one has commented yet.