/**
 * Print a single menu link.
 * @param string $uid Menu identifier
 * @param string $text Override link text
 * @param string $classes class="$classes"
 * @param string $intag e.g. 'target="_blank"'
 */
function print_menu_link($uid, $text = null, $classes = null, $intag = null)
{
    if (!($menu = get_menu_entry($uid))) {
        return null;
    }
    echo HTML::a($menu->url, $text ? $text : $menu->name, $menu->get('title', $menu->name), $classes, $intag);
}
Esempio n. 2
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     global $WikiTheme;
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if (!$src) {
         return $this->error(fmt("%s parameter missing", "'src'"));
     }
     // FIXME: Better recursion detection.
     // FIXME: Currently this doesnt work at all.
     if ($src == $request->getURLtoSelf()) {
         return $this->error(fmt("recursive inclusion of url %s", $src));
     }
     if (!IsSafeURL($src)) {
         return $this->error(_("Bad url in src: remove all of <, >, \""));
     }
     $params = array('title' => _("Transcluded page"), 'src' => $src, 'width' => "100%", 'height' => $height, 'marginwidth' => 0, 'marginheight' => 0, 'class' => 'transclude', "onload" => "adjust_iframe_height(this);");
     $noframe_msg[] = fmt("See: %s", HTML::a(array('href' => $src), $src));
     $noframe_msg = HTML::div(array('class' => 'transclusion'), HTML::p(array(), $noframe_msg));
     $iframe = HTML::div(HTML::iframe($params, $noframe_msg));
     /* This doesn't work very well...  maybe because CSS screws up NS4 anyway...
        $iframe = new HtmlElement('ilayer', array('src' => $src), $iframe);
        */
     return HTML(HTML::p(array('class' => 'transclusion-title'), fmt("Transcluded from %s", LinkURL($src))), $this->_js(), $iframe);
 }
Esempio n. 3
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     $parser = new AtomParser();
     assert(!empty($url));
     $parser->parse_url($url);
     $html = '';
     $items = HTML::dl();
     foreach ($parser->feed as $feed) {
         $title = HTML::h3(HTML::a(array('href' => $feed["links"]["0"]["href"]), $feed["title"]));
         $counter = 1;
         foreach ($parser->entries as $entry) {
             $item = HTML::dt(HTML::a(array('href' => $entry["links"]["0"]["href"]), $entry["title"]));
             $items->pushContent($item);
             if (!$titleonly) {
                 $description = HTML::dd(HTML::raw(html_entity_decode($entry["content"])));
             } else {
                 $description = HTML::dd();
             }
             $items->pushContent($description);
             if ($maxitem > 0 && $counter >= $maxitem) {
                 break;
             }
             $counter++;
         }
         $html = HTML::div(array('class' => 'rss'), $title);
         $html->pushContent($items);
     }
     return $html;
 }
Esempio n. 4
0
 public function __construct(array $objects, $edit = null, $add = true, $delete = true)
 {
     $this->list = '';
     foreach ($objects as $object) {
         $properties = $this->getProperties($object);
         $propertyList = '';
         foreach ($properties as $class => $property) {
             $propertyList .= HTML::span(['class' => $class], $property);
         }
         $id = $object->getId();
         if ($edit) {
             $properties = HTML::span(['class' => 'properties'], HTML::a(['href' => "/edit/{$edit}/{$id}"], $propertyList));
         } else {
             $properties = HTML::span(['class' => 'properties'], $propertyList);
         }
         if ($delete) {
             $deleteLink = HTML::span(['class' => 'delete'], HTML::a(['href' => "/delete/{$edit}/{$id}"], 'x'));
         } else {
             $deleteLink = '';
         }
         $this->list .= HTML::div(['class' => 'objectRow'], $properties . $deleteLink);
     }
     if ($add && $edit) {
         $this->list .= HTML::div(HTML::span(HTML::a(['href' => "/edit/{$edit}/"], 'add ' . $edit)));
     }
     $this->list = HTML::div(['class' => 'objectList'], $this->list);
 }
Esempio n. 5
0
 /**
  * Генерирует код для миниатюры
  *
  * @param string $file
  * @param string $preset
  */
 public static function getThumbCode($file, $preset = 'image.medium')
 {
     $file = UPLOADS . $file;
     $thumbnail = image_preset($preset, $file, TRUE);
     $preset = str_replace('.', '-', $preset);
     return HTML::a(File::pathToUri($file), self::getCode($thumbnail), array('class' => 'preset ' . $preset));
 }
Esempio n. 6
0
function RemovePage(&$request)
{
    global $WikiTheme;
    $page = $request->getPage();
    $pagelink = WikiLink($page);
    if ($request->getArg('cancel')) {
        $request->redirect(WikiURL($page));
        // noreturn
    }
    $current = $page->getCurrentRevision();
    if (!$current or !($version = $current->getVersion())) {
        $html = HTML(HTML::h2(_("Already deleted")), HTML::p(_("Sorry, this page is not in the database.")));
    } elseif (!$request->isPost() || !$request->getArg('verify')) {
        $removeB = Button('submit:verify', _("Remove Page"), 'wikiadmin');
        $cancelB = Button('submit:cancel', _("Cancel"), 'button');
        // use generic wiki button look
        $html = HTML(HTML::h2(fmt("You are about to remove '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'remove')), HTML::div(array('class' => 'toolbar'), $removeB, $WikiTheme->getButtonSeparator(), $cancelB)), HTML::hr());
        $sample = HTML::div(array('class' => 'transclusion'));
        // simple and fast preview expanding only newlines
        foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
            $sample->pushContent($s, HTML::br());
        }
        $html->pushContent(HTML::div(array('class' => 'wikitext'), $sample));
    } elseif ($request->getArg('currentversion') != $version) {
        $html = HTML(HTML::h2(_("Someone has edited the page!")), HTML::p(fmt("Since you started the deletion process, someone has saved a new version of %s.  Please check to make sure you still want to permanently remove the page from the database.", $pagelink)));
    } else {
        // Codendi specific: remove the deleted wiki page from ProjectWantedPages
        $projectPageName = 'ProjectWantedPages';
        $pagename = $page->getName();
        $dbi = $request->getDbh();
        require_once PHPWIKI_DIR . "/lib/loadsave.php";
        $pagehandle = $dbi->getPage($projectPageName);
        if ($pagehandle->exists()) {
            // don't replace default contents
            $current = $pagehandle->getCurrentRevision();
            $version = $current->getVersion();
            $text = $current->getPackedContent();
            $meta = $current->_data;
        }
        $text = str_replace("* [{$pagename}]", "", $text);
        $meta['summary'] = $GLOBALS['Language']->getText('wiki_lib_wikipagewrap', 'page_added', array($pagename));
        $meta['author'] = user_getname();
        $pagehandle->save($text, $version + 1, $meta);
        //Codendi specific: remove permissions for this page @codenditodo: may be transferable otherwhere.
        require_once 'common/wiki/lib/WikiPage.class.php';
        $wiki_page = new WikiPage(GROUP_ID, $_REQUEST['pagename']);
        $wiki_page->resetPermissions();
        // Real delete.
        //$pagename = $page->getName();
        $dbi = $request->getDbh();
        $dbi->deletePage($pagename);
        $dbi->touch();
        $link = HTML::a(array('href' => 'javascript:history.go(-2)'), _("Back to the previous page."));
        $html = HTML(HTML::h2(fmt("Removed page '%s' successfully.", $pagename)), HTML::div($link), HTML::hr());
    }
    GeneratePage($html, _("Remove Page"));
}
Esempio n. 7
0
 public static function showUsers($usuario_tipo)
 {
     $db = new DB();
     $login = new ModelLogin();
     if ($usuario_tipo == null) {
         $query = DB::connect()->prepare("SELECT * FROM wm_usuarios");
     } else {
         $query = DB::connect()->prepare("SELECT * FROM wm_usuarios WHERE usuario_tipo=:usuario_tipo");
         $query->bindValue(':usuario_tipo', $usuario_tipo, PDO::PARAM_STR);
     }
     $query->execute();
     $result = $query->fetchAll();
     switch ($usuario_tipo) {
         case "musico":
             foreach ($result as $row) {
                 echo "<tr>";
                 echo "<td>" . $row['usuario_id'] . "</td>";
                 echo "<td>" . $row['usuario_nombre'] . "</td>";
                 echo "<td>" . $row['usuario_nombre_usuario'] . "</td>";
                 echo "<td>" . $row['usuario_email'] . "</td>";
                 echo "<td>" . $db->getUserDataEstilo($login->getUserDataCampo($row['usuario_id'], "estilo_id")) . "</td>";
                 echo "<td>" . HTML::a(ROUTER::create_action_url("admin/edit&usuario_id=" . $row['usuario_id'] . "&usuario_tipo=" . $row['usuario_tipo'] . ""), "Editar") . "</td>";
                 echo "</tr>";
             }
             break;
         case "local":
             foreach ($result as $row) {
                 echo "<tr>";
                 echo "<td>" . $row['usuario_id'] . "</td>";
                 echo "<td>" . $row['usuario_nombre'] . "</td>";
                 echo "<td>" . $row['usuario_nombre_usuario'] . "</td>";
                 echo "<td>" . $row['usuario_email'] . "</td>";
                 echo "<td>" . $row['usuario_direccion'] . "</td>";
                 echo "<td>" . HTML::a(ROUTER::create_action_url("admin/edit&usuario_id=" . $row['usuario_id'] . "&usuario_tipo=" . $row['usuario_tipo'] . ""), "Editar") . "</td>";
                 echo "</tr>";
             }
             break;
         case "fan":
             foreach ($result as $row) {
                 echo "<tr>";
                 echo "<td>" . $row['usuario_id'] . "</td>";
                 echo "<td>" . $row['usuario_nombre'] . "</td>";
                 echo "<td>" . $row['usuario_apellido1'] . "</td>";
                 echo "<td>" . $row['usuario_apellido2'] . "</td>";
                 echo "<td>" . $row['usuario_nombre_usuario'] . "</td>";
                 echo "<td>" . $row['usuario_email'] . "</td>";
                 echo "<td>" . HTML::a(ROUTER::create_action_url("admin/edit&usuario_id=" . $row['usuario_id'] . "&usuario_tipo=" . $row['usuario_tipo'] . ""), "Editar") . "</td>";
                 echo "</tr>";
             }
             break;
         default:
             echo "Error en AdminPanel";
             break;
     }
 }
Esempio n. 8
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     if (!$args['pagename']) {
         return $this->error(_("No pagename specified"));
     }
     // Get our form args.
     $comment = $request->getArg("comment");
     $request->setArg('comment', false);
     if ($request->isPost() and !empty($comment['addcomment'])) {
         $this->add($request, $comment, 'comment');
         // noreturn
     }
     if ($args['jshide'] and isBrowserIE() and browserDetect("Mac")) {
         //trigger_error(_("jshide set to 0 on Mac IE"), E_USER_NOTICE);
         $args['jshide'] = 0;
     }
     // Now we display previous comments and/or provide entry box
     // for new comments
     $html = HTML();
     if ($args['jshide']) {
         $div = HTML::div(array('id' => 'comments', 'style' => 'display:none;'));
         //$list->setAttr('style','display:none;');
         $div->pushContent(Javascript("\nfunction togglecomments(a) {\n  comments=document.getElementById('comments');\n  if (comments.style.display=='none') {\n    comments.style.display='block';\n    a.title='" . _("Click to hide the comments") . "';\n  } else {\n    comments.style.display='none';\n    a.title='" . _("Click to display all comments") . "';\n  }\n}"));
         $html->pushContent(HTML::h4(HTML::a(array('name' => 'comment-header', 'class' => 'wikiaction', 'title' => _("Click to display"), 'onclick' => "togglecomments(this)"), _("Comments"))));
     } else {
         $div = HTML::div(array('id' => 'comments'));
     }
     foreach (explode(',', $args['mode']) as $show) {
         if (!empty($seen[$show])) {
             continue;
         }
         $seen[$show] = 1;
         switch ($show) {
             case 'show':
                 $show = $this->showAll($request, $args, 'comment');
                 //if ($args['jshide']) $show->setAttr('style','display:none;');
                 $div->pushContent($show);
                 break;
             case 'add':
                 global $WikiTheme;
                 if (!$WikiTheme->DUMP_MODE) {
                     $add = $this->showForm($request, $args, 'addcomment');
                     //if ($args['jshide']) $add->setAttr('style','display:none;');
                     $div->pushContent($add);
                 }
                 break;
             default:
                 return $this->error(sprintf("Bad mode ('%s')", $show));
         }
     }
     $html->pushContent($div);
     return $html;
 }
Esempio n. 9
0
 public function index($action = NULL)
 {
     switch ($action) {
         case 'file':
             $tpl = new Template('Upload.file');
             $tpl->show();
             break;
         case 'image':
             $image = new Upload_Image('file', array('preset' => 'post', 'path' => UPLOADS . DS . 'posts' . DS . date('Y/m/d')));
             if ($result = $image->upload()) {
                 exit(HTML::img($result));
             }
             break;
         default:
             append('content', HTML::a(Url::gear('upload') . '/file?iframe', t('Upload'), array('rel' => 'modal', 'class' => 'button')));
     }
 }
Esempio n. 10
0
 function linkUnknownWikiWord($wikiword, $linktext = '')
 {
     global $request;
     if (isa($wikiword, 'WikiPageName')) {
         $default_text = $wikiword->shortName;
         $wikiword = $wikiword->name;
     } else {
         $default_text = $wikiword;
     }
     $url = WikiURL($wikiword, array('action' => 'create'));
     $link = HTML::span(HTML::a(array('href' => $url, 'rel' => 'nofollow'), '?'));
     if (!empty($linktext)) {
         $link->unshiftContent(HTML::u($linktext));
         $link->setAttr('class', 'named-wikiunknown');
     } else {
         $link->unshiftContent(HTML::u($this->maybeSplitWikiWord($default_text)));
         $link->setAttr('class', 'wikiunknown');
     }
     return $link;
 }
 /**
  * Prepare the DB object.
  *
  * @param type $username Database username
  * @param type $password Database password
  * @param type $location Database location
  * @param type $database Database name
  * @param type $prefix Table Prefix
  */
 function __construct($username = null, $password = null, $location = null, $database = null, $prefix = '', $charset = 'utf8')
 {
     if (func_num_args() === 0) {
         $username = @$GLOBALS['username'];
         $password = @$GLOBALS['password'];
         $location = @$GLOBALS['location'];
         $database = @$GLOBALS['database'];
         $prefix = @$GLOBALS['prefix'];
     }
     $this->prefix = $prefix;
     @($this->mysqli = new mysqli($location, $username, $password, $database));
     if ($this->errorConnection()) {
         if (DEBUG) {
             $password_shown = $password === '' ? _("nessuna") : sprintf(_("di %d caratteri"), strlen($password));
             error_die(sprintf(_("Impossibile connettersi al database '%s' tramite l'utente '%s' e password (%s) sul server MySQL/MariaDB '%s'. Specifica correttamente queste informazioni nel file di configurazione del tuo progetto (usualmente '%s'). %s."), $database, $username, $password_shown, $location, 'load.php', HTML::a('https://github.com/valerio-bozzolan/boz-php-another-php-framework/blob/master/README.md#use-it', _("Documentazione"))));
         } else {
             error_die(_("Errore nello stabilire una connessione al database."));
         }
     }
     @$this->mysqli->set_charset($charset);
 }
Esempio n. 12
0
function RemovePage(&$request)
{
    global $WikiTheme;
    $page = $request->getPage();
    $pagelink = WikiLink($page);
    if ($request->getArg('cancel')) {
        $request->redirect(WikiURL($page));
        // noreturn
    }
    $current = $page->getCurrentRevision();
    if (!$current or !($version = $current->getVersion())) {
        $html = HTML(HTML::h2(_("Already deleted")), HTML::p(_("Sorry, this page is not in the database.")));
    } elseif (!$request->isPost() || !$request->getArg('verify')) {
        $removeB = Button('submit:verify', _("Remove Page"), 'wikiadmin');
        $cancelB = Button('submit:cancel', _("Cancel"), 'button');
        // use generic wiki button look
        $html = HTML(HTML::h2(fmt("You are about to remove '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'remove')), HTML::div(array('class' => 'toolbar'), $removeB, $WikiTheme->getButtonSeparator(), $cancelB)), HTML::hr());
        $sample = HTML::div(array('class' => 'transclusion'));
        // simple and fast preview expanding only newlines
        foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
            $sample->pushContent($s, HTML::br());
        }
        $html->pushContent(HTML::div(array('class' => 'wikitext'), $sample));
    } elseif ($request->getArg('currentversion') != $version) {
        $html = HTML(HTML::h2(_("Someone has edited the page!")), HTML::p(fmt("Since you started the deletion process, someone has saved a new version of %s.  Please check to make sure you still want to permanently remove the page from the database.", $pagelink)));
    } else {
        // Real delete.
        $pagename = $page->getName();
        $dbi = $request->getDbh();
        $dbi->deletePage($pagename);
        $dbi->touch();
        $link = HTML::a(array('href' => 'javascript:history.go(-2)'), _("Back to the previous page."));
        $html = HTML(HTML::h2(fmt("Removed page '%s' successfully.", $pagename)), HTML::div($link), HTML::hr());
    }
    GeneratePage($html, _("Remove Page"));
}
Esempio n. 13
0
<?php

use yii\helpers\Html;
?>
<nav>
    <div class="container">
        <div class="row">
            <div class="nav-inner">
                <ul id="nav" class="hidden-xs">
                    <li id="nav-home" class="level0 parent drop-menu"><?php 
echo HTML::a('<span>Trang chủ</span>', '/');
?>
</li>
                    <?php 
$depth = 0;
foreach ($categories as $key => $category) {
    if ($category->depth == $depth && $key != 0) {
        echo '</li>';
    } elseif ($category->depth > $depth) {
        if ($depth == 0) {
            echo '<div class="level0-wrapper dropdown-6col"><div class="level0-wrapper2"> <div class="nav-block nav-block-center grid13 itemgrid itemgrid-4col"><ul class="level0">';
        } else {
            echo '<ul class="level' . $depth . '">';
        }
    } else {
        for ($i = $depth - $category->depth; $i; $i--) {
            if ($i == 1 && $category->depth == 0) {
                echo '</li></ul>';
                echo '</div></div>';
                echo '<div class="row"><div class="col-lg-4">' . Html::img('/uploads/demo/ads/cat-1.jpg', ['class' => 'img-responsive']) . '</div>
                                    <div class="col-lg-4">' . Html::img('/uploads/demo/ads/cat-2.jpg', ['class' => 'img-responsive']) . '</div>
Esempio n. 14
0
function displayPage(&$request, $template = false)
{
    global $WikiTheme, $pv;
    $pagename = $request->getArg('pagename');
    $version = $request->getArg('version');
    $page = $request->getPage();
    if ($version) {
        $revision = $page->getRevision($version);
        if (!$revision) {
            NoSuchRevision($request, $page, $version);
        }
    } else {
        $revision = $page->getCurrentRevision();
    }
    if (isSubPage($pagename)) {
        $pages = explode(SUBPAGE_SEPARATOR, $pagename);
        $last_page = array_pop($pages);
        // deletes last element from array as side-effect
        $pageheader = HTML::span(HTML::a(array('href' => WikiURL($pages[0]), 'class' => 'pagetitle'), $WikiTheme->maybeSplitWikiWord($pages[0] . SUBPAGE_SEPARATOR)));
        $first_pages = $pages[0] . SUBPAGE_SEPARATOR;
        array_shift($pages);
        foreach ($pages as $p) {
            if ($pv != 2) {
                //Add the Backlink in page title
                $pageheader->pushContent(HTML::a(array('href' => WikiURL($first_pages . $p), 'class' => 'backlinks'), $WikiTheme->maybeSplitWikiWord($p . SUBPAGE_SEPARATOR)));
            } else {
                // Remove Backlinks
                $pageheader->pushContent(HTML::h1($pagename));
            }
            $first_pages .= $p . SUBPAGE_SEPARATOR;
        }
        if ($pv != 2) {
            $backlink = HTML::a(array('href' => WikiURL($pagename, array('action' => _("BackLinks"))), 'class' => 'backlinks'), $WikiTheme->maybeSplitWikiWord($last_page));
            $backlink->addTooltip(sprintf(_("BackLinks for %s"), $pagename));
        } else {
            $backlink = HTML::h1($pagename);
        }
        $pageheader->pushContent($backlink);
    } else {
        if ($pv != 2) {
            $pageheader = HTML::a(array('href' => WikiURL($pagename, array('action' => _("BackLinks"))), 'class' => 'backlinks'), $WikiTheme->maybeSplitWikiWord($pagename));
            $pageheader->addTooltip(sprintf(_("BackLinks for %s"), $pagename));
        } else {
            $pageheader = HTML::h1($pagename);
            //Remove Backlinks
        }
        if ($request->getArg('frame')) {
            $pageheader->setAttr('target', '_top');
        }
    }
    // {{{ Codendi hook to insert stuff between navbar and header
    $eM =& EventManager::instance();
    $ref_html = '';
    $crossref_fact = new CrossReferenceFactory($pagename, ReferenceManager::REFERENCE_NATURE_WIKIPAGE, GROUP_ID);
    $crossref_fact->fetchDatas();
    if ($crossref_fact->getNbReferences() > 0) {
        $ref_html .= '<h3>' . $GLOBALS['Language']->getText('cross_ref_fact_include', 'references') . '</h3>';
        $ref_html .= $crossref_fact->getHTMLDisplayCrossRefs();
    }
    $additional_html = false;
    $eM->processEvent('wiki_before_content', array('html' => &$additional_html, 'group_id' => GROUP_ID, 'wiki_page' => $pagename));
    if ($additional_html) {
        $beforeHeader = HTML();
        $beforeHeader->pushContent($additional_html);
        $beforeHeader->pushContent(HTML::raw($ref_html));
        $toks['BEFORE_HEADER'] = $beforeHeader;
    } else {
        $beforeHeader = HTML();
        $beforeHeader->pushContent(HTML::raw($ref_html));
        $toks['BEFORE_HEADER'] = $beforeHeader;
    }
    // }}} /Codendi hook
    $pagetitle = SplitPagename($pagename);
    if ($redirect_from = $request->getArg('redirectfrom')) {
        $redirect_message = HTML::span(array('class' => 'redirectfrom'), fmt("(Redirected from %s)", RedirectorLink($redirect_from)));
        // abuse the $redirected template var for some status update notice
    } elseif ($request->getArg('errormsg')) {
        $redirect_message = $request->getArg('errormsg');
        $request->setArg('errormsg', false);
    }
    $request->appendValidators(array('pagerev' => $revision->getVersion(), '%mtime' => $revision->get('mtime')));
    /*
        // FIXME: This is also in the template...
        if ($request->getArg('action') != 'pdf' and !headers_sent()) {
          // FIXME: enable MathML/SVG/... support
          if (ENABLE_XHTML_XML
                 and (!isBrowserIE()
                      and strstr($request->get('HTTP_ACCEPT'),'application/xhtml+xml')))
                header("Content-Type: application/xhtml+xml; charset=" . $GLOBALS['charset']);
            else
                header("Content-Type: text/html; charset=" . $GLOBALS['charset']);
        }
    */
    $page_content = $revision->getTransformedContent();
    // if external searchengine (google) referrer, highlight the searchterm
    // FIXME: move that to the transformer?
    // OR: add the searchhightplugin line to the content?
    if ($result = isExternalReferrer($request)) {
        if (DEBUG and !empty($result['query'])) {
            //$GLOBALS['SearchHighlightQuery'] = $result['query'];
            /* simply add the SearchHighlight plugin to the top of the page. 
               This just parses the wikitext, and doesn't highlight the markup */
            include_once 'lib/WikiPlugin.php';
            $loader = new WikiPluginLoader();
            $xml = $loader->expandPI('<' . '?plugin SearchHighlight s="' . $result['query'] . '"?' . '>', $request, $markup);
            if ($xml and is_array($xml)) {
                foreach (array_reverse($xml) as $line) {
                    array_unshift($page_content->_content, $line);
                }
                array_unshift($page_content->_content, HTML::div(_("You searched for: "), HTML::strong($result['query'])));
            }
            if (0) {
                /* Parse the transformed (mixed HTML links + strings) lines?
                     This looks like overkill.
                   */
                require_once "lib/TextSearchQuery.php";
                $query = new TextSearchQuery($result['query']);
                $hilight_re = $query->getHighlightRegexp();
                //$matches = preg_grep("/$hilight_re/i", $revision->getContent());
                // FIXME!
                for ($i = 0; $i < count($page_content->_content); $i++) {
                    $found = false;
                    $line = $page_content->_content[$i];
                    if (is_string($line)) {
                        while (preg_match("/^(.*?)({$hilight_re})/i", $line, $m)) {
                            $found = true;
                            $line = substr($line, strlen($m[0]));
                            $html[] = $m[1];
                            // prematch
                            $html[] = HTML::strong(array('class' => 'search-term'), $m[2]);
                            // match
                        }
                    }
                    if ($found) {
                        $html[] = $line;
                        // postmatch
                        $page_content->_content[$i] = HTML::span(array('class' => 'search-context'), $html);
                    }
                }
            }
        }
    }
    $toks['CONTENT'] = new Template('browse', $request, $page_content);
    $toks['TITLE'] = $pagetitle;
    // <title> tag
    $toks['HEADER'] = $pageheader;
    // h1 with backlink
    $toks['revision'] = $revision;
    if (!empty($redirect_message)) {
        $toks['redirected'] = $redirect_message;
    }
    $toks['ROBOTS_META'] = 'index,follow';
    $toks['PAGE_DESCRIPTION'] = $page_content->getDescription();
    $toks['PAGE_KEYWORDS'] = GleanKeywords($page);
    if (!$template) {
        $template = new Template('html', $request);
    }
    $template->printExpansion($toks);
    $page->increaseHitCount();
    if ($request->getArg('action') != 'pdf') {
        $request->checkValidators();
    }
    flush();
}
Esempio n. 15
0
                
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
                  <i class="fa fa-bars"></i>
                </button>
              </div>
            
              
            
            
        
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="navbar-collapse">
              <ul class="nav navbar-nav">
                <!--li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li-->
                <li><?php 
echo HTML::a('Перейти на сайт', Url::to('/', true), ['target' => '_blank']);
?>
</li>
                <!--li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
                  <ul class="dropdown-menu" role="menu">
                    <li><a href="#">Action</a></li>
                    <li><a href="#">Another action</a></li>
                    <li><a href="#">Something else here</a></li>
                    <li class="divider"></li>
                    <li><a href="#">Separated link</a></li>
                    <li class="divider"></li>
                    <li><a href="#">One more separated link</a></li>
                  </ul>
                </li-->
              </ul>
 function getDocumentPath($id, $group_id, $referrer_id = null)
 {
     $parents = array();
     $html = HTML();
     $hp =& Codendi_HTMLPurifier::instance();
     $item_factory =& $this->_getItemFactory($group_id);
     $item =& $item_factory->getItemFromDb($id);
     $reference =& $item;
     if ($reference && $referrer_id != $id) {
         while ($item && $item->getParentId() != 0) {
             $item =& $item_factory->getItemFromDb($item->getParentId());
             $parents[] = array('id' => $item->getId(), 'title' => $item->getTitle());
         }
         $parents = array_reverse($parents);
         $item_url = '/plugins/docman/?group_id=' . $group_id . '&sort_update_date=0&action=show&id=';
         foreach ($parents as $parent) {
             $html->pushContent(HTML::a(array('href' => $item_url . $parent['id'], 'target' => '_blank'), HTML::strong($parent['title'])));
             $html->pushContent(' / ');
         }
         $md_uri = '/plugins/docman/?group_id=' . $group_id . '&action=details&id=' . $id;
         //Add a pen icon linked to document properties.
         $pen_icon = HTML::a(array('href' => $md_uri), HTML::img(array('src' => util_get_image_theme("ic/edit.png"))));
         $html->pushContent(HTML::a(array('href' => $item_url . $reference->getId()), HTML::strong($reference->getTitle())));
         $html->pushContent($pen_icon);
         $html->pushContent(HTML::br());
     }
     return $html;
 }
Esempio n. 17
0
 function linkExistingWikiWord($wikiword, $linktext = '', $version = false)
 {
     global $request;
     if ($version !== false and !$this->HTML_DUMP_SUFFIX) {
         $url = WikiURL($wikiword, array('version' => $version));
     } else {
         $url = WikiURL($wikiword);
     }
     // Extra steps for dumping page to an html file.
     if ($this->HTML_DUMP_SUFFIX) {
         $url = preg_replace('/^\\./', '%2e', $url);
         // dot pages
     }
     $link = HTML::a(array('href' => $url));
     if (isa($wikiword, 'WikiPageName')) {
         $default_text = $wikiword->shortName;
     } else {
         $default_text = $wikiword;
     }
     if (!empty($linktext)) {
         $link->pushContent($linktext);
         $link->setAttr('class', 'named-wiki');
         $link->setAttr('title', $this->maybeSplitWikiWord($default_text));
     } else {
         //TODO: check if wikiblog
         $link->pushContent($this->maybeSplitWikiWord($default_text));
         $link->setAttr('class', 'wiki');
     }
     return $link;
 }
Esempio n. 18
0
tag('small');
tag('div');
tag('p');
tag('span');
tag('pre');
tag('code');
tag('em');
tag('ul');
tag('li');
tag('h1');
tag('h2');
tag('h3');
tag('h4');
tag('h5');
tag('h6');
tag('blockquote');
tag('footer');
tag_open('tr_open');
HTML::macro('named_anchor', function ($name) {
    return HTML::a('', ['name' => $name]);
});
HTML::macro('pcode', function ($innards) {
    return HTML::p(HTML::code($innards));
});
HTML::macro('nbsp', function ($total = 1) {
    $html = '';
    for ($i = 0; $i < $total; $i++) {
        $html .= '&nbsp;';
    }
    return $html;
});
Esempio n. 19
0
<?php

if ($value) {
    $path = File::pathToUri($value);
    echo icon('download') . ' ' . HTML::a($path, $path);
    ?>
    <label class="checkbox"><input type="checkbox" name="<?php 
    echo $element->name;
    ?>
" value=""/> <?php 
    echo t('Удалить');
    ?>
</label>

    <?php 
} else {
    if ($element->options->multiple) {
        $name = $element->options->name . '[]';
    } else {
        $name = $element->options->name;
    }
    ?>
    <input id="<?php 
    echo $element->id;
    ?>
" type="file" name="<?php 
    echo $name;
    ?>
" <?php 
    if ($element->options->multiple) {
        echo ' multiple';
Esempio n. 20
0
$i = 0;
foreach ($nodes as $node) {
    ?>
  <?php 
    if ($i != 0 && $i % 3 == 0) {
        ?>
</div><div class="clearfix">
  <?php 
    }
    ?>
  <div class="col-lg-4">
    <div class="thumbnail">
      <?php 
    echo HTML::a(Yii::$app->imageCache->thumb($node->image, 'post'), ['product/view', 'slug' => $node->slug]);
    ?>
    </div>
    <h5 class="grid-product-title"><?php 
    echo HTML::a($node->title, ['product/view', 'slug' => $node->slug]);
    ?>
    </h5>
  </div><!--One Item-->
  <?php 
    $i++;
}
?>
</div>
<div class="text-center">
  <?php 
echo HTML::a(HTML::img('img/icon-xem-them.png'), ['category/view', 'slug' => $category_slug]);
?>
</div>
Esempio n. 21
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     if (defined('CHARSET')) {
         $rss_parser = new RSSParser(CHARSET);
     } else {
         $rss_parser = new RSSParser();
     }
     if (!empty($url)) {
         $rss_parser->parse_url($url, $debug);
     }
     if (!empty($rss_parser->channel['title'])) {
         $feed = $rss_parser->channel['title'];
     }
     if (!empty($rss_parser->channel['link'])) {
         $url = $rss_parser->channel['link'];
     }
     if (!empty($rss_parser->channel['description'])) {
         $description = $rss_parser->channel['description'];
     }
     if (!empty($feed)) {
         if (!empty($url)) {
             $titre = HTML::span(HTML::a(array('href' => $rss_parser->channel['link']), $rss_parser->channel['title']));
         } else {
             $titre = HTML::span($rss_parser->channel['title']);
         }
         $th = HTML::div(array('class' => 'feed'), $titre);
         if (!empty($description)) {
             $th->pushContent(HTML::p(array('class' => 'chandesc'), HTML::raw($description)));
         }
     } else {
         $th = HTML();
     }
     if (!empty($rss_parser->channel['date'])) {
         $th->pushContent(HTML::raw("<!--" . $rss_parser->channel['date'] . "-->"));
     }
     $html = HTML::div(array('class' => 'rss'), $th);
     if ($rss_parser->items) {
         // only maxitem's
         if ($maxitem > 0) {
             $rss_parser->items = array_slice($rss_parser->items, 0, $maxitem);
         }
         foreach ($rss_parser->items as $item) {
             $cell = HTML::div(array('class' => 'rssitem'));
             if ($item['link'] and empty($item['title'])) {
                 $item['title'] = $item['link'];
             }
             $cell_title = HTML::div(array('class' => 'itemname'), HTML::a(array('href' => $item['link']), HTML::raw($item['title'])));
             $cell->pushContent($cell_title);
             $cell_author = HTML::raw($item['author']);
             $cell_pubDate = HTML::raw($item['pubDate']);
             $cell_authordate = HTML::div(array('class' => 'authordate'), $cell_author, HTML::raw(" - "), $cell_pubDate);
             $cell->pushContent($cell_authordate);
             if (!$titleonly && !empty($item['description'])) {
                 $cell->pushContent(HTML::div(array('class' => 'itemdesc'), HTML::raw($item['description'])));
             }
             $html->pushContent($cell);
         }
     } else {
         $html = HTML::div(array('class' => 'rss'), HTML::em(_("no RSS items")));
     }
     if (!check_php_version(5)) {
         $rss_parser->__destruct();
     }
     return $html;
 }
Esempio n. 22
0
    ?>
                <?php 
    if ($i != 0 && $i % 3 == 0) {
        ?>
            </div><div class="row">
                <?php 
    }
    ?>
                <div class="col-lg-4">
                    <div class="thumbnail">
                        <?php 
    echo HTML::a(Yii::$app->imageCache->thumb($node->image, 'post', ['class' => 'img-responsive']), ['product/view', 'slug' => $node->slug]);
    ?>
                    </div>
                    <h5 class="grid-product-title"><?php 
    echo HTML::a($node->title, ['product/view', 'slug' => $node->slug]);
    ?>
</h5>
                </div>
                <?php 
    $i++;
}
?>
            </div>
        </div>
        <div class="pagi">
            <?php 
echo \yii\widgets\LinkPager::widget(['pagination' => $pagination, 'options' => ['class' => 'pagination small']]);
?>
        </div>
    </div>
Esempio n. 23
0
 function link($link, $linktext = false)
 {
     list($moniker, $page) = split(":", $link, 2);
     if (!isset($this->_map[$moniker])) {
         return HTML::span(array('class' => 'bad-interwiki'), $linktext ? $linktext : $link);
     }
     $url = $this->_map[$moniker];
     // Urlencode page only if it's a query arg.
     // FIXME: this is a somewhat broken heuristic.
     $page_enc = strstr($url, '?') ? rawurlencode($page) : $page;
     if (strstr($url, '%s')) {
         $url = sprintf($url, $page_enc);
     } else {
         $url .= $page_enc;
     }
     $link = HTML::a(array('href' => $url));
     if (!$linktext) {
         $link->pushContent(PossiblyGlueIconToText('interwiki', "{$moniker}:"), HTML::span(array('class' => 'wikipage'), $page));
         $link->setAttr('class', 'interwiki');
     } else {
         $link->pushContent(PossiblyGlueIconToText('interwiki', $linktext));
         $link->setAttr('class', 'named-interwiki');
     }
     return $link;
 }
Esempio n. 24
0
echo Html::a(Yii::t("user", "Resend confirmation email"), ["/user/resend"]);
?>
		</div>
	</div>

	<?php 
ActiveForm::end();
?>

    <?php 
if (Yii::$app->get("authClientCollection", false)) {
    ?>
        <div class="col-lg-offset-2">
            <?php 
    echo yii\authclient\widgets\AuthChoice::widget(['baseAuthUrl' => ['/user/auth/login']]);
    ?>
        </div>
    <?php 
}
?>

	<div class="col-lg-offset-2" style="color:#999;">
		You may login with <strong>neo/neo</strong>.<br>
		To modify the username/password, log in first and then <?php 
echo HTML::a("update your account", ["/user/account"]);
?>
.
	</div>

</div>
Esempio n. 25
0
 function _makeNewPagesButton($newpages_button, $only_new)
 {
     global $request;
     $url = $request->getURLtoSelf(array('action' => $request->getArg('action'), 'only_new' => $newpages_button));
     $label = $newpages_button == 0 ? _("Old and new pages") : _("New pages only");
     $selected = HTML::td(array('colspan' => 3, 'class' => 'tdselected'), $label);
     $unselected = HTML::td(array('colspan' => 3, 'class' => 'tdunselected'), HTML::a(array('href' => $url, 'class' => 'wiki-rc-action'), $label));
     return $newpages_button == $only_new ? $selected : $unselected;
 }
Esempio n. 26
0
echo HTML::a('Управление записями', '/content/news');
?>
            </li>
            <li>
                <?php 
echo HTML::a('Категории', '/content/categories');
?>
            </li>
        </ul>

        <h1>Пользователи</h1>
        <ul class="nav nav-sidebar">

            <li>
                <?php 
echo HTML::a('Управление пользователями', '/users/index');
?>
            </li>
        </ul>


    </div>

    <div class="col-md-10 col-md-offset-2">
        <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
        <?php 
echo Alert::widget();
?>
        <?php 
Esempio n. 27
0
?>

<div class="site-index">

    <?php 
if (Yii::$app->user->isGuest) {
    ?>
        <div>
            Для работы Вы должны войти:
            <?php 
    echo HTML::a('Войти', Url::to('/site/login'), ['class' => 'btn btn-primary']);
    ?>
            Используйте логин <strong>demo</strong> и пароль <strong>demo</strong>
        </div>
    <?php 
} else {
    ?>
        <div>
            <?php 
    echo HTML::a('Создать таблицы и наполнить их тестовыми данными', Url::to('/book/prepare'), ['class' => 'btn btn-primary']);
    ?>
            или
            <?php 
    echo HTML::a('Перейти к списку книг', Url::to('/book/index'), ['class' => 'btn btn-primary']);
    ?>
        </div>
    <?php 
}
?>
</div>
Esempio n. 28
0
?>
/></a>
    </div>
    <div class="span7">
        <div class="well"><?php 
echo $default->description;
?>
</div>
        <p><b><?php 
echo t('Версия: ') . '</b> ' . $default->version;
?>
 <br/><b><?php 
echo t('Автор: ') . '</b> ' . HTML::a('mailto:' . $default->email, $default->author);
?>
<br/> <b><?php 
echo t('Сайт: ') . '</b> ' . HTML::a($default->site, $default->site);
?>
                        <?php 
echo $default->menu;
?>
                        </div>
                        </div>
                        <div class="page-header">
                            <h2><?php 
echo t('Выбрать тему');
?>
</h2>
                        </div>
                        <?php 
if (!$themes) {
    echo template('Errors/templates/empty')->render();
Esempio n. 29
0
    ?>
 <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="<?php 
    echo ROUTER::create_action_url('account/user');
    ?>
"><i class="fa fa-fw fa-user"></i> Perfil</a>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-fw fa-envelope"></i> Mensajes</a>
                        </li>
                        <?php 
    if ($login->getTypeOfUser() == "administrador") {
        echo "<li>";
        echo HTML::a(ROUTER::create_action_url('admin/admin'), "Panel de administrador");
        echo "</li>";
    }
    ?>
                        <li>
                            <a href="<?php 
    echo ROUTER::create_action_url('account/edit');
    ?>
"><i class="fa fa-fw fa-gear"></i><?php 
    echo WORDING_EDIT_USER_DATA;
    ?>
</a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="<?php 
Esempio n. 30
0
    use yii\widgets\ActiveForm;
    use yii\helpers\ArrayHelper;
    use yii\web\Controller;
?>
<div>
<table class="table table-striped table-bordered">
  <thead>
  	<tr>
  	  <th>Folio</th>
  	  <th>Ver</th>
	</tr>
  </thead>
  <tbody>
  	<?php foreach ($encabezados as $encabezado) {?>
	    <tr>
	      <td><?= $encabezado->folioTramiteCarga ?></td>
	      <td><?= HTML::a('<span class="fa fa-eye"></span>',['imagenes/view','id'=>$encabezado->id],['class'=>'btn btn-default','target'=>'_blank']) ?>
	      		<button type="button" class="btn btn-info btn-sx dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		          	<span class="caret"></span>
		          </button>
		          <ul class="dropdown-menu">
		           <?php foreach ($encabezado->tiposDocumento as $tipoDocumento){?>
		           		<li><?= Html::a($tipoDocumento->tipoDocumento,['imagenes/ver', 'id'=>$encabezado->id, 'tipoDocumento'=>$tipoDocumento->tipoDocumento],['target'=>'_blank']) ?></li>
		           <?php }?>
		          </ul>
	      </td>
	    </tr>
    <?php }?>
   </tbody>
</table>
</div>