function show_templates($phase = 0) { global $UI_CONFIG; global $PutInAllTemplates; global $Templ, $DoAction; if ($DoAction !== NULL) { if ($phase == 1) { //изменение по "галкам" change_templates(); nc_print_status(NETCAT_MODULE_STATS_CHANGES_SAVED, "ok"); } elseif ($phase == 2) { // ставим во все макеты nc_openstat_put_counter_to_templates(); nc_print_status(NETCAT_MODULE_STATS_CHANGES_SAVED, "ok"); } elseif ($phase == 3) { // удаляем из всех макетов nc_openstat_delete_counter_from_templates(); nc_print_status(NETCAT_MODULE_STATS_CHANGES_SAVED, "ok"); } } if (!check_counters()) { return; } // Все макеты $result = write_template(0, nc_openstat_check_counter_in_templates(1)); if ($result) { echo "<form name='TemplatesForm' id='TemlatesForm' method='post' action='?sub_view=templates&phase=1'>\n\n <input type='hidden' name='DoAction' value='1'>\n <table cellpadding='0' cellspacing='0' class='templateMap'><tr>\n\n <td width='60px' align='center'>" . NETCAT_MODULE_STATS_OPENSTAT_INSERT_COUNTER . "</td>\n <td style='padding-left:15px;'>" . NETCAT_MODULE_STATS_OPENSTAT_TEMPLATE . "</td>\n\n </tr></table>"; echo $result; echo "</form>\n"; echo "<form name='addAllTemplatesForm' id='addAllTemplatesForm' method='post' action='?sub_view=templates&phase=2'>\n\n <input type='hidden' name='DoAction' value='1'>\n </form>"; echo "<form name='delAllTemplatesForm' id='delAllTemplatesForm' method='post' action='?sub_view=templates&phase=3'>\n\n <input type='hidden' name='DoAction' value='1'>\n </form>"; $UI_CONFIG->actionButtons[] = array("id" => "submit_all", "caption" => NETCAT_MODULE_STATS_SAVE_CHANGES, "action" => "mainView.submitIframeForm('TemlatesForm')"); $UI_CONFIG->actionButtons[] = array("id" => "submit", "align" => 'left', "caption" => NETCAT_MODULE_STATS_OPENSTAT_INS_IN_ALL_TEMPLATES, "action" => "mainView.submitIframeForm('addAllTemplatesForm')"); $UI_CONFIG->actionButtons[] = array("id" => "submit", "align" => 'left', "caption" => NETCAT_MODULE_STATS_OPENSTAT_DEL_FROM_ALL_TEMPLATES, "action" => "mainView.submitIframeForm('delAllTemplatesForm')", "red_border" => true); } else { nc_print_status(CONTROL_TEMPLATE_NONE, "info"); } }
/** * Рукурсивная функция рисует макет * * @param нулевой индекс $ParentTemplateID */ function write_template($ParentTemplateID, $count = 0) { global $db; global $HTTP_DOMAIN, $HTTP_ROOT_PATH, $ADMIN_PATH, $ADMIN_TEMPLATE; $ParentTemplateID = +$ParentTemplateID; $SQL = "SELECT Template_ID,\n Description\n FROM Template\n where Parent_Template_ID = {$ParentTemplateID}\n AND File_Mode = " . +$_REQUEST['fs'] . "\n ORDER BY Priority, Template_ID"; if ($Result = $db->get_results($SQL, ARRAY_N)) { foreach ($Result as $Array) { $res .= "<table cellpadding='0' cellspacing='0' class='templateMap'>"; $res .= "<tr>\n <td class='withBorder' style='padding-left:" . intval($count * ($count == 1 ? 15 : 20)) . "px;" . (!$ParentTemplateID ? " font-weight: bold;" : "") . "'>" . ($ParentTemplateID ? "<img src='" . $ADMIN_PATH . "images/arrow_sec.gif' border='0' width='14' height='10' alt='arrow' title='" . $Array[0] . "'>" : "") . "<span>" . $Array[0] . ". </span><a href='index.php?fs=" . +$_REQUEST['fs'] . "&phase=4&TemplateID=" . $Array[0] . "'>" . $Array[1] . "</a></td>\n <td class='button withBorder'><a href='index.php?fs=" . +$_REQUEST['fs'] . "&phase=2&ParentTemplateID=" . $Array[0] . "'><i class='nc-icon nc--dev-templates-add nc--hovered' title='" . CONTROL_TEMPLATE_ADDLINK . "'></i></a></td>"; $res .= "<td class='button withBorder'>"; $res .= "<a href='index.php?fs=" . +$_REQUEST['fs'] . "&phase=6&Delete" . $Array[0] . "=" . $Array[0] . "'><i class='nc-icon nc--remove nc--hovered' title='" . CONTROL_TEMPLATE_REMOVETHIS . "'></i></a>"; $res .= "</td>"; $res .= "</tr>"; $res .= "</table>"; // children $res .= write_template($Array[0], $count + 1); } } return $res; }
$text = "<h2>Recent Items</h2>\n<ul>"; $items = 0; foreach ($timeline as $timestamp => $link_array) { $cnt = count($link_array); for ($i = $cnt - 1; $i >= 0; $i--) { if ($items++ > 20) { break; } $link_info = $link_array[$i]; $text .= "<li><span class=\"strong\">" . date_to_string($timestamp) . "</span> - ({$link_info['type']}) <a href=\"{$link_info['url']}\">{$link_info['title']}</a></li>\n"; } } write_timeline(); // copy static in if ($dh = opendir($static_dir)) { while (($file = readdir($dh)) !== false) { if (strlen($file) > 2) { copy($static_dir . $file, $root_dir . $file); chmod($root_dir . $file, 0777); // :| } } closedir($dh); } include "page_compress.php"; // generate index.html with the size of the zip, then add index.html to the zip $text .= "</ul>\n"; $text .= "<p><span class=\"italic\">Compiled on {$conf->compiled_on}.</span></p>\n"; write_template("index.html", "", "", array("@extra" => $text, "@johnc_archive_size" => human_readable_size(filesize("../files/johnc_archive.zip")))); chdir(".."); exec("zip -9 files/johnc_archive.zip index.html");