本文整理匯總了PHP中IPSDebug::getMemoryDebugFlag方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSDebug::getMemoryDebugFlag方法的具體用法?PHP IPSDebug::getMemoryDebugFlag怎麽用?PHP IPSDebug::getMemoryDebugFlag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSDebug
的用法示例。
在下文中一共展示了IPSDebug::getMemoryDebugFlag方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendOutput
/**
* Main output function
*
* @param bool Return finished output instead of printing
* @return @e void
*/
public function sendOutput($return = false)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$_NOW = IPSDebug::getMemoryDebugFlag();
$this->_sendOutputSetUp('normal');
//-----------------------------------------
// Ad Code
//-----------------------------------------
$adCodeData = array();
if ($this->registry->getClass('IPSAdCode')->userCanViewAds()) {
$adCodeData['adHeaderCode'] = $this->registry->getClass('IPSAdCode')->getGobalCode('header');
$adCodeData['adFooterCode'] = $this->registry->getClass('IPSAdCode')->getGobalCode('footer');
$adCodeData['adHeaderCode'] = $adCodeData['adHeaderCode'] ? $adCodeData['adHeaderCode'] : $this->registry->getClass('IPSAdCode')->getAdCode('ad_code_global_header');
$adCodeData['adFooterCode'] = $adCodeData['adFooterCode'] ? $adCodeData['adFooterCode'] : $this->registry->getClass('IPSAdCode')->getAdCode('ad_code_global_footer');
}
//-----------------------------------------
// Meta Tags
//-----------------------------------------
/* What's the page URL? */
$currentUrl = !$_SERVER['HTTPS'] || $_SERVER['HTTPS'] == 'off' ? 'http://' : 'https://';
$currentUrl .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$currentUrl = str_replace(array(ipsRegistry::$settings['board_url'], '/index.php?', '/index.php'), '', $currentUrl);
/* @link http://community.invisionpower.com/resources/bugs.html/_/ip-board/add-meta-tags-not-working-with-urls-containing-a-special-character-r41497 */
$encUrl = urldecode($currentUrl);
/* Add em in */
$metaTags = array();
$meta = $this->cache->getCache('meta_tags');
if (is_array($meta) && count($meta)) {
foreach ($meta as $page => $tags) {
if (is_array($tags) && count($tags)) {
$match = str_replace('/', '\\/', $page);
$match = str_replace('-', '\\-', $match);
$match = str_replace('_', '\\_', $match);
$match = str_replace('.', '\\.', $match);
$match = str_replace('*', '(.*)?', $match);
if (preg_match('/^' . $match . '$/', $currentUrl) or preg_match('/^' . $match . '$/', $encUrl)) {
foreach ($tags as $tag => $val) {
if ($tag == 'title') {
$this->setTitle($val);
} else {
$this->addMetaTag($tag, $val);
}
$metaTags[$tag] = $val;
}
}
}
}
}
//-----------------------------------------
// Gather output
//-----------------------------------------
$output = $this->outputFormatClass->fetchOutput($this->_html, $this->_title, $this->_navigation, $this->_documentHeadItems, $this->_jsLoader, $adCodeData);
$output = $this->templateHooks($output);
$output = $this->replaceMacros($output);
/* Live editing meta tags? */
if ($this->memberData['g_access_cp'] && !empty($this->memberData['_cache']['ipseo_live_meta_edit'])) {
$output = str_replace("<body id='ipboard_body'>", $this->registry->output->getTemplate('global')->metaEditor($metaTags, $currentUrl) . "<body id='ipboard_body'>", $output);
}
/* Gooooogle analytics?! */
if (!empty($this->settings['ipseo_ga'])) {
$output = preg_replace("#</head>#", $this->settings['ipseo_ga'] . '</head>', $output, 1);
}
//-----------------------------------------
// Check for SQL Debug
//-----------------------------------------
$this->_checkSQLDebug();
//-----------------------------------------
// Print it...
//-----------------------------------------
$this->outputFormatClass->printHeader();
/* Remove unused hook comments */
$output = preg_replace('#<!--hook\\.([^\\>]+?)-->#', '', $output);
/* Insert stats */
$output = str_replace('<!--DEBUG_STATS-->', $this->outputFormatClass->html_showDebugInfo(), $output);
/* Return output instead of printing? */
if ($return) {
IPSDebug::setMemoryDebugFlag("Output sent", $_NOW);
$this->outputFormatClass->finishUp();
return $output;
}
print $output;
IPSDebug::setMemoryDebugFlag("Output sent", $_NOW);
$this->outputFormatClass->finishUp();
exit;
}
示例2: query
/**
* Execute a direct database query
*
* @param string Database query
* @param boolean [Optional] Do not convert table prefix
* @return @e resource
*/
public function query($the_query, $bypass = false)
{
//-----------------------------------------
// Debug?
//-----------------------------------------
if ($this->obj['debug'] or $this->obj['use_debug_log'] and $this->obj['debug_log'] or $this->obj['use_bad_log'] and $this->obj['bad_log']) {
IPSDebug::startTimer();
$_MEMORY = IPSDebug::getMemoryDebugFlag();
}
//-----------------------------------------
// Stop sub selects? (UNION)
//-----------------------------------------
if (!IPS_DB_ALLOW_SUB_SELECTS) {
# On the spot allowance?
if (!$this->allow_sub_select) {
$_tmp = strtolower($this->_removeAllQuotes($the_query));
if (preg_match("#(?:/\\*|\\*/)#i", $_tmp)) {
$this->throwFatalError("You are not allowed to use comments in your SQL query.\nAdd \\ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them");
return false;
}
if (preg_match("#[^_a-zA-Z]union[^_a-zA-Z]#s", $_tmp)) {
$this->throwFatalError("UNION query joins are not allowed.\nAdd \\ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them");
return false;
} else {
if (preg_match_all("#[^_a-zA-Z](select)[^_a-zA-Z]#s", $_tmp, $matches)) {
if (count($matches) > 1) {
$this->throwFatalError("SUB SELECT query joins are not allowed.\nAdd \\ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them");
return false;
}
}
}
}
}
//-----------------------------------------
// Run the query
//-----------------------------------------
$this->_tmpQ = substr($the_query, 0, 100) . '...';
$this->query_id = mysqli_query($this->connection_id, $the_query);
//-----------------------------------------
// Reset array...
//-----------------------------------------
$this->resetDataTypes();
$this->allow_sub_select = false;
if (!$this->query_id) {
$this->throwFatalError("mySQL query error: {$the_query}");
}
//-----------------------------------------
// Logging?
//-----------------------------------------
if ($this->obj['use_debug_log'] and $this->obj['debug_log'] or $this->obj['use_bad_log'] and $this->obj['bad_log'] or $this->obj['use_slow_log'] and $this->obj['slow_log']) {
$endtime = IPSDebug::endTimer();
$_data = '';
if (preg_match("/^(?:\\()?select/i", $the_query)) {
$eid = mysqli_query($this->connection_id, "EXPLAIN {$the_query}");
$_bad = false;
while ($array = mysqli_fetch_array($eid)) {
$array['extra'] = isset($array['extra']) ? $array['extra'] : '';
$_data .= "\n+------------------------------------------------------------------------------+";
$_data .= "\n|Table: " . $array['table'];
$_data .= "\n|Type: " . $array['type'];
$_data .= "\n|Possible Keys: " . $array['possible_keys'];
$_data .= "\n|Key: " . $array['key'];
$_data .= "\n|Key Len: " . $array['key_len'];
$_data .= "\n|Ref: " . $array['ref'];
$_data .= "\n|Rows: " . $array['rows'];
$_data .= "\n|Extra: " . $array['Extra'];
//$_data .= "\n+------------------------------------------------------------------------------+";
if ($this->obj['use_bad_log'] and $this->obj['bad_log'] and (stristr($array['Extra'], 'filesort') or stristr($array['Extra'], 'temporary'))) {
$this->writeDebugLog($the_query, $_data, $endtime, $this->obj['bad_log'], TRUE);
}
if ($this->obj['use_slow_log'] and $this->obj['slow_log'] and $endtime >= $this->obj['use_slow_log']) {
$this->writeDebugLog($the_query, $_data, $endtime, $this->obj['slow_log'], TRUE);
}
}
if ($this->obj['use_debug_log'] and $this->obj['debug_log']) {
$this->writeDebugLog($the_query, $_data, $endtime);
}
} else {
if ($this->obj['use_debug_log'] and $this->obj['debug_log']) {
$this->writeDebugLog($the_query, $_data, $endtime);
}
}
}
//-----------------------------------------
// Debugging?
//-----------------------------------------
if ($this->obj['debug']) {
$endtime = IPSDebug::endTimer();
$memoryUsed = IPSDebug::setMemoryDebugFlag('', $_MEMORY);
$memory = '';
$shutdown = $this->is_shutdown ? 'SHUTDOWN QUERY: ' : '';
if (preg_match("/^(?:\\()?select/i", $the_query)) {
$eid = mysqli_query($this->connection_id, "EXPLAIN {$the_query}");
//.........這裏部分代碼省略.........
示例3: getCommand
/**
* Retreive the command
*
* @access public
* @param object ipsRegistry reference
* @return object
*/
public function getCommand(ipsRegistry $registry)
{
$_NOW = IPSDebug::getMemoryDebugFlag();
$module = ipsRegistry::$current_module;
$section = ipsRegistry::$current_section;
$filepath = IPSLib::getAppDir(IPS_APP_COMPONENT) . '/' . self::$modules_dir . '/' . $module . '/';
/* Got a section? */
if (!$section) {
if (file_exists($filepath . 'defaultSection.php')) {
$DEFAULT_SECTION = '';
require $filepath . 'defaultSection.php';
if ($DEFAULT_SECTION) {
$section = $DEFAULT_SECTION;
}
}
}
$classname = self::$class_dir . '_' . IPS_APP_COMPONENT . '_' . $module . '_' . $section;
if (file_exists($filepath . 'manualResolver.php')) {
require_once $filepath . 'manualResolver.php';
$classname = self::$class_dir . '_' . IPS_APP_COMPONENT . '_' . $module . '_manualResolver';
} else {
if (file_exists($filepath . $section . '.php')) {
require_once $filepath . $section . '.php';
}
}
/* Hooks: Are we overloading this class? */
$hooksCache = ipsRegistry::cache()->getCache('hooks');
if (isset($hooksCache['commandHooks']) and is_array($hooksCache['commandHooks']) and count($hooksCache['commandHooks'])) {
foreach ($hooksCache['commandHooks'] as $hook) {
foreach ($hook as $classOverloader) {
/* Hooks: Do we have a hook that extends this class? */
if ($classOverloader['classToOverload'] == $classname) {
if (file_exists(DOC_IPS_ROOT_PATH . 'hooks/' . $classOverloader['filename'])) {
/* Hooks: Do we have the hook file? */
require_once DOC_IPS_ROOT_PATH . 'hooks/' . $classOverloader['filename'];
if (class_exists($classOverloader['className'])) {
/* Hooks: We have the hook file and the class exists - reset the classname to load */
$classname = $classOverloader['className'];
}
}
}
}
}
}
IPSDebug::setMemoryDebugFlag("Controller getCommand executed", $_NOW);
if (class_exists($classname)) {
$cmd_class = new ReflectionClass($classname);
if ($cmd_class->isSubClassOf(self::$base_cmd)) {
return $cmd_class->newInstance();
} else {
throw new Exception("{$section} in {$module} does not exist!");
}
}
# Fudge it to return just the default object
return clone self::$default_cmd;
}
示例4: init
/**
* Initiate class
*
* @return @e void
*/
private function init()
{
if (self::$initiated !== TRUE) {
//--------------------------------
// Eaccelerator...
//--------------------------------
if (function_exists('eaccelerator_get') and ipsRegistry::$settings['use_eaccelerator'] == 1) {
require IPS_KERNEL_PATH . 'interfaces/interfaceCache.php';
/*noLibHook*/
require IPS_KERNEL_PATH . 'classCacheEaccelerator.php';
/*noLibHook*/
self::$cacheLib = new classCacheEaccelerator(ipsRegistry::$settings['board_url']);
} else {
if (function_exists('memcache_connect') and ipsRegistry::$settings['use_memcache'] == 1) {
require IPS_KERNEL_PATH . 'interfaces/interfaceCache.php';
/*noLibHook*/
require IPS_KERNEL_PATH . 'classCacheMemcache.php';
/*noLibHook*/
self::$cacheLib = new classCacheMemcache(ipsRegistry::$settings['board_url'], ipsRegistry::$settings);
} else {
if (function_exists('xcache_get') and ipsRegistry::$settings['use_xcache'] == 1) {
require IPS_KERNEL_PATH . 'interfaces/interfaceCache.php';
/*noLibHook*/
require IPS_KERNEL_PATH . 'classCacheXcache.php';
/*noLibHook*/
self::$cacheLib = new classCacheXcache(ipsRegistry::$settings['board_url']);
} else {
if (function_exists('apc_fetch') and ipsRegistry::$settings['use_apc'] == 1) {
require IPS_KERNEL_PATH . 'interfaces/interfaceCache.php';
/*noLibHook*/
require IPS_KERNEL_PATH . 'classCacheApc.php';
/*noLibHook*/
self::$cacheLib = new classCacheApc(ipsRegistry::$settings['board_url']);
} else {
if (function_exists('wincache_ucache_get') and ipsRegistry::$settings['use_wincache'] == 1) {
require IPS_KERNEL_PATH . 'interfaces/interfaceCache.php';
/*noLibHook*/
require IPS_KERNEL_PATH . 'classCacheWincache.php';
/*noLibHook*/
self::$cacheLib = new classCacheWincache(ipsRegistry::$settings['board_url']);
} else {
if (!empty(ipsRegistry::$settings['use_diskcache'])) {
require IPS_KERNEL_PATH . 'interfaces/interfaceCache.php';
/*noLibHook*/
require IPS_KERNEL_PATH . 'classCacheDiskcache.php';
/*noLibHook*/
self::$cacheLib = new classCacheDiskcache(ipsRegistry::$settings['board_url']);
}
}
}
}
}
}
if (is_object(self::$cacheLib) and self::$cacheLib->crashed) {
// There was a problem - not installed maybe?
// unset(self::$cacheLib);
self::$cacheLib = NULL;
}
$caches = array();
$_caches = array();
$_load = array();
$_pre_load = IPSDebug::getMemoryDebugFlag();
//-----------------------------------------
// Get default cache list
//-----------------------------------------
$CACHE = ipsRegistry::_fetchCoreVariables('cache');
$_LOAD = ipsRegistry::_fetchCoreVariables('cacheload');
if (is_array($CACHE)) {
foreach ($CACHE as $key => $data) {
if (!empty($data['acp_only']) and IPS_AREA != 'admin') {
continue;
}
$_caches[$key] = $CACHE;
if ($data['default_load']) {
$caches[$key] = $key;
}
}
if (count($_LOAD)) {
foreach ($_LOAD as $key => $one) {
$_load[$key] = $key;
}
}
}
//-----------------------------------------
// Get application cache list
//-----------------------------------------
if (IPS_APP_COMPONENT) {
$CACHE = ipsRegistry::_fetchAppCoreVariables(IPS_APP_COMPONENT, 'cache');
$_LOAD = ipsRegistry::_fetchAppCoreVariables(IPS_APP_COMPONENT, 'cacheload');
if (is_array($CACHE)) {
foreach ($CACHE as $key => $data) {
if (!empty($data['acp_only']) and IPS_AREA != 'admin') {
continue;
}
$_caches[$key] = $CACHE;
//.........這裏部分代碼省略.........
示例5: getCommand
/**
* Retreive the command
*
* @access public
* @param object ipsRegistry reference
* @return object
*/
public function getCommand(ipsRegistry $registry)
{
$_NOW = IPSDebug::getMemoryDebugFlag();
$module = ipsRegistry::$current_module;
$section = ipsRegistry::$current_section;
$filepath = IPSLib::getAppDir(IPS_APP_COMPONENT) . '/' . self::$modules_dir . '/' . $module . '/';
/* Bug Fix #21009 */
if (!ipsRegistry::$applications[IPS_APP_COMPONENT]['app_enabled']) {
throw new Exception("The specified application has been disabled");
}
if (!IN_ACP and !IPSLib::moduleIsEnabled($module, IPS_APP_COMPONENT) and $module != 'ajax') {
throw new Exception("The specified module has been disabled");
}
/* Got a section? */
if (!$section) {
if (is_file($filepath . 'defaultSection.php')) {
$DEFAULT_SECTION = '';
include $filepath . 'defaultSection.php';
/*noLibHook*/
if ($DEFAULT_SECTION) {
$section = $DEFAULT_SECTION;
ipsRegistry::$current_section = $section;
}
}
}
$_classname = self::$class_dir . '_' . IPS_APP_COMPONENT . '_' . $module . '_';
/* Rarely used, let's leave file_exists which is faster for non-existent files */
if (file_exists($filepath . 'manualResolver.php')) {
$classname = IPSLib::loadActionOverloader($filepath . 'manualResolver.php', $_classname . 'manualResolver');
} else {
if (is_file($filepath . $section . '.php')) {
$classname = IPSLib::loadActionOverloader($filepath . $section . '.php', $_classname . $section);
}
}
IPSDebug::setMemoryDebugFlag("Controller getCommand executed");
if (class_exists($classname)) {
$cmd_class = new ReflectionClass($classname);
if ($cmd_class->isSubClassOf(self::$base_cmd)) {
return $cmd_class->newInstance();
} else {
throw new Exception("{$section} in {$module} does not exist!");
}
} else {
throw new Exception("{$classname} does not exist!");
}
# Fudge it to return just the default object
return clone self::$default_cmd;
}
示例6: preDisplayParse
/**
* This function processes the DB post before printing as output
*
* @access public
* @param string Raw text
* @return string Converted text
*/
public function preDisplayParse($txt = "")
{
$this->cache->updateCacheWithoutSaving('_tmp_bbcode_media', 0);
$this->cache->updateCacheWithoutSaving('_tmp_bbcode_images', 0);
if ($this->parse_html) {
//-----------------------------------------
// Store true line breaks first
//-----------------------------------------
$txt = str_replace('<br />', "~~~~~_____~~~~~", $txt);
$txt = $this->_parseHtml($txt);
/* We still don't want XSS thx */
if (!$this->skipXssCheck) {
$txt = $this->checkXss($txt, true);
}
}
/* http://community.invisionpower.com/resources/bugs.html/_/ip-board/profile-quotes-in-likes-tab-does-not-appear-r42346
else
{
$txt = str_replace( ' ', ' ', $txt );
}*/
//-----------------------------------------
// Fix "{style_images_url}"
//-----------------------------------------
$txt = str_replace("{style_images_url}", "{style_images_url}", $txt);
//-----------------------------------------
// Custom BB code
//-----------------------------------------
$_NOW = IPSDebug::getMemoryDebugFlag();
IPSDebug::setMemoryDebugFlag("PreDisplayParse - parsed BBCode", $_NOW);
//-----------------------------------------
// Fix line breaks
//-----------------------------------------
if ($this->parse_html) {
$txt = str_replace("~~~~~_____~~~~~", '<br />', $txt);
}
$_memberData = array('member_group_id' => $this->parsing_mgroup, 'mgroup_others' => $this->parsing_mgroup_others);
if ($this->parsing_mgroup) {
$_memberData = array_merge($_memberData, $this->caches['group_cache'][$this->parsing_mgroup]);
}
if ($this->parsing_mgroup_others) {
$_memberData = ips_MemberRegistry::setUpSecondaryGroups($_memberData);
}
/* Finish hiiiiiiiiiiiiiiim */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
$parser = new $classToLoad();
$parser->set(array('memberData' => $_memberData, 'parseBBCode' => $this->parse_bbcode, 'parseArea' => $this->parsing_section, 'parseHtml' => $this->parse_html, 'parseEmoticons' => $this->parse_smilies));
/* Convert emos back into code */
$txt = $parser->emoticonImgtoCode($txt);
$txt = $parser->display($txt);
//-----------------------------------------
// Fix images nested inside anchors
//-----------------------------------------
$txt = preg_replace_callback('#(\\<a[^\\>]+bbc_url[^\\>]+\\>)\\s*?(.+?)\\s*?(\\<\\/a\\>)#im', array($this, 'removeLightboxSpans'), $txt);
return $txt;
}
示例7: topicSetUp
/**
* Topic set up ya'll
*
* @return @e void
*/
public function topicSetUp($topicData)
{
/* Init */
$topicData = $topicData['tid'] ? $topicData : $this->registry->getClass('topics')->getTopicData();
$forumData = $this->forumClass->getForumById($topicData['forum_id']);
$permissionData = $this->registry->getClass('topics')->getPermissionData();
//-----------------------------------------
// Memory...
//-----------------------------------------
$_before = IPSDebug::getMemoryDebugFlag();
//-----------------------------------------
// INIT
//-----------------------------------------
$this->request['start'] = !empty($this->request['start']) ? intval($this->request['start']) : '';
$this->request['page'] = !empty($this->request['page']) ? intval($this->request['page']) : '';
$this->settings['post_order_column'] = $this->settings['post_order_column'] != 'post_date' ? 'pid' : 'post_date';
$this->settings['post_order_sort'] = $this->settings['post_order_sort'] != 'desc' ? 'asc' : 'desc';
$this->settings['au_cutoff'] = empty($this->settings['au_cutoff']) ? 15 : $this->settings['au_cutoff'];
//-----------------------------------------
// Compile the language file
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile(array('public_boards', 'public_topic'));
$this->registry->class_localization->loadLanguageFile(array('public_editors'), 'core');
//-----------------------------------------
// Get all the member groups and
// member title info
//-----------------------------------------
if (!is_array($this->cache->getCache('ranks'))) {
$this->cache->rebuildCache('ranks', 'global');
}
//-----------------------------------------
// Are we actually a moderator for this forum?
//-----------------------------------------
if (!$this->memberData['g_is_supmod']) {
$moderator = $this->memberData['forumsModeratorData'];
if (!isset($moderator[$forumData['id']]) or !is_array($moderator[$forumData['id']])) {
$this->memberData['is_mod'] = 0;
}
}
$this->settings['_base_url'] = $this->settings['base_url'];
$this->first = $this->registry->getClass('topics')->pageToSt($this->request['page']);
$this->request['view'] = !empty($this->request['view']) ? $this->request['view'] : NULL;
//-----------------------------------------
// Check viewing permissions, private forums,
// password forums, etc
//-----------------------------------------
if (!$this->memberData['g_other_topics'] and $topicData['starter_id'] != $this->memberData['member_id']) {
$this->registry->output->showError('topics_not_yours', 10359, null, null, 403);
} else {
if (!$forumData['can_view_others'] and !$this->memberData['is_mod'] and $topicData['starter_id'] != $this->memberData['member_id']) {
$this->registry->output->showError('topics_not_yours2', 10360, null, null, 403);
} else {
if ($forumData['redirect_on'] and $forumData['redirect_url']) {
$this->registry->output->silentRedirect($forumData['redirect_url']);
}
}
}
//-----------------------------------------
// Update the topic views counter
//-----------------------------------------
if (!$this->request['view'] and $topicData['state'] != 'link') {
if ($this->settings['update_topic_views_immediately']) {
$this->DB->update('topics', 'views=views+1', "tid=" . $topicData['tid'], true, true);
} else {
$this->DB->insert('topic_views', array('views_tid' => $topicData['tid']), true);
}
}
//-----------------------------------------
// Need to update this topic?
//-----------------------------------------
if ($topicData['state'] == 'open') {
if (!$topicData['topic_open_time'] or $topicData['topic_open_time'] < $topicData['topic_close_time']) {
if ($topicData['topic_close_time'] and ($topicData['topic_close_time'] <= time() and (time() >= $topicData['topic_open_time'] or !$topicData['topic_open_time']))) {
$topicData['state'] = 'closed';
$this->DB->update('topics', array('state' => 'closed'), 'tid=' . $topicData['tid'], true);
}
} else {
if ($topicData['topic_open_time'] or $topicData['topic_open_time'] > $topicData['topic_close_time']) {
if ($topicData['topic_close_time'] and ($topicData['topic_close_time'] <= time() and time() <= $topicData['topic_open_time'])) {
$topicData['state'] = 'closed';
$this->DB->update('topics', array('state' => 'closed'), 'tid=' . $topicData['tid'], true);
}
}
}
} else {
if ($topicData['state'] == 'closed') {
if (!$topicData['topic_close_time'] or $topicData['topic_close_time'] < $topicData['topic_open_time']) {
if ($topicData['topic_open_time'] and ($topicData['topic_open_time'] <= time() and (time() >= $topicData['topic_close_time'] or !$topicData['topic_close_time']))) {
$topicData['state'] = 'open';
$this->DB->update('topics', array('state' => 'open'), 'tid=' . $topicData['tid'], true);
}
} else {
if ($topicData['topic_close_time'] or $topicData['topic_close_time'] > $topicData['topic_open_time']) {
if ($topicData['topic_open_time'] and ($topicData['topic_open_time'] <= time() and time() <= $topicData['topic_close_time'])) {
$topicData['state'] = 'open';
//.........這裏部分代碼省略.........
示例8: preDisplayParse
/**
* Parses the bbcode to be shown in the browser. Expects preDbParse has already been done before the save.
* If all bbcodes are parse on save, this method does nothing really
*
* @access public
* @param string Raw input text to parse
* @return string Parsed text ready to be displayed
*/
public function preDisplayParse($text)
{
$_NOW = IPSDebug::getMemoryDebugFlag();
$this->_passSettings();
//-----------------------------------------
// Parse
//-----------------------------------------
$text = $this->bbclass->preDisplayParse($text);
IPSDebug::setMemoryDebugFlag("PreDisplayParse completed", $_NOW);
return $text;
}
示例9: preDisplayParse
/**
* This function processes the DB post before printing as output
*
* @access public
* @param string Raw text
* @return string Converted text
*/
public function preDisplayParse($txt = "")
{
if ($this->parse_html) {
$txt = $this->_parseHtml($txt);
}
//-----------------------------------------
// Fix "{style_images_url}"
//-----------------------------------------
$txt = str_replace("{style_images_url}", "{style_images_url}", $txt);
//-----------------------------------------
// Custom BB code
//-----------------------------------------
$_NOW = IPSDebug::getMemoryDebugFlag();
if ($this->parse_bbcode) {
$txt = $this->parseBbcode($txt, 'display');
}
IPSDebug::setMemoryDebugFlag("PreDisplayParse - parsed BBCode", $_NOW);
$_NOW = IPSDebug::getMemoryDebugFlag();
if ($this->parse_wordwrap > 0) {
$txt = $this->applyWordwrap($txt, $this->parse_wordwrap);
}
IPSDebug::setMemoryDebugFlag("PreDisplayParse - applied wordwrap", $_NOW);
//-----------------------------------------
// Protect against XSS
//-----------------------------------------
$txt = $this->checkXss($txt);
//-----------------------------------------
// And fix old youtube embedded videos..
//-----------------------------------------
/*if( stripos( $txt, "<object" ) AND stripos( $txt, "<embed" ) )
{
//$txt = preg_replace( "#<object(.+?)<embed(.+?)></embed></object>#i", "<embed\\2</embed>", $txt );
$txt = preg_replace( "#<object(.+?)<embed.+?></embed></object>#i", "<object\\1</object>", $txt );
}*/
return $txt;
}
示例10: topicSetUp
/**
* Topic set up ya'll
*
* @access public
* @return void
**/
public function topicSetUp()
{
//-----------------------------------------
// Memory...
//-----------------------------------------
$_before = IPSDebug::getMemoryDebugFlag();
//-----------------------------------------
// INIT
//-----------------------------------------
$this->request['start'] = !empty($this->request['start']) ? intval($this->request['start']) : '';
$this->request['st'] = !empty($this->request['st']) ? intval($this->request['st']) : '';
//-----------------------------------------
// Compile the language file
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile(array('public_boards', 'public_topic'));
$this->registry->class_localization->loadLanguageFile(array('public_editors'), 'core');
//-----------------------------------------
// Get all the member groups and
// member title info
//-----------------------------------------
if (!is_array($this->cache->getCache('ranks'))) {
$this->cache->rebuildCache('ranks', 'global');
}
//-----------------------------------------
// Are we actually a moderator for this forum?
//-----------------------------------------
if (!$this->memberData['g_is_supmod']) {
$moderator = $this->memberData['forumsModeratorData'];
if (!isset($moderator[$this->forum['id']]) or !is_array($moderator[$this->forum['id']])) {
$this->memberData['is_mod'] = 0;
}
}
$this->settings['_base_url'] = $this->settings['base_url'];
$this->forum['FORUM_JUMP'] = $this->registry->getClass('class_forums')->buildForumJump();
$this->first = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0;
$this->request['view'] = !empty($this->request['view']) ? $this->request['view'] : NULL;
//-----------------------------------------
// Check viewing permissions, private forums,
// password forums, etc
//-----------------------------------------
if (!$this->memberData['g_other_topics'] and $this->topic['starter_id'] != $this->memberData['member_id']) {
$this->registry->output->showError('topics_not_yours', 10359);
} else {
if (!$this->forum['can_view_others'] and !$this->memberData['is_mod'] and $this->topic['starter_id'] != $this->memberData['member_id']) {
$this->registry->output->showError('topics_not_yours2', 10360);
}
}
//-----------------------------------------
// Update the topic views counter
//-----------------------------------------
if (!$this->request['view'] and $this->topic['state'] != 'link') {
if ($this->settings['update_topic_views_immediately']) {
$this->DB->update('topics', 'views=views+1', "tid=" . $this->topic['tid'], true, true);
} else {
$this->DB->insert('topic_views', array('views_tid' => $this->topic['tid']), true);
}
}
//-----------------------------------------
// Need to update this topic?
//-----------------------------------------
if ($this->topic['state'] == 'open') {
if (!$this->topic['topic_open_time'] or $this->topic['topic_open_time'] < $this->topic['topic_close_time']) {
if ($this->topic['topic_close_time'] and ($this->topic['topic_close_time'] <= time() and (time() >= $this->topic['topic_open_time'] or !$this->topic['topic_open_time']))) {
$this->topic['state'] = 'closed';
$this->DB->update('topics', array('state' => 'closed'), 'tid=' . $this->topic['tid'], true);
}
} else {
if ($this->topic['topic_open_time'] or $this->topic['topic_open_time'] > $this->topic['topic_close_time']) {
if ($this->topic['topic_close_time'] and ($this->topic['topic_close_time'] <= time() and time() <= $this->topic['topic_open_time'])) {
$this->topic['state'] = 'closed';
$this->DB->update('topics', array('state' => 'closed'), 'tid=' . $this->topic['tid'], true);
}
}
}
} else {
if ($this->topic['state'] == 'closed') {
if (!$this->topic['topic_close_time'] or $this->topic['topic_close_time'] < $this->topic['topic_open_time']) {
if ($this->topic['topic_open_time'] and ($this->topic['topic_open_time'] <= time() and (time() >= $this->topic['topic_close_time'] or !$this->topic['topic_close_time']))) {
$this->topic['state'] = 'open';
$this->DB->update('topics', array('state' => 'open'), 'tid=' . $this->topic['tid'], true);
}
} else {
if ($this->topic['topic_close_time'] or $this->topic['topic_close_time'] > $this->topic['topic_open_time']) {
if ($this->topic['topic_open_time'] and ($this->topic['topic_open_time'] <= time() and time() <= $this->topic['topic_close_time'])) {
$this->topic['state'] = 'open';
$this->DB->update('topics', array('state' => 'open'), 'tid=' . $this->topic['tid'], true);
}
}
}
}
}
//-----------------------------------------
// Current topic rating value
//-----------------------------------------
//.........這裏部分代碼省略.........
示例11: loadLanguageFile
/**
* Loads the language file, also loads the global lang file if not loaded
*
* @access public
* @param array [$load] Array of lang files to load
* @param string [$app] Specify application to use
* @param string [$lang] Language pack to use
* @return void
*/
public function loadLanguageFile($load = array(), $app = '', $lang = '')
{
$_MASTER2 = IPSDebug::getMemoryDebugFlag();
/* App */
$app = $app ? $app : IPS_APP_COMPONENT;
$load = $load ? $load : array();
$global = IPS_AREA == 'admin' ? 'core_admin_global' : 'core_public_global';
$_global = str_replace('core_', '', $global);
if ($lang and !IN_DEV) {
$tempLangId = $this->lang_id;
$this->lang_id = $lang;
}
/* Some older calls may still think $load is a string... */
if (is_string($load)) {
$load = array($load);
}
/* Has the global language file been loaded? */
if (!in_array($global, $this->loaded_lang_files) and ($app == 'core' and !in_array($_global, $load))) {
$load[] = $global;
}
/* Load the language file */
$errors = '';
if ($this->load_from_db or $this->_forceEnglish) {
if (is_array($load) and count($load)) {
/* Reformat for query and make sure we're not loading something twice */
$_load = array();
foreach ($load as $l) {
/* Already loaded? */
if (!in_array($app . $l, $this->loaded_lang_files)) {
/* Reformat */
$_load[] = "'{$l}'";
}
/* Add to the loaded array */
$this->loaded_lang_files[] = $app . '_' . $l;
}
/* Query the lang entries */
$this->DB->build(array('select' => 'word_key, word_default, word_custom', 'from' => 'core_sys_lang_words', 'where' => "lang_id={$this->lang_id} AND word_app='{$app}' AND word_pack IN ( " . implode(',', $_load) . " )"));
$this->DB->execute();
/* Add to the language array */
while ($r = $this->DB->fetch()) {
$this->words[$r['word_key']] = $this->_forceEnglish ? $r['word_default'] : ($r['word_custom'] ? $r['word_custom'] : $r['word_default']);
}
}
} else {
if (is_array($load) and count($load)) {
foreach ($load as $l) {
/* Load global from the core app */
if ($l == $global) {
$_file = IPS_CACHE_PATH . 'cache/lang_cache/' . $this->lang_id . '/' . $l . '.php';
$_test = $l;
} else {
$_file = IPS_CACHE_PATH . 'cache/lang_cache/' . $this->lang_id . '/' . $app . '_' . $l . '.php';
$_test = $app . '_' . $l;
}
if (!in_array($_test, $this->loaded_lang_files)) {
if (file_exists($_file)) {
require $_file;
foreach ($lang as $k => $v) {
$this->words[$k] = $v;
}
$this->loaded_lang_files[] = $_test;
IPSDebug::setMemoryDebugFlag("Loaded Language File: " . str_replace(IPS_CACHE_PATH, '', $_file), $_MASTER2);
} else {
$errors .= "<li>Missing Language File: " . $_file;
IPSDebug::setMemoryDebugFlag("NO SUCH Language File: " . str_replace(IPS_CACHE_PATH, '', $_file), $_MASTER2);
}
} else {
IPSDebug::setMemoryDebugFlag("ALREADY LOADED Language File: " . str_replace(IPS_CACHE_PATH, '', $_file), $_MASTER2);
}
}
}
}
if (isset($tempLangId) and $tempLangId) {
$this->lang_id = $tempLangId;
}
if ($errors && IN_ACP) {
return "<ul>{$errors}</ul>";
}
}
示例12: buildDisplayData
/**
* Parse a member for display
*
* @param mixed Either array of member data, or member ID to self load
* @param array Array of flags to parse: 'signature', 'customFields', 'warn'
* @return array Parsed member data
*/
public static function buildDisplayData($member, $_parseFlags = array())
{
$_NOW = IPSDebug::getMemoryDebugFlag();
/* test to see if member_title has been passed */
if (isset($member['member_title'])) {
$member['title'] = $member['member_title'];
}
//-----------------------------------------
// Figure out parse flags
//-----------------------------------------
$parseFlags = array('signature' => isset($_parseFlags['signature']) ? $_parseFlags['signature'] : 0, 'customFields' => isset($_parseFlags['customFields']) ? $_parseFlags['customFields'] : 0, 'reputation' => isset($_parseFlags['reputation']) ? $_parseFlags['reputation'] : 1, 'warn' => isset($_parseFlags['warn']) ? $_parseFlags['warn'] : 1, 'cfSkinGroup' => isset($_parseFlags['cfSkinGroup']) ? $_parseFlags['cfSkinGroup'] : '', 'cfGetGroupData' => isset($_parseFlags['cfGetGroupData']) ? $_parseFlags['cfGetGroupData'] : '', 'cfLocation' => isset($_parseFlags['cfLocation']) ? $_parseFlags['cfLocation'] : '', 'checkFormat' => isset($_parseFlags['checkFormat']) ? $_parseFlags['checkFormat'] : 0, 'photoTagSize' => isset($_parseFlags['photoTagSize']) ? $_parseFlags['photoTagSize'] : false, 'spamStatus' => isset($_parseFlags['spamStatus']) ? $_parseFlags['spamStatus'] : 0);
if (isset($_parseFlags['__all__'])) {
foreach ($parseFlags as $k => $v) {
if (in_array($k, array('cfSkinGroup', 'cfGetGroupData', 'photoTagSize'))) {
continue;
}
$parseFlags[$k] = 1;
}
$parseFlags['spamStatus'] = !empty($parseFlags['spamStatus']) ? 1 : 0;
}
//-----------------------------------------
// Load the member?
//-----------------------------------------
if (!is_array($member) and ($member == intval($member) and $member > 0)) {
$member = self::load($member, 'all');
}
//-----------------------------------------
// Caching
//-----------------------------------------
static $buildMembers = array();
$_key = $member['member_id'];
$_arr = serialize($member);
foreach ($parseFlags as $_flag => $_value) {
$_key .= $_flag . $_value;
}
$_key = md5($_key . $_arr);
if (isset($buildMembers[$_key])) {
IPSDebug::setMemoryDebugFlag("IPSMember::buildDisplayData: " . $member['member_id'] . " - CACHED", $_NOW);
return $buildMembers[$_key];
}
//-----------------------------------------
// Basics
//-----------------------------------------
if (!$member['member_group_id']) {
$member['member_group_id'] = ipsRegistry::$settings['guest_group'];
}
/* Unpack bitwise if required */
if (!isset($member['bw_is_spammer'])) {
$member = self::buildBitWiseOptions($member);
}
//-----------------------------------------
// INIT
//-----------------------------------------
$rank_cache = ipsRegistry::cache()->getCache('ranks');
$group_cache = ipsRegistry::cache()->getCache('group_cache');
$group_name = self::makeNameFormatted($group_cache[$member['member_group_id']]['g_title'], $member['member_group_id']);
$pips = 0;
$topic_id = intval(isset(ipsRegistry::$request['t']) ? ipsRegistry::$request['t'] : 0);
$forum_id = intval(isset(ipsRegistry::$request['f']) ? ipsRegistry::$request['f'] : 0);
//-----------------------------------------
// SEO Name
//-----------------------------------------
$member['members_seo_name'] = self::fetchSeoName($member);
$member['_group_formatted'] = $group_name;
//-----------------------------------------
// Ranks
//-----------------------------------------
if (is_array($rank_cache) and count($rank_cache)) {
foreach ($rank_cache as $k => $v) {
if ($member['posts'] >= $v['POSTS']) {
if (empty($member['title'])) {
$member['title'] = $v['TITLE'];
}
$pips = $v['PIPS'];
break;
}
}
}
//-----------------------------------------
// Group image
//-----------------------------------------
$member['member_rank_img'] = '';
$member['member_rank_img_i'] = '';
if ($group_cache[$member['member_group_id']]['g_icon']) {
$_img = $group_cache[$member['member_group_id']]['g_icon'];
if (substr($_img, 0, 4) != 'http' and strpos($_img, '{style_images_url}') === false) {
$_img = ipsRegistry::$settings['_original_base_url'] . '/' . ltrim($_img, '/');
}
$member['member_rank_img_i'] = 'img';
$member['member_rank_img'] = $_img;
} else {
if ($pips and $member['member_id']) {
if (is_numeric($pips)) {
//.........這裏部分代碼省略.........
示例13: initData
/**
* Initializes cache, loads kernel class, and formats data for kernel class
*
* @param string $type Set to view for displaying the field normally or edit for displaying in a form
* @param bool $mlist Whether this is the memberlist or not
* @return @e void
*/
public function initData($type = 'view', $mlist = 0, $attributes = array())
{
/* Store Type */
$this->type = $type;
/* Get Member */
if (!count($this->member_data) and $this->mem_data_id && !$mlist) {
$this->member_data = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'pfields_content', 'where' => 'member_id=' . intval($this->mem_data_id)));
}
if (count($this->member_data)) {
$this->mem_data_id = isset($this->member_data['member_id']) ? $this->member_data['member_id'] : 0;
}
if (!$this->init) {
/* Cache data... */
if (!is_array($this->cache_data)) {
$this->DB->build(array('select' => '*', 'from' => 'pfields_data', 'order' => 'pf_group_id,pf_position'));
$this->DB->execute();
while ($r = $this->DB->fetch()) {
$this->cache_data[$r['pf_id']] = $r;
}
}
}
/* Get names... */
if (is_array($this->cache_data) and count($this->cache_data)) {
foreach ($this->cache_data as $id => $data) {
/* Field names and descriptions */
$this->field_names[$id] = $data['pf_title'];
$this->field_desc[$id] = $data['pf_desc'];
/* In Fields */
foreach ($this->cache_data as $id => $data) {
$data['pf_key'] = !empty($data['pf_key']) ? $data['pf_key'] : '_key_' . $data['pf_id'];
$data['pf_group_key'] = $data['pf_group_key'] ? $data['pf_group_key'] : '_other';
if ($mlist) {
$this->in_fields[$id] = '';
if (!empty(ipsRegistry::$request['field_' . $id])) {
if (is_string(ipsRegistry::$request['field_' . $id])) {
$this->in_fields[$id] = urldecode(ipsRegistry::$request['field_' . $id]);
} else {
if (is_array(ipsRegistry::$request['field_' . $id])) {
foreach (ipsRegistry::$request['field_' . $id] as $k => $v) {
$this->in_fields[$id][$k] = urldecode($v);
}
}
}
}
} else {
$_val = '';
if (is_string(ipsRegistry::$request['field_' . $id])) {
$_val = urldecode(ipsRegistry::$request['field_' . $id]);
} else {
if (is_array(ipsRegistry::$request['field_' . $id])) {
foreach (ipsRegistry::$request['field_' . $id] as $k => $v) {
$_val[$k] = urldecode($v);
}
}
}
$this->in_fields[$id] = isset($this->member_data['field_' . $id]) ? $this->member_data['field_' . $id] : $_val;
}
}
}
}
/* Clean up on aisle #4 */
$this->out_fields = array();
$this->out_chosen = array();
/* Format data for kernel class */
foreach ($this->cache_data as $k => $v) {
/* Add any option to dropdown */
if ($v['pf_type'] == 'drop' && $mlist) {
$v['pf_content'] = '0=|' . $v['pf_content'];
}
/* Field Info */
$this->cache_data[$k]['id'] = $v['pf_id'];
$this->cache_data[$k]['type'] = $v['pf_type'];
$this->cache_data[$k]['data'] = $v['pf_content'];
$this->cache_data[$k]['value'] = $this->in_fields[$k];
/* Field Restrictions */
$this->cache_data[$k]['restrictions'] = array('max_size' => isset($v['pf_max_input']) ? $v['pf_max_input'] : '', 'min_size' => isset($v['pf_min_input']) ? $v['pf_min_input'] : '', 'not_null' => isset($v['pf_not_null']) ? $v['pf_not_null'] : '', 'format' => isset($v['pf_input_format']) ? $v['pf_input_format'] : '', 'urlfilter' => isset($v['pf_filtering']) ? $v['pf_filtering'] : '');
if (!empty($attributes)) {
if (!isset($this->cache_data[$k]['attributes'])) {
$this->cache_data[$k]['attributes'] = $attributes;
} else {
$this->cache_data[$k]['attributes'] = array_merge($this->cache_data[$k]['attributes'], $attributes);
}
}
}
/* Kernel profile field class */
$_NOW = IPSDebug::getMemoryDebugFlag();
$classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classCustomFields.php', 'classCustomFields');
IPSDebug::setMemoryDebugFlag("Get CustomFields Kernel Class", $_NOW);
$this->cfields_obj = new $classToLoad($this->cache_data, $type, $attributes);
$this->cfields = $this->cfields_obj->cfields;
$this->init = 1;
}
示例14: parsePost
/**
* Builds an array of post data for output
*
* @param array $row Array of post data
* @return array
*/
public function parsePost(array $post)
{
/* Init */
$topicData = $this->getTopicData();
$forumData = $this->registry->getClass('class_forums')->getForumById($topicData['forum_id']);
$permissionData = $this->getPermissionData();
/* Start memory debug */
$_NOW = IPSDebug::getMemoryDebugFlag();
$poster = array();
/* Bitwise options */
$_tmp = IPSBWOptions::thaw($post['post_bwoptions'], 'posts', 'forums');
if (count($_tmp)) {
foreach ($_tmp as $k => $v) {
$post[$k] = $v;
}
}
/* Is this a member? */
if ($post['author_id'] != 0) {
$poster = $this->parseMember($post);
} else {
/* Sort out guest */
$post['author_name'] = $this->settings['guest_name_pre'] . $post['author_name'] . $this->settings['guest_name_suf'];
$poster = IPSMember::setUpGuest($post['author_name']);
$poster['members_display_name'] = $post['author_name'];
$poster['_members_display_name'] = $post['author_name'];
$poster['custom_fields'] = "";
$poster['warn_img'] = "";
$poster = IPSMember::buildProfilePhoto($poster);
}
/* Memory debug */
IPSDebug::setMemoryDebugFlag("PID: " . $post['pid'] . " - Member Parsed", $_NOW);
/* Update permission */
$this->registry->getClass('class_forums')->setMemberData($this->getMemberData());
$permissionData['softDelete'] = $this->registry->getClass('class_forums')->canSoftDeletePosts($topicData['forum_id'], $post);
/* Soft delete */
$post['_softDelete'] = $post['pid'] != $topicData['topic_firstpost'] ? $permissionData['softDelete'] : FALSE;
$post['_softDeleteRestore'] = $permissionData['softDeleteRestore'];
$post['_softDeleteSee'] = $permissionData['softDeleteSee'];
$post['_softDeleteReason'] = $permissionData['softDeleteReason'];
$post['_softDeleteContent'] = $permissionData['softDeleteContent'];
$post['_isVisible'] = $this->registry->getClass('class_forums')->fetchHiddenType($post) == 'visible' ? true : false;
$post['_isHidden'] = $this->registry->getClass('class_forums')->fetchHiddenType($post) == 'hidden' ? true : false;
$post['_isDeleted'] = $this->registry->getClass('class_forums')->fetchHiddenType($post) == 'sdelete' ? true : false;
/* Answered post */
try {
$post['_isMarkedAnswered'] = $this->postIsAnswer($post, $topicData) ? true : false;
} catch (Exception $e) {
$post['_isMarkedAnswered'] = false;
}
$post['_canMarkUnanswered'] = $post['_isMarkedAnswered'] === true && $this->canUnanswerTopic($topicData) ? true : false;
$post['_canAnswer'] = $post['_isMarkedAnswered'] === false && $this->canAnswerTopic($topicData) ? true : false;
$post['PermalinkUrlBit'] = '';
/* Queued */
if ($topicData['topic_firstpost'] == $post['pid'] and ($post['_isHidden'] or $topicData['_isHidden'])) {
$post['queued'] = 1;
$post['_isHidden'] = true;
}
if ($topicData['topic_queuedposts'] || $topicData['topic_deleted_posts']) {
if ($topicData['topic_queuedposts'] && $topicData['Perms']['canQueuePosts']) {
/* We have hidden data that is viewable */
$post['PermalinkUrlBit'] = '&p=' . $post['pid'];
}
if ($topicData['topic_deleted_posts'] && $post['_softDeleteSee']) {
/* We have hidden data that is viewable */
$post['PermalinkUrlBit'] = '&p=' . $post['pid'];
}
}
/* Edited stuff */
$post['edit_by'] = "";
if ($post['append_edit'] == 1 and $post['edit_time'] != "" and $post['edit_name'] != "") {
$e_time = $this->registry->class_localization->getDate($post['edit_time'], 'LONG');
$post['edit_by'] = sprintf($this->lang->words['edited_by'], $post['edit_name'], $e_time);
}
/* Now parse the post */
if (!isset($post['cache_content']) or !$post['cache_content']) {
$_NOW2 = IPSDebug::getMemoryDebugFlag();
/* Grab the parser file */
if ($this->_parser === null) {
/* Load parser */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
$this->_parser = new $classToLoad();
}
/* set up parser */
$this->_parser->set(array('memberData' => array('member_id' => $post['member_id'], 'member_group_id' => $post['member_group_id'], 'mgroup_others' => $post['mgroup_others']), 'parseBBCode' => $forumData['use_ibc'], 'parseHtml' => ($forumData['use_html'] and $poster['g_dohtml'] and $post['post_htmlstate']) ? 1 : 0, 'parseEmoticons' => $post['use_emo'], 'parseArea' => 'topics'));
$post['post'] = $this->_parser->display($post['post']);
IPSDebug::setMemoryDebugFlag("topics::parsePostRow - bbcode parse - Completed", $_NOW2);
IPSContentCache::update($post['pid'], 'post', $post['post']);
} else {
$post['post'] = '<!--cached-' . gmdate('r', $post['cache_updated']) . '-->' . $post['cache_content'];
}
/* Buttons */
$post['_can_delete'] = $post['pid'] != $topicData['topic_firstpost'] ? $this->canDeletePost($post) : FALSE;
$post['_can_edit'] = $this->canEditPost($post);
$post['_show_ip'] = $this->canSeeIp();
//.........這裏部分代碼省略.........
示例15: loadTemplate
/**
* Load a template file
*
* @access public
* @param string Template name
* @param string Application [defaults to current application]
* @return object
*/
public function loadTemplate($template, $app = '')
{
$app = $app ? $app : IPS_APP_COMPONENT;
/* Skin file exists? */
if (file_exists(IPSLib::getAppDir($app) . "/skin_cp/" . $template . ".php")) {
$_pre_load = IPSDebug::getMemoryDebugFlag();
require_once IPSLib::getAppDir($app) . "/skin_cp/" . $template . ".php";
IPSDebug::setMemoryDebugFlag("CORE: Template Loaded ({$template})", $_pre_load);
return new $template($this->registry);
} else {
$this->showError("Could not locate template: {$template}", 4100, true);
}
}