Esempio n. 1
0
 public function display()
 {
     echo '<hr>';
     echo 'cookie';
     echo '<br>uname:' . cookie('vuser_uname');
     echo '<br>tname:' . cookie('vuser_tname');
     echo '<br>authkey:' . cookie('vuser_authkey');
     echo '<br>groupid:' . cookie('vuser_groupid');
     echo '<br>tm:' . cookie('tm');
     //记录时间
     echo '<br>signature:' . cookie('vuser_signature');
     //签名算法
     echo '<hr>';
     echo 'signnature';
     echo '<br>' . \Sham::signnature(cookie('vuser_uname') . cookie('vuser_tname') . cookie('vuser_authkey') . cookie('vuser_groupid') . cookie('vuser_tm'));
     echo '<hr>';
     echo 'islogin';
     echo $this->islogin();
     echo '<hr>';
     echo 'isguest';
     echo $this->isguest();
     echo '<hr>';
     echo ' var isguest';
     echo $this->isguest;
 }
Esempio n. 2
0
File: I.php Progetto: 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
Esempio n. 3
0
 public function getnodelist()
 {
     $path = $this->base . '\\Doc_' . $this->book;
     !is_dir($path) && mkdir($path);
     $dirHandle = @opendir($path);
     $list = array();
     while (($pname = readdir($dirHandle)) !== false) {
         if ($pname != '.' && $pname != '..') {
             if (substr($pname, 0, 4) == 'Doc_') {
                 $pname = substr($pname, 4, -3);
                 $pn = \Sham::getarr($pname, 0, '_');
                 $list[$pn[0]][] = $pn[1];
             }
         }
     }
     foreach ($list as $key => $value) {
         $ar = $value;
         rsort($ar);
         $list[$key] = $ar;
     }
     return $list;
 }
Esempio n. 4
0
 public function buildsql()
 {
     if ($this->sqltype == 'getcount') {
         $sql = " select count(*)";
     } else {
         $sql = " select {$this->colm}";
     }
     $sql .= " from {$this->tablename}";
     if (!empty($this->where)) {
         $wheres = \Sham::getstr($this->where, 0, ' and ');
         $sql .= " where {$wheres}";
     }
     if (!empty($this->group)) {
         $sql .= " group by {$this->group}";
     }
     if (!empty($this->order)) {
         $sql .= " order by {$this->order}";
     }
     if (!empty($this->limit)) {
         $sql .= " limit {$this->limit}";
     }
     $this->sql = $sql;
     return $this;
 }
Esempio n. 5
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;
 }
Esempio n. 6
0
 /**
  * 删除目录和目录里面的所有文件
  * @param type $dirName 目录名
  * @return type
  */
 function DeleteDirandfile($dirName = '.')
 {
     if ($handle = opendir("{$dirName}")) {
         while (false !== ($item = readdir($handle))) {
             if ($item != "." && $item != "..") {
                 if (is_dir("{$dirName}/{$item}")) {
                     \Sham::DeleteDirandfile("{$dirName}/{$item}");
                 } else {
                     unlink("{$dirName}/{$item}");
                     //if( unlink( "$dirName/$item" ) )    echo "成功删除文件: $dirName/$item<br />\n";
                 }
             }
         }
         closedir($handle);
         rmdir($dirName);
         //if( rmdir( $dirName ) ) echo "成功删除目录: $dirName<br />\n";
     }
 }
Esempio n. 7
0
    public function save($path='',$wzchr='',$nr='')
    {
        $path   = trim($path);
        $wzchr  = trim($wzchr);
        if(empty($path) || empty($wzchr) || EMPTY($nr)) return array();

        //目录露监测
        $filepath = $this->base.'\Doc_'.$path;
        !is_dir($filepath) && mkdir($filepath);

        //计算版本id
        $list = $this->wzlist($path);
        $verlist = $list[$wzchr];                           //获取到了所有的版本


//        if(!empty($ver)){
//
//        }

if($this->dtype == 'Doc'){
    $nver = !empty($verlist)?max($verlist)+1:1;         //获取到了新的版本id
}else{
    //流程图和时序图
    $nver = max($verlist);         //获取到了新的版本id
}

        //获得文件名
       // $filename  =$this->base.'\\'.$this->dtype.'_'.$path.'\\'.$this->dtype.'_'.$wzchr."_$nver.ME";
        $filename  =$this->base.'\Doc_'.$path.'\\'.$this->dtype.'_'.$wzchr."_$nver.ME";

        //写文件
        \Sham::Fs($filename,$nr);
        return true;
    }
Esempio n. 8
0
 /**
  * @return mixed
  * 获取我的用户信息
  */
 public function getuserinfo($uname = '')
 {
     $tablename = $this->tablename;
     $uname = $uname ?: $this->S->request->cookie['vuser_uname'] ?: '';
     if ($this->checkname($uname)) {
         //用户名监测通过
         $uname = \Sham::saddslashes($uname);
         $row = $this->S->table->{$tablename}->where("{$this->fileduname} = '{$uname}'")->getrow();
         //unset($row[$this->filedpwd]);
     } else {
         //没通过
         $row = [];
     }
     return $row;
 }