/** * Zikula_View function to obtain current URL for the page * * Available parameters: * - assign: If set, the results are assigned to the corresponding variable instead of printed out * - and any additional ones to override for the current request * * Example * {getcurrenturl} * {getcurrenturl lang='de'} * * @param array $params All attributes passed to this function from the template. * @param Zikula_View $view Reference to the Zikula_View object. * * @return string The current url of the page. */ function smarty_function_getcurrenturl($params, Zikula_View $view) { $assign = null; if (isset($params['assign'])) { $assign = $params['assign']; unset($params['assign']); } $result = htmlspecialchars(System::getCurrentUrl($params)); if ($assign) { $view->assign($assign, $result); } else { return $result; } }
/** * Zikula_View function to get current URI/URL to change language, handling in proper way short URLs * * This function obtains the current request URI and returns URI/URL with parameter to change language. * The results of this function are already sanitized to display, so it should not be passed to the safetext modifier. * * Available parameters: * - assign: If set, the results are assigned to the corresponding variable instead of printed out * - lang: Language code to change to * - fqurl: Fully Qualified URL. True to get full URL, otherwise return URI * * Example * {langchange lang='de'} * * @param array $params All attributes passed to this function from the template. * @param Zikula_View $view Reference to the Zikula_View object. * * @return string The changed current URI. */ function smarty_function_langchange($params, Zikula_View $view) { $assign = null; if (isset($params['assign'])) { $assign = $params['assign']; unset($params['assign']); } $lang = null; if (isset($params['lang'])) { $lang = $params['lang']; } $fqurl = false; if (isset($params['fqurl'])) { $fqurl = $params['fqurl']; unset($params['fqurl']); } // Handling short URL's similar to Language selector block $shorturls = System::getVar('shorturls', false); if (isset($lang) && $shorturls) { $module = FormUtil::getPassedValue('module', null, 'GET', FILTER_SANITIZE_STRING); $type = FormUtil::getPassedValue('type', null, 'GET', FILTER_SANITIZE_STRING); $func = FormUtil::getPassedValue('func', null, 'GET', FILTER_SANITIZE_STRING); if (isset($module) && isset($type) && isset($func)) { // build URL based on module URL $result = ModUtil::url($module, $type, $func, $_GET, null, null, $fqurl, false, $lang); } else { // to homepage with language set in terms of short url's if ($fqurl) { $result = System::getVar('entrypoint', 'index.php') . "?lang=" . $lang; } else { $result = $lang; } } } else { if ($fqurl) { $result = htmlspecialchars(System::getCurrentUrl($params)); } else { $result = htmlspecialchars(System::getCurrentUri($params)); } } if ($assign) { $view->assign($assign, $result); } else { return $result; } }
/** * Zikula_View function to display menulinks in an unordered list * * Example * {modulelinks data=$links id='listid' class='navbar navbar-default' itemclass='z-ml-item' first='z-ml-first' last='z-ml-last'} * * Available parameters: * links Array with menulinks (text, url, title, id, class, disabled) (optional) * modname Module name to display links for (optional) * type Function type where the getLinks-function is located (optional) * menuid ID for the unordered list (optional) * menuclass Class for the unordered list (optional) * itemclass Array with menulinks (text, url, title, class, disabled) (optional) * first Class for the first element (optional) * last Class for the last element (optional) * seperator Link seperator (optional) * class CSS class (optional). * returnAsArray return results as array, not as formatted html - MUST set assign * * @param array $params All attributes passed to this function from the template. * @param Zikula_View $view Reference to the Zikula_View object. * * @return string A formatted string containing navigation for the module admin panel. */ function smarty_function_modulelinks($params, Zikula_View $view) { $menuLinks = isset($params['links']) ? $params['links'] : ''; $menuId = isset($params['menuid']) ? $params['menuid'] : ''; $menuClass = isset($params['menuclass']) ? $params['menuclass'] : 'navbar navbar-default navbar-modulelinks navbar-modulelinks-main'; $menuItemClass = isset($params['itemclass']) ? $params['itemclass'] : ''; $menuItemFirst = isset($params['first']) ? $params['first'] : ''; $menuItemLast = isset($params['last']) ? $params['last'] : ''; $returnAsArray = isset($params['returnAsArray']) ? (bool) $params['returnAsArray'] : false; if (empty($menuLinks)) { if (!isset($params['modname']) || !ModUtil::available($params['modname'])) { $params['modname'] = ModUtil::getName(); } // check our module name if (!ModUtil::available($params['modname'])) { $view->trigger_error('modulelinks: ' . __f("Error! The '%s' module is not available.", DataUtil::formatForDisplay($params['modname']))); return false; } $params['type'] = isset($params['type']) ? $params['type'] : 'admin'; // get the menu links // try the Core-2.0 way first, then try the legacy way. $menuLinks = $view->getContainer()->get('zikula.link_container_collector')->getLinks($params['modname'], $params['type']); if (empty($menuLinks)) { $menuLinks = ModUtil::apiFunc($params['modname'], $params['type'], 'getLinks', $params); } } // return if there are no links to print or template has requested to returnAsArray if (!$menuLinks || $returnAsArray && isset($params['assign'])) { if (isset($params['assign'])) { $view->assign($params['assign'], $menuLinks); } return ''; } $html = ''; if (!empty($menuLinks)) { $html = '<ul'; $html .= !empty($menuId) ? ' id="' . $menuId . '"' : ''; $html .= !empty($menuClass) ? ' class="' . $menuClass . '"' : ''; $html .= '>'; $i = 1; $size = count($menuLinks); foreach ($menuLinks as $menuitem) { $class = array(); $class[] = $size == 1 ? 'z-ml-single' : ''; $class[] = $i == 1 && $size > 1 ? $menuItemFirst : ''; $class[] = $i == $size && $size > 1 ? $menuItemLast : ''; $class[] = !empty($menuItemClass) ? $menuItemClass : ''; $class[] = isset($menuitem['disabled']) && $menuitem['disabled'] == true ? 'z-ml-disabled' : ''; $class = trim(implode(' ', $class)); $i++; if (System::isLegacyMode() && !empty($class) && isset($menuitem['class'])) { if ($menuitem['class'] == 'z-icon-es-add') { $menuitem['class'] = null; $menuitem['icon'] = 'plus'; } elseif ($menuitem['class'] == 'z-icon-es-back') { $menuitem['class'] = null; $menuitem['icon'] = 'arrow-left'; } elseif ($menuitem['class'] == 'z-icon-es-cancel') { $menuitem['class'] = null; $menuitem['icon'] = 'times'; } elseif ($menuitem['class'] == 'z-icon-es-config') { $menuitem['class'] = null; $menuitem['icon'] = 'wrench'; } elseif ($menuitem['class'] == 'z-icon-es-copy') { $menuitem['class'] = null; $menuitem['icon'] = 'files-o'; } elseif ($menuitem['class'] == 'z-icon-es-cubes') { $menuitem['class'] = null; $menuitem['icon'] = 'th'; } elseif ($menuitem['class'] == 'z-icon-es-cut') { $menuitem['class'] = null; $menuitem['icon'] = 'scissors'; } elseif ($menuitem['class'] == 'z-icon-es-delete') { $menuitem['class'] = null; $menuitem['icon'] = 'trash-o'; } elseif ($menuitem['class'] == 'z-icon-es-display') { $menuitem['class'] = null; $menuitem['icon'] = 'eye'; } elseif ($menuitem['class'] == 'z-icon-es-edit') { $menuitem['class'] = null; $menuitem['icon'] = 'pencil-square-o'; } elseif ($menuitem['class'] == 'z-icon-es-error') { $menuitem['class'] = null; $menuitem['icon'] = 'exclamation-triangle'; } elseif ($menuitem['class'] == 'z-icon-es-export') { $menuitem['class'] = null; $menuitem['icon'] = 'upload'; } elseif ($menuitem['class'] == 'z-icon-es-gears') { $menuitem['class'] = null; $menuitem['icon'] = 'gears'; } elseif ($menuitem['class'] == 'z-icon-es-filter') { $menuitem['class'] = null; $menuitem['icon'] = 'filter'; } elseif ($menuitem['class'] == 'z-icon-es-group') { $menuitem['class'] = null; $menuitem['icon'] = 'users'; } elseif ($menuitem['class'] == 'z-icon-es-help') { $menuitem['class'] = null; $menuitem['icon'] = 'info'; } elseif ($menuitem['class'] == 'z-icon-es-home') { $menuitem['class'] = null; $menuitem['icon'] = 'home'; } elseif ($menuitem['class'] == 'z-icon-es-hook') { $menuitem['class'] = null; $menuitem['icon'] = 'paperclip'; } elseif ($menuitem['class'] == 'z-icon-es-import') { $menuitem['class'] = null; $menuitem['icon'] = 'download'; } elseif ($menuitem['class'] == 'z-icon-es-info') { $menuitem['class'] = null; $menuitem['icon'] = 'info'; } elseif ($menuitem['class'] == 'z-icon-es-locale') { $menuitem['class'] = null; $menuitem['icon'] = 'globe'; } elseif ($menuitem['class'] == 'z-icon-es-locked') { $menuitem['class'] = null; $menuitem['icon'] = 'lock'; } elseif ($menuitem['class'] == 'z-icon-es-log') { $menuitem['class'] = null; $menuitem['icon'] = 'archive'; } elseif ($menuitem['class'] == 'z-icon-es-mail') { $menuitem['class'] = null; $menuitem['icon'] = 'inbox'; } elseif ($menuitem['class'] == 'z-icon-es-new') { $menuitem['class'] = null; $menuitem['icon'] = 'file-o'; } elseif ($menuitem['class'] == 'z-icon-es-ok') { $menuitem['class'] = null; $menuitem['icon'] = 'check'; } elseif ($menuitem['class'] == 'z-icon-es-options') { $menuitem['class'] = null; $menuitem['icon'] = 'th-list'; } elseif ($menuitem['class'] == 'z-icon-es-preview') { $menuitem['class'] = null; $menuitem['icon'] = 'cog'; } elseif ($menuitem['class'] == 'z-icon-es-print') { $menuitem['class'] = null; $menuitem['icon'] = 'print'; } elseif ($menuitem['class'] == 'z-icon-es-profile') { $menuitem['class'] = null; $menuitem['icon'] = 'user'; } elseif ($menuitem['class'] == 'z-icon-es-regenerate') { $menuitem['class'] = null; $menuitem['icon'] = 'refresh'; } elseif ($menuitem['class'] == 'z-icon-es-remove') { $menuitem['class'] = null; $menuitem['icon'] = 'times'; } elseif ($menuitem['class'] == 'z-icon-es-save') { $menuitem['class'] = null; $menuitem['icon'] = 'floppy-o'; } elseif ($menuitem['class'] == 'z-icon-es-saveas') { $menuitem['class'] = null; $menuitem['icon'] = 'floppy-o'; } elseif ($menuitem['class'] == 'z-icon-es-search') { $menuitem['class'] = null; $menuitem['icon'] = 'search'; } elseif ($menuitem['class'] == 'z-icon-es-url') { $menuitem['class'] = null; $menuitem['icon'] = 'globe'; } elseif ($menuitem['class'] == 'z-icon-es-user') { $menuitem['class'] = null; $menuitem['icon'] = 'user'; } elseif ($menuitem['class'] == 'z-icon-es-view') { $menuitem['class'] = null; $menuitem['icon'] = 'eye'; } elseif ($menuitem['class'] == 'z-icon-es-warning') { $menuitem['class'] = null; $menuitem['icon'] = 'exclamation-triangle'; } elseif ($menuitem['class'] == 'z-icon-es-rss') { $menuitem['class'] = null; $menuitem['icon'] = 'rss-square'; } } $active = ''; if (!empty($menuitem['url']) && System::getBaseUrl() . $menuitem['url'] === System::getCurrentUrl()) { $active = 'active '; } $dropdown = ''; if (isset($menuitem['links'])) { $dropdown = 'dropdown'; } $html .= '<li'; $html .= !empty($menuitem['id']) ? ' id="' . $menuitem['id'] . '"' : ''; $html .= ' class="' . $active . $dropdown; $html .= !empty($class) ? $class : ''; $html .= '">'; $attr = !empty($menuitem['title']) ? ' title="' . $menuitem['title'] . '"' : ''; $attr .= !empty($menuitem['class']) ? ' class="' . $menuitem['class'] . '"' : ''; if (isset($menuitem['disabled']) && $menuitem['disabled'] == true) { $html .= '<a ' . $attr . '>' . $menuitem['text'] . '</a>'; } elseif (!empty($menuitem['url'])) { $icon = ''; if (!empty($menuitem['icon'])) { $icon = '<span class="fa fa-' . $menuitem['icon'] . '"></span> '; } $html .= '<a href="' . DataUtil::formatForDisplay($menuitem['url']) . '"' . $attr . ' style="display: inline-block;">' . $icon . $menuitem['text'] . '</a>'; if (isset($menuitem['links'])) { $html .= '<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="text-decoration: none;"> <b class="caret"></b></a>'; } } else { $html .= '<span' . $attr . '>' . $menuitem['text'] . '</span>'; } if (isset($menuitem['links'])) { $html .= '<ul class="dropdown-menu">'; foreach ($menuitem['links'] as $submenuitem) { $html .= '<li>'; if (isset($submenuitem['url'])) { $html .= '<a href="' . DataUtil::formatForDisplay($submenuitem['url']) . '">' . $submenuitem['text'] . '</a>'; } else { $html .= $submenuitem['text']; } $html .= '</li>'; } $html .= '</ul>'; } $html .= '</li>'; } $html .= '</ul>'; } if (isset($params['assign'])) { $view->assign($params['assign'], $html); } else { return $html; } }
<div id="error" class="block"><h2></h2> <p></p></div> <div id="footer"> <span> <?php if (System::getCurrentUser()->is_logged_in()) { //display logout ?> Angemeldet als <?php echo System::getCurrentUser()->name; ?> <a href="http://system.salzhimmel.de/api.php?q=logout&von=<?php echo System::getCurrentUrl(); ?> ">Abmelden</a> <?php } else { //display login ?> Nicht angemeldet <a href="javascript:cloud.show_login();">Anmelden</a> <?php } ?> </span> </div> <div id="site"> <div id="header"> <a class="topic" href="index.php" title="Zurück zur Startseite">SalzCloud</a> </div>
/** * Get current URL * * @deprecated Deprecated since version 1.3.0. * @see System::getCurrentUrl() * * @access public * @param args array additional parameters to be added to/replaced in the URL (e.g. theme, ...) * @return string current URL * @todo cfr. BaseURI() for other possible ways, or try PHP_SELF */ function pnGetCurrentURL($args = array()) { LogUtil::log(__f('Warning! Function %1$s is deprecated. Please use %2$s instead.', array(__FUNCTION__, 'System::getCurrentUrl')), E_USER_DEPRECATED); return System::getCurrentUrl($args); }