$symbol_count++; if ($symbol_count == $word_count) { $result .= ' '; $symbol_count = 0; $new_word = true; } } return $result; } if ($action == 'update') { $need_update = false; $last_version_file = fopen("http://cutephp.com/cutenews/latest_version.php", "r"); ob_start(); fpassthru($last_version_file); list($last_version, $last_version_name) = explode('|', ob_get_clean()); if ($last_version > $config_version_id) { $need_update = true; } if ($need_update) { $update_key = base64_encode(create_random_string(50, 7)); $update_temp = fopen(SERVDIR . '/cdata/update_temp.php', "w"); fwrite($update_temp, "<?php\n\$update_key='" . $update_key . "';\n?>"); fclose($update_temp); setcookie('update', $update_key, time() + 60 * 60, '/'); echoheader('info', lang("Update status"), make_breadcrumbs('main/options=options/Update Status')); echo proc_tpl('update/status'); echofooter(); } else { msg('info', lang('Update status'), lang('No update: your revision is the latest one')); } }
} function makeDropDown($options, $name, $selected) { $output = "<select size=1 name=\"{$name}\">\r\n"; foreach ($options as $value => $description) { $output .= "<option value=\"{$value}\""; if ($selected == $value) { $output .= " selected "; } $output .= ">{$description}</option>\n"; } $output .= "</select>"; return $output; } // ---------- show options echoheader("options", lang("System Configuration"), make_breadcrumbs($bc)); echo proc_tpl('options/syscon.top', array('add_fields' => hook('field_options_buttons'))); if (!($handle = opendir(SERVDIR . "/skins"))) { die_stat(false, "Can not open directory ./skins "); } while (false !== ($file = readdir($handle))) { $file_arr = explode(".", $file); if ($file_arr[1] == "skin") { $sys_con_skins_arr[$file_arr[0]] = $file_arr[0]; } elseif ($file_arr[1] == "lang") { $sys_con_langs_arr[$file_arr[0]] = $file_arr[0]; } } closedir($handle); // News if (is_dir(SERVDIR . '/core/ckeditor')) {
user_addban($add_ip); } // from editcomments if ($action == "quickadd") { die_stat(false, str_replace('%1', $add_ip, lang('The IP %1 is now banned from commenting'))); } } elseif ($action == "remove") { if (empty($remove_ip)) { msg("error", lang('Error!'), lang("The IP or nick cannot be blank"), '#GOBACK'); } user_remove_ban($remove_ip); } // ******************************************************************************** // List all IP // ******************************************************************************** echoheader("options", lang("Blocking IP / Nickname"), make_breadcrumbs('main/options=options/Block IP or nickname')); $c = 0; $iplist = array(); // read all lines $ips = fopen(SERVDIR . '/cdata/ipban.db.php', 'r'); while (!feof($ips)) { $dip = explode('|', fgets($ips)); if (empty($dip[0])) { continue; } if (substr($dip[0], 0, 2) == '<' . '?') { continue; } $e = $dip[2] ? format_date($dip[2], 'since-short') : 'never'; $iplist[] = array('ip' => $dip[0], 'bg' => $c++ % 2 ? 'bgcolor="#F7F8FF"' : '', 'times' => $dip[1], 'expire' => $e); }
echofooter(); } elseif ($action == "dosaverss") { if (strpos($rss_news_include_url, 'http://') === false) { msg("error", lang('Error!'), lang("The URL where you include your news must start with <b>http://</b>")); } $handler = fopen(SERVDIR . "/cdata/rss_config.php", "w") or msg("error", lang('Error!'), "Can not open file ./cdata/rss_config.php"); fwrite($handler, "<?PHP \n\n//RSS Configurations (Auto Generated file)\n\n"); fwrite($handler, "\$rss_news_include_url = \"" . htmlspecialchars($rss_news_include_url) . "\";\n\n"); fwrite($handler, "\$rss_title = \"" . htmlspecialchars($rss_title) . "\";\n\n"); fwrite($handler, "\$rss_encoding = \"" . htmlspecialchars($rss_encoding) . "\";\n\n"); fwrite($handler, "\$rss_language = \"" . htmlspecialchars($rss_language) . "\";\n\n"); fwrite($handler, "?>"); fclose($handler); msg("wizard", lang("RSS Configuration Saved"), lang("The configurations were saved successfully") . ".<br><br><input onClick=\"document.location='{$PHP_SELF}?mod=wizards&action=customizerss';\" type=button value='Proceed With RSS Customization >>'>"); } elseif ($action == "customizerss") { echoheader("wizard", lang("RSS Customization"), make_breadcrumbs('main/options=options/wizards=Choose Wizards/wizards:rss=Rss Setup/wizards:rss_step2=Configuration/Complete')); // Detect the categories (if any) $cat_lines = file(SERVDIR . "/cdata/category.db.php"); if (count($cat_lines) > 0) { $cat_options .= '<select style="" id=categories multiple size=5>' . "\n"; foreach ($cat_lines as $single_line) { $cat_arr = explode("|", $single_line); $cat_options .= "<option value=\"{$cat_arr['0']}\">(ID:{$cat_arr['0']}) {$cat_arr['1']}</option>\n"; } $cat_options .= "</select><br><label for=allcategories><input onclick=\"if(this.checked){getElementById('categories').style.display='none';}else{getElementById('categories').style.display='';}\" type=checkbox id=allcategories value=yes>" . lang('Or show from all Categories') . "</label>"; } else { $cat_options = lang("You do not have any categories") . ". <input type=hidden id=categories><input type=hidden id=allcategories>"; } // Show the HTML echo proc_tpl('wizard/customizerss', array('config_http_script_dir' => $config_http_script_dir, 'cat_options' => $cat_options)); echofooter();
} } // if file is uploaded succesfully } } else { unlink($_FILES[$current_image]['tmp_name']); $img_result .= "<br><span style='color:red;'>{$image_name} ->This type of file is not allowed!</span>"; } } } // out html head image content $CSRF = CSRFMake(); if ($action == "quick") { echo proc_tpl('images/quick.up', array('area' => $area, 'CKEditorFuncNum' => $CKEditorFuncNum, 'config_http_script_dir' => $config_http_script_dir), array('WYSYWIG' => $wysiwyg && $_REQUEST['CKEditorFuncNum'])); } else { echoheader("images", "Manage Images", make_breadcrumbs('main/options=options/Manage Images')); } // Add the JS for multiply image upload. echo proc_tpl('images/multi', array(), array('QUICK' => $action == "quick" && $wysiwyg == false ? 1 : 0)); $i = 0; $img_dir = opendir(SERVDIR . "/uploads"); while ($file = readdir($img_dir)) { //Yes we'll store them in array for sorting $images_in_dir[] = $file; } natcasesort($images_in_dir); reset($images_in_dir); foreach ($images_in_dir as $file) { $img_name_arr = explode(".", $file); $img_type = end($img_name_arr); if ((in_array($img_type, $allowed_extensions) or in_array(strtolower($img_type), $allowed_extensions)) and $file != ".." and $file != "." and is_file(SERVDIR . "/uploads/" . $file)) {
$new_cats = fopen(SERVDIR . "/cdata/category.db.php", "w"); foreach ($old_cats as $cat_line) { $cat_arr = explode("|", $cat_line); if ($cat_arr[0] == $catid) { fwrite($new_cats, "{$catid}|{$cat_name}|{$cat_icon}|{$cat_access}|||\n"); } else { fwrite($new_cats, $cat_line); } } fclose($new_cats); } // ******************************************************************************** // List all Categories // ******************************************************************************** $CSRF = CSRFMake(); echoheader("options", "Categories", make_breadcrumbs('main/options=options/Manage Categories')); $count_categories = 0; $all_cats = hook('read_categories', file(SERVDIR . "/cdata/category.db.php")); foreach ($all_cats as $cat_line) { if ($i++ % 2 != 0) { $bg = "bgcolor=#F7F6F4"; } else { $bg = ""; } $cat_arr = explode("|", $cat_line); $cat_arr[1] = stripslashes(preg_replace(array("'\"'", "'\\''"), array(""", "'"), $cat_arr[1])); $cat_help_names[] = $cat_arr[1]; $cat_help_ids[] = $cat_arr[0]; $result .= "<tr><td {$bg}> <b>{$cat_arr['0']}</b></td><td {$bg} >{$cat_arr['1']}</td> <td {$bg} align=center>"; if ($cat_arr[2] != "") { $result .= "<img border=0 src=\"{$cat_arr['2']}\" high=40 width=40 alt=\"{$cat_arr['2']}\">";
fwrite($w, '$conf_rw_' . substr($i, 5) . ' = "' . str_replace('"', '\\"', $v) . "\";\n"); } } flock($w, LOCK_UN); fclose($w); $saved_ok = getpart('saved_ok'); } // Read data from datatable if (file_exists(SERVDIR . '/cdata/conf_rw.php')) { include SERVDIR . '/cdata/conf_rw.php'; } // Default values ----------------- set_default_val_for_rewrite(); hook('insert_additional_rewrites'); // Try to update htaccess if ($update_htaccess == 'Y') { $w = fopen($conf_rw_htaccess, 'w'); flock($w, LOCK_EX); fwrite($w, "RewriteEngine ON\n"); fwrite($w, "RewriteCond %{REQUEST_FILENAME} !-d\n"); fwrite($w, "RewriteCond %{REQUEST_FILENAME} !-f\n"); fwrite($w, "RewriteRule ^(.*)\$ /cn_friendly_url.php?rew=\$1&%{QUERY_STRING}[L]\n"); flock($w, LOCK_UN); fclose($w); } // view template echoheader('home', lang('URL Rewrite Manager'), make_breadcrumbs('main=main/options:options=options/tools:rewrite=Rewrite Manager', true)); echo proc_tpl('tools/rewrites/index'); echofooter(); } hook('tools_additional_actions');
<?php if (!defined('INIT_INSTANCE')) { die('Access restricted'); } if ($member_db[UDB_ACL] != ACL_LEVEL_ADMIN) { msg("error", lang("Access Denied"), lang("You don't have permission to edit users")); } // ******************************************************************************** // List All Available Users + Show Add User Form // ******************************************************************************** if ($action == "list") { $CSRF = CSRFMake(); echoheader("users", lang("Manage Users"), make_breadcrumbs('main/options=options/Manage Users')); $i = 0; $userlist = array(); $all_users = file(SERVDIR . "/cdata/users.db.php"); unset($all_users[0]); foreach ($all_users as $user_line) { $user_arr = user_decode($user_line); $bg = $i++ % 2 == 1 ? 'bgcolor="#f7f6f4"' : false; $last_login = !empty($user_arr[UDB_LAST]) ? date('r', $user_arr[UDB_LAST]) : 'never'; switch ($user_arr[1]) { case 1: $user_level = "administrator"; break; case 2: $user_level = "editor"; break; case 3: $user_level = "journalist";
function agency_breadcrumbs() { $args = array('show_on_home' => 0, 'delimiter' => '<li class="separator"><i class="icon icon-right-open"></i></li>', 'home' => __("Home", "agency"), 'showCurrent' => 1, 'before' => '<span class="current">', 'after' => '</span>'); ?> <section class="breadcrumb"> <div class="wrap"> <?php make_breadcrumbs($args); ?> </div><!--/.wrap--> </section><!--/.breadcrumb--> <?php }