/** Function: efIACUserLockingThemselvesOut( &$text ) * Verify that a user isn't making a change that locks themselves out * $text --> Text that has been entered and is about to be saved * Returns: True if this save should be prevented */ function efIACUserLockingThemselvesOut(&$text) { global $wgUser; global $egPreventSaveDenyingAccess; // If the option to prevent this is off, let it through if (!$egPreventSaveDenyingAccess || $egPreventSaveDenyingAccess == 'none') { return false; } // Get the access control groups for the new content $accessGroups = efIACGetAccessList($text); // Determine if the user will be able to have access in the new content // egPreventSaveDenyingAccess will be 'read' or 'edit' depending on // which right the user must maintain $userCanAccess = efIACUserCanAccess($wgUser, $accessGroups, $egPreventSaveDenyingAccess); if (!$userCanAccess) { efIACDebugLog("(efIACUserLockingThemselvesOut) self-lockout save "); } unset($accessGroups); return !$userCanAccess; }
/** Function: efIACDebug_r( $var ); * Log an object's structure to the extension log file * $var --> Object to log * Returns: void */ function efIACDebug_r($var) { efIACDebugLog(print_r($var, true)); }
/** Function: efIACAccessControlShowSearchHitTitle( &$title, &$text, $result, $terms, $page ) * Hook: ShowSearchHitTitle * Hide search results if the page is unauthorized, using a blunt method of invalidating * the result and blanking out the text before it's rendered. * &$title --> Title object for article being linked to (will be removed) * &$text --> Text to display for the link (will become blank) * $result --> Search result * $terms --> Terms searched for * $page --> Search results page * Returns: Whether this search result should be shown */ function efIACAccessControlShowSearchHitTitle(&$title, &$text, $result, $terms, $page) { $canRead = $title->userCan('read'); if (!$canRead) { efIACDebugLog("(efIACAccessControlShowSearchHitTitle) hiding search result"); $title = null; $text = ""; } return $canRead; }