Guest User

Untitled

a guest
May 11th, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 77.50 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * <pre>
  5.  * Invision Power Services
  6.  * IP.Board vVERSION_NUMBER
  7.  * Admin CP global skin templates
  8.  * Last Updated: $Date: 2013-02-07 16:03:55 +0000 (Thu, 07 Feb 2013) $
  9.  * </pre>
  10.  *
  11.  * @author      $Author: mark $
  12.  * @copyright   (c) 2001 - 2009 Invision Power Services, Inc.
  13.  * @license     http://www.invisionpower.com/company/standards.php#license
  14.  * @package     IP.Board
  15.  * @link        http://www.invisionpower.com
  16.  * @version     $Rev: 11954 $
  17.  * @since       3.0.0
  18.  *
  19.  */
  20.  
  21. class cp_skin_global extends output
  22. {
  23.  
  24. /**
  25.  * Prevent our main destructor being called by this class
  26.  *
  27.  * @access  public
  28.  * @return  @e void
  29.  */
  30. public function __destruct()
  31. {
  32. }
  33.  
  34. /**
  35.  * Redirector page
  36.  *
  37.  * @param   string  $url    URL to send to
  38.  * @param   string  $text   Text to display
  39.  * @return  @e string
  40.  */
  41. public function temporaryRedirect( $url, $text, $time=2 )
  42. {
  43.  
  44. $time = floatval( $time ) * 1000;
  45.  
  46. $IPBHTML = "";
  47. //--starthtml--//
  48.  
  49. $url    = str_replace( '&amp;', '&', $url );
  50.  
  51. $IPBHTML .= <<<EOF
  52. <div class='information-box'>{$text}</div>
  53. <script type='text/javascript'>
  54. jQ(document).ready(function() {
  55.     setTimeout( "window.location = '{$url}';", {$time} );
  56. });
  57. </script>
  58. EOF;
  59.  
  60. //--endhtml--//
  61. return $IPBHTML;
  62. }
  63.  
  64. /**
  65.  * manageBookmarks
  66.  *
  67.  * @param   array   Bookmarks
  68.  * @return  @e string
  69.  */
  70. public function manageBookmarks( $bookmarks )
  71. {
  72.  
  73. $IPBHTML = "";
  74. //--starthtml--//
  75.  
  76. $IPBHTML .= <<<EOF
  77. <h3>{$this->lang->words['bookmarks_title']}</h3>
  78. <div class='ipsPad fixed_inner'>
  79. <div class='right desctext'>{$this->lang->words['bookmarks_make_home']}</div>
  80. <br />
  81. <ul id='sortable'>
  82. EOF;
  83.  
  84. foreach( $bookmarks as $id => $data )
  85. {
  86.     $url = IPSText::truncate( $data['bookmark_url'], 42 );
  87.     $sel = ( $data['bookmark_home'] ) ? ' checked="checked" ' : '';
  88.     $pos = intval( $data['bookmark_pos'] );
  89.    
  90.     $IPBHTML .= <<<EOF
  91.     <li data-rowid='{$id}' id='bookmark_{$id}'>
  92.         <span class="draghandle"></span>
  93.         <div class='right'>
  94.             <input type='checkbox' data-cboxid='{$id}' name='bookmarkHome[{$id}]' value='{$id}' {$sel}>
  95.             &nbsp; <img src="{$this->settings['skin_acp_url']}/images/aff_cross.png" data-deleteid="{$id}" class='clickable' />
  96.         </div>
  97.         <input type='text' class='input_text' size='60' data-inputname="{$id}" name='bookmarkName[{$id}]' value='{$data['bookmark_title']}' />
  98.         <span class='desctext'><a href="{$this->settings['_base_url']}&amp;{$data['bookmark_url']}" target="_blank">{$url}</a></span>
  99.     </li>
  100. EOF;
  101. }
  102.  
  103. $IPBHTML .= <<<EOF
  104. </ul>
  105. <div class='ipsPad'><input type='button' id='saveBookmarksManage' class='realbutton right' value='{$this->lang->words['bookmarks_save']}' /></div>
  106. </div>
  107. <script type="text/javascript">
  108. (function($){
  109.     $("#sortable").sortable();
  110. }(jQuery));
  111. </script>
  112. EOF;
  113.  
  114. //--endhtml--//
  115. return $IPBHTML;
  116. }
  117.  
  118. //===========================================================================
  119. // <ips:ips_editor:desc::trigger:>
  120. //===========================================================================
  121. function editor($formField='post', $content='', $options=array(), $autoSaveData=array() ) {
  122. $IPBHTML = "";
  123. //--starthtml--//
  124.  
  125. $options['type'] = ( $options['type'] ) ? $options['type'] : "''";
  126. $options['minimize']       = intval( $options['minimize'] );
  127. $options['smilies']        = IPSText::jsonEncodeForTemplate( is_array($options['smilies']) ? $options['smilies'] : array() );
  128. $options['noSmilies']      = intval( $options['noSmilies'] );
  129. $bbcode = IPSLib::fetchBbcodeAsJson();
  130.  
  131. $defaultSkin = $this->registry->output->_fetchSkinByDefault();
  132.  
  133. if ( ! $this->_editorJsLoaded )
  134. {
  135.     $this->_editorJsLoaded = true;
  136.    
  137.     if ( defined("CK_LOAD_SOURCE") AND CK_LOAD_SOURCE )
  138.     {
  139.         $IPBHTML .= <<<EOF
  140.         <script type="text/javascript" src="{$this->settings['public_dir']}js/3rd_party/ckeditor/ckeditor_source.js"></script>
  141. EOF;
  142.     }
  143.     else
  144.     {
  145.         $IPBHTML .= <<<EOF
  146.         <script type="text/javascript" src="{$this->settings['public_dir']}js/3rd_party/ckeditor/ckeditor.js"></script>
  147. EOF;
  148.     }
  149.    
  150.     $CmdVAsPlainText = ( $this->memberData['bw_paste_plain'] ) ? 'true' : 'false';
  151.    
  152.     $IPBHTML .= <<<EOF
  153. <script type="text/javascript" src='{$this->settings['cache_dir']}lang_cache/{$this->lang->lang_id}/ipb.lang.js' charset='{$this->settings['gb_char_set']}'></script>
  154. <script type="text/javascript" src="{$this->settings['public_dir']}js/ips.textEditor.js"></script>
  155. <script type="text/javascript" src="{$this->settings['public_dir']}js/ips.textEditor.bbcode.js"></script>
  156. <script type="text/javascript">
  157.     /* Dynamic items */
  158.     CKEDITOR.config.IPS_BBCODE          = {$bbcode};
  159.     CKEDITOR.config.IPS_BBCODE_IMG_URL  = "{$this->settings['public_dir']}style_extra/bbcode_icons";
  160.     CKEDITOR.config.IPS_BBCODE_BUTTONS  = [];
  161.    
  162.     /* Has to go before config load */
  163.     var IPS_smiley_path         = "{$this->settings['emoticons_url']}/";
  164.     var IPS_smiles              = {$options['smilies']};
  165.     var IPS_remove_plugins      = [];
  166.     var IPS_extra_plugins       = [];
  167.  
  168.     /* Load our configuration */
  169.     CKEDITOR.config.customConfig  = '{$this->settings['public_dir']}js/3rd_party/ckeditor/ips_config.js';
  170.    
  171.     /* Override with prefs */
  172.     CKEDITOR.config.CmdVAsPlainText = {$CmdVAsPlainText};
  173. </script>
  174. <style type="text/css">
  175. @import url("{$this->settings['css_base_url']}style_css/css_{$defaultSkin}/ipb_ckeditor.css");
  176. </style>
  177. EOF;
  178. }
  179.  
  180. $options['noSmilies'] = intval($options['noSmilies']);
  181. $options['isRte']     = intval($options['isRte']);
  182. $options['autoSaveKey'] = $options['autoSaveKey'] ? $options['autoSaveKey'] : '';
  183. $jsonEncoded = IPSText::jsonEncodeForTemplate( $autoSaveData );
  184.  
  185. $IPBHTML .= <<<EOF
  186. <input type='hidden' name='noSmilies' id='noSmilies_{$options['editorName']}' value='{$options['noSmilies']}' />
  187. <textarea id="{$options['editorName']}" name="{$formField}" class='ips_EditorTextArea'>{$content}</textarea>
  188. <a id="ips_switchEditor" style="display:none" href="javascript:void()">Switch to Rich Text Editor</a>
  189. <span id='editor_html_message_{$options['editorName']}'>&nbsp;</span>
  190. <script type="text/javascript">
  191.     ipb.textEditor.initialize('{$options['editorName']}', { type: '{$options['type']}',
  192.                                                             minimize: {$options['minimize']},
  193.                                                             bypassCKEditor: {$options['bypassCKEditor']},
  194.                                                             isRte: {$options['isRte']},
  195.                                                             noSmilies: {$options['noSmilies']},
  196.                                                             ips_AutoSaveKey: '{$options['autoSaveKey']}',
  197.                                                             ips_AutoSaveData: {$jsonEncoded} } );
  198. </script>
  199. EOF;
  200. //--endhtml--//
  201. return $IPBHTML;
  202. }
  203.  
  204. /**
  205.  * Editor template for ACP
  206.  *
  207.  * @access  public
  208.  * @param   string      From field name
  209.  * @param   string      Initial content for the editor
  210.  * @param   string      Path to the images
  211.  * @param   integer     Whether RTE is enabled (1) or not (0)
  212.  * @param   string      Editor id
  213.  * @param   string      Emoticon data
  214.  * @return  string      HTML
  215.  */
  216. public function ips_editor($form_field="",$initial_content="",$images_path="",$rte_mode=0,$editor_id='ed-0',$smilies='') {
  217.  
  218. $IPBHTML = "";
  219. //--starthtml--//
  220.  
  221. $this->settings['extraJsModules']   .= ",editor";
  222. $bbcodes                            = IPSLib::fetchBbcodeAsJson();
  223. $show_sidebar                       = IPSCookie::get('emoticon_sidebar');
  224. $show_sidebar_class                 = $show_sidebar && $this->settings['_remove_emoticons'] == 0 ? 'with_sidebar' : '';
  225. $show_sidebar_style                 = $show_sidebar && $this->settings['_remove_emoticons'] == 0 ? '' : "style='display:none'";
  226. $show_sidebar_link                  = $show_sidebar && $this->settings['_remove_emoticons'] == 0 ? 'true' : 'false';
  227.  
  228. $IPBHTML .= <<<EOF
  229.     <!--top-->
  230.     <input type='hidden' name='{$editor_id}_wysiwyg_used' id='{$editor_id}_wysiwyg_used' value='0' />
  231.     <input type='hidden' name='editor_ids[]' value='{$editor_id}' />
  232.     <div class='ips_editor {$show_sidebar_class}' id='editor_{$editor_id}'>
  233. EOF;
  234.     if( $this->settings['_remove_emoticons'] == 0 )
  235.     {
  236.         $IPBHTML .= <<<EOF
  237.         <div class='sidebar row1 altrow' id='{$editor_id}_sidebar' {$show_sidebar_style}>
  238.             <h4><img src='{$this->settings['img_url']}/close_popup.png' alt='{$this->lang->words['icon']}' id='{$editor_id}_close_sidebar' /><span>{$this->lang->words['emoticons_template_title']}</span></h4>
  239.             <div id='{$editor_id}_emoticon_holder' class='emoticon_holder'></div>
  240.             <div class='show_all_emoticons' id='{$editor_id}_showall_bar'>
  241.                 <input type='button' value='{$this->lang->words['show_all_emotes']}' id='{$editor_id}_showall_emoticons' class='input_submit emoticons' />
  242.             </div>
  243.         </div>
  244. EOF;
  245.     }
  246.    
  247.     $IPBHTML .= <<<EOF
  248.         <div id='{$editor_id}_controls' class='controls'>
  249.             <ul id='{$editor_id}_toolbar_1' class='toolbar' style='display: none'>
  250.                 <li class='left'>
  251.                     <span id='{$editor_id}_cmd_removeformat' class='rte_control rte_button' title='{$this->lang->words['js_tt_noformat']}'><img src='{$this->settings['img_url']}/rte_icons/remove_formatting.png' alt='{$this->lang->words['js_tt_noformat']}' /></span>
  252.                 </li>
  253.                 <li class='left'>
  254.                     <span id='{$editor_id}_cmd_togglesource' class='rte_control rte_button' title='{$this->lang->words['js_tt_htmlsource']}'><img src='{$this->settings['img_url']}/rte_icons/toggle_source.png' alt='{$this->lang->words['js_tt_htmlsource']}' /></span>
  255.                 </li>
  256.                 <li class='left'>
  257.                     <span id='{$editor_id}_cmd_otherstyles' class='rte_control rte_menu rte_special' title='{$this->lang->words['box_other_desc']}' style='display: none'>{$this->lang->words['box_other']}</span>
  258.                 </li>
  259.                 <li class='left'>
  260.                     <span id='{$editor_id}_cmd_fontname' class='rte_control rte_menu rte_font' title='{$this->lang->words['box_font_desc']}'>{$this->lang->words['box_font']}</span>
  261.                 </li>
  262.                 <li class='left'>
  263.                     <span id='{$editor_id}_cmd_fontsize' class='rte_control rte_menu rte_fontsize' title='{$this->lang->words['box_size_desc']}'>{$this->lang->words['box_size']}</span>
  264.                 </li>
  265.                 <li class='left'>
  266.                     <span id='{$editor_id}_cmd_forecolor' class='rte_control rte_palette' title='{$this->lang->words['js_tt_font_col']}'><img src='{$this->settings['img_url']}/rte_icons/font_color.png' alt='{$this->lang->words['js_tt_font_col']}' /></span>
  267.                 </li>
  268.                 <!--<li class='left'>
  269.                     <span id='{$editor_id}_cmd_backcolor' class='rte_control rte_palette' title='{$this->lang->words['js_tt_back_col']}'><img src='{$this->settings['img_url']}/rte_icons/background_color.png' alt='{$this->lang->words['js_tt_back_col']}' /></span>
  270.                 </li>-->
  271.  
  272.                 <li class='right'>
  273.                     <span id='{$editor_id}_cmd_spellcheck' class='rte_control rte_button' title='{$this->lang->words['js_tt_spellcheck']}'><img src='{$this->settings['img_url']}/rte_icons/spellcheck.png' alt='{$this->lang->words['js_tt_spellcheck']}' /></span>
  274.                 </li>
  275.                 <li class='right'>
  276.                     <span id='{$editor_id}_cmd_r_small' class='rte_control rte_button' title='{$this->lang->words['js_tt_resizesmall']}'><img src='{$this->settings['img_url']}/rte_icons/resize_small.png' alt='{$this->lang->words['js_tt_resizesmall']}' /></span>
  277.                 </li>
  278.                 <li class='right'>
  279.                     <span id='{$editor_id}_cmd_r_big' class='rte_control rte_button' title='{$this->lang->words['js_tt_resizebig']}'><img src='{$this->settings['img_url']}/rte_icons/resize_big.png' alt='{$this->lang->words['js_tt_resizebig']}' /></span>
  280.                 </li>
  281.                 <li class='right sep'>
  282.                     <span id='{$editor_id}_cmd_help' class='rte_control rte_button' title='{$this->lang->words['js_tt_help']}'><a href='{$this->settings['board_url']}/index.php?app=forums&amp;module=extras&amp;section=legends&amp;do=bbcode' title='{$this->lang->words['js_tt_help']}'><img src='{$this->settings['img_url']}/rte_icons/help.png' alt='{$this->lang->words['js_tt_help']}' /></a></span>
  283.                 </li>          
  284.                 <li class='right sep'>
  285.                     <span id='{$editor_id}_cmd_undo' class='rte_control rte_button' title='{$this->lang->words['js_tt_undo']}'><img src='{$this->settings['img_url']}/rte_icons/undo.png' alt='{$this->lang->words['js_tt_undo']}' /></span>
  286.                 </li>
  287.                 <li class='right'>
  288.                     <span id='{$editor_id}_cmd_redo' class='rte_control rte_button' title='{$this->lang->words['js_tt_redo']}'><img src='{$this->settings['img_url']}/rte_icons/redo.png' alt='{$this->lang->words['js_tt_redo']}' /></span>
  289.                 </li>
  290.             </ul>
  291.             <ul id='{$editor_id}_toolbar_2' class='toolbar' style='display: none'>
  292.                 <li>
  293.                     <span id='{$editor_id}_cmd_bold' class='rte_control rte_button' title='{$this->lang->words['js_tt_bold']}'><img src='{$this->settings['img_url']}/rte_icons/bold.png' alt='{$this->lang->words['js_tt_bold']}' /></span>
  294.                 </li>
  295.                 <li>
  296.                     <span id='{$editor_id}_cmd_italic' class='rte_control rte_button' title='{$this->lang->words['js_tt_italic']}'><img src='{$this->settings['img_url']}/rte_icons/italic.png' alt='{$this->lang->words['js_tt_italic']}' /></span>
  297.                 </li>
  298.                 <li>
  299.                     <span id='{$editor_id}_cmd_underline' class='rte_control rte_button' title='{$this->lang->words['js_tt_underline']}'><img src='{$this->settings['img_url']}/rte_icons/underline.png' alt='{$this->lang->words['js_tt_underline']}' /></span>
  300.                 </li>
  301.                 <li class='sep'>
  302.                     <span id='{$editor_id}_cmd_strikethrough' class='rte_control rte_button' title='{$this->lang->words['js_tt_strike']}'><img src='{$this->settings['img_url']}/rte_icons/strike.png' alt='{$this->lang->words['js_tt_strike']}' /></span>
  303.                 </li>
  304.                 <li>
  305.                     <span id='{$editor_id}_cmd_subscript' class='rte_control rte_button' title='{$this->lang->words['js_tt_sub']}'><img src='{$this->settings['img_url']}/rte_icons/subscript.png' alt='{$this->lang->words['js_tt_sub']}' /></span>
  306.                 </li>
  307.                 <li class='sep'>
  308.                     <span id='{$editor_id}_cmd_superscript' class='rte_control rte_button' title='{$this->lang->words['js_tt_sup']}'><img src='{$this->settings['img_url']}/rte_icons/superscript.png' alt='{$this->lang->words['js_tt_sup']}' /></span>
  309.                 </li>
  310.                 <li>
  311.                     <span id='{$editor_id}_cmd_insertunorderedlist' class='rte_control rte_button' title='{$this->lang->words['js_tt_list']}'><img src='{$this->settings['img_url']}/rte_icons/unordered_list.png' alt='{$this->lang->words['js_tt_list']}' /></span>
  312.                 </li>
  313.                 <li class='sep'>
  314.                     <span id='{$editor_id}_cmd_insertorderedlist' class='rte_control rte_button' title='{$this->lang->words['js_tt_list']}'><img src='{$this->settings['img_url']}/rte_icons/ordered_list.png' alt='{$this->lang->words['js_tt_list']}' /></span>
  315.                 </li>
  316. EOF;
  317.  
  318.             if( $this->settings['_remove_emoticons'] == 0 )
  319.             {
  320. $IPBHTML .= <<<EOF
  321.                 <li>
  322.                     <span id='{$editor_id}_cmd_emoticons' class='rte_control rte_button' title='{$this->lang->words['js_tt_emoticons']}'><img src='{$this->settings['img_url']}/rte_icons/emoticons.png' alt='{$this->lang->words['js_tt_emoticons']}' /></span>
  323.                 </li>
  324. EOF;
  325.             }
  326.  
  327. $IPBHTML .= <<<EOF
  328.                 <li>
  329.                     <span id='{$editor_id}_cmd_link' class='rte_control rte_palette' title='{$this->lang->words['js_tt_link']}'><img src='{$this->settings['img_url']}/rte_icons/link.png' alt='{$this->lang->words['js_tt_link']}' /></span>
  330.                 </li>
  331.                 <li>
  332.                     <span id='{$editor_id}_cmd_image' class='rte_control rte_palette' title='{$this->lang->words['js_tt_image']}'><img src='{$this->settings['img_url']}/rte_icons/picture.png' alt='{$this->lang->words['js_tt_image']}' /></span>
  333.                 </li>
  334.                 <li>
  335.                     <span id='{$editor_id}_cmd_email' class='rte_control rte_palette' title='{$this->lang->words['js_tt_email']}'><img src='{$this->settings['img_url']}/rte_icons/email.png' alt='{$this->lang->words['js_tt_email']}' /></span>
  336.                 </li>
  337.                 <li>
  338.                     <span id='{$editor_id}_cmd_ipb_quote' class='rte_control rte_button' title='{$this->lang->words['js_tt_quote']}'><img src='{$this->settings['img_url']}/rte_icons/quote.png' alt='{$this->lang->words['js_tt_quote']}' /></span>
  339.                 </li>
  340.                 <li>
  341.                     <span id='{$editor_id}_cmd_ipb_code' class='rte_control rte_button' title='{$this->lang->words['js_tt_code']}'><img src='{$this->settings['img_url']}/rte_icons/code.png' alt='{$this->lang->words['js_tt_code']}' /></span>
  342.                 </li>
  343.                 <li>
  344.                     <span id='{$editor_id}_cmd_media' class='rte_control rte_palette' title='{$this->lang->words['js_tt_media']}'><img src='{$this->settings['img_url']}/rte_icons/media.png' alt='{$this->lang->words['js_tt_media']}' /></span>
  345.                 </li>
  346.                 <li class='right'>
  347.                     <span id='{$editor_id}_cmd_justifyright' class='rte_control rte_button' title='{$this->lang->words['js_tt_right']}'><img src='{$this->settings['img_url']}/rte_icons/align_right.png' alt='{$this->lang->words['js_tt_right']}' /></span>
  348.                 </li>
  349.                 <li class='right'>
  350.                     <span id='{$editor_id}_cmd_justifycenter' class='rte_control rte_button' title='{$this->lang->words['js_tt_center']}'><img src='{$this->settings['img_url']}/rte_icons/align_center.png' alt='{$this->lang->words['js_tt_center']}' /></span>
  351.                 </li>
  352.                 <li class='right'>
  353.                     <span id='{$editor_id}_cmd_justifyleft' class='rte_control rte_button' title='{$this->lang->words['js_tt_left']}'><img src='{$this->settings['img_url']}/rte_icons/align_left.png' alt='{$this->lang->words['js_tt_left']}' /></span>
  354.                 </li>
  355.                 <li class='right sep'>
  356.                     <span id='{$editor_id}_cmd_indent' class='rte_control rte_button' title='{$this->lang->words['js_tt_indent']}'><img src='{$this->settings['img_url']}/rte_icons/indent.png' alt='{$this->lang->words['js_tt_indent']}' /></span>
  357.                 </li>
  358.                 <li class='right'>
  359.                     <span id='{$editor_id}_cmd_outdent' class='rte_control rte_button' title='{$this->lang->words['js_tt_outdent']}'><img src='{$this->settings['img_url']}/rte_icons/outdent.png' alt='{$this->lang->words['js_tt_outdent']}' /></span>
  360.                 </li>
  361.             </ul>
  362.         </div>
  363.         <div id='{$editor_id}_wrap' class='editor'>
  364.             <textarea name="{$form_field}" class="input_rte" id="{$editor_id}_textarea" rows="10" cols="60" tabindex="0">{$initial_content}</textarea>
  365.         </div>
  366.     </div>
  367.  
  368.     <!-- Toolpanes -->
  369.     <script type="text/javascript">
  370.     //<![CDATA[
  371.     $('{$editor_id}_toolbar_1').show();
  372.     $('{$editor_id}_toolbar_2').show();
  373.     // Rikki: Had to remove <form>... </form> because Opera would see </form> and not pass the topic icons / hidden fields properly. Tried "</" + "form>" but when it is parsed, it had the same affect
  374.     ipb.editor_values.get('templates')['link'] = new Template("<label for='#{id}_url'>{$this->lang->words['js_template_url']}</label><input type='text' class='input_text' id='#{id}_url' value='http://' tabindex='10' /><label for='#{id}_urltext'>{$this->lang->words['js_template_link']}</label><input type='text' class='input_text _select' id='#{id}_urltext' value='{$this->lang->words['js_template_default']}' tabindex='11' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_insert_link']}' tabindex='12' />");
  375.  
  376.     ipb.editor_values.get('templates')['image'] = new Template("<label for='#{id}_img'>{$this->lang->words['js_template_imageurl']}</label><input type='text' class='input_text' id='#{id}_img' value='http://' tabindex='10' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_insert_img']}' tabindex='11' />");
  377.  
  378.     ipb.editor_values.get('templates')['email'] = new Template("<label for='#{id}_email'>{$this->lang->words['js_template_email_url']}</label><input type='text' class='input_text' id='#{id}_email' tabindex='10' /><label for='#{id}_emailtext'>{$this->lang->words['js_template_link']}</label><input type='text' class='input_text _select' id='#{id}_emailtext' value='{$this->lang->words['js_template_email_me']}' tabindex='11' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_insert_email']}' tabindex='12' />");
  379.  
  380.     ipb.editor_values.get('templates')['media'] = new Template("<label for='#{id}_media'>{$this->lang->words['js_template_media_url']}</label><input type='text' class='input_text' id='#{id}_media' value='http://' tabindex='10' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_insert_media']}' tabindex='11' />");
  381.  
  382.     ipb.editor_values.get('templates')['generic'] = new Template("<div class='rte_title'>#{title}</div><strong>{$this->lang->words['js_template_example']}</strong><pre>#{example}</pre><label for='#{id}_option' class='optional'>#{option_text}</label><input type='text' class='input_text optional' id='#{id}_option' tabindex='10' /><label for='#{id}_text' class='tagcontent'>#{value_text}</label><input type='text' class='input_text _select tagcontent' id='#{id}_text' tabindex='11' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_add']}' tabindex='12' />");
  383.  
  384.     ipb.editor_values.get('templates')['toolbar'] = new Template("<ul id='#{id}_toolbar_#{toolbarid}' class='toolbar' style='display: none'>#{content}</ul>");
  385.  
  386.     ipb.editor_values.get('templates')['button'] = new Template("<li><span id='#{id}_cmd_custom_#{cmd}' class='rte_control rte_button specialitem' title='#{title}'><img src='{$this->settings['img_url']}/rte_icons/#{img}' alt='{$this->lang->words['icon']}' /></span></li>");
  387.  
  388.     ipb.editor_values.get('templates')['menu_item'] = new Template("<li id='#{id}_cmd_custom_#{cmd}' class='specialitem clickable'>#{title}</li>");
  389.  
  390.     ipb.editor_values.get('templates')['togglesource'] = new Template("<fieldset id='#{id}_ts_controls' class='submit' style='text-align: left'><input type='button' class='input_submit' value='{$this->lang->words['js_template_update']}' id='#{id}_ts_update' />&nbsp;&nbsp;&nbsp; <a href='#' id='#{id}_ts_cancel' class='cancel'>{$this->lang->words['js_template_cancel_source']}</a></fieldset>");
  391.  
  392.     ipb.editor_values.get('templates')['emoticons_showall'] = new Template("<input class='input_submit emoticons' type='button' id='#{id}_all_emoticons' value='{$this->lang->words['show_all_emoticons']}' />");
  393.  
  394.     ipb.editor_values.get('templates')['emoticon_wrapper'] = new Template("<h4><span>{$this->lang->words['emoticons_template_title']}</span></h4><div id='#{id}_emoticon_holder' class='emoticon_holder'></div>");
  395.  
  396.     // Add smilies into the mix
  397.     ipb.editor_values.set( 'show_emoticon_link', true );
  398.     ipb.editor_values.set( 'emoticons', \$H({ $smilies }) );
  399.     ipb.editor_values.set( 'bbcodes', \$H( $bbcodes ) );
  400.  
  401.     ipb.vars['emoticon_url'] = "{$this->settings['emoticons_url']}";
  402.  
  403.     Event.observe(window, 'load', function(e){
  404.         ipb.editors[ '{$editor_id}' ] = new ipb.editor( '{$editor_id}', USE_RTE );
  405.     });
  406.  
  407.     //]]>
  408.     </script>
  409.  
  410. EOF;
  411. //--endhtml--//
  412. return $IPBHTML;
  413. }
  414.  
  415. /**
  416.  * Page wrapper for popup windows
  417.  *
  418.  * @access  public
  419.  * @param   string      Document character set
  420.  * @param   array       CSS Files
  421.  * @return  string      HTML
  422.  */
  423. public function global_main_popup_wrapper($IPS_DOC_CHAR_SET=IPS_DOC_CHAR_SET, $cssFiles=array() ) {
  424.  
  425. $IPBHTML = "";
  426. //--starthtml--//
  427.  
  428. $_path      = IPS_PUBLIC_SCRIPT;
  429. $boardurl = ($this->registry->output->isHTTPS) ? $this->settings['board_url_https'] : $this->settings['board_url'];
  430.  
  431. $IPBHTML .= <<<EOF
  432. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  433. <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
  434. <head>
  435.     <meta http-equiv="content-type" content="text/html; charset={$IPS_DOC_CHAR_SET}" />
  436.     <meta http-equiv="Pragma" content="no-cache" />
  437.     <meta http-equiv="Cache-Control" content="no-cache" />
  438.     <meta http-equiv="Expires" content="Fri, 01 January 1999 01:00:00 GMT" />
  439.     <link rel="shortcut icon" href='{$boardurl}/favicon.ico' />
  440.  
  441.     <title><%TITLE%></title>
  442.     <script type='text/javascript'>
  443.         jsDebug = 1;
  444.         USE_RTE = 1;
  445.         inACP   = true;
  446.         isRTL   = false;
  447.     </script>
  448. EOF;
  449.  
  450. /** CSS ----------------------------------------- */
  451. /*if ( $this->settings['use_minify'] )
  452. {
  453.     $_basics  = CP_DIRECTORY . '/skin_cp/acp.css,' . CP_DIRECTORY . '/skin_cp/acp_editor.css';
  454.     $_others  = '';
  455.  
  456.     if ( is_array( $cssFiles['import'] ) AND count( $cssFiles['import'] ) )
  457.     {
  458.         foreach( $cssFiles['import'] as $data )
  459.         {
  460.             $_others .= ',' . preg_replace( "#^(.*)/(" . CP_DIRECTORY . "/.*)$#", "$2", $data['content'] );
  461.         }
  462.     }
  463.  
  464.     $IPBHTML .= "\n\t<link rel=\"stylesheet\" type=\"text/css\" media='screen' href=\"{$this->settings['public_dir']}min/index.php?f={$_basics}{$_others}\">\n";
  465. }
  466. else
  467. {*/
  468.     $IPBHTML .= <<<HTML
  469.     <style type='text/css' media='all'>
  470.         @import url( "{$this->settings['skin_acp_url']}/acp.css" );
  471.         @import url( "{$this->settings['skin_acp_url']}/acp_editor.css" );
  472.     </style>
  473. HTML;
  474.  
  475.     if( is_array($cssFiles['import']) AND count($cssFiles['import']) )
  476.     {
  477.         foreach( $cssFiles['import'] as $data )
  478.         {
  479.             $IPBHTML .= <<<EOF
  480.             <link rel="stylesheet" type="text/css" {$data['attributes']} href="{$data['content']}" />
  481. EOF;
  482.         }
  483.     }
  484. //}
  485.  
  486. $IPBHTML .= <<<HTML
  487.     <!--[if IE]>
  488.         <style type='text/css' media='all'>
  489.             @import url( "{$this->settings['skin_acp_url']}/acp_ie_tweaks.css" );
  490.         </style>
  491.     <![endif]-->
  492. HTML;
  493.  
  494. if( IN_DEV )
  495. {
  496.     $IPBHTML .= <<<HTML
  497.         <style type='text/css' media='all'>
  498.             .ipsActionBar > ul > li.inDev {
  499.                 display: inline;
  500.             }
  501.         </style>
  502. HTML;
  503. }
  504.  
  505. if( is_array($cssFiles['inline']) AND count($cssFiles['inline']) )
  506. {
  507.     $IPBHTML .= <<<EOF
  508.         <style type='text/css' media="all">
  509. EOF;
  510.  
  511.     foreach( $cssFiles['inline'] as $data )
  512.     {
  513.         $IPBHTML .= $data['content'];
  514.     }
  515.  
  516.     $IPBHTML .= <<<EOF
  517.         </style>
  518. EOF;
  519. }
  520.  
  521. /** JS ----------------------------------------- */
  522. /*if ( $this->settings['use_minify'] )
  523. {
  524.     $_others = ',' . CP_DIRECTORY . '/js/acp.js,' . CP_DIRECTORY . '/js/acp.' . implode('.js,' . CP_DIRECTORY . '/js/acp.', array( 'menu', 'tabs' ) ) . '.js';
  525.  
  526.     $IPBHTML .= <<<HTML
  527.  
  528.     <script type='text/javascript' src='{$this->settings['public_dir']}min/index.php?g=js&amp;ipbv={$this->registry->output->antiCacheHash}'></script>
  529. HTML;
  530.  
  531.     $IPBHTML .= "\n\t<script type='text/javascript' src='{$this->settings['public_dir']}min/index.php?ipbv={$this->registry->output->antiCacheHash}&amp;f=" . PUBLIC_DIRECTORY . "/js/ipb.js" . $_others;
  532.  
  533.     if ( $this->settings['extraJsModules'] )
  534.     {
  535.         $_modules       = explode( ',', $this->settings['extraJsModules'] );
  536.         $_loadModules   = '';
  537.         $_seenModules   = array();
  538.  
  539.         foreach( $_modules as $_jsModule )
  540.         {
  541.             if( !$_jsModule )
  542.             {
  543.                 continue;
  544.             }
  545.  
  546.             if( in_array( $_jsModule, $_seenModules ) )
  547.             {
  548.                 continue;
  549.             }
  550.  
  551.             $_seenModules[] = $_jsModule;
  552.  
  553.             $_loadModules   .= "," . PUBLIC_DIRECTORY . "/js/ips." . $_jsModule . ".js";
  554.         }
  555.  
  556.         $IPBHTML .= $_loadModules . "'></script>\n";
  557.     }
  558.     else
  559.     {
  560.         $IPBHTML .= "'></script>\n";
  561.     }
  562. }
  563. else
  564. {*/
  565.     $IPBHTML .= <<<HTML
  566.         <script type="text/javascript" src="{$this->settings['public_dir']}js/3rd_party/prototype.js?ipbv={$this->registry->output->antiCacheHash}"></script>
  567.         <script type='text/javascript' src='{$this->settings['public_dir']}js/3rd_party/scriptaculous/scriptaculous-cache.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  568.         <script type="text/javascript" src='{$this->settings['public_dir']}js/ipb.js?ipbv={$this->registry->output->antiCacheHash}&amp;load={$this->settings['extraJsModules']}'></script>
  569.         <script type='text/javascript' src='{$this->settings['js_main_url']}acp.menu.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  570.         <script type='text/javascript' src='{$this->settings['js_main_url']}acp.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  571.         <script type="text/javascript" src='{$this->settings['js_main_url']}acp.tabs.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  572. HTML;
  573. //}
  574.  
  575. $mem_info = json_encode( array( 'g_mem_info' => $this->memberData['g_mem_info'] ) );
  576.  
  577. $IPBHTML .= <<<EOF
  578.     <script type='text/javascript'>
  579.     //<![CDATA[
  580.         ipb.vars['st']  = "{$this->request['st']}";
  581.         ipb.vars['base_url']    = "{$this->settings['_base_url']}";
  582.         ipb.vars['front_url']   = "{$this->settings['board_url']}/index.php?";
  583.         ipb.vars['app_url']     = "{$this->settings['base_url']}";
  584.         ipb.vars['image_url']   = "{$this->settings['skin_app_url']}/images/";
  585.         ipb.vars['md5_hash']    = "{$this->member->form_hash}";
  586.         ipb.vars['is_touch']    = false;
  587.         ipb.vars['member_group'] = {$mem_info};
  588.         /* ---- cookies ----- */
  589.         ipb.vars['cookie_id']           = '{$this->settings['cookie_id']}';
  590.         ipb.vars['cookie_domain']       = '{$this->settings['cookie_domain']}';
  591.         ipb.vars['cookie_path']         = '{$this->settings['cookie_path']}';
  592.         ipb.templates['close_popup']    = "<img src='{$this->settings['img_url']}/close_popup.png' alt='x' />";
  593.         ipb.templates['page_jump']      = new Template("<div id='#{id}_wrap' class='ipbmenu_content'><h3 class='bar'>{$this->lang->words['gl_pagejump']}</h3><input type='text' class='input_text' id='#{id}_input' size='8' /> <input type='submit' value='Go' class='input_submit add_folder' id='#{id}_submit' /></div>");
  594.         ipb.templates['ajax_loading']   = "<div id='ajax_loading'>{$this->lang->words['gl_loading']}</div>";
  595.     //]]>
  596.     </script>
  597.     <!--<script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>-->
  598.     <script type='text/javascript'>
  599.         Loader.boot();
  600.         acp = new IPBACP;
  601.     </script>
  602.     <script type="text/javascript" src="{$this->settings['cache_dir']}lang_cache/{$this->lang->lang_id}/acp.lang.js?ipbv={$this->registry->output->antiCacheHash}" charset="{$IPS_DOC_CHAR_SET}"></script>
  603. </head>
  604. <body<%BODYEXTRA%> id='ipboard_body' class='popupwindow'>
  605. <div id='loading-layer' style='display:none'>
  606.     <div id='loading-layer-shadow'>
  607.        <div id='loading-layer-inner' >
  608.            <img src='{$this->settings['skin_acp_url']}/images/loading_anim.gif' style='vertical-align:middle' />
  609.            <span style='font-weight:bold' id='loading-layer-text'>{$this->lang->words['ajax_please_wait']}</span>
  610.        </div>
  611.     </div>
  612. </div>
  613. <div id='main_content'>
  614.     <div id='content_wrap'>
  615.         <%CONTENT%>
  616.     </div>
  617. </div>
  618. </body>
  619. </html>
  620. EOF;
  621.  
  622. //--endhtml--//
  623. return $IPBHTML;
  624. }
  625.  
  626. /**
  627.  * Primary page wrapper - used for all full pages
  628.  *
  629.  * @access  public
  630.  * @param   string      Document character set
  631.  * @param   array       CSS Files
  632.  * @param   string      Global submenu HTML (@see global_menu_sub_navigation)
  633.  * @param   array       Order of tabs
  634.  * @return  string      HTML
  635.  */
  636. public function global_main_wrapper($IPS_DOC_CHAR_SET=IPS_DOC_CHAR_SET, $cssFiles=array(), $gbl_sub_menu='', $mainTabData, $otherTabData, $bookMarks=array() ) {
  637.  
  638. $IPBHTML = "";
  639. //--starthtml--//
  640.  
  641. //$_encoded = base64_encode( $this->settings['query_string_safe'] );
  642. $_url   = str_replace( '&amp;'   , '&', $this->settings['query_string_safe'] );
  643. $_url   = preg_replace( '#&{1,}#', ';', $_url );
  644. $_url   = preg_replace( '#={1,}#', ':', $_url );
  645. $_url   = ltrim( $_url, ';' );
  646.  
  647. $_path  = IPS_PUBLIC_SCRIPT;
  648. $year   = date('Y');
  649.  
  650. /* Open Tab */
  651. $__tabs = ( is_array( $this->member->acp_tab_data ) and count( $this->member->acp_tab_data ) )
  652.         ? "'" . implode( "','", array_keys( $this->member->acp_tab_data ) ) . "'"
  653.         : '';
  654.  
  655. $_apptitle  = ipsRegistry::$applications[ ipsRegistry::$current_application ]['app_title'];
  656.  
  657. $defaultFakeApp     = '';
  658. $defaultFakeModule  = '';
  659.  
  660. $curApp             = array();
  661.  
  662. switch( ipsRegistry::$current_application )
  663. {
  664.     case 'forums':
  665.         $curApp['forums'] = 'active';
  666.         break;
  667.     case 'core':
  668.         $curApp['core'] = 'active';
  669.         break;
  670.     case 'members':
  671.         $curApp['members'] = 'active';
  672.         break;
  673.     default:
  674.         $curApp['other'] = 'active';
  675.         break;
  676. }
  677.  
  678. $fakeApps   = $this->registry->output->fetchFakeApps();
  679.  
  680. foreach( $fakeApps as $fa => $data )
  681. {
  682.     foreach( $data as $appData )
  683.     {
  684.         if ( ! $defaultFakeApp )
  685.         {
  686.             $defaultFakeApp    = $appData['app'];
  687.             $defaultFakeModule = $appData['module'];
  688.         }
  689.        
  690.         if ( $appData['app'] == ipsRegistry::$current_application && $appData['module'] == ipsRegistry::$current_module )
  691.         {
  692.             $curApp = array();
  693.             $curApp[ $fa ] = 'active';
  694.             break 2;
  695.         }
  696.     }
  697. }
  698.  
  699. $boardurl = ($this->registry->output->isHTTPS) ? $this->settings['board_url_https'] : $this->settings['board_url'];
  700.  
  701. $IPBHTML .= <<<HTML
  702. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  703. <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
  704. <head>
  705.     <meta http-equiv="content-type" content="text/html; charset={$IPS_DOC_CHAR_SET}" />
  706.     <meta http-equiv="Pragma" content="no-cache" />
  707.     <meta http-equiv="Cache-Control" content="no-cache" />
  708.     <meta http-equiv="Expires" content="Fri, 01 January 1999 01:00:00 GMT" />
  709.     <link rel="shortcut icon" href='{$boardurl}/favicon.ico' />
  710.  
  711.     <title><%TITLE%></title>
  712.     <script type='text/javascript'>
  713.         jsDebug = 1;
  714.         USE_RTE = 1;
  715.         inACP   = true;
  716.         isRTL   = false;
  717.     </script>
  718. HTML;
  719.  
  720. /** CSS ----------------------------------------- */
  721. /*if ( $this->settings['use_minify'] )
  722. {
  723.     $_basics  = CP_DIRECTORY . '/skin_cp/acp.css,' . CP_DIRECTORY . '/skin_cp/acp_editor.css';
  724.     $_others  = '';
  725.    
  726.     if ( is_array( $cssFiles['import'] ) AND count( $cssFiles['import'] ) )
  727.     {
  728.         foreach( $cssFiles['import'] as $data )
  729.         {
  730.             $_others .= ',' . preg_replace( "#^(.*)/(" . CP_DIRECTORY . "/.*)$#", "$2", $data['content'] );
  731.         }
  732.     }
  733.    
  734.     $IPBHTML .= "\n\t<link rel=\"stylesheet\" type=\"text/css\" media='screen' href=\"{$this->settings['public_dir']}min/index.php?ipbv={$this->registry->output->antiCacheHash}&amp;f={$_basics}{$_others}\">\n";
  735. }
  736. else
  737. {*/
  738.     $IPBHTML .= <<<HTML
  739.     <style type='text/css' media='all'>
  740.         @import url( "{$this->settings['skin_acp_url']}/acp.css?ipbv={$this->registry->output->antiCacheHash}" );
  741.         @import url( "{$this->settings['skin_acp_url']}/acp_editor.css?ipbv={$this->registry->output->antiCacheHash}" );
  742.     </style>
  743. HTML;
  744.  
  745.     if( is_array($cssFiles['import']) AND count($cssFiles['import']) )
  746.     {
  747.         foreach( $cssFiles['import'] as $data )
  748.         {
  749.             $IPBHTML .= <<<EOF
  750.             <link rel="stylesheet" type="text/css" {$data['attributes']} href="{$data['content']}?ipbv={$this->registry->output->antiCacheHash}" />
  751. EOF;
  752.         }
  753.     }
  754. //}
  755.  
  756. $IPBHTML .= <<<HTML
  757.     <!--[if IE]>
  758.         <style type='text/css' media='all'>
  759.             @import url( "{$this->settings['skin_acp_url']}/acp_ie_tweaks.css" );
  760.         </style>
  761.     <![endif]-->
  762. HTML;
  763.  
  764. if( IN_DEV )
  765. {
  766.     $IPBHTML .= <<<HTML
  767.         <style type='text/css' media='all'>
  768.             .ipsActionBar > ul > li.inDev {
  769.                 display: inline;
  770.             }
  771.         </style>
  772. HTML;
  773. }
  774.  
  775. if( is_array($cssFiles['inline']) AND count($cssFiles['inline']) )
  776. {
  777.     $IPBHTML .= <<<EOF
  778.         <style type='text/css' media="all">
  779. EOF;
  780.  
  781.     foreach( $cssFiles['inline'] as $data )
  782.     {
  783.         $IPBHTML .= $data['content'];
  784.     }
  785.  
  786.     $IPBHTML .= <<<EOF
  787.         </style>
  788. EOF;
  789. }
  790.  
  791. /** JS ----------------------------------------- */
  792. /*if ( $this->settings['use_minify'] )
  793. {
  794.     $_others = ',' . CP_DIRECTORY . '/js/acp.js,' . CP_DIRECTORY . '/js/acp.' . implode('.js,' . CP_DIRECTORY . '/js/acp.', array( 'menu', 'tabs' ) ) . '.js';
  795.    
  796.     if ( $this->settings['remote_load_js'] )
  797.     {
  798.         $IPBHTML .= <<<HTML
  799.         <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/prototype/1.7/prototype.js'></script>
  800.         <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8/scriptaculous.js?load=effects,dragdrop,builder'></script>
  801. HTML;
  802.  
  803.     }
  804.     else
  805.     {
  806.             $IPBHTML .= <<<HTML
  807.    
  808.     <script type='text/javascript' src='{$this->settings['public_dir']}min/index.php?g=js&amp;ipbv={$this->registry->output->antiCacheHash}'></script>
  809. HTML;
  810.     }
  811.  
  812.     $IPBHTML .= "\n\t<script type='text/javascript' src='{$this->settings['public_dir']}min/index.php?ipbv={$this->registry->output->antiCacheHash}&amp;f=" . PUBLIC_DIRECTORY . "/js/ipb.js" . $_others;
  813.    
  814.     if ( $this->settings['extraJsModules'] )
  815.     {
  816.         $_modules       = explode( ',', $this->settings['extraJsModules'] );
  817.         $_loadModules   = '';
  818.         $_seenModules   = array();
  819.        
  820.         foreach( $_modules as $_jsModule )
  821.         {
  822.             if( !$_jsModule )
  823.             {
  824.                 continue;
  825.             }
  826.            
  827.             if( in_array( $_jsModule, $_seenModules ) )
  828.             {
  829.                 continue;
  830.             }
  831.            
  832.             $_seenModules[] = $_jsModule;
  833.            
  834.             $_loadModules   .= "," . PUBLIC_DIRECTORY . "/js/ips." . $_jsModule . ".js";
  835.         }
  836.        
  837.         $IPBHTML .= $_loadModules . "'></script>\n";
  838.     }
  839.     else
  840.     {
  841.         $IPBHTML .= "'></script>\n";
  842.     }
  843. }
  844. else
  845. {*/
  846.     $IPBHTML .= <<<HTML
  847.         <script type="text/javascript" src="{$this->settings['public_dir']}js/3rd_party/prototype.js?ipbv={$this->registry->output->antiCacheHash}"></script>
  848.         <script type='text/javascript' src='{$this->settings['public_dir']}js/3rd_party/scriptaculous/scriptaculous-cache.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  849.         <script type="text/javascript" src='{$this->settings['public_dir']}js/ipb.js?ipbv={$this->registry->output->antiCacheHash}&amp;load={$this->settings['extraJsModules']}'></script>
  850.         <script type='text/javascript' src='{$this->settings['js_main_url']}acp.menu.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  851.         <script type='text/javascript' src='{$this->settings['js_main_url']}acp.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  852.         <script type="text/javascript" src='{$this->settings['js_main_url']}acp.tabs.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  853. HTML;
  854. //}
  855.  
  856. /* SIDEBAR */
  857. if( $this->settings['hide_sidebar'] || IPSCookie::get("acp_sidebar") == 'closed' )
  858. {
  859.     if( $this->settings['hide_sidebar'] )
  860.     {
  861.         //$sidebar['toggle_class'] = "style='display: none'";
  862.     }
  863.     $sidebar['content_class'] = "close_menu";
  864.     $sidebar['menu_style'] = "style='display: none'";
  865. }
  866. else
  867. {
  868.     $sidebar['content_class'] = "open_menu";
  869.     $sidebar['menu_style'] = "";
  870. }
  871.  
  872. $mem_info = json_encode( array( 'g_mem_info' => $this->memberData['g_mem_info'] ) );
  873. $base_url = str_replace( '&amp;', '&', $this->settings['_base_url'] );
  874.  
  875. $IPBHTML .= <<<HTML
  876.     <script type='text/javascript' src='{$this->settings['board_url']}/cache/lang_cache/{$this->lang->lang_id}/ipb.lang.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  877.     <script type="text/javascript" src="{$this->settings['cache_dir']}lang_cache/{$this->lang->lang_id}/acp.lang.js?ipbv={$this->registry->output->antiCacheHash}" charset="{$IPS_DOC_CHAR_SET}"></script>
  878.     <script type='text/javascript' src='{$this->settings['js_main_url']}3rd_party/jquery.min.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  879.     <script type='text/javascript' src='{$this->settings['js_main_url']}3rd_party/jquery-ui.min.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  880.     <script type='text/javascript'>
  881.         var jQ = jQuery.noConflict();
  882.     </script>
  883.     <script type='text/javascript' src='{$this->settings['js_main_url']}acp.jquery.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  884.     <script type='text/javascript'>
  885.     //<![CDATA[
  886.         ipb.vars['st']  = "{$this->request['st']}";
  887.         ipb.vars['base_url']    = "{$base_url}";
  888.         ipb.vars['front_url']   = "{$this->settings['board_url']}/index.php?";
  889.         ipb.vars['app_url']     = "{$this->settings['base_url']}";
  890.         ipb.vars['upload_url']  = "{$this->settings['upload_url']}";
  891.         ipb.vars['image_url']   = "{$this->settings['skin_app_url']}images/";
  892.         ipb.vars['image_acp_url']   = "{$this->settings['skin_acp_url']}/images/";
  893.         ipb.vars['md5_hash']    = "{$this->member->form_hash}";
  894.         ipb.vars['is_touch']    = false;
  895.         ipb.vars['member_group'] = {$mem_info};
  896.         ipb.vars['member_id']    = parseInt("{$this->memberData['member_id']}");
  897.        
  898.         /* ---- cookies ----- */
  899.         ipb.vars['cookie_id']           = '{$this->settings['cookie_id']}';
  900.         ipb.vars['cookie_domain']       = '{$this->settings['cookie_domain']}';
  901.         ipb.vars['cookie_path']         = '{$this->settings['cookie_path']}';
  902.         ipb.templates['close_popup']    = "<img src='{$this->settings['img_url']}/close_popup.png' alt='x' />";
  903.         ipb.templates['page_jump']      = new Template("<div id='#{id}_wrap' class='ipbmenu_content'><h3 class='bar'>{$this->lang->words['gl_pagejump']}</h3><input type='text' class='input_text' id='#{id}_input' size='8' /> <input type='submit' value='Go' class='realbutton' id='#{id}_submit' /></div>");
  904.         ipb.templates['ajax_loading']   = "<div id='ajax_loading'>{$this->lang->words['gl_loading']}</div>";
  905.         ipb.templates['global_notify']  = new Template("<div class='popupWrapper'><div class='popupInner'><div class='ipsPad'>#{message} #{close}</div></div></div>");
  906.         ipb.templates['global_notify_close']    = "<span id='ipsGlobalNotification_close' class='realbutton'>{$this->lang->words['gbl_ok']}</span>";
  907.         ipb.templates['acp_bookmark_add']       = new Template("<h3>{$this->lang->words['bookmarks_add_title']}</h3><div class='ipsPad' id='bmcontent'>{$this->lang->words['bookmarks_add_field_title']} <input type='text' class='input_text' style='width:99%' name='bookmarkTitle' value='#{title}' /><br /><input type='checkbox' name='homePage' value='1' /> <span class='desctext'>{$this->lang->words['bookmarks_add_field_home']}</span><br /><br /><div style='text-align:center'><input type='button' class='realbutton' value='{$this->lang->words['bookmarks_save']}' /></div></div>" );
  908.     //]]>
  909.     </script>
  910.     <script type='text/javascript'>
  911.         Loader.boot();
  912.         acp = new IPBACP;
  913.     </script>
  914. </head>
  915. <body id='ipboard_body' data-bookmarkurl="{$bookMarks['url']}" data-bookmarkable="{$bookMarks['can']}" data-bookmarked="{$bookMarks['has']}" class='{$extra_class} clearfix'>
  916. <!-- Inline Form Box -->
  917. <div id='modal' style='display: none'></div>
  918. {$license_html}
  919. <div id='inlineFormWrap' style='display: none;'>
  920.     <div id='inlineFormInnerWrap'>
  921.         <div id='inlineFormInnerClose' onclick="Effect.Fade( 'inlineFormWrap', { duration: .5 } );"></div>
  922.         <div id='inlineFormInnerTitle'></div>
  923.         <div id='inlineErrorBox'>
  924.             <img src='{$this->settings['skin_acp_url']}/images/stopLarge.png' />
  925.             <strong>{$this->lang->words['gl_error']}</strong>
  926.             <div id='inlineErrorText'></div>
  927.         </div>
  928.         <div id='inlineFormInnerContent'></div>
  929.         <div id='inlineFormLoading'>
  930.             {$this->lang->words['gl_pleasewait']}...
  931.             <br /><br />
  932.             <img src='{$this->settings['skin_acp_url']}/images/loading_big.gif' alt='loading' id='search_loading' />
  933.         </div>
  934.     </div>
  935. </div>
  936. <!-- / Inline Form Box -->
  937.     <div id='header'>
  938.         <div id='search' class='right'>
  939.             <img src='{$this->settings['skin_acp_url']}/images/search_icon_white.png' alt='' /> <input type='text' value='{$this->lang->words['gl_livesearch']}' id='acpSearchKeyword' class='inactive' /><img src='{$this->settings['skin_acp_url']}/images/loading.gif' id='acp_loading' style='display: none' />
  940.         </div>
  941.         <a href='{$this->settings['_base_url']}' title='{$this->lang->words['home']}'>
  942.             <img src='{$this->settings['skin_acp_url']}/images/logo.png' alt='Logo' />
  943.         </a>
  944.         <div class='logged_in'>
  945.             {$this->lang->words['gl_loggedinas']} {$this->memberData['members_display_name']}
  946.             <ul id='user_links' class='ipsList_inline'>
  947.                 <li>
  948.                     <a href='../' target='_blank'>{$this->lang->words['gbl_view_site']}</a>
  949.                 </li>
  950.                 <li>
  951.                     <a href='{$this->settings['_base_url']}app=core&amp;module=mycp&amp;section=dashboard'>{$this->lang->words['gbl_dashboard']}</a>
  952.                 </li>
  953.                 <li>
  954.                     <a href='{$this->settings['_base_url']}&amp;module=login&amp;do=login-out'>{$this->lang->words['gbl_log_out']}</a>
  955.                 </li>
  956.             </ul>
  957.         </div>
  958.     </div>
  959.     <div id='live_search_results' style='display: none'>
  960.         <div id='ls_sections'>
  961.             <ul>
  962. HTML;
  963.             if ( $this->registry->getClass('class_permissions')->checkPermission( 'settings_manage', 'core', 'settings' ) )
  964.             {
  965.                 $IPBHTML .= <<<HTML
  966.                 <li id='ls_settings'>{$this->lang->words['livesearch_settings']}<span class='count'></span></li>
  967. HTML;
  968.             }
  969.             if ( $this->registry->getClass('class_permissions')->checkPermission( 'member_edit', 'members', 'members' ) )
  970.             {
  971.                 $IPBHTML .= <<<HTML
  972.                 <li id='ls_members'>{$this->lang->words['livesearch_members']}<span class='count'></span></li>
  973. HTML;
  974.             }
  975.             if ( $this->registry->getClass('class_permissions')->checkPermission( 'groups_edit', 'members', 'groups' ) )
  976.             {
  977.                 $IPBHTML .= <<<HTML
  978.                 <li id='ls_groups'>{$this->lang->words['livesearch_groups']}<span class='count'></span></li>
  979. HTML;
  980.             }
  981.             if ( $this->registry->getClass('class_permissions')->checkPermission( 'forums_edit', 'forums', 'forums' ) )
  982.             {
  983.                 $IPBHTML .= <<<HTML
  984.                 <li id='ls_forums'>{$this->lang->words['livesearch_forums']}<span class='count'></span></li>
  985. HTML;
  986.             }
  987.                 $IPBHTML .= <<<HTML
  988.                 <li id='ls_location'>{$this->lang->words['livesearch_pages']}<span class='count'></span></li>
  989. HTML;
  990.                 if( IPSLib::appIsInstalled('nexus') and $this->registry->getClass('class_permissions')->checkForAppAccess('nexus') )
  991.                 {
  992.                     $IPBHTML .= "<li id='ls_nexus'>{$this->lang->words['livesearch_nexus']}<span class='count'></span></li>";
  993.                 }
  994.                
  995. $IPBHTML .= <<<HTML
  996.                 <li id='ls_marketplace' title='{$this->lang->words['search_marketplace_more']}'>{$this->lang->words['search_ipsmarketplace']}</li>
  997.             </ul>
  998.         </div>
  999.         <div id='ls_results'>
  1000.             <span id='ls_no_results' style='display: none'>{$this->lang->words['live_search_no_results']}</span>
  1001.             <div id='ls_settings_panel'></div>
  1002.             <div id='ls_members_panel'></div>
  1003.             <div id='ls_groups_panel'></div>
  1004.             <div id='ls_forums_panel'></div>
  1005.             <div id='ls_location_panel'></div>
  1006. HTML;
  1007.             if( IPSLib::appIsInstalled('nexus') ){
  1008.                 $IPBHTML .= "<div id='ls_nexus_panel'></div>";
  1009.             }
  1010.            
  1011. $IPBHTML .= <<<HTML
  1012.             <div id='ls_marketplace_panel'>
  1013.                 <div class='pad'>
  1014.                     {$this->lang->words['ipsmarketplace_is_best']}
  1015.                     <br /><br />
  1016.  
  1017.                     <a href='http://community.invisionpower.com/files/' class='realbutton'>{$this->lang->words['gotomarketplace']}</a>
  1018.                 </div>
  1019.             </div>
  1020.         </div>
  1021.         <img src='{$this->settings['skin_acp_url']}/images/live_search_stem.png' id='ls_stem' />
  1022.     </div>
  1023.     <!-- pre load -->
  1024.     <img src='{$this->settings['skin_acp_url']}/images/icons/bookmark_white_20.png' style='display:none' />
  1025.     <img src='{$this->settings['skin_acp_url']}/images/icons/bookmark_grey_20.png' style='display:none' />
  1026.     <div id='app_bar'>
  1027.         <a class='right' id='edit_tabs' href='#' title="Set up the app bar just the way you want">Edit Tabs</a>
  1028.        
  1029. HTML;
  1030.         $IPBHTML .= $this->global_app_menu_html( $gbl_sub_menu, $mainTabData, $otherTabData );
  1031.        
  1032. $IPBHTML .= <<<HTML
  1033.     </div>
  1034.  
  1035.     <div id='page_body' class='{$sidebar['content_class']} clearfix'>
  1036.         <a href='#' id='toggle_sidebar' title='Close the sidebar' {$sidebar['toggle_class']}>&larr;</a>
  1037.         <div id='section_navigation' {$sidebar['menu_style']}>         
  1038.             <%SIDEBAR_EXTRA%>
  1039.             <%MENU%>
  1040.         </div>
  1041.         <div id='main_content' class='clearfix'>
  1042.             <%NAV%>            
  1043.             <%CONTENT%>
  1044.         </div>
  1045.     </div>
  1046.     <div id='footer' class='clear'>
  1047.         <a href='http://www.invisionpower.com'>IP.Board 3</a> &copy; {$year} IPS, Inc. &nbsp;&nbsp;|&nbsp;&nbsp; <a href='http://www.invisionpower.com/clients/' target='_blank' title='{$this->lang->words['gl_getsupport_title']}'>{$this->lang->words['gl_getsupport']}</a> &nbsp;&nbsp;|&nbsp;&nbsp; <a href='http://community.invisionpower.com/index.php?app=ccs' target='_blank' title='{$this->lang->words['gl_resources_title']}'>{$this->lang->words['gl_resources']}</a>
  1048. HTML;
  1049.  
  1050. if ( IN_DEV )
  1051. {
  1052. $count = count( $this->DB->obj['cached_queries'] );
  1053. $files = count( get_included_files() );
  1054.  
  1055. $IPBHTML .= <<<HTML
  1056.     &nbsp;&nbsp;|&nbsp;&nbsp; <a href='#' onclick="$('acpQueries').toggle(); return false;">{$count} Queries and {$files} Included Files</a>
  1057.    
  1058. HTML;
  1059. }
  1060.  
  1061. $acpUrl = str_replace( '&amp;', '&', $this->settings['_base_url'] );
  1062.  
  1063. $IPBHTML .= <<<HTML
  1064.     </div>
  1065.     <script type='text/javascript'>
  1066.         jQuery.extend(true, ips,
  1067.         {
  1068.             member:         { member_id: parseInt( $this->memberData['member_id'] ) },
  1069.             acpUrl:         '{$acpUrl}',
  1070.             rootUrl:        '{$this->settings['board_url']}',
  1071.             publicUrl:      '{$this->settings['board_url']}/index.php?}',
  1072.             publicImageUrl: "{$this->settings['skin_app_url']}images/",
  1073.             acpImageUrl:    "{$this->settings['skin_acp_url']}/images/",
  1074.             formToken:      '{$this->member->form_hash}',
  1075.             bookmarksJSON:  {$bookMarks['jsn']}
  1076.         } );       
  1077.     </script>
  1078. </body>
  1079. </html>
  1080. HTML;
  1081. //--endhtml--//
  1082. return $IPBHTML;
  1083. }
  1084.  
  1085. /**
  1086.  * Global page primary template - fits in content area
  1087.  *
  1088.  * @access  public
  1089.  * @return  string      HTML
  1090.  */
  1091. public function global_frame_wrapper() {
  1092.  
  1093. $year = date('Y');
  1094.  
  1095. $IPBHTML = "";
  1096. //--starthtml--//
  1097.  
  1098. $IPBHTML .= <<<EOF
  1099. <%CONTEXT_MENU%>
  1100.  
  1101. <%MSG%>
  1102. <%SECTIONCONTENT%>
  1103.  
  1104. <div id='acpQueries' style='display:none'>
  1105.     <%QUERIES%>
  1106. </div>
  1107. EOF;
  1108.  
  1109. //--endhtml--//
  1110. return $IPBHTML;
  1111. }
  1112.  
  1113. /**
  1114.  * Generate sub navigation menu for global use (all apps)
  1115.  *
  1116.  * @access  public
  1117.  * @param   array       Menu data
  1118.  * @param   array       Application and module titles data
  1119.  * @return  string      array
  1120.  */
  1121. public function global_menu_sub_navigation( $menu ) {
  1122.  
  1123. $seen = array();
  1124. $fakeApps = $this->registry->output->fetchFakeApps();
  1125.  
  1126. foreach( $menu['menu'] as $app => $modules )
  1127. {
  1128.     $this_menu = "<ul id='menu_{$app}' style='display: none'>\r\n";
  1129.  
  1130.     foreach( $modules as $key => $items )
  1131.     {  
  1132.         $this_menu .= "\t<li>\r\n";
  1133.  
  1134.         if( count( $items['items'] ) == 1 )
  1135.         {
  1136.             $real_app   = $items['items'][0]['app_dir'];
  1137.            
  1138.             if ( !ipsRegistry::getClass('class_permissions')->checkForSectionAccess( $real_app, $items['items'][0]['module'], $items['items'][0]['section'] ) )
  1139.             {
  1140.                 continue;
  1141.             }
  1142.            
  1143.             $_url       = ( $items['items'][0]['url'] ) ? "&amp;{$items['items'][0]['url']}" : "";
  1144.             $_title     = $menu['titles'][ $app ][ $key ] ? $menu['titles'][ $app ][ $key ]['title'] : $items['items'][0]['title'];
  1145.             $this_menu .= "\t\t<a href='{$this->settings['_base_url']}app={$real_app}&amp;module={$items['items'][0]['module']}&amp;section={$items['items'][0]['section']}{$_url}'>{$_title}</a>\r\n";
  1146.         }
  1147.         else
  1148.         {
  1149.             $haveItems = FALSE;
  1150.             $_this_menu = "";
  1151.            
  1152.             if( $menu['titles'][ $app ][ $key ] )
  1153.             {
  1154.                 $_this_menu .= "\t\t<span>" . $menu['titles'][ $app ][ $key ]['title'] . "</span>\r\n";
  1155.             }
  1156.             else
  1157.             {
  1158.                 $_this_menu .= "\t\t<span>" . $key . "</span>\r\n";
  1159.             }
  1160.            
  1161.             $_this_menu .= "\t\t<ul>\r\n";
  1162.             foreach( $items['items'] as $i => $info )
  1163.             {
  1164.                 $real_app   = $info['app_dir'];
  1165.                
  1166.                 if ( !ipsRegistry::getClass('class_permissions')->checkForSectionAccess( $real_app, $info['module'], $info['section'] ) )
  1167.                 {
  1168.                     continue;
  1169.                 }
  1170.                 if( is_array( $seen[ $app ][ $info['module'] ] ) && in_array( $info['pos'], $seen[ $app ][ $info['module'] ] ) ){
  1171.                     // Decided to show these because we need to retain access to the options for 3rd party apps
  1172.                     //continue; // don't show sub-sub items
  1173.                 }
  1174.                
  1175.                 $haveItems = TRUE;
  1176.                 $_this_menu .= "\t\t\t<li>\r\n";
  1177.                 $_this_menu .= "\t\t\t\t<a href='{$this->settings['_base_url']}app={$real_app}&amp;module={$info['module']}&amp;section={$info['section']}&amp;{$info['url']}'>{$info['title']}</a>\r\n";
  1178.                 $_this_menu .= "\t\t\t</li>\r\n";
  1179.                
  1180.                 $seen[ $app ][ $info['module'] ][] = $info['pos'];
  1181.             }
  1182.             $_this_menu .= "\t\t</ul>\r\n";
  1183.            
  1184.             if ( $haveItems )
  1185.             {
  1186.                 $this_menu .= $_this_menu;
  1187.             }
  1188.         }
  1189.        
  1190.         $this_menu .= "\t</li>\r\n";
  1191.     }  
  1192.    
  1193.     $this_menu .= "</ul>\r\n";
  1194.    
  1195.     $return[ $app ] = $this_menu;
  1196. }
  1197.  
  1198. //print_r( $seen );
  1199. //print_r($menu);exit;
  1200. //print_r($titles);exit;
  1201.  
  1202. //--endhtml--//
  1203. return $return;
  1204. }
  1205.  
  1206. /**
  1207.  * Generate the application menu HTML
  1208.  *
  1209.  * @access  public
  1210.  * @param   string      Raw menu data
  1211.  * @param   array       Tab order
  1212.  * @return  string      HTML
  1213.  */
  1214. public function global_app_menu_html( $raw_menu, $mainTabData, $otherTabData ) {
  1215.  
  1216. $fakeAppAccess = array();
  1217.  
  1218. $IPBHTML = "";
  1219. //--starthtml--//
  1220.  
  1221. $menus = $this->global_menu_sub_navigation( $raw_menu );
  1222.  
  1223. $defaultFakeApp     = array();
  1224. $defaultFakeModule  = array();
  1225.  
  1226. $IPBHTML .= <<<HTML
  1227. <ul id='app_menu' class='app_menu'>
  1228.     <li>
  1229.         <a href='#' id='bookmarks_button'><img src='{$this->settings['skin_acp_url']}/images/icons/bookmark_white_20.png' /></a>
  1230.         <ul id='bookmarks_items' class='right' style='display:none'></ul>
  1231.     </li>
  1232. HTML;
  1233.  
  1234. $count         = 0;
  1235. $other_menu    = "";
  1236. $otherIsActive = false;
  1237.  
  1238. /* Loop */
  1239. foreach( $otherTabData as $tabkey => $data )
  1240. {
  1241.     $tag = '';
  1242.  
  1243.     if ( ! $data['isEnabled'] || ! $data['permCheck'] )
  1244.     {
  1245.         continue;
  1246.     }
  1247.    
  1248.     if ( $data['active'] )
  1249.     {
  1250.         $otherIsActive = true;
  1251.     }
  1252.    
  1253.     if ( ipsRegistry::$applications[ $data['appDir'] ]['app_location'] == 'ips' || ipsRegistry::$applications[ $data['appDir'] ]['app_location'] == 'root' )
  1254.     {
  1255.         $tag = "<span class='ipsBadge badge_purple'>{$this->lang->words['gl_ipsapp']}</span>&nbsp;&nbsp;";
  1256.     }
  1257.  
  1258.     $other_menu .= <<<EOF
  1259.     <li id='app_{$data['appDir']}'>
  1260.         <a href='{$data['url']}'>
  1261.             {$tag}
  1262.             {$data['title']}
  1263.         </a>
  1264.         {$menus[ $tabkey ]}
  1265.     </li>
  1266. EOF;
  1267.     $count++;
  1268. }
  1269.  
  1270. //-----------------------------------------
  1271. // Draw tabs based on order preference
  1272. //-----------------------------------------
  1273.  
  1274. foreach( $mainTabData as $tabkey => $data )
  1275. {
  1276.     if ( $tabkey == 'other' )
  1277.     {
  1278.         if ( ! $count )
  1279.         {
  1280.             continue;
  1281.         }
  1282.        
  1283.         $data['active'] = $otherIsActive;
  1284.     }
  1285.    
  1286.     if ( ! $data['isEnabled'] || ! $data['permCheck'] )
  1287.     {
  1288.         continue;
  1289.     }
  1290.        
  1291.     $class = ( $data['active'] ) ? 'active' : '';
  1292.    
  1293.     if( $tabkey == 'other' )
  1294.     {
  1295.     $IPBHTML .= <<<HTML
  1296.         <li class='{$class}'>
  1297.             <a href='{$this->settings['_base_url']}app=core&amp;module=applications&amp;section=applications&amp;do=applications_overview'>{$this->lang->words['other_applications']}</a>
  1298.             <ul id='menu__other' style='display: none'>
  1299.                 {$other_menu}
  1300.             </ul>
  1301.         </li>  
  1302. HTML;
  1303.     }
  1304.     else
  1305.     {
  1306.     $IPBHTML .= <<<HTML
  1307.     <li class='{$class}'>
  1308.         <a href='{$data['url']}'>{$data['title']}</a>
  1309.         {$menus[ $tabkey ]}
  1310.     </li>
  1311. HTML;
  1312.     }
  1313. }
  1314.  
  1315. $IPBHTML .= "</ul>";
  1316.  
  1317. //--endhtml--//
  1318. return $IPBHTML;
  1319. }
  1320.  
  1321. /**
  1322.  * Show the information box on the page
  1323.  *
  1324.  * @access  public
  1325.  * @param   string      Box title
  1326.  * @param   string      Box content
  1327.  * @return  string      HTML
  1328.  */
  1329. public function information_box($title="", $content="") {
  1330.  
  1331. $IPBHTML = "";
  1332. //--starthtml--//
  1333.  
  1334. $IPBHTML .= <<<EOF
  1335. <div class='section_title'>
  1336.     <h2>{$title}</h2>
  1337. </div>
  1338. <div class='section_info'>{$content}</div>
  1339. EOF;
  1340.  
  1341. //--endhtml--//
  1342. return $IPBHTML;
  1343. }
  1344.  
  1345. /**
  1346.  * Show a warning box
  1347.  *
  1348.  * @access  public
  1349.  * @param   string      Title
  1350.  * @param   string      Content
  1351.  * @return  string      HTML
  1352.  */
  1353. public function warning_box($title="", $content="") {
  1354.  
  1355. $IPBHTML = "";
  1356. //--starthtml--//
  1357.  
  1358. $IPBHTML .= <<<EOF
  1359. <div class='warning'>
  1360.  <h4>{$title}</h4>
  1361.  {$content}
  1362. </div>
  1363. EOF;
  1364.  
  1365. //--endhtml--//
  1366. return $IPBHTML;
  1367. }
  1368.  
  1369. /**
  1370.  * Shows the debug query output at the bottom of the page
  1371.  *
  1372.  * @access  public
  1373.  * @param   string      Queries to show
  1374.  * @return  string      HTML
  1375.  */
  1376. public function global_query_output($queries="") {
  1377.  
  1378. $IPBHTML = "";
  1379. //--starthtml--//
  1380.  
  1381. $IPBHTML .= <<<EOF
  1382. <br /><br />
  1383. <div align='center' class='clear' style='margin-left:auto;margin-right:0'>
  1384. <div class='acp-box' style='text-align:left;'>
  1385.  <h3>{$this->lang->words['gbl_queries']}</h3>
  1386.  <div style='overflow:auto'>{$queries}</div>
  1387. </div>
  1388. </div>
  1389. EOF;
  1390.  
  1391. //--endhtml--//
  1392. return $IPBHTML;
  1393. }
  1394.  
  1395. /**
  1396.  * Shows the debug included files output at the bottom of the page
  1397.  *
  1398.  * @param   int         Number of files
  1399.  * @param   string      Files to show
  1400.  * @return  string      HTML
  1401.  */
  1402. public function global_if_output($count=0,$files="") {
  1403.  
  1404. $IPBHTML = "";
  1405. //--starthtml--//
  1406.  
  1407. $IPBHTML .= <<<EOF
  1408. <br /><br />
  1409. <div align='center' style='margin-left:auto;margin-right:0'>
  1410. <div class='acp-box' style='text-align:left;'>
  1411.  <h3>{$count} {$this->lang->words['gbl_inc_files']}</h3>
  1412.  <div style='padding: 4px;'>{$files}</div>
  1413. </div>
  1414. </div>
  1415. EOF;
  1416.  
  1417. //--endhtml--//
  1418. return $IPBHTML;
  1419. }
  1420.  
  1421. /**
  1422.  * Shows the debug memory output at the bottom of the page
  1423.  *
  1424.  * @access  public
  1425.  * @param   string      Memory to show
  1426.  * @param   string      Total memory used
  1427.  * @param   string      Peak memory used
  1428.  * @return  string      HTML
  1429.  */
  1430. public function global_memory_output($memory="", $total=0, $peak=0 ) {
  1431.  
  1432. $IPBHTML = "";
  1433. //--starthtml--//
  1434.  
  1435. $IPBHTML .= <<<EOF
  1436. <br /><br />
  1437. <div align='center' style='margin-left:auto;margin-right:0'>
  1438. <div class='acp-box' style='text-align:left;'>
  1439.     <h3>{$this->lang->words['gbl_memory']}</h3>
  1440.     <table class='ipsTable'>
  1441.         {$memory}
  1442.     </table>
  1443.     <div class='acp-actionbar' style='text-align: left;'>
  1444.         <strong>{$this->lang->words['ttlmemoryused']} {$total} ({$this->lang->words['peakmemoryused']} {$peak})</strong>
  1445.     </div>
  1446. </div>
  1447. </div>
  1448. EOF;
  1449.  
  1450. //--endhtml--//
  1451. return $IPBHTML;
  1452. }
  1453.  
  1454. /**
  1455.  * Show the login form
  1456.  *
  1457.  * @access  public
  1458.  * @param   string      Query string to remember
  1459.  * @param   string      Message to show
  1460.  * @param   bool        Replace the form (deprecated)
  1461.  * @param   array       Additional data to add to the form
  1462.  * @return  string      HTML
  1463.  */
  1464. public function log_in_form( $query_string="", $message="", $replace_form=false, $additional_data=array() ) {
  1465.  
  1466. $IPBHTML = "";
  1467. //--starthtml--//
  1468.  
  1469. $IPS_DOC_CHAR_SET   = IPS_DOC_CHAR_SET;
  1470. $publicDirectory    = PUBLIC_DIRECTORY;
  1471.  
  1472. if ( $this->settings['logins_over_https'] )
  1473. {
  1474.     $this->settings['skin_acp_url'] = str_replace( 'http://', 'https://', $this->settings['skin_acp_url'] );
  1475.     $this->settings['public_dir'] = str_replace( 'http://', 'https://', $this->settings['public_dir'] );
  1476.     $this->settings['js_main_url'] = str_replace( 'http://', 'https://', $this->settings['js_main_url'] ); 
  1477. }
  1478.  
  1479. $IPBHTML .= <<<HTML
  1480. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  1481. <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
  1482. <head>
  1483.     <meta http-equiv="content-type" content="text/html; charset={$IPS_DOC_CHAR_SET}" />
  1484.     <meta http-equiv="Pragma" content="no-cache" />
  1485.     <meta http-equiv="Cache-Control" content="no-cache" />
  1486.     <meta http-equiv="Expires" content="Fri, 01 January 1999 01:00:00 GMT" />
  1487.     <link rel="shortcut icon" href='favicon.ico' />
  1488.  
  1489.     <title><%TITLE%></title>
  1490.     <script type='text/javascript'>
  1491.         jsDebug = 1;
  1492.         USE_RTE = 0;
  1493.         isRTL   = false;
  1494.        
  1495.         if ( top != self )
  1496.         {
  1497.             top.location.href = window.location.href;
  1498.         }
  1499.     </script>
  1500. HTML;
  1501.  
  1502.  
  1503. /** CSS ----------------------------------------- */
  1504. /*if ( $this->settings['use_minify'] )
  1505. {
  1506.     $_basics    = CP_DIRECTORY . '/skin_cp/acp.css,' . CP_DIRECTORY . '/skin_cp/acp_editor.css';
  1507.  
  1508.     $IPBHTML    .= "\n\t<link rel=\"stylesheet\" type=\"text/css\" media='screen' href=\"{$this->settings['public_dir']}min/index.php?ipbv={$this->registry->output->antiCacheHash}&amp;f={$_basics}\">\n";
  1509. }
  1510. else
  1511. {*/
  1512.     $IPBHTML .= <<<HTML
  1513.     <style type='text/css' media='all'>
  1514.         @import url( "{$this->settings['skin_acp_url']}/acp.css?ipbv={$this->registry->output->antiCacheHash}" );
  1515.         @import url( "{$this->settings['skin_acp_url']}/acp_editor.css?ipbv={$this->registry->output->antiCacheHash}" );
  1516.     </style>
  1517. HTML;
  1518. //}
  1519.  
  1520. $IPBHTML .= <<<HTML
  1521.     <!--[if IE]>
  1522.         <style type='text/css' media='all'>
  1523.             @import url( "{$this->settings['skin_acp_url']}/acp_ie_tweaks.css?ipbv={$this->registry->output->antiCacheHash}" );
  1524.         </style>
  1525.     <![endif]-->
  1526. HTML;
  1527.  
  1528. if( IN_DEV )
  1529. {
  1530.     $IPBHTML .= <<<HTML
  1531.         <style type='text/css' media='all'>
  1532.             .ipsActionBar > ul > li.inDev {
  1533.                 display: inline;
  1534.             }
  1535.         </style>
  1536. HTML;
  1537. }
  1538.  
  1539. /** JS ----------------------------------------- */
  1540. /*if ( $this->settings['use_minify'] )
  1541. {
  1542.     $_others = ',' . CP_DIRECTORY . '/js/acp.js,' . CP_DIRECTORY . '/js/acp.' . implode('.js,' . CP_DIRECTORY . '/js/acp.', array( 'menu', 'tabs' ) ) . '.js';
  1543.    
  1544.     $IPBHTML .= <<<HTML
  1545.    
  1546.     <script type='text/javascript' src='{$this->settings['public_dir']}min/index.php?g=js&amp;ipbv={$this->registry->output->antiCacheHash}'></script>
  1547.     <script type='text/javascript' src='{$this->settings['public_dir']}min/index.php?ipbv={$this->registry->output->antiCacheHash}&amp;f={$publicDirectory}/js/ipb.js{$_others}'></script>
  1548. HTML;
  1549. }
  1550. else
  1551. {*/
  1552.     $IPBHTML .= <<<HTML
  1553.         <script type="text/javascript" src="{$this->settings['public_dir']}js/3rd_party/prototype.js?ipbv={$this->registry->output->antiCacheHash}"></script>
  1554.         <script type='text/javascript' src='{$this->settings['public_dir']}js/3rd_party/scriptaculous/scriptaculous-cache.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  1555.         <script type="text/javascript" src='{$this->settings['public_dir']}js/ipb.js?ipbv={$this->registry->output->antiCacheHash}&amp;load={$this->settings['extraJsModules']}'></script>
  1556.         <script type='text/javascript' src='{$this->settings['js_main_url']}acp.menu.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  1557.         <script type='text/javascript' src='{$this->settings['js_main_url']}acp.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  1558.         <script type="text/javascript" src='{$this->settings['js_main_url']}acp.tabs.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  1559. HTML;
  1560. //}
  1561.  
  1562. $IPBHTML .= <<<HTML
  1563.     <script type='text/javascript'>
  1564.     //<![CDATA[
  1565.         ipb.vars['st']  = "{$this->request['st']}";
  1566.         ipb.vars['base_url']    = "{$this->settings['_base_url']}";
  1567.         ipb.vars['front_url']   = "{$this->settings['board_url']}/index.php?";
  1568.         ipb.vars['app_url']     = "{$this->settings['base_url']}";
  1569.         ipb.vars['image_url']   = "{$this->settings['skin_app_url']}/images/";
  1570.         ipb.vars['md5_hash']    = "{$this->member->form_hash}";
  1571.         /* ---- cookies ----- */
  1572.         ipb.vars['cookie_id']           = '{$this->settings['cookie_id']}';
  1573.         ipb.vars['cookie_domain']       = '{$this->settings['cookie_domain']}';
  1574.         ipb.vars['cookie_path']         = '{$this->settings['cookie_path']}';
  1575.         ipb.templates['close_popup']    = "<img src='{$this->settings['img_url']}/close_popup.png' alt='x' />";
  1576.         ipb.templates['page_jump']      = new Template("<div id='#{id}_wrap' class='ipbmenu_content'><h3 class='bar'>{$this->lang->words['gl_pagejump']}</h3><input type='text' class='input_text' id='#{id}_input' size='8' /> <input type='submit' value='Go' class='input_submit add_folder' id='#{id}_submit' /></div>");
  1577.         ipb.templates['ajax_loading']   = "<div id='ajax_loading'>{$this->lang->words['gl_loading']}</div>";
  1578.     //]]>
  1579.     </script>
  1580.     <script type='text/javascript'>
  1581.         Loader.boot();
  1582.         acp = new IPBACP;
  1583.  
  1584.         Event.observe( window, 'load', function(e){
  1585.             $('username').focus();
  1586.         });
  1587.     </script>
  1588.     <script type="text/javascript" src="{$this->settings['cache_dir']}lang_cache/{$this->lang->lang_id}/acp.lang.js?ipbv={$this->registry->output->antiCacheHash}" charset="{$IPS_DOC_CHAR_SET}"></script>
  1589. </head>
  1590. <body id='ipboard_body' class='login_screen'>
  1591. <div id='loading-layer' style='display:none'>
  1592.     <div id='loading-layer-shadow'>
  1593.        <div id='loading-layer-inner' >
  1594.            <img src='{$this->settings['skin_acp_url']}/images/loading_anim.gif' style='vertical-align:middle' />
  1595.            <span style='font-weight:bold' id='loading-layer-text'>{$this->lang->words['ajax_please_wait']}</span>
  1596.        </div>
  1597.     </div>
  1598. </div>
  1599. HTML;
  1600.  
  1601. $extraClass = ( $message ) ? 'with_message' : '';
  1602.  
  1603. if( $replace_form )
  1604. {
  1605.     $IPBHTML .= $additional_data[0];
  1606. }
  1607. else
  1608. {
  1609.     $url = "{$this->settings['_base_url']}app=core&amp;module=login&amp;do=login-complete";
  1610.     if ( $this->settings['logins_over_https'] )
  1611.     {
  1612.         $url = str_replace( 'http://', 'https://', $url );
  1613.     }
  1614.  
  1615.     $IPBHTML .= <<<HTML
  1616. <form action='{$url}' method='post'>
  1617. <input type='hidden' name='qstring' id='qstring' value='{$query_string}' />
  1618. <div id='login' class='{$extraClass}'>
  1619.     <img src='{$this->settings['skin_acp_url']}/images/login_logo.png' id='login_logo' />
  1620. HTML;
  1621.  
  1622. if ( $message )
  1623. {
  1624.     $IPBHTML .= <<<HTML
  1625.         <div id='login_error'>{$message}</div>
  1626. HTML;
  1627. }
  1628.  
  1629. $IPBHTML .= <<<HTML
  1630.     <div id='login_controls'>
  1631.         <label for='username'>{$this->lang->words['gl_signinname']}</label>
  1632.         <input type='text' size='20' id='username' name='username' value='' class='textinput'>
  1633.        
  1634.         <label for='password'>{$this->lang->words['gl_password']}</label>
  1635.         <input type='password' size='20' id='password' name='password' value='' class='textinput'>
  1636. HTML;
  1637.  
  1638.         if( count($additional_data) > 0 )
  1639.         {
  1640.             foreach( $additional_data as $form_html )
  1641.             {
  1642.                 $IPBHTML .= $form_html;
  1643.             }
  1644.         }
  1645.        
  1646. $IPBHTML .= <<<HTML
  1647.     </div>
  1648.     <div id='login_submit'>
  1649.         <input type='submit' class='button' value="{$this->lang->words['gl_signin']}" />
  1650.     </div>
  1651. </div>
  1652. </form>
  1653. HTML;
  1654.  
  1655. $IPBHTML .= <<<HTML
  1656.         </div>
  1657.     </div>
  1658.     </form>
  1659.     <script type='text/javascript'>
  1660.         $('username').focus();
  1661.     </script>
  1662. </body>
  1663. </html>
  1664. HTML;
  1665. }
  1666.  
  1667. //--endhtml--//
  1668. return $IPBHTML;
  1669. }
  1670.  
  1671. /**
  1672.  * Redirect hit for auto-redirecting pages (e.g. "recache all caches")
  1673.  *
  1674.  * @access  public
  1675.  * @param   string      URL to send to
  1676.  * @param   string      Text to show
  1677.  * @param   integer     Number of seconds to wait
  1678.  * @return  string      HTML
  1679.  */
  1680. public function global_redirect_hit($url, $text="", $time=1) {
  1681.  
  1682. $IPBHTML = "";
  1683. //--starthtml--//
  1684.  
  1685. $IPBHTML .= <<<EOF
  1686. <script type='text/javascript'>
  1687.     jsDebug = 0;
  1688.     USE_RTE = 0;
  1689. </script>
  1690. <script type="text/javascript" src="{$this->settings['public_dir']}js/3rd_party/prototype.js?ipbv={$this->registry->output->antiCacheHash}"></script>
  1691. <script type='text/javascript' src='{$this->settings['public_dir']}js/3rd_party/scriptaculous/scriptaculous-cache.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  1692. <script type="text/javascript" src='{$this->settings['public_dir']}js/ipb.js?ipbv={$this->registry->output->antiCacheHash}&amp;load={$this->settings['extraJsModules']}'></script>
  1693. <script type='text/javascript' src='{$this->settings['js_main_url']}acp.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  1694. <script type="text/javascript" src='{$this->settings['js_main_url']}acp.tabs.js?ipbv={$this->registry->output->antiCacheHash}'></script>
  1695. <script type="text/javascript">
  1696. //<![CDATA[
  1697.  
  1698. ipb.vars['st']  = "{$this->request['st']}";
  1699.  
  1700. ipb.vars['base_url']    = "{$this->settings['_base_url']}";
  1701. ipb.vars['front_url']   = "{$this->settings['board_url']}/index.php?";
  1702. ipb.vars['app_url'] = "{$this->settings['base_url']}";
  1703. ipb.vars['image_url']   = "{$this->settings['skin_app_url']}/images/";
  1704. ipb.vars['md5_hash']    = "{$this->member->form_hash}";
  1705. /* ---- cookies ----- */
  1706. ipb.vars['cookie_id']           = '{$this->settings['cookie_id']}';
  1707. ipb.vars['cookie_domain']       = '{$this->settings['cookie_domain']}';
  1708. ipb.vars['cookie_path']         = '{$this->settings['cookie_path']}';
  1709.  
  1710. Loader.boot();
  1711. acp = new IPBACP;
  1712. //]]>
  1713. </script>
  1714.  
  1715. <style type='text/css' media='all'>
  1716.     @import url( "{$this->settings['skin_acp_url']}/acp.css?ipbv={$this->registry->output->antiCacheHash}" );
  1717. </style>
  1718.  
  1719. <meta http-equiv='refresh' content='{$time}; url={$url}' />
  1720.  
  1721. <div class='information-box'>
  1722.     <h4>{$this->lang->words['gbl_page_redirecting']}</h4>
  1723.     {$this->lang->words['page_will_refresh']} <a href='$url'>{$this->lang->words['refresh_dont_wait']}</a>
  1724. </div>
  1725. <br />
  1726. <div class='redirector'>
  1727.     <div class='info'>{$text}</div>
  1728. </div>
  1729.  
  1730. EOF;
  1731.  
  1732. //--endhtml--//
  1733. return $IPBHTML;
  1734. }
  1735.  
  1736. /**
  1737.  * Initialize global redirection javascript for AJAX redirecting
  1738.  *
  1739.  * @access  public
  1740.  * @param   string      URL to redirect to
  1741.  * @param   string      Text to show
  1742.  * @param   string      Additional text to add
  1743.  * @return  string      HTML
  1744.  */
  1745. public function global_ajax_redirect_init($url='', $text='', $addtotext='') {
  1746.  
  1747. $IPBHTML = "";
  1748. //--starthtml--//
  1749.  
  1750. $IPBHTML .= <<<EOF
  1751. <div class='redirector'>
  1752.     <div class='info' id='refreshbox'>{$this->lang->words['gbl_initializing']}</div>   
  1753. </div>
  1754. <script type='text/javascript'>
  1755. //<![CDATA[
  1756. acp.ajaxRefresh( '$url', '$text', $addtotext );
  1757. //]]>
  1758. </script>
  1759. EOF;
  1760.  
  1761. //--endhtml--//
  1762. return $IPBHTML;
  1763. }
  1764.  
  1765. /**
  1766.  * Global redirection completed page
  1767.  *
  1768.  * @access  public
  1769.  * @param   string      Text to show
  1770.  * @return  string      HTML
  1771.  */
  1772. public function global_redirect_done($text='This function has now finished executing') {
  1773.  
  1774. $IPBHTML = "";
  1775. //--starthtml--//
  1776.  
  1777. $IPBHTML .= <<<EOF
  1778. <style type='text/css' media='all'>
  1779.     @import url( "{$this->settings['skin_acp_url']}/acp.css?ipbv={$this->registry->output->antiCacheHash}" );
  1780. </style>
  1781.  
  1782. <div class='redirector complete'>
  1783.     <div class='info'>{$text}</div>
  1784. </div>
  1785.  
  1786. EOF;
  1787.  
  1788. //--endhtml--//
  1789. return $IPBHTML;
  1790. }
  1791.  
  1792. /**
  1793.  * General redirect page with message
  1794.  *
  1795.  * @access  public
  1796.  * @param   string      URL to send to
  1797.  * @param   integer     Number of seconds to wait before redirecting
  1798.  * @param   string      Text to display
  1799.  * @return  string      HTML
  1800.  */
  1801. public function global_redirect_halt($url) {
  1802.  
  1803. $IPBHTML = "";
  1804. //--starthtml--//
  1805.  
  1806.  
  1807. $IPBHTML .= <<<EOF
  1808. <div class='warning'>
  1809.  <h4>{$this->lang->words['redirect_halt_title']}</h4>
  1810.     <p><strong>{$this->registry->output->global_error}</strong></p>
  1811.     <br />
  1812.     <ul>
  1813.         <li style='font-weight:bold'><a href='$url'>{$this->lang->words['redirect_halt_continue']}</a></a>
  1814.         <li><a href='{$this->settings['this_url']}'>{$this->lang->words['redirect_repeat_step']}</a>
  1815.     </ul>
  1816. </div>
  1817. EOF;
  1818.  
  1819. $this->registry->output->global_error = '';
  1820.  
  1821. //--endhtml--//
  1822. return $IPBHTML;
  1823. }
  1824.  
  1825. /**
  1826.  * Generate sub navigation menu for sidebar
  1827.  *
  1828.  * @access  public
  1829.  * @param   array       Menu data
  1830.  * @return  string      HTML
  1831.  */
  1832. public function menu_sub_navigation( $menu ) {
  1833.  
  1834. $main_html = array();
  1835. $IPBHTML   = "";
  1836. //--starthtml--//
  1837.  
  1838. if( is_array($menu[ ipsRegistry::$current_application ]) AND count($menu[ ipsRegistry::$current_application ]) )
  1839. {
  1840. foreach( $menu[ ipsRegistry::$current_application ] as $id => $data )
  1841. {
  1842.     $links = "";
  1843.     $_id   = preg_replace( '/^\d+?_(.*)$/', "\\1", $id );
  1844.  
  1845.     if ( $_id != ipsRegistry::$current_module )
  1846.     {
  1847.         continue;
  1848.     }
  1849.  
  1850.     foreach( $data['items'] as $_id => $_data )
  1851.     {
  1852.         $_url   = ( $_data['url'] ) ? "&amp;{$_data['url']}" : "";
  1853. $links .= <<<EOF
  1854.         <div class='menulinkwrapBlock'>
  1855.             <a href="{$this->settings['base_url']}module={$_data['module']}&amp;section={$_data['section']}{$_url}">{$_data['title']}</a>
  1856.         </div>
  1857. EOF;
  1858.     }
  1859.    
  1860.     if ( $links )
  1861.     {
  1862. $main_html[] = <<<EOF
  1863. <!-- MENU FOR {$data['title']}-->
  1864. <div class='menuouterwrap'>
  1865.   <div class='menucatwrapBlock'>{$data['title']}</div>
  1866.   {$links}
  1867. </div>
  1868. <!-- / MENU FOR {$data['title']}-->
  1869. EOF;
  1870.     }
  1871. }
  1872. }
  1873.  
  1874. if ( is_array( $main_html ) AND count( $main_html ) )
  1875. {
  1876. $IPBHTML .= <<<EOF
  1877. <div id='subMenuWrap'>
  1878. EOF;
  1879. $IPBHTML .= implode( "<br />", $main_html );
  1880. $IPBHTML .= <<<EOF
  1881. </div>
  1882. EOF;
  1883. }
  1884.  
  1885. //--endhtml--//
  1886. return $IPBHTML;
  1887. }
  1888.  
  1889. /**
  1890.  * Menu category wrapper for sidebar "categories"
  1891.  *
  1892.  * @access  public
  1893.  * @param   array       Links to show
  1894.  * @param   string      Module (cleaned)
  1895.  * @param   array       Menu items to show
  1896.  * @return  string      HTML
  1897.  */
  1898. public function menu_cat_wrap( $links=array(), $clean_module="", $menu=array() ) {
  1899.  
  1900. $IPBHTML = "";
  1901. $seen    = 0;
  1902. $titles  = 0;
  1903.  
  1904. //--starthtml--//
  1905.  
  1906.     foreach( $links as $app => $module )
  1907.     {
  1908.         $IPBHTML    .= "<ul>\n";
  1909.         $_CHILD     = '';
  1910.         $_MENU      = '';
  1911.        
  1912.         foreach( $module as $data )
  1913.         {
  1914.             $class = '';
  1915.  
  1916.             if ( $app == ipsRegistry::$current_application AND $clean_module == $data['module'] )
  1917.             {
  1918.                 $class = 'active';
  1919.             }
  1920.  
  1921.             if( isset( $menu[ $app ] ) && is_array( $menu[ $app ] ) )
  1922.             {
  1923.                 foreach( $menu[ $app ] as $id => $__data )
  1924.                 {
  1925.                     //print_r($__data);exit;
  1926.                     preg_match( '/^(\d+?)_(.*)$/', $id, $result );
  1927.  
  1928.                     if ( $result[2] != $data['module'] )
  1929.                     {
  1930.                         continue;
  1931.                     }
  1932.  
  1933.                     /* Heres where we check whether this is a single item */
  1934.                     if( intval($result[1]) === 0 )
  1935.                     {
  1936.                         $_single_item   = true;
  1937.                         $_count         = 0;
  1938.                        
  1939.                         foreach( $menu[ $app ] as $__k => $__v )
  1940.                         {
  1941.                             if ( preg_match( '/(\d+?)_' . $result[2] . "/", $__k ) )
  1942.                             {
  1943.                                 $_count++;
  1944.                             }
  1945.                         }
  1946.  
  1947.                         if( $_count > 1 )
  1948.                         {
  1949.                             $_single_item   = false;
  1950.                         }
  1951.  
  1952.                         if( $_single_item )
  1953.                         {
  1954.                             $_url   = ( $__data['items'][0]['url'] ) ? "&amp;{$__data['items'][0]['url']}" : "";
  1955.                            
  1956.                             $_MENU .=  <<<EOF
  1957.                                 <!-- UHM MENU FOR {$data['title']}-->
  1958.                                 <li class='{$class}'>
  1959.                                     <a href='{$this->settings['_base_url']}app={$app}&amp;module={$__data['items'][0]['module']}&amp;section={$__data['items'][0]['section']}{$_url}'>{$__data['title']}</a>
  1960.                                 </li>
  1961. EOF;
  1962.  
  1963.                             continue(2);
  1964.                         }
  1965.                     }
  1966.                     /* /end */
  1967.  
  1968.                     if ( count( $__data['items'] ) > 1 )
  1969.                     {
  1970.     $_CHILD .= <<<EOF
  1971.                     <li>
  1972.                         <a href='{$this->settings['_base_url']}app={$app}&amp;module={$__data['items'][0]['module']}&amp;section={$__data['items'][0]['section']}&amp;{$__data['items'][0]['url']}'>{$__data['items'][0]['title']}</a>
  1973.                         <ul>
  1974. EOF;
  1975.                        
  1976.                         $_seen              = 0;
  1977.                         $seen_in_this_group = 0;
  1978.                         foreach( $__data['items'] as $_id => $_data )
  1979.                         {
  1980.                             $_seen++;
  1981.                            
  1982.                             if( $seen_in_this_group == 0 )
  1983.                             {
  1984.                                 $seen_in_this_group++;
  1985.                                 continue;
  1986.                             }
  1987.                            
  1988.                             $_class = '';
  1989.                             $_url   = ( $_data['url'] ) ? "&amp;{$_data['url']}" : "";
  1990.  
  1991.                             if ( $_seen == count( $__data['items'] ) )
  1992.                             {
  1993.                                 $_class = 'last';
  1994.                             }
  1995.  
  1996.     $_CHILD .= <<<EOF
  1997.                             <li class='{$_class}'><a href="{$this->settings['_base_url']}app={$app}&amp;module={$_data['module']}&amp;section={$_data['section']}{$_url}">{$_data['title']}</a></li>
  1998. EOF;
  1999.                         }
  2000.  
  2001.     $_CHILD .= <<<EOF
  2002.                         </ul>
  2003.                     </li>
  2004. EOF;
  2005.                     ####### / MORE THAN 1 CHILD ITEM    #######
  2006.                     }
  2007.                     else
  2008.                     {
  2009.                         $_url = ( $__data['items'][0]['url'] ) ? "&amp;{$__data['items'][0]['url']}" : "";
  2010.     $_CHILD .= <<<EOF
  2011.                     <li>
  2012.                         <a href="{$this->settings['_base_url']}app={$app}&amp;module={$__data['items'][0]['module']}&amp;section={$__data['items'][0]['section']}{$_url}">{$__data['items'][0]['title']}</a>
  2013.                     </li>
  2014.  
  2015. EOF;
  2016.                     }
  2017.                 }
  2018.                
  2019.                 if( $_CHILD )
  2020.                 {
  2021.                 $_MENU .= <<<EOF
  2022.                         <!-- MENU FOR {$data['title']}-->
  2023.                         <li class='{$class} has_sub'>
  2024.                             {$data['title']}
  2025.                             <ul>
  2026.                                 {$_CHILD}
  2027.                             </ul>
  2028.                         </li>
  2029. EOF;
  2030.                 }
  2031.                 $_CHILD = '';
  2032.  
  2033.             }
  2034.         }
  2035.  
  2036.         $IPBHTML .= <<<EOF
  2037.  
  2038.         {$_MENU}
  2039.         </ul>
  2040. EOF;
  2041.  
  2042.     }
  2043.  
  2044. //--endhtml--//
  2045.     return $IPBHTML;
  2046. }
  2047.  
  2048. /**
  2049.  * Navigation HTML wrapper
  2050.  *
  2051.  * @access  public
  2052.  * @param   string      Menu content
  2053.  * @return  string      HTML
  2054.  */
  2055. public function wrap_nav($content="") {
  2056.  
  2057. $IPBHTML = "";
  2058. //--starthtml--//
  2059.  
  2060. $IPBHTML .= <<<EOF
  2061. <ol id='breadcrumb'>
  2062.     {$content}
  2063. </ol>
  2064. EOF;
  2065.  
  2066. //--endhtml--//
  2067. return $IPBHTML;
  2068. }
  2069.  
  2070. /**
  2071.  * Global informational message to display
  2072.  *
  2073.  * @access  public
  2074.  * @return  string      HTML
  2075.  */
  2076. public function global_message() {
  2077. $IPBHTML = "";
  2078. //--starthtml--//
  2079.  
  2080. if( !$this->registry->getClass('output')->persistent_message )
  2081. {
  2082. $IPBHTML .= <<<EOF
  2083. <script type='text/javascript'>
  2084.     document.observe("dom:loaded", function(){
  2085.         ipb.global.showInlineNotification( "{$this->registry->getClass('output')->global_message}", { showClose: false } );
  2086.     });
  2087. </script>
  2088. EOF;
  2089. }
  2090. else
  2091. {
  2092. $IPBHTML .= <<<EOF
  2093. <div class='information-box'>
  2094. EOF;
  2095.     $IPBHTML .= $this->registry->getClass('output')->global_message;
  2096.  
  2097. $IPBHTML .= <<<EOF
  2098. </div>
  2099. <br />
  2100. EOF;
  2101. }
  2102.  
  2103. //--endhtml--//
  2104. return $IPBHTML;
  2105. }
  2106.  
  2107.  
  2108. /**
  2109.  * Global error message to display
  2110.  *
  2111.  * @access  public
  2112.  * @return  string      HTML
  2113.  */
  2114. public function global_error_message() {
  2115. $IPBHTML = "";
  2116. //--starthtml--//
  2117.  
  2118. $IPBHTML .= <<<EOF
  2119. <div class='warning'>
  2120.     <h4>{$this->lang->words['ipb_message']}</h4>
  2121.     {$this->registry->output->global_error}
  2122. </div>
  2123. <br />
  2124. EOF;
  2125.  
  2126. //--endhtml--//
  2127. return $IPBHTML;
  2128. }
  2129.  
  2130. /**
  2131.  * Pagination wrapper
  2132.  *
  2133.  * @access  public
  2134.  * @param   array       Work data
  2135.  * @param   array       Pagination data
  2136.  * @return  string      HTML
  2137.  */
  2138. public function paginationTemplate( $work, $data ) {
  2139. $IPBHTML = "";
  2140. //--starthtml--//
  2141.  
  2142. if( $work['pages'] > 1 )
  2143. {
  2144. $IPBHTML .= <<<EOF
  2145.     <ul class='pagination'>
  2146. EOF;
  2147.  
  2148.     if( !$data['noDropdown'] )
  2149.     {
  2150.         $IPBHTML .= <<<EOF
  2151.         <li class='pagejump pj{$data['uniqid']}'>
  2152.             <img src='{$this->settings['skin_acp_url']}/images/dropdown.png' alt='+' />
  2153.             <script type='text/javascript'>
  2154.                 ipb.global.registerPageJump( '{$data['uniqid']}', { url: "{$data['baseUrl']}", stKey: '{$data['startValueKey']}', perPage: {$data['itemsPerPage']}, totalPages: {$work['pages']} } );
  2155.             </script>
  2156.         </li>
  2157. EOF;
  2158.     }
  2159.  
  2160. if( 1 < ($work['current_page'] - $data['dotsSkip']) )
  2161. {
  2162. $IPBHTML .= <<<EOF
  2163.     <li class='first'><a href='{$data['baseUrl']}&amp;{$data['startValueKey']}=0' title='{$this->lang->words['tpl_gotofirst']}' rel='start'>{$this->lang->words['_laquo']} {$this->lang->words['tpl_isfirst']}</a></li>
  2164. EOF;
  2165. }
  2166.  
  2167. if( $work['current_page'] > 1 )
  2168. {
  2169.     $stkey = intval( $data['currentStartValue'] - $data['itemsPerPage'] );
  2170. $IPBHTML .= <<<EOF
  2171.     <li class='prev'><a href="{$data['baseUrl']}&amp;{$data['startValueKey']}={$stkey}" title="{$this->lang->words['tpl_prev']}" rel='prev'>{$this->lang->words['pg_prev']}</a></li>
  2172. EOF;
  2173. }
  2174.  
  2175. if( count($work['_pageNumbers']) AND is_array($work['_pageNumbers']) )
  2176. {
  2177.     foreach( $work['_pageNumbers'] as $_real => $_page )
  2178.     {
  2179.         if( $_real == $data['currentStartValue'] )
  2180.         {
  2181.         $IPBHTML .= <<<EOF
  2182.             <li class='active'>{$_page}</li>
  2183. EOF;
  2184.         }
  2185.         else
  2186.         {
  2187.         $IPBHTML .= <<<EOF
  2188.             <li><a href="{$data['baseUrl']}&amp;{$data['startValueKey']}={$_real}" title="{$_page}">{$_page}</a></li>
  2189. EOF;
  2190.         }
  2191.     }
  2192. }
  2193.  
  2194. if( $work['current_page'] < $work['pages'] )
  2195. {
  2196.     $stkey = intval( $data['currentStartValue'] + $data['itemsPerPage'] );
  2197. $IPBHTML .= <<<EOF
  2198.     <li class='next'><a href="{$data['baseUrl']}&amp;{$data['startValueKey']}={$stkey}" title="{$this->lang->words['tpl_next']}" rel='next'>{$this->lang->words['pg_next']}</a></li>
  2199. EOF;
  2200. }
  2201.  
  2202. if( !empty( $work['_showEndDots'] ) )
  2203. {
  2204.     $stkey = intval( ( $work['pages'] - 1 ) * $data['itemsPerPage'] );
  2205. $IPBHTML .= <<<EOF
  2206.     <li class='last'><a href="{$data['baseUrl']}&amp;{$data['startValueKey']}={$stkey}" title="{$this->lang->words['tpl_gotolast']}" rel='last'>{$this->lang->words['tpl_islast']} {$this->lang->words['_raquo']}</a></li>
  2207. EOF;
  2208. }
  2209.  
  2210. $_tplpages  = sprintf( $this->lang->words['tpl_pages_acp'], $work['current_page'], $work['pages'] );
  2211.  
  2212. $IPBHTML .= <<<EOF
  2213.         <li class='total'>({$_tplpages})</li>
  2214.     </ul>
  2215. EOF;
  2216. }
  2217. else
  2218. {
  2219.     $IPBHTML .= <<<EOF
  2220.     <span class='pagination no_pages'>{$this->lang->words['page_1_of_1']}</span>
  2221. EOF;
  2222. }
  2223. //--endhtml--//
  2224. return $IPBHTML;
  2225. }
  2226.  
  2227.  
  2228. /**
  2229.  * System error page
  2230.  *
  2231.  * @access  public
  2232.  * @param   string      Error message to show
  2233.  * @param   integer     Error code
  2234.  * @param   string      Error title
  2235.  * @param   string      Document character set
  2236.  * @return  string      HTML
  2237.  */
  2238. public function system_error( $msg, $code=0, $title='', $IPS_DOC_CHAR_SET=IPS_DOC_CHAR_SET )
  2239. {
  2240. $title = !empty( $title ) ? $title : $this->lang->words['gbl_system_error'];
  2241.  
  2242. if( $code )
  2243. {
  2244.     $finalMessage = "[#{$code}] " . ( is_array( $msg ) ? implode( "<br />", $msg ) : $msg );
  2245. }
  2246. else
  2247. {
  2248.     $finalMessage = is_array( $msg ) ? implode( "<br />", $msg ) : $msg;
  2249. }
  2250.  
  2251. $HTML .= <<<EOF
  2252. <div class='warning'>
  2253.  <h4>{$title}</h4>
  2254.     <p><strong>{$finalMessage}</strong></p>
  2255.     <br />
  2256.     <ul>
  2257.         <li><a href='javascript:history.go(-1)'>{$this->lang->words['gbl_go_back']}</a>
  2258.         <li><a href='{$this->settings['_base_url']}'>{$this->lang->words['gbl_go_to_dashboard']}</a>
  2259.         <li><a href='{$this->settings['base_url']}'>{$this->lang->words['gbl_go_to_module_home']}</a>
  2260.     </ul>
  2261. </div>
  2262. EOF;
  2263.  
  2264. return $HTML;
  2265. }
  2266.  
  2267. /**
  2268.  * HTML for quick help popup boxes
  2269.  *
  2270.  * @access  public
  2271.  * @param   string      Title
  2272.  * @param   string      Help contents
  2273.  * @return  string      HTML
  2274.  */
  2275. public function quickHelp( $title, $body ) {
  2276.  
  2277. $IPBHTML = "";
  2278. //--starthtml--//
  2279.  
  2280. $IPBHTML .= <<<EOF
  2281. <div class='acp-box'>
  2282.  <h3>{$title}</h3>
  2283.     <div style='padding: 4px; line-height: 1.5'>{$body}</div>
  2284. </div>
  2285. EOF;
  2286.  
  2287. //--endhtml--//
  2288. return $IPBHTML;
  2289. }
  2290.  
  2291. }
Advertisement
Add Comment
Please, Sign In to add comment