function template_blockedit() { global $context, $settings, $txt, $scripturl, $boardurl; $newtitle = html_entity_decode(TPgetlangOption($context['TPortal']['blockedit']['lang'], $context['user']['language'])); if (empty($newtitle)) { $newtitle = html_entity_decode($context['TPortal']['blockedit']['title']); } echo ' <form accept-charset="', $context['character_set'], '" name="tpadmin_news" enctype="multipart/form-data" action="' . $scripturl . '?action=tpadmin" method="post" style="margin: 0px;" onsubmit="submitonce(this);"> <input type="hidden" name="sc" value="', $context['session_id'], '" /> <input name="tpadmin_form" type="hidden" value="blockedit"> <input name="tpadmin_form_id" type="hidden" value="' . $context['TPortal']['blockedit']['id'] . '"> <table class="admintable"> <caption class="catbg">' . $txt['tp-editblock'] . '</caption> <tbody> <tr> <td style="padding: 0; border: none;"> <table class="formtable" id="editblock"> <caption class="titlebg"> <a href="', $scripturl, '?action=tpadmin;sa=blocks">', $txt['tp-gobackallblocks'], '</a> </caption> <tr class="windowbg2"> <td class="left"> <input style="float: left;" type="submit" value="' . $txt['tp-send'] . '" /> ', $txt['tp-status'], ': </td> <td class="right"><img src="' . $settings['tp_images_url'] . '/TP', $context['TPortal']['blockedit']['off'] == 0 ? 'green' : 'red', '.gif" alt="" /> <input type="radio" value="0" name="tp_block_off"', $context['TPortal']['blockedit']['off'] == 0 ? ' checked="checked"' : '', ' />' . $txt['tp-on'] . ' <input type="radio" value="1" name="tp_block_off"', $context['TPortal']['blockedit']['off'] == 1 ? ' checked="checked"' : '', ' />' . $txt['tp-off'] . ' </td> </tr><tr class="windowbg2"> <td class="left">' . $txt['tp-title'] . ':</td> <td class="right"><input style="width: 94%" name="tp_block_title" type="text" value="' . $newtitle . '"> </tr><tr class="windowbg2"> <td class="left">', $txt['tp-type'] . ':</td> <td class="right"> <select size="1" onchange="document.getElementById(\'blocknotice\').style.display=\'\';" name="tp_block_type"> <option value="0"', $context['TPortal']['blockedit']['type'] == '0' ? ' selected' : '', '>', $txt['tp-blocktype0'], '</option> <option value="1"', $context['TPortal']['blockedit']['type'] == '1' ? ' selected' : '', '>', $txt['tp-blocktype1'], '</option> <option value="2"', $context['TPortal']['blockedit']['type'] == '2' ? ' selected' : '', '>', $txt['tp-blocktype2'], '</option> <option value="3"', $context['TPortal']['blockedit']['type'] == '3' ? ' selected' : '', '>', $txt['tp-blocktype3'], '</option> <option value="4"', $context['TPortal']['blockedit']['type'] == '4' ? ' selected' : '', '>', $txt['tp-blocktype4'], '</option> <option value="5"', $context['TPortal']['blockedit']['type'] == '5' ? ' selected' : '', '>', $txt['tp-blocktype5'], '</option> <option value="6"', $context['TPortal']['blockedit']['type'] == '6' ? ' selected' : '', '>', $txt['tp-blocktype6'], '</option> <option value="7"', $context['TPortal']['blockedit']['type'] == '7' ? ' selected' : '', '>', $txt['tp-blocktype7'], '</option> <option value="9"', $context['TPortal']['blockedit']['type'] == '9' ? ' selected' : '', '>', $txt['tp-blocktype9'], '</option> <option value="10"', $context['TPortal']['blockedit']['type'] == '10' ? ' selected' : '', '>', $txt['tp-blocktype10'], '</option> <option value="11"', $context['TPortal']['blockedit']['type'] == '11' ? ' selected' : '', '>', $txt['tp-blocktype11'], '</option> <option value="12"', $context['TPortal']['blockedit']['type'] == '12' ? ' selected' : '', '>', $txt['tp-blocktype12'], '</option> <option value="13"', $context['TPortal']['blockedit']['type'] == '13' ? ' selected' : '', '>', $txt['tp-blocktype13'], '</option> <option value="14"', $context['TPortal']['blockedit']['type'] == '14' ? ' selected' : '', '>', $txt['tp-blocktype14'], '</option> <option value="15"', $context['TPortal']['blockedit']['type'] == '15' ? ' selected' : '', '>', $txt['tp-blocktype15'], '</option> <option value="16"', $context['TPortal']['blockedit']['type'] == '16' ? ' selected' : '', '>', $txt['tp-blocktype16'], '</option> <option value="18"', $context['TPortal']['blockedit']['type'] == '18' ? ' selected' : '', '>', $txt['tp-blocktype18'], '</option> <option value="19"', $context['TPortal']['blockedit']['type'] == '19' ? ' selected' : '', '>', $txt['tp-blocktype19'], '</option> <option value="20"', $context['TPortal']['blockedit']['type'] == '20' ? ' selected' : '', '>', $txt['tp-blocktype20'], '</option>'; // theme hooks if (function_exists('ctheme_tp_blocks')) { ctheme_tp_blocks('listblocktypes'); } echo ' </select> </td> </tr><tr class="windowbg2"> <td class="left"><td class="right"> <div id="blocknotice" class="smallpadding error middletext" style="display: none;">', $txt['tp-blocknotice'], '</a> </div> </td> </tr><tr class="windowbg2"> <td class="left">'; if ($context['TPortal']['blockedit']['type'] == '5' || $context['TPortal']['blockedit']['type'] == '10' || $context['TPortal']['blockedit']['type'] == '11') { if ($context['TPortal']['blockedit']['type'] == '11') { echo ' </td><td class="right">'; if ($context['TPortal']['use_wysiwyg'] > 0) { TPwysiwyg('tp_block_body', $context['TPortal']['blockedit']['body'], true, 'qup_blockbody', 1, false); } else { echo $txt['tp-body'], ' <br /><textarea style="width: 94%;" name="tp_block_body" id="tp_block_body" rows="15" cols="40" wrap="auto">', $context['TPortal']['blockedit']['body'], '</textarea>'; } } elseif ($context['TPortal']['blockedit']['type'] == '5') { echo ' </td><td class="right">'; TP_bbcbox($context['TPortal']['editor_id']); } else { echo $txt['tp-body']; } if ($context['TPortal']['blockedit']['type'] == '10') { echo ' </td><td class="right"> <textarea style="width: 94%;" name="tp_block_body" id="tp_block_body" rows="15" cols="40" wrap="auto">', $context['TPortal']['blockedit']['body'], '</textarea> <p><div class="tborder" style="padding: 1em;"><p style="padding: 0 0 5px 0; margin: 0;">', $txt['tp-blockcodes'], ':</p> <select name="tp_blockcode" id="tp_blockcode" size="8" style="margin-bottom: 5px; width: 100%" onchange="changeSnippet(this.selectedIndex);"> <option value="0" selected="selected">', $txt['tp-none-'], '</option>'; if (!empty($context['TPortal']['blockcodes'])) { foreach ($context['TPortal']['blockcodes'] as $bc) { echo ' <option value="', $bc['file'], '">', $bc['name'], '</option>'; } } echo ' </select> <input type="button" value="', $txt['tp-insert'], '" name="blockcode_save" onclick="submit();" /> <input type="checkbox" value="' . $context['TPortal']['blockedit']['id'] . '" name="blockcode_overwrite" /> ', $txt['tp-blockcodes_overwrite'], ' </div> </p><br /> <div id="blockcodeinfo" class="description" > </div> <script type="text/javascript"><!-- // --><![CDATA[ function changeSnippet(indx) { var snipp = new Array(); var snippAuthor = new Array(); var snippTitle = new Array(); snipp[0] = ""; snippAuthor[0] = ""; snippTitle[0] = "";'; $count = 1; foreach ($context['TPortal']['blockcodes'] as $bc) { $what = str_replace(array(",", ".", "/", "\n"), array(",", ".", "/", ""), $bc['text']); echo ' snipp[' . $count . '] = "<div>' . $what . '</div>"; snippTitle[' . $count . '] = "<h3 style=\\"margin: 0 0 5px 0; padding: 0;\\">' . $bc['name'] . ' <span style=\\"font-weight: normal;\\">' . $txt['tp-by'] . '</span> ' . $bc['author'] . '</h3>"; '; $count++; } echo ' setInnerHTML(document.getElementById("blockcodeinfo"), snippTitle[indx] + snipp[indx]); } // ]]></script>'; } } elseif ($context['TPortal']['blockedit']['type'] == '12') { if (!is_numeric($context['TPortal']['blockedit']['body'])) { $context['TPortal']['blockedit']['body'] = 10; } echo $txt['tp-numberofrecenttopics'] . '</td><td class="right"><input style="width: 50px;" name="tp_block_body" value="' . $context['TPortal']['blockedit']['body'] . '"> </td><tr class="windowbg2"><td class="left">' . $txt['tp-rssblock-showavatar'] . '</td><td class="right"> <input name="tp_block_var1" type="radio" value="0" ', $context['TPortal']['blockedit']['var1'] == '0' ? ' checked' : '', '>' . $txt['tp-no'] . ' <input name="tp_block_var1" type="radio" value="1" ', $context['TPortal']['blockedit']['var1'] == '1' || $context['TPortal']['blockedit']['var1'] == '' ? ' checked' : '', '>' . $txt['tp-yes'] . '<br />'; } elseif ($context['TPortal']['blockedit']['type'] == '13') { // SSI block..which function? if (!in_array($context['TPortal']['blockedit']['body'], array('recentpoll', 'toppoll', 'topposters', 'topboards', 'topreplies', 'topviews', 'calendar'))) { $context['TPortal']['blockedit']['body'] = ''; } echo ' </td><td class="right">'; echo '<input name="tp_block_body" type="radio" value="" ', $context['TPortal']['blockedit']['body'] == '' ? 'checked' : '', '>' . $txt['tp-none-']; echo '<br /><input name="tp_block_body" type="radio" value="topboards" ', $context['TPortal']['blockedit']['body'] == 'topboards' ? 'checked' : '', '>' . $txt['tp-ssi-topboards']; echo '<br /><input name="tp_block_body" type="radio" value="topposters" ', $context['TPortal']['blockedit']['body'] == 'topposters' ? 'checked' : '', '>' . $txt['tp-ssi-topposters']; echo '<br /><input name="tp_block_body" type="radio" value="topreplies" ', $context['TPortal']['blockedit']['body'] == 'topreplies' ? 'checked' : '', '>' . $txt['tp-ssi-topreplies']; echo '<br /><input name="tp_block_body" type="radio" value="topviews" ', $context['TPortal']['blockedit']['body'] == 'topviews' ? 'checked' : '', '>' . $txt['tp-ssi-topviews']; echo '<br /><input name="tp_block_body" type="radio" value="calendar" ', $context['TPortal']['blockedit']['body'] == 'calendar' ? 'checked' : '', '>' . $txt['tp-ssi-calendar']; echo '<hr />'; } elseif ($context['TPortal']['blockedit']['type'] == '20') { // TP modules echo ' </td><td class="right">'; foreach ($context['TPortal']['tpmodules']['blockrender'] as $tpm) { echo '<br /><input name="tp_block_var1" type="radio" value="' . $tpm['id'] . '" ', $context['TPortal']['blockedit']['var1'] == $tpm['id'] ? 'checked' : '', '>' . $tpm['name']; } } elseif ($context['TPortal']['blockedit']['type'] == '14') { // Module block...choose module and module ID , check if module is active echo ' </td><td class="right">'; echo '<input name="tp_block_body" type="radio" value="dl-stats" ', $context['TPortal']['blockedit']['body'] == 'dl-stats' ? 'checked' : '', '>' . $txt['tp-module1']; echo '<br /><input name="tp_block_body" type="radio" value="dl-stats2" ', $context['TPortal']['blockedit']['body'] == 'dl-stats2' ? 'checked' : '', '>' . $txt['tp-module2']; echo '<br /><input name="tp_block_body" type="radio" value="dl-stats3" ', $context['TPortal']['blockedit']['body'] == 'dl-stats3' ? 'checked' : '', '>' . $txt['tp-module3']; echo '<br /><input name="tp_block_body" type="radio" value="dl-stats4" ', $context['TPortal']['blockedit']['body'] == 'dl-stats4' ? 'checked' : '', '>' . $txt['tp-module4']; echo '<br /><input name="tp_block_body" type="radio" value="dl-stats5" ', $context['TPortal']['blockedit']['body'] == 'dl-stats5' ? 'checked' : '', '>' . $txt['tp-module5']; echo '<br /><input name="tp_block_body" type="radio" value="dl-stats6" ', $context['TPortal']['blockedit']['body'] == 'dl-stats6' ? 'checked' : '', '>' . $txt['tp-module6']; echo '<br /><input name="tp_block_body" type="radio" value="dl-stats7" ', $context['TPortal']['blockedit']['body'] == 'dl-stats7' ? 'checked' : '', '>' . $txt['tp-module7']; echo '<br /><input name="tp_block_body" type="radio" value="dl-stats8" ', $context['TPortal']['blockedit']['body'] == 'dl-stats8' ? 'checked' : '', '>' . $txt['tp-module8']; echo '<br /><input name="tp_block_body" type="radio" value="dl-stats9" ', $context['TPortal']['blockedit']['body'] == 'dl-stats9' ? 'checked' : '', '>' . $txt['tp-module9'] . '<br />'; } elseif ($context['TPortal']['blockedit']['type'] == '3') { // userbox type echo $txt['tp-showuserbox'] . '</td><td class="right">'; if (isset($context['TPortal']['userbox']['avatar']) && $context['TPortal']['userbox']['avatar']) { echo '<input name="tp_userbox_options0" type="hidden" value="avatar">'; } if (isset($context['TPortal']['userbox']['logged']) && $context['TPortal']['userbox']['logged']) { echo '<input name="tp_userbox_options1" type="hidden" value="logged">'; } if (isset($context['TPortal']['userbox']['time']) && $context['TPortal']['userbox']['time']) { echo '<input name="tp_userbox_options2" type="hidden" value="time">'; } if (isset($context['TPortal']['userbox']['unread']) && $context['TPortal']['userbox']['unread']) { echo '<input name="tp_userbox_options3" type="hidden" value="unread">'; } echo '<input name="tp_userbox_options4" type="checkbox" value="stats" ', isset($context['TPortal']['userbox']['stats']) && $context['TPortal']['userbox']['stats'] ? 'checked' : '', '> ' . $txt['tp-userbox5'] . '<br />'; echo '<input name="tp_userbox_options5" type="checkbox" value="online" ', isset($context['TPortal']['userbox']['online']) && $context['TPortal']['userbox']['online'] ? 'checked' : '', '> ' . $txt['tp-userbox6'] . '<br />'; echo '<input name="tp_userbox_options6" type="checkbox" value="stats_all" ', isset($context['TPortal']['userbox']['stats_all']) && $context['TPortal']['userbox']['stats_all'] ? 'checked' : '', '> ' . $txt['tp-userbox7'] . '<br /> '; } elseif ($context['TPortal']['blockedit']['type'] == '1') { // userbox type echo $txt['tp-showuserbox2'] . '</td><td class="right"> <input name="tp_userbox_options0" type="checkbox" value="avatar" ', isset($context['TPortal']['userbox']['avatar']) && $context['TPortal']['userbox']['avatar'] ? 'checked' : '', '> ' . $txt['tp-userbox1'] . '<br />'; echo '<input name="tp_userbox_options1" type="checkbox" value="logged" ', isset($context['TPortal']['userbox']['logged']) && $context['TPortal']['userbox']['logged'] ? 'checked' : '', '> ' . $txt['tp-userbox2'] . '<br />'; echo '<input name="tp_userbox_options2" type="checkbox" value="time" ', isset($context['TPortal']['userbox']['time']) && $context['TPortal']['userbox']['time'] ? 'checked' : '', '> ' . $txt['tp-userbox3'] . '<br />'; echo '<input name="tp_userbox_options3" type="checkbox" value="unread" ', isset($context['TPortal']['userbox']['unread']) && $context['TPortal']['userbox']['unread'] ? 'checked' : '', '> ' . $txt['tp-userbox4'] . '<br />'; if (isset($context['TPortal']['userbox']['stats']) && $context['TPortal']['userbox']['stats']) { echo '<input name="tp_userbox_options4" type="hidden" value="stats">'; } if (isset($context['TPortal']['userbox']['online']) && $context['TPortal']['userbox']['online']) { echo '<input name="tp_userbox_options5" type="hidden" value="online">'; } if (isset($context['TPortal']['userbox']['stats_all']) && $context['TPortal']['userbox']['stats_all']) { echo '<input name="tp_userbox_options6" type="hidden" value="stats_all">'; } } elseif ($context['TPortal']['blockedit']['type'] == '15') { echo $txt['tp-rssblock'] . ' </td><td class="right">'; // RSS feed type echo '<input style="width: 95%" name="tp_block_body" value="' . $context['TPortal']['blockedit']['body'] . '"><br /><br /> </td> <tr class="windowbg2"> <td class="left">', $txt['tp-rssblock-useutf8'] . '<br /></td><td class="right"> <input name="tp_block_var1" type="radio" value="1" ', $context['TPortal']['blockedit']['var1'] == '1' ? ' checked' : '', '>' . $txt['tp-utf8'] . ' <input name="tp_block_var1" type="radio" value="0" ', $context['TPortal']['blockedit']['var1'] == '0' || $context['TPortal']['blockedit']['var1'] == '' ? ' checked' : '', '>' . $txt['tp-iso'] . '<br /><br /> </td></tr> <tr class="windowbg2"><td class="left">' . $txt['tp-rssblock-showonlytitle'] . '</td><td class="right"> <input name="tp_block_var2" type="radio" value="1" ', $context['TPortal']['blockedit']['var2'] == '1' ? ' checked' : '', '>' . $txt['tp-yes'] . ' <input name="tp_block_var2" type="radio" value="0" ', $context['TPortal']['blockedit']['var2'] == '0' || $context['TPortal']['blockedit']['var2'] == '' ? ' checked' : '', '>' . $txt['tp-no'], ' </td></tr> <tr class="windowbg2"><td class="left">' . $txt['tp-rssblock-maxwidth'] . '</td><td class="right"> <input name="tp_block_var3" type="text" value="', $context['TPortal']['blockedit']['var3'], '"><br />'; } elseif ($context['TPortal']['blockedit']['type'] == '16') { echo $txt['tp-sitemapmodules'] . '</td><td class="right"><ul>'; if ($context['TPortal']['show_download'] == '1') { echo '<li>' . $txt['tp-dldownloads'] . '</li>'; } echo '</ul>'; } elseif ($context['TPortal']['blockedit']['type'] == '18') { // check to see if it is numeric if (!is_numeric($context['TPortal']['blockedit']['body'])) { $lblock['body'] = ''; } echo $txt['tp-showarticle'], '</td><td class="right"> <select name="tp_block_body">'; foreach ($context['TPortal']['edit_articles'] as $art => $article) { echo '<option value="' . $article['id'] . '" ', $context['TPortal']['blockedit']['body'] == $article['id'] ? ' selected="selected"' : '', ' >' . html_entity_decode($article['subject']) . '</option>'; } echo '</select>'; } elseif ($context['TPortal']['blockedit']['type'] == '7') { // get the ids $myt = array(); $thems = explode(",", $context['TPortal']['blockedit']['body']); foreach ($thems as $g => $gh) { $wh = explode("|", $gh); $myt[] = $wh[0]; } echo ' </td><td class="right"> <input type="hidden" name="blockbody' . $context['TPortal']['blockedit']['id'] . '" value="' . $context['TPortal']['blockedit']['body'] . '" /> <div style="padding: 5px;"> <div style="max-height: 25em; overflow: auto;"> <input name="tp_theme-1" type="hidden" value="-1"> <input type="hidden" value="1" name="tp_tpath-1">'; foreach ($context['TPthemes'] as $tema) { echo ' <img style="width: 35px; height: 35px;" alt="*" src="' . $tema['path'] . '/thumbnail.gif" /> <input name="tp_theme' . $tema['id'] . '" type="checkbox" value="' . $tema['name'] . '"'; if (in_array($tema['id'], $myt)) { echo ' checked'; } echo '>' . $tema['name'] . '<input type="hidden" value="' . $tema['path'] . '" name="tp_path' . $tema['id'] . '"><br />'; } echo '</div><hr /><input type="checkbox" onclick="invertAll(this, this.form, \'tp_theme\');" />' . $txt['tp-checkall'], ' </div>'; } elseif ($context['TPortal']['blockedit']['type'] == '19') { // check to see if it is numeric if (!is_numeric($context['TPortal']['blockedit']['body'])) { $lblock['body'] = ''; } if (!is_numeric($context['TPortal']['blockedit']['var1'])) { $lblock['var1'] = '15'; } if ($context['TPortal']['blockedit']['var1'] == '0') { $lblock['var1'] = '15'; } echo $txt['tp-showcategory'], '</td><td class="right"> <select name="tp_block_body">'; foreach ($context['TPortal']['catnames'] as $cat => $catname) { echo '<option value="' . $cat . '" ', $context['TPortal']['blockedit']['body'] == $cat ? ' selected' : '', ' >' . html_entity_decode($catname) . '</option>'; } echo '</select><br /><br /><br />'; echo $txt['tp-catboxheight'] . ' <input name="tp_block_var1" size="4" type="text" value="', $context['TPortal']['blockedit']['var1'], '"> em<br />'; echo $txt['tp-catboxauthor'] . ' <input name="tp_block_var2" type="radio" value="1" ', $context['TPortal']['blockedit']['var2'] == '1' ? 'checked' : '', '> ', $txt['tp-yes'], ' <input name="tp_block_var2" type="radio" value="0" ', $context['TPortal']['blockedit']['var2'] == '0' ? 'checked' : '', '> ', $txt['tp-no'], '<br />'; } elseif ($context['TPortal']['blockedit']['type'] == '9') { // check to see if it is numeric if (!is_numeric($context['TPortal']['blockedit']['body'])) { $lblock['body'] = '0'; } echo $txt['tp-showmenus'], '</td><td class="right"> <select name="tp_block_body">'; foreach ($context['TPortal']['menus'] as $men) { echo ' <option value="' . $men['id'] . '" ', $context['TPortal']['blockedit']['body'] == $men['id'] ? ' selected' : '', ' >' . $men['name'] . '</option>'; } echo ' </select><br />', $txt['tp-showmenustyle'], ' <br /> <input name="tp_block_var1" type="radio" value="0" ', $context['TPortal']['blockedit']['var1'] == '' || $context['TPortal']['blockedit']['var1'] == '0' ? ' checked' : '', ' ><img src="', $boardurl, '/tp-images/icons/TPdivider2.gif" alt="" /><br /> <input name="tp_block_var1" type="radio" value="1" ', $context['TPortal']['blockedit']['var1'] == '1' ? ' checked' : '', ' ><img src="', $boardurl, '/tp-images/icons/bullet3.gif" alt="" /><br /> <input name="tp_block_var1" type="radio" value="2" ', $context['TPortal']['blockedit']['var1'] == '2' ? ' checked' : '', ' >' . $txt['tp-none-'] . '<br /> '; } elseif ($context['TPortal']['blockedit']['type'] == '6') { echo $txt['tp-rssblock-showavatar'] . '</td><td class="right"> <input name="tp_block_var1" type="radio" value="0" ', $context['TPortal']['blockedit']['var1'] == '0' ? ' checked' : '', '>' . $txt['tp-no'] . ' <input name="tp_block_var1" type="radio" value="1" ', $context['TPortal']['blockedit']['var1'] == '1' || $context['TPortal']['blockedit']['var1'] == '' ? ' checked' : '', '>' . $txt['tp-yes'] . '<br />'; } elseif ($context['TPortal']['blockedit']['type'] > '50' && function_exists('ctheme_tp_blocks')) { ctheme_tp_blocks('blockoptions'); } else { echo ' </td><td class="right">'; } echo ' </td> </tr><tr> <td class="left windowbg2">' . $txt['tp-blockstylehelp'] . ':</td> <td class="right"> <div style="overflow: hidden; padding: 5px;">'; if (function_exists('ctheme_tp_getblockstyles')) { $types = ctheme_tp_getblockstyles(); } else { $types = tp_getblockstyles(); } foreach ($types as $blo => $bl) { echo ' <div style="float: left; width: 160px; height: 100px; margin: 5px;"> <div class="smalltext" style="padding: 4px 0;"><input name="tp_block_var4" type="radio" value="' . $blo . '" ', $context['TPortal']['blockedit']['var4'] == $blo ? 'checked' : '', '><span', $context['TPortal']['blockedit']['var4'] == $blo ? ' style="color: red;">' : '>', $bl['class'], '</span> </div>' . $bl['code_title_left'] . 'title' . $bl['code_title_right'] . ' ' . $bl['code_top'] . 'body' . $bl['code_bottom'] . ' </div>'; } echo ' </div> </td> </tr><tr class="windowbg2"> <td class="left">' . $txt['tp-blockframehelp'] . ':</td> <td class="right"> <input name="tp_block_frame" type="radio" value="theme" ', $context['TPortal']['blockedit']['frame'] == 'theme' ? 'checked' : '', '> ' . $txt['tp-useframe'] . '<br /> <input name="tp_block_frame" type="radio" value="frame" ', $context['TPortal']['blockedit']['frame'] == 'frame' ? 'checked' : '', '> ' . $txt['tp-useframe2'] . ' <br /> <input name="tp_block_frame" type="radio" value="title" ', $context['TPortal']['blockedit']['frame'] == 'title' ? 'checked' : '', '> ' . $txt['tp-usetitle'] . ' <br /> <input name="tp_block_frame" type="radio" value="none" ', $context['TPortal']['blockedit']['frame'] == 'none' ? 'checked' : '', '> ' . $txt['tp-noframe'] . '<br />'; echo ' </td> </tr><tr class="windowbg2"> <td class="left"></td> <td class="right"> <input name="tp_block_visible" type="radio" value="1" ', $context['TPortal']['blockedit']['visible'] == '' || $context['TPortal']['blockedit']['visible'] == '1' ? 'checked' : '', '> ' . $txt['tp-allowupshrink'] . '<br /> <input name="tp_block_visible" type="radio" value="0" ', $context['TPortal']['blockedit']['visible'] == '0' ? 'checked' : '', '> ' . $txt['tp-notallowupshrink'] . '<br /> </td> </tr><tr class="windowbg2"> <td class="left"> ' . $txt['tp-membergrouphelp'] . '</td><td class="right"> <div style="padding: 5px; overflow: auto; max-height: 10em;">'; // loop through and set membergroups $tg = explode(',', $context['TPortal']['blockedit']['access']); if (!empty($context['TPmembergroups'])) { foreach ($context['TPmembergroups'] as $mg) { if ($mg['posts'] == '-1' && $mg['id'] != '1') { echo '<input name="tp_group' . $mg['id'] . '" type="checkbox" value="' . $context['TPortal']['blockedit']['id'] . '"'; if (in_array($mg['id'], $tg)) { echo ' checked'; } echo '> ' . $mg['name'] . ' <br />'; } } } // if none is chosen, have a control value echo '</div><hr /><input type="checkbox" onclick="invertAll(this, this.form, \'tp_group\');" />' . $txt['tp-checkall'] . '<br /><br />'; //edit membergroups echo ' </td></tr><tr class="windowbg2"><td class="left">' . $txt['tp-editgrouphelp'] . '</td><td class="right"> <div style="padding: 5px; max-height: 10em; overflow: auto;">'; $tg = explode(',', $context['TPortal']['blockedit']['editgroups']); foreach ($context['TPmembergroups'] as $mg) { if ($mg['posts'] == '-1' && $mg['id'] != '1' && $mg['id'] != '-1' && $mg['id'] != '0') { echo '<input name="tp_editgroup' . $mg['id'] . '" type="checkbox" value="' . $context['TPortal']['blockedit']['id'] . '"'; if (in_array($mg['id'], $tg)) { echo ' checked'; } echo '> ' . $mg['name'] . ' <br />'; } } // if none is chosen, have a control value echo '</div><hr /><input type="checkbox" onclick="invertAll(this, this.form, \'tp_editgroup\');" />' . $txt['tp-checkall']; echo ' </td> </tr><tr class="windowbg2"><td class="left">' . $txt['tp-langhelp'] . '</td><td class="right">'; foreach ($context['TPortal']['langfiles'] as $langlist => $lang) { if ($lang != $context['user']['language'] && $lang != '') { echo '<input name="tp_lang_' . $lang . '" type="text" value="', !empty($context['TPortal']['blockedit']['langfiles'][$lang]) ? html_entity_decode($context['TPortal']['blockedit']['langfiles'][$lang], ENT_QUOTES) : html_entity_decode($context['TPortal']['blockedit']['title'], ENT_QUOTES), '"> ' . $lang . '<br />'; } } echo ' </td> </tr>'; if ($context['TPortal']['blockedit']['bar'] != 4) { // extended visible options echo ' <tr class="windowbg2"> <td class="left">' . $txt['tp-access2help'] . '</td><td class="right"> ', tp_hidepanel('blockopts', true), ' ', empty($context['TPortal']['blockedit']['access22']) ? '<div class="tborder error" style="margin: 1em 0; padding: 4px 4px 4px 20px;">' . $txt['tp-noaccess'] . '</div>' : '', ' <fieldset class="tborder" id="blockopts" ', in_array('blockopts', $context['tp_panels']) ? ' style="display: none;"' : '', '> <input type="hidden" name="TPadmin_blocks_vo" value="' . $mg['id'] . '" />'; if (!empty($context['TPortal']['return_url'])) { echo ' <input type="hidden" name="fromblockpost" value="' . $context['TPortal']['return_url'] . '" />'; } echo ' <table class="admintable windowbg2"> <tr class="windowbg2"> <td width="50%" valign="top"><h4>' . $txt['tp-actions'] . ':</h4> <input name="actiontype1" type="checkbox" value="allpages" ', in_array('allpages', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['tp-allpages'] . '<br /><br /> <input name="actiontype2" type="checkbox" value="frontpage" ', in_array('frontpage', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['tp-frontpage'] . '<br /> <input name="actiontype3" type="checkbox" value="forumall" ', in_array('forumall', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['tp-forumall'] . '<br /> <input name="actiontype4" type="checkbox" value="forum" ', in_array('forum', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['tp-forumfront'] . '<br /> <input name="actiontype5" type="checkbox" value="recent" ', in_array('recent', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['tp-recent'] . '<br /> <input name="actiontype6" type="checkbox" value="unread" ', in_array('unread', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['tp-unread'] . '<br /> <input name="actiontype7" type="checkbox" value="unreadreplies" ', in_array('unreadreplies', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['tp-unreadreplies'] . '<br /> <input name="actiontype8" type="checkbox" value="profile" ', in_array('profile', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['profile'] . '<br /> <input name="actiontype9" type="checkbox" value="pm" ', in_array('pm', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['pm_short'] . '<br /> </td><td valign="bottom"> <input name="actiontype10" type="checkbox" value="calendar" ', in_array('calendar', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['calendar'] . '<br /> <input name="actiontype11" type="checkbox" value="admin" ', in_array('admin', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['admin'] . '<br /> <input name="actiontype12" type="checkbox" value="login" ', in_array('login', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['login'] . '<br /> <input name="actiontype13" type="checkbox" value="logout" ', in_array('logout', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['logout'] . '<br /> <input name="actiontype14" type="checkbox" value="register" ', in_array('register', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['register'] . '<br /> <input name="actiontype15" type="checkbox" value="post" ', in_array('post', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['post'] . '<br /> <input name="actiontype16" type="checkbox" value="stats" ', in_array('stats', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['tp-stats'] . '<br /> <input name="actiontype17" type="checkbox" value="search" ', in_array('search', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['search'] . '<br /> <input name="actiontype18" type="checkbox" value="mlist" ', in_array('mlist', $context['TPortal']['blockedit']['access2']['action']) ? 'checked="checked"' : '', '>' . $txt['tp-memberlist'] . '<br /><br />'; // add the custom ones you added $count = 19; foreach ($context['TPortal']['blockedit']['access2']['action'] as $po => $p) { if (!in_array($p, array('allpages', 'frontpage', 'forumall', 'forum', 'recent', 'unread', 'unreadreplies', 'profile', 'pm', 'calendar', 'admin', 'login', 'logout', 'register', 'post', 'stats', 'mlist'))) { echo '<input name="actiontype' . $count . '" type="checkbox" value="' . $p . '" checked="checked">' . $p . '<br />'; $count++; } } echo ' <p>' . $txt['tp-customactions'] . '</p> <input style="width: 90%;" type="text" name="custotype0" value=""> </td> </tr> <tr class="windowbg2"> <td valign="top"><h4>Boards:</h4><div class="tp_largelist">'; $a = 1; if (!empty($context['TPortal']['boards'])) { echo '<input type="checkbox" name="boardtype', $a, '" value="-1" ', in_array('-1', $context['TPortal']['blockedit']['access2']['board']) ? 'checked="checked"' : '', '>' . $txt['tp-allboards'] . '<br /><br />'; $a++; foreach ($context['TPortal']['boards'] as $bb) { echo ' <input type="checkbox" name="boardtype', $a, '" value="' . $bb['id'] . '" ', in_array($bb['id'], $context['TPortal']['blockedit']['access2']['board']) ? 'checked="checked"' : '', '>' . $bb['name'] . '<br />'; $a++; } } echo ' </div></td> <td valign="top"><h4>' . $txt['tp-articles'] . ':</h4><div class="tp_largelist">'; $a = 1; foreach ($context['TPortal']['edit_articles'] as $bb) { echo ' <input type="checkbox" name="articletype', $a, '" value="' . $bb['id'] . '" ', in_array($bb['id'], $context['TPortal']['blockedit']['access2']['page']) ? 'checked="checked"' : '', '>' . html_entity_decode($bb['subject'], ENT_QUOTES) . '<br />'; $a++; } echo ' </div></td> </tr> <tr class="windowbg2"> <td valign="top"><h4>' . $txt['tp-artcat'] . ':</h4><div class="tp_largelist">'; $a = 1; if (isset($context['TPortal']['article_categories'])) { foreach ($context['TPortal']['article_categories'] as $bb) { echo ' <input type="checkbox" name="categorytype' . $a . '" value="' . $bb['id'] . '" ', in_array($bb['id'], $context['TPortal']['blockedit']['access2']['cat']) ? 'checked="checked"' : '', '>' . $bb['name'] . '<br />'; $a++; } } echo ' </div></td> <td valign="top"><h4>' . $txt['tp-lang'] . ':</h4>'; // alert if the settings is off, supply link if allowed if (empty($context['TPortal']['uselangoption'])) { echo ' <p class="error">', $txt['tp-uselangoption2'], ' ', allowedTo('tp_settings') ? '<a href="' . $scripturl . '?action=tpadmin;sa=settings#uselangoption">[' . $txt['tp-settings'] . ']</a>' : '', '</p>'; } $a = 1; foreach ($context['TPortal']['langfiles'] as $bb => $lang) { echo ' <input type="checkbox" name="langtype' . $a . '" value="' . $lang . '" ', in_array($lang, $context['TPortal']['blockedit']['access2']['lang']) ? 'checked="checked"' : '', '>' . $lang . '<br />'; $a++; } echo ' </td> </tr> <tr class="windowbg2"> <td> <h4>' . $txt['tp-dlmanager'] . ':</h4><div class="tp_largelist">'; $a = 1; if (!empty($context['TPortal']['dlcats'])) { $a++; foreach ($context['TPortal']['dlcats'] as $bb) { echo ' <input type="checkbox" name="dlcattype', $a, '" value="' . $bb['id'] . '" ', in_array($bb['id'], $context['TPortal']['blockedit']['access2']['dlcat']) ? 'checked="checked"' : '', '>' . $bb['name'] . '<br />'; $a++; } } echo ' </div></td> <td valign="top"> <h4>' . $txt['tp-modules'] . '</h4><div class="tp_largelist">'; $a = 1; if (!empty($context['TPortal']['tpmods'])) { $a++; foreach ($context['TPortal']['tpmods'] as $bb) { echo ' <input type="checkbox" name="tpmodtype', $a, '" value="' . $bb['subquery'] . '" ', in_array($bb['subquery'], $context['TPortal']['blockedit']['access2']['tpmod']) ? 'checked="checked"' : '', '>' . $bb['title'] . '<br />'; $a++; } } echo ' </fieldset></td> </tr> </table> </div> </td> </tr>'; } echo ' </table> </td> </tr> </tbody> <tfoot> <tr class="windowbg2"> <td class="windowbg3"><input type="submit" value="' . $txt['tp-send'] . '" name="' . $txt['tp-send'] . '"> </td> </tr> </tfoot> </table> </form>'; }
function TPblock($block, $theme, $side, $double = false) { global $context, $scripturl, $settings, $txt; // setup a container that can be massaged through css echo ' <div class="block_' . $side . 'container">'; if (function_exists('ctheme_tp_getblockstyles')) { $types = ctheme_tp_getblockstyles(); } else { $types = tp_getblockstyles(); } // check if ($block['var4'] == '') { $block['var4'] = 0; } if ($block['var4'] == 0) { $block['var4'] = $context['TPortal']['panelstyle_' . $side]; } // its a normal block.. if (in_array($block['frame'], array('theme', 'frame', 'title', 'none'))) { echo ' <div class="', $theme || $block['frame'] == 'frame' ? 'tborder tp_' . $side . 'block_frame' : 'tp_' . $side . 'block_noframe', '">'; // show the frame and title if ($theme || $block['frame'] == 'title') { echo $types[$block['var4']]['code_title_left']; if ($block['visible'] == '' || $block['visible'] == '1') { echo '<a href="javascript: void(0); return false" onclick="toggle(\'' . $block['id'] . '\'); return false"><img id="blockcollapse' . $block['id'] . '" style="margin: 8px 0 0 0; " align="right" src="' . $settings['tp_images_url'] . '/', !in_array($block['id'], $context['TPortal']['upshrinkblocks']) ? 'TPcollapse' : 'TPexpand', '.gif" border="0" alt="" title="' . $txt['block-upshrink_description'] . '" /></a>'; } // can you edit the block? if ($block['can_edit'] && !$context['TPortal']['blocks_edithide']) { echo '<a href="', $scripturl, '?action=tpmod;sa=editblock' . $block['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '"><img style="margin: 8px 4px 0 0;" border="0" align="right" src="' . $settings['tp_images_url'] . '/TPedit2.gif" alt="" title="' . $txt['edit_description'] . '" /></a>'; } elseif ($block['can_manage'] && !$context['TPortal']['blocks_edithide']) { echo '<a href="', $scripturl, '?action=tpadmin;blockedit=' . $block['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '"><img border="0" style="margin: 8px 4px 0 0;" align="right" src="' . $settings['tp_images_url'] . '/TPedit2.gif" alt="" title="' . $txt['edit_description'] . '" /></a>'; } echo $block['title']; echo $types[$block['var4']]['code_title_right']; } else { if (($block['visible'] == '' || $block['visible'] == '1') && $block['frame'] != 'frame') { echo ' <div style="padding: 4px;">'; if ($block['visible'] == '' || $block['visible'] == '1') { echo '<a href="javascript: void(0); return false" onclick="toggle(\'' . $block['id'] . '\'); return false"><img id="blockcollapse' . $block['id'] . '" style="margin: 0;" align="right" src="' . $settings['tp_images_url'] . '/', !in_array($block['id'], $context['TPortal']['upshrinkblocks']) ? 'TPcollapse' : 'TPexpand', '.gif" border="0" alt="" title="' . $txt['block-upshrink_description'] . '" /></a>'; } echo ' </div>'; } } echo ' <div class="', $theme || $block['frame'] == 'frame' ? 'tp_' . $side . 'block_body' : '', '"', in_array($block['id'], $context['TPortal']['upshrinkblocks']) ? ' style="display: none;"' : '', ' id="block' . $block['id'] . '">'; if ($theme || $block['frame'] == 'frame') { echo $types[$block['var4']]['code_top']; } $func = 'TPortal_' . $block['type']; if (function_exists($func)) { if ($double) { // figure out the height $h = $context['TPortal']['blockheight_' . $side]; if (substr($context['TPortal']['blockheight_' . $side], strlen($context['TPortal']['blockheight_' . $side]) - 2, 2) == 'px') { $nh = substr($context['TPortal']['blockheight_' . $side], 0, strlen($context['TPortal']['blockheight_' . $side]) - 2) * 2 + 43 . 'px'; } elseif (substr($context['TPortal']['blockheight_' . $side], strlen($context['TPortal']['blockheight_' . $side]) - 1, 1) == '%') { $nh = substr($context['TPortal']['blockheight_' . $side], 0, strlen($context['TPortal']['blockheight_' . $side]) - 1) * 2 . '%'; } } echo '<div class="blockbody" style="overflow: auto;', !empty($context['TPortal']['blockheight_' . $side]) ? 'height: ' . ($double ? $nh : $context['TPortal']['blockheight_' . $side]) . ';' : '', '">'; $func($block['id']); echo '</div>'; } else { echo '<div class="blockbody" style="overflow: auto;', !empty($context['TPortal']['blockheight_' . $side]) ? 'height: ' . $context['TPortal']['blockheight_' . $side] . ';' : '', '">', parse_bbc($block['body']), '</div>'; } if ($theme || $block['frame'] == 'frame') { echo $types[$block['var4']]['code_bottom']; } echo ' </div> </div>'; } else { // check if the layout actually exist if (!isset($context['TPortal']['blocktheme'][$block['frame']]['body']['before'])) { $context['TPortal']['blocktheme'][$block['frame']] = array('frame' => array('before' => '', 'after' => ''), 'title' => array('before' => '', 'after' => ''), 'body' => array('before' => '', 'after' => '')); } echo $context['TPortal']['blocktheme'][$block['frame']]['frame']['before']; echo $context['TPortal']['blocktheme'][$block['frame']]['title']['before']; // can you edit the block? if ($block['can_edit'] && !$context['TPortal']['blocks_edithide']) { echo '<a href="', $scripturl, '?action=tpmod;sa=editblock' . $block['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '"><img style="margin-right: 4px;" border="0" align="right" src="' . $settings['tp_images_url'] . '/TPedit2.gif" alt="" title="' . $txt['edit_description'] . '" /></a>'; } elseif ($block['can_manage'] && !$context['TPortal']['blocks_edithide']) { echo '<a href="', $scripturl, '?action=tpadmin;blockedit' . substr($side, 0, 1) . '=' . $block['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '"><img border="0" style="margin-right: 4px;" align="right" src="' . $settings['tp_images_url'] . '/TPedit2.gif" alt="" title="' . $txt['edit_description'] . '" /></a>'; } echo $block['title']; echo $context['TPortal']['blocktheme'][$block['frame']]['title']['after']; echo $context['TPortal']['blocktheme'][$block['frame']]['body']['before']; $func = 'TPortal_' . $block['type']; if (function_exists($func)) { $func(); } else { echo parse_bbc($block['body']); } echo $context['TPortal']['blocktheme'][$block['frame']]['body']['after']; echo $context['TPortal']['blocktheme'][$block['frame']]['frame']['after']; } echo ' </div>'; }