| 
     
      
      
      From: <tr...@us...> - 2011-10-26 19:45:15
      
     
   | 
Revision: 7979
          http://xoops.svn.sourceforge.net/xoops/?rev=7979&view=rev
Author:   trabis
Date:     2011-10-26 19:45:09 +0000 (Wed, 26 Oct 2011)
Log Message:
-----------
Moving template functions to functions.php(where functions should be) and updating protector Database::getInstance();
Modified Paths:
--------------
    XoopsCore/branches/2.6.x/2.6.0/htdocs/class/template.php
    XoopsCore/branches/2.6.x/2.6.0/htdocs/include/comment_delete.php
    XoopsCore/branches/2.6.x/2.6.0/htdocs/include/functions.php
    XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/modulesadmin/modulesadmin.php
    XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin/advisory.php
    XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin/index.php
    XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin/prefix_manager.php
    XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin.php
    XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/include/postcheck_functions.php
    XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/notification.php
    XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/oninstall.php
    XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/onuninstall.php
    XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/onupdate.php
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/template.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/template.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/template.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -160,49 +160,4 @@
         require_once SMARTY_CORE_DIR . 'core.rm_auto.php';
         return smarty_core_rm_auto($_params, $this);
     }
-}
-
-/**
- * function to update compiled template file in templates_c folder
- *
- * @param string $tpl_id
- * @param boolean $clear_old
- * @return boolean
- */
-function xoops_template_touch($tpl_id, $clear_old = true)
-{
-    $tplfile_handler = xoops_gethandler('tplfile');
-    $tplfile = $tplfile_handler->get($tpl_id);
-
-    if (is_object($tplfile)) {
-        $file = $tplfile->getVar('tpl_file', 'n');
-        $tpl = new XoopsTpl();
-        return $tpl->touch('db:' . $file);
-    }
-    return false;
-}
-
-/**
- * Clear the module cache
- *
- * @param int $mid Module ID
- * @return void
- */
-function xoops_template_clear_module_cache($mid)
-{
-    /* @var $block_handler XoopsBlockHandler */
-    $block_handler = xoops_getHandler('block');
-    $block_arr = $block_handler->getByModule($mid);
-    $count = count($block_arr);
-    if ($count > 0) {
-        $xoopsTpl = new XoopsTpl();
-        $xoopsTpl->caching = 2;
-        for ($i = 0; $i < $count; $i++) {
-            if ($block_arr[$i]->getVar('template') != '') {
-                $xoopsTpl->clear_cache(XOOPS_ROOT_PATH . "/modules/" . $block_arr[$i]->getVar('dirname') . "/templates/blocks/" . $block_arr[$i]->getVar('template'), 'blk_' . $block_arr[$i]->getVar('bid'));
-            }
-        }
-    }
-}
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/include/comment_delete.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/include/comment_delete.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/include/comment_delete.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -20,7 +20,6 @@
 defined('XOOPS_ROOT_PATH') or die('Restricted access');
 
 $xoops = Xoops::getInstance();
-
 $xoops->isModule() or die('Restricted access');
 
 include_once $xoops->path('include/comment_constants.php');
@@ -109,10 +108,9 @@
         /* @var $comment XoopsComment */
         $comment = $comment_handler->get($com_id);
         if (!$comment_handler->delete($comment)) {
-            include_once $xoops->path('header.php');
+            $xoops->header();
             xoops_error(_CM_COMDELETENG . ' (ID: ' . $comment->getVar('com_id') . ')');
-            include_once $xoops->path('footer');
-            exit();
+            $xoops->footer();
         }
 
         $com_itemid = $comment->getVar('com_itemid');
@@ -185,9 +183,9 @@
             }
         }
         if (count($errs) > 0) {
-            include_once $xoops->path('header.php');
+            $xoops->header();
             xoops_error($errs);
-            include_once $xoops->path('footer.php');
+            $xoops->footer();
             exit();
         }
         redirect_header($redirect_page . '=' . $com_itemid . '&com_order=' . $com_order . '&com_mode=' . $com_mode, 1, _CM_COMDELETED);
@@ -254,15 +252,15 @@
                 $comment_config['callback']['update']($com_itemid, $comment_count);
             }
         }
-        include_once $xoops->path('header.php');
+        $xoops->header();
         xoops_result($msgs);
         echo '<br /><a href="' . $redirect_page . '=' . $com_itemid . '&com_order=' . $com_order . '&com_mode=' . $com_mode . '">' . _BACK . '</a>';
-        include_once $xoops->path('footer.php');
+        $xoops->footer();
         break;
 
     case 'delete':
     default:
-        include_once $xoops->path('header.php');
+        $xoops->header();
         $comment_confirm = array(
             'com_id' => $com_id, 'com_mode' => $com_mode, 'com_order' => $com_order, 'op' => array(
                 _CM_DELETEONE => 'delete_one', _CM_DELETEALL => 'delete_all'
@@ -272,8 +270,6 @@
             $comment_confirm = $comment_confirm + $comment_confirm_extra;
         }
         xoops_confirm($comment_confirm, 'comment_delete.php', _CM_DELETESELECT);
-        include_once $xoops->path('footer.php');
+        $xoops->footer();
         break;
-}
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/include/functions.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/include/functions.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/include/functions.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -1070,4 +1070,46 @@
     }
     return $domain;
 }
-?>
\ No newline at end of file
+
+/**
+ * function to update compiled template file in templates_c folder
+ *
+ * @param string $tpl_id
+ * @param boolean $clear_old
+ * @return boolean
+ */
+function xoops_template_touch($tpl_id, $clear_old = true)
+{
+    $tplfile_handler = xoops_gethandler('tplfile');
+    $tplfile = $tplfile_handler->get($tpl_id);
+
+    if (is_object($tplfile)) {
+        $file = $tplfile->getVar('tpl_file', 'n');
+        $tpl = new XoopsTpl();
+        return $tpl->touch('db:' . $file);
+    }
+    return false;
+}
+
+/**
+ * Clear the module cache
+ *
+ * @param int $mid Module ID
+ * @return void
+ */
+function xoops_template_clear_module_cache($mid)
+{
+    /* @var $block_handler XoopsBlockHandler */
+    $block_handler = xoops_getHandler('block');
+    $block_arr = $block_handler->getByModule($mid);
+    $count = count($block_arr);
+    if ($count > 0) {
+        $xoopsTpl = new XoopsTpl();
+        $xoopsTpl->caching = 2;
+        for ($i = 0; $i < $count; $i++) {
+            if ($block_arr[$i]->getVar('template') != '') {
+                $xoopsTpl->clear_cache(XOOPS_ROOT_PATH . "/modules/" . $block_arr[$i]->getVar('dirname') . "/templates/blocks/" . $block_arr[$i]->getVar('template'), 'blk_' . $block_arr[$i]->getVar('bid'));
+            }
+        }
+    }
+}
\ No newline at end of file
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/modulesadmin/modulesadmin.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/modulesadmin/modulesadmin.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/modulesadmin/modulesadmin.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -184,7 +184,6 @@
                             $newtplid = $tplfile->getVar('tpl_id');
                             $msgs[] = "  " . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_ADD_DATA, "<strong>" . $tpl['file'] . "</strong>") . "(ID: <strong>" . $newtplid . "</strong>)";
                             // generate compiled file
-                            include_once XOOPS_ROOT_PATH . '/class/template.php';
                             if (!xoops_template_touch($newtplid)) {
                                 $msgs[] = '  <span style="color:#ff0000;">' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_COMPILED_FAILED, "<strong>" . $tpl['file'] . "</strong>") . "</span>";
                             } else {
@@ -194,7 +193,6 @@
                         unset($tplfile, $tpldata);
                     }
                 }
-                include_once XOOPS_ROOT_PATH . '/class/template.php';
                 xoops_template_clear_module_cache($newmid);
                 $blocks = $module->getInfo('blocks');
                 if ($blocks != false) {
@@ -247,7 +245,6 @@
                                     $newtplid = $tplfile->getVar('tpl_id');
                                     $msgs[] = "  " . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_ADD_DATA, "<strong>" . $block['template'] . "</strong>") . " (ID: <strong>" . $newtplid . "</strong>)";
                                     // generate compiled file
-                                    include_once XOOPS_ROOT_PATH . '/class/template.php';
                                     if (!xoops_template_touch($newtplid)) {
                                         $msgs[] = '  <span style="color:#ff0000;">' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_COMPILED_FAILED, "<strong>" . $block['template'] . "</strong>") . "</span>";
 
@@ -483,7 +480,6 @@
     /* @var $module_handler XoopsModuleHandler */
     $module_handler = xoops_gethandler('module');
     $module = $module_handler->getByDirname($dirname);
-    include_once XOOPS_ROOT_PATH . '/class/template.php';
     xoops_template_clear_module_cache($module->getVar('mid'));
     if ($module->getVar('dirname') == 'system') {
         return "<p>" . sprintf(_AM_SYSTEM_MODULES_FAILUNINS, "<strong>" . $module->getVar('name') . "</strong>") . " " . _AM_SYSTEM_MODULES_ERRORSC . "<br /> - " . _AM_SYSTEM_MODULES_SYSNO . "</p>";
@@ -662,7 +658,6 @@
     /* @var $block_handler XoopsBlockHandler */
     $block_handler = xoops_getHandler('block');
     $module = $module_handler->getById($mid);
-    include_once XOOPS_ROOT_PATH . '/class/template.php';
     xoops_template_clear_module_cache($module->getVar('mid'));
     // Display header
     $msgs[] = '<div id="xo-module-log">';
@@ -693,7 +688,6 @@
     /* @var $module_handler XoopsModuleHandler */
     $module_handler = xoops_gethandler('module');
     $module = $module_handler->getById($mid);
-    include_once XOOPS_ROOT_PATH . '/class/template.php';
     xoops_template_clear_module_cache($mid);
     // Display header
     $msgs[] = '<div id="xo-module-log">';
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin/advisory.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin/advisory.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin/advisory.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -1,6 +1,6 @@
 <?php
 
-$db = Database::getInstance() ;
+$db = XoopsDatabaseFactory::getDatabaseConnection();
 
 // beggining of Output
 xoops_cp_header();
@@ -90,7 +90,7 @@
 
 // patch to databasefactory.php
 echo "<dl><dt>'databasefactory.php' : " ;
-$db = Database::getInstance() ;
+$db = XoopsDatabaseFactory::getDatabaseConnection();
 if( strtolower( get_class( $db ) ) != 'protectormysqldatabase' ) {
 	echo "<span style='color:red;font-weight:bold;'>"._AM_ADV_DBFACTORYUNPATCHED."</span></dt>\n" ;
 } else {
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin/index.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin/index.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin/index.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -3,7 +3,7 @@
 require_once XOOPS_ROOT_PATH.'/class/pagenav.php' ;
 require_once dirname(dirname(__FILE__)).'/class/gtickets.php' ;
 $myts = MyTextSanitizer::getInstance() ;
-$db = Database::getInstance() ;
+$db = XoopsDatabaseFactory::getDatabaseConnection();
 
 // GET vars
 $pos = empty( $_GET[ 'pos' ] ) ? 0 : intval( $_GET[ 'pos' ] ) ;
@@ -14,7 +14,7 @@
 
 // Protector object
 require_once dirname(dirname(__FILE__)).'/class/protector.php' ;
-$db = Database::getInstance() ;
+$db = XoopsDatabaseFactory::getDatabaseConnection();
 $protector = Protector::getInstance( $db->conn ) ;
 $conf = $protector->getConf() ;
 
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin/prefix_manager.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin/prefix_manager.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin/prefix_manager.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -1,7 +1,7 @@
 <?php
 
 require_once dirname(dirname(__FILE__)).'/class/gtickets.php' ;
-$db = Database::getInstance() ;
+$db = XoopsDatabaseFactory::getDatabaseConnection();
 
 // COPY TABLES
 if( ! empty( $_POST['copy'] ) && ! empty( $_POST['old_prefix'] ) ) {
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/admin.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -12,7 +12,6 @@
 $mytrustdirpath = dirname( __FILE__ ) ;
 
 // environment
-require_once XOOPS_ROOT_PATH.'/class/template.php' ;
 $module_handler = xoops_gethandler( 'module' ) ;
 $xoopsModule = $module_handler->getByDirname( $mydirname ) ;
 $config_handler = xoops_gethandler( 'config' ) ;
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/include/postcheck_functions.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/include/postcheck_functions.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/include/postcheck_functions.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -22,7 +22,7 @@
 
 	// Protector object
 	require_once dirname(dirname(__FILE__)).'/class/protector.php' ;
-	$db = Database::getInstance() ;
+	$db = XoopsDatabaseFactory::getDatabaseConnection();
 	$protector = Protector::getInstance() ;
 	$protector->setConn( $db->conn ) ;
 	$protector->updateConfFromDb() ;
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/notification.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/notification.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/notification.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -21,7 +21,7 @@
 {
 	include_once dirname(__FILE__).'/include/common_functions.php' ;
 
-	$db = Database::getInstance() ;
+	$db = XoopsDatabaseFactory::getDatabaseConnection();
 
 	$module_handler = xoops_gethandler( 'module' ) ;
 	$module = $module_handler->getByDirname( $mydirname ) ;
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/oninstall.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/oninstall.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/oninstall.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -28,7 +28,7 @@
 		if( ! is_array( $ret ) ) $ret = array() ;
 	}
 
-	$db = Database::getInstance() ;
+	$db = XoopsDatabaseFactory::getDatabaseConnection();
 	$mid = $module->getVar('mid') ;
 
 	// TABLES (loading mysql.sql)
@@ -94,7 +94,6 @@
 					$tplid = $tplfile->getVar( 'tpl_id' ) ;
 					$ret[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)<br />';
 					// generate compiled file
-					include_once XOOPS_ROOT_PATH.'/class/template.php' ;
 					if( ! xoops_template_touch( $tplid ) ) {
 						$ret[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b>.</span><br />';
 					} else {
@@ -105,7 +104,6 @@
 		}
 		closedir( $handler ) ;
 	}
-	include_once XOOPS_ROOT_PATH.'/class/template.php' ;
 	xoops_template_clear_module_cache( $mid ) ;
 
 	return true ;
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/onuninstall.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/onuninstall.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/onuninstall.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -28,7 +28,7 @@
 		if( ! is_array( $ret ) ) $ret = array() ;
 	}
 
-	$db = Database::getInstance() ;
+	$db = XoopsDatabaseFactory::getDatabaseConnection();
 	$mid = $module->getVar('mid') ;
 
 	// TABLES (loading mysql.sql)
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/onupdate.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/onupdate.php	2011-10-26 19:29:35 UTC (rev 7978)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/modules/protector/onupdate.php	2011-10-26 19:45:09 UTC (rev 7979)
@@ -28,7 +28,7 @@
 		if( ! is_array( $msgs ) ) $msgs = array() ;
 	}
 
-	$db = Database::getInstance() ;
+	$db = XoopsDatabaseFactory::getDatabaseConnection();
 	$mid = $module->getVar('mid') ;
 
 	// TABLES (write here ALTER TABLE etc. if necessary)
@@ -78,7 +78,6 @@
 					$tplid = $tplfile->getVar( 'tpl_id' ) ;
 					$msgs[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)';
 					// generate compiled file
-					include_once XOOPS_ROOT_PATH.'/class/template.php' ;
 					if( ! xoops_template_touch( $tplid ) ) {
 						$msgs[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b>.</span>';
 					} else {
@@ -89,7 +88,6 @@
 		}
 		closedir( $handler ) ;
 	}
-	include_once XOOPS_ROOT_PATH.'/class/template.php' ;
 	xoops_template_clear_module_cache( $mid ) ;
 
 	return true ;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |