本文整理汇总了PHP中System::getCurrentUri方法的典型用法代码示例。如果您正苦于以下问题:PHP System::getCurrentUri方法的具体用法?PHP System::getCurrentUri怎么用?PHP System::getCurrentUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System::getCurrentUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_block_form
/**
* Smarty function to wrap Zikula_Form_View generated form controls with suitable form tags.
*
* @param array $params Parameters passed in the block tag.
* @param string $content Content of the block.
* @param Zikula_Form_View $view Reference to Zikula_Form_View object.
*
* @return string The rendered output.
*/
function smarty_block_form($params, $content, $view)
{
if ($content) {
PageUtil::AddVar('stylesheet', 'system/ThemeModule/Resources/public/css/form/style.css');
$action = htmlspecialchars(System::getCurrentUri());
$classString = '';
$roleString = '';
if (isset($params['cssClass'])) {
$classString = "class=\"{$params['cssClass']}\" ";
}
if (isset($params['role'])) {
$roleString = "role=\"{$params['role']}\" ";
}
$enctype = array_key_exists('enctype', $params) ? $params['enctype'] : null;
// if enctype is not set directly, check whenever upload plugins were used;
// if so - set proper enctype for file upload
if (is_null($enctype)) {
$uploadPlugins = array_filter($view->plugins, function ($plugin) {
return $plugin instanceof Zikula_Form_Plugin_UploadInput;
});
if (!empty($uploadPlugins)) {
$enctype = 'multipart/form-data';
}
}
$encodingHtml = !is_null($enctype) ? " enctype=\"{$enctype}\"" : '';
$onSubmit = isset($params['onsubmit']) ? " onSubmit=\"{$params['onsubmit']}\"" : '';
$view->postRender();
$formId = $view->getFormId();
$out = "\n<form id=\"{$formId}\" {$roleString}{$classString}action=\"{$action}\" method=\"post\"{$encodingHtml}{$onSubmit}>\n {$content}\n <div>\n {$view->getStateHTML()}\n {$view->getStateDataHTML()}\n {$view->getIncludesHTML()}\n {$view->getCsrfTokenHtml()}\n <input type=\"hidden\" name=\"__formid\" id=\"form__id\" value=\"{$formId}\" />\n <input type=\"hidden\" name=\"FormEventTarget\" id=\"FormEventTarget\" value=\"\" />\n <input type=\"hidden\" name=\"FormEventArgument\" id=\"FormEventArgument\" value=\"\" />\n <script type=\"text/javascript\">\n <!--\n function FormDoPostBack(eventTarget, eventArgument)\n {\n var f = document.getElementById('{$formId}');\n if (!f.onsubmit || f.onsubmit()) {\n f.FormEventTarget.value = eventTarget;\n f.FormEventArgument.value = eventArgument;\n f.submit();\n }\n }\n // -->\n </script>\n </div>\n</form>\n";
return $out;
}
}
示例2: smarty_block_muboardform
/**
* Smarty function to wrap MUBoard_Form_View generated form controls with suitable form tags.
*
* @param array $params Parameters passed in the block tag.
* @param string $content Content of the block.
* @param Zikula_Form_View $view Reference to Zikula_Form_View object.
*
* @return string The rendered output.
*/
function smarty_block_muboardform($params, $content, $view)
{
if ($content) {
PageUtil::addVar('stylesheet', 'system/Theme/style/form/style.css');
$encodingHtml = array_key_exists('enctype', $params) ? " enctype=\"{$params['enctype']}\"" : '';
$action = htmlspecialchars(System::getCurrentUri());
$classString = '';
if (isset($params['cssClass'])) {
$classString = "class=\"{$params['cssClass']}\" ";
}
$request = new Zikula_Request_Http();
$id = $request->getGet()->filter('id', 0, FILTER_SANITIZE_NUMBER_INT);
$forumid = $request->getGet()->filter('forum', 0, FILTER_SANITIZE_NUMBER_INT);
// we check if the entrypoint is part of the url
$stripentrypoint = ModUtil::getVar('ZConfig', 'shorturlsstripentrypoint');
// get url name
$tables = DBUtil::getTables();
$modcolumn = $tables['modules_column'];
$module = 'MUBoard';
$where = "{$modcolumn['name']} = '" . DataUtil::formatForStore($module) . "'";
$module = DBUtil::selectObject('modules', $where);
$urlname = $module['url'];
if (ModUtil::getVar('ZConfig', 'shorturls') == 0) {
if (strpos($action, "func=display") !== false) {
$action = 'index.php?module=' . $urlname . '&type=user&func=edit&ot=posting&answer=1';
}
if (strpos($action, "func=edit&ot=posting") !== false && $forumid > 0) {
$action = 'index.php?module=' . $urlname . '&type=user&func=edit&ot=posting&forum' . $forumid;
}
} else {
if (strpos($action, $urlname . "/posting/id.") !== false) {
if ($stripentrypoint == 1) {
$action = $urlname . '/edit/ot/posting/answer/1';
} elseif ($stripentrypoint == 0) {
$action = 'index.php/' . $urlname . '/edit/ot/posting/answer/1';
}
}
if (strpos($action, "edit/ot/posting/forum/") !== false && $forumid > 0) {
if ($stripentrypoint == 1) {
$action = $urlname . '/edit/ot/posting/forum/' . $forumid;
} elseif ($stripentrypoint == 0) {
$action = 'index.php/' . $urlname . '/edit/ot/posting/forum/' . $forumid;
}
}
}
$view->postRender();
$formId = $view->getFormId();
$out = "\n <form id=\"{$formId}\" {$classString}action=\"{$action}\" method=\"post\"{$encodingHtml}>\n {$content}\n <div>\n {$view->getStateHTML()}\n {$view->getStateDataHTML()}\n {$view->getIncludesHTML()}\n {$view->getCsrfTokenHtml()}\n <input type=\"hidden\" name=\"__formid\" id=\"form__id\" value=\"{$formId}\" />\n <input type=\"hidden\" name=\"FormEventTarget\" id=\"FormEventTarget\" value=\"\" />\n <input type=\"hidden\" name=\"FormEventArgument\" id=\"FormEventArgument\" value=\"\" />\n <script type=\"text/javascript\">\n <!--\n function FormDoPostBack(eventTarget, eventArgument)\n {\n var f = document.getElementById('{$formId}');\n if (!f.onsubmit || f.onsubmit())\n {\n f.FormEventTarget.value = eventTarget;\n f.FormEventArgument.value = eventArgument;\n f.submit();\n }\n }\n // -->\n </script>\n </div>\n </form>\n ";
return $out;
}
}
示例3: smarty_function_getcurrenturi
/**
* Zikula_View function to obtain current URI
*
* This function obtains the current request URI.
* Unlike the API function getcurrenturi, 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
* - and any additional ones to override for the current request
*
* Example
* {getcurrenturi}
* {getcurrenturi 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 URI.
*/
function smarty_function_getcurrenturi($params, Zikula_View $view)
{
$assign = null;
if (isset($params['assign'])) {
$assign = $params['assign'];
unset($params['assign']);
}
$result = htmlspecialchars(System::getCurrentUri($params));
if ($assign) {
$view->assign($assign, $result);
} else {
return $result;
}
}
示例4: smarty_block_form
/**
* Smarty function to wrap Zikula_Form_View generated form controls with suitable form tags.
*
* @param array $params Parameters passed in the block tag.
* @param string $content Content of the block.
* @param Zikula_Form_View $view Reference to Zikula_Form_View object.
*
* @return string The rendered output.
*/
function smarty_block_form($params, $content, $view)
{
if ($content) {
PageUtil::addVar('stylesheet', 'system/Theme/style/form/style.css');
$encodingHtml = array_key_exists('enctype', $params) ? " enctype=\"{$params['enctype']}\"" : '';
$action = htmlspecialchars(System::getCurrentUri());
$classString = '';
if (isset($params['cssClass'])) {
$classString = "class=\"{$params['cssClass']}\" ";
}
$view->postRender();
$formId = $view->getFormId();
$out = "\n<form id=\"{$formId}\" {$classString}action=\"{$action}\" method=\"post\"{$encodingHtml}>\n {$content}\n <div>\n {$view->getStateHTML()}\n {$view->getStateDataHTML()}\n {$view->getIncludesHTML()}\n {$view->getCsrfTokenHtml()}\n <input type=\"hidden\" name=\"__formid\" id=\"form__id\" value=\"{$formId}\" />\n <input type=\"hidden\" name=\"FormEventTarget\" id=\"FormEventTarget\" value=\"\" />\n <input type=\"hidden\" name=\"FormEventArgument\" id=\"FormEventArgument\" value=\"\" />\n <script type=\"text/javascript\">\n <!--\n function FormDoPostBack(eventTarget, eventArgument)\n {\n var f = document.getElementById('{$formId}');\n if (!f.onsubmit || f.onsubmit())\n {\n f.FormEventTarget.value = eventTarget;\n f.FormEventArgument.value = eventArgument;\n f.submit();\n }\n }\n // -->\n </script>\n </div>\n</form>\n";
return $out;
}
}
示例5: renderFormTag
public function renderFormTag($params, $content, \Zikula_View $view)
{
if ($content) {
if (isset($params['attr']['class'])) {
$params['attr']['class'] .= ' z-form';
} else {
$params['attr']['class'] = 'z-form';
}
$html = '<form action="' . htmlspecialchars(\System::getCurrentUri()) . '" method="post" ' . $this->renderEnctype(array('form' => $params['form']));
foreach ($params['attr'] as $k => $v) {
$html .= ' ' . $k . '="' . $v . '"';
}
$html .= '>' . $content . '</form>';
return $html;
}
}
示例6: smarty_function_langchange
/**
* 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;
}
}
示例7: smarty_function_userlogin
/**
* Zikula_View function to display the login box
*
* Example
* {userlogin size=14 maxlength=25 maxlengthpass=20}
*
* Parameters:
* size Size of text boxes (default=14)
* maxlength Maximum length of text box for unamees (default=25)
* maxlengthpass Maximum length of text box for password (default=20)
* class Name of class assigned to the login form
* value The default value of the username input box
* js Use javascript to automatically clear the default value (defaults to true)
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @see function.userlogin.php::smarty_function_userlogin()
*
* @return string The welcome message.
*/
function smarty_function_userlogin($params, Zikula_View $view)
{
$assign = isset($params['assign']) ? $params['assign'] : false;
if (!UserUtil::isLoggedIn()) {
// set some defaults
$size = isset($params['size']) ? $params['size'] : 14;
$maxlength = isset($params['maxlength']) ? $params['maxlength'] : 25;
$maxlengthpass = isset($params['maxlenthpass']) ? $params['maxlenthpass'] : 20;
$class = isset($params['class']) ? ' class="' . $params['class'] . '"' : '';
if (ModUtil::getVar(Users_Constant::MODNAME, Users_Constant::MODVAR_LOGIN_METHOD, Users_Constant::LOGIN_METHOD_UNAME) == Users_Constant::LOGIN_METHOD_EMAIL) {
$value = isset($params['value']) ? DataUtil::formatForDisplay($params['value']) : __('E-mail address');
$userNameLabel = __('E-mail address');
$methodName = 'email';
} else {
$value = isset($params['value']) ? DataUtil::formatForDisplay($params['value']) : __('User name');
$userNameLabel = __('User name');
$methodName = 'uname';
}
if (!isset($params['js']) || $params['js']) {
$js = ' onblur="if (this.value==\'\')this.value=\'' . $value . '\';" onfocus="if (this.value==\'' . $value . '\')this.value=\'\';"';
} else {
$js = '';
}
// determine the current url so we can return the user to the correct place after login
$returnurl = System::getCurrentUri();
$csrftoken = SecurityUtil::generateCsrfToken();
$loginbox = '<form' . $class . ' style="display:inline" action="' . DataUtil::formatForDisplay(ModUtil::url('Users', 'user', 'login')) . '" method="post"><div>' . "\n" . '<input type="hidden" name="csrftoken" value="' . $csrftoken . '" />' . "\n" . '<input type="hidden" name="authentication_method[modname]" value="Users" />' . "\n" . '<input type="hidden" name="authentication_method[method]" value="' . $methodName . '" />' . "\n" . '<label for="userlogin_plugin_uname">' . $userNameLabel . '</label> ' . "\n" . '<input type="text" name="authentication_info[login_id]" id="userlogin_plugin_uname" size="' . $size . '" maxlength="' . $maxlength . '" value="' . $value . '"' . $js . ' />' . "\n" . '<label for="userlogin_plugin_pass">' . __('Password') . '</label> ' . "\n" . '<input type="password" name="authentication_info[pass]" id="userlogin_plugin_pass" size="' . $size . '" maxlength="' . $maxlengthpass . '" />' . "\n";
if (System::getVar('seclevel') != 'high') {
$loginbox .= '<input type="checkbox" value="1" name="rememberme" id="userlogin_plugin_rememberme" />' . "\n" . '<label for="userlogin_plugin_rememberme">' . __('Remember me') . '</label> ' . "\n";
}
$loginbox .= '<input type="hidden" name="returnurl" value="' . DataUtil::formatForDisplay($returnurl) . '" />' . "\n" . '<input type="submit" value="' . __('Log in') . '" />' . "\n" . '</div></form>' . "\n";
} else {
$loginbox = '';
}
if ($assign) {
$view->assign($assign, $loginbox);
} else {
return $loginbox;
}
}
示例8: _base_vars
/**
* Assign template vars for base theme paths and other useful variables.
*
* @return void
*/
private function _base_vars()
{
// identify the page type
$this->pagetype = 'module';
if (stristr(System::serverGetVar('PHP_SELF'), 'admin.php') || strtolower($this->type) == 'admin') {
$this->pagetype = 'admin';
} else {
$module = FormUtil::getPassedValue('module', null, 'GETPOST', FILTER_SANITIZE_STRING);
if (empty($module)) {
$this->pagetype = 'home';
}
}
// set some basic class variables from Zikula
$this->isloggedin = UserUtil::isLoggedIn();
$this->uid = UserUtil::getVar('uid');
// assign the query string
$this->qstring = System::serverGetVar('QUERY_STRING', '');
// assign the current script
$this->requesturi = System::getCurrentUri();
// define the cache_id if not set yet
if ($this->caching && !$this->cache_id) {
// module / type / function / customargs|homepage/startpageargs / uid_X|guest
$this->cache_id = $this->toplevelmodule . '/' . $this->type . '/' . $this->func . (!$this->homepage ? $this->_get_customargs() : '/homepage/' . str_replace(',', '/', System::getVar('startargs'))) . '/' . UserUtil::getUidCacheString();
}
// assign some basic paths for the engine
$this->template_dir = $this->themepath . '/templates';
// default directory for templates
$this->themepath = 'themes/' . $this->directory;
$theme = ThemeUtil::getTheme($this->name);
if (null === $theme) {
$this->imagepath = $this->themepath . '/images';
$this->imagelangpath = $this->themepath . '/images/' . $this->language;
$this->stylepath = $this->themepath . '/style';
$this->scriptpath = $this->themepath . '/javascript';
} else {
$this->imagepath = $this->themepath . '/Resources/public/images';
$this->imagelangpath = $this->themepath . '/Resources/public/images/' . $this->language;
$this->stylepath = $this->themepath . '/Resources/public/css';
$this->scriptpath = $this->themepath . '/Resources/public/js';
}
// make the base vars available to all templates
$this->assign('module', $this->toplevelmodule)->assign('uid', $this->uid)->assign('loggedin', $this->isloggedin)->assign('pagetype', $this->pagetype)->assign('themepath', $this->themepath)->assign('imagepath', $this->imagepath)->assign('imagelangpath', $this->imagelangpath)->assign('stylepath', $this->stylepath)->assign('scriptpath', $this->scriptpath);
// load the theme variables
$variables = ModUtil::apiFunc('ZikulaThemeModule', 'user', 'getvariables', array('theme' => $this->name));
$this->assign($variables['variables']);
}
示例9: display
/**
* Display the output of the login block.
*
* @param array $blockInfo A blockinfo structure.
*
* @return string The output.
*/
public function display($blockInfo)
{
$renderedOutput = '';
if (SecurityUtil::checkPermission('Loginblock::', $blockInfo['title'].'::', ACCESS_READ)) {
if (!UserUtil::isLoggedIn()) {
if (empty($blockInfo['title'])) {
$blockInfo['title'] = DataUtil::formatForDisplay('Login');
}
$authenticationMethodList = new Users_Helper_AuthenticationMethodList($this);
if ($authenticationMethodList->countEnabledForAuthentication() > 1) {
$selectedAuthenticationMethod = $this->request->request->get('authentication_method', false);
} else {
// There is only one (or there is none), so auto-select it.
$authenticationMethod = $authenticationMethodList->getAuthenticationMethodForDefault();
$selectedAuthenticationMethod = array(
'modname' => $authenticationMethod->modname,
'method' => $authenticationMethod->method,
);
}
// TODO - The order and availability should be set by block configuration
$authenticationMethodDisplayOrder = array();
foreach ($authenticationMethodList as $authenticationMethod) {
if ($authenticationMethod->isEnabledForAuthentication()) {
$authenticationMethodDisplayOrder[] = array(
'modname' => $authenticationMethod->modname,
'method' => $authenticationMethod->method,
);
}
}
$this->view->assign('authentication_method_display_order', $authenticationMethodDisplayOrder)
->assign('selected_authentication_method', $selectedAuthenticationMethod);
// If the current page was reached via a POST or FILES then we don't want to return here.
// Only return if the current page was reached via a regular GET
if ($this->request->isGet()) {
$this->view->assign('returnpage', System::getCurrentUri());
} else {
$this->view->assign('returnpage', '');
}
$tplName = mb_strtolower("users_block_login_{$blockInfo['position']}.tpl");
if ($this->view->template_exists($tplName)) {
$blockInfo['content'] = $this->view->fetch($tplName);
} else {
$blockInfo['content'] = $this->view->fetch('users_block_login.tpl');
}
$renderedOutput = BlockUtil::themeBlock($blockInfo);
}
}
return $renderedOutput;
}
示例10: checkpermissions
/**
* Check permissions.
*
* @return boolean
*/
public function checkpermissions()
{
$username = FormUtil::getPassedValue('username', null, 'POST');
$returnto = FormUtil::getPassedValue('returnto', System::getCurrentUri(), 'POST');
$this->redirect($returnto);
}
示例11: dispatch
public function dispatch(Request $request)
{
$module = $request->attributes->get('_module');
$type = $request->attributes->get('_controller');
$func = $request->attributes->get('_action');
$arguments = array();
// process the homepage
if (!$module) {
// set the start parameters
$module = \System::getVar('startpage');
$type = \System::getVar('starttype');
$func = \System::getVar('startfunc');
$args = explode(',', \System::getVar('startargs'));
foreach ($args as $arg) {
if (!empty($arg)) {
$argument = explode('=', $arg);
$arguments[$argument[0]] = $argument[1];
}
}
}
// get module information
$modinfo = \ModUtil::getInfoFromName($module);
// we need to force the mod load if we want to call a modules interactive init
// function because the modules is not active right now
if ($modinfo) {
$module = $modinfo['url'];
if ($type == 'init' || $type == 'interactiveinstaller') {
\ModUtil::load($modinfo['name'], $type, true);
}
}
$httpCode = 404;
$message = '';
$debug = null;
$return = false;
$e = null;
try {
if (empty($module)) {
// we have a static homepage
return new Response();
} elseif ($modinfo) {
// call the requested/homepage module
$return = \ModUtil::func($modinfo['name'], $type, $func, $arguments);
}
if (!$return) {
// hack for BC since modules currently use ModUtil::func without expecting exceptions
// if a controller is not found the API will return false.
throw new \Zikula\Framework\Exception\NotFoundException(__('Page not found.'));
}
return $return;
} catch (\Exception $e) {
if ($e instanceof \Zikula\Framework\Exception\NotFoundException) {
$httpCode = 404;
$message = $e->getMessage();
$debug = array_merge($e->getDebug(), $e->getTrace());
} elseif ($e instanceof \Zikula\Framework\Exception\ForbiddenException) {
$httpCode = 403;
$message = $e->getMessage();
$debug = array_merge($e->getDebug(), $e->getTrace());
} elseif ($e instanceof \Zikula\Framework\Exception\RedirectException) {
return new RedirectResponse($e->getUrl(), array(), $e->getType());
} elseif ($e instanceof \Exception) {
// general catch all
$httpCode = 500;
$message = $e->getMessage();
$debug = $e->getTrace();
}
}
switch (true) {
case $httpCode == 403:
if (!\UserUtil::isLoggedIn()) {
$url = \ModUtil::url('Users', 'user', 'login', array('returnpage' => urlencode(\System::getCurrentUri())));
return \LogUtil::registerError(\LogUtil::getErrorMsgPermission(), $httpCode, $url);
}
// there is no break here deliberately.
// there is no break here deliberately.
case $return === false:
$session = \ServiceUtil::get('session');
if (!$session->getFlashBag()->has(\Zikula_Session::MESSAGE_ERROR)) {
\LogUtil::registerError(__f('Could not load the \'%1$s\' module at \'%2$s\'.', array($module, $func)), $httpCode, null);
}
return \ModUtil::func('ErrorsModule', 'user', 'index', array('message' => $message, 'exception' => $e));
break;
default:
\LogUtil::registerError(__f('The \'%1$s\' module returned an error in \'%2$s\'.', array($module, $func)), $httpCode, null);
return \ModUtil::func('ErrorsModule', 'user', 'index', array('message' => $message, 'exception' => $e));
break;
}
}
示例12: bindDomain
/**
* Bind domain.
*
* @param string $domain Gettext domain.
* @param string $path Domain path.
*
* @return boolean
*/
public static function bindDomain($domain, $path)
{
$_this = self::getInstance();
$locale = $_this->getLocale();
if (!$locale) {
// fallback solution to be replaced by proper routing
$defaultLocale = System::getVar('language_i18n', 'en');
if (System::getVar('shorturls')) {
// we need to extract the language code from current url, since it is not ensured
// that System::queryStringDecode() has been executed already
$customentrypoint = System::getVar('entrypoint');
$expectEntrypoint = !System::getVar('shorturlsstripentrypoint');
$root = empty($customentrypoint) ? 'index.php' : $customentrypoint;
// get base path to work out our current url
$parsedURL = parse_url(System::getCurrentUri());
$tobestripped = array(System::getBaseUri(), "{$root}");
$path = str_replace($tobestripped, '', $parsedURL['path']);
$path = trim($path, '/');
// split the path into a set of argument strings
$args = explode('/', rtrim($path, '/'));
// ensure that each argument is properly decoded
foreach ($args as $k => $v) {
$args[$k] = urldecode($v);
}
if (isset($args[0]) && self::isLangParam($args[0]) && in_array($args[0], self::getInstalledLanguages())) {
$defaultLocale = $args[0];
}
}
$_this->setLocale($defaultLocale);
$locale = $_this->getLocale();
}
// exit if the language system hasnt yet fully initialised
if (!$locale) {
return false;
}
// prevent double loading
if (array_key_exists($domain, $_this->domainCache[$locale])) {
return true;
}
ZGettext::getInstance()->bindTextDomain($domain, $path);
ZGettext::getInstance()->bindTextDomainCodeset($domain, $_this->encoding);
$_this->domainCache[$locale][$domain] = true;
return $_this->domainCache[$locale][$domain];
}
示例13: phpBBcall
public function phpBBcall($args)
{
$this->throwForbiddenUnless(SecurityUtil::checkPermission('ZphpBB2::', '::', ACCESS_ADMIN), LogUtil::getErrorMsgPermission());
$url = System::getCurrentUri();
return $this->view->fetch('admin/call.tpl');
}
示例14: _processIdsResult
/**
* Process results from IDS scan.
*
* @param IDS_Init $init PHPIDS init object reference.
* @param IDS_Report $result The result object from PHPIDS.
*
* @return void
*/
private function _processIdsResult(IDS_Init $init, IDS_Report $result)
{
// $result contains any suspicious fields enriched with additional info
// Note: it is moreover possible to dump this information by simply doing
//"echo $result", calling the IDS_Report::$this->__toString() method implicitely.
$requestImpact = $result->getImpact();
if ($requestImpact < 1) {
// nothing to do
return;
}
// update total session impact to track an attackers activity for some time
$sessionImpact = SessionUtil::getVar('idsImpact', 0) + $requestImpact;
SessionUtil::setVar('idsImpact', $sessionImpact);
// let's see which impact mode we are using
$idsImpactMode = System::getVar('idsimpactmode', 1);
$idsImpactFactor = 1;
if ($idsImpactMode == 1) {
$idsImpactFactor = 1;
} elseif ($idsImpactMode == 2) {
$idsImpactFactor = 10;
} elseif ($idsImpactMode == 3) {
$idsImpactFactor = 5;
}
// determine our impact threshold values
$impactThresholdOne = System::getVar('idsimpactthresholdone', 1) * $idsImpactFactor;
$impactThresholdTwo = System::getVar('idsimpactthresholdtwo', 10) * $idsImpactFactor;
$impactThresholdThree = System::getVar('idsimpactthresholdthree', 25) * $idsImpactFactor;
$impactThresholdFour = System::getVar('idsimpactthresholdfour', 75) * $idsImpactFactor;
$usedImpact = ($idsImpactMode == 1) ? $requestImpact : $sessionImpact;
// react according to given impact
if ($usedImpact > $impactThresholdOne) {
// db logging
// determine IP address of current user
$_REMOTE_ADDR = System::serverGetVar('REMOTE_ADDR');
$_HTTP_X_FORWARDED_FOR = System::serverGetVar('HTTP_X_FORWARDED_FOR');
$ipAddress = ($_HTTP_X_FORWARDED_FOR) ? $_HTTP_X_FORWARDED_FOR : $_REMOTE_ADDR;
$currentPage = System::getCurrentUri();
$currentUid = UserUtil::getVar('uid');
$intrusionItems = array();
foreach ($result as $event) {
$eventName = $event->getName();
$malVar = explode(".", $eventName, 2);
$filters = array();
foreach ($event as $filter) {
array_push($filters, array(
'id' => $filter->getId(),
'description' => $filter->getDescription(),
'impact' => $filter->getImpact(),
'tags' => $filter->getTags(),
'rule' => $filter->getRule()));
}
$tagVal = $malVar[1];
$newIntrusionItem = array(
'name' => array($eventName),
'tag' => $tagVal,
'value' => $event->getValue(),
'page' => $currentPage,
'uid' => $currentUid,
'ip' => $ipAddress,
'impact' => $result->getImpact(),
'filters' => serialize($filters),
'date' => DateUtil::getDatetime()
);
if (array_key_exists($tagVal, $intrusionItems)) {
$intrusionItems[$tagVal]['name'][] = $newIntrusionItem['name'][0];
} else {
$intrusionItems[$tagVal] = $newIntrusionItem;
}
}
// log details to database
foreach ($intrusionItems as $tag => $intrusionItem) {
$intrusionItem['name'] = implode(", ", $intrusionItem['name']);
// create new ZIntrusion instance
$obj = new SecurityCenter_DBObject_Intrusion();
//.........这里部分代码省略.........
示例15: isset
include $phpbb_root_path . 'extension.inc';
include $phpbb_root_path . 'common.' . $phpEx;
include $phpbb_root_path . 'includes/functions_post.' . $phpEx;
$topic = isset($_POST['topic']) ? $_POST['topic'] : $_GET['topic'];
$friendname = $_POST['friendname'];
$message = $_POST['message'];
// Begin PNphpBB2 Module
$link = System::getBaseUrl() . append_sid("viewtopic") . "&" . $_GET['link'];
// End PNphpBB2 Module
$PHP_SELF = $_SERVER['PHP_SELF'];
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
if (!$userdata['session_logged_in']) {
// ZphpBB2 - use Zikula login and redirect
//redirect(append_sid("login.$phpEx?redirect=tellafriend.$phpEx&topic=$topic_title&link=" . POST_TOPIC_URL . "=$topic_id", true));
System::redirect(ModUtil::url('Users', 'user', 'login', array('returnpage' => urlencode(System::getCurrentUri()))));
// <= ZphpBB2
}
$mail_body = str_replace("{TOPIC}", trim(stripslashes($topic)), $lang['Tell_Friend_Body']);
$mail_body = str_replace("{LINK}", $link, $mail_body);
$mail_body = str_replace("{SITENAME}", $board_config['sitename'], $mail_body);
$template->assign_vars(array('L_TELL_FRIEND_TITLE' => $lang['Tell_Friend_Title'], 'L_TELL_FRIEND_EMAIL_MESSAGE' => $lang['Tell_Friend_Email_Message'], 'L_TELL_FRIEND_SENDER_USER' => $lang['Tell_Friend'], 'L_TELL_FRIEND_SENDER_USER' => $lang['Tell_Friend_Sender_User'], 'L_TELL_FRIEND_SENDER_EMAIL' => $lang['Tell_Friend_Sender_Email'], 'L_TELL_FRIEND_RECIEVER_USER' => $lang['Tell_Friend_Reciever_User'], 'L_TELL_FRIEND_RECIEVER_EMAIL' => $lang['Tell_Friend_Reciever_Email'], 'L_TELL_FRIEND_MSG' => $lang['Tell_Friend_Msg'], 'L_TELL_FRIEND_BODY' => $mail_body, 'SUBMIT_ACTION' => append_sid("tellafriend"), 'L_SUBMIT' => $lang['Send_email'], 'SITENAME' => $board_config['sitename'], 'TOPIC' => trim(stripslashes($topic)), 'LINK' => $link, 'SENDER_NAME' => DataUtil::formatForDisplay($userdata['username']), 'SENDER_MAIL' => $userdata['user_email']));
if (isset($_POST['submit'])) {
$error = FALSE;
if (!empty($_POST['friendemail']) && strpos($_POST['friendemail'], "@") > 0) {
$friendemail = trim(stripslashes($_POST['friendemail']));
if (!$_POST['friendname']) {
$friendname = substr($friendemail, 0, strpos($_POST['friendemail'], "@"));
}
} else {
$error = TRUE;