Example #1
0
 public function update()
 {
     $conf_res = M("Conf")->where("is_effect = 1 and is_conf = 1")->findAll();
     foreach ($conf_res as $k => $v) {
         conf($v['name'], $_REQUEST[$v['name']]);
         if ($v['name'] == 'URL_MODEL' && $v['value'] != $_REQUEST[$v['name']]) {
             clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
             clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/");
             clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/");
             clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
             clear_dir_file(get_real_path() . "public/runtime/data/page_static_cache/");
             clear_dir_file(get_real_path() . "public/runtime/data/dynamic_avatar_cache/");
         }
     }
     //开始写入配置文件
     $sys_configs = M("Conf")->findAll();
     $config_str = "<?php\n";
     $config_str .= "return array(\n";
     foreach ($sys_configs as $k => $v) {
         $config_str .= "'" . $v['name'] . "'=>'" . addslashes($v['value']) . "',\n";
     }
     $config_str .= ");\n ?>";
     $filename = get_real_path() . "public/sys_config.php";
     if (!($handle = fopen($filename, 'w'))) {
         $this->error(l("OPEN_FILE_ERROR") . $filename);
     }
     if (fwrite($handle, $config_str) === FALSE) {
         $this->error(l("WRITE_FILE_ERROR") . $filename);
     }
     fclose($handle);
     save_log(l("CONF_UPDATED"), 1);
     //clear_cache();
     write_timezone();
     $this->success(L("UPDATE_SUCCESS"));
 }
Example #2
0
 public function uninstall()
 {
     $class_name = $_REQUEST['class_name'];
     $directory = APP_ROOT_PATH . "system/integrate/";
     $file = $directory . $class_name . "_integrate.php";
     if (file_exists($file)) {
         require_once $file;
         $integrate_class = $class_name . "_integrate";
         $integrate_item = new $integrate_class();
         $integrate_item->uninstall();
     }
     M("Conf")->where("name='INTEGRATE_CODE'")->setField("value", '');
     M("Conf")->where("name='INTEGRATE_CFG'")->setField("value", '');
     //开始写入配置文件
     $sys_configs = M("Conf")->findAll();
     $config_str = "<?php\n";
     $config_str .= "return array(\n";
     foreach ($sys_configs as $k => $v) {
         $config_str .= "'" . $v['name'] . "'=>'" . addslashes($v['value']) . "',\n";
     }
     $config_str .= ");\n ?>";
     $filename = get_real_path() . "public/sys_config.php";
     if (!($handle = fopen($filename, 'w'))) {
         $this->error(l("OPEN_FILE_ERROR") . $filename);
     }
     if (fwrite($handle, $config_str) === FALSE) {
         $this->error(l("WRITE_FILE_ERROR") . $filename);
     }
     fclose($handle);
     clear_cache();
     write_timezone();
     $this->assign("jumpUrl", u(MODULE_NAME . "/index"));
     save_log(l("UNINSTALL_SUCCESS"), 1);
     $this->success(l("UNINSTALL_SUCCESS"), 0);
 }
Example #3
0
 public function update_commossion()
 {
     $conf_res = M("Conf")->where("is_effect = 1 and name in ('INVESTORS_COMMISSION_RATIO','BORROWER_COMMISSION_RATIO')")->findAll();
     foreach ($conf_res as $k => $v) {
         conf($v['name'], floatval(strim($_REQUEST[$v['name']])));
         if ($v['name'] == 'URL_MODEL' && $v['value'] != $_REQUEST[$v['name']]) {
             clear_auto_cache("byouhui_filter_nav_cache");
             clear_auto_cache("cache_shop_acate_tree");
             clear_auto_cache("cache_shop_cate_tree");
             clear_auto_cache("cache_youhui_cate_tree");
             clear_auto_cache("city_list_result");
             clear_auto_cache("fyouhui_filter_nav_cache");
             clear_auto_cache("get_help_cache");
             clear_auto_cache("page_image");
             clear_auto_cache("tuan_filter_nav_cache");
             clear_auto_cache("youhui_page_recommend_youhui_list");
             clear_auto_cache("ytuan_filter_nav_cache");
             clear_auto_cache("store_filter_nav_cache");
             clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
             clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/");
             clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/");
             clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
             clear_dir_file(get_real_path() . "public/runtime/data/page_static_cache/");
             clear_dir_file(get_real_path() . "public/runtime/data/dynamic_avatar_cache/");
         }
     }
     //开始写入配置文件
     $sys_configs = M("Conf")->findAll();
     $config_str = "<?php\n";
     $config_str .= "return array(\n";
     foreach ($sys_configs as $k => $v) {
         $config_str .= "'" . $v['name'] . "'=>'" . addslashes($v['value']) . "',\n";
     }
     $config_str .= ");\n ?>";
     $filename = get_real_path() . "public/sys_config.php";
     if (!($handle = fopen($filename, 'w'))) {
         $this->error(l("OPEN_FILE_ERROR") . $filename);
     }
     if (fwrite($handle, $config_str) === FALSE) {
         $this->error(l("WRITE_FILE_ERROR") . $filename);
     }
     fclose($handle);
     save_log(l("CONF_UPDATED"), 1);
     //clear_cache();
     write_timezone();
     $this->success(L("UPDATE_SUCCESS"));
 }