コード例 #1
0
 /**
  * Similar to attemptNonReadableCreate, but for uploads
  */
 public static function attemptNonReadableUpload($special, &$warnings)
 {
     global $haclgOpenWikiAccess, $wgUser, $wgOut, $haclgSuperGroups;
     $g = $wgUser->getGroups();
     if (!$g || !array_intersect($g, $haclgSuperGroups)) {
         $file = $special->mUpload->getLocalFile();
         if (!$file->exists()) {
             // Only check for new files
             $r = IACLDefinition::userCan($wgUser->getId(), IACL::PE_NAMESPACE, NS_FILE, IACL::ACTION_READ);
             if ($r == 0 || $r == -1 && !$haclgOpenWikiAccess) {
                 $cats = self::checkForReadableCategories($special->mComment, $file->getTitle());
                 if (!$cats) {
                     $special->uploadFormTextAfterSummary .= self::getReadableCategoriesSelectBox(true);
                     $warnings['hacl_nonreadable_upload_warning'] = array();
                 }
             }
         }
     }
     return true;
 }
コード例 #2
0
 protected static function checkProtectPageRight($pageID, $userID)
 {
     $etc = haclfDisableTitlePatch();
     $title = Title::newFromId($pageID);
     haclfRestoreTitlePatch($etc);
     return IACLDefinition::userCan($userID, IACL::PE_NAMESPACE, $title->getNamespace(), IACL::ACTION_PROTECT_PAGES) > 0 || IACLDefinition::userCan($userID, IACL::PE_CATEGORY, IACLStorage::get('Util')->getParentCategoryIDs($pageID), IACL::ACTION_PROTECT_PAGES) > 0;
 }