private function addDefault() { Config::edit(self::optionName . '_STATUS', '0', 'bool', 'status'); Config::edit(self::optionName . '_EMAIL', array(), 'array', 'report to'); Config::edit(self::optionName . '_PERIOD', 'd', 'char', 'period'); Config::edit(self::optionName . '_CLIENT_NAME', 'CLIENT', 'string', 'email client name'); }
<?php $page = 'testimonios'; $page2 = 'nav-testimonios'; require "template/header.php"; ?> <div class="container"> <div class="row"> <?php require "template/nav_testimonios.php"; ?> <?php if (Utils::checkPost("add")) { if (Config::exist("bgtestimonios")) { $edit = array("value" => File::upload("background")); $confirm = Config::edit($edit, array("name", "=", "bgtestimonios")); } else { $new = array("name" => "bgtestimonios", "value" => File::upload("background")); $confirm = Config::add($new); } } ?> <div class="grid col-9"> <div class="row"> <form action="" method="post" enctype="multipart/form-data" > <p><?php if (isset($confirm) && $confirm > 0) { echo "Modificación exitosa"; }
function applySkin() { $skin = IFilter::string(IReq::get('skin')); if ($skin != null) { $data = array('skin' => $skin); Config::edit('config/config.php', $data); } $this->clearCache(); $this->redirect('conf_ui'); }
function save_conf() { if (!$_POST) { $this->redirect('conf_base'); } //错误信息 $form_index = IReq::get('form_index'); switch ($form_index) { case "base_conf": break; case "site_footer_conf": $_POST['site_footer_code'] = preg_replace('![\\r\\n]+!', "", $_POST['site_footer_code']); break; case "index_slide": $config_slide = array(); if (isset($_POST['slide_name'])) { foreach ($_POST['slide_name'] as $key => $value) { $config_slide[$key]['name'] = $value; $config_slide[$key]['url'] = $_POST['slide_url'][$key]; $config_slide[$key]['img'] = $_POST['slide_img'][$key]; } } if (isset($_FILES['slide_pic'])) { $uploadObj = new PhotoUpload(); $uploadObj->setIterance(false); $slideInfo = $uploadObj->run(); if (isset($slideInfo['slide_pic']['flag'])) { $slideInfo['slide_pic'] = array($slideInfo['slide_pic']); } if (isset($slideInfo['slide_pic'])) { foreach ($slideInfo['slide_pic'] as $key => $value) { if ($value['flag'] == 1) { $config_slide[$key]['img'] = $value['img']; } } } } $_POST = array('index_slide' => serialize($config_slide)); break; //导航写入数据库,不需要记录配置文件 //导航写入数据库,不需要记录配置文件 case "guide_conf": $guideName = IFilter::act(IReq::get('guide_name')); $guideLink = IFilter::act(IReq::get('guide_link')); $data = array(); $guideObj = new IModel('guide'); if (!empty($guideName)) { foreach ($guideName as $key => $val) { if (!empty($val) && !empty($guideLink[$key])) { $data[$key]['name'] = $val; $data[$key]['link'] = $guideLink[$key]; } } } //清空导航栏 $guideObj->del('all'); if ($data) { //插入数据 foreach ($data as $order => $rs) { $dataArray = array('order' => $order, 'name' => $rs['name'], 'link' => $rs['link']); $guideObj->setData($dataArray); $guideObj->add(); } //跳转方法 $this->redirect('conf_base', false); exit; } break; case "other_conf": if (isset($_POST['auto_finish']) && $_POST['auto_finish'] == "") { $_POST['auto_finish'] == "0"; } break; case "mail_conf": break; case "system_conf": break; case "service_online": $serviceName = IFilter::act(IReq::get('service_name')); $serviceQQ = IFilter::act(IReq::get('service_qq')); $data = array(); foreach ($serviceName as $key => $val) { $data[] = array('name' => $serviceName[$key], 'qq' => $serviceQQ[$key]); } $_POST = array('service_online' => serialize($data)); break; } //获取输入的数据 $this->confRow = $inputArray = $_POST; if ($form_index == 'system_conf') { //写入的配置文件 $configFile = IWeb::$app->getBasePath() . 'config/config.php'; Config::edit($configFile, $inputArray); } else { $siteObj = new Config('site_config'); $siteObj->write($inputArray); } $this->redirect('conf_base', false); }
/** * @brief 应用皮肤方法 * @param string $theme 主题 * @param string $skin 皮肤 */ public static function applySkin($theme, $skin) { //兼容老式主题,仅有PC平台的非数组形式 $skinArray = is_array(IWeb::$app->config['skin']) ? IWeb::$app->config['skin'] : array('pc' => IWeb::$app->config['skin']); //根据其theme查询出所属于的平台 foreach (IWeb::$app->config['theme'] as $client => $themeParam) { if ($themeParam == $theme) { $skinArray = array_merge($skinArray, array($client => $skin)); } } $data = array('skin' => $skinArray); Config::edit('config/config.php', $data); }
function config() { $this->authorize('administrator'); $config = new Config($this->handler); $hash['data'] = $config->edit('timecard'); $this->error = $config->error; return $hash; }