コード例 #1
0
ファイル: videoop.php プロジェクト: h3len/Project
 public function siteList()
 {
     if (!class_exists('publishconfig')) {
         include_once ROOT_PATH . 'lib/class/publishconfig.class.php';
         $publishConfig = new publishconfig();
     }
     //获取所有站点
     $hgSites = $publishConfig->get_sites();
     $this->addItem($hgSites);
     $this->output();
 }
コード例 #2
0
ファイル: org_admin.php プロジェクト: h3len/Project
 public function get_roles_prms()
 {
     $sql = "SELECT prms.*, app.name FROM " . DB_PREFIX . "role_prms prms LEFT JOIN " . DB_PREFIX . 'apps app ON prms.app_uniqueid=app.bundle ';
     $query = $this->db->query($sql);
     $role_prms = array();
     while ($row = $this->db->fetch_array($query)) {
         if (trim($row['func_prms'])) {
             $row['func_prms'] = array_flip(explode(',', $row['func_prms']));
             foreach ($row['func_prms'] as $action => $null) {
                 if (!$this->settings['auth_op'][$action]) {
                     $row['func_prms'][$action] = $action;
                 } else {
                     $row['func_prms'][$action] = $this->settings['auth_op'][$action];
                 }
             }
             //$this->settings['auth_op'];
         }
         $role_prms[$row['admin_role_id']]['app_prms'][$row['app_uniqueid']] = $row;
     }
     $sql = 'SELECT id,extend_prms,site_prms,publish_prms FROM ' . DB_PREFIX . 'admin_role ';
     $query = $this->db->query($sql);
     $column_ids = $site_ids = '';
     while ($row = $this->db->fetch_array($query)) {
         if ($row['publish_prms']) {
             $column_ids .= $row['publish_prms'] . ',';
         }
         if ($row['site_prms']) {
             $site_ids .= $row['site_prms'] . ',';
         }
         $row['publish_prms'] = $row['publish_prms'] ? explode(',', $row['publish_prms']) : array();
         $row['site_prms'] = $row['site_prms'] ? explode(',', $row['site_prms']) : array();
         $row['extend_prms'] = unserialize($row['extend_prms']);
         $role[$row['id']] = $row;
     }
     $column_ids = trim($column_ids, ',');
     $site_ids = trim($site_ids, ',');
     if ($column_ids) {
         require_once ROOT_PATH . 'lib/class/publishconfig.class.php';
         $publishconfig = new publishconfig();
         $publish_columns = $publishconfig->get_columnname_by_ids('*', $column_ids);
     }
     if (!class_exists('publishconfig')) {
         require_once ROOT_PATH . 'lib/class/publishconfig.class.php';
         $publishconfig = new publishconfig();
     }
     $publish_sites = $publishconfig->get_sites();
     foreach ($role_prms as $role_id => $v) {
         $v['publish_prms'] = array();
         if ($role[$role_id]['publish_prms']) {
             $v['publish_prms'] = array_intersect_key($publish_columns, array_flip($role[$role_id]['publish_prms']));
         }
         $v['site_prms'] = array();
         if ($role[$role_id]['site_prms']) {
             $v['site_prms'] = array_intersect_key($publish_sites, array_flip($role[$role_id]['site_prms']));
         }
         $v['extend_prms'] = array();
         if ($role[$role_id]['extend_prms']) {
             $v['default_setting'] = $role[$role_id]['extend_prms'];
         }
         $this->addItem_withkey($role_id, $v);
     }
     $this->output();
 }