Exemple #1
0
 /**
  * Returns log page selector.
  * @return XmlSelect
  * @since 1.19
  */
 public function getTypeSelector()
 {
     $typesByName = array();
     // Temporary array
     // First pass to load the log names
     foreach (LogPage::validTypes() as $type) {
         $page = new LogPage($type);
         $restriction = $page->getRestriction();
         if ($this->getUser()->isAllowed($restriction)) {
             $typesByName[$type] = $page->getName()->text();
         }
     }
     // Second pass to sort by name
     asort($typesByName);
     // Always put "All public logs" on top
     $public = $typesByName[''];
     unset($typesByName['']);
     $typesByName = array('' => $public) + $typesByName;
     $select = new XmlSelect('type');
     foreach ($typesByName as $type => $name) {
         $select->addOption($name, $type);
     }
     return $select;
 }
Exemple #2
0
 /**
  * Is $type a valid log type
  *
  * @param $type String: log type to check
  * @return Boolean
  */
 public static function isLogType($type)
 {
     return in_array($type, LogPage::validTypes());
 }
 /**
  * @param $queryTypes Array
  * @return String: Formatted HTML
  */
 private function getTypeMenu($queryTypes)
 {
     global $wgLogRestrictions, $wgUser;
     $html = "<select name='type'>\n";
     $validTypes = LogPage::validTypes();
     $typesByName = array();
     // Temporary array
     // First pass to load the log names
     foreach ($validTypes as $type) {
         $text = LogPage::logName($type);
         $typesByName[$type] = $text;
     }
     // Second pass to sort by name
     asort($typesByName);
     // Note the query type
     $queryType = count($queryTypes) == 1 ? $queryTypes[0] : '';
     // Always put "All public logs" on top
     if (isset($typesByName[''])) {
         $all = $typesByName[''];
         unset($typesByName['']);
         $typesByName = array('' => $all) + $typesByName;
     }
     // Third pass generates sorted XHTML content
     foreach ($typesByName as $type => $text) {
         $selected = $type == $queryType;
         // Restricted types
         if (isset($wgLogRestrictions[$type])) {
             if ($wgUser->isAllowed($wgLogRestrictions[$type])) {
                 $html .= Xml::option($text, $type, $selected) . "\n";
             }
         } else {
             $html .= Xml::option($text, $type, $selected) . "\n";
         }
     }
     $html .= '</select>';
     return $html;
 }
 /**
  * @return string Formatted HTML
  * @private
  */
 function getTypeMenu()
 {
     $out = "<select name='type'>\n";
     $validTypes = LogPage::validTypes();
     $m = array();
     // Temporary array
     // First pass to load the log names
     foreach ($validTypes as $type) {
         $text = LogPage::logName($type);
         $m[$text] = $type;
     }
     // Second pass to sort by name
     ksort($m);
     // Third pass generates sorted XHTML content
     foreach ($m as $text => $type) {
         $selected = $type == $this->reader->queryType();
         $out .= Xml::option($text, $type, $selected) . "\n";
     }
     $out .= '</select>';
     return $out;
 }
Exemple #5
0
<?php

/**
 * @todo document
 * @addtogroup Maintenance
 */
/** */
require_once "commandLine.inc";
require_once "importLogs.inc";
#print $text;
#exit();
foreach (LogPage::validTypes() as $type) {
    if ($type == '') {
        continue;
    }
    $page = LogPage::logName($type);
    $log = new Article(Title::makeTitleSafe(NS_PROJECT, $page));
    $text = $log->fetchContent();
    $importer = new LogImporter($type);
    $importer->dummy = true;
    $importer->importText($text);
}
 /**
  * @return string Formatted HTML
  * @private
  */
 function getTypeMenu()
 {
     $out = "<select name='type'>\n";
     foreach (LogPage::validTypes() as $type) {
         $text = htmlspecialchars(LogPage::logName($type));
         $selected = $type == $this->reader->queryType() ? ' selected="selected"' : '';
         $out .= "<option value=\"{$type}\"{$selected}>{$text}</option>\n";
     }
     $out .= "</select>\n";
     return $out;
 }
Exemple #7
0
 /**
  * @param $queryType String
  * @return String: Formatted HTML
  */
 private function getTypeMenu($queryType)
 {
     global $wgLogRestrictions, $wgUser;
     $html = "<select name='type'>\n";
     $validTypes = LogPage::validTypes();
     $typesByName = array();
     // Temporary array
     // First pass to load the log names
     foreach ($validTypes as $type) {
         $text = LogPage::logName($type);
         $typesByName[$text] = $type;
     }
     // Second pass to sort by name
     ksort($typesByName);
     // Third pass generates sorted XHTML content
     foreach ($typesByName as $text => $type) {
         $selected = $type == $queryType;
         // Restricted types
         if (isset($wgLogRestrictions[$type])) {
             if ($wgUser->isAllowed($wgLogRestrictions[$type])) {
                 $html .= Xml::option($text, $type, $selected) . "\n";
             }
         } else {
             $html .= Xml::option($text, $type, $selected) . "\n";
         }
     }
     $html .= '</select>';
     return $html;
 }