本文整理匯總了PHP中IPSDebug::setMemoryDebugFlag方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSDebug::setMemoryDebugFlag方法的具體用法?PHP IPSDebug::setMemoryDebugFlag怎麽用?PHP IPSDebug::setMemoryDebugFlag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSDebug
的用法示例。
在下文中一共展示了IPSDebug::setMemoryDebugFlag方法的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
//.........這裏部分代碼省略.........
self::instance()->getClass('output')->showError("{$message} {$moredetails}", 1001, true, null, 403);
}
}
}
/* Check server load */
if (ipsRegistry::$settings['load_limit'] > 0) {
$server_load = IPSDebug::getServerLoad();
if ($server_load) {
$loadinfo = explode("-", $server_load);
if (count($loadinfo)) {
self::$server_load = $loadinfo[0];
if (self::$server_load > ipsRegistry::$settings['load_limit']) {
self::instance()->getClass('output')->showError('server_too_busy', 2001);
}
}
}
}
/* Specific Ajax Check */
if (IPS_IS_AJAX and ipsRegistry::$request['section'] != 'warnings') {
if (self::$handles['member']->getProperty('g_view_board') != 1 || ipsRegistry::$settings['board_offline'] && !self::$handles['member']->getProperty('g_access_offline')) {
@header("Content-type: application/json;charset=" . IPS_DOC_CHAR_SET);
print json_encode(array('error' => 'no_permission', '__board_offline__' => 1));
exit;
}
}
/* Other public check */
if (IPB_THIS_SCRIPT == 'public' and IPS_ENFORCE_ACCESS === FALSE and (ipsRegistry::$request['section'] != 'login' and ipsRegistry::$request['section'] != 'lostpass' and IPS_IS_AJAX === FALSE and ipsRegistry::$request['section'] != 'rss' and ipsRegistry::$request['section'] != 'attach' and ipsRegistry::$request['module'] != 'task' and ipsRegistry::$request['section'] != 'captcha')) {
//-----------------------------------------
// Permission to see the board?
//-----------------------------------------
if (self::$handles['member']->getProperty('g_view_board') != 1) {
self::getClass('output')->showError('no_view_board', 1000, null, null, 403);
}
//--------------------------------
// Is the board offline?
//--------------------------------
if (ipsRegistry::$settings['board_offline'] == 1 and !IPS_IS_SHELL) {
if (self::$handles['member']->getProperty('g_access_offline') != 1) {
ipsRegistry::$settings['no_reg'] = 1;
self::getClass('output')->showBoardOffline();
}
}
//-----------------------------------------
// Do we have a display name?
//-----------------------------------------
if (!(ipsRegistry::$request['section'] == 'register' and (ipsRegistry::$request['do'] == 'complete_login' or ipsRegistry::$request['do'] == 'complete_login_do'))) {
if (!self::$handles['member']->getProperty('members_display_name')) {
$pmember = self::DB()->buildAndFetch(array('select' => '*', 'from' => 'members_partial', 'where' => "partial_member_id=" . self::$handles['member']->getProperty('member_id')));
if (!$pmember['partial_member_id']) {
$pmember = array('partial_member_id' => self::$handles['member']->getProperty('member_id'), 'partial_date' => time(), 'partial_email_ok' => self::$handles['member']->getProperty('email') == self::$handles['member']->getProperty('name') . '@' . self::$handles['member']->getProperty('joined') ? 0 : 1);
self::DB()->insert('members_partial', $pmember);
$pmember['partial_id'] = self::DB()->getInsertId();
}
self::instance()->getClass('output')->silentRedirect(ipsRegistry::$settings['base_url'] . 'app=core&module=global§ion=register&do=complete_login&mid=' . self::$handles['member']->getProperty('member_id') . '&key=' . $pmember['partial_date']);
}
}
//--------------------------------
// Is log in enforced?
//--------------------------------
if (!(defined('IPS_IS_SHELL') && IPS_IS_SHELL === TRUE) && (!IPS_IS_MOBILE_APP && self::$handles['member']->getProperty('member_group_id') == ipsRegistry::$settings['guest_group'] and ipsRegistry::$settings['force_login'] == 1 && !in_array(ipsRegistry::$request['section'], array('register', 'privacy', 'unsubscribe')))) {
if (ipsRegistry::$settings['logins_over_https'] and (!$_SERVER['HTTPS'] or $_SERVER['HTTPS'] != 'on')) {
//-----------------------------------------
// Set referrer
//-----------------------------------------
if (!my_getenv('HTTP_REFERER') or stripos(my_getenv('HTTP_REFERER'), ipsRegistry::$settings['board_url']) === false) {
$http_referrer = (strtolower($_SERVER['HTTPS']) == 'on' ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
} else {
$http_referrer = my_getenv('HTTP_REFERER');
}
self::instance()->getClass('output')->silentRedirect(str_replace('http://', 'https://', ipsRegistry::$settings['base_url']) . 'app=core&module=global§ion=login&referer=' . urlencode($http_referrer));
}
ipsRegistry::$request['app'] = 'core';
ipsRegistry::$request['module'] = 'login';
ipsRegistry::$request['core'] = 'login';
ipsRegistry::$request['referer'] = ipsRegistry::$request['referer'] ? ipsRegistry::$request['referer'] : (strtolower($_SERVER['HTTPS']) == 'on' ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if (is_file(DOC_IPS_ROOT_PATH . '/' . PUBLIC_DIRECTORY . '/style_css/' . ipsRegistry::getClass('output')->skin['_csscacheid'] . '/ipb_login_register.css')) {
ipsRegistry::getClass('output')->addToDocumentHead('importcss', ipsRegistry::$settings['css_base_url'] . 'style_css/' . ipsRegistry::getClass('output')->skin['_csscacheid'] . '/ipb_login_register.css');
}
$classToLoad = IPSLib::loadActionOverloader(IPSLib::getAppDir('core') . "/modules_public/global/login.php", 'public_core_global_login');
$runme = new $classToLoad(self::instance());
$runme->doExecute(self::instance());
exit;
}
}
/* Have we entered an incorrect FURL that has no match? */
if (ipsRegistry::$settings['use_friendly_urls'] and self::$_noFurlMatch === true) {
self::getClass('output')->showError('incorrect_furl', 404, null, null, 404);
} else {
if (isset(ipsRegistry::$request['act']) and ipsRegistry::$request['act'] == 'rssout') {
self::getClass('output')->showError('incorrect_furl', 404, null, null, 404);
}
}
/* Track search engine visits */
if (!IPS_IS_TASK and $_SERVER['HTTP_REFERER']) {
seoTracker::track($_SERVER['HTTP_REFERER'], self::$settings['query_string_real'], self::$handles['member']->getProperty('member_id'));
}
}
}
IPSDebug::setMemoryDebugFlag("Registry initialized");
}
示例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
//.........這裏部分代碼省略.........
$this->DB->update('topics', array('state' => 'open'), 'tid=' . $topicData['tid'], true);
}
}
}
}
}
//-----------------------------------------
// Current topic rating value
//-----------------------------------------
$topicData['_rate_show'] = 0;
$topicData['_rate_int'] = 0;
$topicData['_rate_img'] = '';
if ($topicData['state'] != 'open') {
$topicData['_allow_rate'] = 0;
} else {
$topicData['_allow_rate'] = $this->can_rate;
}
if ($forumData['forum_allow_rating']) {
$rating = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'topic_ratings', 'where' => "rating_tid={$topicData['tid']} and rating_member_id=" . $this->memberData['member_id']));
if ($rating['rating_value'] and $this->memberData['g_topic_rate_setting'] != 2) {
$topicData['_allow_rate'] = 0;
}
$topicData['_rate_id'] = 0;
$topicData['_rating_value'] = $rating['rating_value'] ? $rating['rating_value'] : -1;
if ($topicData['topic_rating_total']) {
$topicData['_rate_int'] = round($topicData['topic_rating_total'] / $topicData['topic_rating_hits']);
}
//-----------------------------------------
// Show image?
//-----------------------------------------
if ($topicData['topic_rating_hits'] >= $this->settings['topic_rating_needed'] and $topicData['_rate_int']) {
$topicData['_rate_id'] = $topicData['_rate_int'];
$topicData['_rate_show'] = 1;
}
} else {
$topicData['_allow_rate'] = 0;
}
//-----------------------------------------
// If this forum is a link, then
// redirect them to the new location
//-----------------------------------------
if ($topicData['state'] == 'link' and $topicData['moved_to']) {
$f_stuff = explode("&", $topicData['moved_to']);
$_topic = $this->DB->buildAndFetch(array('select' => 'title_seo', 'from' => 'topics', 'where' => 'tid=' . $f_stuff[0]));
/**
* Mark redirect links as read too
*
* @link http://community.invisionpower.com/tracker/issue-36985-linked-topics-readunread-status/
*/
$this->registry->getClass('classItemMarking')->markRead(array('forumID' => $forumData['id'], 'itemID' => $topicData['tid']), 'forums');
$this->registry->output->silentRedirect($this->settings['base_url'] . "showtopic={$f_stuff[0]}", $_topic['title_seo'], true, 'showtopic');
}
//-----------------------------------------
// If this is a sub forum, we need to get
// the cat details, and parent details
//-----------------------------------------
$this->nav = $this->registry->class_forums->forumsBreadcrumbNav($forumData['id']);
//-----------------------------------------
// Hi! Light?
//-----------------------------------------
$hl = !empty($this->request['hl']) ? '&hl=' . $this->request['hl'] : '';
//-----------------------------------------
// If we can see queued topics, add count
//-----------------------------------------
if ($this->registry->class_forums->canQueuePosts($forumData['id'])) {
if (isset($this->request['modfilter']) and $this->request['modfilter'] == 'invisible_posts') {
$topicData['posts'] = intval($topicData['topic_queuedposts']);
} else {
$topicData['posts'] += intval($topicData['topic_queuedposts']);
}
}
if ($permissionData['softDeleteSee'] and $topicData['topic_deleted_posts']) {
$topicData['posts'] += intval($topicData['topic_deleted_posts']);
}
//-----------------------------------------
// Generate the forum page span links
//-----------------------------------------
if ($this->request['modfilter']) {
$hl .= "&modfilter=" . $this->request['modfilter'];
}
$topicData['SHOW_PAGES'] = $this->registry->output->generatePagination(array('totalItems' => $topicData['posts'] + 1, 'itemsPerPage' => $this->settings['display_max_posts'], 'currentPage' => intval($this->request['page']), 'seoTitle' => $topicData['title_seo'], 'realTitle' => $topicData['title'], 'isPagesMode' => true, 'seoTemplate' => 'showtopic', 'baseUrl' => "showtopic=" . $topicData['tid'] . $hl));
//-----------------------------------------
// Fix up some of the words
//-----------------------------------------
$topicData['TOPIC_START_DATE'] = $this->registry->class_localization->getDate($topicData['start_date'], 'LONG');
$this->lang->words['topic_stats'] = str_replace("<#START#>", $topicData['TOPIC_START_DATE'], $this->lang->words['topic_stats']);
$this->lang->words['topic_stats'] = str_replace("<#POSTS#>", $topicData['posts'], $this->lang->words['topic_stats']);
//-----------------------------------------
// Multi Quoting?
//-----------------------------------------
$this->qpids = IPSCookie::get('mqtids');
//-----------------------------------------
// Multi PIDS?
//-----------------------------------------
$this->request['selectedpids'] = !empty($this->request['selectedpids']) ? $this->request['selectedpids'] : IPSCookie::get('modpids');
$this->request['selectedpidcount'] = 0;
IPSCookie::set('modpids', '', 0);
IPSDebug::setMemoryDebugFlag("TOPIC: topics.php::topicSetUp", $_before);
return $topicData;
}
示例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
//.........這裏部分代碼省略.........
// Current topic rating value
//-----------------------------------------
$this->topic['_rate_show'] = 0;
$this->topic['_rate_int'] = 0;
$this->topic['_rate_img'] = '';
if ($this->topic['state'] != 'open') {
$this->topic['_allow_rate'] = 0;
} else {
$this->topic['_allow_rate'] = $this->can_rate;
}
if ($this->forum['forum_allow_rating']) {
$rating = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'topic_ratings', 'where' => "rating_tid={$this->topic['tid']} and rating_member_id=" . $this->memberData['member_id']));
if ($rating['rating_value'] and $this->memberData['g_topic_rate_setting'] != 2) {
$this->topic['_allow_rate'] = 0;
}
$this->topic['_rate_id'] = 0;
$this->topic['_rating_value'] = $rating['rating_value'] ? $rating['rating_value'] : -1;
if ($this->topic['topic_rating_total']) {
$this->topic['_rate_int'] = round($this->topic['topic_rating_total'] / $this->topic['topic_rating_hits']);
}
//-----------------------------------------
// Show image?
//-----------------------------------------
if ($this->topic['topic_rating_hits'] >= $this->settings['topic_rating_needed'] and $this->topic['_rate_int']) {
$this->topic['_rate_id'] = $this->topic['_rate_int'];
$this->topic['_rate_show'] = 1;
}
} else {
$this->topic['_allow_rate'] = 0;
}
//-----------------------------------------
// Update the item marker
//-----------------------------------------
if (!$this->request['view']) {
$this->registry->getClass('classItemMarking')->markRead(array('forumID' => $this->forum['id'], 'itemID' => $this->topic['tid']));
}
//-----------------------------------------
// If this forum is a link, then
// redirect them to the new location
//-----------------------------------------
if ($this->topic['state'] == 'link') {
$f_stuff = explode("&", $this->topic['moved_to']);
$this->registry->output->redirectScreen($this->lang->words['topic_moved'], $this->settings['base_url'] . "showtopic={$f_stuff[0]}");
}
//-----------------------------------------
// If this is a sub forum, we need to get
// the cat details, and parent details
//-----------------------------------------
$this->nav = $this->registry->class_forums->forumsBreadcrumbNav($this->forum['id']);
//-----------------------------------------
// Are we a moderator?
//-----------------------------------------
if ($this->memberData['member_id'] and $this->memberData['g_is_supmod'] != 1) {
$other_mgroups = array();
if ($this->memberData['mgroup_others']) {
$other_mgroups = explode(",", IPSText::cleanPermString($this->memberData['mgroup_others']));
}
$other_mgroups[] = $this->memberData['member_group_id'];
$member_group_ids = implode(",", $other_mgroups);
$this->moderator = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'moderators', 'where' => "forum_id LIKE '%,{$this->forum['id']},%' AND (member_id={$this->memberData['member_id']} OR (is_group=1 AND group_id IN({$member_group_ids})))"));
}
//-----------------------------------------
// Hi! Light?
//-----------------------------------------
$hl = (isset($this->request['hl']) and $this->request['hl']) ? '&hl=' . $this->request['hl'] : '';
//-----------------------------------------
// If we can see queued topics, add count
//-----------------------------------------
if ($this->registry->class_forums->canQueuePosts($this->forum['id'])) {
if (isset($this->request['modfilter']) and $this->request['modfilter'] == 'invisible_posts') {
$this->topic['posts'] = intval($this->topic['topic_queuedposts']);
} else {
$this->topic['posts'] += intval($this->topic['topic_queuedposts']);
}
}
//-----------------------------------------
// Generate the forum page span links
//-----------------------------------------
$this->topic['SHOW_PAGES'] = $this->registry->output->generatePagination(array('totalItems' => $this->topic['posts'] + 1, 'itemsPerPage' => $this->settings['display_max_posts'], 'currentStartValue' => $this->first, 'seoTitle' => $this->topic['title_seo'], 'seoTemplate' => 'showtopic', 'baseUrl' => "showtopic=" . $this->topic['tid'] . $hl));
if ($this->topic['posts'] + 1 > $this->settings['display_max_posts']) {
// $this->topic['go_new'] = $this->registry->output->getTemplate('topic')->golastpost_link($this->forum['id'], $this->topic['tid'] );
}
//-----------------------------------------
// Fix up some of the words
//-----------------------------------------
$this->topic['TOPIC_START_DATE'] = $this->registry->class_localization->getDate($this->topic['start_date'], 'LONG');
$this->lang->words['topic_stats'] = str_replace("<#START#>", $this->topic['TOPIC_START_DATE'], $this->lang->words['topic_stats']);
$this->lang->words['topic_stats'] = str_replace("<#POSTS#>", $this->topic['posts'], $this->lang->words['topic_stats']);
//-----------------------------------------
// Multi Quoting?
//-----------------------------------------
$this->qpids = IPSCookie::get('mqtids');
//-----------------------------------------
// Multi PIDS?
//-----------------------------------------
$this->request['selectedpids'] = !empty($this->request['selectedpids']) ? $this->request['selectedpids'] : IPSCookie::get('modpids');
$this->request['selectedpidcount'] = 0;
IPSCookie::set('modpids', '', 0);
IPSDebug::setMemoryDebugFlag("TOPIC: topics.php::topicSetUp", $_before);
}
示例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);
}
}