function tk_settings_page($par) { global $pagenow, $wp_version; $settings = get_option("tk_theme_settings"); if (version_compare($wp_version, '3.4', '>=')) { $theme_data = wp_get_theme(TEMPLATEPATH . '/style.css'); } else { $theme_data = get_theme_data(TEMPLATEPATH . '/style.css'); } ?> <div class="wrap"> <h2><?php $pages = @get_all_pages(); for ($i = 0; $i <= count($pages) - 1; $i++) { if ($pages[$i]['slug'] == $_GET['page']) { echo $pages[$i]['page_title']; } } ?> </h2> <?php if ('true' == esc_attr(@$_GET['error'])) { echo '<div class="error" ><p>All fields marked with (*) are required.</p></div>'; } if ('true' == esc_attr(@$_GET['updated'])) { echo '<div class="updated" ><p>Theme Settings updated.</p></div>'; } if (isset($_GET['tab'])) { tk_admin_tabs($_GET['tab']); } else { tk_admin_tabs(get_first_tab()); } ?> <div id="poststuff"> <form method="post" action="<?php admin_url('admin.php?page=' . $_GET['page']); ?> "> <?php wp_nonce_field("ilc-settings-page"); if ($pagenow == 'admin.php' && isset($_GET['page'])) { if (isset($_GET['tab'])) { $tab = $_GET['tab']; } else { $tab = get_first_tab(); } echo '<table class="form-table">'; global $tabs; $tk_theme_name = get_option('tk_theme_name'); foreach ($tabs as $r1) { if ($r1['id'] == $tab) { $row_items = 1; foreach ($r1 as $r2) { if ($row_items == 4) { if (count($r2) > 0) { foreach ($r2 as $r3) { if (@$r3['options']['required'] == 'yes') { $required = '* '; $required_hidden_field = '<input type="hidden" name="' . $r3['name'] . '_required" value="yes">'; } else { $required = ''; $required_hidden_field = '<input type="hidden" name="' . $r3['name'] . '_required" value="no">'; } if (isset($_GET['dev'])) { $dev = '<br /><font color="red">' . $tk_theme_name . '_' . $tab . '_' . $r3['name'] . '</font>'; } else { $dev = ''; } if ($r3['type'] == 'text') { //TYPE: TEXT if (isset($r3['options']['size'])) { $size = 'size = "' . $r3['options']['size'] . '"'; } else { $size = ''; } if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr> <th><label>' . $required . '' . $r3['label'] . '</label>' . $dev . '</th> <td> <input id="' . $r3['id'] . '" name="' . $r3['name'] . '" type="' . $r3['type'] . '" value="' . htmlspecialchars(stripslashes($val)) . '" ' . @$r3['options']['readonly'] . ' ' . $size . ' /> <span class="description"><br />' . $r3['desc'] . '</span> ' . $required_hidden_field . ' </td> </tr>'; } if ($r3['type'] == 'colorpicker') { //TYPE: COLORPICKER if (isset($r3['options']['size'])) { $size = 'size = "' . $r3['options']['size'] . '"'; } else { $size = ''; } if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr> <th><label>' . $required . '' . $r3['label'] . '</label>' . $dev . '</th> <td> <input id="' . $r3['id'] . '" name="' . $r3['name'] . '" type="text" value="' . $val . '" class="color" ' . $size . ' /> <span class="description">' . $r3['desc'] . '</span><input type="button" value="Reset" style="margin-left:15px" name="button' . $r3['id'] . '" id="button_' . $r3['id'] . '"/> ' . $required_hidden_field . ' </td> </tr>'; ?> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#button_<?php echo $r3['id']; ?> ').live('click', function(){ jQuery('#<?php echo $r3['id']; ?> ').val('<?php echo $r3['value']; ?> '); }) }) </script> <?php } if ($r3['type'] == 'datepicker') { //TYPE: DATEPICKER if (isset($r3['options']['size'])) { $size = 'size = "' . $r3['options']['size'] . '"'; } else { $size = ''; } if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr> <th><label>' . $required . '' . $r3['label'] . '</label>' . $dev . '</th> <td> <input id="' . $r3['id'] . '" name="' . $r3['name'] . '" type="text" value="' . $val . '" class="admin-datepicker" ' . $size . ' /> <span class="description">' . $r3['desc'] . '</span> ' . $required_hidden_field . ' </td> </tr>'; } if ($r3['type'] == 'hidden') { //TYPE: HIDDEN if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr>' . $dev . ' <td> <input id="' . $r3['id'] . '" name="' . $r3['name'] . '" type="' . $r3['type'] . '" value="' . stripslashes($val) . '" /> ' . $required_hidden_field . ' </td> </tr>'; } if ($r3['type'] == 'password') { //TYPE: PASSWORD if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr> <th><label>' . $required . '' . $r3['label'] . '</label>' . $dev . '</th> <td> <input id="' . $r3['id'] . '" name="' . $r3['name'] . '" type="' . $r3['type'] . '" value="' . $val . '" /> <span class="description">' . $r3['desc'] . '</span> ' . $required_hidden_field . ' </td> </tr>'; } if ($r3['type'] == 'radio') { //TYPE: RADIO if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr> <th><label>' . $required . '' . $r3['label'] . '</label>' . $dev . '</th> <td>'; for ($i = 0; $i < count($r3['value']); $i++) { if ($r3['value'][$i] == $val) { $checked = 'checked="checked"'; } else { $checked = ''; } echo '<input type="' . $r3['type'] . '" name="' . $r3['name'] . '" value="' . $r3['value'][$i] . '" ' . $checked . ' /> ' . $r3['caption'][$i] . '<br />'; } echo ' <span class="description">' . $r3['desc'] . '</span> ' . $required_hidden_field . ' </td> </tr>'; } if ($r3['type'] == 'checkbox') { //TYPE: CHECKBOX if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); @($val_database = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name'])); } else { $val = $r3['value']; @($val_database = array()); } echo '<tr> <th><label>' . $required . '' . $r3['label'] . '</label>' . $dev . '</th> <td>'; for ($i = 0; $i < count($r3['value']); $i++) { if (@in_array($r3['value'][$i], $val_database)) { $checked = 'checked="checked"'; } else { $checked = ''; } echo '<input type="' . $r3['type'] . '" name="' . $r3['name'] . '[]" value="' . $r3['value'][$i] . '" ' . $checked . ' /> ' . $r3['caption'][$i] . '<br />'; } echo '<input type="' . $r3['type'] . '" name="' . $r3['name'] . '[]" value="" style="display:none;" checked />'; echo ' <span class="description">' . $r3['desc'] . '</span> ' . $required_hidden_field . ' </td> </tr>'; } if ($r3['type'] == 'select') { //TYPE: SELECT if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr> <th><label>' . $required . '' . $r3['label'] . '</label>' . $dev . '</th> <td> <select name="' . $r3['name'] . '" id="' . $r3['id'] . '">'; for ($i = 0; $i < count($r3['value']); $i++) { if ($r3['value'][$i] == $val) { $selected = 'selected="selected"'; } else { $selected = ''; } echo '<option value="' . $r3['value'][$i] . '" ' . $selected . '>' . $r3['value'][$i] . '</option>'; } echo '</select> <span class="description"><br />' . $r3['desc'] . '</span> ' . $required_hidden_field . ' </td> </tr>'; } //TYPE: STYLE CHANGER if ($r3['type'] == 'stylechanger') { if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } ?> <div class="option-section" style="max-width: 960px;"> <?php foreach ($r3['styles'] as $styleobject) { if ($styleobject == $val) { $checked = 'checked="checked"'; } else { $checked = ''; } ?> <div class="one-style" style="display: inline-block;margin: 50px 10px 10px 10px"> <input type="radio" name="<?php echo $r3['name']; ?> " style="display: inline-block;position: relative;left: 50%;top: -170px;" value="<?php echo $styleobject; ?> " class="style-radio" <?php echo $checked; ?> > <div class="style-preview" style="background-image:url(<?php echo get_template_directory_uri(); ?> /style/stylechanger/<?php echo $styleobject; ?> .png);background-position: center center;width: 150px;height: 150px;display: inline-block;border:1px solid #DFDFDF"></div> </div> <?php } ?> <label class="option-description"><?php echo $r3['description']; ?> </label> </div> <?php } if ($r3['type'] == 'label') { //TYPE: LABEL if (isset($r3['options']['size'])) { $size = 'size = "' . $r3['options']['size'] . '"'; } else { $size = ''; } if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr> <th><label>' . $required . '' . $r3['label'] . '</label>' . $dev . '</th> </tr>'; } if ($r3['type'] == 'textarea') { //TYPE: TEXTAREA if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr> <th><label>' . $required . '' . $r3['label'] . '</label>' . $dev . '</th> <td> <textarea name="' . $r3['name'] . '" id="' . $r3['id'] . '" rows="' . @$r3['options']['rows'] . '" cols="' . @$r3['options']['cols'] . '">' . stripslashes($val) . '</textarea><br /> <span class="description">' . $r3['desc'] . '</span> ' . $required_hidden_field . ' </td> </tr>'; } if ($r3['type'] == 'file') { //TYPE: FILE if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr valign="top"> <th scope="row">' . $required . '' . $r3['label'] . ' ' . $dev . '</th> <td><label for="' . $r3['id'] . '"> <input class="upload-url" id="' . $r3['id'] . '" type="text" size="36" name="' . $r3['name'] . '" value="' . $val . '" /> <input class="st_upload_button" id="' . $r3['id'] . '_button" type="button" value="Upload" /> <br /><span class="description">' . $r3['desc'] . '</span> </label></td> ' . $required_hidden_field . ' </tr>'; } if ($r3['type'] == 'file_image') { //TYPE: FILE IMAGE if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr valign="top"> <th scope="row">' . $required . '' . $r3['label'] . ' ' . $dev . '</th> <td><label for="' . $r3['id'] . '"> <input class="upload-url" id="' . $r3['id'] . '" type="text" size="36" name="' . $r3['name'] . '" value="' . $val . '" /> <input class="st_upload_button" id="' . $r3['id'] . '_button" type="button" value="Upload" />'; if ($val != '') { echo '<img src="' . $val . '" width="30" height="30" />'; } echo '<br /><span class="description">' . $r3['desc'] . '</span> </label></td> ' . $required_hidden_field . ' </tr>'; } if ($r3['type'] == 'hr') { //TYPE: HR (horizontal line) echo '<tr valign="top"> <td colspan="2"><hr class="hr2" style="background-color: ' . @$r3['options']['color'] . ';color: ' . @$r3['options']['color'] . ';width: ' . @$r3['options']['width'] . ';height: 1px;border: 0 none;"></td> </tr>'; } if ($r3['type'] == 'button') { //TYPE: button (custom button) echo '<tr valign="top"> <td colspan="2" style="margin-left:0;padding-left:0"><input type="button" class="button-secondary" value="' . $r3['value'] . '" name="' . $r3['name'] . '" id="' . $r3['id'] . '"/></td> </tr>'; } if ($r3['type'] == 'pages') { //TYPE: dropdown Pages if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr> <th><label>' . $required . '' . $r3['label'] . '</label>' . $dev . '</th> <td>'; $args = array('selected' => $val, 'echo' => 1, 'name' => $r3['name']); wp_dropdown_pages($args); '<span class="description"><br />' . $r3['desc'] . '</span> ' . $required_hidden_field . ' </td> </tr>'; } if ($r3['type'] == 'category') { //TYPE: dropdown Categories if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr> <th><label>' . $required . '' . $r3['label'] . '</label>' . $dev . '</th> <td>'; $args = array('selected' => $val, 'echo' => 1, 'name' => $r3['name']); wp_dropdown_categories($args); '<span class="description"><br />' . $r3['desc'] . '</span> ' . $required_hidden_field . ' </td> </tr>'; } if ($r3['type'] == 'author') { //TYPE: dropdown Authors if (get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']) != '') { $val = get_option($tk_theme_name . '_' . $tab . '_' . $r3['name']); } else { $val = $r3['value']; } echo '<tr> <th><label>' . $required . '' . $r3['label'] . '</label>' . $dev . '</th> <td>'; $args = array('selected' => $val, 'name' => $r3['name']); wp_dropdown_users($args); '<span class="description"><br />' . $r3['desc'] . '</span> ' . $required_hidden_field . ' </td> </tr>'; } } } } $row_items++; } } } echo '</table>'; } ?> <p class="submit" style="clear: both;"> <input type="submit" name="Submit" class="button-primary" value="Update Settings" /> <input type="hidden" name="ilc-settings-submit" value="Y" /> </p> </form> </div> </div> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#button_test').live('click', function(){ jQuery.ajax({ type: "POST", url: "<?php echo get_template_directory_uri(); ?> /inc/reset_colors.php" }).done(function( ) { alert( 'Colors now have default values again!' ); }); }) }) </script> <?php }
if ($sel_page != NULL) { echo "- " . $sel_page['page_name']; } ?> </h1> </div> <div class="section"> <ul id="MenuBar1" class="MenuBarHorizontal"> <?php //this loop will go through and pick out each array the subjects while ($subject = mysql_fetch_array($subject_set)) { echo "<li><a class=\"MenuBarItemSubmenu\" href=\"" . $subject['link'] . "?index=" . $subject['id'] . "\">" . $subject["title"] . "</a>\n"; if ($subject['id'] != 4) { $page_set = get_all_pages($subject_set['id']); } else { $page_set = recent_blog_posts(3, $_COOKIE['friendly']); } //this second loop will get all of the corresponding sub-pages... echo "<ul>\n"; while ($page = mysql_fetch_array($page_set)) { if ($page['subject_id'] == $subject['id'] && $page['has_link'] == 1) { echo "<li><a href =\"" . $subject['link'] . "?index=" . $subject['id'] . "&page=" . $page['id'] . "\">" . $page['page_name'] . "</a></li>\n"; } } echo "</ul>\n</li>\n"; } ?> </ul>
function main($id, $mode) { global $db, $user, $auth, $template, $cache; global $config, $k_config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $SID; include $phpbb_root_path . 'includes/sgp_functions_admin.' . $phpEx; // Define Switches for html file // $user->add_lang('acp/k_blocks'); $this->tpl_name = 'acp_k_blocks'; $this->page_title = 'ACP_BLOCKS'; $form_key = 'acp_k_blocks'; add_form_key($form_key); $action = request_var('action', ''); $submit = isset($_POST['submit']) ? true : false; if ($submit && !check_form_key($form_key)) { $submit = false; $mode = ''; trigger_error($user->lang['FORM_INVALID']); } // Can not use append_sid here, the $block_id is assigned to the html but unknow to this code // // Would require I add a form element and use request_var to retrieve it // // The global $SID is available so I make use of it...? $template->assign_vars(array('U_BACK' => $this->u_action, 'U_EDIT2' => "{$phpbb_admin_path}index.{$phpEx}{$SID}&i=k_blocks&mode=edit&block=", 'U_UP' => "{$phpbb_admin_path}index.{$phpEx}{$SID}&i=k_blocks&mode=up&block=", 'U_DOWN' => "{$phpbb_admin_path}index.{$phpEx}{$SID}&i=k_blocks&mode=down&block=", 'U_DELETE' => "{$phpbb_admin_path}index.{$phpEx}{$SID}&i=k_blocks&mode=delete&block=", 'U_SET_VARS_W' => "{$phpbb_admin_path}index.{$phpEx}{$SID}&i=k_modules&mode=welcome&block=", 'U_SET_VARS' => "{$phpbb_admin_path}index.{$phpEx}{$SID}&i=k_vars&mode=config&block=", 'U_LINK_MINIMOD' => "{$phpbb_admin_path}index.{$phpEx}{$SID}&i=k_modules&mode=edit&module=", 'U_MANAGE_PAGES' => "{$phpbb_admin_path}index.{$phpEx}{$SID}&i=k_pages&mode=manage")); // Set up general vars $mode = request_var('mode', ''); $block = request_var('block', ''); // bold current row text so things are easier to follow when moving/editing etc... // if ($block ? $block : 0) { $sql = 'UPDATE ' . K_BLOCKS_CONFIG_VAR_TABLE . ' SET config_value = ' . (int) $block . ' WHERE config_name = "adm_block"'; $db->sql_query($sql); } else { $wheresql = ' WHERE config_name = "adm_block"'; $sql = 'SELECT config_name, config_value FROM ' . K_BLOCKS_CONFIG_VAR_TABLE . $wheresql; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $k_config[$row['config_name']] = $row['config_value']; } $template->assign_var('ADM_BLOCK', $k_config['adm_block']); //$u_action = append_sid("{$phpbb_admin_path}index.$phpEx" , "i=$id&mode=" . strtolower($mode)); $u_action = append_sid("{$phpbb_admin_path}index.{$phpEx}", "i={$id}&mode=" . $mode); switch ($mode) { case 'up': case 'down': $to_move = $move_to = array(); // get current block data// $sql = "SELECT id, ndx, position FROM " . K_BLOCKS_TABLE . "\n\t\t\t\t\tWHERE id = " . (int) $block . " LIMIT 1"; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['ERROR_PORTAL_BLOCKS'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } // Added function to reindex blocks after a block deletion Dicky if (isset($current_position) && $current_position != $position) { $index_start = get_lowest_ndx($current_position); reindex_column($current_position, $index_start); } $row = $db->sql_fetchrow($result); $to_move['id'] = $row['id']; $to_move['ndx'] = $temp = $row['ndx']; // position is char 'L', 'R', 'C' (char) // $position = $row['position']; if ($mode == 'up') { $temp = $temp - 1; } if ($mode == 'down') { $temp = $temp + 1; } // get move_to block data// $sql = "SELECT id, ndx, position FROM " . K_BLOCKS_TABLE . "\n\t\t\t\t\tWHERE ndx = '" . (int) $temp . "' AND position = '" . $db->sql_escape($position) . "' LIMIT 1"; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['BLOCK_MOVE_ERROR'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } $row = $db->sql_fetchrow($result); $move_to['id'] = $row['id']; $move_to['ndx'] = $row['ndx']; if ($move_to['ndx'] != $temp || $move_to['id'] == '') { trigger_error($user->lang['BLOCK_MOVE_ERROR'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } if ($mode == 'up') { // sql is not duplicated $sql = "UPDATE " . K_BLOCKS_TABLE . " SET ndx = " . $to_move['ndx'] . " WHERE id = " . $move_to['id']; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['BLOCK_MOVE_ERROR'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } $sql = "UPDATE " . K_BLOCKS_TABLE . " SET ndx = " . $move_to['ndx'] . " WHERE id = " . $to_move['id']; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['BLOCK_MOVE_ERROR'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } } if ($mode == 'down') { // sql is not duplicated $sql = "UPDATE " . K_BLOCKS_TABLE . " SET ndx = " . $move_to['ndx'] . " WHERE id = " . $to_move['id']; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['BLOCK_MOVE_ERROR'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } $sql = "UPDATE " . K_BLOCKS_TABLE . " SET ndx = " . $to_move['ndx'] . " WHERE id = " . $move_to['id']; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['BLOCK_MOVE_ERROR'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } } $template->assign_var('BLOCK_REPORT', $user->lang['BLOCK_UPDATING']); if ($position) { $mode = $position; } else { $mode = 'manage'; } $cache->destroy('sql', K_BLOCKS_TABLE); meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_blocks&mode=' . $mode)); break; case 'add': case 'ADD': if ($submit) { if (request_var('html_file_name', '') == "" or request_var('title', '') == "") { $message = $user->lang['MISSING_BLOCK_DATA']; $template->assign_var('BLOCK_REPORT', $message . '<br />'); meta_refresh(2, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_blocks&mode=add')); return; } //$id = request_var('m_id']; // auto assigned //$ndx = request_var('ndx']; // we calculate this $title = utf8_normalize_nfc(request_var('title', '', true)); $position = request_var('position', ''); $active = request_var('active', 1); $type = request_var('type', ''); $scroll = request_var('scroll', 0); $view_by = request_var('view_by', 1); $view_groups = request_var('view_groups', ''); $view_all = request_var('view_all', 1); $view_pages = request_var('view_pages', ''); $html_file_name = request_var('html_file_name', ''); $var_file_name = request_var('var_file_name', ''); $img_file_name = request_var('img_file_name', ''); $has_vars = request_var('has_vars', 0); $minimod_based = request_var('minimod_based', 0); $mod_block_id = request_var('mod_block_id', 0); $block_cache_time = request_var('block_cache_time', 300); if ($view_all) { $view_by = 1; } if ($img_file_name == '') { $img_file_name = 'default.gif'; } if ($has_vars == 0) { $var_file_name = ''; } if ($minimod_based == 0) { $mod_block_id = '0'; } $view_page_id = request_var('view_page_id', array(0)); for ($i = 0; $i < count($view_page_id); $i++) { $view_pages .= $view_page_id[$i]; if ($i < count($view_page_id) - 1) { $view_pages .= ','; } } $ndx = get_next_ndx($position); // get the next ndx to use for this position // $sql_array = array('ndx' => $ndx, 'title' => $title, 'active' => $active, 'html_file_name' => $html_file_name, 'var_file_name' => $var_file_name, 'img_file_name' => $img_file_name, 'position' => $position, 'view_by' => $view_by, 'view_groups' => $view_groups, 'view_all' => $view_all, 'view_pages' => $view_pages, 'scroll' => $scroll, 'has_vars' => $has_vars, 'minimod_based' => $minimod_based, 'mod_block_id' => $mod_block_id, 'block_cache_time' => $block_cache_time); if (!$db->sql_query('INSERT INTO ' . K_BLOCKS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_array))) { trigger_error($user->lang['COULD_NOT_ADD_BLOCK'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } else { $message = $user->lang['BLOCK_ADDED']; $template->assign_var('BLOCK_REPORT', $title . $message . '</font><br />'); } $cache->destroy('sql', K_BLOCKS_TABLE); meta_refresh(2, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_blocks&mode=manage')); return; } else { // get all groups and fill array // get_all_groups(); get_all_pages(0); get_all_minimods(); get_all_vars_files($block); //Get all installed blocks// $data = ''; $c = 0; $sql = 'SELECT * FROM ' . K_BLOCKS_TABLE; if ($result = $db->sql_query($sql)) { while ($row = $db->sql_fetchrow($result)) { $data .= $row['id']; $data .= ' '; $c++; } } $dirslist = ''; $dirs = dir($phpbb_root_path . 'styles/_portal_common/template/blocks'); while ($file = $dirs->read()) { if (!stripos($file, ".bak")) { $dirslist .= "{$file} "; } } closedir($dirs->handle); $dirslist = explode(" ", $dirslist); sort($dirslist); for ($i = 0; $i < sizeof($dirslist); $i++) { if ($dirslist[$i] != '') { $template->assign_block_vars('html_file_name', array('S_BLOCK_FILE_HTML' => $dirslist[$i])); } } $dirslist = '.. '; $dirs = dir($phpbb_root_path . 'images/block_images/block'); while ($file = $dirs->read()) { if (stripos($file, ".gif") || stripos($file, ".png")) { $dirslist .= "{$file} "; } } closedir($dirs->handle); $dirslist = explode(" ", $dirslist); sort($dirslist); for ($i = 0; $i < sizeof($dirslist); $i++) { if ($dirslist[$i] != '') { $template->assign_block_vars('img_file_name', array('S_BLOCK_FILE_I' => $dirslist[$i])); } } $dirslist = ''; $template->assign_var('S_OPTIONS', strtoupper($mode)); } break; case 'edit': case 'EDIT': if ($submit) { $id = request_var('id', 0); $ndx = request_var('ndx', 0); $title = utf8_normalize_nfc(request_var('title', '', true)); $position = request_var('position', ''); $type = request_var('type', ''); $active = request_var('active', 1); $view_by = request_var('view_by', 1); $view_groups = request_var('view_groups', ''); $view_all = request_var('view_all', 1); $view_pages = request_var('view_pages', ''); $scroll = request_var('scroll', 0); $has_vars = request_var('has_vars', 0); $minimod_based = request_var('minimod_based', 0); $mod_block_id = request_var('mod_block_id', 0); $html_file_name = request_var('html_file_name', ''); $var_file_name = request_var('var_file_name', ''); $img_file_name = request_var('img_file_name', ''); $block_cache_time = request_var('block_cache_time', 300); $view_page_id = request_var('view_page_id', array(0)); for ($i = 0; $i < count($view_page_id); $i++) { $view_pages .= $view_page_id[$i]; if ($i < count($view_page_id) - 1) { $view_pages .= ','; } } // this shoud not happen but just in case // if (!$id) { $template->assign_var('BLOCK_REPORT', $user->lang['UNKNOWN_ERROR']); $submit = false; return; } if ($type == 1) { $type = 'H'; } else { $type = 'B'; } if ($view_by == '' && !$view_all) { $view_by = 0; } else { if ($view_all) { $view_by = 1; } } if ($img_file_name == '') { $img_file_name = 'default.gif'; } if ($has_vars == 0) { $var_file_name = ''; } if ($minimod_based == 0) { $mod_block_id = '0'; } // get the current block position // $current_position = get_current_position($id); // if moving block position (column) // if ($current_position != $position) { $ndx = get_next_ndx($position); } // change to build array later $sql = "UPDATE " . K_BLOCKS_TABLE . "\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\tndx\t\t\t\t\t= '" . (int) $ndx . "',\n\t\t\t\t\t\t\tactive\t\t\t\t= '" . (int) $active . "',\n\t\t\t\t\t\t\ttitle\t\t\t\t= '" . $db->sql_escape($title) . "',\n\t\t\t\t\t\t\tposition\t\t\t= '" . $db->sql_escape($position) . "',\n\t\t\t\t\t\t\ttype\t\t\t\t= '" . $db->sql_escape($type) . "',\n\t\t\t\t\t\t\thtml_file_name\t\t= '" . $db->sql_escape($html_file_name) . "',\n\t\t\t\t\t\t\tvar_file_name\t\t= '" . $db->sql_escape($var_file_name) . "',\n\t\t\t\t\t\t\timg_file_name\t\t= '" . $db->sql_escape($img_file_name) . "',\n\t\t\t\t\t\t\tview_groups\t\t\t= '" . $db->sql_escape($view_groups) . "',\n\t\t\t\t\t\t\tview_pages\t\t\t= '" . $db->sql_escape($view_pages) . "',\n\t\t\t\t\t\t\tview_by\t\t\t\t= '" . $db->sql_escape($view_by) . "',\n\t\t\t\t\t\t\tview_all\t\t\t= '" . (int) $view_all . "',\n\t\t\t\t\t\t\tscroll\t\t\t\t= '" . (int) $scroll . "',\n\t\t\t\t\t\t\thas_vars\t\t\t= '" . (int) $has_vars . "',\n\t\t\t\t\t\t\tminimod_based\t\t= '" . (int) $minimod_based . "',\n\t\t\t\t\t\t\tmod_block_id\t\t= '" . (int) $mod_block_id . "',\n\t\t\t\t\t\t\tblock_cache_time\t= '" . (int) $block_cache_time . "'\n\t\t\t\t\t\t\tWHERE id = '{$id}'"; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['COULD_NOT_EDIT_BLOCK'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } $template->assign_var('BLOCK_REPORT', $user->lang['SAVING']); $cache->destroy('sql', K_BLOCKS_TABLE); delete_this_block_cached_file($html_file_name); if ($position) { $mode = $position; } else { $mode = 'manage'; } meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_blocks&mode=' . $mode)); return; } // get all available html files, note.. we search the admin styles folder // $dirslist = '.. '; $dirs = dir($phpbb_root_path . 'styles/_portal_common/template/blocks'); while ($file = $dirs->read()) { if (!stripos($file, ".bak")) { $dirslist .= "{$file} "; } } closedir($dirs->handle); $dirslist = explode(" ", $dirslist); sort($dirslist); for ($i = 0; $i < sizeof($dirslist); $i++) { if ($dirslist[$i] != '') { $template->assign_block_vars('html_file_name', array('S_BLOCK_FILE_HTML' => $dirslist[$i])); } } // get all available block images // $dirslist = '.. '; $dirs = dir($phpbb_root_path . 'images/block_images/block'); while ($file = $dirs->read()) { if (stripos($file, ".gif") || stripos($file, ".png")) { $dirslist .= "{$file} "; } } closedir($dirs->handle); $dirslist = explode(" ", $dirslist); sort($dirslist); for ($i = 0; $i < sizeof($dirslist); $i++) { if ($dirslist[$i] != '') { $template->assign_block_vars('img_file_name', array('S_BLOCK_FILE_I' => $dirslist[$i])); } } $dirslist = ''; $template->assign_var('S_OPTIONS', 'ADD'); // not a language var // if ($block == '' || $block == 0) { trigger_error($user->lang['NO_BLOCK_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * FROM ' . K_BLOCKS_TABLE . ' WHERE id=' . (int) $block; if ($result = $db->sql_query($sql)) { $row = $db->sql_fetchrow($result); } if ($row['img_file_name'] == '') { $row['img_file_name'] = 'default.gif'; } $template->assign_vars(array('S_ID' => $row['id'], 'S_NDX' => $row['ndx'], 'S_TITLE' => $row['title'], 'S_POSITION' => $row['position'], 'S_ACTIVE' => $row['active'], 'S_TYPE' => $row['type'], 'S_FNAME_H' => $row['html_file_name'], 'S_FNAME_V' => $row['var_file_name'], 'S_FNAME_I' => $row['img_file_name'], 'S_VIEW_BY' => $row['view_by'], 'S_VIEW_GROUPS' => $row['view_groups'], 'S_VIEW_ALL' => $row['view_all'], 'S_VIEW_PAGES' => $row['view_pages'], 'S_SCROLL' => $row['scroll'], 'S_HAS_VARS' => $row['has_vars'], 'S_MINIMOD_BASED' => $row['minimod_based'], 'S_MOD_BLOCK_ID' => $row['mod_block_id'], 'BLOCK_CACHE_TIME' => $row['block_cache_time'])); // get all groups and fill array // get_all_pages($block); get_all_groups(); get_all_minimods(); get_all_vars_files($block); $db->sql_freeresult($result); $template->assign_var('S_OPTIONS', strtoupper($mode)); break; case 'delete': if (!$block) { trigger_error($user->lang['MUST_SELECT_VALID_BLOCK_DATA'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) { $sql = 'SELECT title, id, position FROM ' . K_BLOCKS_TABLE . ' WHERE id = ' . (int) $block; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $title = $row['title']; $id = $row['id']; $position = $row['position']; $db->sql_freeresult($result); // Get lowest ndx for current position block Dicky $index_start = get_lowest_ndx($position); $sql = "DELETE FROM " . K_BLOCKS_TABLE . "\n\t\t\t\t\t\tWHERE id = " . (int) $block; $db->sql_query($sql); // Added function to reindex blocks after a block deletion reindex_column($position, $index_start); $template->assign_var('BLOCK_REPORT', $title . $user->lang['BLOCK_DELETED'] . '</font><br />'); $cache->destroy('sql', K_BLOCKS_TABLE); meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_blocks&mode=manage')); break; } else { confirm_box(false, $user->lang['CONFIRM_OPERATION_BLOCKS'], build_hidden_fields(array('i' => $id, 'mode' => $mode, 'action' => 'delete'))); } $template->assign_var('BLOCK_REPORT', $user->lang['ACTION_CANCELLED']); meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_blocks&mode=manage')); break; case 'reindex': $index_no = 1; if (confirm_box(true)) { $thispos = $newpos = ''; $list = array(); $sql = 'SELECT * FROM ' . K_BLOCKS_TABLE . ' ORDER by position, ndx'; if ($result = $db->sql_query($sql)) { while ($row = $db->sql_fetchrow($result)) { $thispos = $row['position']; if ($thispos == $newpos) { $index_no++; } else { $index_no = 1; } $sql = "UPDATE " . K_BLOCKS_TABLE . " SET ndx = '" . (int) $index_no . "' WHERE id = " . (int) $row['id']; //reset ndx to 1 when position changes $newpos = $row['position']; $results = $db->sql_query($sql); if (!$results) { trigger_error($user->lang['RE-INDEXING BLOCKS'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } } } $db->sql_freeresult($result); $template->assign_vars(array('S_BUTTON_HIDE' => true, 'BLOCK_REPORT' => $user->lang['BLOCKS_REINDEXED'])); $cache->destroy('sql', K_BLOCKS_TABLE); meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_blocks&mode=manage')); break; } else { confirm_box(false, $user->lang['CONFIRM_OPERATION_BLOCKS_REINDEX'], build_hidden_fields(array('i' => $id, 'mode' => $mode, 'action' => 'reindex'))); } $template->assign_var('BLOCK_REPORT', $user->lang['ACTION_CANCELLED']); meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_blocks&mode=manage')); break; case 'tools': $template->assign_var('S_OPTIONS', 'TOOLS'); // not language var // break; case 'L': case 'C': case 'R': case '1': case '2': case '3': $template->assign_var('S_TYPE', $mode); case 'manage': if ($mode != 'manage') { $sql = "SELECT * FROM " . K_BLOCKS_TABLE . " WHERE position = '" . $db->sql_escape($mode) . "' ORDER by ndx, type"; } else { $sql = 'SELECT * FROM ' . K_BLOCKS_TABLE . ' ORDER by position, ndx'; } $l_b_first = $r_b_first = $c_b_first = $l_b_last = $r_b_last = $c_b_last = 1; if ($result = $db->sql_query($sql)) { while ($row = $db->sql_fetchrow($result)) { if ($row['img_file_name'] == '') { $row['img_file_name'] = 'default.gif'; } if ($mode == 'manage') { if ($row['position'] == 'L') { $l_b_last = $l_b_last + 1; } else { if ($row['position'] == 'R') { $r_b_last = $r_b_last + 1; } else { if ($row['position'] == 'C') { $c_b_last = $c_b_last + 1; } } } } $template->assign_block_vars('bdata', array('S_ID' => $row['id'], 'S_NDX' => $row['ndx'], 'S_TITLE' => $row['title'], 'S_POSITION' => $row['position'], 'S_ACTIVE' => $row['active'], 'S_TYPE' => $row['type'], 'S_FNAME_H' => $row['html_file_name'], 'S_FNAME_V' => $row['var_file_name'], 'S_FNAME_I' => $row['img_file_name'], 'S_VIEW_BY' => which_group($row['view_by']), 'S_VIEW_GROUPS' => $row['view_groups'], 'S_VIEW_ALL' => $row['view_all'], 'S_VIEW_PAGES' => $row['view_pages'], 'S_SCROLL' => $row['scroll'], 'S_HAS_VARS' => $row['has_vars'], 'S_MINIMOD_BASED' => $row['minimod_based'], 'S_MOD_BLOCK_ID' => $row['mod_block_id'], 'S_BLOCK_CACHE_TIME' => $row['block_cache_time'], 'S_BLOCK' => $row['id'] == $block ? $block : '.....')); } $db->sql_freeresult($result); } $template->assign_vars(array('S_OPTIONS' => strtoupper($mode), 'S_LBL' => $l_b_last - 1, 'S_RBL' => $r_b_last - 1, 'S_CBL' => $c_b_last - 1, 'S_LRC' => '1')); break; case 'default': break; } $template->assign_var('U_ACTION', $u_action); }
<table id="structure"> <tr> <td id="navigation"> <ul class="subjects"> <br /> <?php $subjects_set = get_all_subj(); while ($subject = mysql_fetch_array($subjects_set)) { echo "<li"; if ($subject["id"] == $s_subj) { echo "class=\"selected\""; } echo "><a href=\"content.php?subj=" . urldecode($subject["id"]) . "\"> {$subject["name"]}</a></li>"; echo "<ul class=\"pages\">"; $page_set = get_all_pages($subject["id"]); while ($page = mysql_fetch_array($page_set)) { echo "<li><a href=\"content.php?page=" . urldecode($page["id"]) . "\"> {$page["menu_name"]}</a></li>"; } echo "</ul>"; } ?> </ul> </td> <td id="pages"> <h2> <?php echo $set_subject['name']; ?> </h2> <?php
require_once "./wp-load.php"; require_once "./wp-admin/admin.php"; header('Content-Type: application/json'); $inFile = $_GET['file']; if ($inFile == 'true') { header("Content-Disposition: attachment; filename=\"report.csv\";"); header("Content-Transfer-Encoding: binary"); } $contentType = $_GET['query']; ob_end_clean(); switch ($contentType) { case "blogs": get_all_blogs(); break; case "pages": get_all_pages(); break; case "posts": get_all_posts(); break; case "tags": get_all_tags(); break; case "users": get_all_users(); break; case "administrators": get_all_users("administrator"); break; case "authors": get_all_users("author");
function tk_settings_page($par) { global $pagenow, $wp_version; $settings = get_option("tk_theme_settings"); $theme_data = wp_get_theme(get_template_directory() . '/style.css'); ?> <div class="wrap"> <h2><?php $pages = @get_all_pages(); for ($i = 0; $i <= count($pages) - 1; $i++) { if ($pages[$i]['slug'] == $_GET['page']) { echo $pages[$i]['page_title']; } } ?> </h2> <?php if ('true' == esc_attr(@$_GET['error'])) { echo '<div class="error" ><p>All fields marked with (*) are required.</p></div>'; } if ('true' == esc_attr(@$_GET['updated'])) { echo '<div class="updated" ><p>Theme Settings updated.</p></div>'; } if (isset($_GET['tab'])) { tk_admin_tabs($_GET['tab']); } else { tk_admin_tabs(get_first_tab()); } ?> <div id="poststuff"> <form method="post" action="<?php admin_url('admin.php?page=' . $_GET['page']); ?> "> <p class="submit" style="clear: both;"> <input type="submit" name="Submit" class="button-primary" value="Update Settings" /> <input type="hidden" name="ilc-settings-submit" value="Y" /> </p> <?php wp_nonce_field("ilc-settings-page"); if ($pagenow == 'admin.php' && isset($_GET['page'])) { if (isset($_GET['tab'])) { $tab = $_GET['tab']; } else { $tab = get_first_tab(); } echo '<table class="form-table">'; global $tabs; foreach ($tabs as $r1) { if ($r1['id'] == $tab) { $row_items = 1; foreach ($r1 as $r2) { if ($row_items == 4) { if (count($r2) > 0) { foreach ($r2 as $r3) { if (@$r3['options']['required'] == 'yes') { $required = '* '; $required_hidden_field = '<input type="hidden" name="' . $r3['name'] . '_required" value="yes">'; } else { $required = ''; $required_hidden_field = '<input type="hidden" name="' . $r3['name'] . '_required" value="no">'; } if (isset($_GET['dev'])) { $dev = '<br /><font color="red">' . wp_get_theme()->name . '_' . $tab . '_' . $r3['name'] . '</font>'; } else { $dev = ''; } // call block text function if ($r3['type'] == 'text') { tk_block_text($r3, $tab, $dev, $required, $required_hidden_field); } // call block label function if ($r3['type'] == 'label') { tk_block_label($r3, $tab, $dev, $required); } // call block label function if ($r3['type'] == 'colorpicker') { tk_block_colorpicker($r3, $tab, $dev, $required, $required_hidden_field); } // call block label function if ($r3['type'] == 'datepicker') { tk_block_datepicker($r3, $tab, $dev, $required, $required_hidden_field); } // call block hidden function if ($r3['type'] == 'hidden') { tk_block_hidden($r3, $tab, $dev, $required_hidden_field); } // call block password function if ($r3['type'] == 'password') { tk_block_password($r3, $tab, $dev, $required, $required_hidden_field); } // call block radio function if ($r3['type'] == 'radio') { tk_block_radio($r3, $tab, $dev, $required, $required_hidden_field); } // call block checkbox function if ($r3['type'] == 'checkbox') { tk_block_checkbox($r3, $tab, $dev, $required, $required_hidden_field); } // call block font preview function if ($r3['type'] == 'font_preview') { tk_block_font_preview($r3, $tab, $dev, $required, $required_hidden_field); } // call block select function if ($r3['type'] == 'select') { if (isset($r3['class'])) { tk_block_select($r3, $tab, $dev, $required, $required_hidden_field, $r3['class']); } else { tk_block_select($r3, $tab, $dev, $required, $required_hidden_field); } } // call block stylechanger function if ($r3['type'] == 'stylechanger') { tk_block_stylechanger($r3, $tab); } // call block textarea function if ($r3['type'] == 'textarea') { tk_block_textarea($r3, $tab, $dev, $required, $required_hidden_field); } // call block widgetareas function if ($r3['type'] == 'widgetareas') { tk_block_widgetareas($r3, $dev, $required, $required_hidden_field); } // call block file function if ($r3['type'] == 'file') { tk_block_file($r3, $tab, $dev, $required, $required_hidden_field); } // call block file function if ($r3['type'] == 'file_image') { tk_block_file_image($r3, $tab, $dev, $required, $required_hidden_field); } // call block hr function if ($r3['type'] == 'hr') { tk_block_hr($r3); } // call block button function if ($r3['type'] == 'button') { tk_block_custom_button($r3); } // call block pages function if ($r3['type'] == 'pages') { tk_block_pages($r3, $tab, $dev, $required, $required_hidden_field); } // call block pages function if ($r3['type'] == 'posts') { tk_block_posts($r3, $tab, $dev, $required); } // call block category function if ($r3['type'] == 'category') { tk_block_categories($r3, $tab, $dev, $required, $required_hidden_field); } // call block author function if ($r3['type'] == 'author') { tk_block_authors($r3, $tab, $dev, $required, $required_hidden_field); } if ($r3['type'] == 'include') { //TYPE: include include $r3['value']; } // include } } } $row_items++; } } } ?> <?php echo '</table>'; } ?> <p class="submit" style="clear: both;"> <input type="submit" name="Submit" class="button-primary" value="Update Settings" /> <input type="hidden" name="ilc-settings-submit" value="Y" /> </p> </form> </div> </div> <?php }