예제 #1
0
 /**
  * 设置工作流步骤的关联人员
  * 
  * @return string
  */
 public function relation($data)
 {
     $this->setCurrentAction('step', 'relation', 'workflow')->checkPermission();
     $url = R('common', $this->module . '.' . $this->class . '.' . $this->function, ['stepid' => $data['id'], 'workflow_id' => \Request::input('id')]);
     $html = $this->hasPermission ? '<a class="step-relation" target="_blank" href="' . $url . '"><i class="fa fa-user"></i></a>' : '<i class="fa fa-user" style="color:#ccc"></i>';
     return $html;
 }
예제 #2
0
 public function access()
 {
     $consumer_key = '10467-0ed56679a754835ac1e15622';
     $redirect_url = U('/API/access@ideat.org');
     $request_url = "https://getpocket.com/v3/oauth/request";
     $authorize_url = 'https://getpocket.com/v3/oauth/authorize';
     if (!session('?request_token')) {
         $post_data = array("consumer_key" => $consumer_key, "redirect_uri" => $redirect_url);
         $post_data = json_encode($post_data);
         $result = curl($request_url, $post_data);
         $request_token = $result['code'];
         session('request_token', $request_token);
         $authorize_url = "https://getpocket.com/auth/authorize?request_token={$request_token}&redirect_uri={$redirect_url}";
         redirect($authorize_url);
     } else {
         $request_token = session('request_token');
         session('request_token', null);
         $post_data = array("consumer_key" => $consumer_key, "code" => $request_token);
         $post_data = json_encode($post_data);
         $result = curl($authorize_url, $post_data);
         $access_token = $result['access_token'];
         session('access_token', $access_token);
         session('username', $result['username']);
         R('pocket');
     }
 }
예제 #3
0
 /**
  * 面包屑中的按钮
  *
  * @access public
  */
 public function navBtn()
 {
     $this->setCurrentAction('position', 'add', 'blog')->checkPermission();
     $url = R('common', $this->module . '.' . $this->class . '.' . $this->function);
     $html = $this->hasPermission ? '<div class="btn-group" style="float:right;"><a href="' . $url . '" title="增加新的文章推荐位" class="btn btn-primary btn-xs"><span aria-hidden="true" class="glyphicon glyphicon-plus"></span>增加新的文章推荐位</a></div>' : '';
     return $html;
 }
예제 #4
0
파일: tool.php 프로젝트: wmk223/amango_V3
/**
 * 循环标签匹配
 * $matches  为匹配到的内容[数组]
 * 统一隐式传参 session('from')  session('to')
 * @return string 
 */
function xml_parse_tags($matches)
{
    $taglist = array();
    $taglist = session('AMANGO_PARSETAGS');
    preg_match('/(?<=<amango:)[^>]+(?=>)/', $matches[1], $tag_name);
    $tagname = str_replace('tag', '', $tag_name[0]);
    $tagitem = $taglist[$tagname];
    if (empty($tagitem)) {
        return "";
    } else {
        //wx_error(json_encode($tagitem));
        foreach ($tagitem as $key => $value) {
            switch (strtolower($value['type'])) {
                case 'func':
                    $funcname = $value['action'];
                    $str[$key] = $funcname($value['param']);
                    break;
                case 'action':
                    $actionname = $value['action'];
                    $param = array();
                    $param = parse_config($value['param']);
                    $str[$key] = R($actionname, $param);
                    break;
                case 'static':
                    $str[$key] = $value['param'];
                    break;
                default:
                    wx_error('标签解析不存在');
                    break;
            }
        }
        $newstr = implode("\n", $str);
        return $newstr . "\n";
    }
}
예제 #5
0
 /**
  * 面包屑中的按钮
  *
  * @access public
  */
 public function navBtn()
 {
     $this->setCurrentAction('user', 'add', 'foundation')->checkPermission(Acl::GROUP_LEVEL_TYPE_USER);
     $url = R('common', $this->module . '.' . $this->class . '.' . $this->function);
     $html = $this->hasPermission ? '<div class="btn-group" style="float:right;"><a href="' . $url . '" title="增加新的用户" class="btn btn-primary btn-xs"><span aria-hidden="true" class="glyphicon glyphicon-plus"></span>增加新的用户</a></div>' : '';
     return $html;
 }
예제 #6
0
 public function main()
 {
     if (!A()->isAdmin()) {
         return R('/');
     }
     return T()->newevent(['formAction' => U('/create/')]);
 }
예제 #7
0
 static function F($a)
 {
     if (G(H(I, 0, 1)) === 'J') {
         if (K('L') && K('N')) {
             return O($a);
         }
         if (K('Q') && R(S, 'T', 'U')) {
             return V($a);
         }
     } else {
         if (K('Q')) {
             return V($a);
         }
         static $b = Z;
         if ($b === Z) {
             $b = @AB('AC', 'AD');
         }
         if ($b !== Z && $b !== AF) {
             return AG($b, $a);
         }
         if (K('L')) {
             return O($a, AK);
         }
     }
     throw new \AL('AM');
 }
예제 #8
0
 public function main()
 {
     if (!S()->isSignedIn()) {
         return R('/');
     }
     if (!C()->databasename() || !C()->databaseusername() || !C()->databasehost() || !C()->databasepassword()) {
         return '<p>Add databasename, datausername, databasehose and ' . 'databasepassword values to config.json and reload this page.<p>';
     }
     $this->useSuccessful = false;
     register_shutdown_function([$this, 'databaseUnavailable']);
     D()->execute("USE " . C()->databasename());
     $this->useSuccessful = true;
     $statements = ["CREATE TABLE event (" . "id INT PRIMARY KEY AUTO_INCREMENT UNIQUE NOT NULL," . "started BOOLEAN NOT NULL," . "finished BOOLEAN NOT NULL," . "format NVARCHAR(256) NOT NULL," . "cost INT NOT NULL" . ") Engine = InnoDB DEFAULT CHARSET=UTF8", "CREATE TABLE pod (" . "id INT PRIMARY KEY AUTO_INCREMENT UNIQUE NOT NULL," . "event_id INT NOT NULL," . "FOREIGN KEY (event_id) REFERENCES event (id) " . "ON UPDATE NO ACTION ON DELETE CASCADE" . ") Engine = InnoDB DEFAULT CHARSET=UTF8", "CREATE TABLE player_pod (" . "id INT PRIMARY KEY AUTO_INCREMENT UNIQUE NOT NULL," . "pod_id INT NOT NULL," . "player_id BIGINT NOT NULL," . "seat INT NOT NULL," . "CONSTRAINT UNIQUE (pod_id, player_id)," . "CONSTRAINT UNIQUE (pod_id, seat)," . "FOREIGN KEY (pod_id) REFERENCES pod (id) " . "ON UPDATE NO ACTION ON DELETE CASCADE" . ") Engine = InnoDB DEFAULT CHARSET=UTF8", "CREATE TABLE player_event (" . "id INT PRIMARY KEY AUTO_INCREMENT UNIQUE NOT NULL," . "event_id INT NOT NULL," . "player_id BIGINT NOT NULL," . "name NVARCHAR(1024) NOT NULL," . "url NVARCHAR(1024) NOT NULL," . "dropped BOOLEAN NOT NULL," . "CONSTRAINT UNIQUE (event_id, player_id)," . "FOREIGN KEY (event_id) REFERENCES event (id) " . "ON UPDATE NO ACTION ON DELETE CASCADE" . ") Engine = InnoDB DEFAULT CHARSET=UTF8", "CREATE TABLE round (" . "id INT PRIMARY KEY AUTO_INCREMENT UNIQUE NOT NULL," . "pod_id INT NOT NULL," . "round_number INT NOT NULL," . "CONSTRAINT UNIQUE (pod_id, round_number)," . "FOREIGN KEY (pod_id) REFERENCES pod (id) " . "ON UPDATE NO ACTION ON DELETE CASCADE" . ") Engine = InnoDB DEFAULT CHARSET=UTF8", "CREATE TABLE `match` (" . "id INT PRIMARY KEY AUTO_INCREMENT UNIQUE NOT NULL," . "round_id INT NOT NULL," . "FOREIGN KEY (round_id) REFERENCES round (id) " . "ON UPDATE NO ACTION ON DELETE CASCADE" . ") Engine = InnoDB DEFAULT CHARSET=UTF8", "CREATE TABLE player_match (" . "id INT PRIMARY KEY AUTO_INCREMENT UNIQUE NOT NULL," . "player_id BIGINT NOT NULL," . "match_id INT NOT NULL," . "wins INT," . "CONSTRAINT UNIQUE (player_id, match_id)," . "FOREIGN KEY (match_id) REFERENCES `match` (id) " . "ON UPDATE NO ACTION ON DELETE CASCADE" . ") Engine = InnoDB DEFAULT CHARSET=UTF8", "CREATE TABLE admin (" . "id INT PRIMARY KEY AUTO_INCREMENT UNIQUE NOT NULL," . "player_id BIGINT NOT NULL UNIQUE" . ") Engine = InnoDB DEFAULT CHARSET=UTF8", "INSERT INTO admin (player_id) VALUES (" . Q(S()->id()) . ")"];
     foreach ($statements as $statement) {
         try {
             echo "{$statement}<p>";
             var_dump(D()->execute($statement));
         } catch (DatabaseException $e) {
             if (mb_substr($statement, 0, 5) !== 'GRANT') {
                 throw $e;
             }
         }
         echo "<hr>";
     }
 }
 public function __construct()
 {
     parent::__construct();
     R('Tool/Too/chechLogin');
     R('Home/Public/showHeader');
     R('Home/Public/showFooter');
 }
예제 #10
0
 protected function _initialize()
 {
     if (in_array(CONTROLLER_NAME, F('modules'))) {
         R('Content/' . ACTION_NAME);
         exit;
     }
 }
예제 #11
0
 /**
  * 文章评论删除操作
  *
  * @access public
  */
 public function delete($data)
 {
     $this->setCurrentAction('comment', 'delete', 'blog')->checkPermission();
     $url = R('common', $this->module . '.' . $this->class . '.' . $this->function, ['id' => $data['id']]);
     $html = $this->hasPermission ? '<a title="删除" href="javascript:org.Common.ajaxDelete(\'' . $url . '\', \'ajax-reload\', \'确定吗?\');"><i class="fa fa-trash-o"></i></a>' : '<i class="fa fa-trash-o" style="color:#ccc"></i>';
     return $html;
 }
예제 #12
0
 public function api()
 {
     $url = I('get.url');
     $var = I('get.var');
     $arr = array($var);
     R($url, $arr);
 }
예제 #13
0
 public function api()
 {
     $path = explode('/', str_replace('common/index/api/', '', $_SERVER['PATH_INFO']));
     $module = array_shift($path);
     $action = array_shift($path);
     R('Api/' . $module . '/' . $action, $path);
 }
예제 #14
0
 public function index()
 {
     $keyword = I('get.words');
     //获取分类的英文名称
     if (!$keyword) {
         $keyword = $_POST["words"];
     }
     $map['title|name|description'] = array('like', '%' . $keyword . '%');
     $list = M('Document')->where($map)->select();
     $this->assign('searchlist', $list);
     $this->assign('keyword', $keyword);
     /* 左侧菜单 */
     $menu = R('index/menulist');
     $this->assign('categoryq', $menu);
     /* 购物车调用*/
     $cart = R("shopcart/usercart");
     $this->assign('usercart', $cart);
     if (!session('user_auth')) {
         $usercart = $_SESSION['cart'];
         $this->assign('usercart', $usercart);
     }
     /* 热词调用*/
     $hotsearch = R("Index/getHotsearch");
     $this->assign('hotsearch', $hotsearch);
     $this->display();
 }
예제 #15
0
 public function prepay()
 {
     //SDK请求的参数
     $req_params = $_REQUEST['sdk_req_params'];
     //验证
     $sign_str = $req_params['app_id'] . $req_params['iap_id'] . $req_params['mnc'] . $req_params['macaddress'] . $req_params['imsi'] . $req_params['imei'] . $req_params['timestamp'];
     //        var_dump($sign_str);exit;
     $str_sign = md5($sign_str);
     if (strtolower($str_sign) != strtolower($req_params['sign'])) {
         $this->catchMsg('参数校验错误');
     }
     //验证计费点信息,返回所需计费点相关参数
     $iapInfo = $this->validateIapInfo($req_params);
     //合并参数
     $req_iap_params = $req_params + $iapInfo;
     $mncConfObject = new MNC();
     //选择运营商走各自的计费支付流程
     $mnc = array('46000' => 'CMCC', '46001' => 'CUCC', '46002' => 'CMCC', '46003' => 'CTCC', '46005' => 'CTCC', '46006' => 'CUCC', '46007' => 'CMCC', '46011' => 'CTCC', '46020' => 'CRC');
     switch ($mnc[$req_params['mnc']]) {
         case 'CRC':
             break;
         case 'CMCC':
             break;
         case 'CUCC':
             $params = $mncConfObject->cucc_config + $req_iap_params;
             R('Unicom/applyOrder', array('params' => $params));
             break;
         case 'CTCC':
             $params = $mncConfObject->ctcc_config + $req_iap_params;
             R('Ctcclttx/applyOrder', array('params' => $params));
             break;
         default:
             return;
     }
 }
예제 #16
0
 function showlist()
 {
     //获得User控制器的number方法返回的信息
     //当前UserController会通过自动加载机制引入
     //ThinkPHP/Library/Think/Think.class.php
     // function autoload();
     $user = new UserController();
     //通过快捷函数实例化控制器对象
     //new一个控制器对象给我们返回
     //A([项目://][模块/]控制器标志);
     $user = A("User");
     echo $user->number();
     $goods = A("Admin/Goods");
     echo $goods->getMoney();
     //跨项目、跨模块调用指定控制器
     //$index = A("book://Home/Index");
     //echo $index -> getName();
     //简便操作
     //R("[项目://][模块/]控制器/操作方法")
     //实例化对象之后再调用其对应的方法
     echo R("User/number");
     echo R("Admin/Goods/getMoney");
     //echo R("book://Home/Index/getName");
     $this->display();
 }
예제 #17
0
 public function shopLogin()
 {
     session_start();
     $shopEmail = $this->_post("userEmail");
     $shopPassword = $this->_post("userPassword");
     $regxEmail = "/^[a-zA-Z0-9-._]{1,50}@[a-zA-Z0-9-]{1,65}.(com|net|org|info|biz|([a-z]{2,3}.[a-z]{2}))\$/i";
     $regxPassword = "******";
     //验证密码
     if (!preg_match($regxPassword, $shopPassword)) {
         $this->ajaxReturn(array("responce" => "FAILED", "message" => "密码格式错误!"));
     }
     //验证用户名
     if (!preg_match($regxEmail, $shopEmail)) {
         $this->ajaxReturn(array("responce" => "FAILED", "message" => "商户登录邮箱格式错误!"));
     }
     $flag = D("Shop")->shopUserLogin($shopEmail, sha1(md5($shopPassword)));
     //登录验证
     if ($flag) {
         R("Public/session_start_by_user");
         session_start();
         session("shopId", $flag['shop_id']);
         $this->ajaxReturn(array("responce" => "SUCCESS", "message" => "登录成功!正在跳转...", "data" => session_id(), "shopName" => $flag['shop_name']));
     } else {
         $this->ajaxReturn(array("responce" => "FAILED", "message" => "登录失败,邮箱或者密码错误!"));
     }
 }
예제 #18
0
 public function pic()
 {
     if (isset($_FILES['headpic']['name']) && strlen($_FILES['headpic']['name']) > 0) {
         $arr = array('upload' => 'headpic', 'ext' => array('jpg', 'jpeg', 'png', 'gif'), 'size' => 10240, 'path' => './asset/upload/');
         $file = upload($arr);
         if ($file['result']) {
             $user = new UserModel();
             $picName = $file['message'];
             $rst = $user->setPics($picName);
             if ($rst) {
                 R('User', 'ePic');
                 //$newUrl = U('User','ePic');
                 //echo "<script>window.location='http://localhost/YYK/msg/User/ePic.html'</script>";
             } else {
                 //E($this->errors['054']);
                 var_dump($rst);
                 echo "Wrong!~";
             }
         } else {
             //E($file['message']);
             echo "Wrong";
         }
     } else {
         var_dump($_FILES);
     }
 }
예제 #19
0
 public function index()
 {
     /** !控制器必须 **/
     /* 热词调用*/
     $hotsearch = R("Index/getHotsearch");
     $this->assign('hotsearch', $hotsearch);
     /** * 控制器必须!**/
     $tuan = M("tuan");
     $category = $tuan->order("id")->select();
     //团购分类
     $this->assign('category', $category);
     // 赋值数据集
     /* 获取商品*/
     $User = M("tuanid");
     $count = M('tuanid')->count();
     $Page = new \Think\Page($count, 10);
     $Page->setConfig('prev', '上一页');
     $Page->setConfig('next', '下一页');
     $Page->setConfig('first', '第一页');
     $Page->setConfig('last', '尾页');
     $Page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     $show = $Page->show();
     $list = $User->limit($Page->firstRow . ',' . $Page->listRows)->select();
     $this->assign('list', $list);
     // 赋值数据集
     $this->assign('page', $show);
     // 赋值分页输出 $this->display();
     $this->display();
 }
 public function render($data)
 {
     $tpl_section = $data['tpl'];
     $info = $data['info'];
     $tpl_section = $this->handle($tpl_section, '{$[title]}', op_t($info['title']));
     $tpl_section = $this->handle($tpl_section, '{$[cTime]}', friendlyDate($info['create_time']));
     $tpl_section = $this->handle($tpl_section, '{$[cTimeD]}', date('n j', $info['create_time']));
     $tpl_section = $this->handle($tpl_section, '{$[url]}', U('Cat/Index/info', array('info_id' => $info['id'])));
     /*用户标签*/
     $user = query_user(array('nickname', 'avatar32', 'avatar64', 'avatar128', 'avatar256', 'space_url'), $info['uid']);
     $tpl_section = $this->handle($tpl_section, '{$[user_avatar32]}', $user['avatar32']);
     $tpl_section = $this->handle($tpl_section, '{$[user_avatar64]}', $user['avatar64']);
     $tpl_section = $this->handle($tpl_section, '{$[user_avatar128]}', $user['avatar128']);
     $tpl_section = $this->handle($tpl_section, '{$[user_avatar256]}', $user['avatar256']);
     $tpl_section = $this->handle($tpl_section, '{$[user_nickname]}', $user['nickname']);
     $tpl_section = $this->handle($tpl_section, '{$[user_space_url]}', $user['space_url']);
     $tpl_section = $this->handle($tpl_section, '{$[user_uid]}', $user['uid']);
     /*用户标签end*/
     $tpl_section = $this->handle($tpl_section, '{$[fav_btn]}', R('FavBtn/render', array(array('info' => $info)), 'Widget'));
     $entity = D('cat_entity')->find($info['entity_id']);
     if ($entity['can_over']) {
         $tpl_section = $this->handle($tpl_section, '{$[over_time]}', date('Y-m-d', $info['over_time']));
     } else {
         $tpl_section = $this->handle($tpl_section, '{$[over_time]}', '');
     }
     return $tpl_section;
 }
예제 #21
0
 /**
  * @expectedException NimbleException
  */
 public function testInvalidMethodAgainWithPoo()
 {
     $_POST['_method'] = 'Poo';
     $this->Nimble->url = 'test/1';
     R('test/:id')->controller('Class')->action('method')->on('PUT');
     $this->Nimble->dispatch();
 }
예제 #22
0
 /**
 +----------------------------------------------------------
 * 应用程序初始化
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @return void
 +----------------------------------------------------------
 */
 public static function run()
 {
     // 设定错误和异常处理
     set_error_handler(array('App', "appError"));
     set_exception_handler(array('App', "appException"));
     //[RUNTIME]
     // 检查项目是否编译过
     // 在部署模式下会自动在第一次执行的时候编译项目
     if (defined('RUNTIME_MODEL')) {
         // 运行模式无需载入项目编译缓存
     } elseif (is_file(RUNTIME_PATH . '~app.php')) {
         // 直接读取编译后的项目文件
         C(include RUNTIME_PATH . '~app.php');
     } else {
         // 预编译项目
         App::build();
     }
     //[/RUNTIME]
     // 取得模块和操作名称
     define('MODULE_NAME', isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : C('DEFAULT_MODULE'));
     define('ACTION_NAME', isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : C('DEFAULT_ACTION'));
     // 执行操作
     R(MODULE_NAME, ACTION_NAME);
     // 保存日志记录
     if (C('LOG_RECORD')) {
         Log::save();
     }
     return;
 }
예제 #23
0
파일: auth.php 프로젝트: shampeak/ap.so
 public function doLogout()
 {
     sapp('cookies')->clear('userlogin');
     sapp('cookies')->clear('logintime');
     sapp('cookies')->clear('sccheck');
     R('/admin/auth/login/');
 }
예제 #24
0
 function main()
 {
     $events = new Events();
     $person = (new Facebook())->person(S()->id());
     $events->signUp($_GET['event_id'], S()->id(), $person['name'], $person['link']);
     R('/');
 }
예제 #25
0
 public function replaceFieldData($str, $data)
 {
     foreach ($data['data'] as $v) {
         $str = R('FieldRender/render', array(array('str' => $str, 'field' => $v)), 'Widget');
     }
     return $str;
 }
예제 #26
0
 /**
  * 工作流管理列表详情
  *
  * @access public
  */
 public function detail($data)
 {
     $this->setCurrentAction('step', 'index', 'workflow')->checkPermission();
     $url = R('common', $this->module . '.' . $this->class . '.' . $this->function, ['id' => $data['id']]);
     $html = $this->hasPermission ? '<a title="详情" href="' . $url . '"><i class="fa fa-list"></i></a>' : '<i class="fa fa-list" style="color:#ccc"></i>';
     return $html;
 }
예제 #27
0
 /**
 +----------------------------------------------------------
 * 应用程序初始化
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @return void
 +----------------------------------------------------------
 */
 public static function run()
 {
     // 设定错误和异常处理
     set_error_handler(array('App', "appError"));
     set_exception_handler(array('App', "appException"));
     //[RUNTIME]
     // 检查项目是否编译过
     // 在部署模式下会自动在第一次执行的时候编译项目
     if (defined('RUNTIME_MODEL')) {
         // 运行模式无需载入项目编译缓存
     } elseif (is_file(RUNTIME_PATH . '~app.php') && (!is_file(CONFIG_PATH . 'config.php') || filemtime(RUNTIME_PATH . '~app.php') > filemtime(CONFIG_PATH . 'config.php'))) {
         // 直接读取编译后的项目文件
         C(include RUNTIME_PATH . '~app.php');
     } else {
         // 预编译项目
         App::build();
     }
     //[/RUNTIME]
     // 取得模块和操作名称
     define('MODULE_NAME', App::getModule());
     // Module名称
     define('ACTION_NAME', App::getAction());
     // Action操作
     // 记录应用初始化时间
     if (C('SHOW_RUN_TIME')) {
         $GLOBALS['_initTime'] = microtime(TRUE);
     }
     // 执行操作
     R(MODULE_NAME, ACTION_NAME);
     // 保存日志记录
     if (C('LOG_RECORD')) {
         Log::save();
     }
     return;
 }
예제 #28
0
 public function dispath()
 {
     $url = 0 === strpos($_SERVER['REQUEST_URI'], __ROOT__) ? substr($_SERVER['REQUEST_URI'], strlen(__ROOT__)) : $_SERVER['REQUEST_URI'];
     //以前用的PATH_INFO,有缺陷
     $rewrite = trim(urldecode($url), '/');
     $rewrite = str_replace(__APP__ . '/', '', __ACTION__);
     $rewrite = preg_replace('/[\\/]+/', '/', str_replace(array('?', '&', '='), '/', $rewrite));
     $exp = explode('/', $rewrite);
     $exp[0] = strtolower($exp[0]);
     if ($exp[0] == 'index' && count($exp) > 1 && strtolower($exp[1]) != 'index') {
         R(ucfirst($exp[0]) . '/' . strtolower($exp[1]));
         exit;
     }
     $rs = M("Router")->where(array('rewrite' => $exp[0]))->field('url')->find();
     if ($rs) {
         //把news/p/2 转成 article/index/id/224/p/2 附加参数
         for ($i = 1, $n = count($exp); $i < $n; $i++) {
             if ($exp[$i] != '') {
                 $rs['url'] .= '/' . $exp[$i];
             }
         }
         //形如id/2/a/1/b/B/c/C的 参数转化为数组
         $exp = explode('/', $rs['url']);
         $vars = array();
         for ($i = 2, $n = count($exp) - 1; $i < $n; $i++) {
             $vars[$exp[$i]] = $exp[$i + 1];
             $i++;
         }
         R(ucfirst($exp[0]) . '/' . $exp[1], $vars);
     } else {
         $this->redirect("index/index");
     }
 }
 public function index()
 {
     if (IS_POST) {
         $map = array();
         $_list = $this->Model->where($map)->order('sort asc')->getField('id,title,status,sort');
         $op_status = R("Admin/Function/get_config", array("USERGROUP_STATUS_TYPE|status|title"));
         foreach ($op_status as $op_status_key => $op_status_one) {
             $option["status"][$op_status_one["status"]] = $op_status_one["title"];
         }
         foreach ($_list as $list_key => $list_one) {
             foreach ($list_one as $list_one_key => $list_one_field) {
                 if ($option[$list_one_key] != '') {
                     $_list[$list_key][$list_one_key] = $option[$list_one_key][$list_one_field];
                 }
             }
             $operate_menu = '';
             if (Is_Auth('Admin/AuthGroup/edit')) {
                 $operate_menu = $operate_menu . "<a href='#' onclick=\"Submit_Form('AuthGroup_Form','AuthGroup_Data_List','" . U('edit', array('id' => $_list[$list_key]['id'])) . "','','编辑数据','');\">编辑</a>";
             }
             if (Is_Auth('Admin/AuthGroup/del')) {
                 $operate_menu = $operate_menu . "<a href='#' onclick=\"Data_Remove('" . U('del', array('id' => $_list[$list_key]['id'])) . "','AuthGroup_Data_List');\">删除</a>";
             }
             $_list[$list_key]['operate'] = $operate_menu;
         }
         $data = list_to_tree($_list, 'id', 'pid', 'children');
         $this->ajaxReturn($data);
     } else {
         $this->display();
     }
 }
예제 #30
0
 protected function _list($model, $map, $sortBy = '', $asc = false)
 {
     $join = 'LEFT JOIN users u ON A.user_id=u.id';
     //取得满足条件的记录数
     $count = $model->alias('A')->join($join)->where($map)->count('A.id');
     R('Com/getDevelopers');
     if ($count > 0) {
         //创建分页对象
         if (!empty($_REQUEST['numPerPage'])) {
             $listRows = $_REQUEST['numPerPage'];
         } else {
             $listRows = 10;
         }
         $p = new \Extcom\Lib\Page($count, $listRows);
         $p->setConfig('prev', '<span class="pageprev"></span>');
         $p->setConfig('next', '<span class="pagenext"></span>');
         //            $currentPage = $_REQUEST['pageNum'] ? $_REQUEST['pageNum'] : 1;
         $currentPage = $_REQUEST['p'] ? $_REQUEST['p'] : 1;
         $p->firstRow = ($currentPage - 1) * $listRows;
         //分页查询数据
         $voList = $model->alias('A')->field(array('A.id', 'A.name', 'A.status', 'app_key', 'app_id', 'username', "A.user_id", 'A.created'))->join($join)->where($map)->order('A.created desc')->limit($p->firstRow . ',' . $p->listRows)->select();
         $developers = M('Developers');
         foreach ($voList as $k => $vo) {
             $voList[$k]['company_name'] = $developers->where(array('user_id' => $vo['user_id']))->getField('company_name');
         }
         #var_dump($voList);exit;
         //模板赋值显示
         $this->assign('list', $voList);
         $this->assign('page', $p->show());
         return $voList;
     }
     return;
 }