function template_blocks() { global $context, $settings, $txt, $scripturl; echo ' <form accept-charset="', $context['character_set'], '" name="tpadmin_news" action="' . $scripturl . '?action=tpadmin" method="post" style="margin: 0px;"> <input type="hidden" name="sc" value="', $context['session_id'], '" /> <input name="tpadmin_form" type="hidden" value="blocks"> <table class="admintable"> <tbody> <tr class="windowbg2"> <td class="tborder" style="padding: 0; border: none;"> <table class="multiplerow">'; $side = array('left', 'right', 'center', 'front', 'bottom', 'top', 'lower'); $sd = array('lb', 'rb', 'cb', 'fb', 'bb', 'tb', 'lob'); for ($i = 0; $i < 7; $i++) { echo ' <tr class="catbg"> <td colspan="9"> <b>' . $txt['tp-' . $side[$i] . 'sideblocks'] . '</b> <a href="' . $scripturl . '?action=tpadmin;addblock=' . $side[$i] . ';' . $context['session_var'] . '=' . $context['session_id'] . '"> <span class="smalltext" style="float: right;">[', $txt['tp-addblock'], ']</span> </a> </td> </tr> '; if (isset($context['TPortal']['admin' . $side[$i] . 'panel']) && $context['TPortal']['admin' . $side[$i] . 'panel'] == 0 && $side[$i] != 'front') { echo ' <tr class="windowbg2"> <td colspan="9"> <div class="tborder error smalltext" style="padding: 2px;"><a style="color: red;" href="' . $scripturl . '?action=tpadmin;sa=panels">', $txt['tp-panelclosed'], '</a></div> </td> </tr>'; } if (isset($context['TPortal']['admin_' . $side[$i] . 'block']['blocks'])) { $tn = count($context['TPortal']['admin_' . $side[$i] . 'block']['blocks']); } else { $tn = 0; } if ($tn > 0) { echo ' <tr class="titlebg2"> <td class="smalltext">' . $txt['tp-pos'] . '</td> <td class="smalltext" colspan="2">' . $txt['tp-title'] . '</td> <td class="smalltext" >' . $txt['tp-type'] . '</td> <td class="smalltext" align="center">' . $txt['tp-activate'] . '</td> <td class="smalltext" align="center">' . $txt['tp-move'] . '</td> <td class="smalltext" align="center" colspan="2">' . $txt['tp-editsave'] . '</td> <td class="smalltext" align="center"2">' . $txt['tp-delete'] . '</td> </tr>'; } $n = 0; if ($tn > 0) { foreach ($context['TPortal']['admin_' . $side[$i] . 'block']['blocks'] as $lblock) { $newtitle = TPgetlangOption($lblock['lang'], $context['user']['language']); if (empty($newtitle)) { $newtitle = $lblock['title']; } if (!$lblock['loose']) { $class = "windowbg3"; } else { if ($lblock['off'] == 0) { $class = 'windowbg2'; } else { $class = 'windowbg'; } } echo ' <tr class="', $class, '"> <td>', $lblock['editgroups'] != '' && $lblock['editgroups'] != '-2' ? '#' : '', ' <input name="pos' . $lblock['id'] . '" type="text" size="2" value="' . $n * 10 . '"> <a name="block' . $lblock['id'] . '"></a>'; echo ' <a class="tpbut" title="' . $txt['tp-sortdown'] . '" href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';addpos=' . $lblock['id'] . '"><img src="' . $settings['tp_images_url'] . '/TPsort_down.gif" value="' . ($n * 10 + 11) . '" /></a>'; if ($n > 0) { echo ' <a class="tpbut" title="' . $txt['tp-sortup'] . '" href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';subpos=' . $lblock['id'] . '"><img src="' . $settings['tp_images_url'] . '/TPsort_up.gif" value="' . ($n * 10 - 11) . '" /></a>'; } echo ' </td> <td colspan="2"><input name="title' . $lblock['id'] . '" type="text" size="20" value="' . html_entity_decode($newtitle) . '"></td> <td> <select size="1" name="type' . $lblock['id'] . '"> <option value="0"', $lblock['type'] == 'no' ? ' selected' : '', '>', $txt['tp-blocktype0'], '</option> <option value="1"', $lblock['type'] == 'userbox' ? ' selected' : '', '>', $txt['tp-blocktype1'], '</option> <option value="2"', $lblock['type'] == 'newsbox' ? ' selected' : '', '>', $txt['tp-blocktype2'], '</option> <option value="3"', $lblock['type'] == 'statsbox' ? ' selected' : '', '>', $txt['tp-blocktype3'], '</option> <option value="4"', $lblock['type'] == 'searchbox' ? ' selected' : '', '>', $txt['tp-blocktype4'], '</option> <option value="5"', $lblock['type'] == 'html' ? ' selected' : '', '>', $txt['tp-blocktype5'], '</option> <option value="6"', $lblock['type'] == 'onlinebox' ? ' selected' : '', '>', $txt['tp-blocktype6'], '</option> <option value="7"', $lblock['type'] == 'themebox' ? ' selected' : '', '>', $txt['tp-blocktype7'], '</option> <option value="9"', $lblock['type'] == 'catmenu' ? ' selected' : '', '>', $txt['tp-blocktype9'], '</option> <option value="10"', $lblock['type'] == 'phpbox' ? ' selected' : '', '>', $txt['tp-blocktype10'], '</option> <option value="11"', $lblock['type'] == 'scriptbox' ? ' selected' : '', '>', $txt['tp-blocktype11'], '</option> <option value="12"', $lblock['type'] == 'recentbox' ? ' selected' : '', '>', $txt['tp-blocktype12'], '</option> <option value="13"', $lblock['type'] == 'ssi' ? ' selected' : '', '>', $txt['tp-blocktype13'], '</option> <option value="14"', $lblock['type'] == 'module' ? ' selected' : '', '>', $txt['tp-blocktype14'], '</option> <option value="15"', $lblock['type'] == 'rss' ? ' selected' : '', '>', $txt['tp-blocktype15'], '</option> <option value="16"', $lblock['type'] == 'sitemap' ? ' selected' : '', '>', $txt['tp-blocktype16'], '</option> <option value="18"', $lblock['type'] == 'articlebox' ? ' selected' : '', '>', $txt['tp-blocktype18'], '</option> <option value="19"', $lblock['type'] == 'categorybox' ? ' selected' : '', '>', $txt['tp-blocktype19'], '</option> <option value="20"', $lblock['type'] == 'tpmodulebox' ? ' selected' : '', '>', $txt['tp-blocktype20'], '</option>'; // theme hooks if (function_exists('ctheme_tp_blocks')) { ctheme_tp_blocks('listblocktypes2', $lblock['type']); } echo '</select> </td> <td align="center"> <a name="' . $lblock['id'] . '"></a> <img class="toggleButton" id="blockonbutton' . $lblock['id'] . '" title="' . $txt['tp-activate'] . '" border="0" src="' . $settings['tp_images_url'] . '/TP', $lblock['off'] == '0' ? 'active2' : 'active1', '.gif" alt="' . $txt['tp-activate'] . '" />'; echo ' </td> <td align="center" >'; switch ($side[$i]) { case 'left': echo ' <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockright=' . $lblock['id'] . '"><img title="' . $txt['tp-moveright'] . '" src="' . $settings['tp_images_url'] . '/TPselect_right.gif" alt="' . $txt['tp-moveright'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockcenter=' . $lblock['id'] . '"><img title="' . $txt['tp-movecenter'] . '" src="' . $settings['tp_images_url'] . '/TPselect_upper.gif" alt="' . $txt['tp-movecenter'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockfront=' . $lblock['id'] . '"><img title="' . $txt['tp-movefront'] . '" src="' . $settings['tp_images_url'] . '/TPselect_front.gif" alt="' . $txt['tp-movefront'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockbottom=' . $lblock['id'] . '"><img title="' . $txt['tp-movedown'] . '" src="' . $settings['tp_images_url'] . '/TPselect_bottom.gif" alt="' . $txt['tp-movedown'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blocktop=' . $lblock['id'] . '"><img title="' . $txt['tp-moveup'] . '" src="' . $settings['tp_images_url'] . '/TPselect_top.gif" alt="' . $txt['tp-moveup'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blocklower=' . $lblock['id'] . '"><img title="' . $txt['tp-movelower'] . '" src="' . $settings['tp_images_url'] . '/TPselect_lower.gif" alt="' . $txt['tp-movelower'] . '" /></a>'; break; case 'right': echo ' <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockleft=' . $lblock['id'] . '"><img title="' . $txt['tp-moveleft'] . '" src="' . $settings['tp_images_url'] . '/TPselect_left.gif" alt="' . $txt['tp-moveleft'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockcenter=' . $lblock['id'] . '"><img title="' . $txt['tp-movecenter'] . '" src="' . $settings['tp_images_url'] . '/TPselect_upper.gif" alt="' . $txt['tp-movecenter'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockfront=' . $lblock['id'] . '"><img title="' . $txt['tp-movefront'] . '" src="' . $settings['tp_images_url'] . '/TPselect_front.gif" alt="' . $txt['tp-movefront'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockbottom=' . $lblock['id'] . '"><img title="' . $txt['tp-movedown'] . '" src="' . $settings['tp_images_url'] . '/TPselect_bottom.gif" alt="' . $txt['tp-movedown'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blocktop=' . $lblock['id'] . '"><img title="' . $txt['tp-moveup'] . '" src="' . $settings['tp_images_url'] . '/TPselect_top.gif" alt="' . $txt['tp-moveup'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blocklower=' . $lblock['id'] . '"><img title="' . $txt['tp-movelower'] . '" src="' . $settings['tp_images_url'] . '/TPselect_lower.gif" alt="' . $txt['tp-movelower'] . '" /></a>'; break; case 'center': echo ' <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockleft=' . $lblock['id'] . '"><img title="' . $txt['tp-moveleft'] . '" src="' . $settings['tp_images_url'] . '/TPselect_left.gif" alt="' . $txt['tp-moveleft'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockright=' . $lblock['id'] . '"><img title="' . $txt['tp-moveright'] . '" src="' . $settings['tp_images_url'] . '/TPselect_right.gif" alt="' . $txt['tp-moveright'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockfront=' . $lblock['id'] . '"><img title="' . $txt['tp-movefront'] . '" src="' . $settings['tp_images_url'] . '/TPselect_front.gif" alt="' . $txt['tp-movefront'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockbottom=' . $lblock['id'] . '"><img title="' . $txt['tp-movedown'] . '" src="' . $settings['tp_images_url'] . '/TPselect_bottom.gif" alt="' . $txt['tp-movedown'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blocktop=' . $lblock['id'] . '"><img title="' . $txt['tp-moveup'] . '" src="' . $settings['tp_images_url'] . '/TPselect_top.gif" alt="' . $txt['tp-moveup'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blocklower=' . $lblock['id'] . '"><img title="' . $txt['tp-movelower'] . '" src="' . $settings['tp_images_url'] . '/TPselect_lower.gif" alt="' . $txt['tp-movelower'] . '" /></a>'; break; case 'front': echo ' <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockleft=' . $lblock['id'] . '"><img title="' . $txt['tp-moveleft'] . '" src="' . $settings['tp_images_url'] . '/TPselect_left.gif" alt="' . $txt['tp-moveleft'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockright=' . $lblock['id'] . '"><img title="' . $txt['tp-moveright'] . '" src="' . $settings['tp_images_url'] . '/TPselect_right.gif" alt="' . $txt['tp-moveright'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockcenter=' . $lblock['id'] . '"><img title="' . $txt['tp-movecenter'] . '" src="' . $settings['tp_images_url'] . '/TPselect_upper.gif" alt="' . $txt['tp-movecenter'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockbottom=' . $lblock['id'] . '"><img title="' . $txt['tp-movedown'] . '" src="' . $settings['tp_images_url'] . '/TPselect_bottom.gif" alt="' . $txt['tp-movedown'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blocktop=' . $lblock['id'] . '"><img title="' . $txt['tp-moveup'] . '" src="' . $settings['tp_images_url'] . '/TPselect_top.gif" alt="' . $txt['tp-moveup'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blocklower=' . $lblock['id'] . '"><img title="' . $txt['tp-movelower'] . '" src="' . $settings['tp_images_url'] . '/TPselect_lower.gif" alt="' . $txt['tp-movelower'] . '" /></a>'; break; case 'bottom': echo ' <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockleft=' . $lblock['id'] . '"><img title="' . $txt['tp-moveleft'] . '" src="' . $settings['tp_images_url'] . '/TPselect_left.gif" alt="' . $txt['tp-moveleft'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockright=' . $lblock['id'] . '"><img title="' . $txt['tp-moveright'] . '" src="' . $settings['tp_images_url'] . '/TPselect_right.gif" alt="' . $txt['tp-moveright'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockcenter=' . $lblock['id'] . '"><img title="' . $txt['tp-movecenter'] . '" src="' . $settings['tp_images_url'] . '/TPselect_upper.gif" alt="' . $txt['tp-movecenter'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockfront=' . $lblock['id'] . '"><img title="' . $txt['tp-movefront'] . '" src="' . $settings['tp_images_url'] . '/TPselect_front.gif" alt="' . $txt['tp-movefront'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blocktop=' . $lblock['id'] . '"><img title="' . $txt['tp-moveup'] . '" src="' . $settings['tp_images_url'] . '/TPselect_top.gif" alt="' . $txt['tp-moveup'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blocklower=' . $lblock['id'] . '"><img title="' . $txt['tp-movelower'] . '" src="' . $settings['tp_images_url'] . '/TPselect_lower.gif" alt="' . $txt['tp-movelower'] . '" /></a>'; break; case 'top': echo ' <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockleft=' . $lblock['id'] . '"><img title="' . $txt['tp-moveleft'] . '" src="' . $settings['tp_images_url'] . '/TPselect_left.gif" alt="' . $txt['tp-moveleft'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockright=' . $lblock['id'] . '"><img title="' . $txt['tp-moveright'] . '" src="' . $settings['tp_images_url'] . '/TPselect_right.gif" alt="' . $txt['tp-moveright'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockcenter=' . $lblock['id'] . '"><img title="' . $txt['tp-movecenter'] . '" src="' . $settings['tp_images_url'] . '/TPselect_upper.gif" alt="' . $txt['tp-movecenter'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockfront=' . $lblock['id'] . '"><img title="' . $txt['tp-movefront'] . '" src="' . $settings['tp_images_url'] . '/TPselect_front.gif" alt="' . $txt['tp-movefront'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockbottom=' . $lblock['id'] . '"><img title="' . $txt['tp-movedown'] . '" src="' . $settings['tp_images_url'] . '/TPselect_bottom.gif" alt="' . $txt['tp-movedown'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blocklower=' . $lblock['id'] . '"><img title="' . $txt['tp-movelower'] . '" src="' . $settings['tp_images_url'] . '/TPselect_lower.gif" alt="' . $txt['tp-movelower'] . '" /></a>'; break; case 'lower': echo ' <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockleft=' . $lblock['id'] . '"><img title="' . $txt['tp-moveleft'] . '" src="' . $settings['tp_images_url'] . '/TPselect_left.gif" alt="' . $txt['tp-moveleft'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockright=' . $lblock['id'] . '"><img title="' . $txt['tp-moveright'] . '" src="' . $settings['tp_images_url'] . '/TPselect_right.gif" alt="' . $txt['tp-moveright'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockcenter=' . $lblock['id'] . '"><img title="' . $txt['tp-movecenter'] . '" src="' . $settings['tp_images_url'] . '/TPselect_upper.gif" alt="' . $txt['tp-movecenter'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockfront=' . $lblock['id'] . '"><img title="' . $txt['tp-movefront'] . '" src="' . $settings['tp_images_url'] . '/TPselect_front.gif" alt="' . $txt['tp-movefront'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockbottom=' . $lblock['id'] . '"><img title="' . $txt['tp-movedown'] . '" src="' . $settings['tp_images_url'] . '/TPselect_bottom.gif" alt="' . $txt['tp-movedown'] . '" /></a> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blocktop=' . $lblock['id'] . '"><img title="' . $txt['tp-moveup'] . '" src="' . $settings['tp_images_url'] . '/TPselect_top.gif" alt="' . $txt['tp-moveup'] . '" /></a>'; break; } echo ' </td> <td colspan="2" align="center"> <a href="' . $scripturl . '?action=tpadmin;blockedit=' . $lblock['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '"><img title="' . $txt['tp-edit'] . '" border="0" align="middle" src="' . $settings['tp_images_url'] . '/TPmodify.gif" alt="' . $txt['tp-edit'] . '" /></a>'; echo ' <input align="middle" class="tpbut" type="image" src="' . $settings['tp_images_url'] . '/TPsave.gif" alt="' . $txt['tp-send'] . '" value="�" onClick="javascript: submit();">'; echo ' </td> <td colspan="2" align="center"> <a href="' . $scripturl . '?action=tpadmin;' . $context['session_var'] . '=' . $context['session_id'] . ';blockdelete=' . $lblock['id'] . '" onclick="javascript:return confirm(\'' . $txt['tp-blockconfirmdelete'] . '\')"><img title="' . $txt['tp-delete'] . '" align="middle" border="0" src="' . $settings['tp_images_url'] . '/tp-delete_shout.gif" alt="' . $txt['tp-delete'] . '" /></a> </td> </tr>'; if ($lblock['type'] == 'recentbox') { // check to see if it is numeric if (!is_numeric($lblock['body'])) { $lblock['body'] = '10'; } echo ' <tr class="windowbg"> <td colspan="9" align="center"> ' . $txt['tp-numberofrecenttopics'] . '<input style="width: 50px;" name="blockbody' . $lblock['id'] . '" value="' . $lblock['body'] . '"> </td> </tr>'; } elseif ($lblock['type'] == 'ssi') { // SSI block..which function? if (!in_array($lblock['body'], array('recentpoll', 'toppoll', 'topposters', 'topboards', 'topreplies', 'topviews', 'calendar'))) { $lblock['body'] = ''; } echo ' <tr class="windowbg"> <td colspan="9" align="center"> <select name="blockbody' . $lblock['id'] . '"><option value="" ', $lblock['body'] == '' ? 'selected' : '', '>' . $txt['tp-none-'] . '</option>'; echo ' <option value="recentpoll" ', $lblock['body'] == 'recentpoll' ? 'selected' : '', '>' . $txt['tp-ssi-recentpoll'] . '</option>'; echo ' <option value="toppoll" ', $lblock['body'] == 'toppoll' ? 'selected' : '', '>' . $txt['tp-ssi-toppoll'] . '</option>'; echo ' <option value="topboards" ', $lblock['body'] == 'topboards' ? 'selected' : '', '>' . $txt['tp-ssi-topboards'] . '</option>'; echo ' <option value="topposters" ', $lblock['body'] == 'topposters' ? 'selected' : '', '>' . $txt['tp-ssi-topposters'] . '</option>'; echo ' <option value="topreplies" ', $lblock['body'] == 'topreplies' ? 'selected' : '', '>' . $txt['tp-ssi-topreplies'] . '</option>'; echo ' <option value="topviews" ', $lblock['body'] == 'topviews' ? 'selected' : '', '>' . $txt['tp-ssi-topviews'] . '</option>'; echo ' <option value="calendar" ', $lblock['body'] == 'calendar' ? 'selected' : '', '>' . $txt['tp-ssi-calendar'] . '</option> </select> </td> </tr>'; } elseif ($lblock['type'] == 'rss') { echo ' <tr class="windowbg"> <td colspan="9" align="center"> ' . $txt['tp-rssblock'] . '<input style="width: 75%;" name="blockbody' . $lblock['id'] . '" value="' . $lblock['body'] . '"> </td> </tr>'; } elseif ($lblock['type'] == 'module') { echo ' <tr class="windowbg"> <td colspan="9" align="center"> <select name="blockbody' . $lblock['id'] . '"> <option value="dl-stats" ', $lblock['body'] == 'dl-stats' ? 'selected' : '', '>' . $txt['tp-module1'] . '</option> <option value="dl-stats2" ', $lblock['body'] == 'dl-stats2' ? 'selected' : '', '>' . $txt['tp-module2'] . '</option> <option value="dl-stats3" ', $lblock['body'] == 'dl-stats3' ? 'selected' : '', '>' . $txt['tp-module3'] . '</option> <option value="dl-stats4" ', $lblock['body'] == 'dl-stats4' ? 'selected' : '', '>' . $txt['tp-module4'] . '</option> <option value="dl-stats5" ', $lblock['body'] == 'dl-stats5' ? 'selected' : '', '>' . $txt['tp-module5'] . '</option> <option value="dl-stats6" ', $lblock['body'] == 'dl-stats6' ? 'selected' : '', '>' . $txt['tp-module6'] . '</option> <option value="dl-stats7" ', $lblock['body'] == 'dl-stats7' ? 'selected' : '', '>' . $txt['tp-module7'] . '</option> <option value="dl-stats8" ', $lblock['body'] == 'dl-stats8' ? 'selected' : '', '>' . $txt['tp-module8'] . '</option> <option value="dl-stats9" ', $lblock['body'] == 'dl-stats9' ? 'selected' : '', '>' . $txt['tp-module9'] . '</option> </select> </td> </tr>'; } elseif ($lblock['type'] == 'articlebox') { // check to see if it is numeric if (!is_numeric($lblock['body'])) { $lblock['body'] = ''; } echo ' <tr class="windowbg"> <td colspan="9" align="center"> <select name="blockbody' . $lblock['id'] . '">'; foreach ($context['TPortal']['edit_articles'] as $article) { echo ' <option value="' . $article['id'] . '" ', $lblock['body'] == $article['id'] ? ' selected' : '', ' >' . html_entity_decode($article['subject'], ENT_QUOTES) . '</option>'; } echo ' </select> </td> </tr>'; } elseif ($lblock['type'] == 'categorybox') { // check to see if it is numeric if (!is_numeric($lblock['body'])) { $lblock['body'] = ''; } echo ' <tr class="windowbg"> <td colspan="9" align="center"> <select name="blockbody' . $lblock['id'] . '">'; if (isset($context['TPortal']['catnames']) && count($context['TPortal']['catnames']) > 0) { foreach ($context['TPortal']['catnames'] as $cat => $val) { echo ' <option value="' . $cat . '" ', $lblock['body'] == $cat ? ' selected' : '', ' >' . html_entity_decode($val) . '</option>'; } } echo ' </select> </td> </tr>'; } $n++; } } } 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 TPortal_panel($side) { global $context, $scripturl, $settings; if (function_exists('ctheme_tportal_panel')) { ctheme_tportal_panel($side); return; } // decide for $flow $flow = $context['TPortal']['block_layout_' . $side]; $panelside = $paneltype = $side == 'front' ? 'frontblocks' : 'blocks'; $code = ' <div class="tp_' . $side . 'panel" style="overflow: hidden;">'; // set the grid type if ($flow == 'grid') { $grid_selected = $context['TPortal']['blockgrid_' . $side]; if ($grid_selected == 'colspan3') { $grid_recycle = 4; } elseif ($grid_selected == 'rowspan1') { $grid_recycle = 5; } $grid_entry = 0; // fetch the grids.. TP_blockgrids(); } // check if we left out the px!! if (is_numeric($context['TPortal']['blockwidth_' . $side])) { $context['TPortal']['blockwidth_' . $side] .= 'px'; } // for the cols, calculate numbers if ($flow == 'horiz2') { $flowgrid = array('1' => array(1, 0), '2' => array(1, 1), '3' => array(2, 1), '4' => array(2, 2), '5' => array(3, 2), '6' => array(3, 3), '7' => array(4, 3), '8' => array(4, 4), '9' => array(5, 4), '10' => array(5, 5), '11' => array(6, 5), '12' => array(6, 6), '13' => array(7, 6), '14' => array(7, 7), '15' => array(8, 7), '16' => array(8, 8)); $switch = ceil(count($context['TPortal'][$panelside][$side]) / 2); } elseif ($flow == 'horiz3') { $flowgrid = array('1' => array(1, 0, 0), '2' => array(1, 1, 0), '3' => array(1, 1, 1), '4' => array(2, 1, 1), '5' => array(2, 2, 1), '6' => array(2, 2, 2), '7' => array(3, 2, 2), '8' => array(3, 3, 2), '9' => array(3, 3, 3), '10' => array(4, 3, 3), '11' => array(4, 4, 3), '12' => array(4, 4, 4), '13' => array(5, 4, 4), '14' => array(5, 5, 4), '15' => array(5, 5, 5), '16' => array(6, 5, 5)); } elseif ($flow == 'horiz4') { $flowgrid = array('1' => array(1, 0, 0, 0), '2' => array(1, 1, 0, 0), '3' => array(1, 1, 1, 0), '4' => array(1, 1, 1, 1), '5' => array(2, 1, 1, 1), '6' => array(2, 2, 1, 1), '7' => array(2, 2, 2, 1), '8' => array(2, 2, 2, 2), '9' => array(3, 2, 2, 2), '10' => array(3, 3, 2, 2), '11' => array(3, 3, 3, 2), '12' => array(3, 3, 3, 3), '13' => array(4, 3, 3, 3), '14' => array(4, 4, 3, 3), '15' => array(4, 4, 4, 3), '16' => array(4, 4, 4, 4)); } if (in_array($flow, array('horiz2', 'horiz3', 'horiz4'))) { $pad = $context['TPortal']['padding']; if ($flow == 'horiz2') { $wh = 50; } elseif ($flow == 'horiz3') { $wh = 33; } elseif ($flow == 'horiz4') { $wh = 25; } echo '<table cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top" style="' . (isset($wh) ? 'width: ' . $wh . '%;' : '') . 'padding-right: ' . $pad . 'px; ">'; } $flowmain = 0; $flowsub = 0; $bcount = 0; $flowcount = isset($context['TPortal'][$panelside][$side]) ? count($context['TPortal'][$panelside][$side]) : 0; if (!isset($context['TPortal'][$panelside][$side])) { $context['TPortal'][$panelside][$side] = array(); } for ($i = 0, $n = count($context['TPortal'][$paneltype][$side]); $i < $n; $i += 1) { $block =& $context['TPortal'][$panelside][$side][$i]; if (!isset($block['frame'])) { continue; } $theme = $block['frame'] == 'theme'; // check if a language title string exists $newtitle = TPgetlangOption($block['lang'], $context['user']['language']); if (!empty($newtitle)) { $block['title'] = $newtitle; } $use = true; // special title links and variables for special types switch ($block['type']) { case 'searchbox': $mp = '<a class="subject" href="' . $scripturl . '?action=search">' . $block['title'] . '</a>'; $block['title'] = $mp; break; case 'onlinebox': $mp = '<a class="subject" href="' . $scripturl . '?action=who">' . $block['title'] . '</a>'; $block['title'] = $mp; if ($block['var1'] == 0) { $context['TPortal']['useavataronline'] = 0; } else { $context['TPortal']['useavataronline'] = 1; } break; case 'userbox': if ($context['user']['is_logged']) { $mp = '<a class="subject" href="' . $scripturl . '?action=profile;u=' . $context['user']['id'] . '">' . $block['title'] . '</a>'; } else { $mp = '<a class="subject" href="' . $scripturl . '?action=login">' . $block['title'] . '</a>'; } $block['title'] = $mp; break; case 'statsbox': $mp = '<a class="subject" href="' . $scripturl . '?action=stats">' . $block['title'] . '</a>'; $block['title'] = $mp; break; case 'recentbox': $mp = '<a class="subject" href="' . $scripturl . '?action=recent">' . $block['title'] . '</a>'; $context['TPortal']['recentboxnum'] = $block['body']; $context['TPortal']['useavatar'] = $block['var1']; if ($block['var1'] == '') { $context['TPortal']['useavatar'] = 1; } if (!empty($block['var2'])) { $context['TPortal']['recentbox_options'] = explode(',', $block['var2']); } break; case 'scriptbox': $block['title'] = '<span class="header">' . $block['title'] . '</span>'; $context['TPortal']['scriptboxbody'] = $block['body']; break; case 'phpbox': $block['title'] = '<span class="header">' . $block['title'] . '</span>'; $context['TPortal']['phpboxbody'] = $block['body']; break; case 'ssi': $block['title'] = '<span class="header">' . $block['title'] . '</span>'; $context['TPortal']['ssifunction'] = $block['body']; break; case 'module': $block['title'] = '<span class="header">' . $block['title'] . '</span>'; $context['TPortal']['moduleblock'] = $block['body']; $context['TPortal']['modulevar2'] = $block['var2']; break; case 'themebox': $block['title'] = '<span class="header">' . $block['title'] . '</span>'; $context['TPortal']['themeboxbody'] = $block['body']; break; case 'newsbox': $block['title'] = '<span class="header">' . $block['title'] . '</span>'; if ($context['random_news_line'] == '') { $use = false; } break; case 'articlebox': $block['title'] = '<span class="header">' . $block['title'] . '</span>'; $context['TPortal']['blockarticle'] = $block['body']; break; case 'rss': $block['title'] = '<span class="header rss">' . $block['title'] . '</span>'; $context['TPortal']['rss'] = $block['body']; $context['TPortal']['rss_notitles'] = $block['var2']; $context['TPortal']['rss_utf8'] = $block['var1']; $context['TPortal']['rsswidth'] = isset($block['var3']) ? $block['var3'] : ''; break; case 'categorybox': $block['title'] = '<span class="header">' . $block['title'] . '</span>'; $context['TPortal']['blocklisting'] = $block['body']; $context['TPortal']['blocklisting_height'] = $block['var1']; $context['TPortal']['blocklisting_author'] = $block['var2']; break; case 'tpmodulebox': $block['title'] = '<span class="header">' . $block['title'] . '</span>'; $context['TPortal']['moduleid'] = $block['var1']; $context['TPortal']['modulevar2'] = $block['var2']; $context['TPortal']['modulebody'] = $block['body']; break; case 'catmenu': $block['title'] = '<span class="header">' . $block['title'] . '</span>'; $context['TPortal']['menuid'] = is_numeric($block['body']) ? $block['body'] : 0; $context['TPortal']['menuvar1'] = $block['var1']; $context['TPortal']['menuvar2'] = $block['var2']; $context['TPortal']['blockid'] = $block['id']; break; } // render them horisontally if ($flow == 'horiz') { $pad = $context['TPortal']['padding']; if ($i == $flowcount - 1) { $pad = 0; } echo '<div style="float: left; width: ' . $context['TPortal']['blockwidth_' . $side] . ';"><div style="padding-right: ' . $pad . 'px; padding-bottom: ' . $pad . 'px;">'; call_user_func($context['TPortal']['hooks']['tp_block'], $block, $theme, $side); echo '</div></div>'; } elseif (in_array($flow, array('horiz2', 'horiz3', 'horiz4'))) { $pad = $context['TPortal']['padding']; if ($i == $flowcount - 1) { $pad = 0; } if ($flow == 'horiz2') { $wh = 50; } elseif ($flow == 'horiz3') { if ($i == $flowcount - 1) { $wh = 34; } else { $wh = 33; } } elseif ($flow == 'horiz4') { $wh = 25; } if (isset($flowgrid) && $flowsub == $flowgrid[$flowcount][$flowmain]) { $flowsub = 0; $flowmain++; echo '</td><td valign="top" style="' . (isset($wh) ? 'width: ' . $wh . '%;' : '') . 'padding-right: ' . $pad . 'px;">'; } call_user_func($context['TPortal']['hooks']['tp_block'], $block, $theme, $side); } elseif ($flow == 'grid') { echo TP_blockgrid($block, $theme, $grid_entry, $side, $grid_entry == $grid_recycle - 1 ? true : false, $grid_selected); $grid_entry++; if ($grid_recycle == $grid_entry) { $grid_entry = 0; } // what if its the last block, but in the middle of the recycle? if ($i == $n - 1) { if ($grid_entry > 0) { for ($a = $grid_entry; $a < $grid_recycle; $a++) { echo TP_blockgrid(0, 0, $a, $side, $a == $grid_recycle - 1 ? true : false, $grid_selected, true); } } } } else { call_user_func($context['TPortal']['hooks']['tp_block'], $block, $theme, $side); } $bcount++; $flowsub++; } if (in_array($flow, array('horiz2', 'horiz3', 'horiz4'))) { echo '</td></tr></table>'; } // the upshrink routine for blocks echo '</div> <script type="text/javascript"><!-- // --><![CDATA[ function toggle( targetId ) { var state = 0; var blockname = "block" + targetId; var blockimage = "blockcollapse" + targetId; if ( document.getElementById ) { target = document.getElementById( blockname ); if ( target.style.display == "none" ) { target.style.display = ""; state = 1; } else { target.style.display = "none"; state = 0; } document.getElementById( blockimage ).src = "' . $settings['tp_images_url'] . '" + (state ? "/TPcollapse.gif" : "/TPexpand.gif"); var tempImage = new Image(); tempImage.src = "' . $scripturl . '?action=tpmod;upshrink=" + targetId + ";state=" + state + ";" + (new Date().getTime()); } } // ]]></script>'; return $code; }