Esempio n. 1
0
 public function check_uuid()
 {
     $uuid = C('version', 'uuid');
     if (!empty($uuid)) {
         return $uuid;
     } else {
         $uuid = uuid(C('version', 'product') . '-');
         \Leaps\Base\Config::modify('version', array('uuid' => $uuid));
         return $uuid;
     }
 }
Esempio n. 2
0
 /**
  * 设置默认风格
  */
 public function set_default()
 {
     $style = isset($_GET['style']) && trim($_GET['style']) ? trim($_GET['style']) : showmessage(L('illegal_operation'), HTTP_REFERER);
     \Leaps\Base\Config::modify('template', array('name' => $style));
     // 模板配置
     $category_model = Loader::model('category_model');
     $result = S('common/category_content');
     // 加载栏目缓存
     if (!empty($result) && is_array($result)) {
         foreach ($result as $r) {
             $setting = string2array($r['setting']);
             $setting['template_list'] = $style;
             $setting = array2string($setting);
             $category_model->where(array('catid' => $r['catid']))->update(array('setting' => $setting));
         }
     }
     showmessage(L('operation_success'), HTTP_REFERER);
 }
Esempio n. 3
0
 public function init()
 {
     if (isset($_POST['dosubmit'])) {
         $setuc = isset($_POST['setuc']) ? $_POST['setuc'] : '';
         \Leaps\Base\Config::modify('system', $setuc);
         unset($setuc['uc_use']);
         // 保持进UC配置文件
         $setuc['uc_dbtablepre'] = $setuc['uc_dbname'] . '.' . $setuc['uc_dbtablepre'];
         $uc_config = '<?php ' . "\ndefine('UC_CONNECT', 'mysql');\n";
         foreach ($setuc as $k => $v) {
             $uc_config .= "define('" . strtoupper($k) . "', '{$v}');\n";
         }
         $uc_config .= "define('UC_PPP', '20');\n";
         $uc_config_filepath = WEKIT_PATH . 'config' . DIRECTORY_SEPARATOR . 'uc_config.php';
         @file_put_contents($uc_config_filepath, $uc_config);
         showmessage(L('operation_success'), HTTP_REFERER);
     } else {
         $uc_config = C('system');
         extract($uc_config);
         include $this->view('member_ucenter');
     }
 }
Esempio n. 4
0
 /**
  * 保存配置信息
  */
 public function save()
 {
     // 保存框架配置
     \Leaps\Base\Config::modify('config', $_POST['config']);
     // 保存系统配置
     if (!Validate::is_email($_POST['setting']['system_email'])) {
         // 判断邮件是否合法
         showmessage(L('email_illegal'), HTTP_REFERER);
     }
     \Leaps\Base\Config::modify('system', $_POST['system']);
     // 保存网站配置
     foreach ($_POST['setting'] as $key => $value) {
         $setting[$key] = trim($value);
     }
     if (empty($setting['site_name'])) {
         // 站点名称不能为空
         showmessage(L('site_name') . L('not_empty'), HTTP_REFERER);
     }
     $this->db->set_setting('admin', $setting);
     // 保存日志配置
     $_POST['log']['log_chunk_size'] = $_POST['log']['log_chunk_size'] . 'M';
     \Leaps\Base\Config::modify('log', $_POST['log']);
     // 系统配置
     $attachment = C('attachment');
     // 加载附件设置
     $passwordmask = $attachment['ftp_password'] ? $attachment['ftp_password'][0] . '********' . substr($attachment['ftp_password'], -2) : '';
     $_POST['attachment']['ftp_password'] = $passwordmask == $_POST['attachment']['ftp_password'] ? $attachment['ftp_password'] : $_POST['attachment']['ftp_password'];
     \Leaps\Base\Config::modify('attachment', $_POST['attachment']);
     // 附件配置
     \Leaps\Base\Config::modify('sms', $_POST['sms']);
     // 短信配置
     \Leaps\Base\Config::set('mail', $_POST['mail']);
     // 邮件配置
     \Leaps\Base\Config::set('sns', $_POST['sns']);
     // 邮件配置
     $this->setcache();
     showmessage(L('setting_succ'), HTTP_REFERER);
 }
Esempio n. 5
0
     break;
 case '6':
     // 安装详细过程
     $db_config = array('hostname' => $_POST['dbhost'], 'username' => $_POST['dbuser'], 'password' => $_POST['dbpw'], 'database' => $_POST['dbname'], 'prefix' => $_POST['prefix'], 'pconnect' => $_POST['pconnect'], 'charset' => $_POST['dbcharset']);
     \Leaps\Base\Config::modify('database', $db_config);
     // 写入数据库配置信息
     \Leaps\Base\Config::modify('cookie', array('prefix' => String::rand_string(5) . '_'));
     // Cookie前缀
     // 附件访问路径
     \Leaps\Base\Config::modify('attachment', array('upload_url' => $siteurl . 'data/attachment/'));
     \Leaps\Base\Config::modify('attachment', array('avatar_url' => $siteurl . 'data/avatar/'));
     $auth_key = String::rand_string(20);
     \Leaps\Base\Config::modify('config', array('auth_key' => $auth_key));
     $uuid = String::uuid(C('version', 'product') . '-');
     \Leaps\Base\Config::modify('version', array('uuid' => $uuid));
     \Leaps\Base\Config::modify('system', array('js_path' => $siteurl . 'statics/js/', 'css_path' => $siteurl . 'statics/css/', 'img_path' => $siteurl . 'statics/images/', 'app_path' => $siteurl, 'skin_path' => $siteurl . 'statics/skins/'));
     $selectapp = $_POST['selectapp'];
     $testdata = $_POST['testdata'];
     include INS_PATH . "step/step_" . $step . ".tpl.php";
     break;
 case '7':
     // 完成安装
     //File::write ( DATA_PATH . 'install.lock', 'ok' );
     include INS_PATH . "step/step_" . $step . ".tpl.php";
     //Folder::rm(INS_PATH);//删除安装目录
     break;
 case 'installapp':
     // 执行SQL
     if ($_POST['app'] == 'admin') {
         $dbfile = 'yuncms_db.sql';
         if (file_exists(INS_PATH . "resource" . DIRECTORY_SEPARATOR . $dbfile)) {
Esempio n. 6
0
File: func.php Progetto: hubs/yuncms
/**
 * 加载配置文件
 *
 * @param string $file 文件名
 * @param string $key 配置项
 * @param string/bool $default 默认值
 */
function C($file, $key = null, $default = false)
{
    return \Leaps\Base\Config::get($file, $key, $default);
}