/** * Smarty plugin * * @package Smarty * @subpackage plugins */ function smarty_function_pagelink($params, &$smarty) { if (isset($params['delimiter'])) { $_delimiter = $params['delimiter']; unset($params['delimiter']); } else { $_delimiter = ':'; } $_current_querystring = \Sifo\FilterServer::getInstance()->getString('QUERY_STRING'); $_current_path = \Sifo\FilterServer::getInstance()->getString('REQUEST_URI'); if (!empty($_current_querystring)) { $_current_querystring = '?' . $_current_querystring; $_current_path = str_replace($_current_querystring, '', $_current_path); } $_current_url = array_reverse(explode($_delimiter, $_current_path)); if (is_numeric($_current_url[0])) { $_current_page = (int) array_shift($_current_url); } else { $_current_page = 1; } $_current_url = implode($_delimiter, array_reverse($_current_url)); if (!isset($params['page'])) { trigger_error("pagelink: You should provide the destination pagelink."); } else { if ($params['page'] > 1) { return $_current_url . $_delimiter . $params['page']; } else { return $_current_url; } } }
public function build() { if (!\Sifo\Domains::getInstance()->getDebugMode()) { throw new \Sifo\Exception_404('Only in debug mode'); } $this->setLayout('debug/mail.tpl'); if ($this->getParam('current_url') == $this->getUrl('mail-continue')) { $this->assign('mail_sent', true); $this->assign('result', $this->continueMail()); if (isset($this->mail_data['return_page'])) { $this->assign('return_page', $this->mail_data['return_page']); } } else { $new_mail_data = $this->getParam('mail_data'); if (\Sifo\FilterServer::getInstance()->getString('HTTP_REFERER')) { $new_mail_data['return_page'] = \Sifo\FilterServer::getInstance()->getString('HTTP_REFERER'); } // So it continue by clicking on the link: \Sifo\Session::getInstance()->set('mail_data', $new_mail_data); $this->assign('mail_data', $new_mail_data); $this->assign('continue_sending', $this->getUrl('mail-continue')); } }
private function _validateParams() { foreach ($this->command_options as $option) { $found = false; foreach ($this->_shell_common_params as $defined_option) { if ($option[0] == $defined_option['short_param_name'] || $option[0] == $defined_option['long_param_name']) { $found = true; if ($defined_option['need_second_param']) { if (!isset($option[1])) { $this->showMessage("Need define a param in for use '{$option['0']}' option."); $this->showHelp(); return false; } } break; } } if (!$found) { $this->showMessage("Error in options. Option '{$option['0']}' undefinded."); $this->showHelp(); return false; } } // Validating required options: foreach ($this->_shell_common_params as $defined_option) { if ($defined_option['is_required']) { $found = false; foreach ($this->command_options as $option) { if ($option[0] == $defined_option['short_param_name'] || $option[0] == $defined_option['long_param_name']) { $found = true; break; } } if (!$found) { $this->showMessage("Error: '" . $defined_option["long_param_name"] . "' required option not found."); $this->showHelp(); return false; } } } $argv = \Sifo\FilterServer::getInstance()->getArray('argv'); preg_match("/([^\\/]+)\$/", $argv[0], $matchs); $this->_script_name = $matchs[0]; $this->_domain_name = $argv[1]; return true; }