コード例 #1
0
ファイル: book.php プロジェクト: antsmallant/coreapp
 /**
  * 群删日志
  */
 public static final function group_remove()
 {
     // 获取数据
     if (!isset($_POST['book_id']) || !is_array($_POST['book_id'])) {
         $error = '该日志不存在';
         front::view2('error.tpl', compact('error'));
         return;
     }
     // 删除数据
     self::deletes(null, null, array('book_id' => $_POST['book_id']), null, __CLASS__);
     header('Location: ?' . $_GET['query']);
 }
コード例 #2
0
ファイル: channel.php プロジェクト: antsmallant/coreapp
 public static final function tree()
 {
     $online = front::online();
     $channels = self::get_channel();
     $docs = self::selects('doc_id,typeid,title,create_date,create_time,update_date,update_time,hit', null, array('user_id' => $online->user_id), array('ORDER BY typeid ASC,doc_id DESC'), array('doc_id', 'assoc|table=doc' => null));
     $sites = self::selects('site_id,typeid,title,create_date,create_time,update_date,update_time', null, array('user_id' => $online->user_id), array('ORDER BY typeid ASC,site_id DESC'), array('site_id', 'assoc|table=site' => null));
     $adds = self::selects('address_id,typeid,name', null, array('user_id' => $online->user_id), array('ORDER BY typeid ASC,address_id DESC'), array('address_id', 'assoc|table=address' => null));
     $diarys = self::selects('diary_id,typeid,title,create_date,create_time,update_date,update_time', null, array('user_id' => $online->user_id), array('ORDER BY typeid ASC,diary_id DESC'), array('diary_id', 'assoc|table=diary' => null));
     return front::view2(__CLASS__ . '.' . 'tree.tpl', compact('channels', 'docs', 'sites', 'adds', 'diarys'), null, false);
 }
コード例 #3
0
ファイル: user.php プロジェクト: antsmallant/coreapp
 /**
  * 群删用户
  */
 public static final function group_remove()
 {
     if (!self::user_level(2, __CLASS__, __FUNCTION__)) {
         return;
     }
     $online = front::online();
     // 获取数据
     if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
         $error = '该用户不存在';
         front::view2('common/error.tpl', compact('error'));
         return;
     }
     // 删除数据
     self::deletes(null, null, array('user_id' => $_POST['user_id'], 'user_id!=?' => $online->user_id), null, __CLASS__);
     header('Location: ?' . $_GET['query']);
 }
コード例 #4
0
ファイル: sync.php プロジェクト: antsmallant/coreapp
 /**
  * 默认动作
  */
 public static final function index()
 {
     front::view2(__CLASS__ . '.' . __FUNCTION__ . '.tpl');
 }
コード例 #5
0
ファイル: related.php プロジェクト: antsmallant/coreapp
 /**
  * 删除网址
  */
 public static final function remove()
 {
     // 获取数据
     $related = new self();
     $related->related_id = isset($_GET['related_id']) ? $_GET['related_id'] : null;
     if (!is_numeric($related->related_id) || !$related->select()) {
         $error = '该关联不存在';
         front::view2('error.tpl', compact('error'));
         return;
     }
     // 删除数据
     $related->delete();
     header('Location: ?' . $_GET['query']);
 }
コード例 #6
0
ファイル: front.php プロジェクト: antsmallant/coreapp
 /**
  * 登录函数
  *
  * @param bool $login
  * @return self
  */
 public static final function login($redirect = null)
 {
     $error = array();
     //print_r($_SERVER);
     //print_r($_POST);
     // 数据消毒
     $method = 'post';
     if (IN_WAP) {
         //@file_put_contents('wap-'.date('Y-m-d').'-'.$_SERVER['REMOTE_HOST'].'.txt',var_export($_SERVER,true));
         if (strstr($_SERVER['HTTP_VIA'], 'infoX-WISG, Huawei Technologies')) {
             $method = 'get';
             $_POST = $_GET;
         }
     }
     $post = array('username' => isset($_POST['username']) ? $_POST['username'] : '', 'password' => isset($_POST['password']) ? $_POST['password'] : '', 'authcode' => isset($_POST['authcode']) ? $_POST['authcode'] : '', 'redirect' => isset($_POST['redirect']) ? $_POST['redirect'] : '');
     if (get_magic_quotes_gpc()) {
         $post = array_map('stripslashes', $post);
     }
     // 表单处理
     while ($redirect === null && isset($_SERVER['REQUEST_METHOD']) && ($_SERVER['REQUEST_METHOD'] === 'POST' || $method == 'get' && $_SERVER['REQUEST_METHOD'] === 'GET')) {
         // 配置处理
         $attribute_array = array('front_class', 'front_table', 'front_fuzzy', 'front_username', 'front_password', 'front_redirect');
         list($front_class, $front_table, $front_fuzzy, $front_username, $front_password, $front_redirect) = self::init($attribute_array);
         list($front_class2, $front_table2, $front_fuzzy2, $front_username2, $front_password2, $front_redirect2) = parent::init($attribute_array);
         $front_class === '' and $front_class = $front_class2;
         $front_table === '' and $front_table = $front_table2;
         $front_fuzzy === '' and $front_fuzzy = $front_fuzzy2;
         $front_username === '' and $front_username = $front_username2;
         $front_password === '' and $front_password = $front_password2;
         $front_redirect === '' and $front_redirect = $front_redirect2;
         // 数据验证
         if ($post['username'] === '') {
             $error['username'] = '******';
         }
         if ($post['password'] === '') {
             $error['password'] = '******';
         }
         if (!IN_WAP) {
             if ($post['authcode'] === '') {
                 $error['authcode'] = '验证码不能为空';
             } elseif (!self::authcode($post['authcode'])) {
                 $error['authcode'] = '验证码输入不正确';
             }
         }
         if ($error !== array()) {
             break;
         }
         // 密码加密处理
         //$post ['password'] = md5 ($post ['password']);
         //$front_password = md5 ($front_password);
         if (empty($front_class)) {
             $front_class = get_parent_class();
         }
         if ($front_username) {
             // 配置项验证
             if ($front_fuzzy) {
                 // 同时验证
                 if ($front_username !== $post['username'] || $front_password !== md5($post['username'] . md5($post['password']))) {
                     $error['username'] = $error['password'] = '******';
                     break;
                 }
             } else {
                 // 分开验证
                 if ($front_username !== $post['username']) {
                     $error['username'] = '******';
                     break;
                 }
                 if ($front_password !== md5($post['username'] . md5($post['password']))) {
                     $error['password'] = '******';
                     break;
                 }
             }
             $online = new $front_class();
             $online->username = $post['username'];
             $online->password = md5($post['username'] . md5($post['password']));
         } else {
             // 数据库验证
             if (empty($front_table)) {
                 $front_table = null;
                 $class_table = 'class|table=' . $front_class;
             } else {
                 $class_table = 'class';
             }
             if ($front_fuzzy) {
                 // 同时验证
                 $online = self::selects(null, $front_table, array('username' => $post['username'], 'password' => md5($post['username'] . md5($post['password']))), null, array($class_table => $front_class));
                 if (empty($online)) {
                     $error['username'] = $error['password'] = '******';
                     break;
                 }
             } else {
                 // 分开验证
                 $online = self::selects(null, $front_table, array('username' => $post['username']), null, array($class_table => $front_class));
                 if (empty($online)) {
                     $error['username'] = '******';
                     break;
                 }
                 if ($online->password !== md5($post['username'] . md5($post['password']))) {
                     $error['password'] = '******';
                     break;
                 }
             }
         }
         // 页面跳转
         self::online($online);
         if ($post['redirect'] !== '') {
             header('Location: ' . $post['redirect']);
         } elseif ($front_redirect !== '') {
             header('Location: ' . $front_redirect);
         } else {
             echo 'Require front_redirect.';
         }
         return false;
     }
     // 显示模板
     front::view2(__CLASS__ . '.' . __FUNCTION__ . '.tpl', compact('error', 'redirect', 'method'));
     return false;
 }