/** * 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]); $form['max_urls'] = $this->registry->output->formInput("max_urls", $sig_limits[4]); $form['max_lines'] = $this->registry->output->formInput("max_lines", $sig_limits[5]); $form['g_displayname_unit'] = $this->registry->output->formSimpleInput("g_displayname_unit", $group['g_displayname_unit'], 3); $form['gbw_displayname_unit_type'] = $this->registry->output->formDropdown("gbw_displayname_unit_type", $gbw_unit_type, $group['gbw_displayname_unit_type']); $form['g_sig_unit'] = $this->registry->output->formSimpleInput("g_sig_unit", $group['g_sig_unit'], 3); $form['gbw_sig_unit_type'] = $this->registry->output->formDropdown("gbw_sig_unit_type", $gbw_unit_type, $group['gbw_sig_unit_type']); $form['gbw_promote_unit_type'] = $this->registry->output->formDropdown("gbw_promote_unit_type", $gbw_unit_type, $group['gbw_promote_unit_type']); $form['gbw_no_status_update'] = $this->registry->output->formYesNo("gbw_no_status_update", $group['gbw_no_status_update']); if ($type == 'edit') { $title = $this->lang->words['g_editing'] . $group['g_title']; } else { $title = $this->lang->words['g_adding']; } $IPBHTML = ""; //--starthtml--// $IPBHTML .= <<<HTML <div class='section_title'> \t<h2>{$title}</h2> </div> <script type='text/javascript' src='{$this->settings['js_app_url']}ipsEditGroup.js'></script> <script type='text/javascript'> HTML; foreach ($permission_masks as $d) { $IPBHTML .= "\tperms_{$d[0]} = '{$d[1]}';\n"; } $IPBHTML .= <<<HTML </script> <form action='{$this->settings['base_url']}&{$this->form_code}&do={$form_code}&secure_key={$secure_key}' method='post' id='adform' name='adform' onsubmit='return checkform();'> <input type='hidden' name='id' value='{$group['g_id']}' /> <ul id='tabstrip_group' class='tab_bar no_title'> \t<li id='tabtab-GROUPS|1' class=''>{$this->lang->words['g_globalsett']}</li> \t<li id='tabtab-GROUPS|2' class=''>{$this->lang->words['g_globalperm']}</li> HTML; // Got blocks from other apps? $IPBHTML .= implode("\n", $content['tabs']); $semaillimit = sprintf($this->lang->words['g_semail_limit'], $form['join_limit']); $semailflood = sprintf($this->lang->words['g_semail_flood'], $form['join_flood']); $pmlimit = sprintf($this->lang->words['g_pm_limit'], $form['g_pm_perday']); $pmflood = sprintf($this->lang->words['g_pm_flood'], $form['g_pm_flood_mins']); $IPBHTML .= <<<HTML </ul> <script type="text/javascript"> //<![CDATA[ document.observe("dom:loaded",function() { ipbAcpTabStrips.register('tabstrip_group'); }); //]]> </script> <div class='acp-box'> \t<div id='tabpane-GROUPS|1'> \t\t<table width='100%' cellpadding='0' cellspacing='0' class='form_table alternate_rows double_pad'> \t\t\t<tr> \t\t\t\t<th colspan='2'>{$this->lang->words['gt_details']}</th> \t\t\t</tr> \t\t\t<tr> \t\t\t\t<td style='width: 40%'> \t\t\t\t\t<label>{$this->lang->words['g_gtitle']}</label> \t\t\t\t</td> \t\t\t\t<td style='width: 60%'> \t\t\t\t\t{$form['g_title']} \t\t\t\t</td> \t\t\t</tr> \t\t\t<tr> \t\t \t\t<td> \t\t\t\t\t<label>{$this->lang->words['g_gicon']}</label><br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['g_gicon_info']}</span> \t\t\t\t</td> \t\t \t\t<td> \t\t\t\t\t{$form['g_icon']} \t\t \t\t</td> \t\t \t</tr> \t\t \t \t\t \t<tr> \t\t \t\t<td> \t\t\t\t\t<label>{$this->lang->words['g_gformpre']}</label><br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['g_gformpre_info']}</span> \t\t\t\t</td> \t\t \t\t<td> \t\t\t\t\t{$form['prefix']} \t\t \t\t</td> \t\t \t</tr> \t\t \t \t\t \t<tr> \t\t \t\t<td> \t\t\t\t\t<label>{$this->lang->words['g_gformsuf']}</label><br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['g_gformsuf_info']}</span> \t\t\t\t</td> \t\t \t\t<td> \t\t\t\t\t{$form['suffix']} \t\t \t\t</td> \t\t \t</tr> \t\t\t<tr> \t\t\t\t<th colspan='2'>{$this->lang->words['gt_permissions']}</th> \t\t\t</tr> \t\t\t<tr> \t\t \t\t<td> \t\t\t\t\t<label>{$this->lang->words['g_permset']}</label><br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['g_permset_info']}</span> \t\t\t\t</td> \t\t \t\t<td> \t\t\t\t\t{$form['permid']} \t\t \t\t</td> \t\t \t</tr> \t\t \t<tr> \t\t \t\t<td> \t\t\t\t\t<label>{$this->lang->words['g_newpermset']}</label><br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['g_newpermset_info']}</span> \t\t\t\t</td> \t\t \t\t<td> \t\t\t\t\t{$form['g_new_perm_set']} \t\t \t\t</td> \t\t \t</tr> \t\t \t \t\t \t<tr class='guest_legend'> \t\t \t\t<td> \t\t \t\t\t<label>{$this->lang->words['g_hide']}</label> \t\t \t\t\t{$guest_legend} \t\t \t\t</td> \t\t \t\t<td> \t\t \t\t\t{$form['g_hide_from_list']} \t\t \t\t</td> \t\t \t</tr> \t\t \t \t\t \t<tr class='guest_legend'> \t\t \t\t<td> \t\t \t\t\t<label>{$this->lang->words['g_hide_online']}</label> \t\t \t\t\t{$guest_legend} \t\t \t\t</td> \t\t \t\t<td> \t\t \t\t\t{$form['g_hide_online_list']} \t\t \t\t</td> \t\t \t</tr> \t\t \t<tr> \t\t\t\t<th colspan='2'>{$this->lang->words['gt_display_name']}</th> \t\t\t</tr> \t\t\t<tr> \t\t \t\t<td> \t\t\t\t\t<label>{$this->lang->words['g_dmax']}</label><br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['g_dmax_info']}</span> \t\t\t\t</td> \t\t \t\t<td> \t\t\t\t\t<p>{$form['g_dname_changes']} {$this->lang->words['g_when']} {$form['g_displayname_unit']} {$form['gbw_displayname_unit_type']}</p> \t\t\t\t\t<p style='color:gray;font-size:0.8em'>{$this->lang->words['g_limit_dd']}</p> \t\t \t\t</td> \t\t \t</tr> \t\t \t<tr> \t\t \t\t<td> \t\t\t\t\t<label>{$this->lang->words['g_dlimit']}</label><br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['g_dlimit_info']}</span> \t\t\t\t</td> \t\t \t\t<td> \t\t \t\t\t{$form['g_dname_date']} \t\t \t\t</td> \t\t \t</tr> \t\t \t<tr> \t\t\t\t<th colspan='2'>{$this->lang->words['gt_access_control']}</th> \t\t\t</tr> \t\t \t<tr class='guest_legend'> \t\t \t\t<td> \t\t \t\t\t<label>{$this->lang->words['g_msup']}</label> \t\t \t\t\t{$guest_legend} \t\t \t\t</td> \t\t \t\t<td> \t\t \t\t\t{$form['g_is_supmod']} \t\t \t\t</td> \t\t \t</tr> \t\t \t \t\t \t<tr class='guest_legend'> \t\t \t\t<td> \t\t \t\t\t<label>{$this->lang->words['g_macp']}</label> \t\t \t\t\t{$guest_legend} \t\t \t\t</td> \t\t \t\t<td> \t\t \t\t\t{$form['g_access_cp']} \t\t \t\t</td> \t\t \t</tr> \t\t \t<tr> \t\t\t\t<th colspan='2'>{$this->lang->words['gt_promotion']}</th> \t\t\t</tr> \t\t \t<tr class='guest_legend'> \t\t \t\t<td> \t\t\t\t\t<label>{$this->lang->words['g_mpromote']}</label><br /> \t\t\t\t\t{$guest_legend} \t\t\t\t\t<span class='desctext'>{$this->registry->output->javascriptHelpLink('mg_promote')}</span> \t\t\t\t</td> \t\t \t\t<td>\t\t \t\t HTML; if ($group['g_access_cp']) { $IPBHTML .= "{$this->lang->words['g_mpromote_no']}"; } else { $promotegrouptxt = sprintf($this->lang->words['g_mpromote_to'], $form['g_promotion_id'], $form['g_promotion_posts'], $form['gbw_promote_unit_type']); $IPBHTML .= "{$promotegrouptxt}"; } $IPBHTML .= <<<HTML \t\t \t\t</td> \t\t \t</tr> \t\t</table> \t</div> <div id='tabpane-GROUPS|2'> \t <table class='form_table alternate_rows double_pad' cellspacing='0'> \t\t<tr> \t\t\t<th colspan='2'>{$this->lang->words['gt_access_permissions']}</th> \t\t</tr> \t \t<tr> \t \t\t<td style='width: 40%'> \t\t\t\t<label>{$this->lang->words['g_ssite']}</label> \t\t\t</td> \t \t\t<td style='width: 60%'> \t \t\t\t{$form['g_view_board']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr> \t \t\t<td> \t\t\t\t<label>{$this->lang->words['g_soffline']}</label> \t\t\t</td> \t \t\t<td> \t \t\t\t{$form['g_access_offline']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr> \t \t\t<td> \t\t\t\t<label>{$this->lang->words['g_sprofile']}</label> \t\t\t</td> \t \t\t<td> \t \t\t\t{$form['g_mem_info']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr class='guest_legend'> \t \t\t<td> \t\t\t\t<label>{$this->lang->words['g_addfriends']}{$guest_legend}</label> \t\t\t</td> \t \t\t<td> \t \t\t\t{$form['g_can_add_friends']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr class='guest_legend'> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_editprofile']}</label> \t \t\t\t{$guest_legend} \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['g_edit_profile']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr class='guest_legend'> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_shtml']}</label><br /> \t \t\t\t{$guest_legend} \t\t\t\t<span class='desctext'>{$this->registry->output->javascriptHelpLink('mg_dohtml')}</span> \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['g_dohtml']} \t \t\t</td> \t \t</tr> \t\t<tr class='guest_legend'> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_semail']}</label><br /> \t \t\t\t{$guest_legend} \t\t\t\t<span class='desctext'>{$this->lang->words['g_semail_info']}</span> \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['g_email_friend']} \t \t\t\t<br />{$semaillimit} \t \t\t\t<br />{$semailflood} \t \t\t</td> \t \t</tr> \t\t<tr class='guest_legend'> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_uav']}</label> \t \t\t\t{$guest_legend} \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['g_avatar_upload']} \t \t\t</td> \t \t</tr> \t\t<tr class='guest_legend'> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_sbadword']}</label> \t \t\t\t{$guest_legend} \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['g_bypass_badwords']} \t \t\t</td> \t \t</tr> \t\t<tr class='guest_legend'> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_no_status']}</label> \t \t\t\t{$guest_legend} \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['gbw_no_status_update']} \t \t\t</td> \t \t</tr> \t \t<tr> \t\t\t<th colspan='2'>{$this->lang->words['gt_search']}</th> \t\t</tr> \t \t<tr> \t \t\t<td> \t\t\t\t<label>{$this->lang->words['g_ssearch']}</label> \t\t\t</td> \t \t\t<td> \t \t\t\t{$form['g_use_search']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr> \t \t\t<td> \t\t\t\t<label>{$this->lang->words['g_sflood']}</label><br /> \t\t\t\t<span class='desctext'>{$this->lang->words['g_sflood_info']}</span> \t\t\t</td> \t \t\t<td> \t \t\t\t{$form['g_search_flood']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr> \t\t\t<th colspan='2'>{$this->lang->words['gt_pms']}</th> \t\t</tr> \t \t<tr class='guest_legend'> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_spm']}</label><br /> \t \t\t\t{$guest_legend} \t\t\t\t<span class='desctext'>{$this->lang->words['g_spmperday_info']}</span> \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['g_use_pm']} \t\t\t\t<br />{$pmlimit} \t \t\t\t<br />{$pmflood} \t \t\t</td> \t \t</tr> \t \t \t<tr class='guest_legend'> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_spmmax']}</label><br /> \t \t\t\t{$guest_legend} \t\t\t\t<span class='desctext'>{$this->lang->words['g_spmmax_info']}</span> \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['g_max_mass_pm']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr class='guest_legend'> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_spmmaxstor']}</label> \t \t\t\t{$guest_legend} \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['g_max_messages']} \t \t\t</td> \t \t</tr> \t\t<tr class='guest_legend'> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_upm']}</label> \t \t\t\t{$guest_legend} \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['g_can_msg_attach']} \t \t\t</td> \t \t</tr> \t \t\t<tr> \t\t\t<th colspan='2'>{$this->lang->words['gt_reps']}</th> \t\t</tr> \t \t<tr> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_repmaxpos']}</label><br /> \t\t\t\t<span class='desctext'>{$this->lang->words['g_repnum_info']}</span> \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['g_rep_max_positive']} \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_repmaxneg']}</label><br /> \t\t\t\t<span class='desctext'>{$this->lang->words['g_repnum_info']}</span> \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['g_rep_max_negative']} \t \t\t</td> \t \t</tr> \t\t<tr> \t\t\t<th colspan='2'>{$this->lang->words['gt_sigs']}</th> \t\t</tr> \t \t<tr> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_usesigs']}</label> \t \t\t</td> \t \t\t<td> \t\t\t<p>{$form['use_signatures']} {$this->lang->words['g_until']} {$form['g_sig_unit']} {$form['gbw_sig_unit_type']}</p> \t\t\t<p style='color:gray;font-size:0.8em'>{$this->lang->words['g_limit_dd']}</p> \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_sigmaximages']}</label> \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['max_images']} \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_sigmaxdims']}</label> \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['max_dims']} \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_sigmaxurls']}</label> \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['max_urls']} \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_sigmaxtext']}</label> \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['max_lines']} \t \t\t</td> \t \t</tr> \t\t<tr> \t\t\t<th colspan='2'>{$this->lang->words['gt_uploads']}</th> \t\t</tr> \t \t<tr> \t \t\t<td> \t\t\t\t<label>{$this->lang->words['g_uglobal']}</label><br /> \t\t\t\t<span class='desctext'>{$this->registry->output->javascriptHelpLink('mg_upload')}<br />{$this->lang->words['g_uglobal_info']}</span> \t\t\t</td> \t \t\t<td> \t \t\t\t{$form['g_attach_max']} \t \t\t\t{$this->lang->words['g_inkb']} ({$this->lang->words['g_ucurrently']}{$group['g_attach_maxdis']}) \t \t\t\t<br />{$this->lang->words['g_usingle']}{$ini_max} \t \t\t</td> \t \t</tr> \t \t \t \t<tr> \t \t\t<td> \t\t\t\t<label>{$this->lang->words['g_upost']}</label><br /> \t\t\t\t<span class='desctext'>{$this->registry->output->javascriptHelpLink('mg_upload')}<br />{$this->lang->words['g_upost_info']}</span> \t\t\t</td> \t \t\t<td> \t \t\t\t{$form['g_attach_per_post']} \t \t\t\t{$this->lang->words['g_inkb']} ({$this->lang->words['g_ucurrently']}{$group['g_attach_per_postdis']}) \t \t\t\t<br />{$this->lang->words['g_usingle']}{$ini_max} \t \t\t</td> \t \t</tr> \t \t \t \t<tr class='guest_legend'> \t \t\t<td> \t \t\t\t<label>{$this->lang->words['g_upersonalpho']}</label><br /> \t \t\t\t{$guest_legend} \t\t\t\t<span class='desc'>{$this->lang->words['g_upersonalpho_l']}</span> \t \t\t</td> \t \t\t<td> \t \t\t\t{$form['p_max']}{$this->lang->words['g_inkb']} \t \t\t\t<br />{$this->lang->words['g_upersonalpho_w']}{$form['p_width']} x {$this->lang->words['g_upersonalpho_h']}{$form['p_height']} \t \t\t</td> \t \t</tr> \t</table> </div> HTML; // Got blocks from other apps? $IPBHTML .= implode("\n", $content['area']); $IPBHTML .= <<<HTML <div class='acp-actionbar'> \t<input type='submit' value=' {$button} ' class='realbutton' /> </div> </div> </form> <script type="text/javascript"> HTML; if ($group['g_id'] == $this->settings['guest_group']) { $IPBHTML .= "stripGuestLegend();"; } $IPBHTML .= <<<HTML </script> HTML; //--endhtml--// return $IPBHTML; }
/** * Output the HTML to the browser * * @param bool Return finished output instead of printing * @return @e void */ public function sendOutput($return = false) { $this->_sendOutputSetUp('normal'); //----------------------------------------- // Hang on, is IP.SEO still installed? //----------------------------------------- if (IPSLib::appIsInstalled('ipseo') and !in_array(ipsRegistry::$request['section'], array('upgrade', 'applications'))) { $this->silentRedirect($this->settings['_base_url'] . 'app=core&module=seo&section=upgrade'); } //--------------------------------------- // INIT //----------------------------------------- $clean_module = IPSText::alphanumericalClean(ipsRegistry::$current_module); $navigation = array(); $_seen_nav = array(); $_last_nav = ''; $no_wrapper = FALSE; //----------------------------------------- // Inline pop-up? //----------------------------------------- if (ipsRegistry::$request['_popup']) { $this->printPopupWindow(); exit; } //----------------------------------------- // Debug? //----------------------------------------- if ($this->DB->obj['debug']) { flush(); print "<html><head><title>SQL Debugger</title><body bgcolor='white'><style type='text/css'> TABLE, TD, TR, BODY { font-family: verdana,arial, sans-serif;color:black;font-size:11px }</style>"; print "<h1 align='center'>SQL Total Time: {$this->DB->sql_time} for {$this->DB->query_cnt} queries</h1><br />" . $this->DB->debug_html; print "<br /><div align='center'><strong>Total SQL Time: {$this->DB->sql_time}</div></body></html>"; exit; } //----------------------------------------- // Context sensitive stuff //----------------------------------------- if (!$this->cm_output) { $_file = IPSLib::getAppDir(IPS_APP_COMPONENT) . '/skin_cp/cp_skin_' . $clean_module . '_context_menu.php'; if (is_file($_file)) { $_class = IPSLib::loadLibrary($_file, 'cp_skin_' . $clean_module . '_context_menu', IPS_APP_COMPONENT); $context_menu = new $_class($this->registry); $cm_function_full = ipsRegistry::$request['do'] ? 'context_menu__' . $clean_module . '__' . ipsRegistry::$request['section'] . '__' . ipsRegistry::$request['do'] : 'context_menu__' . $clean_module . '__' . ipsRegistry::$request['section']; $cm_function = 'context_menu__' . $clean_module . '__' . ipsRegistry::$request['section']; $cm_module = 'context_menu__' . $clean_module; if (method_exists($_class, $cm_function_full)) { $this->cm_output = $context_menu->__wrap($context_menu->{$cm_function_full}()); } else { if (method_exists($_class, $cm_function)) { $this->cm_output = $context_menu->__wrap($context_menu->{$cm_function}()); } else { if (method_exists($_class, $cm_module)) { $this->cm_output = $context_menu->__wrap($context_menu->{$cm_module}()); } } } } } /** * Add in bookmarkables */ require_once IPS_ROOT_PATH . 'sources/classes/admin/bookmarks.php'; $bookmarks = new classes_admin_bookmarks(); $_bookmarkData = array('url' => $bookmarks->cleanUrl($this->settings['query_string_safe']), 'can' => $this->_canBookmark ? 'true' : 'false', 'has' => $bookmarks->hasBookmarked($this->settings['query_string_safe']) ? 'true' : 'false', 'jsn' => $bookmarks->asJson()); //----------------------------------------- // Get tab order //----------------------------------------- $applications = ipsRegistry::$applications; $mainTabs = $this->registry->output->getMainTabKeys(); $otherTabs = $this->registry->output->getOtherTabKeys(); $mainTabData = $this->registry->output->getTabDataFromKeys($mainTabs); $otherTabData = $this->registry->output->getTabDataFromKeys($otherTabs); $gbl_sub_menu = $this->_buildGlobalSubMenu(); $html = str_replace('<%CONTENT%>', $this->html_main, $this->global_template->global_main_wrapper(IPS_DOC_CHAR_SET, $this->_css, $gbl_sub_menu, $mainTabData, $otherTabData, $_bookmarkData)); //------------------------------------------------ // Message in a bottle? //------------------------------------------------ $message = ''; if ($this->global_error) { $message = $this->global_template->global_error_message(); } if ($this->global_message) { $message .= $message ? '<br />' . $this->global_template->global_message() : $this->global_template->global_message(); } //----------------------------------------- // Figure out title... //----------------------------------------- $this->html_title = "IP.Board:"; if (ipsRegistry::$current_application) { $this->html_title .= " " . IPSLIb::getAppTitle(ipsRegistry::$current_application); if (ipsRegistry::$current_module) { $this->html_title .= " > " . (isset($this->lang->words['module__' . ipsRegistry::$current_application . '_' . ipsRegistry::$current_module]) ? $this->lang->words['module__' . ipsRegistry::$current_application . '_' . ipsRegistry::$current_module] : ipsRegistry::$modules_by_section[ipsRegistry::$current_application][ipsRegistry::$current_module]['sys_module_title']); } } if (count($this->extra_title)) { $this->html_title .= " > " . implode(' > ', $this->extra_title); } //----------------------------------------- // Got app menu cache? //----------------------------------------- if (!is_array(ipsRegistry::cache()->getCache('app_menu_cache')) or !count(ipsRegistry::cache()->getCache('app_menu_cache'))) { $this->cache->rebuildCache('app_menu_cache', 'global'); } //----------------------------------------- // Other tags... //----------------------------------------- // Can set the second one to none to hide left menu when no context nav is available $html = str_replace("<%DISPLAY_SUB_MENU%>", $this->cm_output ? '' : 'none', $html); $html = str_replace("<%TITLE%>", $this->html_title, $html); $html = str_replace("<%SUBMENU%>", $this->_buildSubMenu(), $html); # Must be called first $html = str_replace("<%MENU%>", $this->_buildMenu(), $html); $html = str_replace("<%SIDEBAR_EXTRA%>", $this->sidebar_extra, $html); $html = str_replace("<%CONTEXT_MENU%>", $this->cm_output, $html); $html = str_replace("<%SECTIONCONTENT%>", $this->html, $html); # This has to be called after the menu has been set so that query_string is set correctly $html = str_replace("<%MSG%>", $message, $html); //----------------------------------------- // Fix up navigation //----------------------------------------- if (count($this->core_nav)) { foreach ($this->core_nav as $data) { if (isset($_seen_nav[$data[1]])) { continue; } else { $_seen_nav[$data[1]] = 1; } $_nav = isset($_last_nav['nav']) ? $_last_nav['nav'] . ' > ' . $data[1] : $data[1]; # Append last nav... $_last_nav = array('url' => $data[0], 'title' => $data[1], 'nav' => $_nav); if ($data[0]) { $navigation[] = "<a href='" . $data[0] . "'>" . $data[1] . "</a>"; } else { $navigation[] = $data[1]; } } } if (count($this->extra_nav)) { foreach ($this->extra_nav as $data) { if (isset($_seen_nav[$data[1]])) { continue; } else { $_seen_nav[$data[1]] = 1; } $_nav = isset($_last_nav['nav']) ? $_last_nav['nav'] . ' > ' . $data[1] : $data[1]; # Append last nav... $_last_nav = array('url' => $data[0], 'title' => $data[1], 'nav' => $_nav); if ($data[0]) { $navigation[] = "<a href='" . $data[0] . "'>" . $data[1] . "</a>"; } else { $navigation[] = $data[1]; } } } //------------------------------------------------ // 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; }
/** * 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)) { $mytopic['attachment_data'] = $this_topic_attachments; } $final_topics[] = $mytopic; } } //----------------------------------------- // Return... //----------------------------------------- if (count($final_topics)) { return $final_topics; } else { return $topics; } }
/** * 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; //----------------------------------------- // 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', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left')))); $outer = $this->DB->execute(); while ($p = $this->DB->fetch($outer)) { $posts[$p['pid']] = $p; $topics[$p['topic_id']] = $p['topic_id']; $forums[$p['forum_id']] = $p['forum_id']; if ($p['author_id'] == $this->request['postauthor']) { $author = array('id' => $p['author_id'], 'name' => $p['author_name']); } if ($p['pid'] != $this->request['postdate']) { $post_to_delete[] = $p['pid']; } if ($p['append_edit']) { $append_edit = 1; } } //----------------------------------------- // Update main post... //----------------------------------------- $this->DB->update('posts', array('author_id' => $author['id'], 'author_name' => $author['name'], 'post' => $post, 'post_key' => $new_post_key, 'edit_time' => time(), 'edit_name' => $this->memberData['members_display_name'], 'append_edit' => ($append_edit or !$this->memberData['g_append_edit']) ? 1 : 0), 'pid=' . $this->request['postdate']); /* Run moderation sync */ $this->modLibrary->runModSync('postMerge', $this->pids, $this->request['postdate']); //----------------------------------------- // Fix attachments //----------------------------------------- $attach_keep = array(); $attach_kill = array(); foreach ($_POST as $key => $value) { if (preg_match('/^attach_(\\d+)$/', $key, $match)) { if ($this->request[$match[0]] == 'keep') { $attach_keep[] = $match[1]; } else { $attach_kill[] = $match[1]; } } } $attach_keep = IPSLib::cleanIntArray($attach_keep); $attach_kill = IPSLib::cleanIntArray($attach_kill); //----------------------------------------- // Keep //----------------------------------------- if (count($attach_keep)) { $this->DB->update('attachments', array('attach_rel_id' => $this->request['postdate'], 'attach_post_key' => $new_post_key, 'attach_member_id' => $author['id']), 'attach_id IN(' . implode(",", $attach_keep) . ')'); } //----------------------------------------- // Kill Attachments //----------------------------------------- if (count($attach_kill)) { $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php', 'class_attach'); $class_attach = new $classToLoad($this->registry); $class_attach->type = 'post'; $class_attach->init(); $class_attach->bulkRemoveAttachment($attach_kill, 'attach_id'); } //----------------------------------------- // Kill old posts //----------------------------------------- if (count($post_to_delete)) { $this->DB->delete('posts', 'pid IN(' . implode(",", $post_to_delete) . ')'); IPSDeleteLog::removeEntries($post_to_delete, 'post', TRUE); /* Handle Rep */ $this->DB->delete('reputation_cache', "app='forums' AND type='pid' AND type_id IN(" . implode(",", $post_to_delete) . ")"); $this->DB->delete('reputation_index', "app='forums' AND type='pid' AND type_id IN(" . implode(",", $post_to_delete) . ")"); foreach ($post_to_delete as $post) { $this->DB->delete('reputation_totals', "rt_key=MD5('forums;pid;" . $post . "') AND rt_type_id=" . $post); } } foreach ($topics as $t) { $this->modLibrary->rebuildTopic($t, 0); } foreach ($forums as $f) { $this->modLibrary->forumRecount($f); } $this->cache->rebuildCache('stats', 'global'); /* Clear the content cache */ IPSContentCache::drop('post', $this->pids); $this->_addModeratorLog(sprintf($this->lang->words['acp_merged_posts'], implode(", ", $this->pids))); } }
/** * 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}"); $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; }
/** * Output the HTML to the browser * * @access public * @return void */ public function sendOutput() { $this->_sendOutputSetUp('normal'); //--------------------------------------- // INIT //----------------------------------------- $clean_module = IPSText::alphanumericalClean(ipsRegistry::$current_module); $navigation = array(); $_seen_nav = array(); $_last_nav = ''; $no_wrapper = FALSE; //----------------------------------------- // Inline pop-up? //----------------------------------------- if (ipsRegistry::$request['_popup']) { $this->printPopupWindow(); exit; } //----------------------------------------- // Debug? //----------------------------------------- if ($this->DB->obj['debug']) { flush(); print "<html><head><title>SQL Debugger</title><body bgcolor='white'><style type='text/css'> TABLE, TD, TR, BODY { font-family: verdana,arial, sans-serif;color:black;font-size:11px }</style>"; print "<h1 align='center'>SQL Total Time: {$this->DB->sql_time} for {$this->DB->query_cnt} queries</h1><br />" . $this->DB->debug_html; print "<br /><div align='center'><strong>Total SQL Time: {$this->DB->sql_time}</div></body></html>"; exit; } //----------------------------------------- // Sticky tabs //----------------------------------------- $this->member->setProperty('global_sticky_tabs', is_array($this->memberData['global_sticky_tabs']) ? $this->memberData['global_sticky_tabs'] : array()); //----------------------------------------- // Start function proper //----------------------------------------- if ($no_wrapper === FALSE) { //----------------------------------------- // Context sensitive stuff //----------------------------------------- if (!$this->cm_output) { $_file = IPS_APPLICATION_PATH . 'skin_cp/cp_skin_' . $clean_module . '_context_menu.php'; $_class = 'cp_skin_' . $clean_module . '_context_menu'; if (file_exists($_file)) { require $_file; $context_menu = new $_class($this->registry); $cm_function_full = ipsRegistry::$request['do'] ? 'context_menu__' . $clean_module . '__' . ipsRegistry::$request['section'] . '__' . ipsRegistry::$request['do'] : 'context_menu__' . $clean_module . '__' . ipsRegistry::$request['section']; $cm_function = 'context_menu__' . $clean_module . '__' . ipsRegistry::$request['section']; $cm_module = 'context_menu__' . $clean_module; if (method_exists($_class, $cm_function_full)) { $this->cm_output = $context_menu->__wrap($context_menu->{$cm_function_full}()); } else { if (method_exists($_class, $cm_function)) { $this->cm_output = $context_menu->__wrap($context_menu->{$cm_function}()); } else { if (method_exists($_class, $cm_module)) { $this->cm_output = $context_menu->__wrap($context_menu->{$cm_module}()); } else { if (ipsRegistry::$request['section'] != 'dashboard' && ipsRegistry::$request['do'] != 'index') { $this->cm_output = $this->global_template->no_context_menu(); } } } } } else { $this->cm_output = $this->global_template->no_context_menu(); } } //----------------------------------------- // Global Context Menu Stuff //----------------------------------------- $_file = IPS_ROOT_PATH . "skin_cp/cp_skin_global_context_menu.php"; if (file_exists($_file)) { require_once $_file; $global_context = new cp_skin_global_context_menu($this->registry); $global_context_output = $global_context->get(); } $html = str_replace('<%CONTENT%>', $this->html_main, $this->global_template->global_main_wrapper(IPS_DOC_CHAR_SET, $this->_css)); } else { $html = str_replace('<%CONTENT%>', $this->html_main, $this->global_template->global_main_wrapper_no_furniture(IPS_DOC_CHAR_SET, $this->_css)); } //------------------------------------------------ // Message in a bottle? //------------------------------------------------ $message = ''; if ($this->global_error) { $message = $this->global_template->global_error_message(); } if ($this->global_message) { $message .= $message ? '<br />' . $this->global_template->global_message() : $this->global_template->global_message(); } //------------------------------------------------ // Help? //------------------------------------------------ /*if ( isset( $this->html_help_title ) AND isset( $this->html_help_msg ) AND $this->html_help_title != '' ) { $help = $this->global_template->information_box( $this->html_help_title, $this->html_help_msg ) . "<br >"; }*/ //----------------------------------------- // Keith's help mode (tm) //----------------------------------------- if ($this->settings['acp_tutorial_mode']) { //-------------------------------------- // More Help? - *sigh* Keith //-------------------------------------- // Decided to use request instead of (e.g.) ipsRegistry::$current_application to make it easier for us to map. // We can change in the future if it's preferred $check_key = $this->request['app'] . '_' . $this->request['module'] . '_' . $this->request['section'] . '_' . $this->request['do'] . '_'; if ($this->request['groupHelpKey']) { $check_key .= $this->request['groupHelpKey']; } $help .= $this->global_template->help_box($check_key); } //----------------------------------------- // Figure out title... //----------------------------------------- $this->html_title = "IP.Board:"; if (ipsRegistry::$current_application) { $this->html_title .= " > " . ipsRegistry::$applications[ipsRegistry::$current_application]['app_title']; if (ipsRegistry::$current_module) { $this->html_title .= " > " . ipsRegistry::$modules_by_section[ipsRegistry::$current_application][ipsRegistry::$current_module]['sys_module_title']; } } if (count($this->extra_title)) { $this->html_title .= " > " . implode(' > ', $this->extra_title); } //----------------------------------------- // Got app menu cache? //----------------------------------------- if (!is_array(ipsRegistry::cache()->getCache('app_menu_cache')) or !count(ipsRegistry::cache()->getCache('app_menu_cache'))) { $this->cache->rebuildCache('app_menu_cache', 'global'); } //----------------------------------------- // Other tags... //----------------------------------------- // Can set the second one to none to hide left menu when no context nav is available $html = str_replace("<%DISPLAY_SUB_MENU%>", $this->cm_output ? '' : 'none', $html); $html = str_replace("<%TITLE%>", $this->html_title, $html); $html = str_replace("<%SUBMENU%>", $this->_buildSubMenu(), $html); # Must be called first $html = str_replace("<%MENU%>", $this->_buildMenu(), $html); $html = str_replace("<%CONTEXT_MENU%>", $this->cm_output, $html); $html = str_replace("<%GLOBAL_CONTEXT_MENU%>", $global_context_output, $html); $html = str_replace("<%SECTIONCONTENT%>", $this->html, $html); # This has to be called after the menu has been set so that query_string is set correctly $html = str_replace("<%MSG%>", $message, $html); $html = str_replace("<%HELP%>", isset($help) ? $help : '', $html); //----------------------------------------- // Fix up navigation //----------------------------------------- if (count($this->core_nav)) { foreach ($this->core_nav as $data) { if (isset($_seen_nav[$data[1]])) { continue; } else { $_seen_nav[$data[1]] = 1; } $_nav = isset($_last_nav['nav']) ? $_last_nav['nav'] . ' > ' . $data[1] : $data[1]; # Append last nav... $_last_nav = array('url' => $page_location, 'title' => $data[1], 'nav' => $_nav); if ($data[0]) { $navigation[] = "<a href='" . $data[0] . "'>" . $data[1] . "</a>"; } else { $navigation[] = $data[1]; } } } if (count($this->extra_nav)) { foreach ($this->extra_nav as $data) { if (isset($_seen_nav[$data[1]])) { continue; } else { $_seen_nav[$data[1]] = 1; } $_nav = $_last_nav['nav'] ? $_last_nav['nav'] . ' > ' . $data[1] : $data[1]; # Append last nav... $_last_nav = array('url' => $page_location, 'title' => $data[1], 'nav' => $_nav); if ($data[0]) { $navigation[] = "<a href='" . $data[0] . "'>" . $data[1] . "</a>"; } else { $navigation[] = $data[1]; } } } //------------------------------------------------ // 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... //----------------------------------------- $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; }
/** * Show the main screen * * @access public * @param string Current path * @param array Folders in the path * @param array Files in the path * @param array Unfinished pages * @return string HTML */ public function overview($path, array $folders, array $files, array $unfinished) { $IPBHTML = ""; //--starthtml--// //----------------------------------------- // Fix CSS - have to be careful of paths since // our CSS file is in our own dir, and minify // normalizes all paths to the first CSS file... // just print it inline ;) //----------------------------------------- $inlineCSS = <<<EOF .acp-menu li.ccs-file { \tbackground-image: url(skin_cp/_newimages/ccs/page.png ); } .acp-menu li.ccs-css { \tbackground-image: url( skin_cp/_newimages/ccs/css.png ); } .acp-menu li.ccs-js { \tbackground-image: url( skin_cp/_newimages/ccs/js.png ); } EOF; $this->registry->output->addToDocumentHead('inlinecss', $inlineCSS); $urlencodePath = urlencode($path); $IPBHTML .= <<<HTML <div class='section_title'> \t<h2>{$this->lang->words['page_and_file_man']}</h2> \t<ul class='context_menu'> \t\t<li> \t\t\t<a href='{$this->settings['base_url']}&module=pages&section=manage&do=newDir&in={$urlencodePath}' title='{$this->lang->words['add_folder_alt']}'> \t\t\t\t<img src='{$this->settings['skin_acp_url']}/_newimages/icons/folder_add.png' alt='{$this->lang->words['icon']}' /> \t\t\t\t{$this->lang->words['add_folder_alt']} \t\t\t</a> \t\t</li> \t\t<li> \t\t\t<a class='ipbmenu' id='addContent'> \t\t\t\t<img src='{$this->settings['skin_acp_url']}/_newimages/icons/page_add.png' alt='{$this->lang->words['icon']}' /> \t\t\t\t{$this->lang->words['add_content_button']} \t\t\t</a> \t\t</li> \t</ul> </div> <ul class='acp-menu' id='addContent_menucontent'> \t<li class='icon ccs-file'><a href='{$this->settings['base_url']}&module=pages&section=wizard&in={$urlencodePath}' title='{$this->lang->words['add_page_button']}'>{$this->lang->words['add_page_button']}</a></li> \t<li class='icon ccs-css'><a href='{$this->settings['base_url']}&module=pages&section=wizard&fileType=css&in={$urlencodePath}' title='{$this->lang->words['add_css_button']}'>{$this->lang->words['add_css_button']}</a></li> \t<li class='icon ccs-js'><a href='{$this->settings['base_url']}&module=pages&section=wizard&fileType=js&in={$urlencodePath}' title='{$this->lang->words['add_js_button']}'>{$this->lang->words['add_js_button']}</a></li> </ul> HTML; /*if( count($unfinished) ) { $IPBHTML .= <<<HTML <div class='acp-box'> <h3>{$this->lang->words['unfinished_pages_header']}</h3> <div class='information-box'>{$this->lang->words['unfinished_pages_desc']}</div> <ul class='alternate_rows filemanager'> HTML; foreach( $unfinished as $page ) { $IPBHTML .= <<<HTML <li class='record'> <div class='manage'> <img class='ipbmenu' id="menu_{$page['wizard_id']}" src='{$this->settings['skin_acp_url']}/_newimages/menu_open.png' alt='{$this->lang->words['page_options_alt']}' /> <ul class='acp-menu' id='menu_{$page['wizard_id']}_menucontent'> <li class='icon edit'><a href='{$this->settings['base_url']}&module=pages&section=wizard&do=completePage&wizard_session={$page['wizard_id']}'>{$this->lang->words['continue_config_block']}</a></li> <li class='icon delete'><a href='#' onclick="return acp.confirmDelete( '{$this->settings['base_url']}&module=pages&section=pages&do=delete&type=wizard&page={$page['wizard_id']}' );">{$this->lang->words['delete_page_link']}</a></li> </ul> </div> <div> <strong>{$page['wizard_name']}</strong> <div class='desctext'>({$this->lang->words['current_step_pre']} {$page['wizard_step']})</div> </div> </li> HTML; } $IPBHTML .= <<<HTML </ul> </div> <br /> HTML; }*/ $IPBHTML .= <<<HTML <script type='text/javascript' src='{$this->settings['js_app_url']}acp.ccs.js'></script> <script type='text/javascript'> function confirmsubmit() { \tvar isOk = false; \t \t\$\$('#multi-action option').each( function( elem ) { \t\tDebug.write( "Found option: " + elem.value ); \t\t \t\tif( elem.selected && elem.value == 'delete' ) \t\t{ \t\t\tif( confirm( "{$this->lang->words['multi_submit_confirm']}" ) ) \t\t\t{ \t\t\t\tisOk\t= true; \t\t\t} \t\t} \t\t \t\tif( elem.selected && elem.value != 'delete' ) \t\t{ \t\t\tisOk\t= true; \t\t} \t}); \t \treturn isOk; } </script> <div class='acp-box'> \t<h3>{$this->lang->words['viewing_h_prefix']} {$path}</h3> \t<form action='{$this->settings['base_url']}&module=pages&section=manage&do=multi' method='post'> \t<input type='hidden' name='return' value='{$urlencodePath}' /> \t<table width='100%' cellpadding='0' cellspacing='0' class='alternate_rows double_pad'> \t\t<tr> \t\t\t<th style='width: 2%'> </th> \t\t\t<th style='width: 46%'>{$this->lang->words['row_name']}</th> \t\t\t<th style='width: 30%'>{$this->lang->words['row_modified']}</th> \t\t\t<th style='width: 20%'>{$this->lang->words['row_size']}</th> \t\t\t<th style='width: 2%'> </th> \t\t</tr> HTML; if (!count($folders) && !count($files)) { $IPBHTML .= <<<HTML \t<tr> \t\t<td colspan='5'> \t\t\t<div style='padding: 20px; text-align: center'> \t\t\t\t<em>{$this->lang->words['no_pages_created']} <a href='{$this->settings['base_url']}&module=pages&section=wizard&in=%2F'>{$this->lang->words['create_one_now']}</a></em> \t\t\t</div> \t\t</td> \t</tr> HTML; } else { foreach ($folders as $object) { $path = urlencode($object['full_path']); $mtime = $this->registry->getClass('class_localization')->getDate($object['last_modified'], 'SHORT', 1); $id = md5($path); $IPBHTML .= <<<HTML \t\t<tr> HTML; $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; }
/** * 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 //----------------------------------------- if ($this->settings['debug_level'] >= 3) { $stats .= "<br />\n<div class='tableborder' style='overflow:auto'>\n<div class='subtitle'>Queries Used</div><div class='row1' style='padding:6px'>"; foreach ($this->DB->obj['cached_queries'] as $q) { $q = htmlspecialchars($q); $q = str_ireplace("SELECT", "<span style='color:red'>SELECT</span>", $q); $q = preg_replace("/^UPDATE/i", "<span style='color:blue'>UPDATE</span>", $q); $q = preg_replace("/^DELETE/i", "<span style='color:orange'>DELETE</span>", $q); $q = preg_replace("/^INSERT/i", "<span style='color:green'>INSERT</span>", $q); $q = str_replace("LEFT JOIN", "<span style='color:red'>LEFT JOIN</span>", $q); $stats .= "<p style='padding:6px;border-bottom:1px solid black'>{$q}</p>\n"; } if (count($this->DB->obj['shutdown_queries'])) { foreach ($this->DB->obj['shutdown_queries'] as $q) { $q = htmlspecialchars($q); $q = preg_replace("/^SELECT/i", "<span style='color:red'>SELECT</span>", $q); $q = preg_replace("/^UPDATE/i", "<span style='color:blue'>UPDATE</span>", $q); $q = preg_replace("/^DELETE/i", "<span style='color:orange'>DELETE</span>", $q); $q = preg_replace("/^INSERT/i", "<span style='color:green'>INSERT</span>", $q); $q = str_replace("LEFT JOIN", "<span style='color:red'>LEFT JOIN</span>", $q); //$q = preg_replace( "/(".$this->settings['sql_tbl_prefix'].")(\S+?)([\s\.,]|$)/", "<span class='purple'>\\1\\2</span>\\3", $q ); $stats .= "<div style='background:#DEDEDE'><b>SHUTDOWN:</b> {$q}</div><br />\n"; } } $stats .= "</div>\n</div>"; } if ($stats) { $stats = "\n\t\t\t\t\t <div align='center'>\n\t\t\t\t\t <div class='row2' style='padding:8px;vertical-align:middle'><a href='#' onclick=\"\$('debug').toggle(); return false;\">Hide Debug Information</a></div>\n\t\t\t\t\t <br />\n\t\t\t\t\t <div class='tableborder' align='left' id='debug'>\n\t\t\t\t\t\t<div class='maintitle'>Debug Information</div>\n\t\t\t\t\t\t <div style='padding:5px;background:#8394B2;'>{$stats}</div>\n\t\t\t\t\t </div>\n\t\t\t\t\t </div>"; } return $stats; }
/** * Returns an array of topics * * @param boolean Load only topics viewable by guests? * @return @e array Array of topics data */ public function return_topic_list_data($view_as_guest = false, $parse_display = false) { //----------------------------------------- // INIT //----------------------------------------- $topics = array(); if ($view_as_guest) { $this->registry->class_forums->strip_invisible = true; $this->registry->class_forums->forumsInit(); } else { $this->registry->class_forums->strip_invisible = false; $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 //----------------------------------------- $_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; } }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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); }
/** * 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; }
/** * Group form * * @param string Type (add|edit) * @param array Group data * @param array Permission masks * @param array Extra tabs * @param string Default tab to open * @return string HTML */ public function groupsForm($type, $group, $permission_masks, $content = array(), $firsttab = '') { //----------------------------------------- // 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']); 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['gf_unlimited']; } else { if ($type == 'edit' and $group['g_attach_max'] == -1) { $group['g_attach_maxdis'] = $this->lang->words['gf_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['gf_unlimited']; } else { if ($type == 'edit' and $group['g_attach_per_post'] == -1) { $group['g_attach_per_postdis'] = $this->lang->words['gf_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']; $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'], '', 32, 'text', '', '', 32); $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_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'], '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['gbw_view_last_info'] = $this->registry->output->formYesNo("gbw_view_last_info", $group['gbw_view_last_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_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']); $form['gbw_view_reps'] = $this->registry->output->formYesNo("gbw_view_reps", $group['gbw_view_reps']); $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->lang->words['g_upersonalpho_w'] . ' ' . $this->registry->output->formSimpleInput("max_dims_x", $sig_limits[2]) . ' x ' . $this->lang->words['g_upersonalpho_h'] . ' ' . $this->registry->output->formSimpleInput("max_dims_y", $sig_limits[3]); $form['max_urls'] = $this->registry->output->formInput("max_urls", $sig_limits[4]); $form['max_lines'] = $this->registry->output->formInput("max_lines", $sig_limits[5]); $form['g_displayname_unit'] = $this->registry->output->formSimpleInput("g_displayname_unit", $group['g_displayname_unit'], 3); $form['gbw_displayname_unit_type'] = $this->registry->output->formDropdown("gbw_displayname_unit_type", $gbw_unit_type, $group['gbw_displayname_unit_type']); $form['g_sig_unit'] = $this->registry->output->formSimpleInput("g_sig_unit", $group['g_sig_unit'], 3); $form['gbw_sig_unit_type'] = $this->registry->output->formDropdown("gbw_sig_unit_type", $gbw_unit_type, $group['gbw_sig_unit_type']); $form['gbw_promote_unit_type'] = $this->registry->output->formDropdown("gbw_promote_unit_type", $gbw_unit_type, $group['gbw_promote_unit_type']); $form['gbw_no_status_update'] = $this->registry->output->formYesNo("gbw_no_status_update", $group['gbw_no_status_update']); $form['gbw_no_status_import'] = $this->registry->output->formYesNo("gbw_no_status_import", $group['gbw_no_status_import']); $form['g_max_notifications'] = $this->registry->output->formInput("g_max_notifications", $group['g_max_notifications']); $form['gbw_allow_customization'] = $this->registry->output->formYesNo("gbw_allow_customization", $group['gbw_allow_customization']); $form['gbw_allow_url_bgimage'] = $this->registry->output->formYesNo("gbw_allow_url_bgimage", $group['gbw_allow_url_bgimage']); $form['gbw_allow_upload_bgimage'] = $this->registry->output->formYesNo("gbw_allow_upload_bgimage", $group['gbw_allow_upload_bgimage']); $form['g_max_bgimg_upload'] = $this->registry->output->formInput("g_max_bgimg_upload", $group['g_max_bgimg_upload']); $form['gbw_disable_tagging'] = $this->registry->output->formYesNo("gbw_disable_tagging", $group['gbw_disable_tagging']); $form['gbw_disable_prefixes'] = $this->registry->output->formYesNo("gbw_disable_prefixes", $group['gbw_disable_prefixes']); if ($type == 'edit') { $title = $this->lang->words['g_editing'] . $group['g_title']; } else { $title = $this->lang->words['g_adding']; } $IPBHTML = ""; //--starthtml--// $IPBHTML .= <<<HTML <div class='section_title'> \t<h2>{$title}</h2> </div> <script type='text/javascript' src='{$this->settings['js_app_url']}ipsEditGroup.js'></script> <script type='text/javascript'> HTML; foreach ($permission_masks as $d) { $IPBHTML .= "\tperms_{$d[0]} = '{$d[1]}';\n"; } $IPBHTML .= <<<HTML </script> <form action='{$this->settings['base_url']}&{$this->form_code}&do={$form_code}&secure_key={$secure_key}' method='post' id='adform' name='adform' onsubmit='return checkform();'> <input type='hidden' name='id' value='{$group['g_id']}' /> <div class='acp-box'> \t<h3> </h3> \t <div id='tabstrip_group' class='ipsTabBar with_left with_right'> \t<span class='tab_left'>«</span> \t<span class='tab_right'>»</span> \t \t<ul> \t\t<li id='tab_GROUPS_1'>{$this->lang->words['g_globalsett']}</li> \t\t<li id='tab_GROUPS_2'>{$this->lang->words['g_globalperm']}</li> HTML; // Got blocks from other apps? $IPBHTML .= implode("\n", $content['tabs']); $pmlimit = sprintf($this->lang->words['gf_pm_limit'], $form['g_pm_perday']); $pmflood = sprintf($this->lang->words['gf_pm_flood'], $form['g_pm_flood_mins']); $_firstTab = $firsttab ? 'GROUPS_' . $firsttab : "GROUPS_1"; $dnc1 = sprintf($this->lang->words['display_name_changes_1'], $form['g_displayname_unit'], $form['gbw_displayname_unit_type']); $dnc2 = sprintf($this->lang->words['display_name_changes_3'], $form['g_dname_changes'], $form['g_dname_date']); $IPBHTML .= <<<HTML \t</ul> </div> <div id='tabstrip_group_content' class='ipsTabBar_content'> \t<div id='tab_GROUPS_1_content'> \t\t<table class='ipsTable double_pad'> \t\t\t<tr> \t\t\t\t<th colspan='2'>{$this->lang->words['gf_t_details']}</th> \t\t\t</tr> \t\t\t<tr> \t\t\t\t<td class='field_title'> \t\t\t\t\t<strong class='title'>{$this->lang->words['gf_gtitle']}</strong> \t\t\t\t</td> \t\t\t\t<td class='field_field'> \t\t\t\t\t{$form['g_title']} \t\t\t\t</td> \t\t\t</tr> \t\t\t<tr> \t\t \t\t<td class='field_title'> \t\t\t\t\t<strong class='title'>{$this->lang->words['gf_gicon']}</strong> \t\t\t\t</td> \t\t \t\t<td class='field_field'> \t\t\t\t\t{$form['g_icon']}<br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['gf_gicon_info']}</span> \t\t \t\t</td> \t\t \t</tr> \t\t \t \t\t \t<tr> \t\t \t\t<td class='field_title'> \t\t\t\t\t<strong class='title'>{$this->lang->words['gf_gformpre']}</strong> \t\t\t\t</td> \t\t \t\t<td class='field_field'> \t\t\t\t\t{$form['prefix']}<br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['gf_gformpre_info']}</span> \t\t \t\t</td> \t\t \t</tr> \t\t \t \t\t \t<tr> \t\t \t\t<td class='field_title'> \t\t\t\t\t<strong class='title'>{$this->lang->words['gf_gformsuf']}</strong> \t\t\t\t</td> \t\t \t\t<td class='field_field'> \t\t\t\t\t{$form['suffix']}<br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['gf_gformsuf_info']}</span> \t\t \t\t</td> \t\t \t</tr> \t\t\t<tr> \t\t\t\t<th colspan='2'>{$this->lang->words['gf_t_permissions']}</th> \t\t\t</tr> \t\t\t<tr> \t\t \t\t<td class='field_title'> \t\t\t\t\t<strong class='title'>{$this->lang->words['gf_permset']}</strong> \t\t\t\t</td> \t\t \t\t<td class='field_field'> \t\t\t\t\t{$form['permid']}<br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['g_permset_info']}</span> \t\t \t\t</td> \t\t \t</tr> \t\t \t<tr> \t\t \t\t<td class='field_title'> \t\t\t\t\t<strong class='title'>{$this->lang->words['g_newpermset']}</strong> \t\t\t\t</td> \t\t \t\t<td class='field_field'> \t\t\t\t\t{$form['g_new_perm_set']}<br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['g_newpermset_info']}</span> \t\t \t\t</td> \t\t \t</tr> \t\t \t \t\t \t<tr class='guest_legend'> \t\t \t\t<td class='field_title'> \t\t \t\t\t<strong class='title'>{$this->lang->words['gf_hide']}</strong> \t\t \t\t</td> \t\t \t\t<td class='field_field'> \t\t \t\t\t{$form['g_hide_from_list']} \t\t \t\t</td> \t\t \t</tr> \t\t \t \t\t \t<tr class='guest_legend'> \t\t \t\t<td class='field_title'> \t\t \t\t\t<strong class='title'>{$this->lang->words['gf_hide_online']}</strong> \t\t \t\t</td> \t\t \t\t<td class='field_field'> \t\t \t\t\t{$form['g_hide_online_list']}<br /> \t\t \t\t\t<span class='desctext'>{$this->lang->words['gf_hideonline_desc']}</span> \t\t \t\t</td> \t\t \t</tr> \t\t \t<tr> \t\t\t\t<th colspan='2'>{$this->lang->words['gf_t_display_name']}</th> \t\t\t</tr> \t\t\t<tr> \t\t\t\t<td class='field_title'> \t\t\t\t\t<strong class='title'>{$this->lang->words['display_name_changes']}</strong> \t\t\t\t</td> \t\t\t\t<td> \t\t\t\t\t{$dnc1}<br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['display_name_changes_2']}</span><br /> \t\t\t\t\t<br /> \t\t\t\t\t{$dnc2}<br /> \t\t\t\t\t<span class='desctext'>{$this->lang->words['display_name_changes_4']}</span> \t\t\t\t</td> \t\t\t</tr> \t\t \t<tr class='guest_legend'> \t\t\t\t<th colspan='2'>{$this->lang->words['gf_t_access_control']}</th> \t\t\t</tr> \t\t \t<tr class='guest_legend'> \t\t \t\t<td class='field_title'> \t\t \t\t\t<strong class='title'>{$this->lang->words['gf_msup']}</strong> \t\t \t\t</td> \t\t \t\t<td class='field_field'> \t\t \t\t\t{$form['g_is_supmod']} \t\t \t\t</td> \t\t \t</tr> \t\t \t \t\t \t<tr class='guest_legend'> \t\t \t\t<td class='field_title'> \t\t \t\t\t<strong class='title'>{$this->lang->words['gf_macp']}</strong> \t\t \t\t</td> \t\t \t\t<td class='field_field'> \t\t \t\t\t{$form['g_access_cp']} \t\t \t\t</td> \t\t \t</tr> \t\t \t<tr class='guest_legend'> \t\t\t\t<th colspan='2'>{$this->lang->words['gf_t_promotion']}</th> \t\t\t</tr> \t\t \t<tr class='guest_legend'> \t\t \t\t<td class='field_title'> \t\t\t\t\t<strong class='title'>{$this->lang->words['gf_mpromote']}</strong> \t\t\t\t\t{$this->javascriptHelpLink('mg_promote')} \t\t\t\t</td> \t\t \t\t<td class='field_field'>\t\t \t\t HTML; if ($group['g_access_cp']) { $IPBHTML .= "{$this->lang->words['g_mpromote_no']}"; } else { $promotegrouptxt = sprintf($this->lang->words['g_mpromote_to'], $form['g_promotion_id'], $form['g_promotion_posts'], $form['gbw_promote_unit_type']); $IPBHTML .= "{$promotegrouptxt}"; } $IPBHTML .= <<<HTML \t\t \t\t</td> \t\t \t</tr> \t\t</table> \t</div> <div id='tab_GROUPS_2_content'> \t <table class='ipsTable double_pad'> \t\t<tr> \t\t\t<th colspan='2'>{$this->lang->words['gf_t_access_permissions']}</th> \t\t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t\t\t\t<strong class='title'>{$this->lang->words['gf_ssite']}</strong> \t\t\t</td> \t \t\t<td class='field_field'> HTML; if ($group['g_id'] == $this->settings['guest_group']) { $g_view_board_warning_message = sprintf($this->lang->words['gf_view_board_warning'], $this->registry->output->buildURL('app=core&module=settings§ion=settings', 'admin')); $IPBHTML .= <<<HTML \t \t\t\t<div class='information-box'>{$g_view_board_warning_message}</div> \t \t\t\t<input type='hidden' name='g_view_board' value='1' /> HTML; } else { $IPBHTML .= $form['g_view_board']; } $IPBHTML .= <<<HTML \t \t\t</td> \t \t</tr> \t \t \t \t<tr> \t \t\t<td class='field_title'> \t\t\t\t<strong class='title'>{$this->lang->words['gf_soffline']}</strong> \t\t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_access_offline']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr> \t \t\t<td class='field_title'> \t\t\t\t<strong class='title'>{$this->lang->words['gf_sprofile']}</strong> \t\t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_mem_info']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr> \t \t\t<td class='field_title'> \t\t\t\t<strong class='title'>{$this->lang->words['gbw_view_last_info']}</strong> \t\t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['gbw_view_last_info']} \t \t\t</td> \t \t</tr> \t \t \t \t \t \t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t\t\t\t<strong class='title'>{$this->lang->words['gf_addfriends']}</strong> \t\t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_can_add_friends']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_editprofile']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_edit_profile']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_shtml']}</strong> \t\t\t\t{$this->javascriptHelpLink('mg_dohtml')} \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_dohtml']} \t \t\t</td> \t \t</tr> \t\t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_maxnotify']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_max_notifications']}<br /> \t\t\t\t<span class='desctext'>{$this->lang->words['gf_maxnotify_desc']}</span> \t \t\t</td> \t \t</tr> \t\t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_sbadword']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_bypass_badwords']} \t \t\t</td> \t \t</tr> \t\t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_no_status']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['gbw_no_status_update']} \t \t\t</td> \t \t</tr> \t \t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_no_status_import']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['gbw_no_status_import']} \t \t\t\t<br /><span class='desctext'>{$this->lang->words['gf_no_status_import_d']}</span> \t \t\t</td> \t \t</tr> \t \t \t \t<tr> \t\t\t<th colspan='2'>{$this->lang->words['gf_customization_title']}</th> \t\t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t\t\t\t<strong class='title'>{$this->lang->words['gf_bw_allow_customization']}</strong> \t\t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['gbw_allow_customization']}\t\t\t\t \t\t\t\t<br /><span class='desctext'>{$this->lang->words['gbw_allow_customization_d']}</span> \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t\t\t\t<strong class='title'>{$this->lang->words['gf_bw_allow_url_bgimage']}</strong> \t\t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['gbw_allow_url_bgimage']} \t\t\t\t<br /><span class='desctext'>{$this->lang->words['gbw_allow_url_bgimage_d']}</span> \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t\t\t\t<strong class='title'>{$this->lang->words['gf_bw_allow_upload_bgimage']}</strong> \t\t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['gbw_allow_upload_bgimage']} \t \t\t\t<div style='padding-top:4px'>{$this->lang->words['gf_max_bgimg_upload']} {$form['g_max_bgimg_upload']}</div> \t\t\t\t<br /><span class='desctext'>{$this->lang->words['gbw_allow_upload_bgimage_d']}</span> \t \t\t</td> \t \t</tr> \t \t<tr> \t\t\t<th colspan='2'>{$this->lang->words['gf_t_search']}</th> \t\t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t\t\t\t<strong class='title'>{$this->lang->words['gf_ssearch']}</strong> \t\t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_use_search']} \t \t\t</td> \t \t</tr> \t \t \t \t<tr> \t \t\t<td class='field_title'> \t\t\t\t<strong class='title'>{$this->lang->words['gf_sflood']}</strong> \t\t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_search_flood']}<br /> \t\t\t\t<span class='desctext'>{$this->lang->words['gf_sflood_info']}</span> \t \t\t</td> \t \t</tr> \t \t \t \t<tr class='guest_legend'> \t\t\t<th colspan='2'>{$this->lang->words['gf_t_pms']}</th> \t\t</tr> \t \t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_spm']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_use_pm']} \t\t\t\t<br />{$pmlimit} \t \t\t\t<br />{$pmflood} \t\t\t\t<br /> \t\t\t\t<span class='desctext'>{$this->lang->words['gf_spmperday_info']}</span> \t \t\t</td> \t \t</tr> \t \t \t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_spmmax']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_max_mass_pm']}<br /> \t\t\t\t<span class='desctext'>{$this->lang->words['gf_spmmax_info']}</span> \t \t\t</td> \t \t</tr> \t \t \t \t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_spmmaxstor']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_max_messages']}<br /> \t\t\t\t<span class='desctext'>{$this->lang->words['gf_maxmessages_info']}</span> \t \t\t</td> \t \t</tr> \t\t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_upm']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_can_msg_attach']} \t \t\t</td> \t \t</tr> \t \t\t<tr> \t\t\t<th colspan='2'>{$this->lang->words['gf_t_reps']}</th> \t\t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_repmaxpos']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_rep_max_positive']} \t\t\t\t<br /> \t\t\t\t<span class='desctext'>{$this->lang->words['gf_repnum_info']}</span> \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_repmaxneg']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_rep_max_negative']}<br /> \t\t\t\t<span class='desctext'>{$this->lang->words['gf_repnum_info']}</span> \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_bw_view_reps']}</strong><br /> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['gbw_view_reps']} \t \t\t</td> \t \t</tr> \t\t<tr> \t\t\t<th colspan='2'>{$this->lang->words['gf_t_sigs']}</th> \t\t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_usesigs']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t\t\t<p>{$form['use_signatures']} {$this->lang->words['g_until']} {$form['g_sig_unit']} {$form['gbw_sig_unit_type']}</p> \t\t\t<p class='desctext'>{$this->lang->words['g_limit_dd']}</p> \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_sigmaximages']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['max_images']} \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_sigmaxdims']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['max_dims']} \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_sigmaxurls']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['max_urls']} \t \t\t</td> \t \t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_sigmaxtext']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['max_lines']} \t \t\t</td> \t \t</tr> \t\t<tr> \t\t\t<th colspan='2'>{$this->lang->words['gf_t_uploads']}</th> \t\t</tr> \t \t<tr> \t \t\t<td class='field_title'> \t\t\t\t<strong class='title'>{$this->lang->words['gf_uglobal']}</strong> \t\t\t\t{$this->javascriptHelpLink('mg_upload')} \t\t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_attach_max']} \t \t\t\t{$this->lang->words['g_inkb']} ({$this->lang->words['g_ucurrently']}{$group['g_attach_maxdis']}) \t \t\t\t<br />{$this->lang->words['g_usingle']}{$ini_max}<br /> \t\t\t\t<span class='desctext'>{$this->lang->words['gf_uglobal_info']}</span> \t \t\t</td> \t \t</tr> \t \t \t \t<tr> \t \t\t<td class='field_title'> \t\t\t\t<strong class='title'>{$this->lang->words['gf_upost']}</strong> \t\t\t\t{$this->javascriptHelpLink('mg_upload')} \t\t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['g_attach_per_post']} \t \t\t\t{$this->lang->words['g_inkb']} ({$this->lang->words['g_ucurrently']}{$group['g_attach_per_postdis']}) \t \t\t\t<br />{$this->lang->words['g_usingle']}{$ini_max}<br /> \t\t\t\t<span class='desctext'>{$this->lang->words['gf_upost_info']}</span> \t \t\t</td> \t \t</tr> \t \t \t \t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gf_upersonalpho']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['p_max']}{$this->lang->words['g_inkb']} \t \t\t\t<br />{$this->lang->words['g_upersonalpho_w']}{$form['p_width']} x {$this->lang->words['g_upersonalpho_h']}{$form['p_height']}<br /> \t\t\t\t<span class='desctext'>{$this->lang->words['g_upersonalpho_l']}</span> \t \t\t</td> \t \t</tr> \t \t<tr class='guest_legend'> \t\t\t<th colspan='2'>{$this->lang->words['gf_t_tagging']}<!--You're it--></th> \t\t</tr> \t \t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gbw_disable_tagging']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['gbw_disable_tagging']}<br /> \t\t\t\t<span class='desctext'>{$this->lang->words['gbw_disable_tagging_desc']}</span> \t \t\t</td> \t \t</tr> \t \t<tr class='guest_legend'> \t \t\t<td class='field_title'> \t \t\t\t<strong class='title'>{$this->lang->words['gbw_disable_prefixes']}</strong> \t \t\t</td> \t \t\t<td class='field_field'> \t \t\t\t{$form['gbw_disable_prefixes']}<br /> \t\t\t\t<span class='desctext'>{$this->lang->words['gbw_disable_prefixes_desc']}</span> \t \t\t</td> \t \t</tr> \t</table> </div> HTML; // Got blocks from other apps? $IPBHTML .= implode("\n", $content['area']); $IPBHTML .= <<<HTML <script type='text/javascript'> \tjQ("#tabstrip_group").ipsTabBar({tabWrap: "#tabstrip_group_content", defaultTab: "tab_{$_firstTab}" }); </script> </div> <div class='acp-actionbar'> \t<input type='submit' value='{$button}' class='button primary' /> </div> </form> <script type="text/javascript"> setUpForm(); HTML; if ($group['g_id'] == $this->settings['guest_group']) { $IPBHTML .= "stripGuestLegend();"; } $IPBHTML .= <<<HTML </script> HTML; //--endhtml--// return $IPBHTML; }
/** * List all of the current caches * * @return @e void [Outputs to screen] */ public function cacheOverview() { //----------------------------------------- // INIT //----------------------------------------- $content = ""; $db_caches = array(); $lib_caches = array(); $cacheContent = array(); $total = 0; //----------------------------------------- // Get stored caches //----------------------------------------- $this->DB->build(array('select' => '*', 'from' => 'cache_store')); $this->DB->execute(); while ($r = $this->DB->fetch()) { $db_caches[$r['cs_key']] = $r; } //----------------------------------------- // Get core cache list //----------------------------------------- foreach ($this->registry->_fetchCoreVariables('cache') as $cache_name => $cache_data) { $cache_data['cache_name'] = $cache_name; $cache_data['_cache_size'] = IPSLib::sizeFormat(IPSLib::strlenToBytes(strlen($db_caches[$cache_name]['cs_value']))); $cache_data['_cs_init_load'] = $db_caches[$cache_name]['cs_init_load']; $total += IPSLib::strlenToBytes(strlen($db_caches[$cache_name]['cs_value'])); $lib_caches['global'][$cache_name] = $cache_data; } //----------------------------------------- // Get all application's cache lists //----------------------------------------- foreach (IPSLib::getEnabledApplications() as $app_dir => $app_data) { $_file = IPSLib::getAppDir($app_dir) . '/extensions/coreVariables.php'; if (is_file($_file)) { $CACHE = array(); require $_file; /*maybeLibHook*/ foreach ($CACHE as $cache_name => $cache_data) { $cache_data['cache_name'] = $cache_name; $cache_data['_cache_size'] = IPSLib::sizeFormat(IPSLib::strlenToBytes(strlen($db_caches[$cache_name]['cs_value']))); $cache_data['_cs_init_load'] = $db_caches[$cache_name]['cs_init_load']; $total += IPSLib::strlenToBytes(strlen($db_caches[$cache_name]['cs_value'])); $lib_caches[$app_dir][$cache_name] = $cache_data; } } } foreach ($lib_caches as $app => $data) { ksort($lib_caches[$app]); } $total = IPSLib::sizeFormat($total); /* Content Cache Stuffs */ if (IPSContentCache::isEnabled()) { /* Get all posts */ $statsCache = ipsRegistry::cache()->getCache('stats'); $cacheContent['posts'] = array('count' => intval($statsCache['total_replies'] + $statsCache['total_topics'])); /* Get all members */ $cacheContent['members'] = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as count', 'from' => 'members')); /* Get cached post count */ $cacheContent['cachedPosts'] = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as count', 'from' => 'content_cache_posts')); /* Get cached sig count */ $cacheContent['cachedSigs'] = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as count', 'from' => 'content_cache_sigs')); /* Work out percentages */ $cacheContent['postPercent'] = ($cacheContent['posts']['count'] and $cacheContent['cachedPosts']['count']) ? sprintf("%.0f", $cacheContent['cachedPosts']['count'] / $cacheContent['posts']['count'] * 100) : 0; $cacheContent['sigPercent'] = ($cacheContent['members']['count'] and $cacheContent['cachedSigs']['count']) ? sprintf("%.0f", $cacheContent['cachedSigs']['count'] / $cacheContent['members']['count'] * 100) : 0; } $this->registry->output->html .= $this->html->cache_entry_wrapper($lib_caches, $total, $cacheContent); }
/** * Main display form to upload new images, etc * * @param array Current Images * @param array Form data * @param array Warnings * @return string HTML */ public function overview($currentImages, $defaultImages, $imagePath = '', $imgErrors, $canImport) { $IPBHTML = ""; //--starthtml--// $information = sprintf($this->lang->words['mi_information'], $imagePath); $IPBHTML .= <<<EOF <script type="text/javascript" src="{$this->settings['js_app_url']}acp.mobileimages.js"></script> <script type='text/javascript'> \tipb.templates['import_xml'] = new Template("<div class='acp-box'><h3 class='ipsBlock_title'>{$this->lang->words['mi_import_title']}</h3><form action='{$this->settings['base_url']}{$this->form_code}do=importXml' method='post' enctype='multipart/form-data'><table class='ipsTable double_pad'><tr><td class='field_title'><strong class='title'>{$this->lang->words['mi_select_xml']}</strong></td><td class='field_field'><input type='file' name='FILE_UPLOAD' /></td></tr></table><div class='acp-actionbar'><input type='submit' value='{$this->lang->words['mi_upload']}' class='button primary' /></div></form></div>"); </script> <style type="text/css"> .ios_image { max-height: 40px; width auto; } </style> <div class='section_title'> \t<h2>{$this->lang->words['mi_title']}</h2> \t<div class='section_info'> \t\t{$information} \t</div> \t<div class='ipsActionBar clearfix'> \t<ul> \t\t<li class='ipsActionButton'> \t\t\t<a href='{$this->settings['base_url']}{$this->form_code}do=refresh'><img src='{$this->settings['skin_acp_url']}/images/icons/arrow_refresh.png' alt='' /> {$this->lang->words['mi_recache']}</a> \t\t</li> EOF; if ($canImport) { $IPBHTML .= <<<EOF \t\t<li class='ipsActionButton' id='importXml'> \t\t\t<a href='javascript:void(0);'><img src='{$this->settings['skin_acp_url']}/images/icons/add.png' alt='' /> {$this->lang->words['mi_import_title']}</a> \t\t</li> EOF; } else { $IPBHTML .= <<<EOF \t\t<li class='ipsActionButton'> \t\t\t<a href='javascript:void(0);'>{$this->lang->words['mi_cant_import']}</a> \t\t</li> EOF; } $IPBHTML .= <<<EOF \t\t<li class='ipsActionButton right'> \t\t\t<a href='{$this->settings['base_url']}{$this->form_code}do=exportXml'><img src='{$this->settings['skin_acp_url']}/images/icons/cog.png' /> {$this->lang->words['mi_exportxml']}</a> \t\t</li> \t</ul> \t</div> </div> <div class='acp-box'> \t<h3>{$this->lang->words['mi_current_title']}</h3> \t<table class="ipsTable"> \t\t<tr> \t\t\t<th width='1%'> </td> \t\t\t<th width='35%'>{$this->lang->words['mi_tt_filename']}</th> \t\t\t<th width='40%'>{$this->lang->words['mi_tt_modified']}</th> \t\t\t<th width='10%'>{$this->lang->words['mi_tt_size']}</th> \t\t</tr> EOF; foreach ($currentImages as $image) { $modified = $this->registry->class_localization->getDate($image['mtime'], 'long'); $size = IPSLib::sizeFormat($image['size']); $errors = array(); $errorBox = ''; if ($imgErrors['writeable'] !== false && in_array($image['filename'], $imgErrors['writeable'])) { $errors[] = $this->lang->words['mi_img_not_writable']; } if ($imgErrors['dimensions'] !== false && in_array($image['filename'], $imgErrors['dimensions'])) { foreach ($defaultImages as $def) { if ($image['filename'] == $def['filename']) { $rDims = $def['dimensions'][0] . ' x ' . $def['dimensions'][1]; break; } } $errors[] = sprintf($this->lang->words['mi_img_not_dims'], $rDims); } if (count($errors)) { $errorBox = "<div class='warning'>" . implode("<br />\n", $errors) . "</div>"; } $IPBHTML .= <<<EOF \t\t<tr class='ipsControlRow'> \t\t <td><img src="{$image['imgsrc']}" class='ios_image' /></td> \t\t <td>{$image['filename']}<p class='desctext'>{$image['dimensions'][0]}px x {$image['dimensions'][1]}px</p>{$errorBox}</td> \t\t <td>{$modified}</td> \t\t <td>{$size}</td> \t\t</tr> EOF; } $IPBHTML .= <<<EOF \t</table> </div> EOF; //--endhtml--// return $IPBHTML; }
/** * Show the attachments form * * @author Matt Mecham * @return string Processed HTML */ public function showFormAttachments() { //----------------------------------------- // INIT //----------------------------------------- $info = array(); $start = intval($this->request['st']); $perpage = 15; $sort_key = ""; $attachments = array(); $this->hide_form_and_save_button = 1; //----------------------------------------- // Sort it //----------------------------------------- switch ($this->request['sort']) { case 'date': $sort_key = 'a.attach_date ASC'; $info['date_order'] = 'rdate'; $info['size_order'] = 'size'; break; case 'rdate': $sort_key = 'a.attach_date DESC'; $info['date_order'] = 'date'; $info['size_order'] = 'size'; break; case 'size': $sort_key = 'a.attach_filesize DESC'; $info['date_order'] = 'date'; $info['size_order'] = 'rsize'; break; case 'rsize': $sort_key = 'a.attach_filesize ASC'; $info['date_order'] = 'date'; $info['size_order'] = 'size'; break; default: $sort_key = 'a.attach_date DESC'; $info['date_order'] = 'date'; $info['size_order'] = 'size'; break; } //----------------------------------------- // Get some stats... //----------------------------------------- $maxspace = intval($this->memberData['g_attach_max']); if ($this->memberData['g_attach_max'] == -1) { $this->registry->getClass('output')->showError('no_permission_to_attach', 1010); } //----------------------------------------- // Limit by forums //----------------------------------------- $stats = $this->DB->buildAndFetch(array('select' => 'count(*) as count, ' . $this->DB->buildCoalesce(array('sum(attach_filesize)', 0)) . ' as sum', 'from' => 'attachments', 'where' => 'attach_member_id=' . $this->memberData['member_id'] . " AND attach_rel_module IN( 'post', 'msg' )")); if ($maxspace > 0) { //----------------------------------------- // Figure out percentage used //----------------------------------------- $info['has_limit'] = 1; $info['full_percent'] = $stats['sum'] ? sprintf("%.0f", $stats['sum'] / ($maxspace * 1024) * 100) : 0; if ($info['full_percent'] > 100) { $info['full_percent'] = 100; } else { if ($info['full_percent'] < 1 and $stats['count'] > 0) { $info['full_percent'] = 1; } } $info['attach_space_count'] = sprintf($this->lang->words['attach_space_count'], intval($stats['count']), intval($info['full_percent'])); $info['attach_space_used'] = sprintf($this->lang->words['attach_space_used'], IPSLib::sizeFormat($stats['sum']), IPSLib::sizeFormat($maxspace * 1024)); } else { $info['has_limit'] = 0; $info['attach_space_used'] = sprintf($this->lang->words['attach_space_unl'], IPSLib::sizeFormat($stats['sum'])); } //----------------------------------------- // Pages //----------------------------------------- $pages = $this->registry->getClass('output')->generatePagination(array('totalItems' => $stats['count'], 'itemsPerPage' => $perpage, 'currentStartValue' => $start, 'baseUrl' => "app=core&module=usercp&tab=core&area=attachments&sort=" . $this->request['sort'] . "")); //----------------------------------------- // Get attachments... //----------------------------------------- if ($stats['count']) { $this->DB->build(array('select' => 'a.*', 'from' => array('attachments' => 'a'), 'where' => "a.attach_member_id=" . $this->memberData['member_id'] . " AND a.attach_rel_module IN( 'post', 'msg' )", 'order' => $sort_key, 'limit' => array($start, $perpage), 'add_join' => array(array('select' => 'p.topic_id', 'from' => array('posts' => 'p'), 'where' => 'p.pid=a.attach_rel_id', 'type' => 'left'), array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left')))); $outer = $this->DB->execute(); $this->registry->getClass('class_localization')->loadLanguageFile(array('public_topic'), 'forums'); $cache = $this->cache->getCache('attachtypes'); /* Load topic class */ if (!$this->registry->isClassLoaded('topics')) { $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums'); $this->registry->setClass('topics', new $classToLoad($this->registry)); } while ($row = $this->DB->fetch($outer)) { $row['_link'] = true; if (!$this->registry->topics->canView($row)) { $row['title'] = $this->lang->words['attach_topicmoved']; $row['_link'] = false; } //----------------------------------------- // Full attachment thingy //----------------------------------------- if ($row['attach_rel_module'] == 'post') { $row['_type'] = 'post'; } else { if ($row['attach_rel_module'] == 'msg') { $row['_type'] = 'msg'; $row['title'] = $this->lang->words['attach_inpm']; } } /* IPB 2.x conversion */ $row['image'] = str_replace('folder_mime_types', 'mime_types', $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']); $attachments[] = $row; } } return $this->registry->getClass('output')->getTemplate('ucp')->coreAttachments($info, $pages, $attachments); }
/** * Shows attachment statistics * * @return @e void */ public function attachmentStatsOverview() { /* Get attachment Types */ $cache['attachtypes'] = array(); $this->DB->build(array('select' => 'atype_extension,atype_mimetype,atype_post,atype_img', 'from' => 'attachments_type', 'where' => "atype_post=1")); $this->DB->execute(); while ($r = $this->DB->fetch()) { $cache['attachtypes'][$r['atype_extension']] = $r; } $stats = $this->DB->buildAndFetch(array('select' => 'count(*) as count, sum(attach_filesize) as sum', 'from' => 'attachments', 'where' => 'attach_rel_module=\'post\'')); /* Overall Stats */ $overall_stats = array('total_attachments' => $this->registry->class_localization->formatNumber($stats['count']), 'total_size' => IPSLib::sizeFormat($stats['sum'])); /* Last 5 Attachments */ $this->DB->build(array('select' => 'a.*', 'from' => array('attachments' => 'a'), 'where' => "attach_rel_module='post'", 'order' => "a.attach_date DESC", 'limit' => array(0, 5), 'add_join' => array(array('select' => 'p.author_id, p.author_name, p.post_date', 'from' => array('posts' => 'p'), 'where' => 'p.pid=a.attach_rel_id', 'type' => 'left'), array('select' => 't.tid, t.forum_id, t.title', 'from' => array('topics' => 't'), 'where' => 'p.topic_id=t.tid', 'type' => 'left'), array('select' => 'm.members_display_name', 'from' => array('members' => 'm'), 'where' => 'm.member_id=a.attach_member_id', 'type' => 'left')))); $this->DB->execute(); /* Loop through the last 5 */ $last_5 = array(); while ($r = $this->DB->fetch()) { /* Format Fields */ $r['stitle'] = $r['title'] ? "<a href='{$this->settings['board_url']}/index.php?showtopic={$r['tid']}&view=findpost&p={$r['attach_rel_id']}' title='{$r['title']}'>" . IPSText::truncate($r['title'], 30) . "</a>" : $this->lang->words['attach_not_topic']; $r['_icon'] = $this->settings['mime_img'] . '/' . $cache['attachtypes'][$r['attach_ext']]['atype_img']; $r['attach_filesize'] = IPSLib::sizeFormat($r['attach_filesize']); $r['post_date'] = $this->registry->class_localization->getDate($r['attach_date'], 'SHORT', 1); /* Add to output array */ $last_5[] = $r; } /* Largest 5 Attachments */ $this->DB->build(array('select' => 'a.*', 'from' => array('attachments' => 'a'), 'where' => "attach_rel_module='post'", 'order' => "a.attach_filesize DESC", 'limit' => array(0, 5), 'add_join' => array(array('select' => 'p.author_id, p.author_name, p.post_date', 'from' => array('posts' => 'p'), 'where' => 'p.pid=a.attach_rel_id', 'type' => 'left'), array('select' => 't.tid, t.forum_id, t.title', 'from' => array('topics' => 't'), 'where' => 'p.topic_id=t.tid', 'type' => 'left'), array('select' => 'm.members_display_name', 'from' => array('members' => 'm'), 'where' => 'm.member_id=a.attach_member_id', 'type' => 'left')))); $this->DB->execute(); /* Loop through the last 5 */ $largest_5 = array(); while ($r = $this->DB->fetch()) { /* Format Fields */ $r['stitle'] = $r['title'] ? "<a href='{$this->settings['board_url']}/index.php?showtopic={$r['tid']}&view=findpost&p={$r['attach_rel_id']}' title='{$r['title']}'>" . IPSText::truncate($r['title'], 30) . "</a>" : $this->lang->words['attach_not_topic']; $r['_icon'] = $this->settings['mime_img'] . '/' . $cache['attachtypes'][$r['attach_ext']]['atype_img']; $r['attach_filesize'] = IPSLib::sizeFormat($r['attach_filesize']); $r['post_date'] = $this->registry->class_localization->getDate($r['attach_date'], 'SHORT', 1); /* Add to output array */ $largest_5[] = $r; } /* 5 Most Viewed Downloads */ $this->DB->build(array('select' => 'a.*', 'from' => array('attachments' => 'a'), 'where' => "attach_rel_module='post'", 'order' => "a.attach_hits DESC", 'limit' => array(0, 5), 'add_join' => array(array('select' => 'p.author_id, p.author_name, p.post_date', 'from' => array('posts' => 'p'), 'where' => 'p.pid=a.attach_rel_id', 'type' => 'left'), array('select' => 't.tid, t.forum_id, t.title', 'from' => array('topics' => 't'), 'where' => 'p.topic_id=t.tid', 'type' => 'left'), array('select' => 'm.members_display_name', 'from' => array('members' => 'm'), 'where' => 'm.member_id=a.attach_member_id', 'type' => 'left')))); $this->DB->execute(); /* Loop through the last 5 */ $most_viewed_5 = array(); while ($r = $this->DB->fetch()) { /* Format Fields */ $r['stitle'] = $r['title'] ? "<a href='{$this->settings['board_url']}/index.php?showtopic={$r['tid']}&view=findpost&p={$r['attach_rel_id']}' title='{$r['title']}'>" . IPSText::truncate($r['title'], 30) . "</a>" : $this->lang->words['attach_not_topic']; $r['_icon'] = $this->settings['mime_img'] . '/' . $cache['attachtypes'][$r['attach_ext']]['atype_img']; $r['attach_filesize'] = IPSLib::sizeFormat($r['attach_filesize']); $r['post_date'] = $this->registry->class_localization->getDate($r['attach_date'], 'SHORT', 1); /* Add to output array */ $most_viewed_5[] = $r; } /* Output */ $this->registry->output->html .= $this->html->attachmentStats($overall_stats, $last_5, $largest_5, $most_viewed_5); }
/** * Show the main screen * * @access public * @param string Current path * @param array Folders in the path * @param array Files in the path * @return string HTML */ public function overview($path, array $folders, array $files) { $IPBHTML = ""; //--starthtml--// $urlencodePath = urlencode($path); $IPBHTML .= <<<HTML <div class='section_title'> \t<h2>{$this->lang->words['media_manager']}</h2> \t<ul class='context_menu'> \t\t<li> \t\t\t<a href='{$this->settings['base_url']}&module=media&section=manage&do=newDir&in={$urlencodePath}' title='{$this->lang->words['add_folder_alt']}'> \t\t\t\t<img src='{$this->settings['skin_acp_url']}/_newimages/icons/folder_add.png' alt='{$this->lang->words['icon']}' /> \t\t\t\t{$this->lang->words['add_folder_alt']} \t\t\t</a> \t\t</li> \t\t<li> \t\t\t<a href='#' id='uploadTrigger'> \t\t\t\t<img src='{$this->settings['skin_acp_url']}/_newimages/icons/add.png' alt='{$this->lang->words['icon']}' /> \t\t\t\t{$this->lang->words['media_upload_file']} \t\t\t</a> \t\t</li> \t</ul> </div> <div id="uploadForm"> \t<form action='{$this->settings['base_url']}&module=media&section=manage&do=upload&in={$urlencodePath}' method='post' enctype="multipart/form-data"> \t<div class="acp-box"> \t\t<h3>{$this->lang->words['upload_file_h3']}</h3> \t\t<ul class="acp-form alternate_rows"> \t\t<ul class="acp-form alternate_rows"> \t\t\t<li> \t\t\t\t<label>{$this->lang->words['select_to_upload']}</label> \t\t\t\t<input name="FILE_UPLOAD" type="file" /> \t\t\t\t<span class='desctext' style='float:right;'>{$this->lang->words['media_allowed_files']}</span> \t\t\t</li> \t\t<ul> \t\t \t\t<div class="acp-actionbar"> \t\t\t<div class="centeraction"> \t\t\t\t<input value="{$this->lang->words['upload__button']}" class="button primary" type="submit" /> \t\t\t</div> \t\t</div> \t</div> \t</form> </div> <script type='text/javascript' src='{$this->settings['js_app_url']}acp.ccs.js'></script> <script type='text/javascript'> function confirmsubmit() { \tvar isOk = false; \t \t\$\$('#multi-action option').each( function( elem ) { \t\tDebug.write( "Found option: " + elem.value ); \t\t \t\tif( elem.selected && elem.value == 'delete' ) \t\t{ \t\t\tif( confirm( "{$this->lang->words['multi_submit_confirm']}" ) ) \t\t\t{ \t\t\t\tisOk\t= true; \t\t\t} \t\t} \t\t \t\tif( elem.selected && elem.value != 'delete' ) \t\t{ \t\t\tisOk\t= true; \t\t} \t}); \t \treturn isOk; } </script> <div class='acp-box'> \t<h3>{$this->lang->words['viewing_h_prefix']} {$path}</h3> \t<form action='{$this->settings['base_url']}&module=media&section=manage&do=multi' method='post'> \t<input type='hidden' name='return' value='{$urlencodePath}' /> \t<table width='100%' cellpadding='0' cellspacing='0' class='alternate_rows double_pad'> \t\t<tr> \t\t\t<th style='width: 2%'> </th> \t\t\t<th style='width: 46%'>{$this->lang->words['row_name']}</th> \t\t\t<th style='width: 30%'>{$this->lang->words['row_modified']}</th> \t\t\t<th style='width: 20%'>{$this->lang->words['row_size']}</th> \t\t\t<th style='width: 2%'> </th> \t\t</tr> HTML; if (!count($folders) && !count($files)) { $IPBHTML .= <<<HTML \t\t<tr> \t\t\t<td colspan='5'> \t\t\t\t<div style='padding: 20px; text-align: center'> \t\t\t\t\t<em>{$this->lang->words['no_media_uploaded']}</em> \t\t\t\t</div> \t\t\t</td> \t\t</tr> HTML; } else { foreach ($folders as $object) { $path = urlencode($object['full_path']); $mtime = $this->registry->getClass('class_localization')->getDate($object['last_modified'], 'SHORT', 1); $id = md5($path); $size = IPSLib::sizeFormat($object['size']); $name = $object['name'] != '..' ? "<a href='{$this->settings['base_url']}&module=media&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']}' />"; $IPBHTML .= <<<HTML \t\t<tr>\t\t\t HTML; if ($object['name'] != '..') { $IPBHTML .= <<<HTML \t\t\t<td><input type='checkbox' name='folders[]' value='{$path}' /></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'>{$size}</span> \t\t\t</td> \t\t\t<td> \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=media&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=media&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=media&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=media&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</td> HTML; } else { $IPBHTML .= <<<HTML \t\t\t<td> </td> \t\t\t<td colspan='4'>{$name} <strong><a href='{$this->settings['base_url']}{$this->form_code}&do=viewdir&dir={$path}'>{$object['name']}</a></strong></td> HTML; } $IPBHTML .= <<<HTML \t\t</tr> HTML; } foreach ($files as $object) { $path = urlencode($object['full_path']); $icon = $object['icon'] ? $object['icon'] : 'file.png'; $size = IPSLib::sizeFormat($object['size']); $mtime = $this->registry->getClass('class_localization')->getDate($object['last_modified'], 'SHORT', 1); $id = md5($path); $url = CCS_MEDIA_URL . str_replace(CCS_MEDIA, '', $object['full_path']); $IPBHTML .= <<<HTML \t\t<tr> \t\t\t<td><input type='checkbox' name='pages[]' value='{$path}' /></td> \t\t\t<td> \t\t\t\t<a href='{$url}'><img src='{$this->settings['skin_acp_url']}/_newimages/ccs/{$icon}' alt='{$this->lang->words['file_alt']}' /></a> \t\t\t\t<strong><a href='{$url}' target='_blank'>{$object['name']}</a></strong> \t\t\t</td> \t\t\t<td> \t\t\t\t<span class='desctext'>{$mtime}</span> \t\t\t</td> \t\t\t<td> \t\t\t\t<span class='desctext'>{$size}</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['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 delete'><a href='#' onclick="return acp.confirmDelete( '{$this->settings['base_url']}&module=media&section=manage&do=delete&file={$path}' );">{$this->lang->words['media_delete_link']}</a></li> \t\t\t\t\t\t<li class='icon export'><a href='{$this->settings['base_url']}&module=media&section=manage&do=multi&action=move&pages[]={$path}'>{$this->lang->words['media_move_link']}</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; }
/** * Swaps the HTML for the nice attachments. * * @param array Array of matches from preg_replace_callback * @return string HTML */ protected function _parseThumbnailInline($matches) { //----------------------------------------- // INIT //----------------------------------------- $row = $this->_current['row']; $skin_name = $this->_current['skin_name']; //----------------------------------------- // Generate random ID //----------------------------------------- $row['_attach_id'] = $row['attach_id'] . '-' . str_replace(array('.', ' '), "-", microtime()); //----------------------------------------- // Build HTML //----------------------------------------- $tmp = $this->registry->getClass('output')->getTemplate($skin_name)->Show_attachments_img_thumb(array('t_location' => $row['attach_thumb_location'], 't_width' => $row['attach_thumb_width'], 't_height' => $row['attach_thumb_height'], 'o_width' => $row['attach_img_width'], 'o_height' => $row['attach_img_height'], 'attach_id' => $row['attach_id'], '_attach_id' => $row['_attach_id'], 'file_size' => IPSLib::sizeFormat($row['attach_filesize']), 'attach_hits' => $row['attach_hits'], 'location' => $row['attach_file'], 'type' => $this->_current['type'])); return $tmp; }
/** * Attachment search results * * @return @e void [Outputs to screen] */ protected function _searchResults() { $show = intval($this->request['show']); $show = $show > 100 ? 100 : $show; //----------------------------------------- // Build URL //----------------------------------------- $url = ""; $url_components = array('extension', 'filesize', 'filesize_gt', 'days', 'days_gt', 'hits', 'hits_gt', 'filename', 'authorname', 'onlyimage', 'orderby', 'sort', 'show'); foreach ($url_components as $u) { $url .= $u . '=' . $this->request[$u] . '&'; } //----------------------------------------- // Build Query //----------------------------------------- $queryfinal = ""; $query = array(); if ($this->request['extension']) { $query[] = 'a.attach_ext="' . strtolower(str_replace(".", "", $this->request['extension'])) . '"'; } if ($this->request['filesize']) { $gt = $this->request['filesize_gt'] == 'gt' ? '>=' : '<'; $query[] = "a.attach_filesize {$gt} " . intval($this->request['filesize'] * 1024); } if ($this->request['days']) { $day_break = time() - intval($this->request['days'] * 86400); $gt = $this->request['days_gt'] == 'lt' ? '>=' : '<'; $query[] = "a.attach_date {$gt} {$day_break}"; } if ($this->request['hits']) { $gt = $this->request['hits_gt'] == 'gt' ? '>=' : '<'; $query[] = "a.attach_hits {$gt} " . intval($this->request['hits']); } if ($this->request['filename']) { $query[] = $this->DB->buildLower('a.attach_file') . ' LIKE "%' . strtolower($this->request['filename']) . '%"'; } if ($this->request['authorname']) { $query[] = $this->DB->buildLower('p.author_name') . ' LIKE "%' . strtolower($this->request['authorname']) . '%"'; } if ($this->request['onlyimage']) { $query[] = 'a.attach_is_image=1'; } if (count($query)) { $queryfinal = 'AND ' . implode(" AND ", $query); } $rows = array(); $this->DB->build(array('select' => 'a.*', 'from' => array('attachments' => 'a'), 'where' => "attach_rel_module='post'" . $queryfinal, 'add_join' => array(0 => array('select' => 'p.author_id, p.author_name, p.post_date', 'from' => array('posts' => 'p'), 'where' => 'p.pid=a.attach_rel_id', 'type' => 'left'), 1 => array('select' => 't.tid, t.forum_id, t.title', 'from' => array('topics' => 't'), 'where' => 'p.topic_id=t.tid', 'type' => 'left'), 2 => array('select' => 'm.members_display_name', 'from' => array('members' => 'm'), 'where' => 'm.member_id=a.attach_member_id', 'type' => 'left')), 'order' => "a.attach_" . $this->request['orderby'] . " " . $this->request['sort'], 'limit' => array(0, $show))); $this->DB->execute(); while ($r = $this->DB->fetch()) { $r['stitle'] = $r['title'] ? "<a href='{$this->settings['board_url']}/index.php?showtopic={$r['tid']}&view=findpost&p={$r['attach_rel_id']}' title='{$r['title']}'>" . IPSText::truncate($r['title'], 30) . "</a>" : $this->lang->words['attach_not_topic']; $r['attach_filesize'] = IPSLib::sizeFormat($r['attach_filesize']); $r['attach_date'] = ipsRegistry::getClass('class_localization')->getDate($r['attach_date'], 'SHORT', 1); $rows[] = $r; } $this->registry->output->html .= $this->html->attachmentSearchResults($url, $rows); }
/** * Returns debug data * * @access protected * @return string Debug HTML */ public function html_showDebugInfo() { $input = ""; $queries = ""; $sload = ""; $stats = ""; //----------------------------------------- // Form & Get & Skin //----------------------------------------- if ($this->settings['debug_level'] >= 2) { $stats .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>IPSDebug сообщения</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 кеши</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) . ") подключенных файлов</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'>Загруженных кешей</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>ИТОГО: " . IPSLib::sizeFormat($_total) . "</strong></div>\n</div>"; /* Loaded classes */ $loadedClasses = $this->registry->getLoadedClassesAsArray(); $stats .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>Загруженные классы через 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 и GET данные</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>Следующая задача</b> = " . $this->registry->getClass('class_localization')->getDate($cache['task_next_run'], 'LONG') . "\n<br /><b>Время</b> = " . $this->registry->getClass('class_localization')->getDate(time(), 'LONG'); $stats .= "<br /><b>Сейчас</b> = " . time(); $stats .= "<p>Пользователь: last_visit: " . $this->memberData['last_visit'] . " / " . $this->registry->getClass('class_localization')->getDate($this->memberData['last_visit'], 'LONG') . "</p>"; $stats .= "<p>Пользователь: uagent_key: " . $this->memberData['userAgentKey'] . "</p>"; $stats .= "<p>Пользователь: uagent_type: " . $this->memberData['userAgentType'] . "</p>"; $stats .= "<p>Пользователь: uagent_version: " . $this->memberData['userAgentVersion'] . "</p>"; $stats .= "</div>\n</div>"; $stats .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>Загруженные PHP шаблоны</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 //----------------------------------------- if ($this->settings['debug_level'] >= 3) { $stats .= "<br />\n<div class='tableborder' style='overflow:auto'>\n<div class='subtitle'>Запросы</div><div class='row1' style='padding:6px'>"; foreach ($this->DB->obj['cached_queries'] as $q) { $q = htmlspecialchars($q); $q = str_ireplace("SELECT", "<span style='color:red'>SELECT</span>", $q); $q = preg_replace("/^UPDATE/i", "<span style='color:blue'>UPDATE</span>", $q); $q = preg_replace("/^DELETE/i", "<span style='color:orange'>DELETE</span>", $q); $q = preg_replace("/^INSERT/i", "<span style='color:green'>INSERT</span>", $q); $q = str_replace("LEFT JOIN", "<span style='color:red'>LEFT JOIN</span>", $q); $stats .= "<p style='padding:6px;border-bottom:1px solid black'>{$q}</p>\n"; } if (count($this->DB->obj['shutdown_queries'])) { foreach ($this->DB->obj['shutdown_queries'] as $q) { $q = htmlspecialchars($q); $q = preg_replace("/^SELECT/i", "<span style='color:red'>SELECT</span>", $q); $q = preg_replace("/^UPDATE/i", "<span style='color:blue'>UPDATE</span>", $q); $q = preg_replace("/^DELETE/i", "<span style='color:orange'>DELETE</span>", $q); $q = preg_replace("/^INSERT/i", "<span style='color:green'>INSERT</span>", $q); $q = str_replace("LEFT JOIN", "<span style='color:red'>LEFT JOIN</span>", $q); //$q = preg_replace( "/(".$this->settings['sql_tbl_prefix'].")(\S+?)([\s\.,]|$)/", "<span class='purple'>\\1\\2</span>\\3", $q ); $stats .= "<div style='background:#DEDEDE'><b>SHUTDOWN:</b> {$q}</div><br />\n"; } } $stats .= "</div>\n</div>"; } //----------------------------------------- // Memory usage //----------------------------------------- if (IPS_MEMORY_DEBUG_MODE and defined('IPS_MEMORY_START') and $this->memberData['g_access_cp']) { if (is_array(IPSDebug::$memory_debug)) { $memory .= "<br />\n<div class='tableborder'>\n<div class='subtitle'>MEMORY USAGE</div><div class='row1' 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>"; } $end = memory_get_usage(); $peak_end = function_exists('memory_get_peak_usage') ? memory_get_peak_usage() : memory_get_usage(); $_used = $end - IPS_MEMORY_START; $peak_used = $peak_end - IPS_MEMORY_START; $stats .= $memory; $stats .= "Total Memory Used: " . IPSLib::sizeFormat($_used) . " (Peak:" . IPSLib::sizeFormat($peak_used) . ")"; } if ($stats) { $stats = "\n\t\t\t\t\t <div align='center' style='width:92%; margin:120px auto 20px auto; overflow:auto;'>\n\t\t\t\t\t <div class='tableborder' align='left'>\n\t\t\t\t\t\t<div class='maintitle'>Debug Information (<a href='#' onclick=\"\$('debug').toggle(); return false;\">Toggle Debug Information</a>)</div>\n\t\t\t\t\t\t <div style='padding:5px;background:#8394B2;' id='debug'>{$stats}</div>\n\t\t\t\t\t </div>\n\t\t\t\t\t </div>"; } return $stats; }
/** * Fetch Templates from the tree * * @access public * @param mixed Skin key or 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'); * # To return all master templates for the mobile skin * $templates = $skinFunctions->fetchTemplates( 'mobile', 'allTemplates' ); * </code> */ public function fetchTemplates($setID, $type = 'allTemplates', $group = '') { //----------------------------------------- // INIT //----------------------------------------- $templates = array(); $where = ''; /* Did we pass a master key? - all root skins are 0 */ if (!is_numeric($setID)) { $skinSetData = array('set_id' => 0, 'set_master_key' => $setID, 'set_key' => $setID, '_isMaster' => 1, '_parentTree' => array(), '_childTree' => array(), '_userAgents' => array(), '_cssGroupsArray' => array()); } else { $skinSetData = $this->fetchSkinData($setID); $skinSetData['_isMaster'] = $skinSetData['_isMaster'] ? $skinSetData['_isMaster'] : 0; } /* Did we get a skin set? */ if (!isset($skinSetData['_parentTree']) or !is_array($skinSetData['_parentTree'])) { return array(); } //----------------------------------------- // Push root ID onto the END of the parent array //----------------------------------------- array_push($skinSetData['_parentTree'], 0); //----------------------------------------- // Push the current skin set ID onto the beginnging //----------------------------------------- if (is_numeric($setID)) { array_unshift($skinSetData['_parentTree'], $setID); } /* We want to capture only this set's master bits */ $where = ' AND ( ( template_set_id > 0 AND ( template_master_key=\'\' OR template_master_key IS NULL ) ) OR ( template_set_id=0 AND template_master_key=\'' . $skinSetData['set_master_key'] . '\' ) )'; /* First off, load 'root' skin as we tend to develop this the most and there is always a small chance other master skins won't contain all the template bits. We'll just load the group / name and leave the content blank to prevent parse errors, etc */ if ($setID != 'root') { if (($type == 'groupTemplates' or $type == 'groupTemplatesNoContent') and $group != '') { $_w = " AND template_group='{$group}'"; } $this->DB->build(array('select' => '*', 'from' => 'skin_templates', 'where' => "template_master_key='root'" . $_w, 'order' => 'template_group')); $this->DB->execute(); while ($r = $this->DB->fetch()) { $r['template_content'] = '<!--no data in this master skin-->'; 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; } } } } //----------------------------------------- // 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']) . " )" . $where, '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}'" . $where, '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']) . ")" . $where, '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); foreach ($templates as $k => $v) { if (is_array($v)) { ksort($templates[$k]); } } return $templates; }
/** * Check if SQL debug is on, if so add the SQL debug data * * @access protected * @return void * @since 2.0 */ protected function _checkSQLDebug() { if ($this->DB->obj['debug']) { flush(); print "<html><head><title>SQL Debugger</title><body bgcolor='white'><style type='text/css'> TABLE, TD, TR, BODY { font-family: verdana,arial, sans-serif;color:black;font-size:11px }</style>"; print "<h1 align='center'>SQL Total Time: {$this->DB->sql_time} for {$this->DB->query_count} queries</h1><br />" . $this->DB->debug_html; print "<br /><div align='center'><strong>Total SQL Time: {$this->DB->sql_time}</div></body></html>"; print "<br />SQL Fetch Total Memory: " . IPSLib::sizeFormat($this->DB->_tmpT, TRUE); $this->outputFormatClass->finishUp(); exit; } }
/** * Post multi-mod: Merge posts * * @access private * @return void [Outputs to screen] */ private function _multiMergePost() { $this->_resetModerator($this->topic['forum_id']); $this->_genericPermissionCheck('delete_post'); 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 .= "<br /><br />" . $p['post']; $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 //----------------------------------------- if (IPSText::getTextClass('editor')->method == 'rte') { IPSText::getTextClass('bbcode')->parse_wordwrap = 0; IPSText::getTextClass('bbcode')->parse_html = 0; $master_post = IPSText::getTextClass('bbcode')->convertForRTE(trim($master_post)); } else { IPSText::getTextClass('bbcode')->parse_html = 0; IPSText::getTextClass('bbcode')->parse_nl2br = 0; IPSText::getTextClass('bbcode')->parse_smilies = 1; IPSText::getTextClass('bbcode')->parse_bbcode = 1; IPSText::getTextClass('bbcode')->parsing_section = 'topics'; if (IPSText::getTextClass('bbcode')->parse_html) { if (!IPSText::getTextClass('bbcode')->parse_nl2br) { $master_post = str_replace(array('<br />', '<br>'), "", trim($master_post)); } } $master_post = IPSText::getTextClass('bbcode')->preEditParse($master_post); } $editor = IPSText::getTextClass('editor')->showEditor($master_post, 'Post'); $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'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}"); } $this->registry->getClass('output')->addNavigation($this->lang->words['cm_title'], ''); $this->registry->getClass('output')->setTitle($this->lang->words['cm_title']); $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 (!$this->request['selectedpids'] or !$this->request['postdate'] or !$this->request['postauthor'] or !$this->request['Post']) { $this->_showError('mod_merge_posts', 10384); } 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 = IPSText::getTextClass('editor')->processRawPost('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; //----------------------------------------- // 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', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left')))); $outer = $this->DB->execute(); while ($p = $this->DB->fetch($outer)) { $posts[$p['pid']] = $p; $topics[$p['topic_id']] = $p['topic_id']; $forums[$p['forum_id']] = $p['forum_id']; if ($p['author_id'] == $this->request['postauthor']) { $author = array('id' => $p['author_id'], 'name' => $p['author_name']); } if ($p['pid'] != $this->request['postdate']) { $post_to_delete[] = $p['pid']; } if ($p['append_edit']) { $append_edit = 1; } } //----------------------------------------- // Update main post... //----------------------------------------- $this->DB->update('posts', array('author_id' => $author['id'], 'author_name' => $author['name'], 'post' => $post, 'post_key' => $new_post_key, 'post_parent' => 0, 'edit_time' => time(), 'edit_name' => $this->memberData['members_display_name'], 'append_edit' => ($append_edit or !$this->memberData['g_append_edit']) ? 1 : 0), 'pid=' . $this->request['postdate']); //----------------------------------------- // Fix attachments //----------------------------------------- $attach_keep = array(); $attach_kill = array(); foreach ($_POST as $key => $value) { if (preg_match("/^attach_(\\d+)\$/", $key, $match)) { if ($this->request[$match[0]] == 'keep') { $attach_keep[] = $match[1]; } else { $attach_kill[] = $match[1]; } } } $attach_keep = IPSLib::cleanIntArray($attach_keep); $attach_kill = IPSLib::cleanIntArray($attach_kill); //----------------------------------------- // Keep //----------------------------------------- if (count($attach_keep)) { $this->DB->update('attachments', array('attach_rel_id' => $this->request['postdate'], 'attach_post_key' => $new_post_key, 'attach_member_id' => $author['id']), 'attach_id IN(' . implode(",", $attach_keep) . ')'); } //----------------------------------------- // Kill Attachments //----------------------------------------- if (count($attach_kill)) { require_once IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php'; $class_attach = new class_attach($this->registry); $class_attach->type = $rel_module; $class_attach->attach_post_key = $post_key; $class_attach->attach_rel_id = $rel_id; $class_attach->init(); $class_attach->bulkRemoveAttachment($attach_kill, 'attach_id'); } //----------------------------------------- // Kill old posts //----------------------------------------- if (count($post_to_delete)) { $this->DB->delete('posts', 'pid IN(' . implode(",", $post_to_delete) . ')'); } foreach ($topics as $t) { $this->modLibrary->rebuildTopic($t, 0); } foreach ($forums as $f) { $this->modLibrary->forumRecount($f); } $this->modLibrary->statsRecount(); /* Clear the content cache */ IPSContentCache::drop('post', $this->pids); $this->_addModeratorLog(sprintf($this->lang->words['acp_merged_posts'], implode(", ", $this->pids))); } }