Beispiel #1
0
 public function add()
 {
     $gets = $this->_get('style');
     $db = M('Merchant_info');
     include './cms/Lib/ORG/index.Tpl.php';
     foreach ($tpl as $k => $v) {
         if ($gets == $v['tpltypeid']) {
             $data['tpltypeid'] = $v['tpltypeid'];
             $data['tpltypename'] = $v['tpltypename'];
         }
     }
     $where['token'] = $this->token;
     $db->where($where)->save($data);
     M('Home')->where(array('token' => $this->token))->save(array('advancetpl' => 0));
     import('ORG.Util.Dir');
     Dir::delDirnotself('./runtime');
     if (isset($_GET['noajax'])) {
         $this->success('设置成功', '/merchant.php?g=Merchant&c=Tmpls&a=index&token=' . $this->token);
     }
 }
Beispiel #2
0
 public function amend()
 {
     if (IS_POST) {
         $database_config = D('Config');
         foreach ($_POST as $key => $value) {
             $data['name'] = $key;
             $data['value'] = trim(stripslashes(htmlspecialchars_decode($value)));
             $database_config->data($data)->where(array("name" => $key))->save();
             if ($key == 'wechat_sourceid') {
                 $data['name'] = 'wechat_token';
                 $data['value'] = md5('pigcms_wechat_token' . $data['value']);
                 $database_config->data($data)->where(array("name" => 'wechat_token'))->save();
             }
         }
         import('ORG.Util.Dir');
         Dir::delDirnotself('./cache');
         $this->success('修改成功!');
     } else {
         $this->error('非法提交,请重新提交~');
     }
 }
Beispiel #3
0
 public function cache()
 {
     import('ORG.Util.Dir');
     Dir::delDirnotself('./runtime');
     $this->frame_main_ok_tips('清除缓存成功!');
 }
 public function styleChange()
 {
     $db = D('Home');
     $info = $db->where(array('token' => $this->token))->find();
     $radiogroup = $this->_get('radiogroup');
     $token = $this->token;
     $data['radiogroup'] = $radiogroup;
     if ($info == false) {
         $data['token'] = $this->token;
         $res = $db->add($data);
     } else {
         $data['id'] = $info['id'];
         $res = $db->save($data);
     }
     import('ORG.Util.Dir');
     Dir::delDirnotself('./runtime');
 }
Beispiel #5
0
 public function adver_del()
 {
     $database_adver = D('Adver');
     $condition_adver['id'] = $_POST['id'];
     $now_adver = $database_adver->field(true)->where($condition_adver)->find();
     if ($database_adver->where($condition_adver)->delete()) {
         unlink('./upload/' . $now_adver['pic']);
         $attachment_upload_type = C('config.attachment_upload_type');
         // 删除又拍云服务器
         if ($attachment_upload_type == '1') {
             import('upyunUser', './source/class/upload/');
             upyunUser::delete('/' . $now_adver['pic']);
         }
         S('adver_list_' . $now_adver['cat_id'], NULL);
         // 清空缓存
         import('ORG.Util.Dir');
         Dir::delDirnotself('./cache');
         $this->success('删除成功');
     } else {
         $this->error('删除失败!请重试~');
     }
 }
Beispiel #6
0
 /**
 +----------------------------------------------------------
 * 清空目录下的所有文件和目录,但是保留本身
 +----------------------------------------------------------
 * @access static
 +----------------------------------------------------------
 * @return void
 +----------------------------------------------------------
 */
 function delDirnotself($directory, $notself = false)
 {
     if (is_dir($directory) == false) {
         return '1';
     }
     $handle = opendir($directory);
     while (($file = readdir($handle)) !== false) {
         if ($file != "." && $file != "..") {
             if (is_dir("{$directory}/{$file}")) {
                 Dir::delDirnotself("{$directory}/{$file}", true);
             } else {
                 unlink("{$directory}/{$file}");
             }
         }
     }
     if (readdir($handle) == false) {
         closedir($handle);
         if ($notself) {
             rmdir($directory);
         }
     }
 }