init() public static method

public static init ( )
示例#1
0
 /**
  * @JSON
  */
 public function savePlanCustom()
 {
     $custom_plan_name['A'] = $_POST['setting-A'];
     $custom_plan_name['B'] = $_POST['setting-B'];
     $custom_plan_name['C'] = $_POST['setting-C'];
     $custom_plan_name['D'] = $_POST['setting-D'];
     $custom_plan_name['VIP'] = $_POST['setting-VIP'];
     $custom_plan_name['Z'] = $_POST['setting-Z'];
     Option::set('custom_plan_name', json_encode($custom_plan_name));
     Option::init();
     $result['error'] = 0;
     $result['message'] = '保存完毕';
     return $result;
 }
示例#2
0
 /**
  * 更新 邮件系统设置
  *
  * @JSON
  */
 public function update()
 {
     $result['error'] = 0;
     $result['message'] = '保存完成';
     foreach ($_POST as $key => $val) {
         if (!empty($val) && strpos($key, 'mail_') !== false) {
             if (strpos($key, 'mailer') === false) {
                 // 判断是否为 mail_mailer <- 这个字段是用于是被当前设定的邮件类名,此配置无需存入数据库
                 $k = str_replace('mail_', '', $key);
                 $data[$k] = trim($val);
             }
         }
     }
     if (!empty($_POST['mail_mailer'])) {
         $config = json_encode($data);
         $mailer = trim($_POST['mail_mailer']);
         Option::set('MAIL_' . $mailer, $config);
         Option::set('MAIL_AVAILABLE', $mailer);
     } else {
         $result['error'] = 1;
         $result['message'] = '保存失败,参数不完整';
     }
     Option::init();
     return $result;
 }