本文整理汇总了PHP中debug_buffer函数的典型用法代码示例。如果您正苦于以下问题:PHP debug_buffer函数的具体用法?PHP debug_buffer怎么用?PHP debug_buffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug_buffer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
protected function fetch($name, &$source, &$mtime)
{
debug_buffer('start global_content_get_template');
$gCms = cmsms();
$config = $gCms->GetConfig();
$gcbops = $gCms->GetGlobalContentOperations();
$oneblob = $gcbops->LoadHtmlBlobByName($name);
if ($oneblob) {
$text = $oneblob->content;
$source = $text;
$mtime = $oneblob->modified_date;
// So no one can do anything nasty, take out the php smarty tags. Use a user
// defined plugin instead.
if (!(isset($config["use_smarty_php_tags"]) && $config["use_smarty_php_tags"] == true)) {
$source = preg_replace("/\\{\\/?php\\}/", "", $source);
}
} else {
$source = "<!-- Html blob '" . $name . "' does not exist -->";
// put mention into the admin log
audit('', 'Global Content Block: ' . $name, 'Can not open or does not exist!');
$mtime = time();
}
debug_buffer('end global_content_get_template');
return true;
}
示例2: __cms_load
/**
* A function for auto-loading classes.
*
* @since 1.7
* @param string A class name
* @return boolean
*/
function __cms_load($filename)
{
$gCms = cmsms();
static $_cumulative = 0;
$mem = memory_get_usage();
require_once $filename;
$mem = memory_get_usage() - $mem;
$_cumulative += $mem;
debug_buffer("Loading {$filename} = {$mem} bytes for an approximate total of {$_cumulative}");
}
示例3: fetch
protected function fetch($name, &$source, &$mtime)
{
debug_buffer('', 'CMSModuleDbTemplateResource start' . $name);
$db = cmsms()->GetDb();
$tmp = explode(';', $name);
$query = "SELECT * from " . cms_db_prefix() . "module_templates WHERE module_name = ? and template_name = ?";
$row = $db->GetRow($query, preg_split('/;/', $name));
if ($row) {
$source = $row['content'];
$mtime = $db->UnixTimeStamp($row['modified_date']);
}
debug_buffer('', 'CMSModuleDbTemplateResource end' . $name);
}
示例4: lang
echo lang('login_info_params');
?>
<span>( <?php
echo $_SERVER['HTTP_HOST'];
?>
)</span>
</div>
</div>
<div class="login">
<div class="top"><?php
echo lang('logintitle');
?>
</div>
<div id="centerLogin" class="formcontainer">
<?php
debug_buffer('Debug in the page is: ' . $error);
if (isset($error) && $error != '') {
echo '<div class="erroLogin">' . $error . '</div>';
} else {
if (isset($warningLogin) && $warningLogin != '') {
echo '<div class="warningLogin">' . $warningLogin . '</div>';
} else {
if (isset($acceptLogin) && $acceptLogin != '') {
echo '<div class="acceptLogin">' . $acceptLogin . '</div>';
}
}
}
?>
<?php
if ($changepwhash != '') {
echo '<div class="warningLogin">' . lang('passwordchange') . '</div>';
示例5: get_userid
$config = $gCms->GetConfig();
$userid = get_userid();
if (isset($USE_THEME) && $USE_THEME == false) {
//echo '<!-- admin theme disabled -->';
} else {
debug_buffer('before theme load');
$themeObject = cms_utils::get_theme_object();
debug_buffer('after theme load');
if (isset($headtext) && $headtext != '') {
$themeObject->set_value('headertext', $headtext);
}
// Display notification stuff from modules
// should be controlled by preferences or something
$ignoredmodules = explode(',', get_preference($userid, 'ignoredmodules'));
if (get_site_preference('enablenotifications', 1) && get_preference($userid, 'enablenotifications', 1)) {
debug_buffer('before notifications');
if ($data = get_site_preference('__NOTIFICATIONS__')) {
$data = unserialize($data);
if (is_array($data) && count($data)) {
foreach ($data as $item) {
$old = $item->html;
$regex = '/' . CMS_SECURE_PARAM_NAME . '\\=[0-9a-z]{8}/';
$to = CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY];
$new = preg_replace($regex, $to, $old);
$themeObject->AddNotification($item->priority, $item->name, $item->html);
}
}
}
// if the install directory still existsx
// add a priority 1 dashboard item
if (file_exists(dirname(dirname(__FILE__)) . '/install')) {
示例6: _populate_admin_navigation
/**
* PopulateAdminNavigation
* This method populates a big array containing the Navigation Taxonomy
* for the admin section. This array is then used to create menus and
* section main pages. It uses aggregate permissions to hide sections for which
* the user doesn't have permissions, and highlights the current section so
* menus can show the user where they are.
*
* @param subtitle any info to add to the page title
* @access private
* @ignore
*/
private function _populate_admin_navigation($subtitle = '')
{
if (count($this->_menuItems) > 0) {
// we have already created the list
return;
}
$config = cmsms()->GetConfig();
debug_buffer('before populate admin navigation');
$this->subtitle = $subtitle;
debug_buffer('before menu items');
$this->_menuItems = array('main' => array('url' => 'index.php', 'parent' => -1, 'title' => 'CMS', 'description' => '', 'show_in_menu' => true), 'home' => array('url' => 'index.php', 'parent' => 'main', 'title' => $this->_FixSpaces(lang('home')), 'description' => '', 'show_in_menu' => true), 'viewsite' => array('url' => $config['root_url'] . '/index.php', 'parent' => 'main', 'title' => $this->_FixSpaces(lang('viewsite')), 'type' => 'external', 'description' => '', 'show_in_menu' => true, 'target' => '_blank'), 'logout' => array('url' => 'logout.php', 'parent' => 'main', 'title' => $this->_FixSpaces(lang('logout')), 'description' => '', 'show_in_menu' => true), 'content' => array('url' => 'index.php?section=content', 'parent' => -1, 'title' => $this->_FixSpaces(lang('content')), 'description' => lang('contentdescription'), 'show_in_menu' => $this->HasPerm('contentPerms')), 'pages' => array('url' => 'listcontent.php', 'parent' => 'content', 'title' => $this->_FixSpaces(lang('pages')), 'description' => lang('pagesdescription'), 'show_in_menu' => $this->HasPerm('pagePerms')), 'addcontent' => array('url' => 'addcontent.php', 'parent' => 'pages', 'title' => $this->_FixSpaces(lang('addcontent')), 'description' => lang('addcontent'), 'show_in_menu' => false), 'editpage' => array('url' => 'editcontent.php', 'parent' => 'pages', 'title' => $this->_FixSpaces(lang('editpage')), 'description' => lang('editpage'), 'show_in_menu' => false), 'images' => array('url' => 'imagefiles.php', 'parent' => 'content', 'title' => $this->_FixSpaces(lang('imagemanager')), 'description' => lang('imagemanagerdescription'), 'show_in_menu' => $this->HasPerm('filePerms')), 'blobs' => array('url' => 'listhtmlblobs.php', 'parent' => 'content', 'title' => $this->_FixSpaces(lang('htmlblobs')), 'description' => lang('htmlblobdescription'), 'show_in_menu' => $this->HasPerm('htmlPerms')), 'addhtmlblob' => array('url' => 'addhtmlblob.php', 'parent' => 'blobs', 'title' => $this->_FixSpaces(lang('addhtmlblob')), 'description' => lang('addhtmlblob'), 'show_in_menu' => false), 'edithtmlblob' => array('url' => 'edithtmlblob.php', 'parent' => 'blobs', 'title' => $this->_FixSpaces(lang('edithtmlblob')), 'description' => lang('edithtmlblob'), 'show_in_menu' => false), 'layout' => array('url' => 'index.php?section=layout', 'parent' => -1, 'title' => $this->_FixSpaces(lang('layout')), 'description' => lang('layoutdescription'), 'show_in_menu' => $this->HasPerm('layoutPerms')), 'template' => array('url' => 'listtemplates.php', 'parent' => 'layout', 'title' => $this->_FixSpaces(lang('templates')), 'description' => lang('templatesdescription'), 'show_in_menu' => $this->HasPerm('templatePerms')), 'addtemplate' => array('url' => 'addtemplate.php', 'parent' => 'template', 'title' => $this->_FixSpaces(lang('addtemplate')), 'description' => lang('addtemplate'), 'show_in_menu' => false), 'edittemplate' => array('url' => 'edittemplate.php', 'parent' => 'template', 'title' => $this->_FixSpaces(lang('edittemplate')), 'description' => lang('edittemplate'), 'show_in_menu' => false), 'currentassociations' => array('url' => 'listcssassoc.php', 'parent' => 'template', 'title' => $this->_FixSpaces(lang('currentassociations')), 'description' => lang('currentassociations'), 'show_in_menu' => false), 'copytemplate' => array('url' => 'copyemplate.php', 'parent' => 'template', 'title' => $this->_FixSpaces(lang('copytemplate')), 'description' => lang('copytemplate'), 'show_in_menu' => false), 'stylesheets' => array('url' => 'listcss.php', 'parent' => 'layout', 'title' => $this->_FixSpaces(lang('stylesheets')), 'description' => lang('stylesheetsdescription'), 'show_in_menu' => $this->HasPerm('cssPerms') || $this->HasPerm('cssAssocPerms')), 'addcss' => array('url' => 'addcss.php', 'parent' => 'stylesheets', 'title' => $this->_FixSpaces(lang('addstylesheet')), 'description' => lang('addstylesheet'), 'show_in_menu' => false), 'editcss' => array('url' => 'editcss.php', 'parent' => 'stylesheets', 'title' => $this->_FixSpaces(lang('editcss')), 'description' => lang('editcss'), 'show_in_menu' => false), 'templatecss' => array('url' => 'templatecss.php', 'parent' => 'stylesheets', 'title' => $this->_FixSpaces(lang('templatecss')), 'description' => lang('templatecss'), 'show_in_menu' => false), 'usersgroups' => array('url' => 'index.php?section=usersgroups', 'parent' => -1, 'title' => $this->_FixSpaces(lang('usersgroups')), 'description' => lang('usersgroupsdescription'), 'show_in_menu' => $this->HasPerm('usersGroupsPerms')), 'users' => array('url' => 'listusers.php', 'parent' => 'usersgroups', 'title' => $this->_FixSpaces(lang('users')), 'description' => lang('usersdescription'), 'show_in_menu' => $this->HasPerm('userPerms')), 'adduser' => array('url' => 'adduser.php', 'parent' => 'users', 'title' => $this->_FixSpaces(lang('adduser')), 'description' => lang('adduser'), 'show_in_menu' => false), 'edituser' => array('url' => 'edituser.php', 'parent' => 'users', 'title' => $this->_FixSpaces(lang('edituser')), 'description' => lang('edituser'), 'show_in_menu' => false), 'groups' => array('url' => 'listgroups.php', 'parent' => 'usersgroups', 'title' => $this->_FixSpaces(lang('groups')), 'description' => lang('groupsdescription'), 'show_in_menu' => $this->HasPerm('groupPerms')), 'addgroup' => array('url' => 'addgroup.php', 'parent' => 'groups', 'title' => $this->_FixSpaces(lang('addgroup')), 'description' => lang('addgroup'), 'show_in_menu' => false), 'editgroup' => array('url' => 'editgroup.php', 'parent' => 'groups', 'title' => $this->_FixSpaces(lang('editgroup')), 'description' => lang('editgroup'), 'show_in_menu' => false), 'groupmembers' => array('url' => 'changegroupassign.php', 'parent' => 'usersgroups', 'title' => $this->_FixSpaces(lang('groupassignments')), 'description' => lang('groupassignmentdescription'), 'show_in_menu' => $this->HasPerm('groupMemberPerms')), 'groupperms' => array('url' => 'changegroupperm.php', 'parent' => 'usersgroups', 'title' => $this->_FixSpaces(lang('groupperms')), 'description' => lang('grouppermsdescription'), 'show_in_menu' => $this->HasPerm('groupPermPerms')), 'extensions' => array('url' => 'index.php?section=extensions', 'parent' => -1, 'title' => $this->_FixSpaces(lang('extensions')), 'description' => lang('extensionsdescription'), 'show_in_menu' => $this->HasPerm('extensionsPerms')), 'modules' => array('url' => 'listmodules.php', 'parent' => 'extensions', 'title' => $this->_FixSpaces(lang('modules')), 'description' => lang('moduledescription'), 'show_in_menu' => $this->HasPerm('modulePerms')), 'tags' => array('url' => 'listtags.php', 'parent' => 'extensions', 'title' => $this->_FixSpaces(lang('tags')), 'description' => lang('tagdescription'), 'show_in_menu' => $this->HasPerm('taghelpPerms')), 'usertags' => array('url' => 'listusertags.php', 'parent' => 'extensions', 'title' => $this->_FixSpaces(lang('usertags')), 'description' => lang('usertagdescription'), 'show_in_menu' => $this->HasPerm('codeBlockPerms')), 'eventhandlers' => array('url' => 'eventhandlers.php', 'parent' => 'extensions', 'title' => $this->_FixSpaces(lang('eventhandlers')), 'description' => lang('eventhandlerdescription'), 'show_in_menu' => $this->HasPerm('eventPerms')), 'editeventhandler' => array('url' => 'editevent.php', 'parent' => 'eventhandlers', 'title' => $this->_FixSpaces(lang('editeventhandler')), 'description' => lang('editeventshandler'), 'show_in_menu' => false), 'addusertag' => array('url' => 'adduserplugin.php', 'parent' => 'usertags', 'title' => $this->_FixSpaces(lang('addusertag')), 'description' => lang('addusertag'), 'show_in_menu' => false), 'editusertag' => array('url' => 'edituserplugin.php', 'parent' => 'usertags', 'title' => $this->_FixSpaces(lang('editusertag')), 'description' => lang('editusertag'), 'show_in_menu' => false), 'siteadmin' => array('url' => 'index.php?section=siteadmin', 'parent' => -1, 'title' => $this->_FixSpaces(lang('admin')), 'description' => lang('admindescription'), 'show_in_menu' => $this->HasPerm('siteAdminPerms')), 'siteprefs' => array('url' => 'siteprefs.php', 'parent' => 'siteadmin', 'title' => $this->_FixSpaces(lang('globalconfig')), 'description' => lang('preferencesdescription'), 'show_in_menu' => $this->HasPerm('sitePrefPerms')), 'pagedefaults' => array('url' => 'pagedefaults.php', 'parent' => 'siteadmin', 'title' => $this->_FixSpaces(lang('pagedefaults')), 'description' => lang('pagedefaultsdescription'), 'show_in_menu' => $this->HasPerm('sitePrefPerms')), 'systeminfo' => array('url' => 'systeminfo.php', 'parent' => 'siteadmin', 'title' => $this->_FixSpaces(lang('systeminfo')), 'description' => lang('systeminfodescription'), 'show_in_menu' => $this->HasPerm('adminPerms')), 'systemmaintenance' => array('url' => 'systemmaintenance.php', 'parent' => 'siteadmin', 'title' => $this->_FixSpaces(lang('systemmaintenance')), 'description' => lang('systemmaintenancedescription'), 'show_in_menu' => $this->HasPerm('adminPerms')), 'checksum' => array('url' => 'checksum.php', 'parent' => 'siteadmin', 'title' => $this->_FixSpaces(lang('system_verification')), 'description' => lang('checksumdescription'), 'show_in_menu' => $this->HasPerm('adminPerms')), 'adminlog' => array('url' => 'adminlog.php', 'parent' => 'siteadmin', 'title' => $this->_FixSpaces(lang('adminlog')), 'description' => lang('adminlogdescription'), 'show_in_menu' => $this->HasPerm('adminPerms')), 'myprefs' => array('url' => 'index.php?section=myprefs', 'parent' => -1, 'title' => $this->_FixSpaces(lang('myprefs')), 'description' => lang('myprefsdescription'), 'show_in_menu' => true), 'myaccount' => array('url' => 'myaccount.php', 'parent' => 'myprefs', 'title' => $this->_FixSpaces(lang('myaccount')), 'description' => lang('myaccountdescription'), 'show_in_menu' => true), 'managebookmarks' => array('url' => 'listbookmarks.php', 'parent' => 'myprefs', 'title' => $this->_FixSpaces(lang('managebookmarks')), 'description' => lang('managebookmarksdescription'), 'show_in_menu' => true), 'addbookmark' => array('url' => 'addbookmark.php', 'parent' => 'myprefs', 'title' => $this->_FixSpaces(lang('addbookmark')), 'description' => lang('addbookmark'), 'show_in_menu' => false), 'editbookmark' => array('url' => 'editbookmark.php', 'parent' => 'myprefs', 'title' => $this->_FixSpaces(lang('editbookmark')), 'description' => lang('editbookmark'), 'show_in_menu' => false));
debug_buffer('after menu items');
// slightly cleaner syntax
$this->_menuItems['ecommerce'] = array('url' => 'index.php?section=ecommerce', 'parent' => -1, 'title' => $this->_FixSpaces(lang('ecommerce')), 'description' => lang('ecommerce_desc'), 'show_in_menu' => true);
// adjust all the urls to include the session key
// and set an icon if we can.
foreach ($this->_menuItems as $sectionKey => $sectionArray) {
if (isset($sectionArray['url']) && (!isset($sectionArray['type']) || $sectionArray['type'] != 'external')) {
$url = $this->_menuItems[$sectionKey]['url'];
if (strpos($url, '?') !== FALSE) {
$url .= '&';
} else {
$url .= '?';
}
$url .= CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY];
$this->_menuItems[$sectionKey]['url'] = $url;
}
}
debug_buffer('before syste modules');
// add in all of the 'system' modules too
$gCms = cmsms();
foreach ($this->_menuItems as $sectionKey => $sectionArray) {
$tmpArray = $this->_MenuListSectionModules($sectionKey);
$first = true;
foreach ($tmpArray as $thisKey => $thisVal) {
$thisModuleKey = $thisKey;
$counter = 0;
// don't clobber existing keys
if (array_key_exists($thisModuleKey, $this->_menuItems)) {
while (array_key_exists($thisModuleKey, $this->_menuItems)) {
$thisModuleKey = $thisKey . $counter;
$counter++;
}
}
// if it's a system module...
if (ModuleOperations::get_instance()->IsSystemModule($thisModuleKey)) {
$this->_menuItems[$thisModuleKey] = array('url' => $thisVal['url'], 'parent' => $sectionKey, 'title' => $this->_FixSpaces($thisVal['name']), 'description' => $thisVal['description'], 'show_in_menu' => true);
}
}
}
debug_buffer('before module menu items');
// add in all of the modules
foreach ($this->_menuItems as $sectionKey => $sectionArray) {
$tmpArray = $this->_MenuListSectionModules($sectionKey);
$first = true;
foreach ($tmpArray as $thisKey => $thisVal) {
$thisModuleKey = $thisKey;
$counter = 0;
// don't clobber existing keys
if (array_key_exists($thisModuleKey, $this->_menuItems)) {
while (array_key_exists($thisModuleKey, $this->_menuItems)) {
$thisModuleKey = $thisKey . $counter;
$counter++;
}
if ($counter > 0) {
continue;
}
}
$this->_menuItems[$thisModuleKey] = array('url' => $thisVal['url'], 'parent' => $sectionKey, 'title' => $this->_FixSpaces($thisVal['name']), 'description' => $thisVal['description'], 'show_in_menu' => true);
if ($first) {
$this->_menuItems[$thisModuleKey]['firstmodule'] = 1;
$first = false;
} else {
$this->_menuItems[$thisModuleKey]['module'] = 1;
}
}
}
debug_buffer('after module menu items');
// remove any top level items that don't have children
$parents = array();
foreach ($this->_menuItems as $sectionKey => $sectionArray) {
if ($this->_menuItems[$sectionKey]['parent'] == -1) {
$parents[] = $sectionKey;
}
}
foreach ($parents as $oneparent) {
$found = 0;
foreach ($this->_menuItems as $sectionKey => $sectionArray) {
//.........这里部分代码省略.........
示例7: lang
echo '<p class="pageback"><a class="pageback" href="' . $thisurl . '">« ' . lang('back') . '</a></p>';
} else {
if ($action == 'missingdeps') {
echo '<div class="pagecontainer">';
echo '<p class="pageheader">' . lang('depsformodule', array($module)) . '</p>';
echo '<table cellspacing="0" class="AdminTable">';
echo '<thead>';
echo '<tr><th>' . lang('name') . '</th><th>' . lang('minimumversion') . '</th><th>' . lang('installed') . '</th></tr>';
echo '</thead>';
echo '<tbody>';
if (isset($gCms->modules[$module])) {
$modinstance = $gCms->modules[$module]['object'];
if (count($modinstance->GetDependencies()) > 0) {
$curclass = 'row1';
#Now check to see if we can satisfy any deps
debug_buffer($modinstance->GetDependencies(), 'deps in module');
foreach ($modinstance->GetDependencies() as $onedepkey => $onedepvalue) {
echo '<tr class="' . $curclass . '"><td>' . $onedepkey . '</td><td>' . $onedepvalue . '</td><td>';
$havedep = false;
if (isset($gCms->modules[$onedepkey]) && $gCms->modules[$onedepkey]['installed'] == true && $gCms->modules[$onedepkey]['active'] == true && version_compare($gCms->modules[$onedepkey]['object']->GetVersion(), $onedepvalue) > -1) {
$havedep = true;
}
echo lang($havedep ? 'true' : 'false');
echo '</td></tr>';
$curclass == "row1" ? $curclass = "row2" : ($curclass = "row1");
}
}
}
echo '</tbody>';
echo '</table>';
echo '</div>';
示例8: cms_htmlentities
}
$action = "";
if (isset($_GET["action"])) {
$action = cms_htmlentities($_GET["action"]);
}
$userid = get_userid();
$access = check_permission($userid, "View Tag Help");
//if( !$access ) return;
if (!$access) {
die('Permission Denied');
return;
}
#$smarty = new Smarty_CMS($gCms->config);
debug_buffer('before header');
include_once "header.php";
debug_buffer('after header');
if ($action == "showpluginhelp") {
if (function_exists('smarty_cms_help_function_' . $plugin)) {
echo '<div class="pagecontainer">';
// Display the title along with a wiki help link
$header = '<div class="pageheader">';
$header .= lang('pluginhelp', array($plugin));
$wikiUrl = $config['wiki_url'];
$module_name = $plugin;
// Turn ModuleName into _Module_Name
$moduleName = preg_replace('/([A-Z])/', "_\$1", $module_name);
$moduleName = preg_replace('/_([A-Z])_/', "\$1", $moduleName);
if ($moduleName[0] == '_') {
$moduleName = substr($moduleName, 1);
}
$wikiUrl .= '/Tags/' . $moduleName;
示例9: count
$this->FillNode($content, $onenode, $nodelist, $gCms, $count, $prevdepth, $prevdepth);
$this->GetChildNodes($onenode, $nodelist, $gCms, $prevdepth, $count, $params, $origdepth, $showparents, $deep);
}
}
} else {
$this->GetChildNodes($rootnode, $nodelist, $gCms, $prevdepth, $count, $params, $origdepth, $showparents, $deep);
}
}
if (count($nodelist) > 0) {
$smarty =& $this->smarty;
$smarty->assign('menuparams', $params);
$smarty->assign('count', count($nodelist));
$smarty->assign_by_ref('nodelist', $nodelist);
if ($usefile) {
echo $this->ProcessTemplate($tpl_name, $mdid, false, $gCms->variables['content_id']);
} else {
echo $this->ProcessTemplateFromDatabase($tpl_name, $mdid, false);
}
}
}
/*
else
{
if ($usefile)
echo $this->ProcessTemplate($tpl_name, $mdid, true, $gCms->variables['content_id']);
else
echo $this->ProcessTemplateFromDatabase($tpl_name, $mdid, true, $gCms->variables['content_id']);
}
*/
debug_buffer('', 'End of Menu Manager Display');
示例10: debug_buffer
function &getNodeByID($id)
{
$result = null;
if ($id) {
debug_buffer('start findNodeByTag');
$ref = null;
$result =& $this->findNodeByTag($id, $ref);
debug_buffer('end findNodeByTag');
}
return $result;
}
示例11: debug_buffer
/**
* Returns an array of all content objects in the system, active or not.
*
* @param boolean $loadprops Not implemented
* @return array The array of content objects
*/
function &GetAllContent($loadprops = true)
{
debug_buffer('get all content...');
global $gCms;
$contentcache = array();
$db =& $gCms->GetDb();
$query = "SELECT * FROM " . cms_db_prefix() . "content ORDER BY hierarchy";
$dbresult =& $db->Execute($query);
$map = array();
$count = 0;
while ($dbresult && !$dbresult->EOF) {
#Make sure the type exists. If so, instantiate and load
if (in_array($dbresult->fields['type'], array_keys(ContentOperations::ListContentTypes()))) {
$contentobj =& ContentOperations::CreateNewContent($dbresult->fields['type']);
if (isset($contentobj)) {
$tmp = $dbresult->FetchRow();
$contentobj->LoadFromData($tmp, false);
$map[$contentobj->Id()] = $count;
$contentcache[] = $contentobj;
$count++;
} else {
$dbresult->MoveNext();
}
} else {
$dbresult->MoveNext();
}
}
if ($dbresult) {
$dbresult->Close();
}
for ($i = 0; $i < $count; $i++) {
if ($contentcache[$i]->ParentId() != -1 && isset($map[$contentcache[$i]->ParentId()])) {
$contentcache[$map[$contentcache[$i]->ParentId()]]->mChildCount++;
}
}
return $contentcache;
}
示例12: check_login
/**
* Checks to see if the user is logged in. If not, redirects the browser
* to the admin login.
*
* @since 0.1
* @param string no_redirect - If true, then don't redirect if not logged in
* @return boolean
*/
function check_login($no_redirect = false)
{
$config = cmsms()->GetConfig();
//Handle a current login if one is in queue in the SESSION
if (isset($_SESSION['login_user_id'])) {
debug_buffer("Found login_user_id. Going to generate the user object.");
generate_user_object($_SESSION['login_user_id']);
unset($_SESSION['login_user_id']);
}
if (isset($_SESSION['login_cms_language'])) {
debug_buffer('Setting language to: ' . $_SESSION['login_cms_language']);
cms_cookies::set('cms_language', $_SESSION['login_cms_language']);
unset($_SESSION['login_cms_language']);
}
if (!isset($_SESSION["cms_admin_user_id"])) {
debug_buffer('No session found. Now check for cookies');
if (isset($_COOKIE["cms_admin_user_id"]) && isset($_COOKIE["cms_passhash"])) {
debug_buffer('Cookies found, do a passhash check');
if (check_passhash($_COOKIE["cms_admin_user_id"], $_COOKIE["cms_passhash"])) {
debug_buffer('passhash check succeeded... creating session object');
generate_user_object($_COOKIE["cms_admin_user_id"]);
} else {
debug_buffer('passhash check failed... redirect to login');
$_SESSION["redirect_url"] = $_SERVER["REQUEST_URI"];
if (false == $no_redirect) {
redirect($config['admin_url'] . "/login.php");
}
return false;
}
} else {
debug_buffer('No cookies found. Redirect to login.');
$_SESSION["redirect_url"] = $_SERVER["REQUEST_URI"];
if (false == $no_redirect) {
redirect($config['admin_url'] . "/login.php");
}
return false;
}
}
debug_buffer('Session found. Moving on...');
global $CMS_ADMIN_PAGE;
if ($config['debug'] === false && isset($CMS_ADMIN_PAGE)) {
if (!isset($_SESSION[CMS_USER_KEY])) {
// it's not in the session, try to grab something from cookies
if (isset($_COOKIE[CMS_SECURE_PARAM_NAME])) {
$_SESSION[CMS_USER_KEY] = $_COOKIE[CMS_SECURE_PARAM_NAME];
}
}
// now we've got to check the request
// and make sure it matches the session key
if (!isset($_SESSION[CMS_USER_KEY]) || !isset($_GET[CMS_SECURE_PARAM_NAME]) || !isset($_POST[CMS_SECURE_PARAM_NAME])) {
$v = '<no$!tgonna!$happen>';
if (isset($_GET[CMS_SECURE_PARAM_NAME])) {
$v = $_GET[CMS_SECURE_PARAM_NAME];
} else {
if (isset($_POST[CMS_SECURE_PARAM_NAME])) {
$v = $_POST[CMS_SECURE_PARAM_NAME];
}
}
if ($v != $_SESSION[CMS_USER_KEY] && !isset($config['stupidly_ignore_xss_vulnerability'])) {
debug_buffer('Session key mismatch problem... redirect to login');
if (false == $no_redirect) {
redirect($config['admin_url'] . '/login.php');
}
return false;
}
}
}
return true;
}
示例13: global_content_get_timestamp
/**
* A method to return the timestamp of a global content block.
*
* @access private
* @param string The name of the global content block.
* @param int (returned) The file timestamp
* @param object The smarty object
* @return boolean
*/
function global_content_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
{
debug_buffer('start global_content_get_timestamp');
$gCms = cmsms();
$gcbops = $gCms->GetGlobalContentOperations();
$oneblob = $gcbops->LoadHtmlBlobByName($tpl_name);
if ($oneblob) {
$tpl_timestamp = $oneblob->modified_date;
debug_buffer('end global_content_get_timestamp');
return true;
} else {
return false;
}
}
示例14: array_reverse
}
$separator = $gCms->GetContentOperations()->CreateNewContent('separator');
$separator->SetName('»');
$separator->SetMenuText('»');
$pagestack = array_reverse($pagestack);
$newstack = array();
$prevdepth = 1;
$curNode = null;
for ($i = 0; $i < count($pagestack) - 1; $i++) {
$newstack[] = $pagestack[$i];
$newstack[count($newstack) - 1]->depth = 1;
$newstack[count($newstack) - 1]->prevdepth = 1;
$this->FillNode($separator, $curNode, $newstack, $gCms, $count, $prevdepth, 1, $deep, $params);
}
$newstack[] = $pagestack[count($pagestack) - 1];
$newstack[count($newstack) - 1]->depth = 1;
$newstack[count($newstack) - 1]->prevdepth = 1;
unset($pagestack);
// and get ready to display.
$smarty->assign('starttext', $this->Lang('youarehere'));
$smarty->assign('menuparams', $params);
$smarty->assign('count', count($newstack));
$smarty->assign('nodelist', $newstack);
if ($usefile) {
$txt = $this->ProcessTemplate($tpl_name, '', false, $gCms->variables['content_id']);
} else {
$txt = $this->ProcessTemplateFromDatabase($tpl_name, '', false);
}
echo $txt;
debug_buffer('', 'End of BreadCrumbs Display');
示例15: _load_module
private function _load_module($module_name, $force_load = FALSE)
{
$config = cmsms()->GetConfig();
$dir = $config['root_path'] . '/modules';
$info = $this->_get_module_info();
if (!isset($info[$module_name]) && !$force_load) {
debug_buffer("Nothing is known about {$module_name}... cant load it");
return FALSE;
}
if ((!isset($info[$module_name]['active']) || $info[$module_name]['active'] == 0) && !$force_load) {
debug_buffer('Requested deactivated module ' . $module_name);
return FALSE;
}
global $CMS_INSTALL_PAGE;
global $CMS_VERSION;
global $CMS_PREVENT_AUTOINSTALL;
global $CMS_FORCE_MODULE_LOAD;
$allow_auto = isset($CMS_PREVENT_AUTOINSTALL) && $CMS_PREVENT_AUTOINSTALL ? 0 : 1;
$gCms = cmsms();
// backwards compatibility... set the global.
if (!class_exists($module_name)) {
$fname = $dir . "/{$module_name}/{$module_name}.module.php";
if (!is_file($fname)) {
debug_buffer("Cannot load {$module_name} because the module file does not exist");
return FALSE;
}
require_once $fname;
}
$obj = new $module_name();
if (!is_object($obj)) {
// oops, some problem loading.
debug_buffer("Cannot load {$module_name} ... some problem instantiating the class");
return FALSE;
}
if (version_compare($obj->MinimumCMSVersion(), $CMS_VERSION) == 1) {
// oops, not compatible.... can't load.
debug_buffer("Cannot load {$module_name}... It is not compatible with this version of CMSMS");
unset($obj);
return FALSE;
}
// okay, lessee if we can load the dependants
if (!isset($config['modules_noloaddependants'])) {
$deps = $obj->GetDependencies();
if (is_array($deps) && count($deps)) {
$res = true;
foreach ($deps as $name => $ver) {
$obj2 = $this->get_module_instance($name);
if (!is_object($obj2)) {
$res = false;
break;
}
}
if (!$res && !isset($CMS_FORCE_MODULE_LOAD)) {
debug_buffer("Cannot load {$module_name}... cannot load it's dependants.");
unset($obj);
return FALSE;
}
}
}
if (isset($info[$module_name]) && $info[$module_name]['status'] != 'installed' && (isset($CMS_INSTALL_PAGE) || $this->_is_queued_for_install($module_name))) {
// not installed, can we auto-install it?
if ((in_array($module_name, $this->cmssystemmodules) || $obj->AllowAutoInstall() == true || $this->_is_queued_for_install($module_name)) && $allow_auto) {
$res = $this->_install_module($obj);
if (!isset($_SESSION['moduleoperations_result'])) {
$_SESSION['moduleoperations_result'] = array();
}
$_SESSION['moduleoperations_result'][$module_name] = $res;
} else {
if (!isset($CMS_FORCE_MODULE_LOAD)) {
// nope, can't auto install...
unset($obj);
return FALSE;
}
}
}
// check to see if an upgrade is needed.
allow_admin_lang(TRUE);
// isn't this ugly.
if (isset($info[$module_name]) && $info[$module_name]['status'] == 'installed') {
$dbversion = $info[$module_name]['version'];
if (version_compare($dbversion, $obj->GetVersion()) == -1) {
// upgrade is needed
if (($obj->AllowAutoUpgrade() == TRUE || $this->_is_queued_for_install($module_name)) && $allow_auto) {
// we're allowed to upgrade
$res = $this->_upgrade_module($obj);
if (!isset($_SESSION['moduleoperations_result'])) {
$_SESSION['moduleoperations_result'] = array();
}
if ($res) {
return TRUE;
//$res2 = array(TRUE,lang('moduleupgraded'));
} else {
return FALSE;
//$res2 = array(FALSE,lang('moduleupgradeerror'));
}
$_SESSION['moduleoperations_result'][$module_name] = $res2;
if (!$res) {
// upgrade failed
allow_admin_lang(FALSE);
// isn't this ugly.
//.........这里部分代码省略.........