本文整理汇总了PHP中IPSLib::sizeFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP IPSLib::sizeFormat方法的具体用法?PHP IPSLib::sizeFormat怎么用?PHP IPSLib::sizeFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPSLib
的用法示例。
在下文中一共展示了IPSLib::sizeFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: groupsForm
/**
* Group form
*
* @access public
* @param string Type (add|edit)
* @param array Group data
* @param array Permission masks
* @param array Extra tabs
* @return string HTML
*/
public function groupsForm($type, $group, $permission_masks, $content = array())
{
//-----------------------------------------
// Format some of the data
//-----------------------------------------
list($group['g_promotion_id'], $group['g_promotion_posts']) = explode('&', $group['g_promotion']);
list($p_max, $p_width, $p_height) = explode(":", $group['g_photo_max_vars']);
list($limit, $flood) = explode(":", $group['g_email_limit']);
if ($group['g_promotion_posts'] < 1) {
$group['g_promotion_posts'] = '';
}
if ($type == 'edit' and $group['g_attach_max'] == 0) {
$group['g_attach_maxdis'] = $this->lang->words['g_unlimited'];
} else {
if ($type == 'edit' and $group['g_attach_max'] == -1) {
$group['g_attach_maxdis'] = $this->lang->words['g_disabled'];
} else {
$group['g_attach_maxdis'] = IPSLib::sizeFormat($group['g_attach_max'] * 1024);
}
}
if ($type == 'edit' and $group['g_attach_per_post'] == 0) {
$group['g_attach_per_postdis'] = $this->lang->words['g_unlimited'];
} else {
if ($type == 'edit' and $group['g_attach_per_post'] == -1) {
$group['g_attach_per_postdis'] = $this->lang->words['g_disabled'];
} else {
$group['g_attach_per_postdis'] = IPSLib::sizeFormat($group['g_attach_per_post'] * 1024);
}
}
//-----------------------------------------
// Set some of the form variables
//-----------------------------------------
$form_code = $type == 'edit' ? 'doedit' : 'doadd';
$button = $type == 'edit' ? $this->lang->words['g_compedit'] : $this->lang->words['g_addgroup'];
$ini_max = @ini_get('upload_max_filesize') ? @ini_get('upload_max_filesize') : $this->lang->words['g_cannotobt'];
$guest_legend = $group['g_id'] == $this->settings['guest_group'] ? $this->lang->words['g_appguests'] : '';
$secure_key = ipsRegistry::getClass('adminFunctions')->getSecurityKey();
//-----------------------------------------
// Start off the form fields
//-----------------------------------------
$all_groups = array(0 => array('none', $this->lang->words['g_dontprom']));
foreach ($this->cache->getCache('group_cache') as $group_data) {
$all_groups[] = array($group_data['g_id'], $group_data['g_title']);
}
$gbw_unit_type = array(0 => array(0, $this->lang->words['g_dd_apprp']), 1 => array(1, $this->lang->words['g_dd_days']));
$form = array();
$form['g_title'] = $this->registry->output->formInput("g_title", $group['g_title']);
$form['permid'] = $this->registry->output->formMultiDropdown("permid[]", $permission_masks, explode(",", $group['g_perm_id']));
$form['g_icon'] = $this->registry->output->formTextarea("g_icon", htmlspecialchars($group['g_icon'], ENT_QUOTES));
$form['prefix'] = $this->registry->output->formInput("prefix", htmlspecialchars($group['prefix'], ENT_QUOTES));
$form['suffix'] = $this->registry->output->formInput("suffix", htmlspecialchars($group['suffix'], ENT_QUOTES));
$form['g_hide_from_list'] = $this->registry->output->formYesNo("g_hide_from_list", $group['g_hide_from_list']);
$form['g_attach_max'] = $this->registry->output->formInput("g_attach_max", $group['g_attach_max']);
$form['g_attach_per_post'] = $this->registry->output->formInput("g_attach_per_post", $group['g_attach_per_post']);
$form['p_max'] = $this->registry->output->formInput("p_max", $p_max);
$form['p_width'] = $this->registry->output->formSimpleInput("p_width", $p_width, 3);
$form['p_height'] = $this->registry->output->formSimpleInput("p_height", $p_height, 3);
$form['g_avatar_upload'] = $this->registry->output->formYesNo("g_avatar_upload", $group['g_avatar_upload']);
$form['g_can_msg_attach'] = $this->registry->output->formYesNo("g_can_msg_attach", $group['g_can_msg_attach']);
$form['g_view_board'] = $this->registry->output->formYesNo("g_view_board", $group['g_view_board']);
$form['g_access_offline'] = $this->registry->output->formYesNo("g_access_offline", $group['g_access_offline']);
$form['g_mem_info'] = $this->registry->output->formYesNo("g_mem_info", $group['g_mem_info']);
$form['g_can_add_friends'] = $this->registry->output->formYesNo("g_can_add_friends", $group['g_can_add_friends']);
$form['g_hide_online_list'] = $this->registry->output->formYesNo("g_hide_online_list", $group['g_hide_online_list']);
$form['g_use_search'] = $this->registry->output->formYesNo("g_use_search", $group['g_use_search']);
$form['g_search_flood'] = $this->registry->output->formInput("g_search_flood", $group['g_search_flood']);
$form['g_email_friend'] = $this->registry->output->formYesNo("g_email_friend", $group['g_email_friend']);
$form['join_limit'] = $this->registry->output->formSimpleInput("join_limit", $limit, 2);
$form['join_flood'] = $this->registry->output->formSimpleInput("join_flood", $flood, 2);
$form['g_edit_profile'] = $this->registry->output->formYesNo("g_edit_profile", $group['g_edit_profile']);
$form['g_use_pm'] = $this->registry->output->formYesNo("g_use_pm", $group['g_use_pm']);
$form['g_max_mass_pm'] = $this->registry->output->formInput("g_max_mass_pm", $group['g_max_mass_pm']);
$form['g_max_messages'] = $this->registry->output->formInput("g_max_messages", $group['g_max_messages']);
$form['g_pm_perday'] = $this->registry->output->formSimpleInput("g_pm_perday", $group['g_pm_perday'], 4);
$form['g_pm_flood_mins'] = $this->registry->output->formSimpleInput("g_pm_flood_mins", $group['g_pm_flood_mins'], 3);
$form['g_dohtml'] = $this->registry->output->formYesNo("g_dohtml", $group['g_dohtml']);
$form['g_bypass_badwords'] = $this->registry->output->formYesNo("g_bypass_badwords", $group['g_bypass_badwords']);
$form['g_dname_date'] = $this->registry->output->formSimpleInput("g_dname_date", $group['g_dname_date'], 3);
$form['g_dname_changes'] = $this->registry->output->formSimpleInput("g_dname_changes", $group['g_dname_changes'], 3);
$form['g_is_supmod'] = $this->registry->output->formYesNo("g_is_supmod", $group['g_is_supmod']);
$form['g_access_cp'] = $this->registry->output->formYesNo("g_access_cp", $group['g_access_cp']);
$form['g_promotion_id'] = $this->registry->output->formDropdown("g_promotion_id", $all_groups, $group['g_promotion_id']);
$form['g_promotion_posts'] = $this->registry->output->formSimpleInput('g_promotion_posts', $group['g_promotion_posts']);
$form['g_new_perm_set'] = $this->registry->output->formInput("g_new_perm_set", '');
$form['g_rep_max_positive'] = $this->registry->output->formInput("g_rep_max_positive", $group['g_rep_max_positive']);
$form['g_rep_max_negative'] = $this->registry->output->formInput("g_rep_max_negative", $group['g_rep_max_negative']);
$sig_limits = explode(':', $group['g_signature_limits']);
$form['use_signatures'] = $this->registry->output->formYesNo("use_signatures", $sig_limits[0]);
$form['max_images'] = $this->registry->output->formInput("max_images", $sig_limits[1]);
$form['max_dims'] = $this->registry->output->formSimpleInput("max_dims_x", $sig_limits[2]) . ' x ' . $this->registry->output->formSimpleInput("max_dims_y", $sig_limits[3]);
//.........这里部分代码省略.........
示例2: sendOutput
//.........这里部分代码省略.........
// Navigation?
//------------------------------------------------
if (count($navigation) > 0) {
$html = str_replace("<%NAV%>", $this->global_template->wrap_nav("<li>" . implode(" > </li><li>", $navigation) . "</li>"), $html);
} else {
$html = str_replace("<%NAV%>", '', $html);
}
//-----------------------------------------
// Last thing, the nav element...
//-----------------------------------------
if (isset($_last_nav['title'])) {
$html = str_replace("<%PAGE_NAV%>", $_last_nav['title'], $html);
}
$query_html = "";
//-----------------------------------------
// Show SQL queries
//-----------------------------------------
if (IN_DEV and count($this->DB->obj['cached_queries'])) {
$queries = "";
foreach ($this->DB->obj['cached_queries'] as $q) {
$queries .= "<div style='padding:6px; border-bottom:1px solid #000'>" . htmlspecialchars($q) . '</div>';
}
$query_html .= $this->global_template->global_query_output($queries);
/* Included Files */
if (function_exists('get_included_files')) {
$__files = get_included_files();
$files = '';
foreach ($__files as $__f) {
$files .= "<strong>{$__f}</strong><br />";
}
$query_html .= $this->global_template->global_if_output(count($__files), $files);
}
}
//-----------------------------------------
// Memory usage
//-----------------------------------------
if (IPS_MEMORY_DEBUG_MODE and defined('IPS_MEMORY_START') and IN_DEV) {
if (is_array(IPSDebug::$memory_debug)) {
$memory = '';
$_c = 0;
foreach (IPSDebug::$memory_debug as $usage) {
$_c++;
if ($usage[1] > 500 * 1024) {
$_col = "color:#D00000";
} else {
if ($usage[1] < 10 * 1024) {
$_col = "color:darkgreen";
} else {
if ($usage[1] < 100 * 1024) {
$_col = "color:darkorange";
}
}
}
$memory .= "<tr><td width='60%' style='{$_col}' align='left'>{$usage[0]}</td><td style='{$_col}' align='left'><strong>" . IPSLib::sizeFormat($usage[1]) . "</strong></td></tr>";
}
}
$_used = memory_get_usage() - IPS_MEMORY_START;
$peak_used = memory_get_peak_usage() - IPS_MEMORY_START;
$query_html .= $this->global_template->global_memory_output($memory, IPSLib::sizeFormat($_used), IPSLib::sizeFormat($peak_used));
}
$html = str_replace("<%QUERIES%>", $query_html, $html);
//-----------------------------------------
// Got BODY EXTRA?
//-----------------------------------------
if ($this->body_extra) {
$html = str_replace("<body", "<body " . $this->body_extra, $html);
}
//-----------------------------------------
// Emoticons fix
//-----------------------------------------
$html = str_replace("<#EMO_DIR#>", 'default', $html);
/* Remove any public side hooks */
$html = preg_replace('#<!--hook\\.([^\\>]+?)-->#', '', $html);
//-----------------------------------------
// Gzip?
//-----------------------------------------
if (IPB_ACP_USE_GZIP) {
$buffer = "";
if (count(ob_list_handlers())) {
$buffer = ob_get_contents();
ob_end_clean();
}
ob_start('ob_gzhandler');
print $buffer;
}
@header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
@header("Cache-Control: no-cache, must-revalidate");
@header("Pragma: no-cache");
@header("Content-type: text/html; charset=" . IPS_DOC_CHAR_SET);
//-----------------------------------------
// OUTPUT
//-----------------------------------------
if ($return) {
$this->_IS_PRINTED = 1;
return $html;
}
print $html;
$this->_IS_PRINTED = 1;
exit;
}
示例3: return_topic_list_data
/**
* Returns an array of gallery data
*
* @access public
* @param bool View as guest?
* @return mixed Array of data, or void
*/
public function return_topic_list_data($view_as_guest = 0)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$topics = array();
if (!$view_as_guest) {
$this->registry->class_forums->strip_invisible = false;
$this->registry->class_forums->forumsInit();
} else {
$this->registry->class_forums->strip_invisible = true;
$this->registry->class_forums->forumsInit();
}
//-----------------------------------------
// Set up
//-----------------------------------------
$this->topic_list_config['order_field'] = $this->topic_list_config['order_field'] == 'started' ? 'start_date' : $this->topic_list_config['order_field'];
$this->topic_list_config['order_field'] = $this->topic_list_config['order_field'] == 'lastpost' ? 'last_post' : $this->topic_list_config['order_field'];
$this->topic_list_config['forums'] = is_array($this->topic_list_config['forums']) ? implode(",", $this->topic_list_config['forums']) : $this->topic_list_config['forums'];
//-----------------------------------------
// Fix up allowed forums
//-----------------------------------------
if ($this->topic_list_config['forums']) {
# Reset topics...
if ($this->topic_list_config['forums'] == '*') {
$_tmp_array = array();
$this->topic_list_config['forums'] = '';
foreach ($this->registry->class_forums->forum_by_id as $id => $data) {
$_tmp_forums[] = $id;
}
} else {
$_tmp_forums = explode(',', $this->topic_list_config['forums']);
$_tmp_array = array();
$this->topic_list_config['forums'] = '';
}
foreach ($_tmp_forums as $_id) {
$_tmp_array[] = $_id;
}
$this->topic_list_config['forums'] = implode(',', $_tmp_array);
}
//-----------------------------------------
// Get from the DB
//-----------------------------------------
$this->DB->build(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => 't.approved=1 AND t.forum_id IN (0,' . $this->topic_list_config['forums'] . ')', 'order' => $this->topic_list_config['order_field'] . ' ' . $this->topic_list_config['order_by'], 'limit' => array($this->topic_list_config['offset'], $this->topic_list_config['limit']), 'add_join' => array(0 => array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => 't.topic_firstpost=p.pid', 'type' => 'left'), 1 => array('select' => 'm.member_id, m.members_display_name as member_name, m.members_seo_name, m.member_group_id, m.email', 'from' => array('members' => 'm'), 'where' => "m.member_id=p.author_id", 'type' => 'left'), 2 => array('select' => 'f.id as forum_id, f.name as forum_name, f.use_html, f.name_seo', 'from' => array('forums' => 'f'), 'where' => "t.forum_id=f.id", 'type' => 'left'))));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
if ($row['topic_hasattach']) {
$this->attach_pids[] = $row['pid'];
}
//-----------------------------------------
// Guest name?
//-----------------------------------------
$row['member_name'] = $row['member_name'] ? $row['member_name'] : $row['author_name'];
//-----------------------------------------
// Topic link
//-----------------------------------------
$row['link-topic'] = $this->registry->getClass('output')->buildSEOUrl("showtopic={$row['tid']}", 'public', $row['title_seo'], 'showtopic');
$row['link-forum'] = $this->registry->getClass('output')->buildSEOUrl("showforum={$row['forum_id']}", 'public', $row['name_seo'], 'showforum');
$row['link-profile'] = $this->registry->getClass('output')->buildSEOUrl("showuser={$row['member_id']}", 'public', $row['members_seo_name'], 'showuser');
$topics[] = $row;
}
if (count($this->attach_pids)) {
$final_attachments = array();
$this->DB->build(array('select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module='post' AND attach_rel_id IN (" . implode(",", $this->attach_pids) . ")"));
$this->DB->execute;
while ($a = $this->DB->fetch()) {
$final_attachments[$a['attach_pid']][$a['attach_id']] = $a;
}
$final_topics = array();
foreach ($topics as $mytopic) {
$this_topic_attachments = array();
foreach ($final_attachments as $pid => $data) {
if ($pid != $mytopic['pid']) {
continue;
}
$temp_out = "";
$temp_hold = array();
foreach ($final_attachments[$pid] as $aid => $row) {
//-----------------------------------------
// Is it an image, and are we viewing the image in the post?
//-----------------------------------------
if ($this->settings['show_img_upload'] and $row['attach_is_image']) {
if ($this->settings['siu_thumb'] and $row['attach_thumb_location'] and $row['attach_thumb_width']) {
$this_topic_attachments[] = array('size' => IPSLib::sizeFormat($row['attach_filesize']), 'method' => 'post', 'id' => $row['attach_id'], 'file' => $row['attach_file'], 'hits' => $row['attach_hits'], 'thumb_location' => $row['attach_thumb_location'], 'type' => 'thumb', 'thumb_x' => $row['attach_thumb_width'], 'thumb_y' => $row['attach_thumb_height'], 'ext' => $row['attach_ext']);
} else {
$this_topic_attachments[] = array('size' => IPSLib::sizeFormat($row['attach_filesize']), 'method' => 'post', 'id' => $row['attach_id'], 'file' => $row['attach_file'], 'hits' => $row['attach_hits'], 'thumb_location' => $row['attach_thumb_location'], 'type' => 'image', 'thumb_x' => $row['attach_thumb_width'], 'thumb_y' => $row['attach_thumb_height'], 'ext' => $row['attach_ext']);
}
} else {
$this_topic_attachments[] = array('size' => IPSLib::sizeFormat($row['attach_filesize']), 'method' => 'post', 'id' => $row['attach_id'], 'file' => $row['attach_file'], 'hits' => $row['attach_hits'], 'thumb_location' => $row['attach_thumb_location'], 'type' => 'reg', 'thumb_x' => $row['attach_thumb_width'], 'thumb_y' => $row['attach_thumb_height'], 'ext' => $row['attach_ext']);
}
}
}
if (count($this_topic_attachments)) {
//.........这里部分代码省略.........
示例4: _multiMergePost
/**
* Post multi-mod: Merge posts
*
* @return @e void [Outputs to screen]
*/
protected function _multiMergePost()
{
$this->_resetModerator($this->topic['forum_id']);
$this->_genericPermissionCheck('split_merge');
if (count($this->pids) < 2) {
$this->_showError('mod_only_one_pid', 10383);
}
//-----------------------------------------
// Form or print?
//-----------------------------------------
if (!$this->request['checked']) {
//-----------------------------------------
// Get post data
//-----------------------------------------
$master_post = "";
$dropdown = array();
$authors = array();
$seen_author = array();
$upload_html = "";
$seoTitle = '';
//-----------------------------------------
// Grab teh posts
//-----------------------------------------
$this->DB->build(array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => "p.pid IN (" . implode(",", $this->pids) . ")", 'add_join' => array(array('select' => 't.forum_id, t.title_seo', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left'))));
$outer = $this->DB->execute();
while ($p = $this->DB->fetch($outer)) {
if (IPSMember::checkPermissions('read', $p['forum_id']) == TRUE) {
$master_post .= $p['post'] . "<br /><br />";
$dropdown[] = array($p['pid'], ipsRegistry::getClass('class_localization')->getDate($p['post_date'], 'LONG') . " (#{$p['pid']})");
if (!in_array($p['author_id'], $seen_author)) {
$authors[] = array($p['author_id'], "{$p['author_name']} (#{$p['pid']})");
$seen_author[] = $p['author_id'];
}
$seoTitle = $p['title_seo'];
}
}
//-----------------------------------------
// Get Attachment Data
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module='post' AND attach_rel_id IN (" . implode(",", $this->pids) . ")"));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
$row['image'] = $this->caches['attachtypes'][$row['attach_ext']]['atype_img'];
$row['size'] = IPSLib::sizeFormat($row['attach_filesize']);
$row['attach_file'] = IPSText::truncate($row['attach_file'], 50);
$attachments[] = $row;
}
//-----------------------------------------
// Print form
//-----------------------------------------
/* Load editor stuff */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite');
$_editor = new $classToLoad();
$_editor->setContent(trim($master_post));
$editor = $_editor->show('Post', array('autoSaveKey' => md5('merge-' . $this->topic['tid']), 'height' => 350));
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->mergePostForm($editor, $dropdown, $authors, $attachments, $seoTitle);
if ($this->topic['tid']) {
$this->registry->getClass('output')->addNavigation($this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic');
}
$this->registry->getClass('output')->addNavigation($this->lang->words['cm_title'], '');
$this->registry->getClass('output')->setTitle($this->lang->words['cm_title'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->output->addContent($this->output);
$this->registry->getClass('output')->sendOutput();
} else {
//-----------------------------------------
// DO THE THING, WITH THE THING!!
//-----------------------------------------
$this->request['postdate'] = intval($this->request['postdate']);
if (empty($this->request['selectedpids']) || empty($this->request['postdate']) || empty($this->request['Post'])) {
$this->_showError('mod_merge_posts', 10384);
}
/* Load editor stuff */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite');
$_editor = new $classToLoad();
/* remove saved content */
if ($this->memberData['member_id']) {
$_editor->removeAutoSavedContent(array('member_id' => $this->memberData['member_id'], 'autoSaveKey' => md5('merge-' . $this->topic['tid'])));
}
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
$post = $_editor->process($_POST['Post']);
$post = IPSText::getTextClass('bbcode')->preDbParse($post);
//-----------------------------------------
// Post to keep...
//-----------------------------------------
$posts = array();
$author = array();
$post_to_delete = array();
$new_post_key = md5(time());
$topics = array();
$forums = array();
$append_edit = 0;
//-----------------------------------------
//.........这里部分代码省略.........
示例5: query
//.........这里部分代码省略.........
$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}");
$this->debug_html .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FFE8F3' align='center'>\r\n\t\t\t\t\t\t\t\t\t\t <tr>\r\n\t\t\t\t\t\t\t\t\t\t \t <td colspan='8' style='font-size:14px' bgcolor='#FFC5Cb'><b>{$shutdown}Select Query</b></td>\r\n\t\t\t\t\t\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t\t\t\t\t <tr>\r\n\t\t\t\t\t\t\t\t\t\t <td colspan='8' style='font-family:courier, monaco, arial;font-size:14px;color:black'>{$the_query}</td>\r\n\t\t\t\t\t\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t\t\t\t\t <tr bgcolor='#FFC5Cb'>\r\n\t\t\t\t\t\t\t\t\t\t\t <td><b>table</b></td><td><b>type</b></td><td><b>possible_keys</b></td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td><b>key</b></td><td><b>key_len</b></td><td><b>ref</b></td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td><b>rows</b></td><td><b>Extra</b></td>\r\n\t\t\t\t\t\t\t\t\t\t </tr>\n";
while ($array = mysqli_fetch_array($eid)) {
$type_col = '#FFFFFF';
if ($array['type'] == 'ref' or $array['type'] == 'eq_ref' or $array['type'] == 'const') {
$type_col = '#D8FFD4';
} else {
if ($array['type'] == 'ALL') {
$type_col = '#FFEEBA';
}
}
$this->debug_html .= "<tr bgcolor='#FFFFFF'>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['table']} </td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td bgcolor='{$type_col}'>{$array['type']} </td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['possible_keys']} </td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['key']} </td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['key_len']} </td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['ref']} </td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['rows']} </td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['Extra']} </td>\r\n\t\t\t\t\t\t\t\t\t\t </tr>\n";
}
$this->sql_time += $endtime;
if ($endtime > 0.1) {
$endtime = "<span style='color:red'><b>{$endtime}</b></span>";
}
if ($memoryUsed) {
$memory = '<br />Memory Used: ' . IPSLib::sizeFormat($memoryUsed, TRUE);
}
$this->debug_html .= "<tr>\r\n\t\t\t\t\t\t\t\t\t\t <td colspan='8' bgcolor='#FFD6DC' style='font-size:14px'><b>MySQL time</b>: {$endtime}{$memory}</b></td>\r\n\t\t\t\t\t\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t\t\t\t\t </table>\n<br />\n";
} else {
$this->debug_html .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FEFEFE' align='center'>\r\n\t\t\t\t\t\t\t\t\t\t <tr>\r\n\t\t\t\t\t\t\t\t\t\t <td style='font-size:14px' bgcolor='#EFEFEF'><b>{$shutdown}Non Select Query</b></td>\r\n\t\t\t\t\t\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t\t\t\t\t <tr>\r\n\t\t\t\t\t\t\t\t\t\t <td style='font-family:courier, monaco, arial;font-size:14px'>{$the_query}</td>\r\n\t\t\t\t\t\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t\t\t\t\t <tr>\r\n\t\t\t\t\t\t\t\t\t\t <td style='font-size:14px' bgcolor='#EFEFEF'><b>MySQL time</b>: {$endtime}</span></td>\r\n\t\t\t\t\t\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t\t\t\t\t</table><br />\n\n";
}
}
$this->query_count++;
$this->obj['cached_queries'][] = $the_query;
return $this->query_id;
}
示例6: sendOutput
//.........这里部分代码省略.........
if (count($navigation) > 0) {
$html = str_replace("<%NAV%>", $this->global_template->wrap_nav("<li>" . implode(" > </li><li>", $navigation) . "</li>"), $html);
} else {
$html = str_replace("<%NAV%>", '', $html);
}
//-----------------------------------------
// Last thing, the nav element...
//-----------------------------------------
$html = str_replace("<%PAGE_NAV%>", $_last_nav['title'], $html);
$query_html = "";
//-----------------------------------------
// Show SQL queries
//-----------------------------------------
if (IN_DEV and count($this->DB->obj['cached_queries'])) {
$queries = "";
foreach ($this->DB->obj['cached_queries'] as $q) {
$queries .= "<div style='padding:6px; border-bottom:1px solid #000'>" . htmlspecialchars($q) . '</div>';
}
$query_html .= $this->global_template->global_query_output($queries);
/* Included Files */
if (function_exists('get_included_files')) {
$__files = get_included_files();
$query_html .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>(" . count($__files) . ") Included Files</div><div class='row1' style='padding:6px'>\n";
foreach ($__files as $__f) {
$query_html .= "<strong>{$__f}</strong><br />";
}
$query_html .= '</div></div>';
}
}
$html = str_replace("<%QUERIES%>", $query_html, $html);
//-----------------------------------------
// Got BODY EXTRA?
//-----------------------------------------
if ($this->body_extra) {
$html = str_replace("<body", "<body " . $this->body_extra, $html);
}
//-----------------------------------------
// Lang Replace
//-----------------------------------------
$html = preg_replace("#{txt\\.(.+?)}#e", "\$this->lang->words['\\1']", $html);
//-----------------------------------------
// Emoticons fix
//-----------------------------------------
$html = str_replace("<#EMO_DIR#>", 'default', $html);
//-----------------------------------------
// Gzip?
//-----------------------------------------
if (IPB_ACP_USE_GZIP) {
$buffer = "";
if (count(ob_list_handlers())) {
$buffer = ob_get_contents();
ob_end_clean();
}
ob_start('ob_gzhandler');
print $buffer;
}
@header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
@header("Cache-Control: no-cache, must-revalidate");
@header("Pragma: no-cache");
@header("Content-type: text/html; charset=" . IPS_DOC_CHAR_SET);
//-----------------------------------------
// OUTPUT
//-----------------------------------------
print $html;
//-----------------------------------------
// Memory usage
//-----------------------------------------
if (IPS_MEMORY_DEBUG_MODE and defined('IPS_MEMORY_START') and IN_DEV) {
if (is_array(IPSDebug::$memory_debug)) {
$memory .= "<br />\n<div align='center' style='margin-left:auto;margin-right:auto'><div class='tableborder' style='width:75%'>\n<div class='tableheaderalt'>MEMORY USAGE</div><div class='tablerow1' style='padding:6px'>\n";
$memory .= "<table cellpadding='4' cellspacing='0' border='0' width='100%'>\n";
$_c = 0;
foreach (IPSDebug::$memory_debug as $usage) {
$_col = $_c % 2 ? '#eee' : '#ddd';
$_c++;
if ($usage[1] > 500 * 1024) {
$_col .= ";color:#D00000";
} else {
if ($usage[1] < 10 * 1024) {
$_col .= ";color:darkgreen";
} else {
if ($usage[1] < 100 * 1024) {
$_col .= ";color:darkorange";
}
}
}
$memory .= "<tr><td width='60%' style='background-color:{$_col}' align='left'>{$usage[0]}</td><td style='background-color:{$_col}' align='left'><strong>" . IPSLib::sizeFormat($usage[1]) . "</strong></td></tr>";
}
$memory .= "</table></div></div></div>";
}
$end = memory_get_usage();
$peak_end = memory_get_peak_usage();
$_used = $end - IPS_MEMORY_START;
$peak_used = $peak_end - IPS_MEMORY_START;
print $memory;
print "Total Memory Used: " . IPSLib::sizeFormat($_used) . " (Peak:" . IPSText::sizeFormat($peak_used) . ")";
}
$this->_IS_PRINTED = 1;
exit;
}
示例7: overview
//.........这里部分代码省略.........
$name = $object['name'] != '..' ? "<a href='{$this->settings['base_url']}&module=pages&section=manage&do=editFolder&dir={$path}'><img src='{$this->settings['skin_acp_url']}/_newimages/ccs/folder.png' alt='{$this->lang->words['folder_alt']}' /></a>" : "<img src='{$this->settings['skin_acp_url']}/_newimages/ccs/folder.png' alt='{$this->lang->words['folder_alt']}' />";
if ($object['name'] != '..') {
$IPBHTML .= <<<HTML
\t\t\t<td>
\t\t\t\t<input type='checkbox' name='folders[]' value='{$path}' />
\t\t\t</td>
\t\t\t<td>
\t\t\t\t{$name} <strong><a href='{$this->settings['base_url']}{$this->form_code}&do=viewdir&dir={$path}'>{$object['name']}</a></strong>
\t\t\t</td>
\t\t\t<td class='page_date'>
\t\t\t\t<span class='desctext'>{$mtime}</span>
\t\t\t</td>
\t\t\t<td class='page_size'>
\t\t\t\t<span class='desctext'>--</span>
\t\t\t</td>
\t\t\t<td>\t\t
\t\t\t\t<div class='manage'>
\t\t\t\t\t<img class='ipbmenu' id="menu_{$id}" src='{$this->settings['skin_acp_url']}/_newimages/menu_open.png' alt='{$this->lang->words['folder_options_alt']}' />
\t\t\t\t\t<ul class='acp-menu' id='menu_{$id}_menucontent'>
\t\t\t\t\t\t<li class='icon edit'><a href='{$this->settings['base_url']}&module=pages&section=manage&do=editFolder&dir={$path}'>{$this->lang->words['edit_folder_name']}</a></li>
\t\t\t\t\t\t<li class='icon delete'><a href='#' onclick="return acp.confirmDelete( '{$this->settings['base_url']}&module=pages&section=manage&do=emptyFolder&dir={$path}' );">{$this->lang->words['empty_folder']}</a></li>
\t\t\t\t\t\t<li class='icon delete'><a href='#' onclick="return acp.confirmDelete( '{$this->settings['base_url']}&module=pages&section=manage&do=deleteFolder&dir={$path}' );">{$this->lang->words['delete_folder_link']}</a></li>
\t\t\t\t\t\t<li class='icon export'><a href='{$this->settings['base_url']}&module=pages&section=manage&do=multi&action=move&folders[]={$path}'>{$this->lang->words['move_folder_link']}</a></li>
\t\t\t\t\t</ul>
\t\t\t\t</div>\t
\t\t\t</td>
HTML;
} else {
$IPBHTML .= <<<HTML
\t\t\t<td>
\t\t\t\t
\t\t\t</td>
\t\t\t<td colspan='4'>
\t\t\t\t{$name} <strong><a href='{$this->settings['base_url']}{$this->form_code}&do=viewdir&dir={$path}'>{$object['name']}</a></strong>
\t\t\t</td>
HTML;
}
$IPBHTML .= <<<HTML
\t</tr>
HTML;
}
foreach ($files as $object) {
$path = urlencode($object['full_path']);
$icon = $object['icon'] ? $object['icon'] . '.png' : 'file.png';
$size = $object['directory'] ? '' : IPSLib::sizeFormat($object['size']);
$mtime = $this->registry->getClass('class_localization')->getDate($object['last_modified'], 'SHORT', 1);
$id = md5($path);
$url = $this->registry->ccsFunctions->returnPageUrl(array('page_folder' => $object['path'], 'page_seo_name' => $object['name'], 'page_id' => $object['page_id']));
$texts = array('edit' => $this->lang->words['edit_page_link'], 'delete' => $this->lang->words['delete_page_link'], 'move' => $this->lang->words['move_page_link']);
if ($object['icon'] != 'page') {
$texts = array('edit' => $this->lang->words['edit_pagefile_link'], 'delete' => $this->lang->words['delete_file_link'], 'move' => $this->lang->words['move_pagefile_link']);
}
$IPBHTML .= <<<HTML
\t\t<tr id='record_{$object['page_id']}'>
\t\t\t<td>
\t\t\t\t<input type='checkbox' name='pages[]' value='{$object['page_id']}' />
\t\t\t</td>
\t\t\t<td>
\t\t\t\t<a href='{$this->settings['base_url']}&module=pages&section=wizard&do=quickEdit&page={$object['page_id']}'><img src='{$this->settings['skin_acp_url']}/_newimages/ccs/{$icon}' alt='{$this->lang->words['file_alt']}' /></a>
\t\t\t\t<strong><a href='{$this->settings['base_url']}&module=pages&section=wizard&do=quickEdit&page={$object['page_id']}'>{$object['name']}</a></strong> <span class='view-page'><a href='{$url}' target='_blank' title='{$this->lang->words['view_page_title']}'><img src='{$this->settings['skin_acp_url']}/_newimages/ccs/page_go.png' alt='{$this->lang->words['view_page_title']}' /></a></span>
\t\t\t</td>
\t\t\t<td style='text-align: left;'>
\t\t\t\t<span class='desctext'>{$mtime}</span>
\t\t\t</td>
\t\t\t<td style='text-align: left;'>
\t\t\t\t<span class='desctext'>{$size}</span>
\t\t\t</td>
\t\t\t<td>\t\t\t
\t\t\t\t<div class='manage'>
\t\t\t\t\t<img class='ipbmenu' id="menu_{$id}" src='{$this->settings['skin_acp_url']}/_newimages/menu_open.png' alt='{$this->lang->words['file_options_alt']}' />
\t\t\t\t\t<ul class='acp-menu' id='menu_{$id}_menucontent'>
\t\t\t\t\t\t<li class='icon edit'><a href='{$this->settings['base_url']}&module=pages&section=wizard&do=quickEdit&page={$object['page_id']}'>{$texts['edit']}</a></li>
\t\t\t\t\t\t<!--<li class='icon edit'><a href='{$this->settings['base_url']}&module=pages&section=wizard&do=editPage&page={$object['page_id']}'>{$this->lang->words['edit_page_wizard_link']}</a></li>-->
\t\t\t\t\t\t<li class='icon delete'><a href='#' onclick="return acp.confirmDelete( '{$this->settings['base_url']}&module=pages&section=pages&do=delete&page={$object['page_id']}' );">{$texts['delete']}</a></li>
\t\t\t\t\t\t<li class='icon export'><a href='{$this->settings['base_url']}&module=pages&section=manage&do=multi&action=move&pages[]={$object['page_id']}'>{$texts['move']}</a></li>
\t\t\t\t\t</ul>
\t\t\t\t</div>
\t\t\t</td>
\t\t</tr>
HTML;
}
}
$IPBHTML .= <<<HTML
\t</table>
\t<div class="acp-actionbar">
\t\t<div>
\t\t\t{$this->lang->words['with_selected__form']}
\t\t\t<select name='action' id='multi-action'>
\t\t\t\t<option value='move'>{$this->lang->words['form__move_items']}</option>
\t\t\t\t<option value='delete'>{$this->lang->words['form__delete_items']}</option>
\t\t\t</select>
\t\t\t<input type="submit" value="{$this->lang->words['form__go']}" class="button primary" onclick="return confirmsubmit();" />
\t\t</div>
\t</div>
\t</form>
</div>
HTML;
//--endhtml--//
return $IPBHTML;
}
示例8: html_showDebugInfo
/**
* Returns debug data
*
* @access private
* @return string Debug HTML
*/
public function html_showDebugInfo()
{
$input = "";
$queries = "";
$sload = "";
$stats = "";
//-----------------------------------------
// Form & Get & Skin
//-----------------------------------------
/* Admins only */
if (!$this->memberData['g_access_cp']) {
//return '';
}
if ($this->settings['debug_level'] >= 2) {
$stats .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>IPSDebug Messages</div><div class='row1' style='padding:6px'>\n";
foreach (IPSDebug::getMessages() as $dx => $entry) {
$stats .= "<strong>{$entry}</strong><br />\n";
}
$stats .= "</div>\n</div>";
$stats .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>IPSMember Cache Actions</div><div class='row1' style='padding:6px'>\n";
if (is_array(IPSMember::$debugData)) {
foreach (IPSMember::$debugData as $entry) {
$stats .= "<strong>{$entry}</strong><br />\n";
}
}
$stats .= "</div>\n</div>";
/* Included Files */
if (function_exists('get_included_files')) {
$__files = get_included_files();
$stats .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>(" . count($__files) . ") Included Files</div><div class='row1' style='padding:6px'>\n";
foreach ($__files as $__f) {
$stats .= "<strong>{$__f}</strong><br />";
}
$stats .= '</div></div>';
}
/* Caches */
$stats .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>Loaded Caches</div><div class='row1' style='padding:6px'>\n";
$_total = 0;
if (is_array($this->cache->debugInfo)) {
foreach ($this->cache->debugInfo as $key => $data) {
$_size = $data['size'];
$_total += $_size;
$stats .= "<strong>{$key}</strong> - " . IPSLib::sizeFormat($_size) . "<br />\n";
}
}
$stats .= "<strong>TOTAL: " . IPSLib::sizeFormat($_total) . "</strong></div>\n</div>";
/* Loaded classes */
$loadedClasses = $this->registry->getLoadedClassesAsArray();
$stats .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>Loaded Classes In ipsRegistry::getClass()</div><div class='row1' style='padding:6px'>\n";
if (is_array($loadedClasses)) {
foreach ($loadedClasses as $entry) {
$stats .= "<strong>{$entry}</strong><br />\n";
}
}
$stats .= "</div>\n</div>";
$stats .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>FORM and GET Input</div><div class='row1' style='padding:6px'>\n";
foreach ($this->request as $k => $v) {
if (in_array(strtolower($k), array('pass', 'password'))) {
$v = '*******';
}
$stats .= "<strong>{$k}</strong> = {$v}<br />\n";
}
$stats .= "</div>\n</div>";
$stats .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>SKIN, MEMBER & TASK Info</div><div class='row1' style='padding:6px'>\n";
while (list($k, $v) = each($this->skin)) {
if (is_array($v)) {
continue;
}
if (strlen($v) > 120) {
$v = substr($v, 0, 120) . '...';
}
$stats .= "<strong>{$k}</strong> = " . IPSText::htmlspecialchars($v) . "<br />\n";
}
//-----------------------------------------
// Stop E_ALL moaning...
//-----------------------------------------
$cache = $this->caches['systemvars'];
$cache['task_next_run'] = $cache['task_next_run'] ? $cache['task_next_run'] : 0;
$stats .= "<b>Next task</b> = " . $this->registry->getClass('class_localization')->getDate($cache['task_next_run'], 'LONG') . "\n<br /><b>Time now</b> = " . $this->registry->getClass('class_localization')->getDate(time(), 'LONG');
$stats .= "<br /><b>Timestamp Now</b> = " . time();
$stats .= "<p>MEMBER: last_visit: " . $this->memberData['last_visit'] . " / " . $this->registry->getClass('class_localization')->getDate($this->memberData['last_visit'], 'LONG') . "</p>";
$stats .= "<p>MEMBER: uagent_key: " . $this->memberData['userAgentKey'] . "</p>";
$stats .= "<p>MEMBER: uagent_type: " . $this->memberData['userAgentType'] . "</p>";
$stats .= "<p>MEMBER: uagent_version: " . $this->memberData['userAgentVersion'] . "</p>";
$stats .= "</div>\n</div>";
$stats .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>Loaded PHP Templates</div><div class='row1' style='padding:6px'>\n";
$stats .= "<strong>" . implode(", ", array_keys($this->output->compiled_templates)) . "</strong><br />\n";
$stats .= "<strong>" . implode(", ", array_keys($this->output->loaded_templates)) . "</strong><br />\n";
$stats .= "<strong>" . implode(", ", array_values($this->registry->getClass('class_localization')->loaded_lang_files)) . "</strong><br />\n";
$stats .= "</div>\n</div>";
}
//-----------------------------------------
// SQL
//-----------------------------------------
//.........这里部分代码省略.........
示例9: return_topic_list_data
//.........这里部分代码省略.........
$this->topic_list_config['forums'] = is_array($this->topic_list_config['forums']) ? implode(",", $this->topic_list_config['forums']) : $this->topic_list_config['forums'];
//-----------------------------------------
// Fix up allowed forums
//-----------------------------------------
if ($this->topic_list_config['forums']) {
# Reset topics...
if ($this->topic_list_config['forums'] == '*') {
$_tmp_array = array();
$this->topic_list_config['forums'] = '';
foreach ($this->registry->class_forums->forum_by_id as $id => $data) {
$_tmp_forums[] = $id;
}
} else {
$_tmp_forums = explode(',', $this->topic_list_config['forums']);
$_tmp_array = array();
$this->topic_list_config['forums'] = '';
}
foreach ($_tmp_forums as $_id) {
$_tmp_array[] = $_id;
}
$this->topic_list_config['forums'] = implode(',', $_tmp_array);
}
//-----------------------------------------
// Get from the DB
//-----------------------------------------
$_approved = $this->registry->getClass('class_forums')->fetchTopicHiddenQuery(array('visible'), 't.');
$this->DB->build(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => $_approved . ' AND t.forum_id IN (0,' . $this->topic_list_config['forums'] . ')', 'order' => $this->topic_list_config['order_field'] . ' ' . $this->topic_list_config['order_by'], 'limit' => array($this->topic_list_config['offset'], $this->topic_list_config['limit']), 'add_join' => array(0 => array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => 't.topic_firstpost=p.pid', 'type' => 'left'), 1 => array('select' => 'm.member_id, m.members_display_name as member_name, m.members_seo_name, m.member_group_id, m.email', 'from' => array('members' => 'm'), 'where' => "m.member_id=p.author_id", 'type' => 'left'), 2 => array('select' => 'f.id as forum_id, f.name as forum_name, f.use_html, f.name_seo', 'from' => array('forums' => 'f'), 'where' => "t.forum_id=f.id", 'type' => 'left'))));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
if ($row['topic_hasattach']) {
$this->attach_pids[] = $row['pid'];
}
//-----------------------------------------
// Guest name?
//-----------------------------------------
$row['member_name'] = $row['member_name'] ? $row['member_name'] : $row['author_name'];
//-----------------------------------------
// Topic link
//-----------------------------------------
$row['link-topic'] = $this->registry->getClass('output')->buildSEOUrl("showtopic={$row['tid']}", 'public', $row['title_seo'], 'showtopic');
$row['link-forum'] = $this->registry->getClass('output')->buildSEOUrl("showforum={$row['forum_id']}", 'public', $row['name_seo'], 'showforum');
$row['link-profile'] = $this->registry->getClass('output')->buildSEOUrl("showuser={$row['member_id']}", 'public', $row['members_seo_name'], 'showuser');
//-----------------------------------------
// Parse for display - http://community.invisionpower.com/resources/bugs.html/_/ip-board/xml-rpc-returning-bbcode-r41329
//-----------------------------------------
if ($parse_display) {
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
$parser = new $classToLoad();
/* Set up some settings */
$parser->set(array('parseArea' => 'topics', 'parseBBCode' => true, 'parseHtml' => true, 'parseEmoticons' => true));
$row['post'] = $parser->display($row['post']);
}
$topics[] = $row;
}
if (count($this->attach_pids)) {
$final_attachments = array();
$this->DB->build(array('select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module='post' AND attach_rel_id IN (" . IPSText::cleanPermString(implode(",", $this->attach_pids)) . ")"));
$this->DB->execute();
while ($a = $this->DB->fetch()) {
$final_attachments[$a['attach_pid']][$a['attach_id']] = $a;
}
$final_topics = array();
foreach ($topics as $mytopic) {
$this_topic_attachments = array();
foreach ($final_attachments as $pid => $data) {
if ($pid != $mytopic['pid']) {
continue;
}
$temp_out = "";
$temp_hold = array();
foreach ($final_attachments[$pid] as $aid => $row) {
//-----------------------------------------
// Is it an image, and are we viewing the image in the post?
//-----------------------------------------
if ($this->settings['show_img_upload'] and $row['attach_is_image']) {
if ($this->settings['siu_thumb'] and $row['attach_thumb_location'] and $row['attach_thumb_width']) {
$this_topic_attachments[] = array('size' => IPSLib::sizeFormat($row['attach_filesize']), 'method' => 'post', 'id' => $row['attach_id'], 'file' => $row['attach_file'], 'hits' => $row['attach_hits'], 'thumb_location' => $row['attach_thumb_location'], 'type' => 'thumb', 'thumb_x' => $row['attach_thumb_width'], 'thumb_y' => $row['attach_thumb_height'], 'ext' => $row['attach_ext']);
} else {
$this_topic_attachments[] = array('size' => IPSLib::sizeFormat($row['attach_filesize']), 'method' => 'post', 'id' => $row['attach_id'], 'file' => $row['attach_file'], 'hits' => $row['attach_hits'], 'thumb_location' => $row['attach_thumb_location'], 'type' => 'image', 'thumb_x' => $row['attach_thumb_width'], 'thumb_y' => $row['attach_thumb_height'], 'ext' => $row['attach_ext']);
}
} else {
$this_topic_attachments[] = array('size' => IPSLib::sizeFormat($row['attach_filesize']), 'method' => 'post', 'id' => $row['attach_id'], 'file' => $row['attach_file'], 'hits' => $row['attach_hits'], 'thumb_location' => $row['attach_thumb_location'], 'type' => 'reg', 'thumb_x' => $row['attach_thumb_width'], 'thumb_y' => $row['attach_thumb_height'], 'ext' => $row['attach_ext']);
}
}
}
if (count($this_topic_attachments)) {
$mytopic['attachment_data'] = $this_topic_attachments;
}
$final_topics[] = $mytopic;
}
}
//-----------------------------------------
// Return...
//-----------------------------------------
if (count($final_topics)) {
return $final_topics;
} else {
return $topics;
}
}
示例10: sqllogsWrapper
/**
* SQL log RAPPER LIKE ICE T BUT MORE LIKE COFFEE
*
* @param array Rows
* @param string Page links
* @return string HTML
*/
public function sqllogsWrapper($rows, $latestError)
{
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<div class='section_title'>
\t<h2>{$this->lang->words['sqllog_title']}</h2>
\t<ul class='context_menu'>
\t\t<li>
\t\t\t<a href="#" onclick="acp.confirmDelete( '{$this->settings['base_url']}{$this->form_code}&do=delete_all');">
\t\t\t\t<img src='{$this->settings['skin_acp_url']}/images/icons/delete.png' alt='' />
\t\t\t\t{$this->lang->words['delete_all_sqllogs']}
\t\t\t</a>
\t\t</li>
\t</ul>
</div>
HTML;
if ($latestError) {
$IPBHTML .= <<<HTML
\t<div class='information-box'>
\t\t{$latestError}
\t</div>
\t<br />
HTML;
}
$IPBHTML .= <<<HTML
<div class="acp-box">
\t<h3>{$this->lang->words['sqllog_title']}</h3>
\t<table class="ipsTable">
\t\t<tr>
\t\t\t<th width="1%"> </th>
\t\t\t<th width='49%'>{$this->lang->words['sqllog_name']}</th>
\t\t\t<th width='40%'>{$this->lang->words['sqllog_date']}</th>
\t\t\t<th width='10%'>{$this->lang->words['sqllog_size']}</th>
\t\t\t<th class="col_buttons"> </th>
\t\t</tr>
HTML;
if (count($rows) and is_array($rows)) {
foreach ($rows as $row) {
$size = IPSLib::sizeFormat($row['size']);
$mtime = $this->registry->class_localization->getDate($row['mtime'], 'SHORT');
$IPBHTML .= <<<HTML
\t\t<tr class='ipsControlRow'>
\t\t\t<td><img src='{$this->settings['skin_acp_url']}/images/icons/page_red.png' /></td>
\t\t\t<td><a href="{$this->settings['base_url']}{$this->form_code}&do=view&file={$row['name']}">{$row['name']}</a></td>
\t\t\t<td>{$mtime}</td>
\t\t\t<td>{$size}</td>
\t\t\t<td class='col_buttons'>
\t\t\t\t<ul class='ipsControlStrip'>
\t\t\t\t\t<li class='i_view'><a href="{$this->settings['base_url']}{$this->form_code}&do=view&file={$row['name']}" title='{$this->lang->words['slog_view']}'>{$this->lang->words['slog_view']}</a></li>
\t\t\t\t\t<li class='i_delete'><a href="#" onclick="acp.confirmDelete( '{$this->settings['base_url']}{$this->form_code}&do=remove&file={$row['name']}' )" title='{$this->lang->words['delete']}'>{$this->lang->words['delete']}</a></li>
\t\t\t\t</ul>
\t\t\t</td>
\t\t</tr>
HTML;
}
} else {
$IPBHTML .= <<<HTML
\t\t<tr>
\t\t\t<td colspan='5' class='no_messages'>{$this->lang->words['sqllog_noresults']}</td>
\t\t</tr>
HTML;
}
$IPBHTML .= <<<HTML
\t</table>
\t<div class='acp-actionbar'>
\t\t<div class="leftaction"> </div>
\t</div>
</div>
<br />
HTML;
//--endhtml--//
return $IPBHTML;
}
示例11: fetchReport
/**
* Fetch a report
*
* @access public
* @param int Session ID
* @return array
*/
public function fetchReport($diffSessionID)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$return = array('counts' => array('missing' => 0, 'changed' => 0), 'data' => array());
//-----------------------------------------
// Get data
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'skin_merge_changes', 'where' => 'change_session_id=' . $diffSessionID, 'order' => 'change_data_group ASC, change_data_title ASC'));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
//-----------------------------------------
// Gen data
//-----------------------------------------
$row['_key'] = $row['change_key'];
$row['_size'] = IPSLib::sizeFormat(IPSLib::strlenToBytes(IPSText::mbstrlen($row['change_data_content'])));
//-----------------------------------------
// Diff type
//-----------------------------------------
if ($row['change_is_new']) {
$row['_is'] = 'new';
$return['counts']['missing']++;
} else {
$row['_is'] = 'changed';
$return['counts']['changed']++;
}
/* Is it CSS? */
if ($row['change_data_type'] == 'css') {
$row['change_data_group'] = 'css';
$row['change_data_title'] .= '.css';
}
/* Fetch basic stats */
if ($row['change_data_content']) {
$row['_diffs'] = substr_count($row['change_data_content'], '-ips-match:1');
}
if ($row['change_merge_content'] and stristr($row['change_merge_content'], '<ips:conflict')) {
$row['_conflicts'] = substr_count($row['change_merge_content'], '<ips:conflict');
}
//-----------------------------------------
// Add data...
//-----------------------------------------
$return['data'][$row['change_data_group']][$row['_key']] = $row;
}
return $return;
}
示例12: fetchTemplates
/**
* Fetch Templates from the tree
*
* @access public
* @param int Skin set ID
* @param string Type of data to return: 'allTemplates' will return the data [template_group][template_name], 'allNoContent' the same as 'allTemplates' minus the actual template content, 'groupNames'; [template_group] or groupTemplates, just that groups templates [template_name], groupTemplatesNoContent is the same as groupTemplates but template_content is removed
* @param string Which group to use
* @return array Array of data depending on the params
* <code>
* Usage:
* # To return all skin 'groups' (eg, skin_global, skin_topics, etc)
* $groups = $skinFunctions->fetchTemplates( 1, 'groupNames' );
* # To return all templates within group 'skin_global'
* $templates = $skinFunctions->fetchTemplates( 1, 'groupTemplates', 'skin_global' );
* # To return all templates in all groups
* $templates = $skinFunctions->fetchTemplates( 1, 'allTemplates');
* </code>
*/
public function fetchTemplates($setID, $type = 'allTemplates', $group = '')
{
//-----------------------------------------
// INIT
//-----------------------------------------
$templates = array();
//-----------------------------------------
// Try and get the skin from the cache
//-----------------------------------------
$skinSetData = $this->fetchSkinData($setID);
//-----------------------------------------
// Push root ID onto the END of the parent array
//-----------------------------------------
array_push($skinSetData['_parentTree'], 0);
//-----------------------------------------
// Push the current skin set ID onto the beginnging
//-----------------------------------------
array_unshift($skinSetData['_parentTree'], $setID);
//-----------------------------------------
// Ok, what to return?
//-----------------------------------------
if ($type == 'groupNames') {
# Just return group titles
$this->DB->build(array('select' => 'template_group, template_set_id, template_id, template_name, template_data,' . $this->DB->buildInstring("," . implode(",", $skinSetData['_parentTree']) . ",", $this->DB->buildConcat(array(array(',', 'string'), array('template_set_id'), array(',', 'string')))) . ' as theorder', 'from' => 'skin_templates', 'where' => "template_set_id IN (" . implode(",", $skinSetData['_parentTree']) . " )", 'order' => 'template_group, theorder DESC'));
$newq = $this->DB->execute();
} else {
if (($type == 'groupTemplates' or $type == 'groupTemplatesNoContent') and $group != '') {
# Return group template bits
$this->DB->build(array('select' => '*,' . $this->DB->buildInstring("," . implode(",", $skinSetData['_parentTree']) . ",", $this->DB->buildConcat(array(array(',', 'string'), array('template_set_id'), array(',', 'string')))) . ' as theorder', 'from' => 'skin_templates', 'where' => "template_set_id IN (" . implode(",", $skinSetData['_parentTree']) . ") AND template_group='{$group}'", 'order' => 'template_name, theorder DESC'));
$newq = $this->DB->execute();
} else {
# Return all...
$this->DB->build(array('select' => '*,' . $this->DB->buildInstring("," . implode(",", $skinSetData['_parentTree']) . ",", $this->DB->buildConcat(array(array(',', 'string'), array('template_set_id'), array(',', 'string')))) . ' as theorder', 'from' => 'skin_templates', 'where' => "template_set_id IN (" . implode(",", $skinSetData['_parentTree']) . ")", 'order' => 'template_group, template_name, theorder DESC'));
$newq = $this->DB->execute();
}
}
//-----------------------------------------
// Get all results
//-----------------------------------------
while ($r = $this->DB->fetch($newq)) {
if (isset($r['template_name'])) {
if (substr($r['template_name'], 0, 2) == '__') {
continue;
}
}
//-----------------------------------------
// Build counts
//-----------------------------------------
$this->_templateCount[$r['template_set_id']] = isset($this->_templateCount[$r['template_set_id']]) ? $this->_templateCount[$r['template_set_id']] : array();
$this->_templateCount[$r['template_set_id']][$r['template_group']] = isset($this->_templateCount[$r['template_set_id']][$r['template_group']]) ? $this->_templateCount[$r['template_set_id']][$r['template_group']] : array('count' => 0);
$this->_templateCount[$r['template_set_id']][$r['template_group']]['count']++;
if ($type == 'groupNames') {
$templates[$r['template_group']] = $r;
} else {
if ($type == 'groupTemplates' or $type == 'groupTemplatesNoContent') {
$r['_templateSize'] = IPSLib::sizeFormat(IPSLib::strlenToBytes(strlen($r['template_content'])));
if ($type == 'groupTemplatesNoContent') {
unset($r['template_data']);
unset($r['template_content']);
}
$templates[strtolower($r['template_name'])] = $r;
} else {
if ($type == 'allNoContent') {
unset($r['template_content']);
}
$templates[$r['template_group']][strtolower($r['template_name'])] = $r;
}
}
}
ksort($templates);
return $templates;
}
示例13: fetchReport
/**
* Fetch a report
*
* @access public
* @param int Session ID
* @return array
*/
public function fetchReport($diffSessionID)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$return = array('counts' => array('missing' => 0, 'changed' => 0), 'data' => array());
//-----------------------------------------
// Get data
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'template_diff_changes', 'where' => 'diff_session_id=' . $diffSessionID, 'order' => 'diff_change_func_group ASC, diff_change_func_name ASC'));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
//-----------------------------------------
// Gen data
//-----------------------------------------
$row['_key'] = $diffSessionID . ':' . $row['diff_change_func_group'] . ':' . $row['diff_change_func_name'];
$row['_size'] = IPSLib::sizeFormat(IPSLib::strlenToBytes(IPSText::mbstrlen($row['diff_change_content'])));
//-----------------------------------------
// Diff type
//-----------------------------------------
if (!$row['diff_change_type']) {
$row['_is'] = 'new';
$return['counts']['missing']++;
} else {
$row['_is'] = 'changed';
$return['counts']['changed']++;
}
//-----------------------------------------
// Add data...
//-----------------------------------------
$return['data'][$row['diff_change_func_group']][$row['_key']] = $row;
}
return $return;
}
示例14: sizeFormat
/**
* Convert bytes into kb, mb, etc. Duplicate of copy in IPSLib.
* Leaving this here in case IPSText is called instead of IPSLib.
*
* @access public
* @param integer Size in bytes
* @return string Human size
* @since 2.0
* @see IPSLib::sizeFormat
* @deprecated Use IPSLib instead
*/
public static function sizeFormat($bytes = "")
{
return IPSLib::sizeFormat($bytes);
}
示例15: getAttachments
/**
* Get the actual output.
* This is abstracted so that the AJAX routine can load and execute this function
*
* @param array Topic and attachment data
* @return string HTML output
*/
public function getAttachments($topic)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$attach_cache = ipsRegistry::cache()->getCache('attachtypes');
//-----------------------------------------
// Get forum skin and lang
//-----------------------------------------
$this->registry->getClass('class_localization')->loadLanguageFile(array('public_forums', 'public_topic'), 'forums');
//-----------------------------------------
// aight.....
//-----------------------------------------
$_queued = !$this->registry->getClass('class_forums')->canQueuePosts($topic['forum_id']) ? ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery(array('visible'), 'p.') : '';
$_st = $this->request['st'] > 0 ? intval($this->request['st']) : 0;
$_limit = 50;
$_pages = '';
$_count = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as attachments', 'from' => array('posts' => 'p'), 'where' => 'a.attach_id IS NOT NULL AND p.topic_id=' . $topic['tid'] . $_queued, 'add_join' => array(array('from' => array('attachments' => 'a'), 'where' => "a.attach_rel_id=p.pid AND a.attach_rel_module='post'", 'type' => 'left'))));
if ($_count['attachments'] > $_limit) {
$_pages = $this->registry->getClass('output')->generatePagination(array('totalItems' => $_count['attachments'], 'itemsPerPage' => $_limit, 'currentStartValue' => $_st, 'baseUrl' => "app=forums&module=forums&section=attach&tid={$topic['tid']}"));
}
$this->DB->build(array('select' => 'p.pid, p.topic_id', 'from' => array('posts' => 'p'), 'where' => 'a.attach_id IS NOT NULL AND p.topic_id=' . $topic['tid'] . $_queued, 'order' => 'p.pid ASC, a.attach_id ASC', 'limit' => array($_st, $_limit), 'add_join' => array(array('select' => 'a.*', 'from' => array('attachments' => 'a'), 'where' => "a.attach_rel_id=p.pid AND a.attach_rel_module='post'", 'type' => 'left'))));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
if (IPSMember::checkPermissions('read', $topic['forum_id']) != TRUE) {
continue;
}
if (!$row['attach_id']) {
continue;
}
$row['image'] = str_replace('folder_mime_types', 'mime_types', $attach_cache[$row['attach_ext']]['atype_img']);
$row['short_name'] = IPSText::truncate($row['attach_file'], 30);
$row['attach_date'] = $this->registry->getClass('class_localization')->getDate($row['attach_date'], 'SHORT');
$row['real_size'] = IPSLib::sizeFormat($row['attach_filesize']);
$rows[] = $row;
}
$this->output .= $this->registry->getClass('output')->getTemplate('forum')->forumAttachments($topic['title'], $rows, $_pages);
return $this->output;
}