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

PHP xoops_template_touch函数代码示例

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

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



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

示例1: tplsadmin_import_data

function tplsadmin_import_data($tplset, $tpl_file, $tpl_source, $lastmodified = 0)
{
    $db =& Database::getInstance();
    // check the file is valid template
    list($count) = $db->fetchRow($db->query("SELECT COUNT(*) FROM " . $db->prefix("tplfile") . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes($tpl_file) . "'"));
    if (!$count) {
        return false;
    }
    // check the template exists in the tplset
    if ($tplset != 'default') {
        list($count) = $db->fetchRow($db->query("SELECT COUNT(*) FROM " . $db->prefix("tplfile") . " WHERE tpl_tplset='" . addslashes($tplset) . "' AND tpl_file='" . addslashes($tpl_file) . "'"));
        if ($count <= 0) {
            // copy from 'default' to the tplset
            $result = $db->query("SELECT * FROM " . $db->prefix("tplfile") . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes($tpl_file) . "'");
            while ($row = $db->fetchArray($result)) {
                $db->queryF("INSERT INTO " . $db->prefix("tplfile") . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_module='" . addslashes($row['tpl_module']) . "',tpl_tplset='" . addslashes($tplset) . "',tpl_file='" . addslashes($tpl_file) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_type='" . addslashes($row['tpl_type']) . "'");
                $tpl_id = $db->getInsertId();
                $db->queryF("INSERT INTO " . $db->prefix("tplsource") . " SET tpl_id='{$tpl_id}', tpl_source=''");
            }
        }
    }
    // UPDATE just tpl_lastmodified and tpl_source
    $drs = $db->query("SELECT tpl_id FROM " . $db->prefix("tplfile") . " WHERE tpl_tplset='" . addslashes($tplset) . "' AND tpl_file='" . addslashes($tpl_file) . "'");
    while (list($tpl_id) = $db->fetchRow($drs)) {
        $db->queryF("UPDATE " . $db->prefix("tplfile") . " SET tpl_lastmodified='" . addslashes($lastmodified) . "',tpl_lastimported=UNIX_TIMESTAMP() WHERE tpl_id='{$tpl_id}'");
        $db->queryF("UPDATE " . $db->prefix("tplsource") . " SET tpl_source='" . addslashes($tpl_source) . "' WHERE tpl_id='{$tpl_id}'");
        xoops_template_touch($tpl_id);
    }
    return true;
}
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:30,代码来源:tpls_functions.php


示例2: xpress_create_db_template

function xpress_create_db_template($file_name, $file_path, $mydirname, $mid)
{
    if (is_file($file_path)) {
        $tplfile_handler =& xoops_gethandler('tplfile');
        $tplfile =& $tplfile_handler->create();
        $mtime = intval(@filemtime($file_path));
        $tplfile->setVar('tpl_source', file_get_contents($file_path), true);
        $tplfile->setVar('tpl_refid', $mid);
        $tplfile->setVar('tpl_tplset', 'default');
        $tplfile->setVar('tpl_file', $file_name);
        $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)) {
            $msg = '<span style="color:#ff0000;">ERROR: Template Could not added to the database. <b>' . htmlspecialchars($file_name) . '</b> to the database.</span><br />';
        } else {
            $tplid = $tplfile->getVar('tpl_id');
            $msg = 'Template <b>' . htmlspecialchars($file_name) . '</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)) {
                $msg = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>' . htmlspecialchars($file_name) . '</b>.</span><br />';
            } else {
                $msg = 'Template <b>' . htmlspecialchars($file_name) . '</b> compiled.</span><br />';
            }
        }
    }
    return $msg;
}
开发者ID:nouphet,项目名称:rata,代码行数:32,代码来源:xpress_templates_make.php


示例3: gnavi_onupdate_base

 function gnavi_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', 'gnavi_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)
     $check_sql = "SELECT arrowhtml FROM " . $db->prefix("{$mydirname}_text");
     if (!$db->query($check_sql)) {
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_text") . " ADD arrowhtml tinyint(1) NOT NULL default '0',ADD addinfo text");
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_cat") . " CHANGE icd icd int(5) unsigned NOT NULL default '0'");
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_photos") . " CHANGE icd icd int(5) unsigned NOT NULL default '0'");
     }
     //version 0.13 -> version 0.7
     $check_sql = "SELECT * FROM " . $db->prefix("{$mydirname}_photos") . " USE INDEX(submitter)";
     if (!$db->query($check_sql)) {
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_photos") . " ADD INDEX (submitter)");
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_cat") . " CHANGE lat tmp_lat double(9,6) NOT NULL default '0'");
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_cat") . " CHANGE lng lat double(9,6) NOT NULL default '0'");
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_cat") . " CHANGE tmp_lat lng double(9,6) NOT NULL default '0'");
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_photos") . " CHANGE lat tmp_lat double(9,6) NOT NULL default '0'");
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_photos") . " CHANGE lng lat double(9,6) NOT NULL default '0'");
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_photos") . " CHANGE tmp_lat lng double(9,6) NOT NULL default '0'");
     }
     //version 0.8 -> version 0.9
     $check_sql = "SELECT mtype FROM " . $db->prefix("{$mydirname}_photos");
     if (!$db->query($check_sql)) {
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_photos") . " ADD mtype varchar(30) NOT NULL default ''");
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_cat") . " ADD mtype varchar(30) NOT NULL default ''");
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_cat") . " ADD   kmlurl varchar(150) NOT NULL default ''");
     }
     //version 0.95 -> version 0.96
     $check_sql = "SELECT rss FROM " . $db->prefix("{$mydirname}_photos");
     if (!$db->query($check_sql)) {
         $db->queryF("ALTER TABLE " . $db->prefix("{$mydirname}_photos") . " ADD rss varchar(255) NOT NULL default ''");
     }
     // TEMPLATES (all templates have been already removed by modulesadmin)
     $tplfile_handler =& xoops_gethandler('tplfile');
     // block templete must alldelete (for update from V2 module)
     $templates =& $tplfile_handler->find(null, 'block', null, $mydirname);
     $tcount = count($templates);
     if ($tcount > 0) {
         $ret[] = 'Deleting templates...';
         for ($i = 0; $i < $tcount; $i++) {
             if (!$tplfile_handler->delete($templates[$i])) {
                 $msgs[] = '<span style="color:#ff0000;">ERROR: Could not delete template ' . $templates[$i]->getVar('tpl_file', 's') . ' from the database. Template ID: <b>' . $templates[$i]->getVar('tpl_id', 's') . '</b></span><br />';
             } else {
                 $msgs[] = 'Template <b>' . $templates[$i]->getVar('tpl_file', 's') . '</b> deleted from the database. Template ID: <b>' . $templates[$i]->getVar('tpl_id', 's') . '</b><br />';
             }
         }
     }
     unset($templates);
     $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);
     }
//.........这里部分代码省略.........
开发者ID:nouphet,项目名称:rata,代码行数:101,代码来源:onupdate.php


示例4: bulletin_onupdate_base


//.........这里部分代码省略.........
					}
				}
			}
		}
	}

	// 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 ) && 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 ) ) {
					$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 ) ;

	// BLOCKS
	$tpl_path = dirname(__FILE__).'/templates/blocks' ;
	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 ) ) ;
				$tpl_file = $mydirname . '_' . $file;
				$tpl_source = file_get_contents( $file_path );
				$sql = "SELECT tpl_id, tpl_refid FROM ".$db->prefix('tplfile')." WHERE tpl_module='$mydirname' AND tpl_file='".mysql_escape_string($tpl_file)."'";
				list($tpl_id, $block_id) = $db->fetchRow($db->query($sql));
				if( empty($tpl_id) && empty($block_id)){
					$blocks_info = $module->getInfo('blocks');
					$show_func = '';
					foreach($blocks_info as $oneblock){
						if($tpl_file == $oneblock['template']){
							$show_func = $oneblock['show_func'];
							break;
开发者ID:nunoluciano,项目名称:uxcl,代码行数:67,代码来源:onupdate.php


示例5: time

             } else {
                 $tpl =& $tpltpl_handler->get($old_template[$upload_file]);
             }
             $tpl->setVar('tpl_lastmodified', time());
             $fp = @fopen($uploader->getSavedDestination(), 'r');
             $fsource = @fread($fp, filesize($uploader->getSavedDestination()));
             @fclose($fp);
             $tpl->setVar('tpl_source', $fsource, true);
             @unlink($uploader->getSavedDestination());
             if (!$tpltpl_handler->insert($tpl)) {
                 $msg[] = 'Failed inserting data for ' . $upload_file . ' to database';
             } else {
                 $msg[] = 'Template file <b>' . $upload_file . '</b> updated.';
                 if ($tplset == $xoopsConfig['template_set']) {
                     include_once XOOPS_ROOT_PATH . '/class/template.php';
                     if (xoops_template_touch($tpl, true)) {
                         $msg[] = 'Template file <b>' . $upload_file . '</b> compiled.';
                     }
                 }
             }
         }
     } else {
         if ($uploader->getMediaName() == '') {
             continue;
         } else {
             $msg[] = $uploader->getErrors();
         }
     }
 }
 xoops_cp_header();
 echo '<code>';
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:31,代码来源:main.php


示例6: attachfile_onupdate_base

 function attachfile_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', 'attachfile_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)
     // non
     // 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:naao,项目名称:attachfile,代码行数:63,代码来源:onupdate.php


示例7: bulletin_oninstall_base

function bulletin_oninstall_base($module, $mydirname)
{
    // transations on module install
    global $ret;
    $db =& Database::getInstance();
    $mid = $module->getVar('mid');
    // for Cube 2.1
    if (defined('XOOPS_CUBE_LEGACY')) {
        $isCube = true;
        $root =& XCube_Root::getSingleton();
        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleInstall.' . ucfirst($mydirname) . '.Success', 'bulletin_message_append_oninstall');
        $ret = array();
    } else {
        $isCube = false;
        if (!is_array($ret)) {
            $ret = array();
        }
    }
    // transations on module installation
    $bulletin_posting_permissions = array(1, 2, 3, 7);
    $gperm_handler = xoops_gethandler('groupperm');
    foreach ($bulletin_posting_permissions as $itemid) {
        $gperm =& $gperm_handler->create();
        $gperm->setVar('gperm_groupid', 1);
        $gperm->setVar('gperm_name', 'bulletin_permit');
        $gperm->setVar('gperm_modid', $mid);
        $gperm->setVar('gperm_itemid', $itemid);
        $gperm_handler->insert($gperm);
    }
    // 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...<br />";
        if (file_exists(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));
        $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[] = '&nbsp;&nbsp;Table <b>' . htmlspecialchars($prefix_mod . '_' . $prefixed_query[4]) . '</b> created.<br />';
                    $created_tables[] = $prefixed_query[4];
                } else {
                    $ret[] = '&nbsp;&nbsp;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 />';
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:nouphet,项目名称:rata,代码行数:101,代码来源:oninstall.php


示例8: insertBlocks

 /**
  * Insert blocks from module into the database
  *
  * @return void
  */
 function insertBlocks()
 {
     global $xoopsConfig, $xoopsUser;
     $block_handler =& xoops_gethandler('block');
     $blocks = $this->getInfo('blocks');
     $this->setMessage('Building blocks...');
     if ($blocks != false) {
         $count = count($blocks);
         $showfuncs = array();
         $funcfiles = array();
         foreach (array_keys($blocks) as $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 =& $this->gettemplate($blocks[$i]['template'], true);
                 }
                 if (!isset($content) || !$content) {
                     $content = '';
                 } else {
                     $template = $blocks[$i]['template'];
                 }
                 $options = '';
                 if (!empty($blocks[$i]['options'])) {
                     $options = $blocks[$i]['options'];
                 }
                 $myts =& MyTextSanitizer::getInstance();
                 $criteria = new CriteriaCompo(new Criteria('mid', $this->getVar('mid')));
                 $criteria->add(new Criteria('show_func', $myts->addSlashes($blocks[$i]['show_func'])));
                 $criteria->add(new Criteria('func_file', $myts->addSlashes($blocks[$i]['file'])));
                 if (isset($blocks[$i]['template']) && trim($blocks[$i]['template']) != '') {
                     $criteria->add(new Criteria('template', $myts->addSlashes($blocks[$i]['template'])));
                 }
                 $block = $block_handler->getObjects($criteria);
                 if (isset($block[0])) {
                     $block = $block[0];
                     $this->setMessage("Updating existing block");
                 } else {
                     $this->setMessage("Creating new block");
                     $block =& $block_handler->create();
                     $block->setVar('mid', $this->getVar('mid'));
                     $block->setVar('dirname', $this->getVar('dirname'));
                     $block->setVar('show_func', $blocks[$i]['show_func'], true);
                     $block->setVar('func_file', $blocks[$i]['file'], true);
                     $block->setVar('isactive', 1);
                 }
                 $block->setVar('name', $blocks[$i]['name'], true);
                 $block->setVar('edit_func', $editfunc, true);
                 $block->setVar('options', explode('|', $options), true);
                 $block->setVar('template', $template, true);
                 $block->setVar('last_modified', time());
                 if (!$block_handler->insert($block)) {
                     $this->setMessage('&nbsp;&nbsp;ERROR: Could not insert ' . $blocks[$i]['name']);
                 } else {
                     $this->setMessage('&nbsp;&nbsp;Block <b>' . $blocks[$i]['name'] . '</b> inserted. Block ID: <b>' . $block->getVar('bid') . '</b>');
                     if ($template != '') {
                         //Update or insert template
                         $tplfile_handler =& xoops_gethandler('tplfile');
                         $tplfile =& $tplfile_handler->find('default', 'block', $block->getVar('bid'));
                         if (count($tplfile) == 0) {
                             $tplfile_new =& $tplfile_handler->create();
                             $tplfile_new->setVar('tpl_module', $this->getVar('dirname'));
                             $tplfile_new->setVar('tpl_refid', $block->getVar('bid'));
                             $tplfile_new->setVar('tpl_tplset', 'default');
                             $tplfile_new->setVar('tpl_file', $template, true);
                             $tplfile_new->setVar('tpl_type', 'block');
                         } else {
                             $tplfile_new = $tplfile[0];
                         }
                         $tplfile_new->setVar('tpl_source', $content, true);
                         $tplfile_new->setVar('tpl_desc', $blocks[$i]['description'], true);
                         $tplfile_new->setVar('tpl_lastmodified', time());
                         $tplfile_new->setVar('tpl_lastimported', 0);
                         if (!$tplfile_handler->insert($tplfile_new)) {
                             $this->setMessage('&nbsp;&nbsp;<span style="color:#ff0000;">ERROR: Could not insert template <b>' . $blocks[$i]['template'] . '</b>.</span>');
                         } else {
                             $this->setMessage('&nbsp;&nbsp;Template <b>' . $blocks[$i]['template'] . '</b> inserted.');
                             if (isset($xoopsConfig['template_set']) && $xoopsConfig['template_set'] == 'default') {
                                 if (!xoops_template_touch($tplfile_new)) {
                                     $this->setMessage('&nbsp;&nbsp;<span style="color:#ff0000;">ERROR: Could not compile template <b>' . $blocks[$i]['template'] . '</b>.</span>');
                                 } else {
                                     $this->setMessage('&nbsp;&nbsp;Template <b>' . $blocks[$i]['template'] . '</b> compiled.');
                                 }
                             }
                         }
                     }
                 }
                 $blockids[] = $block->getVar('bid');
             }
         }
     }
     $block_arr = $block_handler->getByModule($this->getVar('mid'));
     if (count($block_arr) > 0) {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:101,代码来源:module.php


示例9: xsns_oninstall


//.........这里部分代码省略.........
					return false ;
				}
				if( ! $db->query( $prefixed_query[0] ) ) {
					$ret[] = '<b>'.htmlspecialchars( $db->error() ).'</b><br />' ;
					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 ) == '.' || !preg_match('/(\.html$)|(\.css$)/i', $file)){
				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 ) ) {
					$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 ) ;
	
	
	// Set default categories
	$ini_category_list = array(
		// 小カテゴリ名, 表示順, 中カテゴリID
		array(constant($constpref.'_CATEGORY_1'), 1, 1),
		array(constant($constpref.'_CATEGORY_2'), 2, 1),
		array(constant($constpref.'_CATEGORY_3'), 3, 1),
		array(constant($constpref.'_CATEGORY_4'), 50, 1),
	);
	
	$sql_values = array();
	$selector_arr = array();
	$id = 1;
	
	foreach($ini_category_list as $category){
		$values = array();
		foreach($category as $v){
			$values[] = "'".$v."'";
		}
		$sql_values[] = "(".implode(',', $values).")";
		$selector_arr[] = "<a href=\"".XOOPS_URL."/modules/".$mydirname."/?cat_id=".($id++)."\">".$category[0]."<nobr><small>(0)</small></nobr></a>";
	}
	
	if(count($sql_values) > 0 || count($selector_arr) > 0){
		$sql = "INSERT INTO ".$db->prefix($mydirname.'_c_commu_category').
				" (name,sort_order,c_commu_category_parent_id) VALUES ".
				implode(",", $sql_values);
		if($db->query($sql)){
			$sql = "INSERT INTO ".$db->prefix($mydirname.'_c_commu_category_parent').
					" (name,sort_order,selector) VALUES".
					" ('".constant($constpref.'_CATEGORY')."', '1', '".implode("&nbsp;- ", $selector_arr)."')";
			return $db->query($sql);
		}
		else{
			return false;
		}
	}
	return true;
}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:101,代码来源:oninstall.php


示例10: xoops_module_update


//.........这里部分代码省略.........
            foreach ($templates as $tpl) {
                $tpl['file'] = trim($tpl['file']);
                // START irmtfan solve templates duplicate issue
                // if (!in_array($tpl['file'], $delng)) { // irmtfan bug fix: remove codes for delete templates
                $type = isset($tpl['type']) ? $tpl['type'] : 'module';
                if (preg_match("/\\.css\$/i", $tpl['file'])) {
                    $type = 'css';
                }
                $criteria = new CriteriaCompo();
                $criteria->add(new Criteria('tpl_refid', $newmid), 'AND');
                $criteria->add(new Criteria('tpl_module', $dirname), 'AND');
                $criteria->add(new Criteria('tpl_tplset', 'default'), 'AND');
                $criteria->add(new Criteria('tpl_file', $tpl['file']), 'AND');
                $criteria->add(new Criteria('tpl_type', $type), 'AND');
                $tplfiles = $tplfile_handler->getObjects($criteria);
                $tpldata =& xoops_module_gettemplate($dirname, $tpl['file'], $type);
                $tplfile = empty($tplfiles) ? $tplfile_handler->create() : $tplfiles[0];
                // END irmtfan solve templates duplicate issue
                $tplfile->setVar('tpl_refid', $newmid);
                $tplfile->setVar('tpl_lastimported', 0);
                $tplfile->setVar('tpl_lastmodified', time());
                $tplfile->setVar('tpl_type', $type);
                $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[] = '&nbsp;&nbsp;<span style="color:#ff0000;">' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_ADD_ERROR, '<strong>' . $tpl['file'] . '</strong>') . '</span>';
                } else {
                    $newid = $tplfile->getVar('tpl_id');
                    $msgs[] = '&nbsp;&nbsp;' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_INSERT_DATA, '<strong>' . $tpl['file'] . '</strong>');
                    if ($xoopsConfig['template_set'] === 'default') {
                        if (!xoops_template_touch($newid)) {
                            $msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE_ERROR, '<strong>' . $tpl['file'] . '</strong>') . '</span>';
                        } else {
                            $msgs[] = '&nbsp;&nbsp;<span>' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE, '<strong>' . $tpl['file'] . '</strong>') . '</span>';
                        }
                    }
                }
                unset($tpldata);
                // irmtfan bug fix: remove codes for delete templates
                /*
                } else {
                    $msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">'.sprintf(_AM_SYSTEM_MODULES_TEMPLATE_DELETE_OLD_ERROR, "<strong>".$tpl['file']."</strong>").'</span>';
                }
                */
                // irmtfan bug fix: remove codes for delete templates
            }
        }
        $blocks = $module->getInfo('blocks');
        $msgs[] = _AM_SYSTEM_MODULES_BLOCKS_REBUILD;
        if ($blocks != false) {
            $showfuncs = array();
            $funcfiles = array();
            foreach ($blocks as $i => $block) {
                if (isset($block['show_func']) && $block['show_func'] != '' && isset($block['file']) && $block['file'] != '') {
                    $editfunc = isset($block['edit_func']) ? $block['edit_func'] : '';
                    $showfuncs[] = $block['show_func'];
                    $funcfiles[] = $block['file'];
                    $template = '';
                    if (isset($block['template']) && trim($block['template']) != '') {
                        $content =& xoops_module_gettemplate($dirname, $block['template'], 'blocks');
                    }
                    if (!$content) {
                        $content = '';
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:67,代码来源:modulesadmin.php


示例11: array

}

// EDIT UPDATE
$errors = array() ;
if( ! empty( $_POST['do_modifycont'] ) || ! empty( $_POST['do_modify'] ) ) {
	if ( ! $xoopsGTicket->check( true , 'dbcss' ) ) {
		redirect_header(XOOPS_URL.'/modules/'.$mydirname.'/admin/index.php',3,$xoopsGTicket->getErrors());
	}

	$post_source = addslashes($myts->stripSlashesGPC( $_POST['tpl_source'] ) );

	$result = $db->query( "UPDATE ".$db->prefix("tplsource")." SET tpl_source='".$post_source."' WHERE tpl_id=$tpl_id" ) ;
	if( ! $result ) $errors[] = $tpl_id ;
	$result = $db->query( "UPDATE ".$db->prefix("tplfile")." SET tpl_lastmodified=UNIX_TIMESTAMP() WHERE tpl_id=$tpl_id" ) ;
	if( ! $result ) $errors[] = $tpl_id ;
	xoops_template_touch( $tpl_id ) ;

	// CONTINUE OR END ?
	if( ! empty( $_POST['do_modifycont'] ) ) {
		redirect_header(  XOOPS_URL."/modules/$mydirname/admin/index.php?page=mytplsform&tpl_id=".$tpl_id."&#dbcss_tplsform_top." , 2 , $errors ? sprintf( _MD_DBCSS_ERROR_MESSEAGE , implode( ',' , $errors ) ) : _MD_DBCSS_MYTPLSFORM_UPDATED ) ;
	} else {
		if( ! empty( $bid ) ) {
			redirect_header( XOOPS_URL."/modules/$mydirname/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&op=edit&bid=".$bid , 2 , $errors ? sprintf( _MD_DBCSS_ERROR_MESSEAGE , implode( ',' , $errors ) ) : _MD_DBCSS_MYTPLSFORM_UPDATED ) ;
		} else {
			redirect_header( XOOPS_URL."/modules/$mydirname/admin/index.php?page=export" , 2 , $errors ? sprintf( _MD_DBCSS_ERROR_MESSEAGE , implode( ',' , $errors ) ) : _MD_DBCSS_MYTPLSFORM_UPDATED ) ;
		}
	}
	exit() ;
}

// DISPLAY STAGE
开发者ID:nunoluciano,项目名称:uxcl,代码行数:31,代码来源:mytplsform.php


示例12: 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 {
                 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xoops_trim函数代码示例发布时间:2022-05-23
下一篇:
PHP xoops_template_clear_module_cache函数代码示例发布时间: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