Ejemplo n.º 1
0
 public function main()
 {
     $this->meta[] = array('name' => 'google-signin-client_id', 'content' => Config::$googleClientId . '.apps.googleusercontent.com');
     $cookie = Lib::cookie();
     $identifier = $cookie->get(Lib::hash(Config::$userkey));
     $user = Lib::table('user');
     $isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
     $this->set('user', $user);
     $this->set('isLoggedIn', $isLoggedIn);
     $this->js[] = $isLoggedIn ? 'inbox' : 'login';
     if ($isLoggedIn) {
         array_shift($this->js);
         $id = Req::get('id');
         if (empty($id)) {
             Lib::redirect('index');
         }
         $report = Lib::table('report');
         if (!$report->load($id)) {
             $this->template = 'no-report';
             return;
         }
         $report->init();
         $assignees = Lib::model('user')->getProjectAssignees($report->project_id);
         $projectTable = Lib::table('project');
         $projectTable->load($report->project_id);
         $this->set('report', $report);
         $this->set('assignees', $assignees);
         $this->set('project', $projectTable);
     }
 }
Ejemplo n.º 2
0
 public function execute()
 {
     $api = Lib::api('admin', array('response' => 'return', 'format' => 'php'));
     $type = Req::get('type');
     if (!is_callable(array($api, $type))) {
         return Lib::redirect('error');
     }
     $result = $api->{$type}();
     $options = array('view' => 'admin');
     $ref = Req::post('ref');
     if (!$result['state']) {
         if (!empty($ref)) {
             $options['ref'] = $ref;
         }
     } else {
         $segments = explode('/', base64_decode(urldecode($ref)));
         $base = array_shift($segments);
         $type = array_shift($segments);
         $subtype = array_shift($segments);
         if (!empty($type)) {
             $options['type'] = $type;
         }
         if (!empty($subtype)) {
             $options['subtype'] = $subtype;
         }
     }
     Lib::redirect('admin', $options);
 }
Ejemplo n.º 3
0
 public static function env($checkget = true)
 {
     if ($checkget && Req::hasget('environment')) {
         return Req::get('environment');
     }
     $serverName = $_SERVER['SERVER_NAME'];
     return isset(Config::$baseurl[$serverName]) ? Config::$baseurl[$serverName] : 'production';
 }
Ejemplo n.º 4
0
 public function main()
 {
     $filterProject = Req::get('project');
     if (empty($filterProject)) {
         $this->template = 'empty-project';
         return;
     }
     $projectTable = Lib::table('project');
     if (!$projectTable->load(array('name' => $filterProject))) {
         $this->set('name', $filterProject);
         $this->template = 'new-project';
         return;
     }
     $this->meta[] = array('name' => 'google-signin-client_id', 'content' => Config::$googleClientId . '.apps.googleusercontent.com');
     $cookie = Lib::cookie();
     $identifier = $cookie->get(Lib::hash(Config::$userkey));
     $user = Lib::table('user');
     $isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
     $this->set('user', $user);
     $this->set('filterProject', $filterProject);
     $this->set('filterSettingsProject', $filterProject);
     $this->set('isLoggedIn', $isLoggedIn);
     if (!$isLoggedIn) {
         $this->js[] = 'login';
     }
     if ($isLoggedIn) {
         $this->js[] = 'inbox';
         $this->js[] = 'settings';
         array_shift($this->js);
         $userModel = Lib::model('user');
         $assignees = $userModel->getProjectAssignees($projectTable->id);
         $users = $userModel->getUsers();
         $filterState = $cookie->get('filter-state', 'pending');
         $filterAssignee = $cookie->get('filter-assignee', empty($assignees[$user->id]) ? 'all' : $user->id);
         $filterSort = $cookie->get('filter-sort', 'asc');
         $reportModel = Lib::model('report');
         $reports = $reportModel->getItems(array('state' => constant('STATE_' . strtoupper($filterState)), 'assignee_id' => $filterAssignee, 'order' => 'date', 'direction' => $filterSort, 'project_id' => $projectTable->id));
         $userSettingsTable = Lib::table('user_settings');
         if (!$userSettingsTable->load(array('user_id' => $user->id, 'project_id' => $projectTable->id))) {
             $userSettingsTable->load(array('user_id' => $user->id, 'project_id' => 0));
         }
         $userSettings = $userSettingsTable->getData();
         if ($userSettings['color'] !== 'cyan' && $userSettings['color'] !== 'custom') {
             $this->css[] = 'theme-' . str_replace(' ', '', $userSettings['color']);
         }
         $categories = Lib::model('category')->getCategories(['projectid' => $projectTable->id]);
         $this->set('filterState', $filterState);
         $this->set('filterAssignee', $filterAssignee);
         $this->set('filterSort', $filterSort);
         $this->set('reports', $reports);
         $this->set('assignees', $assignees);
         $this->set('userSettings', $userSettings);
         $this->set('users', $users);
         $this->set('projectTable', $projectTable);
         $this->set('categories', $categories);
     }
 }
Ejemplo n.º 5
0
 public static function env()
 {
     if (Req::hasget('development')) {
         Lib::cookie()->set('development', Req::get('development'));
     }
     if (Lib::cookie()->get('development')) {
         return 'development';
     }
     return self::$env;
 }
Ejemplo n.º 6
0
 public function form()
 {
     $ref = Req::get('ref');
     $this->set('ref', $ref);
     $model = Lib::model('admin');
     if (!$model->hasAdmins()) {
         $this->template = 'formcreate';
         return;
     }
     $this->template = 'form';
 }
Ejemplo n.º 7
0
 public function main()
 {
     $slug = Req::get('slug');
     $this->set('slug', $slug);
     if (file_exists(Config::getBasePath() . '/assets/css/' . $slug . '.' . (Config::env() === 'development' ? 'less' : 'css'))) {
         $this->css[] = $slug;
     }
     if (file_exists(Config::getBasePath() . '/assets/js/' . $slug . '.' . (Config::env() === 'development' ? 'coffee' : 'js'))) {
         $this->js[] = $slug;
     }
     $page = $this->getPages()->{$slug};
     $this->set('slug', $slug);
     $this->set('page', $page);
     $this->set('pagetitle', $page->title);
     $this->set('pagedate', $page->date);
     $content = $this->loadTemplate($slug . '/content');
     $this->set('content', $content);
 }
Ejemplo n.º 8
0
 public function init()
 {
     $menu = new Menu();
     $this->assign('mainMenu', $menu->getMenu());
     $menu_index = $menu->current_menu();
     $this->assign('menu_index', $menu_index);
     $this->assign('subMenu', $menu->getSubMenu($menu_index['menu']));
     $this->assign('menu', $menu);
     $nav_act = Req::get('act') == null ? $this->defaultAction : Req::get('act');
     $nav_act = preg_replace("/(_edit)\$/", "_list", $nav_act);
     $this->assign('nav_link', '/' . Req::get('con') . '/' . $nav_act);
     $this->assign('node_index', $menu->currentNode());
     $this->safebox = Safebox::getInstance();
     $this->assign('manager', $this->safebox->get('manager'));
     $currentNode = $menu->currentNode();
     if (isset($currentNode['name'])) {
         $this->assign('admin_title', $currentNode['name']);
     }
 }
Ejemplo n.º 9
0
 public function css()
 {
     header('Content-Type: text/css');
     $script = Req::get('script');
     switch ($script) {
         case 'theme-custom':
             $identifier = Lib::cookie(Lib::hash(Config::$userkey));
             $user = Lib::table('user');
             $isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
             if (!$isLoggedIn) {
                 echo '';
                 return;
             }
             $project = Req::get('name');
             $projectTable = Lib::table('project');
             if ($project !== 'all' && $project !== '-1' && !$projectTable->load(array('name' => $project))) {
                 echo '';
                 return;
             }
             $userSettingsTable = Lib::table('user_settings');
             if ($project === '-1') {
                 $projectTable->id = '-1';
             }
             if (!$userSettingsTable->load(array('user_id' => $user->id, 'project_id' => $project === 'all' ? 0 : $projectTable->id)) && $project !== 'all') {
                 $userSettingsTable->load(array('user_id' => $user->id, 'project_id' => 0));
             }
             $userSettings = $userSettingsTable->getData();
             $basecss = $this->output('css/theme-custom');
             $keys = array(50, 100, 200, 300, 400, 500, 600, 700, 800, 900);
             $search = array();
             $replace = array();
             foreach ($keys as $key) {
                 $search[] = '"@@color' . $key . '"';
                 $replace[] = '#' . $userSettings['color' . $key];
             }
             $css = str_replace($search, $replace, $basecss);
             echo $css;
             break;
     }
 }
Ejemplo n.º 10
0
 public function getLogDetails($dbh, $args)
 {
     $from_ts = isset($args['from_ts']) ? trim($args['from_ts']) : date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 1, date("Y")));
     $to_ts = isset($args['to_ts']) ? trim($args['to_ts']) : date("Y-m-d");
     $today = date("Y-m-d");
     $params[] = date("Y-m-d", strtotime($from_ts));
     $params[] = date("Y-m-d", strtotime($to_ts));
     if ($args['caltype'] == '0') {
         $str_config = " SELECT  u.name as oname,u.username,oncall_to,oncall_from,'P' as octype,'US' as timezone \n\t\t\t\tFROM  backupTapeopencalCalendar as btc \n\t\t\t\tLEFT JOIN opencal.user as u on (btc.user_id=u.user_id)  \n\t\t\t\tWHERE oncall_to BETWEEN ? AND ?";
     } else {
         $str_config = "SELECT \n\t\t\t\t\tu.name as oname,u.username,d.name as timezone,if(oncall_type=1,'P','S') as octype,oncall_to,oncall_from \n\t\t\t       FROM backupAssigneeConfig as bac \n\t\t\t       LEFT JOIN opencal.user as u on (bac.user_id=u.user_id)  \n\t\t\t       LEFT JOIN opencal.dictionary as d on (bac.assign_time=d.dict_id) \n\t\t\t       WHERE oncall_to BETWEEN ? AND ?";
     }
     if (trim($args['search']) != 'any' && trim($args[search]) != '') {
         $str_config .= " AND u.username like ?";
         $params[] = "%" . trim($args['search']) . "%";
     }
     if (isset($args[timezone]) && $args[timezone] != -1) {
         $str_config .= " AND bac.assign_time=?";
         $params[] = $args[timezone];
     }
     $options = array('page' => array('per_page' => Req::has('per_page') ? Req::get('per_page') : 50, 'current_page' => Req::get('page'), 'order_by' => Req::get('order_by') ? Req::get('order_by') : 'oncall_from'));
     $options['page']['query'] = $str_config;
     $options['page']['db'] = $dbh;
     $options['page']['params'] = $params;
     $recs = Pager::paginate($options['page']);
     return $recs;
 }
Ejemplo n.º 11
0
 public function order_status()
 {
     if ($this->checkOnline()) {
         $order_id = Filter::int(Req::get("order_id"));
         if ($order_id) {
             $order = $this->model->table("order as od")->join("left join payment as pa on od.payment= pa.id")->fields("od.id,od.order_no,od.payment,od.pay_status,od.order_amount,pa.pay_name as payname,od.type,od.status")->where("od.id={$order_id} and od.status<4 and od.user_id = " . $this->user['id'])->find();
             if ($order) {
                 if ($order['pay_status'] == 0) {
                     $payment_plugin = Common::getPaymentInfo($order['payment']);
                     if ($payment_plugin != null && $payment_plugin['class_name'] == 'received' && $order['status'] == 3) {
                         $this->redirect("/simple/order_completed/order_id/{$order_id}");
                     }
                     $this->assign("order", $order);
                     $this->redirect();
                 } else {
                     if ($order['pay_status'] == 1) {
                         $this->redirect("/simple/order_completed/order_id/{$order_id}");
                     }
                 }
             } else {
                 Tiny::Msg($this, 404);
             }
         } else {
             Tiny::Msg($this, 404);
         }
     } else {
         $this->redirect("login");
     }
 }
Ejemplo n.º 12
0
 public static function url($key, $options = array(), $external = false)
 {
     $values = array();
     $link = $external ? Config::getHTMLBase() : '';
     if (Req::hasget('environment')) {
         $options['environment'] = Req::get('environment');
     }
     if (Config::$sef) {
         Lib::load('router');
         $segments = array();
         foreach (Router::getRouters() as $router) {
             if (is_string($router->allowedBuild) && $key !== $router->allowedBuild) {
                 continue;
             }
             if (is_array($router->allowedBuild) && !in_array($key, $router->allowedBuild)) {
                 continue;
             }
             $router->encode($key, $options, $segments);
         }
         if (!empty($segments)) {
             $link .= implode('/', $segments);
         }
     } else {
         $link .= 'index.php';
     }
     if (!empty($options)) {
         $values = array();
         foreach ($options as $k => $v) {
             $values[] = urlencode($k) . '=' . urlencode($v);
         }
         $queries = implode('&', $values);
         if (!empty($queries)) {
             $queries = '?' . $queries;
         }
         $link .= $queries;
     }
     return $link;
 }
Ejemplo n.º 13
0
 /**
  *路径格式化处理
  */
 static function urlFormat($path)
 {
     if ($path == '') {
         return self::baseDir();
     }
     if (preg_match('@[/\\@#*!]?(http://.+)$@i', $path, $matches)) {
         return $matches[1];
     }
     switch (substr($path, 0, 1)) {
         case '/':
             $path = self::createUrl($path);
             return rtrim(self::baseUri(), '/') . $path;
             //解释成绝对路由地址
         case '@':
             return self::baseDir() . substr($path, 1);
             //解析成绝对路径
         //解析成绝对路径
         case '#':
             if (Tiny::app()->getTheme() !== null) {
                 return Tiny::app()->getTheme()->getBaseUrl() . '/' . substr($path, 1);
             } else {
                 return self::baseDir() . substr($path, 1);
             }
         case '*':
             if (Tiny::app()->getTheme() !== null && Tiny::app()->getSkin() !== null) {
                 $theme = Tiny::app()->getTheme();
                 return $theme->getBaseUrl() . '/skins/' . Tiny::app()->getSkin() . '/' . substr($path, 1);
             } else {
                 if (Tiny::app()->getSkin() !== null) {
                     return self::baseDir() . 'skins/' . Tiny::app()->getSkin() . '/' . substr($path, 1);
                 } else {
                     return self::urlFormat('#' . substr($path, 1));
                 }
             }
         case '!':
             return Tiny::app()->getRuntimeUrl() . '/' . substr($path, 1);
         default:
             $q = Req::get();
             $url = '/' . $q['con'] . '/' . $q['act'];
             unset($q['con'], $q['act']);
             $query = explode('/', trim($path, '/'));
             $new_q = array();
             $len = count($query);
             for ($i = 0; $i < $len; $i++) {
                 if ($i % 2 == 1) {
                     $new_q[$query[$i - 1]] = $query[$i];
                 }
             }
             $q = array_merge($q, $new_q);
             foreach ($q as $k => $v) {
                 if (is_string($k)) {
                     $url .= '/' . $k . '/' . $v;
                 }
             }
             $path = self::createUrl($url);
             return rtrim(self::baseUri(), '/') . $path;
             //解释成绝对路由地址
     }
 }
Ejemplo n.º 14
0
 /**
  * 重新定位
  * 
  * @access public
  * @param string $operator 操作path
  * @param bool $jump 真假跳转方式
  * @param array $args 需要传送的数据
  * @return void
  */
 public function redirect($operator = '', $jump = true, $args = array())
 {
     //初始化 $con $act
     $old_args_num = count($args);
     $con = $this->getId();
     $act = Req::get('act') == null ? $this->defaultAction : Req::get('act');
     $controllerId = $con;
     if (stripos($operator, "http://") === false) {
         if ($operator != '') {
             $operator = trim($operator, '/');
             $operator = explode('/', $operator);
             $args_num = count($operator);
             if ($args_num >= 2) {
                 $con = $operator[0];
                 //$controllerName = ucfirst($operator[0]).'Controller';
                 //if(class_exists($controllerName))$controller = new $controllerName($operator[1],$this->module);
                 //else if($con != $this->getId()) $controller = new Controller($operator[1],$this->module);
                 if ($args_num > 2) {
                     for ($i = 2; $i < $args_num; $i = $i + 2) {
                         $args[$operator[$i]] = isset($operator[$i + 1]) ? $operator[$i + 1] : '';
                     }
                 }
                 $operator = $operator[1];
             } else {
                 $operator = $operator[0];
             }
         } else {
             $operator = $act;
         }
     }
     //如果请求的action 和新的跳转是同一action则进入到对应的视图Action
     if ($act == $operator && $controllerId == $con) {
         $this->action = new ViewAction($this, $act);
         $this->action->setData($args);
         $this->action->run();
     } else {
         if ($jump == false) {
             if ($controllerId == $con) {
                 $_GET['act'] = $operator;
                 $this->setDatas($args);
                 $this->run();
             } else {
                 $_GET['act'] = $operator;
                 $_GET['con'] = $con;
                 $controller = $this->module->createController();
                 $controller->setDatas($args);
                 $this->module->setController($controller);
                 $this->module->getController()->run();
             }
         } else {
             if ($old_args_num != 0 && is_array($args) && !empty($args)) {
                 $args['tiny_token_redirect'] = Tiny::app()->getToken('redirect');
                 //var_dump($args);exit();
                 header("Content-type: text/html; charset=" . $this->encoding);
                 $str = '<!doctype html><html lang="zh"><head></head><body>';
                 if (stripos($operator, "http://") !== false) {
                     $str .= '<form id="hiddenForm" name="hiddenForm" action="' . $operator . '" method="post">';
                 } else {
                     $str .= '<form id="hiddenForm" name="hiddenForm" action="' . Url::urlFormat('/' . $con . '/' . $operator) . '" method="post">';
                 }
                 foreach ($args as $key => $value) {
                     if (is_array($value)) {
                         foreach ($value as $k => $v) {
                             $str .= '<input type="hidden" name="' . $key . '[' . $k . ']" value="' . $v . '" />';
                         }
                     } else {
                         $str .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />';
                     }
                 }
                 $str .= '</form><script type="text/javascript">document.forms["hiddenForm"].submit();</script></body></html>';
                 echo $str;
                 exit;
             } else {
                 $urlargs = '';
                 if (is_array($args) && !empty($args)) {
                     $urlargs = '?' . http_build_query($args);
                 }
                 header('Location:' . Url::urlFormat('/' . $con . '/' . $operator . $urlargs));
             }
         }
     }
 }
Ejemplo n.º 15
0
 /**
  * override what the username() function returns
  * GET params:
  *   - user: what user to act as
  *   - ttl: for how long (defaults to 60 sec)
  */
 public final function override()
 {
     if (defined('OPS_ENV') && strncasecmp(OPS_ENV, 'prod', 4) === 0) {
         header("HTTP/1.1 401 Unauthorized");
         echo "Can't do that in production.";
         exit;
     }
     $user = Req::get('user');
     if (false === array_search(username_strict(), $this->authorizedUsers(), true)) {
         header("HTTP/1.1 401 Unauthorized");
         echo "You are not authorized to perform this action";
         exit;
     }
     $ttl = Req::get('ttl') ? Req::get('ttl') : 60;
     Log::debug('User ' . username_strict() . ' will act as ' . $user . ' for ' . $ttl . ' seconds');
     apc_store(username_override_hash(username_strict()), $user, $ttl);
     echo "Now {$user}";
     exit;
 }
Ejemplo n.º 16
0
 function configTime()
 {
     $this->title = 'Calendar Time';
     $this->addYUI = 1;
     $this->menu = 'backup';
     $this->view = 'calendar/addedittime';
     $this->addAutocomplete = 1;
     $dbh = Connection::cal_ro();
     $obj_assignee = new calendarConfig();
     $admingrp = $obj_assignee->getAdmingroup($dbh, $team);
     $this->is_allowed = $this->checkUserPermission($admingrp);
     $time = $obj_assignee->getTimezoneDetail($dbh, Req::get('aid'));
     $this->pagetitle = 'Session Timing';
     $this->hideheader = 1;
     $this->time = $time;
     $this->action = 'updateTime';
 }
Ejemplo n.º 17
0
 public function __construct()
 {
     $nodes = array('/admin/index' => array('name' => '管理首页', 'parent' => 'config'), '/admin/theme_list' => array('name' => '主题设置', 'parent' => 'config'), '/admin/config_globals' => array('name' => '站点设置', 'parent' => 'config'), '/admin/config_other' => array('name' => '其它配置', 'parent' => 'config'), '/admin/config_email' => array('name' => '邮箱配置', 'parent' => 'config'), '/admin/msg_template_list' => array('name' => '信息模板', 'parent' => 'config'), '/admin/msg_template_edit' => array('name' => '信息模板编辑', 'parent' => 'config'), '/admin/oauth_list' => array('name' => '开放登录', 'parent' => 'config'), '/admin/oauth_edit' => array('name' => '开放登录编辑', 'parent' => 'config'), '/admin/payment_list' => array('name' => '支付方式', 'parent' => 'delivery'), '/admin/payment_edit' => array('name' => '编辑支付方式', 'parent' => 'delivery'), '/admin/zoning_list' => array('name' => '区域划分', 'parent' => 'delivery'), '/admin/ext_params_list' => array('name' => '海关对接', 'parent' => 'delivery'), '/admin/area_list' => array('name' => '地区管理', 'parent' => 'delivery'), '/admin/fare_list' => array('name' => '运费模板', 'parent' => 'delivery'), '/admin/fare_edit' => array('name' => '运费模板编辑', 'parent' => 'delivery'), '/admin/express_company_list' => array('name' => '快递公司', 'parent' => 'delivery'), '/admin/express_company_edit' => array('name' => '快递公司编辑', 'parent' => 'delivery'), '/admin/manager_list' => array('name' => '管理员', 'parent' => 'safe'), '/admin/manager_edit' => array('name' => '编辑管理员', 'parent' => 'safe'), '/admin/roles_list' => array('name' => '角色管理', 'parent' => 'safe'), '/admin/roles_edit' => array('name' => '角色编辑', 'parent' => 'safe'), '/admin/resources_list' => array('name' => '权限列表', 'parent' => 'safe'), '/admin/resources_edit' => array('name' => '编辑权限资源', 'parent' => 'safe'), '/admin/log_operation_list' => array('name' => '操作日志', 'parent' => 'safe'), '/admin/update' => array('name' => '版本升级', 'parent' => 'safe'), '/admin/clear' => array('name' => '清除缓存', 'parent' => 'safe'), '/content/article_list' => array('name' => '全部文章', 'parent' => 'article'), '/content/article_edit' => array('name' => '文章编辑', 'parent' => 'article'), '/content/category_list' => array('name' => '分类管理', 'parent' => 'article'), '/content/category_edit' => array('name' => '编辑分类', 'parent' => 'article'), '/content/help_list' => array('name' => '全部帮助', 'parent' => 'help'), '/content/help_edit' => array('name' => '帮助编辑', 'parent' => 'help'), '/content/help_category_list' => array('name' => '帮助分类管理', 'parent' => 'help'), '/content/help_category_edit' => array('name' => '编辑帮助分类', 'parent' => 'help'), '/content/ad_list' => array('name' => '广告管理', 'parent' => 'banner'), '/content/wel_list' => array('name' => '欢迎页面', 'parent' => 'banner'), '/content/ad_edit' => array('name' => '编辑广告', 'parent' => 'banner'), '/content/wel_edit' => array('name' => '编辑欢迎页面', 'parent' => 'banner'), '/content/tags_list' => array('name' => '标签管理', 'parent' => 'banner'), '/content/nav_list' => array('name' => '导航管理', 'parent' => 'banner'), '/content/nav_edit' => array('name' => '导航管理', 'parent' => 'banner'), '/admin/tables_list' => array('name' => '数据库备份', 'parent' => 'database'), '/admin/back_list' => array('name' => '数据库还原', 'parent' => 'database'), '/goods/goods_category_list' => array('name' => '分类管理', 'parent' => 'goods_config'), '/goods/goods_category_edit' => array('name' => '编辑分类', 'parent' => 'goods_config'), '/goods/goods_type_list' => array('name' => '类型管理', 'parent' => 'goods_config'), '/goods/goods_type_edit' => array('name' => '类型编辑', 'parent' => 'goods_config'), '/goods/tax_type_list' => array('name' => '税种管理', 'parent' => 'goods_config'), '/goods/tax_type_edit' => array('name' => '税种编辑', 'parent' => 'goods_config'), '/goods/theme_list' => array('name' => '主题管理', 'parent' => 'goods_config'), '/goods/theme_edit' => array('name' => '主题编辑', 'parent' => 'goods_config'), '/goods/tax_country_list' => array('name' => '国别管理', 'parent' => 'goods_config'), '/goods/tax_country_edit' => array('name' => '国别编辑', 'parent' => 'goods_config'), '/goods/goods_spec_list' => array('name' => '规格管理', 'parent' => 'goods_config'), '/goods/goods_spec_edit' => array('name' => '规格编辑', 'parent' => 'goods_config'), '/goods/brand_list' => array('name' => '品牌管理', 'parent' => 'goods_config'), '/goods/brand_edit' => array('name' => '品牌编辑', 'parent' => 'goods_config'), '/goods/series_list' => array('name' => '系列管理', 'parent' => 'goods_config'), '/goods/series_edit' => array('name' => '系列编辑', 'parent' => 'goods_config'), '/goods/goods_list' => array('name' => '商品管理', 'parent' => 'goods'), '/goods/goods_edit' => array('name' => '商品编辑', 'parent' => 'goods'), '/customer/customer_list' => array('name' => '会员管理', 'parent' => 'customer'), '/customer/customer_edit' => array('name' => '添加会员', 'parent' => 'customer'), '/customer/grade_list' => array('name' => '会员等级管理', 'parent' => 'customer'), '/customer/grade_edit' => array('name' => '添加会员等级', 'parent' => 'customer'), '/customer/withdraw_list' => array('name' => '提现申请', 'parent' => 'balance'), '/customer/balance_list' => array('name' => '资金日志', 'parent' => 'balance'), '/customer/review_list' => array('name' => '商品评价', 'parent' => 'ask_reviews'), '/customer/ask_list' => array('name' => '商品咨询', 'parent' => 'ask_reviews'), '/customer/ask_edit' => array('name' => '咨询回复', 'parent' => 'ask_reviews'), '/customer/message_list' => array('name' => '信息管理', 'parent' => 'ask_reviews'), '/customer/message_edit' => array('name' => '信息发送', 'parent' => 'ask_reviews'), '/customer/notify_list' => array('name' => '到货通知', 'parent' => 'ask_reviews'), '/customer/company_list' => array('name' => '商户管理', 'parent' => 'company'), '/customer/company_edit' => array('name' => '添加商户', 'parent' => 'company'), '/order/order_list' => array('name' => '商品订单', 'parent' => 'order'), '/order/email_message_list' => array('name' => '订单通知', 'parent' => 'order'), '/order/result_list' => array('name' => '回执信息', 'parent' => 'order'), '/order/examine_list' => array('name' => '审批结果', 'parent' => 'order'), '/order/email_message_edit' => array('name' => '订单通知编辑', 'parent' => 'order'), '/order/express_template_list' => array('name' => '快递单模板', 'parent' => 'express'), '/order/express_template_edit' => array('name' => '快递单模板编辑', 'parent' => 'express'), '/order/ship_list' => array('name' => '发货点管理', 'parent' => 'express'), '/order/ship_edit' => array('name' => '发货点编辑', 'parent' => 'express'), '/order/doc_receiving_list' => array('name' => '收款单', 'parent' => 'receipt'), '/order/doc_invoice_list' => array('name' => '发货单', 'parent' => 'receipt'), '/order/doc_refund_list' => array('name' => '退款单', 'parent' => 'receipt'), '/count/index' => array('name' => '订单统计', 'parent' => 'count'), '/count/hot' => array('name' => '热销统计', 'parent' => 'count'), '/count/area_buy' => array('name' => '地区统计', 'parent' => 'count'), '/count/user_reg' => array('name' => '会员分布统计', 'parent' => 'customer_count'), '/marketing/voucher_template_list' => array('name' => '代金券模板', 'parent' => 'voucher'), '/marketing/voucher_template_edit' => array('name' => '代金券模板编辑', 'parent' => 'voucher'), '/marketing/voucher_list' => array('name' => '代金券管理', 'parent' => 'voucher'), '/marketing/voucher_edit' => array('name' => '代金券编辑', 'parent' => 'voucher'), '/marketing/prom_goods_list' => array('name' => '商品促销', 'parent' => 'promotions'), '/marketing/prom_goods_edit' => array('name' => '编辑商品促销', 'parent' => 'promotions'), '/marketing/prom_order_list' => array('name' => '订单促销', 'parent' => 'promotions'), '/marketing/prom_order_edit' => array('name' => '编辑订单促销', 'parent' => 'promotions'), '/marketing/prom_series_list' => array('name' => '系列促销', 'parent' => 'promotions'), '/marketing/prom_series_edit' => array('name' => '编辑系列促销', 'parent' => 'promotions'), '/marketing/bundling_list' => array('name' => '捆绑促销', 'parent' => 'promotions'), '/marketing/bundling_edit' => array('name' => '编辑捆绑促销', 'parent' => 'promotions'), '/marketing/groupbuy_list' => array('name' => '团购', 'parent' => 'promotions'), '/marketing/groupbuy_edit' => array('name' => '团购', 'parent' => 'promotions'), '/marketing/flash_sale_list' => array('name' => '限时抢购', 'parent' => 'promotions'), '/marketing/flash_sale_edit' => array('name' => '编辑限时抢购', 'parent' => 'promotions'));
     //分组菜单
     $subMenu = array('config' => array('name' => '参数设定', 'parent' => 'system'), 'delivery' => array('name' => '支付与配送', 'parent' => 'system'), 'safe' => array('name' => '安全管理', 'parent' => 'system'), 'database' => array('name' => '数据库管理', 'parent' => 'system'), 'article' => array('name' => '文章管理', 'parent' => 'content'), 'help' => array('name' => '帮助中心', 'parent' => 'content'), 'banner' => array('name' => '内容管理', 'parent' => 'content'), 'goods' => array('name' => '产品管理', 'parent' => 'goods'), 'goods_config' => array('name' => '商品配置', 'parent' => 'goods'), 'company' => array('name' => '商户管理', 'parent' => 'customer'), 'customer' => array('name' => '会员管理', 'parent' => 'customer'), 'balance' => array('name' => '会员资金', 'parent' => 'customer'), 'ask_reviews' => array('name' => '咨询与评价', 'parent' => 'customer'), 'order' => array('name' => '订单管理', 'parent' => 'order'), 'receipt' => array('name' => '单据管理', 'parent' => 'order'), 'express' => array('name' => '快递单配置', 'parent' => 'order'), 'count' => array('name' => '销售统计', 'parent' => 'count'), 'customer_count' => array('name' => '客户统计', 'parent' => 'count'), 'promotions' => array('name' => '促销活动', 'parent' => 'marketing'), 'voucher' => array('name' => '代金券管理', 'parent' => 'marketing'));
     //主菜单
     $menu = array('goods' => array('link' => '/goods/goods_list', 'name' => '商品中心'), 'order' => array('link' => '/order/order_list', 'name' => '订单中心'), 'customer' => array('link' => '/customer/company_list', 'name' => '客户中心'), 'marketing' => array('link' => '/marketing/prom_goods_list', 'name' => '营销推广'), 'count' => array('link' => '/count/index', 'name' => '统计报表'), 'content' => array('link' => '/content/article_list', 'name' => '内容管理'), 'system' => array('link' => '/admin/index', 'name' => '系统设置'));
     $safebox = Safebox::getInstance();
     $manager = $safebox->get('manager');
     if (isset($manager['roles']) && $manager['roles'] != 'administrator') {
         $roles = new Roles($manager['roles']);
         $result = $roles->getRoles();
         if (isset($result['rights'])) {
             $rights = $result['rights'];
         } else {
             $rights = '';
         }
         if (is_array($nodes)) {
             $subMenuKey = array();
             foreach ($nodes as $key => $value) {
                 $_key = trim(strtr($key, '/', '@'), '@');
                 if (stripos($rights, $_key) === false) {
                     unset($nodes[$key]);
                 } else {
                     if (!isset($subMenuKey[$value['parent']])) {
                         $subMenuKey[$value['parent']] = $key;
                     } else {
                         if (stristr($key, '_list')) {
                             $subMenuKey[$value['parent']] = $key;
                         }
                     }
                 }
             }
             $menuKey = array();
             foreach ($subMenu as $key => $value) {
                 if (isset($subMenuKey[$key])) {
                     $menuKey[$value['parent']] = $key;
                 } else {
                     unset($subMenu[$key]);
                 }
             }
             foreach ($menu as $key => $value) {
                 if (!isset($menuKey[$key])) {
                     unset($menu[$key]);
                 } else {
                     $menu[$key]['link'] = $subMenuKey[$menuKey[$key]];
                 }
             }
         }
     }
     //var_dump($subMenuKey,$menuKey,$menu);exit;
     if (is_array($nodes)) {
         $this->nodes = $nodes;
     } else {
         $this->nodes = array();
     }
     if (is_array($subMenu)) {
         $this->subMenu = $subMenu;
     } else {
         $this->subMenu = array();
     }
     if (is_array($menu)) {
         $this->menu = $menu;
     } else {
         $this->menu = array();
     }
     foreach ($this->nodes as $key => $nodes) {
         $this->_subMenu[$nodes['parent']][] = array('link' => $key, 'name' => $nodes['name'], 'display' => isset($nodes['name']) ? $nodes['name'] : true);
     }
     foreach ($this->subMenu as $key => $subMenu) {
         $this->_menu[$subMenu['parent']][] = array('link' => $key, 'name' => $subMenu['name']);
     }
     $this->link_key = '/' . (Req::get('con') == null ? strtolower(Tiny::app()->defaultController) : Req::get('con')) . '/' . (Req::get('act') == null ? Tiny::app()->getController()->defaultAction : Req::get('act'));
 }
Ejemplo n.º 18
0
 function async_callback()
 {
     //从URL中获取支付方式
     $payment_id = Filter::int(Req::get('payment_id'));
     $payment = new Payment($payment_id);
     $paymentPlugin = $payment->getPaymentPlugin();
     if (!is_object($paymentPlugin)) {
         echo "fail";
     }
     //初始化参数
     $money = '';
     $message = '支付失败';
     $orderNo = '';
     //执行接口回调函数
     $callbackData = Req::args();
     //array_merge($_POST,$_GET);
     unset($callbackData['con']);
     unset($callbackData['act']);
     unset($callbackData['payment_id']);
     $return = $paymentPlugin->callback($callbackData, $payment_id, $money, $message, $orderNo);
     //支付成功
     if ($return == 1) {
         //充值方式
         if (stripos($orderNo, 'recharge_') !== false) {
             $tradenoArray = explode('_', $orderNo);
             $recharge_no = isset($tradenoArray[1]) ? $tradenoArray[1] : 0;
             if (Order::recharge($recharge_no, $payment_id, $callbackData)) {
                 $paymentPlugin->asyncStop();
                 exit;
             }
         } else {
             $order_id = Order::updateStatus($orderNo, $payment_id, $callbackData);
             if ($order_id) {
                 $paymentPlugin->asyncStop();
                 exit;
             }
         }
     }
 }