Exemple #1
0
 public function __construct()
 {
     $this->m = Lib::getinstance()->A('Home\\Model\\home', Null, 'Model');
     $this->m_columns = Lib::getinstance()->A('Admin\\Model\\columns', Null, 'Model');
     //获取路由
     $url_str = trim($_SERVER['REQUEST_URI'], '/');
     $this->array['url_arr'] = explode('/', $url_str);
 }
Exemple #2
0
 /**
  * 模版方法
  *
  * @return string
  */
 public function createHtml($path, $array = [], $path_arr = [], $file_name = 'index.html')
 {
     if (C('HTML')) {
         $file_name ? $file_name : ($file_name = 'index.html');
         $create_class = Lib::getinstance()->A('Admin\\Expand\\CreateHtml', $path_arr, 'Expand');
         $create_class->start();
         $this->display($path, $array);
         $create_class->end($file_name);
         $this->display($path, $array);
     } else {
         $this->display($path, $array);
     }
 }
Exemple #3
0
 /**
  * 登录验证
  * @access public
  * @return json
  */
 public function index()
 {
     session_start();
     if ($_SESSION['manage']) {
         $this->message('', app_url('/home/index'));
         exit;
     }
     if ($this->post()) {
         if ($_POST['admincode'] == C('ADMIN_CODE')) {
             $model = lib::getinstance()->A('Admin\\Model', Null, 'Model');
             $user = $this->post('user');
             $password = md5($this->post('password'));
             $datetime = date('Y-m-d H:i:s', time());
             $sql = "select * from @_manage where admin=:user and password=:password and status=1";
             $re = $model->prepare($sql);
             $re->user = $user;
             $re->password = $password;
             $result = $re->execute()->fetch();
             $manage_id = $result['id'];
             if ($result) {
                 $_SESSION['manage'] = $_POST['user'];
                 $_SESSION['power_id'] = $result['power_id'];
                 $base_arr = lib::getinstance()->A('Admin\\Model\\base', Null, 'Model')->getOne();
                 $power_arr = Lib::getinstance()->A('Admin\\Model\\power', Null, 'Model')->getOne($_SESSION['power_id']);
                 $_SESSION['power_name'] = $power_arr['name'];
                 $_SESSION['base_name'] = $base_arr['name'];
                 $sql = "update @_manage set datetime='{$datetime}' where id='{$manage_id}'";
                 $model->prepare($sql)->execute();
                 echo json_encode(array('status' => 'y'));
                 exit;
             } else {
                 echo json_encode(array('status' => 'n'));
                 exit;
             }
         } else {
             echo json_encode(array('status' => 'c'));
             exit;
         }
     }
     $this->display('login.html');
 }
Exemple #4
0
 /**
  * 重定义构造器
  *
  * @param string $message
  * @param int $code
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->m = Lib::getinstance()->A('Admin\\Model\\link', Null, 'Model');
 }
 public function __construct()
 {
     $this->m = Lib::getinstance()->A('Admin\\Model\\base', Null, 'Model');
 }
Exemple #6
0
 /**
  * 重定义构造器
  *
  * @param string $message
  * @param int $code
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->m = Lib::getinstance()->A('Admin\\Model\\power', Null, 'Model');
     $this->m_power_class = Lib::getinstance()->A('Admin\\Model\\powerClass', Null, 'Model');
 }
Exemple #7
0
 /**
  * 生成订单
  *
  * @return array
  */
 public function makeOrder($array = [], $id = "")
 {
     $member = Lib::getinstance()->A('Admin\\Model\\member', Null, 'Model');
     $this->beginTransaction();
     $mem_data = $member->save($array, $id);
     $order_data = $this->save($array);
     if (!$mem_data || !$order_data) {
         $this->rollback();
         return false;
     }
     $this->commit();
     return $order_data;
 }
Exemple #8
0
 /**
  * 重定义构造器
  *
  * @param string $message
  * @param int $code
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->m['article'] = Lib::getinstance()->A('Admin\\Model\\article', Null, 'Model');
     $this->m['columns'] = Lib::getinstance()->A('Admin\\Model\\columns', Null, 'Model');
 }
Exemple #9
0
 /**
  * 记录日志
  */
 public function r_log($message = '')
 {
     $model = Lib::getinstance()->A('Admin\\Model\\log', Null, 'Model');
     //存入数据库
     $info = $this->get();
     $control = explode('\\', $info['controller']);
     $control = substr($control[2], 0, -10);
     $op = $info['operate'] ? $info['operate'] : 'index';
     // $message = $message;
     $datetime = time();
     $user = $_SESSION['manage'];
     $insert_array = array('message' => $message, 'datetime' => $datetime, 'controller' => $control, 'operate' => $op, 'user' => $user);
     $data = $model->save($insert_array);
     if (!$data) {
         die('日志存储失败');
     }
     //写入日志文件
     $file_path = ITEM_PATH . '/Data/log';
     $file_name = date('Ymd', time());
     if (!file_exists($file_path)) {
         mkdirs($file_path);
     }
     $control_path = $info['controller'] . '\\' . $info['operate'];
     $log_content = $user . ' ' . $message;
     $content = '时间:' . date('Y-m-d H:i:s', time()) . "\r\n" . '路径:' . $control_path . "\r\n" . '内容:' . $log_content . "\r\n";
     $open = fopen("{$file_path}/{$file_name}.txt", "a");
     fwrite($open, $content);
     fclose($open);
 }
Exemple #10
0
 /**
  * 删除栏目
  *
  * @return array
  */
 public function delete($id)
 {
     $columnsid = $id . ($this->columnsClassCount($id) > 0 ? ',' . implode(',', $this->getLevelId($id)) : '');
     $article = Lib::getinstance()->A('Admin\\Model\\article', Null, 'Model');
     $this->beginTransaction();
     if (!$this->columnsDel($columnsid) || !$article->delete($columnsid, 'columnsid')) {
         $this->rollback();
         return false;
     }
     $this->commit();
     return true;
 }