Ejemplo n.º 1
0
 function handler_admin($page)
 {
     $mixed = func_get_args();
     array_shift($mixed);
     $mixed = implode('/', $mixed);
     if (empty($mixed)) {
         $wikis = Wiki::selectAll(Wiki::SELECT_BASE | Wiki::SELECT_COUNT);
         $page->assign('wikis', $wikis);
         $page->addCssLink('wiki.css');
         $page->assign('title', 'Admin Wiki');
         $page->changeTpl('wiki/list.tpl');
     } else {
         if (Wiki::isId($mixed)) {
             $wiki = new Wiki($mixed);
         } else {
             $wiki = Wiki::from($mixed, true);
             // Create the Wiki if it doesn't exist
         }
         if (Env::has('newcontent')) {
             $wiki->update(Env::s('newcontent'));
         }
         $wiki->select(Wiki::SELECT_BASE | Wiki::SELECT_COUNT);
         $wiki->select(array(Wiki::SELECT_VERSION => array('versions' => array('last'), 'options' => UserSelect::base())));
         $page->assign('wiki', $wiki);
         $page->addCssLink('wiki.css');
         $page->assign('title', 'Admin Wiki: ' . $wiki->name());
         $page->changeTpl('wiki/admin.tpl');
     }
 }
Ejemplo n.º 2
0
/** 
 * @param $name    The name of the wiki to load
 * @param $output  The name of the smarty variable containing the output
 */
function smarty_function_wiki($params, &$smarty)
{
    $w = Wiki::from($params['name'], true);
    $w->select(Wiki::SELECT_VERSION);
    $smarty->assign($params['output'], $w);
}