Esempio n. 1
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     if (is_array($argstr)) {
         // can do with array also.
         $args =& $argstr;
         if (!isset($args['order'])) {
             $args['order'] = 'reverse';
         }
     } else {
         $args = $this->getArgs($argstr, $request);
     }
     $user = $request->getUser();
     if (empty($args['user'])) {
         if ($user->isAuthenticated()) {
             $args['user'] = $user->UserName();
         } else {
             $args['user'] = '';
         }
     }
     if (!$args['user'] or $args['user'] == ADMIN_USER) {
         if (BLOG_DEFAULT_EMPTY_PREFIX) {
             $args['user'] = '';
             // "Blogs/day" pages
         } else {
             $args['user'] = ADMIN_USER;
             // "Admin/Blogs/day" pages
         }
     }
     $parent = empty($args['user']) ? '' : $args['user'] . SUBPAGE_SEPARATOR;
     $sp = HTML::Raw('· ');
     $prefix = $base = $parent . $this->_blogPrefix('wikiblog');
     if ($args['month']) {
         $prefix .= SUBPAGE_SEPARATOR . $args['month'];
     }
     $pages = $dbi->titleSearch(new TextSearchQuery("^" . $prefix . SUBPAGE_SEPARATOR, true, 'posix'));
     $html = HTML();
     $i = 0;
     while ($page = $pages->next() and $i < $args['count']) {
         $rev = $page->getCurrentRevision(false);
         if ($rev->get('pagetype') != 'wikiblog') {
             continue;
         }
         $i++;
         $blog = $this->_blog($rev);
         //$html->pushContent(HTML::h3(WikiLink($page, 'known', $rev->get('summary'))));
         $html->pushContent($rev->getTransformedContent('wikiblog'));
     }
     if ($args['user'] == $user->UserName() or $args['user'] == '') {
         $html->pushContent(Button(array('action' => 'WikiBlog', 'mode' => 'add'), _("New entry"), $base));
     }
     if (!$i) {
         return HTML(HTML::h3(_("No Blog Entries")), $html);
     }
     if (!$args['noheader']) {
         return HTML(HTML::h3(sprintf(_("Blog Entries for %s:"), $this->_monthTitle($args['month']))), $html);
     } else {
         return $html;
     }
 }
Esempio n. 2
0
 function box($args = false, $request = false, $basepage = false)
 {
     if (!$request) {
         $request =& $GLOBALS['request'];
     }
     $stats = $this->getStats($request->_dbi, $request, 'summary');
     return $this->makeBox(_("Who is online"), HTML(HTML::Raw('&middot; '), WikiLink(_("WhoIsOnline"), 'auto', fmt("%d online users", $stats['NUM_USERS']))));
 }
Esempio n. 3
0
 function findTemplate($name)
 {
     // hack for navbar.tmpl to hide the buttonseparator
     if ($name == "navbar") {
         $this->setButtonSeparator(HTML::Raw("<br />\n&nbsp;&middot;&nbsp;"));
     }
     if ($name == "actionbar" || $name == "signin") {
         $this->setButtonSeparator(" ");
     }
     return parent::findTemplate($name);
 }
Esempio n. 4
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     if (empty($this->source)) {
         return '';
     }
     include_once "lib/ASCIIMathPHP/ASCIIMathPHP.cfg.php";
     $ascii_math = new ASCIIMathPHP($symbol_arr, $this->source);
     $ascii_math->genMathML();
     return HTML::Raw($ascii_math->getMathML());
 }
Esempio n. 5
0
 function showNotify(&$request, $messages, $page, $pagelist, $verified)
 {
     $isNecessary = !$this->contains($pagelist, $page);
     $form = HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), HiddenInputs(array('verify' => 1)), HiddenInputs($request->getArgs(), false, array('verify')), $messages, HTML::p(_("Your current watchlist: "), $this->showWatchList($pagelist)));
     if ($isNecessary) {
         $form->pushContent(HTML::p(_("New watchlist: "), $this->showWatchList($this->addpagelist($page, $pagelist))), HTML::p(sprintf(_("Do you %s want to add this page \"%s\" to your WatchList?"), $verified ? _("really") : "", $page)), HTML::p(Button('submit:add', _("Yes")), HTML::Raw('&nbsp;'), Button('submit:cancel', _("Cancel"))));
     } else {
         $form->pushContent(HTML::p(fmt("The page %s is already watched!", $page)), HTML::p(Button('submit:edit', _("Edit")), HTML::Raw('&nbsp;'), Button('submit:cancel', _("Cancel"))));
     }
     $fieldset = HTML::fieldset(HTML::legend("Watch Page"), $form);
     return $fieldset;
 }
Esempio n. 6
0
 function markup($match)
 {
     return HTML::Raw($match);
 }
Esempio n. 7
0
 /**
  * HTML widget display
  *
  * This needs to be put in the <body> section of the page.
  *
  * @param pagename    Name of the page to rate
  * @param version     Version of the page to rate (may be "" for current)
  * @param imgPrefix   Prefix of the names of the images that display the rating
  *                    You can have two widgets for the same page displayed at
  *                    once iff the imgPrefix-s are different.
  * @param dimension   Id of the dimension to rate
  * @param small       Makes a smaller ratings widget if non-false
  *
  * Limitations: Currently this can only print the current users ratings.
  *              And only the widget, but no value (for buddies) also.
  */
 function RatingWidgetHtml($pagename, $version, $imgPrefix, $dimension, $small = false)
 {
     global $WikiTheme, $request;
     $imgId = MangleXmlIdentifier($pagename) . $imgPrefix;
     $actionImgName = $imgId . 'RateItAction';
     $dbi =& $GLOBALS['request']->_dbi;
     $version = $dbi->_backend->get_latest_version($pagename);
     //$rdbi =& $this->_rdbi;
     $rdbi = RatingsDb::getTheRatingsDb();
     // check if the imgPrefix icons exist.
     if (!$WikiTheme->_findData("images/RateIt" . $imgPrefix . "Nk0.png", true)) {
         $imgPrefix = '';
     }
     // Protect against 's, though not \r or \n
     $reImgPrefix = $this->_javascript_quote_string($imgPrefix);
     $reActionImgName = $this->_javascript_quote_string($actionImgName);
     $rePagename = $this->_javascript_quote_string($pagename);
     //$dimension = $args['pagename'] . "rat";
     $html = HTML::span(array("id" => $imgId));
     for ($i = 0; $i < 2; $i++) {
         $nk[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Nk" . $i . ".png");
         $none[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Rk" . $i . ".png");
     }
     $user = $request->getUser();
     $userid = $user->getId();
     //if (!isset($args['rating']))
     $rating = $rdbi->getRating($userid, $pagename, $dimension);
     if (!$rating) {
         $pred = $rdbi->getPrediction($userid, $pagename, $dimension);
     }
     for ($i = 1; $i <= 10; $i++) {
         $a1 = HTML::a(array('href' => 'javascript:click(\'' . $reActionImgName . '\',\'' . $rePagename . '\',\'' . $version . '\',\'' . $reImgPrefix . '\',\'' . $dimension . '\',' . $i / 2 . ')'));
         $img_attr = array();
         $img_attr['src'] = $nk[$i % 2];
         //if (!$rating and !$pred)
         //  $img_attr['src'] = $none[$i%2];
         $img_attr['name'] = $imgPrefix . $i;
         $img_attr['alt'] = $img_attr['name'];
         $img_attr['border'] = 0;
         $a1->pushContent(HTML::img($img_attr));
         $a1->addToolTip(_("Rate the topic of this page"));
         $html->pushContent($a1);
         //This adds a space between the rating smilies:
         // if (($i%2) == 0) $html->pushContent(' ');
     }
     $html->pushContent(HTML::Raw('&nbsp;'));
     $a0 = HTML::a(array('href' => 'javascript:click(\'' . $reActionImgName . '\',\'' . $rePagename . '\',\'' . $version . '\',\'' . $reImgPrefix . '\',\'' . $dimension . '\',\'X\')'));
     $msg = _("Cancel rating");
     $a0->pushContent(HTML::img(array('src' => $WikiTheme->getImageUrl("RateIt" . $imgPrefix . "Cancel"), 'name' => $imgPrefix . 'Cancel', 'alt' => $msg)));
     $a0->addToolTip($msg);
     $html->pushContent($a0);
     /*} elseif ($pred) {
           $msg = _("No opinion");
           $html->pushContent(HTML::img(array('src' => $WikiTheme->getImageUrl("RateItCancelN"),
                                              'name'=> $imgPrefix.'Cancel',
                                              'alt' => $msg)));
           //$a0->addToolTip($msg);
           //$html->pushContent($a0);
       }*/
     $img_attr = array();
     $img_attr['src'] = $WikiTheme->_findData("images/RateItAction.png");
     $img_attr['name'] = $actionImgName;
     $img_attr['alt'] = $img_attr['name'];
     //$img_attr['class'] = 'k' . $i;
     $img_attr['border'] = 0;
     $html->pushContent(HTML::img($img_attr));
     // Display the current rating if there is one
     if ($rating) {
         $html->pushContent(JavaScript('displayRating(\'' . $reImgPrefix . '\',' . $rating . ',0)'));
     } elseif ($pred) {
         $html->pushContent(JavaScript('displayRating(\'' . $reImgPrefix . '\',' . $pred . ',1)'));
     } else {
         $html->pushContent(JavaScript('displayRating(\'' . $reImgPrefix . '\',0,0)'));
     }
     return $html;
 }
Esempio n. 8
0
/**
 * Glue icon in front of or after text.
 * Pref: 'noLinkIcons'      - ignore icon if set
 * WikiTheme: 'LinkIcons'   - 'yes'   at front
 *                          - 'no'    display no icon
 *                          - 'front' display at left
 *                          - 'after' display at right
 *
 * @param string $protocol_or_url Protocol or URL.  Used to determine the
 * proper icon.
 * @param string $text The text.
 * @return XmlContent.
 */
function PossiblyGlueIconToText($proto_or_url, $text)
{
    global $request, $WikiTheme;
    if ($request->getPref('noLinkIcons')) {
        return $text;
    }
    $icon = IconForLink($proto_or_url);
    if (!$icon) {
        return $text;
    }
    if ($where = $WikiTheme->getLinkIconAttr()) {
        if ($where == 'no') {
            return $text;
        }
        if ($where != 'after') {
            $where = 'front';
        }
    } else {
        $where = 'front';
    }
    if ($where == 'after') {
        // span the icon only to the last word (tie them together),
        // to let the previous words wrap on line breaks.
        if (!is_object($text)) {
            preg_match('/^(\\s*\\S*)(\\s*)$/', $text, $m);
            list(, $prefix, $last_word) = $m;
        } else {
            $last_word = $text;
            $prefix = false;
        }
        $text = HTML::span(array('style' => 'white-space: nowrap'), $last_word, HTML::Raw('&nbsp;'), $icon);
        if ($prefix) {
            $text = HTML($prefix, $text);
        }
        return $text;
    }
    // span the icon only to the first word (tie them together),
    // to let the next words wrap on line breaks
    if (!is_object($text)) {
        preg_match('/^\\s*(\\S*)(.*?)\\s*$/', $text, $m);
        list(, $first_word, $tail) = $m;
    } else {
        $first_word = $text;
        $tail = false;
    }
    $text = HTML::span(array('style' => 'white-space: nowrap'), $icon, $first_word);
    if ($tail) {
        $text = HTML($text, $tail);
    }
    return $text;
}
Esempio n. 9
0
 function _work($pagename, $args, $dbi, &$request)
 {
     if (empty($args['s'])) {
         if ($request->isPost()) {
             if ($pagename != _("AppendText")) {
                 return HTML($request->redirect(WikiURL($pagename, false, 'absurl'), false));
             }
         }
         return '';
     }
     $page = $dbi->getPage($pagename);
     $message = HTML();
     if (!$page->exists()) {
         // We might want to create it?
         $message->pushContent(sprintf(_("Page could not be updated. %s doesn't exist!\n"), $pagename));
         return $message;
     }
     $current = $page->getCurrentRevision();
     $oldtext = $current->getPackedContent();
     $text = $args['s'];
     // If a "before" or "after" is specified but not found, we simply append text to the end.
     if (!empty($args['before'])) {
         $before = preg_quote($args['before'], "/");
         // Insert before
         $newtext = preg_match("/\n{$before}/", $oldtext) ? preg_replace("/(\n{$before})/", "\n" . preg_quote($text, "/") . "\\1", $oldtext) : $this->_fallback($text, $oldtext, $args['before'], $message);
     } elseif (!empty($args['after'])) {
         // Insert after
         $after = preg_quote($args['after'], "/");
         $newtext = preg_match("/\n{$after}/", $oldtext) ? preg_replace("/(\n{$after})/", "\\1\n" . preg_quote($text, "/"), $oldtext) : $this->_fallback($text, $oldtext, $args['after'], $message);
     } else {
         // Append at the end
         $newtext = $oldtext . "\n" . $text;
     }
     require_once "lib/loadsave.php";
     $meta = $current->_data;
     $meta['summary'] = sprintf(_("AppendText to %s"), $pagename);
     if ($page->save($newtext, $current->getVersion() + 1, $meta)) {
         $message->pushContent(_("Page successfully updated."), HTML::br());
     }
     // AppendText has been called from the same page that got modified
     // so we directly show the page.
     if ($request->getArg($pagename) == $pagename) {
         // TODO: Just invalidate the cache, if AppendText didn't
         // change anything before.
         //
         return $request->redirect(WikiURL($pagename, false, 'absurl'), false);
         // The user asked to be redirected to the modified page
     } elseif ($args['redirect']) {
         return $request->redirect(WikiURL($pagename, false, 'absurl'), false);
     } else {
         $link = HTML::em(WikiLink($pagename));
         $message->pushContent(HTML::Raw(sprintf(_("Go to %s."), $link->asXml())));
     }
     return $message;
 }
Esempio n. 10
0
 function RelatedExternalLinksBox($title = false, $body = '', $limit = 20)
 {
     global $request;
     $this->title = $title ? $title : _("External Links");
     $this->body = HTML($body);
     $page = $request->getPage($request->getArg('pagename'));
     $cache =& $page->_wikidb->_cache;
     $counter = 0;
     $sp = HTML::Raw('&middot; ');
     foreach ($cache->getWikiPageLinks() as $link) {
         if ($link) {
             $this->body->pushContent($sp, WikiLink($link), HTML::br());
             $counter++;
             if ($limit and $counter > $limit) {
                 continue;
             }
         }
     }
 }
Esempio n. 11
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     if (empty($action)) {
         return $this->error(fmt("A required argument '%s' is missing.", "action"));
     }
     $form = HTML::form(array('action' => $request->getPostURL(), 'method' => strtolower($method), 'class' => 'wikiaction', 'accept-charset' => $GLOBALS['charset']), HiddenInputs(array('action' => $action, 'group_id' => GROUP_ID)));
     $nbsp = HTML::Raw('&nbsp;');
     $already_submit = 0;
     foreach ($this->inputbox as $inputbox) {
         foreach ($inputbox as $inputtype => $input) {
             if ($inputtype == 'radiobutton') {
                 $inputtype = 'radio';
             }
             // convert from older versions
             $input['type'] = $inputtype;
             $text = '';
             if ($inputtype != 'submit') {
                 if (empty($input['name'])) {
                     return $this->error(fmt("A required argument '%s' is missing.", $inputtype . "[][name]"));
                 }
                 if (!isset($input['text'])) {
                     $input['text'] = gettext($input['name']);
                 }
                 $text = $input['text'];
                 unset($input['text']);
             }
             switch ($inputtype) {
                 case 'checkbox':
                 case 'radio':
                     if (empty($input['value'])) {
                         $input['value'] = 1;
                     }
                     if (is_array($input['value'])) {
                         $div = HTML::div(array('class' => $class));
                         $values = $input['value'];
                         $name = $input['name'];
                         $input['name'] = $inputtype == 'checkbox' ? $name . "[]" : $name;
                         foreach ($values as $val) {
                             $input['value'] = $val;
                             if ($request->getArg($name)) {
                                 if ($request->getArg($name) == $val) {
                                     $input['checked'] = 'checked';
                                 } else {
                                     unset($input['checked']);
                                 }
                             }
                             $div->pushContent(HTML::input($input), $nbsp, $val, $nbsp, "\n");
                             if (!$nobr) {
                                 $div->pushContent(HTML::br());
                             }
                         }
                         $form->pushContent($div);
                     } else {
                         if (empty($input['checked'])) {
                             if ($request->getArg($input['name'])) {
                                 $input['checked'] = 'checked';
                             }
                         } else {
                             $input['checked'] = 'checked';
                         }
                         if ($nobr) {
                             $form->pushContent(HTML::input($input), $nbsp, $text, $nbsp);
                         } else {
                             $form->pushContent(HTML::div(array('class' => $class), HTML::input($input), $text));
                         }
                     }
                     break;
                 case 'editbox':
                     $input['type'] = 'text';
                     if (empty($input['value']) and $s = $request->getArg($input['name'])) {
                         $input['value'] = $s;
                     }
                     if ($nobr) {
                         $form->pushContent(HTML::input($input), $nbsp, $text, $nbsp);
                     } else {
                         $form->pushContent(HTML::div(array('class' => $class), HTML::input($input), $text));
                     }
                     break;
                 case 'combobox':
                     // TODO: moACDROPDOWN
                     $values = $input['value'];
                     unset($input['value']);
                     $input['type'] = 'text';
                     if (is_string($values)) {
                         $values = explode(",", $values);
                     }
                     if (empty($values)) {
                         if ($input['method']) {
                             $input['value'] = xmlrequest($input['method']);
                         } elseif ($s = $request->getArg($input['name'])) {
                             $input['value'] = $s;
                         }
                     } elseif (is_array($values)) {
                         $name = $input['name'];
                         unset($input['name']);
                         foreach ($values as $val) {
                             $input = array('value' => $val);
                             if ($request->getArg($name)) {
                                 if ($request->getArg($name) == $val) {
                                     $input['selected'] = 'selected';
                                 } else {
                                     unset($input['selected']);
                                 }
                             }
                             //$select->pushContent(HTML::option($input, $val));
                         }
                     }
                     if ($nobr) {
                         $form->pushContent(HTML::input($input), $nbsp, $text, $nbsp);
                     } else {
                         $form->pushContent(HTML::div(array('class' => $class), HTML::input($input), $text));
                     }
                     break;
                 case 'pulldown':
                     $values = $input['value'];
                     unset($input['value']);
                     unset($input['type']);
                     $select = HTML::select($input);
                     if (is_string($values)) {
                         $values = explode(",", $values);
                     }
                     if (empty($values) and $s = $request->getArg($input['name'])) {
                         $select->pushContent(HTML::option(array('value' => $s), $s));
                     } elseif (is_array($values)) {
                         $name = $input['name'];
                         unset($input['name']);
                         foreach ($values as $val) {
                             $input = array('value' => $val);
                             if ($request->getArg($name)) {
                                 if ($request->getArg($name) == $val) {
                                     $input['selected'] = 'selected';
                                 } else {
                                     unset($input['selected']);
                                 }
                             }
                             $select->pushContent(HTML::option($input, $val));
                         }
                     }
                     $form->pushContent($text, $nbsp, $select);
                     break;
                 case 'reset':
                 case 'hidden':
                     $form->pushContent(HTML::input($input));
                     break;
                     // change the order of inputs, by explicitly placing a submit button here.
                 // change the order of inputs, by explicitly placing a submit button here.
                 case 'submit':
                     //$input['type'] = 'submit';
                     if (empty($input['value'])) {
                         $input['value'] = $buttontext ? $buttontext : $action;
                     }
                     unset($input['text']);
                     if (empty($input['class'])) {
                         $input['class'] = $class;
                     }
                     if ($nobr) {
                         $form->pushContent(HTML::input($input), $nbsp, $text, $nbsp);
                     } else {
                         $form->pushContent(HTML::div(array('class' => $class), HTML::input($input), $text));
                     }
                     // unset the default submit button
                     $already_submit = 1;
                     break;
             }
         }
     }
     if ($request->getArg('start_debug')) {
         $form->pushContent(HTML::input(array('name' => 'start_debug', 'value' => $request->getArg('start_debug'), 'type' => 'hidden')));
     }
     if (!USE_PATH_INFO) {
         $form->pushContent(HiddenInputs(array('pagename' => $basepage)));
     }
     if (!$already_submit) {
         if (empty($buttontext)) {
             $buttontext = $action;
         }
         $submit = Button('submit:', $buttontext, $class);
         if ($cancel) {
             $form->pushContent(HTML::span(array('class' => $class), $submit, Button('submit:cancel', _("Cancel"), $class)));
         } else {
             $form->pushContent(HTML::span(array('class' => $class), $submit));
         }
     }
     return $form;
 }
Esempio n. 12
0
 * be omitted.
 */
$WikiTheme->addImageAlias('signature', WIKI_NAME . "Signature.png");
// Uncomment this next line to disable the signature.
$WikiTheme->addImageAlias('signature', false);
/*
 * Link icons.
 */
//$WikiTheme->setLinkIcon('http');
$WikiTheme->setLinkIcon('https');
$WikiTheme->setLinkIcon('ftp');
$WikiTheme->setLinkIcon('mailto');
//$WikiTheme->setLinkIcon('interwiki');
//$WikiTheme->setLinkIcon('wikiuser');
//$WikiTheme->setLinkIcon('*', 'url');
$WikiTheme->setButtonSeparator(HTML::Raw("<li>"));
/**
 * WikiWords can automatically be split by inserting spaces between
 * the words. The default is to leave WordsSmashedTogetherLikeSo.
 */
$WikiTheme->setAutosplitWikiWords(false);
/**
 * Layout improvement with dangling links for mostly closed wiki's:
 * If false, only users with edit permissions will be presented the 
 * special wikiunknown class with "?" and Tooltip.
 * If true (default), any user will see the ?, but will be presented 
 * the PrintLoginForm on a click.
 */
$WikiTheme->setAnonEditUnknownLinks(false);
/*
 * You may adjust the formats used for formatting dates and times
Esempio n. 13
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     $user =& $request->_user;
     if (isa($request, 'MockRequest')) {
         return '';
     }
     if (!$request->isActionPage($request->getArg('pagename')) and (!isset($user->_prefs->_method) or !in_array($user->_prefs->_method, array('ADODB', 'SQL'))) or in_array($request->getArg('action'), array('zip', 'ziphtml', 'dumphtml')) or isa($user, '_ForbiddenUser')) {
         $no_args = $this->getDefaultArguments();
         // ?
         //            foreach ($no_args as $key => $value) {
         //                $no_args[$value] = false;
         //            }
         $no_args['errmsg'] = HTML(HTML::h2(_("Error: The user HomePage must be a valid WikiWord. Sorry, UserPreferences cannot be saved."), HTML::hr()));
         $no_args['isForm'] = false;
         return Template('userprefs', $no_args);
     }
     $userid = $user->UserName();
     if ($user->isAuthenticated() and !empty($userid)) {
         $pref =& $request->_prefs;
         $args['isForm'] = true;
         //trigger_error("DEBUG: reading prefs from getPreferences".print_r($pref));
         if ($request->isPost()) {
             $errmsg = '';
             $delete = $request->getArg('delete');
             if ($delete and $request->getArg('verify')) {
                 // deleting prefs, verified
                 $default_prefs = $pref->defaultPreferences();
                 $default_prefs['userid'] = $user->UserName();
                 $user->setPreferences($default_prefs);
                 $request->_setUser($user);
                 $request->setArg("verify", false);
                 $request->setArg("delete", false);
                 $alert = new Alert(_("Message"), _("Your UserPreferences have been successfully deleted."));
                 $alert->show();
                 return;
             } elseif ($delete and !$request->getArg('verify')) {
                 return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), HiddenInputs(array('verify' => 1)), HiddenInputs($request->getArgs()), HTML::p(_("Do you really want to delete all your UserPreferences?")), HTML::p(Button('submit:delete', _("Yes"), 'delete'), HTML::Raw('&nbsp;'), Button('cancel', _("Cancel"))));
             } elseif ($rp = $request->getArg('pref')) {
                 // replace only changed prefs in $pref with those from request
                 if (!empty($rp['passwd']) and $rp['passwd2'] != $rp['passwd']) {
                     $errmsg = _("Wrong password. Try again.");
                 } else {
                     //trigger_error("DEBUG: reading prefs from request".print_r($rp));
                     //trigger_error("DEBUG: writing prefs with setPreferences".print_r($pref));
                     if (empty($rp['passwd'])) {
                         unset($rp['passwd']);
                     }
                     // fix to set system pulldown's. empty values don't get posted
                     if (empty($rp['theme'])) {
                         $rp['theme'] = '';
                     }
                     if (empty($rp['lang'])) {
                         $rp['lang'] = '';
                     }
                     $num = $user->setPreferences($rp);
                     if (!empty($rp['passwd'])) {
                         $passchanged = false;
                         if ($user->mayChangePass()) {
                             if (method_exists($user, 'storePass')) {
                                 $passchanged = $user->storePass($rp['passwd']);
                             }
                             if (!$passchanged and method_exists($user, 'changePass')) {
                                 $passchanged = $user->changePass($rp['passwd']);
                             }
                             if ($passchanged) {
                                 $errmsg = _("Password updated.");
                             } else {
                                 $errmsg = _("Password was not changed.");
                             }
                         } else {
                             $errmsg = _("Password cannot be changed.");
                         }
                     }
                     if (!$num) {
                         $errmsg .= " " . _("No changes.");
                     } else {
                         $request->_setUser($user);
                         $pref = $user->_prefs;
                         $errmsg .= sprintf(_("%d UserPreferences fields successfully updated."), $num);
                     }
                 }
                 $args['errmsg'] = HTML(HTML::h2($errmsg), HTML::hr());
             }
         }
         $args['available_themes'] = listAvailableThemes();
         $args['available_languages'] = listAvailableLanguages();
         return Template('userprefs', $args);
     } else {
         // wrong or unauthenticated user
         return $request->_notAuthorized(WIKIAUTH_BOGO);
         //return $user->PrintLoginForm ($request, $args, false, false);
     }
 }
Esempio n. 14
0
 function load()
 {
     $this->addMoreHeaders(JavaScript("var ta;\nvar skin = '" . $this->_name . "';\n"));
     $this->addMoreHeaders(JavaScript('', array('src' => $this->_findData("wikibits.js"))));
     if (isBrowserIE()) {
         $ver = browserVersion();
         if ($ver > 5.1 and $ver < 5.9) {
             $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IE55Fixes.css'), 'all'));
         } elseif ($ver > 5.5 and $ver < 7.0) {
             $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IE60Fixes.css'), 'all'));
         } elseif ($ver >= 7.0) {
             $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IE70Fixes.css'), 'all'));
         } else {
             $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IE50Fixes.css'), 'all'));
         }
         unset($ver);
         $this->addMoreHeaders("\n");
         $this->addMoreHeaders(JavaScript('', array('src' => $this->_findData("IEFixes.js"))));
         $this->addMoreHeaders("\n");
         $this->addMoreHeaders(HTML::Raw('<meta http-equiv="imagetoolbar" content="no" />'));
     }
     $this->addMoreAttr('body', "class-ns-0", HTML::Raw('class="ns-0"'));
     // CSS file defines fonts, colors and background images for this
     // style.  The companion '*-heavy.css' file isn't defined, it's just
     // expected to be in the same directory that the base style is in.
     // This should result in phpwiki-printer.css being used when
     // printing or print-previewing with style "PhpWiki" or "MacOSX" selected.
     $this->setDefaultCSS('PhpWiki', array('' => 'monobook.css', 'print' => 'commonPrint.css'));
     // This allows one to manually select "Printer" style (when browsing page)
     // to see what the printer style looks like.
     $this->addAlternateCSS(_("Printer"), 'commonPrint.css', 'print, screen');
     $this->addAlternateCSS(_("Top & bottom toolbars"), 'phpwiki-topbottombars.css');
     $this->addAlternateCSS(_("Modern"), 'phpwiki-modern.css');
     /**
      * The logo image appears on every page and links to the HomePage.
      */
     $this->addImageAlias('logo', 'MonoBook-Logo.png');
     //$this->addImageAlias('logo', WIKI_NAME . 'Logo.png');
     /**
      * The Signature image is shown after saving an edited page. If this
      * is set to false then the "Thank you for editing..." screen will
      * be omitted.
      */
     $this->addImageAlias('signature', "Signature.png");
     // Uncomment this next line to disable the signature.
     $this->addImageAlias('signature', false);
     /*
      * Link icons.
      */
     /*
     $this->setLinkIcon('http');
     $this->setLinkIcon('https');
     $this->setLinkIcon('ftp');
     $this->setLinkIcon('mailto');
     //$this->setLinkIcon('interwiki');
     */
     $this->setLinkIcon('wikiuser');
     //$this->setLinkIcon('*', 'url');
     // front or after
     //$this->setLinkIconAttr('after');
     //$this->setButtonSeparator("\n | ");
     /**
      * WikiWords can automatically be split by inserting spaces between
      * the words. The default is to leave WordsSmashedTogetherLikeSo.
      */
     //$this->setAutosplitWikiWords(false);
     /**
      * Layout improvement with dangling links for mostly closed wiki's:
      * If false, only users with edit permissions will be presented the
      * special wikiunknown class with "?" and Tooltip.
      * If true (default), any user will see the ?, but will be presented
      * the PrintLoginForm on a click.
      */
     $this->setAnonEditUnknownLinks(false);
     /*
      * You may adjust the formats used for formatting dates and times
      * below.  (These examples give the default formats.)
      * Formats are given as format strings to PHP strftime() function See
      * http://www.php.net/manual/en/function.strftime.php for details.
      * Do not include the server's zone (%Z), times are converted to the
      * user's time zone.
      */
     $this->setDateFormat("%B %d, %Y");
     $this->setTimeFormat("%H:%M");
     /*
      * To suppress times in the "Last edited on" messages, give a
      * give a second argument of false:
      */
     //$this->setDateFormat("%B %d, %Y", false);
 }
Esempio n. 15
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     if (is_array($argstr)) {
         // can do with array also.
         $args =& $argstr;
         if (!isset($args['order'])) {
             $args['order'] = 'reverse';
         }
     } else {
         $args = $this->getArgs($argstr, $request);
     }
     if (empty($args['user'])) {
         $user = $request->getUser();
         if ($user->isAuthenticated()) {
             $args['user'] = $user->UserName();
         } else {
             $args['user'] = '';
         }
     }
     if (!$args['user'] or $args['user'] == ADMIN_USER) {
         if (BLOG_EMPTY_DEFAULT_PREFIX) {
             $args['user'] = '';
         } else {
             $args['user'] = ADMIN_USER;
         }
         // "Admin/Blogs/day" pages
     }
     $parent = empty($args['user']) ? '' : $args['user'] . SUBPAGE_SEPARATOR;
     //$info = explode(',', $args['info']);
     //$pagelist = new PageList($args['info'], $args['exclude'], $args);
     //if (!is_array('pagename'), explode(',', $info))
     //    unset($pagelist->_columns['pagename']);
     $sp = HTML::Raw('&middot; ');
     if (!empty($args['month'])) {
         $prefix = $parent . $this->_blogPrefix('wikiblog') . SUBPAGE_SEPARATOR . $args['month'];
         $pages = $dbi->titleSearch(new TextSearchQuery("^" . $prefix, true, 'posix'));
         $html = HTML::ul();
         while ($page = $pages->next()) {
             $rev = $page->getCurrentRevision(false);
             if ($rev->get('pagetype') != 'wikiblog') {
                 continue;
             }
             $blog = $this->_blog($rev);
             $html->pushContent(HTML::li(WikiLink($page, 'known', $rev->get('summary'))));
         }
         if (!$args['noheader']) {
             return HTML(HTML::h3(sprintf(_("Blog Entries for %s:"), $this->_monthTitle($args['month']))), $html);
         } else {
             return $html;
         }
     }
     $blogs = $this->findBlogs($dbi, $args['user'], 'wikiblog');
     if ($blogs) {
         if (!$basepage) {
             $basepage = _("BlogArchives");
         }
         $html = HTML::ul();
         usort($blogs, array("WikiPlugin_WikiBlog", "cmp"));
         if ($args['order'] == 'reverse') {
             $blogs = array_reverse($blogs);
         }
         // collapse pagenames by month
         $months = array();
         foreach ($blogs as $rev) {
             $blog = $this->_blog($rev);
             $mon = $blog['month'];
             if (empty($months[$mon])) {
                 $months[$mon] = array('title' => $this->_monthTitle($mon), 'num' => 1, 'month' => $mon, 'link' => WikiURL($basepage, $this->_nonDefaultArgs(array('month' => $mon))));
             } else {
                 $months[$mon]['num']++;
             }
         }
         foreach ($months as $m) {
             $html->pushContent(HTML::li(HTML::a(array('href' => $m['link'], 'class' => 'named-wiki'), $m['title'] . " (" . $m['num'] . ")")));
         }
         if (!$args['noheader']) {
             return HTML(HTML::h3(_("Blog Archives:")), $html);
         } else {
             return $html;
         }
     } else {
         return '';
     }
 }
Esempio n. 16
0
 function _do_email_verification(&$request, &$args)
 {
     $dbi = $request->getDbh();
     $pagelist = new PageList('pagename', 0, $args);
     //$args['return_url'] = 'action=email-verification-verified';
     $email = new _PageList_Column_email('email', _("E-Mail"), 'left');
     $emailVerified = new _PageList_Column_emailVerified('emailVerified', _("Verification Status"), 'center');
     $pagelist->_columns[] = $email;
     $pagelist->_columns[] = $emailVerified;
     //This is the best method to find all users (Db and PersonalPage)
     $current_user = $request->_user;
     if (empty($args['verify'])) {
         $group = $request->getGroup();
         $allusers = $group->_allUsers();
     } else {
         $allusers = array_keys($args['user']);
     }
     foreach ($allusers as $username) {
         if (ENABLE_USER_NEW) {
             $user = WikiUser($username);
         } else {
             $user = new WikiUser($request, $username);
         }
         $prefs = $user->getPreferences();
         if ($prefs->get('email')) {
             if (!$prefs->get('userid')) {
                 $prefs->set('userid', $username);
             }
             if (!empty($pagelist->_rows)) {
                 $group = (int) (count($pagelist->_rows) / $pagelist->_group_rows);
             } else {
                 $group = 0;
             }
             $class = $group % 2 ? 'oddrow' : 'evenrow';
             $row = HTML::tr(array('class' => $class));
             $page_handle = $dbi->getPage($username);
             $row->pushContent($pagelist->_columns[0]->format($pagelist, $page_handle, $page_handle));
             $row->pushContent($email->format($pagelist, $prefs, $page_handle));
             if (!empty($args['verify'])) {
                 $prefs->_prefs['email']->set('emailVerified', empty($args['verified'][$username]) ? 0 : 2);
                 $user->setPreferences($prefs);
             }
             $row->pushContent($emailVerified->format($pagelist, $prefs, $args['verify']));
             $pagelist->_rows[] = $row;
         }
     }
     $request->_user = $current_user;
     if (!empty($args['verify'])) {
         return HTML($pagelist->_generateTable(false));
     } else {
         $args['verify'] = 1;
         $args['return_url'] = $request->getURLtoSelf();
         return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), HiddenInputs($args, 'wikiadminutils'), HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), HiddenInputs($request->getArgs()), $pagelist->_generateTable(false), HTML::p(Button('submit:', _("Change Verification Status"), 'wikiadmin'), HTML::Raw('&nbsp;'), Button('cancel', _("Cancel"))));
     }
 }
Esempio n. 17
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     if (isa($request, 'MockRequest')) {
         return '';
     }
     $user =& $request->_user;
     $post_args = $request->getArg('admin_reset');
     $userid = $request->getArg('user');
     $isadmin = $user->isAdmin();
     if ($request->isPost()) {
         if (!$userid) {
             $alert = new Alert(_("Warning:"), _("You need to specify the userid!"));
             $alert->show();
             return $this->doForm($request);
         }
         @($reset = $post_args['reset']);
         if ($reset and $userid and !empty($post_args['verify'])) {
             if ($user->isAdmin()) {
                 return $this->doReset($userid);
             } else {
                 return $this->doEmail($request, $userid);
             }
         } elseif ($reset and empty($post_args['verify'])) {
             $buttons = HTML::p(Button('submit:admin_reset[reset]', $isadmin ? _("Yes") : _("Send email"), $isadmin ? 'wikiadmin' : 'button'), HTML::Raw('&nbsp;'), Button('submit:admin_reset[cancel]', _("Cancel"), 'button'));
             $header = HTML::strong("Verify");
             if (!$user->isAdmin()) {
                 // check for email
                 if ($userid == $user->UserName() and $user->isAuthenticated()) {
                     $alert = new Alert(_("Already logged in"), HTML(fmt("Changing passwords is done at "), WikiLink(_("UserPreferences"))));
                     $alert->show();
                     return;
                 }
                 $thisuser = WikiUser($userid);
                 $prefs = $thisuser->getPreferences();
                 $email = $prefs->get('email');
                 if (!$email) {
                     $alert = new Alert(_("Error"), HTML(fmt("No email stored for user %s.", $userid), HTML::br(), fmt("You need to ask an Administrator to reset this password. See below: "), HTML::br(), WikiLink(ADMIN_USER)));
                     $alert->show();
                     return;
                 }
                 $verified = $thisuser->_prefs->_prefs['email']->getraw('emailVerified');
                 if (!$verified) {
                     $header->pushContent(HTML::br(), "Warning: This users email address is unverified!");
                 }
             }
             return $this->doForm($request, $header, HTML(HTML::hr(), fmt("Do you really want to reset the password of user %s?", $userid), $isadmin ? '' : _("An email will be sent."), HiddenInputs(array('admin_reset[verify]' => 1, 'user' => $userid)), $buttons));
         } else {
             return $this->doForm($request);
         }
     } else {
         return $this->doForm($request);
     }
 }
Esempio n. 18
0
function RevertPage(&$request)
{
    $mesg = HTML::dd();
    $pagename = $request->getArg('pagename');
    $version = $request->getArg('version');
    if (!$version) {
        PrintXML(HTML::dt(fmt("Revert"), " ", WikiLink($pagename)), HTML::dd(_("missing required version argument")));
        return;
    }
    $dbi =& $request->_dbi;
    $page = $dbi->getPage($pagename);
    $current = $page->getCurrentRevision();
    $currversion = $current->getVersion();
    if ($currversion == 0) {
        $mesg->pushContent(' ', _("no page content"));
        PrintXML(HTML::dt(fmt("Revert"), " ", WikiLink($pagename)), $mesg);
        flush();
        return;
    }
    if ($currversion == $version) {
        $mesg->pushContent(' ', _("same version page"));
        PrintXML(HTML::dt(fmt("Revert"), " ", WikiLink($pagename)), $mesg);
        flush();
        return;
    }
    if ($request->getArg('cancel')) {
        $mesg->pushContent(' ', _("Cancelled"));
        PrintXML(HTML::dt(fmt("Revert"), " ", WikiLink($pagename)), $mesg);
        flush();
        return;
    }
    if (!$request->getArg('verify')) {
        $mesg->pushContent(HTML::br(), _("Are you sure?"), HTML::br(), HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), HiddenInputs($request->getArgs(), false, array('verify')), HiddenInputs(array('verify' => 1)), Button('submit:verify', _("Yes"), 'button'), HTML::Raw('&nbsp;'), Button('submit:cancel', _("Cancel"), 'button')));
        $rev = $page->getRevision($version);
        $html = HTML(HTML::dt(fmt("Revert %s to version {$version}", WikiLink($pagename))), $mesg, $rev->getTransformedContent());
        $template = Template('browse', array('CONTENT' => $html));
        GeneratePage($template, $pagename, $rev);
        $request->checkValidators();
        flush();
        return;
    }
    $rev = $page->getRevision($version);
    $content = $rev->getPackedContent();
    $versiondata = $rev->_data;
    $versiondata['summary'] = sprintf(_("revert to version %d"), $version);
    $new = $page->save($content, $currversion + 1, $versiondata);
    $dbi->touch();
    $pagelink = WikiLink($pagename);
    $mesg->pushContent(fmt("Revert: %s", $pagelink), fmt("- version %d saved to database as version %d", $version, $new->getVersion()));
    // Force browse of current page version.
    $request->setArg('version', false);
    $template = Template('savepage', array());
    $template->replace('CONTENT', $new->getTransformedContent());
    GeneratePage($template, $mesg, $new);
    flush();
}
Esempio n. 19
0
 /**
  * HTML widget display
  *
  * This needs to be put in the <body> section of the page.
  *
  * @param pagename    Name of the page to rate
  * @param version     Version of the page to rate (may be "" for current)
  * @param imgPrefix   Prefix of the names of the images that display the rating
  *                    You can have two widgets for the same page displayed at
  *                    once iff the imgPrefix-s are different.
  * @param dimension   Id of the dimension to rate
  * @param small       Makes a smaller ratings widget if non-false
  *
  * Limitations: Currently this can only print the current users ratings.
  *              And only the widget, but no value (for buddies) also.
  */
 function RatingWidgetHtml($pagename, $version, $imgPrefix, $dimension, $small = false)
 {
     global $WikiTheme, $request;
     $dbi =& $request->_dbi;
     $version = $dbi->_backend->get_latest_version($pagename);
     $pageid = sprintf("%u", crc32($pagename));
     // MangleXmlIdentifier($pagename)
     $imgId = 'RateIt' . $pageid;
     $actionImgName = 'RateIt' . $pageid . 'Action';
     //$rdbi =& $this->_rdbi;
     $rdbi = RatingsDb::getTheRatingsDb();
     // check if the imgPrefix icons exist.
     if (!$WikiTheme->_findData("images/RateIt" . $imgPrefix . "Nk0.png", true)) {
         $imgPrefix = '';
     }
     // Protect against \'s, though not \r or \n
     $reImgPrefix = $this->_javascript_quote_string($imgPrefix);
     $reImgId = $this->_javascript_quote_string($imgId);
     $reActionImgName = $this->_javascript_quote_string($actionImgName);
     $rePagename = $this->_javascript_quote_string($pagename);
     //$dimension = $args['pagename'] . "rat";
     $html = HTML::span(array("class" => "rateit-widget", "id" => $imgId));
     for ($i = 0; $i < 2; $i++) {
         $ok[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Ok" . $i . ".png");
         // empty
         $nk[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Nk" . $i . ".png");
         // rated
         $rk[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Rk" . $i . ".png");
         // pred
     }
     if (empty($this->userid)) {
         $user = $request->getUser();
         $this->userid = $user->getId();
     }
     if (empty($this->rating)) {
         $this->rating = $rdbi->getRating($this->userid, $pagename, $dimension);
         if (!$this->rating and empty($this->pred)) {
             $this->pred = $rdbi->getPrediction($this->userid, $pagename, $dimension);
         }
     }
     for ($i = 1; $i <= 10; $i++) {
         $j = $i / 2;
         $a1 = HTML::a(array('href' => "javascript:clickRating('{$reImgPrefix}','{$rePagename}','{$version}'," . "'{$reImgId}','{$dimension}',{$j})"));
         $img_attr = array();
         $img_attr['src'] = $nk[$i % 2];
         if ($this->rating) {
             $img_attr['src'] = $ok[$i % 2];
             $img_attr['onmouseover'] = "displayRating('{$reImgId}','{$reImgPrefix}',{$j},0,1)";
             $img_attr['onmouseout'] = "displayRating('{$reImgId}','{$reImgPrefix}',{$this->rating},0,1)";
         } else {
             if (!$this->rating and $this->pred) {
                 $img_attr['src'] = $rk[$i % 2];
                 $img_attr['onmouseover'] = "displayRating('{$reImgId}','{$reImgPrefix}',{$j},1,1)";
                 $img_attr['onmouseout'] = "displayRating('{$reImgId}','{$reImgPrefix}',{$this->pred},1,1)";
             } else {
                 $img_attr['onmouseover'] = "displayRating('{$reImgId}','{$reImgPrefix}',{$j},0,1)";
                 $img_attr['onmouseout'] = "displayRating('{$reImgId}','{$reImgPrefix}',0,0,1)";
             }
         }
         //$imgName = 'RateIt'.$reImgId.$i;
         $img_attr['id'] = $imgId . $i;
         $img_attr['alt'] = $img_attr['id'];
         $a1->pushContent(HTML::img($img_attr));
         //$a1->addToolTip(_("Rate the topic of this page"));
         $html->pushContent($a1);
         //This adds a space between the rating smilies:
         //if (($i%2) == 0) $html->pushContent("\n");
     }
     $html->pushContent(HTML::Raw("&nbsp;"));
     $a0 = HTML::a(array('href' => "javascript:clickRating('{$reImgPrefix}','{$rePagename}','{$version}'," . "'{$reImgId}','{$dimension}','X')"));
     $msg = _("Cancel your rating");
     $imgprops = array('src' => $WikiTheme->getImageUrl("RateIt" . $imgPrefix . "Cancel"), 'id' => $imgId . $imgPrefix . 'Cancel', 'alt' => $msg, 'title' => $msg);
     if (!$this->rating) {
         $imgprops['style'] = 'display:none';
     }
     $a0->pushContent(HTML::img($imgprops));
     $a0->addToolTip($msg);
     $html->pushContent($a0);
     /*} elseif ($pred) {
           $msg = _("No opinion");
           $html->pushContent(HTML::img(array('src' => $WikiTheme->getImageUrl("RateItCancelN"),
                                              'id'  => $imgPrefix.'Cancel',
                                              'alt' => $msg)));
           //$a0->addToolTip($msg);
           //$html->pushContent($a0);
       }*/
     $img_attr = array();
     $img_attr['src'] = $WikiTheme->_findData("images/spacer.png");
     $img_attr['id'] = $actionImgName;
     $img_attr['alt'] = $img_attr['id'];
     $img_attr['height'] = 15;
     $img_attr['width'] = 20;
     $html->pushContent(HTML::img($img_attr));
     // Display your current rating if there is one, or the current prediction
     // or the empty widget.
     $pred = empty($this->pred) ? 0 : $this->pred;
     $js = '';
     if (!empty($this->avg)) {
         $js .= "avg['{$reImgId}']={$this->avg}; numusers['{$reImgId}']={$this->numusers};\n";
     }
     if ($this->rating) {
         $js .= "rating['{$reImgId}']={$this->rating}; prediction['{$reImgId}']={$pred};\n";
         $html->pushContent(JavaScript($js . "displayRating('{$reImgId}','{$reImgPrefix}',{$this->rating},0,1);"));
     } elseif (!empty($this->pred)) {
         $js .= "rating['{$reImgId}']=0; prediction['{$reImgId}']={$this->pred};\n";
         $html->pushContent(JavaScript($js . "displayRating('{$reImgId}','{$reImgPrefix}',{$this->pred},1,1);"));
     } else {
         $js .= "rating['{$reImgId}']=0; prediction['{$reImgId}']=0;\n";
         $html->pushContent(JavaScript($js . "displayRating('{$reImgId}','{$reImgPrefix}',0,0,1);"));
     }
     return $html;
 }
Esempio n. 20
0
 function format($changes)
 {
     include_once 'lib/InlineParser.php';
     $last_date = '';
     $first = true;
     $html = HTML();
     $counter = 1;
     $sp = HTML::Raw("\n&nbsp;&middot;&nbsp;");
     while ($rev = $changes->next()) {
         // enforce view permission
         if (mayAccessPage('view', $rev->_pagename)) {
             if ($link = $this->pageLink($rev)) {
                 // some entries may be empty
                 // (/Blog/.. interim pages)
                 $html->pushContent($sp, $link, HTML::br());
             }
             if ($first) {
                 $this->setValidators($rev);
             }
             $first = false;
         }
     }
     if ($first) {
         $html->pushContent(HTML::p(array('class' => 'rc-empty'), $this->empty_message()));
     }
     return $html;
 }
Esempio n. 21
0
        if ($action == 'browse') {
            unset($attr['action']);
        }
        return $this->makeButton($label, WikiURL($pagename, $attr), $class);
    }
}
$WikiTheme = new Theme_MonoBook('MonoBook');
$WikiTheme->addMoreHeaders(JavaScript('', array('src' => $WikiTheme->_findData("wikibits.js"))));
if (isBrowserIE()) {
    $WikiTheme->addMoreHeaders($WikiTheme->_CSSlink(0, $WikiTheme->_findFile('IEFixes.css'), 'all'));
    $WikiTheme->addMoreHeaders("\n");
    $WikiTheme->addMoreHeaders(JavaScript('', array('src' => $WikiTheme->_findData("IEFixes.js"))));
    $WikiTheme->addMoreHeaders("\n");
    $WikiTheme->addMoreHeaders(HTML::Raw('<meta http-equiv="imagetoolbar" content="no" />'));
}
$WikiTheme->addMoreAttr('body', "class-ns-0", HTML::Raw('class="ns-0"'));
// CSS file defines fonts, colors and background images for this
// style.  The companion '*-heavy.css' file isn't defined, it's just
// expected to be in the same directory that the base style is in.
// This should result in phpwiki-printer.css being used when
// printing or print-previewing with style "PhpWiki" or "MacOSX" selected.
$WikiTheme->setDefaultCSS('PhpWiki', array('' => 'monobook.css', 'print' => 'commonPrint.css'));
// This allows one to manually select "Printer" style (when browsing page)
// to see what the printer style looks like.
$WikiTheme->addAlternateCSS(_("Printer"), 'commonPrint.css', 'print, screen');
$WikiTheme->addAlternateCSS(_("Top & bottom toolbars"), 'phpwiki-topbottombars.css');
$WikiTheme->addAlternateCSS(_("Modern"), 'phpwiki-modern.css');
/**
 * The logo image appears on every page and links to the HomePage.
 */
$WikiTheme->addImageAlias('logo', 'MonoBook-Logo.png');