Пример #1
0
 protected function __construct(WAPConfig $config)
 {
     $this->wapConfig = $config;
     $this->articleTagDB = WAPTagDB::getArticleTagDB($config);
     $this->userTagDB = WAPTagDB::getUserTagDB($config);
     $this->dbType = $config->getDBType();
 }
Пример #2
0
 function __construct(WAPConfig $config)
 {
     parent::__construct($config);
 }
Пример #3
0
 function hasPermissions($action = array(''))
 {
     $hasPermissions = false;
     $adminGroup = WAPDB::getInstance($this->dbType)->getWAPConfig()->getWikiHowAdminGroupName();
     $userGroup = WAPDB::getInstance($this->dbType)->getWAPConfig()->getWikiHowGroupName();
     if ($this->inGroup($userGroup)) {
         switch ($action[0]) {
             case 'tag':
                 if ($this->hasTag(WAPTagDB::sanitizeRawTag($action[1]))) {
                     $hasPermissions = true;
                 }
                 break;
             case 'user':
                 if ($action[1] == $this->getId()) {
                     $hasPermissions = true;
                 }
                 break;
             case 'reserve_article':
             case 'complete_article':
             case 'article_details':
             case 'release_article':
             case 'assigned_list_more_rows':
             case 'tag_list_more_rows':
                 $hasPermissions = true;
         }
     }
     if ($this->isPowerUser()) {
         switch ($action[0]) {
             case 'rpt_assigned_articles':
             case 'rpt_completed_articles':
                 $hasPermissions = true;
         }
     }
     if ($this->inGroup($adminGroup)) {
         // Admins can only access the system from dev or a wikiknowhow.com domain
         // for perf reasons
         $hasPermissions = stripos(@$_SERVER['HOSTNAME'], 'wikidiy.com') !== false || stripos(@$_SERVER['HOSTNAME'], 'spare1.wikihow.com') !== false;
         $hasPermissions = true;
     }
     return $hasPermissions;
 }