Example #1
0
 public function __construct()
 {
     $this->S = \Seter\Seter::getInstance();
     $this->base = SHAM_PATH . '\\Document';
     $this->booklist = $this->getbooklist_();
     //获取book列表
 }
Example #2
0
 public function doMain()
 {
     //        echo $this->user->islogin();
     //        echo $this->user->isguest();
     //        D( $this->user->getuserinfo());
     //        echo $this->user->isadmin();
     D(\Seter\Seter::getInstance()->request->cookie['vuser_uname']);
     $this->display('', ['title' => '主界面']);
 }
Example #3
0
 public function __construct()
 {
     $this->S = \Seter\Seter::getInstance();
     $this->get = $this->S->request->get;
     $this->post = $this->S->request->post;
     $this->cookie = $this->S->request->cookie;
     //$this->coderes = $this->DefaultCoderes();
     //$this->jsoncode(0);          //初始状态
     $this->_init();
 }
Example #4
0
 public function __construct($tablename = '')
 {
     $this->tablename = trim($tablename);
     $this->db = \Seter\Seter::getInstance()->db;
     //获取所有的表明
     $sql = "select table_name\n                from information_schema.tables\n                where table_schema='{$this->db->Config['database']}' and table_type='base table'\n                ";
     $colar = $this->db->getcol($sql);
     if (!in_array($tablename, $colar)) {
         die("error tablename : {$table};");
     }
 }
Example #5
0
 /**
  * @param string $tplDir
  */
 public function __construct($tplDir = '')
 {
     $this->_tplDir = C('app')['APP_PATH'];
     $mo = C('Router')['method_modules'];
     if ($mo) {
         $this->_tplDir .= 'Modules/' . C('app')['modulelist'][$mo] . '/';
     }
     $this->_tplDir .= 'view/';
     $this->assign('GET', \Seter\Seter::getInstance()->request->get);
     $this->assign('POST', \Seter\Seter::getInstance()->request->post);
     $this->assign('COOKIE', \Seter\Seter::getInstance()->request->cookie);
 }
Example #6
0
 public function __construct()
 {
     \St::Getcodelist($this->DefaultCoderes());
     //1 把code列表传入进去
     $this->S = \Seter\Seter::getInstance();
     $userfield = C('User')['UserField'] ?: [];
     $field = array_merge($this->UserDefaultField(), $userfield);
     foreach ($field as $key => $value) {
         $this->{$key} = $value;
     }
     $this->map['idtouname'] = $this->mapidtouname();
     $this->map['unametoid'] = array_flip($this->map['idtouname']);
     //        $this->isguest = $this->isguest();          //是否访客【未登录】
     //        $this->islogin = $this->islogin();          //是否登陆
     //        $this->isadmin = $this->isadmin();          //是否管理员
     //        $this->myinfo = $this->myinfo();            //我的信息
 }
Example #7
0
 /**
  * 构造函数,初始化视图实例,调用hook
  */
 public function __construct()
 {
     //$this->Geter = \G\Geter::getInstance();
     $this->router = C('Router');
     $this->env = C('env');
     $this->app = C('app');
     $this->rules = C('rules');
     $this->headers = C('headers');
     $this->params = $this->router['params'];
     $this->env['bt'] = $_SERVER['REQUEST_TIME_FLOAT'];
     $this->env['ip'] = $this->env['REMOTE_ADDR'];
     $this->env['mem'] = memory_get_usage();
     //
     //        // 依赖注入
     $this->singleton('S', function ($c) {
         return \Seter\Seter::getInstance();
     });
     //
     //        /**
     //         * 无依赖或者只抵赖底层的 route属于最底层,可以在conf中进行变量的配置
     //         * /
     $this->singleton('db', function ($c) {
         return $this->S->db;
     });
     $this->singleton('table', function ($c) {
         return $this->S->table;
     });
     $this->singleton('Model', function ($c) {
         return $this->S->model;
     });
     $this->singleton('request', function ($c) {
         return $this->S->request;
     });
     //            $this->singleton('user', function ($c) {
     //                  return $this->S->user;
     //            });
     $this->singleton('rbac', function ($c) {
         return $this->S->rbac;
     });
     $this->_view = new View();
 }
Example #8
0
 /**
  * 计算解析数组
  */
 public function urianal($uri = '')
 {
     if (!empty($uri)) {
         $p_ = explode('?', $uri);
         $router['path'] = $p_[0];
         if (isset($p_[1])) {
             $p2 = explode('&', $p_[1]);
             foreach ($p2 as $key => $value) {
                 $pp_ = explode('=', $value);
                 if (!empty($pp_[0]) && !empty($pp_[1])) {
                     //						if($pp_[0]) $pp[$pp_[0]] = $pp_[1];
                     if (\Seter\Seter::getInstance()->sys->is_zm($pp_[0])) {
                         $pp[$pp_[0]] = $pp_[1];
                     }
                 }
             }
             $router['parm'] = $pp;
         }
     }
     return $router;
 }
Example #9
0
<?php

//检索数据库,看是否能找到想匹配的模拟结果输出
$s = \Seter\Seter::getInstance();
$s->model->logc->L();
//开始执行的时候 insert log
$router = C('Router');
$chr = $router['method_controller'] . '/' . $router['method_action'];
//查询数据库
$where = "api = '{$chr}'";
$row = $s->table->g_userapi->where($where)->getrow();
if ($row['response']) {
    $res = $row['response'];
    $res = json_decode($res, true);
    //$res['getpost'] = print_r($s->request->post,true);
    $res['getpost'] = $s->request->post;
    //    $res['getpost'] = print_r($s->request->post,true);
    $res['st'] = 'from 404';
} else {
    $res = ['code' => 404, 'msg' => 'error 404', 'st' => 'from 404page'];
}
echo json_encode($res);
exit;
Example #10
0
<?php

/**
 * 对G的测试代码
 */
include '../../Grace/Common.php';
//基础函数
include '../../App/Seter/I.php';
//入口代码
$m['app'] = G('../../App/Conf.php');
C($m);
//建立配置文件
$db = \Seter\Seter::getInstance()->gpdo;
echo 123;
$rc = $db->getAll("select * from dy_user");
D($rc);
D($db->getTablesName());
/**
 * 1 : 要根据动作选择不同的连接池
 * select -> 副表 或镜像表   [定时或触发更新副表]
 * update -> 主表 或主表扩展 [配合任务系统进行]
 * delete -> 主表 或主表扩展 [配合任务系统进行]
 * insert -> 主表 或主表扩展 [配合任务系统进行]
 *
 * 2 : 要根据表,选择不同的连接池
 * tablename
 *
 * 3 : 其他情况进行扩展,比如联合查询,组合查询,等等
 */
Example #11
0
 public function __construct()
 {
     $this->S = \Seter\Seter::getInstance();
     $this->isguest = $this->isguest();
 }
Example #12
0
<?php

/**
 * 对G的测试代码
 */
include '../../Grace/Common.php';
//基础函数
include '../../App/Seter/I.php';
//入口代码
$m['app'] = G('../../App/Conf.php');
C($m);
//建立配置文件
$db = \Seter\Seter::getInstance()->db;
$rc = $db->getall("select * from dy_user");
D($rc);
Example #13
0
 public function __construct()
 {
     $this->db = \Seter\Seter::getInstance()->db;
     $this->table = \Seter\Seter::getInstance()->table;
 }
Example #14
0
/**
 * 获取数据库实例
 * @return DB
 */
function M()
{
    return \Seter\Seter::getInstance()->db;
}
Example #15
0
 public function __construct()
 {
     $this->S = \Seter\Seter::getInstance();
     $this->base = SHAM_PATH . '\Document';
     $this->indexlist = $this->getindexlist_();       //获得所有的book
 }
Example #16
0
 public function __construct()
 {
     parent::__construct();
     $this->S = \Seter\Seter::getInstance();
 }
Example #17
0
File: I.php Project: shampeak/_m.so
入口程序
 * */
namespace Seter;

define('FAST_PATH', __DIR__);
//use Seter\RedBeanPHP;
define('SHAM_PATH', __DIR__);
include __DIR__ . '/Function/Fun.php';
!empty($_GET) && define('ISGET', TRUE);
!empty($_POST) && define('ISPOST', TRUE);
!defined('ISGET') && define('ISGET', false);
!defined('ISPOST') && define('ISPOST', false);
!defined('BTIME') && define('BTIME', \Sham::T());
include 'Core/Base.php';
//基类
include 'Seter.php';
//基类
\Seter\Seter::registerAutoloader();
//PSR-0
/**
 * 目录设定
 * 1 基础类 不能直接使用,需要被继承
 * Fast
 * 2 基础功能类 提供稳定的函数和变量 可以直接使用
 * Base
 * 3 功能类 提供系列功能
 * Library
 * 4 模型 Model
 * 解决问题的模型
 * 5 modules模块
 */
Example #18
0
 public function Umarch_do_user()
 {
     if ($this->res) {
         //用户匹配
         $ck = $this->res['roles'];
         //用户验证仓库
         //所有用户
         if (in_array('*', $ck)) {
             $this->p = ['deny' => $this->res['deny'], 'allow' => $this->res['allow']];
             return true;
         }
         //登陆用户
         if (\Seter\Seter::getInstance()->user->islogin()) {
             if (in_array('@', $ck)) {
                 $this->p = ['deny' => $this->res['deny'], 'allow' => $this->res['allow']];
                 return true;
             }
             //管理员
             if (in_array('?', $ck)) {
                 //查询数据库解决
                 //                    $tablename = "g_accessrules";
                 //                    $tablename_rulelib = "g_rulelib";
                 //获取表名
                 $tablename = C('Rbacdb')['accessrules'];
                 $tablename_rulelib = C('Rbacdb')['accessrules_lib'];
                 $uname = \Sham::saddslashes(\Seter\Seter::getInstance()->request->cookie['vuser_uname']);
                 $where_ = $this->Module ? "rule_module = '{$this->Module}'" : '1';
                 $where_ .= "and rule_action = '{$this->Action}'\n                                and rule_controller = '{$this->Controller}'\n                                and enable = 1";
                 $where = "uname = '{$uname}' and rid in(\n                        select rule_id from {$tablename_rulelib} where {$where_}\n                    )";
                 $sql = "select * from {$tablename} where {$where}";
                 $row = \Seter\Seter::getInstance()->db->getrow($sql);
                 if ($row) {
                     $this->p = ['deny' => $row['deny'], 'allow' => $row['allow']];
                     return true;
                 }
             }
         } else {
             //游客
             if (in_array('G', $ck)) {
                 $this->p = ['deny' => $this->res['deny'], 'allow' => $this->res['allow']];
                 return true;
             }
         }
         //管理员
         if (\Seter\Seter::getInstance()->user->isadmin()) {
             if (in_array('A', $ck)) {
                 $this->p = ['deny' => $this->res['deny'], 'allow' => $this->res['allow']];
                 return true;
             }
         }
         //+--------------------------------------------
     }
     return false;
 }