public function blockall() { $citys = explode(',', '北京,浙江,天津,安徽,上海,福建,莆田,重庆,江西,山东,河南,内蒙古,湖北,新疆,湖南,宁夏,广东,西藏,海南,广西,四川,河北,贵州,山西,云南,辽宁,陕西, 吉林,甘肃,黑龙江,青海,江苏,' . $_POST['city_list']); SetSettValue('ipblock_city', serialize($citys)); cleanCache(); $this->jumpUrl = U('Ipblock/index'); $this->success('设置成功!'); }
public function nodelist() { if ($this->isPost()) { $access = $_POST['access']; SetValue('accessmode', $access); cleanCache(); $this->success("修改成功!"); } $this->access = GetValue('accessmode') ? GetValue('accessmode') : 'module'; $this->display(); }
function doSortUpdate() { $j = 0; foreach ($_POST['sort'] as $k => $v) { if ($_POST['sort'][$k] != '') { if (D('Virtual_cat')->where(array('id' => $k))->data(array('sort' => $v))->save()) { $j++; } } } cleanCache(); $this->success('共修改了' . $j . '个排序!'); }
function Payment() { $model = D('Payment'); $this->list = $model->order('sort desc')->select(); if ($this->isPost()) { $id = implode(',', (array) $_POST['id']); $map['id'] = array('in', $id); $list = $model->where($map)->getField('id,name'); $status = $_POST['status']; foreach ($list as $val) { SetValue($val . '_status', $status); } $count = count($list); cleanCache(); $this->success(($status ? '启用了' : '禁用了') . $count . '个付款方式!'); } $this->display(); }
function index() { if ($this->isPost()) { SetSettValue('365webcall_name', rawurlencode($_POST['365webcall_name'])); SetSettValue('365webcall_email', $_POST['365webcall_email']); SetSettValue('365webcall_accountid', '0594trade'); SetSettValue('365webcall_status', $_POST['365webcall_status']); SetSettValue('365webcall_password', rawurlencode($_POST['365webcall_password'])); SetSettValue('365webcall_url', $_SERVER['HTTP_HOST']); cleanCache(); $this->success('操作成功!'); } else { $this->name = GetSettValue('365webcall_name'); $this->email = GetSettValue('365webcall_email'); $this->accountid = GetSettValue('365webcall_accountid'); $this->pwd = GetSettValue('365webcall_password'); $this->url = GetSettValue('365webcall_url'); $this->name2 = rawurldecode(GetSettValue('365webcall_name')); $this->email2 = GetSettValue('365webcall_email'); $this->accountid2 = GetSettValue('365webcall_accountid'); $this->pwd2 = rawurldecode(GetSettValue('365webcall_accountid')); $this->display(); } }
$new_width = preg_replace("/[^0-9]+/", '', get_request('w', 0)); $new_height = preg_replace("/[^0-9]+/", '', get_request('h', 0)); $zoom_crop = preg_replace("/[^0-9]+/", '', get_request('zc', 1)); $quality = preg_replace("/[^0-9]+/", '', get_request('q', 80)); $filters = get_request('f', ''); $sharpen = get_request('s', 0); if ($new_width == 0 && $new_height == 0) { $new_width = 100; $new_height = 100; } // get mime type of src $mime_type = mime_type($src); // check to see if this image is in the cache already check_cache($mime_type); // if not in cache then clear some space and generate a new file cleanCache(); ini_set('memory_limit', '50M'); // make sure that the src is gif/jpg/png if (!valid_src_mime_type($mime_type)) { displayError('Invalid src mime type: ' . $mime_type); } if (strlen($src) && file_exists($src)) { // open the existing image $image = open_image($mime_type, $src); if ($image === false) { displayError('Unable to open image : ' . $src); } // Get original width and height $width = imagesx($image); $height = imagesy($image); // generate new w/h if not provided
public function Update() { if (isset($_POST['pid'])) { if ($_POST['id'] == $_POST['pid']) { $this->error("无法更新数据!"); } } if ($this->dao->create()) { $list = $this->dao->save(); if ($list !== false) { $this->success('数据更新成功!'); cleanCache(); } else { $this->error("没有更新任何数据!"); } } else { $this->error($this->dao->getError()); } }
case 'disable_cache': if ($perform === true) { echo disableCache(); } else { echo isCacheDisabled(); } break; case 'disable_compiler': if ($perform === true) { echo disableCompiler(); } else { echo isCompilerDisabled(); } break; case 'clean_cache': echo cleanCache(); break; default: $action = null; break; } } else { $action = null; } } function isCacheDisabled() { Mage::app('admin'); $options = Mage::getModel('core/cache')->canUse(); foreach ($options as $option) { if ($option == 1) {
<?php function cleanCache($time) { $files = glob(__DIR__ . "/../cache/*"); $now = time(); foreach ($files as $file) { if (is_file($file) && $now - filemtime($file) >= $time) { unlink($file); } } } cleanCache(180); $config = parse_ini_file("../config.ini"); $page = explode("/", $_SERVER["REQUEST_URI"]); $page = $page[count($page) - 1]; $page = $page === "" ? "about" : $page; $page = !file_exists("templates/{$page}.html") ? "404" : $page; $menuItems = array("about", "how to use", "pricing"); require_once "templates/header.php"; require_once "templates/{$page}.html"; require_once "templates/footer.php";
function do_movepro() { if (isset($_POST['cateid']) && $_GET['id']) { self::$Model = D('Products'); $map['cateid'] = $_GET['id']; if (self::$Model->where($map)->count()) { $data['cateid'] = $_POST['cateid']; self::$Model->where($map)->save($data); cleanCache(); $this->success('产品移动成功!'); } $this->error('移动失败,该类别不存在!'); } $this->error('移动失败,该类别不存在!'); }
public function delcate($id) { $model = M('Cate'); $promodel = M('products'); $array["id"] = $id; $catecount = $model->where("pid=" . $id)->count(); $procount = $promodel->where("cateid=" . $id)->count(); if ($catecount < 1 && $procount < 1) { $count = $model->where($array)->delete(); if ($count) { $res["code"] = 0; $res["Msg"] = '删除成功'; } else { $res["code"] = 1; $res["Msg"] = '删除失败'; } } else { $res["code"] = 2; $res["Msg"] = '该类别正在使用,删除失败'; } cleanCache(); return $res; }
#!/usr/bin/php4 -q <?php // Copyright 2002 - Robert Pufky // Conversion engine for picture frame // load configuration settings require_once "/etc/pictureframe/config.php"; // stay running indefinity in the background while (true) { // grab config.php datestamp and refresh background image $timestamp = filemtime("/etc/pictureframe/config.php"); // re-render the loading screen in case of config.php changes `{$convert} xc:{$background} -resize {$geometry}! -fill {$textcolor} -pointsize 20 -font helvetica -gravity center -draw "text 0,0 'Loading images...'" /tmp/loading.png > /dev/null 2>&1`; // (re)load the originals, and clean cache of original pictures removed loadImages($images, $source); cleanCache($images); // go through each image and convert if necessary foreach ($images as $image) { // figure out the destination name $modified = $destination . "/" . $image; // if the image has not been converted or the converted image needs updating due to new config.php if (!file_exists("{$modified}") || file_exists("{$modified}") && filemtime("{$modified}") < $timestamp) { // assemble the full path to the files $original = $source . "/" . $image; // resize the image `{$convert} -interlace NONE -geometry {$geometry} "{$original}" "-" | {$composite} -gravity center "-" -compose Over /tmp/loading.png "{$modified}" > /dev/null 2>&1`; // if fancypants options are turned on, re-process and insert text if ($showtext) { `{$convert} "{$modified}" -font helvetica -pointsize {$textsize} -fill {$textcolor} -gravity {$textpos}{$textalign} -annotate 0 '{$image}' "{$modified}" > /dev/null 2>&1`; } } }
function update($new_instance, $old_instance) { $id = 'gh.' . $old_instance['user'] . '.' . $old_instance['repo'] . '.repository'; cleanCache($id); $id = 'gh.' . $old_instance['user'] . '.' . $old_instance['repo'] . '.contributors'; cleanCache($id); $id = 'gh.' . $old_instance['user'] . '.' . $old_instance['repo'] . '.issues'; cleanCache($id); return array('title' => strip_tags($new_instance['title']), 'user' => strip_tags($new_instance['user']), 'repo' => strip_tags($new_instance['repo']), 'desc' => strip_tags($new_instance['desc']), 'repo-add-description' => strip_tags($new_instance['repo-add-description'])); }