示例#1
0
文件: User.php 项目: clrh/mediawiki
 function isAllowedEx($ns, $pt, $action)
 {
     // Check if the extension
     // "Hierarchical Namespace Permission" is loaded
     // If not, continue normal processing.
     if (!class_exists('hnpClass')) {
         return true;
     }
     // If the extension is loaded, reformat the "action query"
     // so that HNP understands it.
     return hnpClass::userCanInternal($this, $ns, $pt, $action);
 }
function bwKeepYourHandsToYourself()
{
    global $wgUser, $wgGroupPermissions;
    $userName = $wgUser->getName();
    $wgGroupPermissions['user'][hnpClass::buildPermissionKey(NS_USER, $userName, "edit")] = true;
    $wgGroupPermissions['user'][hnpClass::buildPermissionKey(NS_USER, $userName, "create")] = true;
    $wgGroupPermissions['user'][hnpClass::buildPermissionKey(NS_USER, $userName, "delete")] = true;
}
示例#3
0
 /**
  * Make a list of searchable namespaces and their canonical names.
  * @return array
  * @access public
  */
 function searchableNamespaces()
 {
     global $wgContLang;
     # <jld id="7">
     # <file name="SearchEngine.php" />
     # <func name="searchableNamespaces" />
     # Filter searchable document whilst respecting user rights.
     global $wgUser;
     # </jld>
     $arr = array();
     foreach ($wgContLang->getNamespaces() as $ns => $name) {
         # <jld id="8">
         # <file name="SearchEngine.php" />
         # <func name="searchableNamespaces" />
         # Filter searchable document whilst respecting user rights.
         if (!hnpClass::userCanX($ns, "~", "search")) {
             continue;
         }
         # </JLD>
         if ($ns >= NS_MAIN) {
             $arr[$ns] = $name;
         }
     }
     return $arr;
 }