• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP xoops_template_clear_module_cache函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中xoops_template_clear_module_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP xoops_template_clear_module_cache函数的具体用法?PHP xoops_template_clear_module_cache怎么用?PHP xoops_template_clear_module_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了xoops_template_clear_module_cache函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: xpress_templates_make

function xpress_templates_make($mid, $mydirname)
{
    $msgs = array();
    // TEMPLATES
    $tplfile_handler =& xoops_gethandler('tplfile');
    $tpl_path = XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/templates';
    //copy  template file from source
    if ($handler = @opendir($tpl_path . '/source/')) {
        while (($file = readdir($handler)) !== false) {
            if (substr($file, 0, 1) == '.') {
                continue;
            }
            if (!is_template($file)) {
                continue;
            }
            $file_path = $tpl_path . '/source/' . $file;
            if (is_file($file_path)) {
                $target_file_name = $mydirname . '_' . $file;
                $target_file_path = $tpl_path . '/' . $target_file_name;
                $rcd = @unlink($target_file_path);
                if ($mydirname != 'xpress') {
                    //old version file delete
                    $rcd = @unlink($tpl_path . '/xpress' . $file);
                }
                //				$rcd = rename($file_path, $target_file_path);
                $rcd = copy($file_path, $target_file_path);
                if ($rcd) {
                    $msgs[] = 'Template <b>' . htmlspecialchars($target_file_path) . '</b> copy from ' . htmlspecialchars($file) . '<br />';
                } else {
                    $msgs[] = '<span style="color:#ff0000;">ERROR: Could not copy template <b>' . htmlspecialchars($target_file_name) . '</b> from ' . htmlspecialchars($file) . '(check templates directory permision (777))</span><br />';
                }
            }
        }
        closedir($handler);
    }
    // template added to the database.
    if ($handler = @opendir($tpl_path . '/')) {
        while (($file = readdir($handler)) !== false) {
            if (substr($file, 0, 1) == '.') {
                continue;
            }
            $file_path = $tpl_path . '/' . $file;
            $file_name = $file;
            $pattern = '^' . $mydirname . '_';
            if (preg_match('/' . $pattern . '/', $file_name, $match)) {
                if (is_file($file_path)) {
                    $msgs[] = xpress_create_db_template($file_name, $file_path, $mydirname, $mid);
                }
            }
        }
        closedir($handler);
    }
    include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
    include_once XOOPS_ROOT_PATH . '/class/template.php';
    xoops_template_clear_module_cache($mid);
    return $msgs;
}
开发者ID:nouphet,项目名称:rata,代码行数:57,代码来源:xpress_templates_make.php


示例2: xpwiki_oninstall_base


//.........这里部分代码省略.........
     $db =& Database::getInstance();
     $mid = $module->getVar('mid');
     // TABLES (loading mysql.sql)
     $sql_file_path = dirname(__FILE__) . '/sql/mysql.sql';
     $prefix_mod = $db->prefix() . '_' . $mydirname;
     if (file_exists($sql_file_path)) {
         $ret[] = "SQL file found at <b>" . htmlspecialchars($sql_file_path) . "</b>.<br /> Creating tables...";
         if (is_file(XOOPS_ROOT_PATH . '/class/database/oldsqlutility.php')) {
             include_once XOOPS_ROOT_PATH . '/class/database/oldsqlutility.php';
             $sqlutil =& new OldSqlUtility();
         } else {
             include_once XOOPS_ROOT_PATH . '/class/database/sqlutility.php';
             $sqlutil =& new SqlUtility();
         }
         $sql_query = trim(file_get_contents($sql_file_path));
         // [ MySQL Version >= 5 ] BLOB and TEXT columns cannot be assigned a default value.
         $mysql_ver = mysql_get_server_info();
         if (@$mysql_ver[0] >= 5) {
             $sql_query = str_replace(' default \'\'', '', $sql_query);
         }
         // [ MySQL Version >= 4 ] ENGINE is the preferred term from MySQL 4.0.18 on and TYPE is deprecated.
         if (@$mysql_ver[0] >= 4) {
             $sql_query = str_replace(' TYPE=MyISAM', ' ENGINE=MyISAM', $sql_query);
         }
         $sqlutil->splitMySqlFile($pieces, $sql_query);
         $created_tables = array();
         foreach ($pieces as $piece) {
             $prefixed_query = $sqlutil->prefixQuery($piece, $prefix_mod);
             if (!$prefixed_query) {
                 $ret[] = "Invalid SQL <b>" . htmlspecialchars($piece) . "</b><br />";
                 return false;
             }
             if (!$db->query($prefixed_query[0])) {
                 $ret[] = '<b>' . htmlspecialchars($db->error()) . '</b><br />';
                 //var_dump( $db->error() ) ;
                 return false;
             } else {
                 if (!in_array($prefixed_query[4], $created_tables)) {
                     $ret[] = 'Table <b>' . htmlspecialchars($prefix_mod . '_' . $prefixed_query[4]) . '</b> created.<br />';
                     $created_tables[] = $prefixed_query[4];
                 } else {
                     $ret[] = 'Data inserted to table <b>' . htmlspecialchars($prefix_mod . '_' . $prefixed_query[4]) . '</b>.</br />';
                 }
             }
         }
     }
     // TEMPLATES
     $tplfile_handler =& xoops_gethandler('tplfile');
     $tpl_path = dirname(__FILE__) . '/templates';
     if ($handler = @opendir($tpl_path . '/')) {
         while (($file = readdir($handler)) !== false) {
             if (substr($file, 0, 1) == '.') {
                 continue;
             }
             $file_path = $tpl_path . '/' . $file;
             if (is_file($file_path) && substr($file, -5) == '.html') {
                 $mtime = intval(@filemtime($file_path));
                 $tplfile =& $tplfile_handler->create();
                 $tplfile->setVar('tpl_source', file_get_contents($file_path), true);
                 $tplfile->setVar('tpl_refid', $mid);
                 $tplfile->setVar('tpl_tplset', 'default');
                 $tplfile->setVar('tpl_file', $mydirname . '_' . $file);
                 $tplfile->setVar('tpl_desc', '', true);
                 $tplfile->setVar('tpl_module', $mydirname);
                 $tplfile->setVar('tpl_lastmodified', $mtime);
                 $tplfile->setVar('tpl_lastimported', 0);
                 $tplfile->setVar('tpl_type', 'module');
                 if (!$tplfile_handler->insert($tplfile)) {
                     $ret[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>' . htmlspecialchars($mydirname . '_' . $file) . '</b> to the database.</span><br />';
                 } else {
                     $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/xoopsblock.php';
                     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 {
                         $ret[] = 'Template <b>' . htmlspecialchars($mydirname . '_' . $file) . '</b> compiled.</span><br />';
                     }
                 }
             }
         }
         closedir($handler);
     }
     include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
     include_once XOOPS_ROOT_PATH . '/class/template.php';
     xoops_template_clear_module_cache($mid);
     // xpWiki original functions
     include_once dirname(__FILE__) . '/include/check.func.php';
     $_ret = xpwikifunc_permission_check($mydirname);
     if (!$_ret) {
         $ret = array_merge($ret, xpwikifunc_defdata_check($mydirname));
     } else {
         $GLOBALS['XpWikiMsg'] = $_ret;
         $ret = array_merge($ret, $_ret);
         return false;
     }
     return true;
 }
开发者ID:nouphet,项目名称:rata,代码行数:101,代码来源:oninstall.php


示例3: AMS_updateCache

/**
 * Remove module's cache
 *
 * @package AMS
 * @author Instant Zero (http://xoops.instant-zero.com)
 * @copyright (c) Instant Zero
*/
function AMS_updateCache()
{
    global $xoopsModule;
    if (!isset($xoopsModule) || $xoopsModule->getVar('dirname') != "AMS") {
        $mod_handler =& xoops_gethandler('module');
        $amsModule =& $mod_handler->getByDirname('AMS');
    } else {
        $amsModule =& $xoopsModule;
    }
    $folder = $amsModule->getVar('dirname');
    $tpllist = array();
    include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
    include_once XOOPS_ROOT_PATH . '/class/template.php';
    $tplfile_handler =& xoops_gethandler('tplfile');
    $tpllist = $tplfile_handler->find(null, null, null, $folder);
    $xoopsTpl = new XoopsTpl();
    xoops_template_clear_module_cache($amsModule->getVar('mid'));
    // Clear module's blocks cache
    //remove RSS cache (XOOPS, ImpressCMS)
    $files_del = array();
    $files_del = glob(XOOPS_CACHE_PATH . '/*system_rss*');
    if (count($files_del) > 0) {
        foreach ($files_del as $one_file) {
            unlink($one_file);
        }
    }
    $files_del = array();
    $files_del = glob(XOOPS_COMPILE_PATH . '/*system_rss*');
    if (count($files_del) > 0) {
        foreach ($files_del as $one_file) {
            unlink($one_file);
        }
    }
    $files_del = array();
    $files_del = glob($xoopsTpl->cache_dir . '/*system_rss*');
    if (count($files_del) > 0) {
        foreach ($files_del as $one_file) {
            unlink($one_file);
        }
    }
    //remove RSS cache (XOOPS CUBE)
    $files_del = array();
    $files_del = glob(XOOPS_CACHE_PATH . '/*legacy_rss*');
    if (count($files_del) > 0) {
        foreach ($files_del as $one_file) {
            unlink($one_file);
        }
    }
    $files_del = array();
    $files_del = glob(XOOPS_COMPILE_PATH . '/*legacy_rss*');
    if (count($files_del) > 0) {
        foreach ($files_del as $one_file) {
            unlink($one_file);
        }
    }
    $files_del = array();
    $files_del = glob($xoopsTpl->cache_dir . '/*legacy_rss*');
    if (count($files_del) > 0) {
        foreach ($files_del as $one_file) {
            unlink($one_file);
        }
    }
    // Remove cache for each page.
    foreach ($tpllist as $onetemplate) {
        if ($onetemplate->getVar('tpl_type') == 'module') {
            // Note, I've been testing all the other methods (like the one of Smarty) and none of them run, that's why I have used this code
            $files_del = array();
            $files_del = glob(XOOPS_CACHE_PATH . '/*' . $onetemplate->getVar('tpl_file') . '*');
            if (count($files_del) > 0) {
                foreach ($files_del as $one_file) {
                    unlink($one_file);
                }
            }
            $files_del = array();
            $files_del = glob(XOOPS_COMPILE_PATH . '/*' . $onetemplate->getVar('tpl_file') . '*');
            if (count($files_del) > 0) {
                foreach ($files_del as $one_file) {
                    unlink($one_file);
                }
            }
            $files_del = array();
            $files_del = glob($xoopsTpl->cache_dir . '/*' . $onetemplate->getVar('tpl_file') . '*');
            if (count($files_del) > 0) {
                foreach ($files_del as $one_file) {
                    unlink($one_file);
                }
            }
        }
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:97,代码来源:functions.inc.php


示例4: xoops_module_deactivate

function xoops_module_deactivate($mid)
{
    global $xoopsConfig;
    $module_handler =& xoops_gethandler('module');
    $module =& $module_handler->get($mid);
    include_once XOOPS_ROOT_PATH . '/class/template.php';
    xoops_template_clear_module_cache($mid);
    $module->setVar('isactive', 0);
    if ($module->getVar('dirname') == "system") {
        return "<p>" . sprintf(_MD_AM_FAILDEACT, "<b>" . $module->getVar('name') . "</b>") . "&nbsp;" . _MD_AM_ERRORSC . "<br /> - " . _MD_AM_SYSNO . "</p>";
    } elseif ($module->getVar('dirname') == $xoopsConfig['startpage']) {
        return "<p>" . sprintf(_MD_AM_FAILDEACT, "<b>" . $module->getVar('name') . "</b>") . "&nbsp;" . _MD_AM_ERRORSC . "<br /> - " . _MD_AM_STRTNO . "</p>";
    } else {
        if (!$module_handler->insert($module)) {
            $ret = "<p>" . sprintf(_MD_AM_FAILDEACT, "<b>" . $module->getVar('name') . "</b>") . "&nbsp;" . _MD_AM_ERRORSC . "<br />" . $module->getHtmlErrors();
            return $ret . "</p>";
        }
        $blocks =& XoopsBlock::getByModule($module->getVar('mid'));
        $bcount = count($blocks);
        for ($i = 0; $i < $bcount; $i++) {
            $blocks[$i]->setVar('isactive', 0);
            $blocks[$i]->store();
        }
        return "<p>" . sprintf(_MD_AM_OKDEACT, "<b>" . $module->getVar('name') . "</b>") . "</p>";
    }
}
开发者ID:koki-h,项目名称:xoops_utf8,代码行数:26,代码来源:modulesadmin.php


示例5: icms_module_update

function icms_module_update($dirname)
{
    $dirname = trim($dirname);
    $db =& icms_db_Factory::instance();
    $module_handler = icms::handler('icms_module');
    $module =& $module_handler->getByDirname($dirname);
    // Save current version for use in the update function
    $prev_version = $module->getVar('version');
    $prev_dbversion = $module->getVar('dbversion');
    xoops_template_clear_module_cache($module->getVar('mid'));
    // we dont want to change the module name set by admin
    $temp_name = $module->getVar('name');
    $module->loadInfoAsVar($dirname);
    $module->setVar('name', $temp_name);
    if (!$module_handler->insert($module)) {
        echo '<p>Could not update ' . $module->getVar('name') . '</p>';
        echo "<br /><a href='admin.php?fct=modulesadmin'>" . _MD_AM_BTOMADMIN . "</a>";
    } else {
        $newmid = $module->getVar('mid');
        $msgs = array();
        $msgs[] = _MD_AM_MOD_DATA_UPDATED;
        $tplfile_handler =& icms::handler('icms_view_template_file');
        $deltpl =& $tplfile_handler->find('default', 'module', $module->getVar('mid'));
        $delng = array();
        if (is_array($deltpl)) {
            $xoopsDelTpl = new icms_view_Tpl();
            // clear cache files
            $xoopsDelTpl->clear_cache(null, 'mod_' . $dirname);
            // delete template file entry in db
            $dcount = count($deltpl);
            for ($i = 0; $i < $dcount; $i++) {
                if (!$tplfile_handler->delete($deltpl[$i])) {
                    $delng[] = $deltpl[$i]->getVar('tpl_file');
                }
            }
        }
        $templates = $module->getInfo('templates');
        if ($templates != false) {
            $msgs[] = _MD_AM_MOD_UP_TEM;
            foreach ($templates as $tpl) {
                $tpl['file'] = trim($tpl['file']);
                if (!in_array($tpl['file'], $delng)) {
                    $tpldata =& xoops_module_gettemplate($dirname, $tpl['file']);
                    $tplfile =& $tplfile_handler->create();
                    $tplfile->setVar('tpl_refid', $newmid);
                    $tplfile->setVar('tpl_lastimported', 0);
                    $tplfile->setVar('tpl_lastmodified', time());
                    if (preg_match("/\\.css\$/i", $tpl['file'])) {
                        $tplfile->setVar('tpl_type', 'css');
                    } else {
                        $tplfile->setVar('tpl_type', 'module');
                    }
                    $tplfile->setVar('tpl_source', $tpldata, true);
                    $tplfile->setVar('tpl_module', $dirname);
                    $tplfile->setVar('tpl_tplset', 'default');
                    $tplfile->setVar('tpl_file', $tpl['file'], true);
                    $tplfile->setVar('tpl_desc', $tpl['description'], true);
                    if (!$tplfile_handler->insert($tplfile)) {
                        $msgs[] = sprintf('&nbsp;&nbsp;<span style="color:#ff0000;">' . _MD_AM_TEMPLATE_INSERT_FAIL . '</span>', '<strong>' . $tpl['file'] . '</strong>');
                    } else {
                        $newid = $tplfile->getVar('tpl_id');
                        $msgs[] = sprintf('&nbsp;&nbsp;<span>' . _MD_AM_TEMPLATE_INSERTED . '</span>', '<strong>' . $tpl['file'] . '</strong>', '<strong>' . $newid . '</strong>');
                        if ($icmsConfig['template_set'] == 'default') {
                            if (!icms_view_Tpl::template_touch($newid)) {
                                $msgs[] = sprintf('&nbsp;&nbsp;<span style="color:#ff0000;">' . _MD_AM_TEMPLATE_RECOMPILE_FAIL . '</span>', '<strong>' . $tpl['file'] . '</strong>');
                            } else {
                                $msgs[] = sprintf('&nbsp;&nbsp;<span>' . _MD_AM_TEMPLATE_RECOMPILED . '</span>', '<strong>' . $tpl['file'] . '</strong>');
                            }
                        }
                    }
                    unset($tpldata);
                } else {
                    $msgs[] = sprintf('&nbsp;&nbsp;<span style="color:#ff0000;">' . _MD_AM_TEMPLATE_DELETE_FAIL . '</span>', $tpl['file']);
                }
            }
        }
        $blocks = $module->getInfo('blocks');
        $msgs[] = _MD_AM_MOD_REBUILD_BLOCKS;
        if ($blocks != false) {
            $count = count($blocks);
            $showfuncs = array();
            $funcfiles = array();
            for ($i = 1; $i <= $count; $i++) {
                if (isset($blocks[$i]['show_func']) && $blocks[$i]['show_func'] != '' && isset($blocks[$i]['file']) && $blocks[$i]['file'] != '') {
                    $editfunc = isset($blocks[$i]['edit_func']) ? $blocks[$i]['edit_func'] : '';
                    $showfuncs[] = $blocks[$i]['show_func'];
                    $funcfiles[] = $blocks[$i]['file'];
                    $template = '';
                    if (isset($blocks[$i]['template']) && trim($blocks[$i]['template']) != '') {
                        $content =& xoops_module_gettemplate($dirname, $blocks[$i]['template'], true);
                    }
                    if (!$content) {
                        $content = '';
                    } else {
                        $template = $blocks[$i]['template'];
                    }
                    $options = '';
                    if (!empty($blocks[$i]['options'])) {
                        $options = $blocks[$i]['options'];
                    }
//.........这里部分代码省略.........
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:101,代码来源:modulesadmin.php


示例6: nw_updateCache

/**
 * Remove module's cache
 *
 * @package News
 * @author Instant Zero (http://xoops.instant-zero.com)
 * @copyright (c) Instant Zero
*/
function nw_updateCache() {
	global $xoopsModule;
	$folder = $xoopsModule->getVar('dirname');
	$tpllist = array();
	include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';
	include_once XOOPS_ROOT_PATH.'/class/template.php';
	$tplfile_handler =& xoops_gethandler('tplfile');
	$tpllist = $tplfile_handler->find(null, null, null, $folder);
	$xoopsTpl = new XoopsTpl();
	xoops_template_clear_module_cache($xoopsModule->getVar('mid'));			// Clear module's blocks cache

	// Remove cache for each page.
	foreach ($tpllist as $onetemplate) {
		if( $onetemplate->getVar('tpl_type') == 'module' ) {
			// Note, I've been testing all the other methods (like the one of Smarty) and none of them run, that's why I have used this code
			$files_del = array();
			$files_del = glob(XOOPS_CACHE_PATH.'/*'.$onetemplate->getVar('tpl_file').'*');
			if(count($files_del) >0) {
				foreach($files_del as $one_file) {
					unlink($one_file);
				}
			}
		}
	}
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:32,代码来源:functions.php


示例7: insert

 /**
  * Updates or inserts the module's data, templates, blocks, configuration categories and items and profile fields
  *
  * @return string
  */
 function insert()
 {
     $this->setVar('last_update', time());
     $module_handler =& xoops_gethandler('module');
     if (!$module_handler->insert($this)) {
         $this->setErrors('Could not insert <b>' . $this->getVar('name') . '</b> to database.');
         $ret = "<p>" . sprintf(_MD_AM_FAILINS, "<b>" . $this->name() . "</b>") . "&nbsp;" . _MD_AM_ERRORSC . "<br />";
         foreach ($this->getErrors() as $err) {
             $ret .= " - " . $err . "<br />";
         }
         $ret .= "</p>";
         return $ret;
     }
     $this->setMessage('Module data inserted successfully. Module ID: <b>' . $this->getVar('mid') . '</b>');
     $this->insertTemplates();
     include_once XOOPS_ROOT_PATH . '/class/template.php';
     xoops_template_clear_module_cache($this->getVar('mid'));
     $this->insertBlocks();
     $this->insertConfigCategories();
     $this->insertConfig();
     $this->insertProfileFields();
     return "";
 }
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:28,代码来源:module.php


示例8: updateCache

/**
 * Remove module's cache
 *
 * @package News
 * @author Hervé Thouzard (www.herve-thouzard.com)
 * @copyright (c) The Xoops Project - www.xoops.org
*/
function updateCache()
{
    global $xoopsModule;
    $tpllist = array('news_item.html', 'news_archive.html', 'news_article.html', 'news_index.html', 'news_by_topic.html', 'news_by_this_author.html', 'news_ratenews.html', 'news_rss.html');
    include_once XOOPS_ROOT_PATH . "/class/xoopsblock.php";
    include_once XOOPS_ROOT_PATH . '/class/template.php';
    // Clear blocks cache
    xoops_template_clear_module_cache($xoopsModule->getVar('mid'));
    // Clear pages cache
    $xoopsTpl = new XoopsTpl();
    foreach ($tpllist as $onetemplate) {
        $xoopsTpl->clear_cache('db:' . $onetemplate);
    }
}
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:21,代码来源:functions.php


示例9: xoops_module_deactivate

function xoops_module_deactivate($mid)
{
    global $xoopsConfig;
    $module_handler =& xoops_gethandler('module');
    $module =& $module_handler->get($mid);
    include_once XOOPS_ROOT_PATH . '/class/template.php';
    xoops_template_clear_module_cache($mid);
    $module->setVar('isactive', 0);
    if ($module->getVar('dirname') == "system") {
        return "<p>" . sprintf(_MD_AM_FAILDEACT, "<b>" . $module->getVar('name') . "</b>") . "&nbsp;" . _MD_AM_ERRORSC . "<br /> - " . _MD_AM_SYSNO . "</p>";
    } elseif ($module->getVar('dirname') == $xoopsConfig['startpage']) {
        return "<p>" . sprintf(_MD_AM_FAILDEACT, "<b>" . $module->getVar('name') . "</b>") . "&nbsp;" . _MD_AM_ERRORSC . "<br /> - " . _MD_AM_STRTNO . "</p>";
    } else {
        if (!$module_handler->insert($module)) {
            $ret = "<p>" . sprintf(_MD_AM_FAILDEACT, "<b>" . $module->getVar('name') . "</b>") . "&nbsp;" . _MD_AM_ERRORSC . "<br />" . $module->getHtmlErrors();
            return $ret . "</p>";
        }
        $block_handler =& xoops_gethandler('block');
        $block_handler->updateAll('isactive', 1, new Criteria('mid', $mid));
        return "<p>" . sprintf(_MD_AM_OKDEACT, "<b>" . $module->getVar('name') . "</b>") . "</p>";
    }
}
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:22,代码来源:modulesadmin.php


示例10: pico_onupdate_base


//.........这里部分代码省略.........
     }
     // 0.2 -> 0.9
     $check_sql = "SELECT cat_vpath FROM " . $db->prefix($mydirname . "_categories");
     if (!$db->query($check_sql)) {
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_categories") . " ADD   `cat_vpath` varchar(255) AFTER `cat_id`, ADD UNIQUE KEY (`cat_vpath`)");
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_contents") . " ADD   `vpath` varchar(255) AFTER `content_id`, ADD UNIQUE KEY (`vpath`)");
     }
     // 0.9 -> 0.95
     $check_sql = "SELECT cat_vpath_mtime FROM " . $db->prefix($mydirname . "_categories");
     if (!$db->query($check_sql)) {
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_categories") . " ADD cat_created_time int(10) NOT NULL default 0, ADD cat_modified_time int(10) NOT NULL default 0, ADD cat_vpath_mtime int(10) NOT NULL default 0");
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_contents") . " MODIFY weight smallint(5) NOT NULL default 0");
     }
     // 1.0 -> 1.1/1.2
     $check_sql = "SELECT COUNT(*) FROM " . $db->prefix($mydirname . "_content_histories");
     if (!$db->query($check_sql)) {
         $db->queryF("CREATE TABLE " . $db->prefix($mydirname . "_content_histories") . " ( content_history_id int(10) unsigned NOT NULL auto_increment, content_id int(10) unsigned NOT NULL default 0, vpath varchar(255), cat_id smallint(5) unsigned NOT NULL default 0, created_time int(10) NOT NULL default 0, modified_time int(10) NOT NULL default 0, poster_uid mediumint(8) unsigned NOT NULL default 0, poster_ip varchar(15) NOT NULL default '', modifier_uid mediumint(8) unsigned NOT NULL default 0, modifier_ip varchar(15) NOT NULL default '', subject varchar(255) NOT NULL default '', htmlheader mediumtext, body mediumtext, filters text, PRIMARY KEY (content_history_id), KEY (content_id), KEY (created_time), KEY (modified_time), KEY (modifier_uid) ) TYPE=MyISAM");
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_contents") . " MODIFY htmlheader mediumtext, MODIFY htmlheader_waiting mediumtext, MODIFY body mediumtext, MODIFY body_waiting mediumtext, MODIFY body_cached mediumtext");
     }
     // 1.1/1.2 -> 1.3/1.4
     $check_sql = "SELECT cat_redundants FROM " . $db->prefix($mydirname . "_categories");
     if (!$db->query($check_sql)) {
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_categories") . " MODIFY cat_id smallint(5) unsigned NOT NULL, ADD cat_redundants text AFTER cat_vpath_mtime");
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_contents") . " ADD comments_count int(10) unsigned NOT NULL default 0 AFTER votes_count");
         $db->queryF("INSERT INTO " . $db->prefix($mydirname . "_categories") . " (cat_id,pid,cat_title) VALUES (0,0xffff,'TOP')");
     }
     // 1.3/1.4 -> 1.5/1.6
     $check_sql = "SELECT COUNT(*) FROM " . $db->prefix($mydirname . "_content_extras");
     if (!$db->query($check_sql)) {
         $db->queryF("CREATE TABLE " . $db->prefix($mydirname . "_content_extras") . " ( content_extra_id int(10) unsigned NOT NULL auto_increment, content_id int(10) unsigned NOT NULL default 0, extra_type varchar(255) NOT NULL default '', created_time int(10) NOT NULL default 0, modified_time int(10) NOT NULL default 0, data mediumtext, PRIMARY KEY (content_extra_id), KEY (content_id), KEY (extra_type), KEY (created_time) ) TYPE=MyISAM");
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_contents") . " ADD `locked` tinyint(1) NOT NULL default 0 AFTER subject_waiting, ADD `redundants` text AFTER filters");
     }
     $check_sql = "SHOW CREATE TABLE " . $db->prefix($mydirname . "_content_histories");
     list(, $create_sql) = $db->fetchRow($db->queryF($check_sql));
     if (stristr($create_sql, '`body` text')) {
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_content_histories") . " MODIFY `htmlheader` mediumtext, MODIFY `body` mediumtext");
     }
     $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_categories") . " MODIFY `cat_redundants` mediumtext");
     // 1.5/1.6 -> 1.7/1.8
     $check_sql = "SELECT cat_permission_id FROM " . $db->prefix($mydirname . "_categories");
     if (!$db->query($check_sql)) {
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_contents") . " ADD permission_id int(10) unsigned NOT NULL default 0 AFTER `content_id`, ADD expiring_time int(10) NOT NULL default 0x7fffffff AFTER `modified_time`, ADD last_cached_time int(10) NOT NULL default 0 AFTER `modified_time`, ADD `extra_fields` mediumtext AFTER `filters`, ADD `for_search` mediumtext AFTER `redundants`, MODIFY `redundants` mediumtext, ADD `tags` text AFTER `filters`, ADD KEY (`modified_time`), ADD KEY (`expiring_time`), ADD KEY (`permission_id`)");
         $db->queryF("UPDATE " . $db->prefix($mydirname . "_contents") . " SET `expiring_time`=0x7fffffff");
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_content_histories") . " ADD tags text, ADD extra_fields mediumtext");
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_categories") . " ADD `cat_permission_id` int(10) unsigned NOT NULL AFTER `cat_id`, ADD KEY (`cat_permission_id`)");
         $db->queryF("UPDATE " . $db->prefix($mydirname . "_categories") . " SET `cat_permission_id`=`cat_id`");
         $db->queryF("CREATE TABLE " . $db->prefix($mydirname . "_tags") . " ( label varchar(255) NOT NULL default '', weight int(10) unsigned NOT NULL default 0, count int(10) unsigned NOT NULL default 0, content_ids mediumtext, created_time int(10) NOT NULL default 0, modified_time int(10) NOT NULL default 0, PRIMARY KEY (label), KEY (count), KEY (weight), KEY (created_time) ) TYPE=MyISAM");
     }
     // 1.7/1.8 -> 1.9/2.0 (1)
     $check_sql = "SELECT * FROM " . $db->prefix($mydirname . "_content_ef_sortables");
     if (!$db->query($check_sql)) {
         $db->queryF("ALTER TABLE " . $db->prefix($mydirname . "_categories") . " ADD `cat_extra_fields` mediumtext AFTER `cat_vpath_mtime`;");
         $db->queryF("CREATE TABLE " . $db->prefix($mydirname . "_content_ef_sortables") . " ( content_id int(10) unsigned NOT NULL default 0, ef0 char(64) NOT NULL default '', ef1 char(64) NOT NULL default '', ef2 char(64) NOT NULL default '', ef3 char(64) NOT NULL default '', ef4 char(64) NOT NULL default '', ef5 char(64) NOT NULL default '', ef6 char(64) NOT NULL default '', ef7 char(64) NOT NULL default '', ef8 char(64) NOT NULL default '', ef9 char(64) NOT NULL default '', KEY (ef0), KEY (ef1), KEY (ef2), KEY (ef3), KEY (ef4), KEY (ef5), KEY (ef6), KEY (ef7), KEY (ef8), KEY (ef9), PRIMARY KEY (content_id) ) TYPE=MyISAM");
     }
     // 1.7/1.8 -> 1.9/2.0 (2)
     // content_histories ...
     // TEMPLATES (all templates have been already removed by modulesadmin)
     $tplfile_handler =& xoops_gethandler('tplfile');
     $tpl_path = dirname(__FILE__) . '/templates';
     if ($handler = @opendir($tpl_path . '/')) {
         while (($file = readdir($handler)) !== false) {
             if (substr($file, 0, 1) == '.') {
                 continue;
             }
             $file_path = $tpl_path . '/' . $file;
             if (is_file($file_path)) {
                 $mtime = intval(@filemtime($file_path));
                 $tplfile =& $tplfile_handler->create();
                 $tplfile->setVar('tpl_source', file_get_contents($file_path), true);
                 $tplfile->setVar('tpl_refid', $mid);
                 $tplfile->setVar('tpl_tplset', 'default');
                 $tplfile->setVar('tpl_file', $mydirname . '_' . $file);
                 $tplfile->setVar('tpl_desc', '', true);
                 $tplfile->setVar('tpl_module', $mydirname);
                 $tplfile->setVar('tpl_lastmodified', $mtime);
                 $tplfile->setVar('tpl_lastimported', 0);
                 $tplfile->setVar('tpl_type', 'module');
                 if (!$tplfile_handler->insert($tplfile)) {
                     $msgs[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>' . htmlspecialchars($mydirname . '_' . $file) . '</b> to the database.</span>';
                 } else {
                     $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/xoopsblock.php';
                     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 {
                         $msgs[] = 'Template <b>' . htmlspecialchars($mydirname . '_' . $file) . '</b> compiled.</span>';
                     }
                 }
             }
         }
         closedir($handler);
     }
     include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
     include_once XOOPS_ROOT_PATH . '/class/template.php';
     xoops_template_clear_module_cache($mid);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:101,代码来源:onupdate.php


示例11: dbtheme_oninstall_base


//.........这里部分代码省略.........
                     return false;
                 }
                 if (!$db->query($prefixed_query[0])) {
                     $ret[] = '<b>' . htmlspecialchars($db->error()) . '</b><br />';
                     //var_dump( $db->error() ) ;
                     return false;
                 } else {
                     if (!in_array($prefixed_query[4], $created_tables)) {
                         $ret[] = 'Table <b>' . htmlspecialchars($prefix_mod . '_' . $prefixed_query[4]) . '</b> created.<br />';
                         $created_tables[] = $prefixed_query[4];
                     } else {
                         $ret[] = 'Data inserted to table <b>' . htmlspecialchars($prefix_mod . '_' . $prefixed_query[4]) . '</b>.</br />';
                     }
                 }
             }
         }
     }
     // IMPORT THE SELECTED THEME AS THIS MODULE'S TEMPLATES
     $tplfile_handler =& xoops_gethandler('tplfile');
     /*************** BEGIN DBTHEME SPECIFIC PART ******************/
     // set weight=0
     $db->queryF("UPDATE " . $db->prefix("modules") . " SET weight=0 WHERE mid={$mid}");
     // set tpl_path
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($mydirname);
     $config_handler =& xoops_gethandler('config');
     $mod_config =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
     if (file_exists(dirname(__FILE__) . '/templates/theme.html')) {
         $tpl_path = dirname(__FILE__) . '/templates';
     } else {
         if (!empty($mod_config['base_theme'])) {
             $tpl_path = XOOPS_ROOT_PATH . '/themes/' . $mod_config['base_theme'];
         } else {
             $tpl_path = XOOPS_ROOT_PATH . '/themes/' . $GLOBALS['xoopsConfig']['theme_set'];
         }
     }
     /*************** END DBTHEME SPECIFIC PART ******************/
     // TEMPLATES
     //$tplfile_handler =& xoops_gethandler( 'tplfile' ) ;
     //$tpl_path = dirname(__FILE__).'/templates' ;
     if ($handler = @opendir($tpl_path . '/')) {
         while (($file = readdir($handler)) !== false) {
             if (substr($file, 0, 1) == '.') {
                 continue;
             }
             $file_path = $tpl_path . '/' . $file;
             if (is_file($file_path) && in_array(strrchr($file, '.'), array('.html', '.css', '.js'))) {
                 $mtime = intval(@filemtime($file_path));
                 $tplfile =& $tplfile_handler->create();
                 /*************** BEGIN DBTHEME SPECIFIC PART ******************/
                 // modify the theme/css
                 $tpl_source = file_get_contents($file_path);
                 $searches = array();
                 $replacements = array();
                 if (strrchr($file, '.') == '.html') {
                     // CSS hooking
                     $searches[] = '/\\"\\<\\{\\$xoops_imageurl\\}\\>([0-9a-zA-Z_-]+)\\.(css|html|js)\\"/';
                     $replacements[] = '"<{$xoops_url}>/modules/' . $mydirname . '/?template=$1.$2' . '"';
                 } else {
                     if (strrchr($file, '.') == '.css') {
                         // url() hooking
                         $searches[] = '#url\\(\\s*([\\"\']?)([0-9a-z./]{3})#i';
                         $replacements[] = 'url($1<{$xoops_imageurl}>$2';
                     }
                 }
                 $tplfile->setVar('tpl_source', preg_replace($searches, $replacements, $tpl_source));
                 $mtime = time();
                 /*************** END DBTHEME SPECIFIC PART ******************/
                 //				$tplfile->setVar( 'tpl_source' , file_get_contents( $file_path ) , true ) ;
                 $tplfile->setVar('tpl_refid', $mid);
                 $tplfile->setVar('tpl_tplset', 'default');
                 $tplfile->setVar('tpl_file', $mydirname . '_' . $file);
                 $tplfile->setVar('tpl_desc', '', true);
                 $tplfile->setVar('tpl_module', $mydirname);
                 $tplfile->setVar('tpl_lastmodified', $mtime);
                 $tplfile->setVar('tpl_lastimported', 0);
                 $tplfile->setVar('tpl_type', 'module');
                 if (!$tplfile_handler->insert($tplfile)) {
                     $ret[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>' . htmlspecialchars($mydirname . '_' . $file) . '</b> to the database.</span><br />';
                 } else {
                     $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/xoopsblock.php';
                     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 {
                         $ret[] = 'Template <b>' . htmlspecialchars($mydirname . '_' . $file) . '</b> compiled.</span><br />';
                     }
                 }
             }
         }
         closedir($handler);
     }
     include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
     include_once XOOPS_ROOT_PATH . '/class/template.php';
     xoops_template_clear_module_cache($mid);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:101,代码来源:oninstall.php


示例12: dbtheme_onupdate_base

 function dbtheme_onupdate_base($module, $mydirname)
 {
     // transations on module update
     global $msgs;
     // TODO :-D
     // for Cube 2.1
     if (defined('XOOPS_CUBE_LEGACY')) {
         $root =& XCube_Root::getSingleton();
         $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUpdate.' . ucfirst($mydirname) . '.Success', 'dbtheme_message_append_onupdate');
         $msgs = array();
     } else {
         if (!is_array($msgs)) {
             $msgs = array();
         }
     }
     $db =& Database::getInstance();
     $mid = $module->getVar('mid');
     // TABLES (write here ALTER TABLE etc. if necessary)
     // configs (Though I know it is not a recommended way...)
     $check_sql = "SHOW COLUMNS FROM " . $db->prefix("config") . " LIKE 'conf_title'";
     if (($result = $db->query($check_sql)) && ($myrow = $db->fetchArray($result)) && @$myrow['Type'] == 'varchar(30)') {
         $db->queryF("ALTER TABLE " . $db->prefix("config") . " MODIFY `conf_title` varchar(255) NOT NULL default '', MODIFY `conf_desc` varchar(255) NOT NULL default ''");
     }
     // IMPORT THE SELECTED THEME AS THIS MODULE'S TEMPLATES
     $tplfile_handler =& xoops_gethandler('tplfile');
     /*************** BEGIN DBTHEME SPECIFIC PART ******************/
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($mydirname);
     $config_handler =& xoops_gethandler('config');
     $mod_config =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
     if (file_exists(dirname(__FILE__) . '/templates/theme.html')) {
         $tpl_path = dirname(__FILE__) . '/templates';
     } else {
         if (!empty($mod_config['base_theme'])) {
             $tpl_path = XOOPS_ROOT_PATH . '/themes/' . $mod_config['base_theme'];
         } else {
             $tpl_path = XOOPS_ROOT_PATH . '/themes/' . $GLOBALS['xoopsConfig']['theme_set'];
         }
     }
     /*************** END DBTHEME SPECIFIC PART ******************/
     if ($handler = @opendir($tpl_path . '/')) {
         while (($file = readdir($handler)) !== false) {
             if (substr($file, 0, 1) == '.') {
                 continue;
             }
             $file_path = $tpl_path . '/' . $file;
             if (is_file($file_path) && in_array(strrchr($file, '.'), array('.html', '.css', '.js'))) {
                 $mtime = intval(@filemtime($file_path));
                 $tplfile =& $tplfile_handler->create();
                 /*************** BEGIN DBTHEME SPECIFIC PART ******************/
                 $tpl_source = file_get_contents($file_path);
                 $searches = array();
                 $replacements = array();
                 if (strrchr($file, '.') == '.html') {
                     // CSS hooking
                     $searches[] = '/\\"\\<\\{\\$xoops_imageurl\\}\\>([0-9a-zA-Z_-]+)\\.(css|html|js)\\"/';
                     $replacements[] = '"<{$xoops_url}>/modules/' . $mydirname . '/?template=$1.$2' . '"';
                 } else {
                     if (strrchr($file, '.') == '.css') {
                         // url() hooking
                         $searches[] = '#url\\(\\s*([\\"\']?)([0-9a-z./]{3})#i';
                         $replacements[] = 'url($1<{$xoops_imageurl}>$2';
                     }
                 }
                 $tplfile->setVar('tpl_source', preg_replace($searches, $replacements, $tpl_source));
                 $mtime = time();
                 /*************** END DBTHEME SPECIFIC PART ******************/
                 //				$tplfile->setVar( 'tpl_source' , file_get_contents( $file_path ) , true ) ;
                 $tplfile->setVar('tpl_refid', $mid);
                 $tplfile->setVar('tpl_tplset', 'default');
                 $tplfile->setVar('tpl_file', $mydirname . '_' . $file);
                 $tplfile->setVar('tpl_desc', '', true);
                 $tplfile->setVar('tpl_module', $mydirname);
                 $tplfile->setVar('tpl_lastmodified', $mtime);
                 $tplfile->setVar('tpl_lastimported', 0);
                 $tplfile->setVar('tpl_type', 'module');
                 if (!$tplfile_handler->insert($tplfile)) {
                     $msgs[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>' . htmlspecialchars($mydirname . '_' . $file) . '</b> to the database.</span>';
                 } else {
                     $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/xoopsblock.php';
                     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 {
                         $msgs[] = 'Template <b>' . htmlspecialchars($mydirname . '_' . $file) . '</b> compiled.</span>';
                     }
                 }
             }
         }
         closedir($handler);
     }
     include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
     include_once XOOPS_ROOT_PATH . '/class/template.php';
     xoops_template_clear_module_cache($mid);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:99,代码来源:onupdate.php


示例13: gnavi_onupdate_base

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xoops_template_touch函数代码示例发布时间:2022-05-23
下一篇:
PHP xoops_substr函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap