本文整理汇总了PHP中jApp::coord方法的典型用法代码示例。如果您正苦于以下问题:PHP jApp::coord方法的具体用法?PHP jApp::coord怎么用?PHP jApp::coord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jApp
的用法示例。
在下文中一共展示了jApp::coord方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeAction
/**
* @param array $params plugin parameters for the current action
* @return null or jSelectorAct if action should change
*/
public function beforeAction($params)
{
$selector = null;
$aclok = true;
if (isset($params['jacl.right'])) {
$aclok = jAcl::check($params['jacl.right'][0], $params['jacl.right'][1]);
} elseif (isset($params['jacl.rights.and'])) {
$aclok = true;
foreach ($params['jacl.rights.and'] as $right) {
if (!jAcl::check($right[0], $right[1])) {
$aclok = false;
break;
}
}
} elseif (isset($params['jacl.rights.or'])) {
$aclok = false;
foreach ($params['jacl.rights.or'] as $right) {
if (jAcl::check($right[0], $right[1])) {
$aclok = true;
break;
}
}
}
if (!$aclok) {
if (jApp::coord()->request->isAjax() || $this->config['on_error'] == 1 || !jApp::coord()->request->isAllowedResponse('jResponseRedirect')) {
throw new jException($this->config['error_message']);
} else {
$selector = new jSelectorAct($this->config['on_error_action']);
}
}
return $selector;
}
示例2: jtpl_function_html_breadcrumb
/**
* @package jelix
* @subpackage jtpl_plugin
* @author Lepeltier kévin
* @contributor Dominique Papin
* @copyright 2008 Lepeltier kévin, 2008 Dominique Papin
* @link http://www.jelix.org
* @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
*/
function jtpl_function_html_breadcrumb($tpl, $nb = null, $separator = '')
{
$plugin = jApp::coord()->getPlugin('history', true);
if ($plugin === null) {
return;
}
$config =& $plugin->config;
if (!isset($config['session_name']) || $config['session_name'] == '') {
$config['session_name'] = 'HISTORY';
}
if (!isset($_SESSION[$config['session_name']])) {
return;
}
echo '<ol class="history">';
$leng = count($_SESSION[$config['session_name']]);
$nb = $nb !== null ? count($_SESSION[$config['session_name']]) - $nb : 0;
$nb = $nb < 0 ? 0 : $nb;
for ($i = $nb; $i < $leng; $i++) {
$page = $_SESSION[$config['session_name']][$i];
echo '<li' . ($i == $nb ? ' class="first"' : ($i == $leng - 1 ? ' class="end"' : '')) . '>';
if ($i != $leng - 1) {
echo '<a href="' . jUrl::get($page['action'], $page['params'], jUrl::XMLSTRING) . '" ' . ($page['title'] != '' ? 'title="' . $page['title'] . '"' : '') . '>';
}
echo $_SESSION[$config['session_name']][$i]['label'];
if ($i != $leng - 1) {
echo '</a>';
}
echo ($i == $leng - 1 ? '' : $separator) . '</li>';
}
echo '</ol>';
}
示例3: getBasePath
protected function getBasePath($requestType, $module = null, $action = null)
{
if ($this->urlhttps == null) {
$this->urlhttps = array();
$selectors = preg_split("/[\\s,]+/", jApp::config()->urlengine['simple_urlengine_https']);
foreach ($selectors as $sel2) {
$this->urlhttps[$sel2] = true;
}
}
$usehttps = false;
if (count($this->urlhttps)) {
if ($action && isset($this->urlhttps[$module . '~' . $action . '@' . $requestType])) {
$usehttps = true;
} elseif ($module && isset($this->urlhttps[$module . '~*@' . $requestType])) {
$usehttps = true;
} elseif (isset($this->urlhttps['@' . $requestType])) {
$usehttps = true;
}
}
if ($usehttps) {
return jApp::coord()->request->getServerURI(true) . jApp::config()->urlengine['basePath'];
} else {
return jApp::config()->urlengine['basePath'];
}
}
示例4: outputMetaContent
public function outputMetaContent($t)
{
$resp = jApp::coord()->response;
if ($resp === null || $resp->getType() != 'html') {
return;
}
$confUrlEngine =& jApp::config()->urlengine;
$www = $confUrlEngine['jelixWWWPath'];
$jq = $confUrlEngine['jqueryPath'];
$resp->addJSLink($jq . 'jquery.js');
$resp->addJSLink($jq . 'include/jquery.include.js');
$resp->addJSLink($www . 'js/jforms_jquery.js');
$resp->addCSSLink($www . 'design/jform.css');
//we loop on root control has they fill call the outputMetaContent recursively
foreach ($this->_form->getRootControls() as $ctrlref => $ctrl) {
if ($ctrl->type == 'hidden') {
continue;
}
if (!$this->_form->isActivated($ctrlref)) {
continue;
}
$widget = $this->getWidget($ctrl, $this->rootWidget);
$widget->outputMetaContent($resp);
}
}
示例5: index
/**
* handle the search of specific member
*/
function index()
{
$title = stripslashes(jApp::config()->havefnubb['title']);
$rep = $this->getResponse('html');
$letter = $this->param('letter');
$id_rank = (int) $this->param('id_rank');
$memberSearch = (string) $this->param('member_search');
$page = 0;
$page = (int) $this->param('page');
// get the group name of the group id we request
$grpid = $this->param('grpid');
$groupname = jLocale::get('havefnubb~member.memberlist.allgroups');
if ($grpid != '__anonymous') {
$dao = jDao::get('jacl2db~jacl2group');
$grpname = $dao->get($grpid);
$groupname = $grpname->name;
}
$beginningBy = '';
if (strlen($letter) == 1) {
$beginningBy = ' - ' . jLocale::get('havefnubb~member.memberlist.members.beginning.by', array($letter));
}
// change the label of the breadcrumb
if ($page == 0) {
jApp::coord()->getPlugin('history')->change('label', jLocale::get('havefnubb~member.memberlist.members.list'));
$rep->title = jLocale::get('havefnubb~member.memberlist.members.list') . ' - ' . $groupname . $beginningBy;
} else {
jApp::coord()->getPlugin('history')->change('label', jLocale::get('havefnubb~member.memberlist.members.list') . ' ' . ($page + 1));
$rep->title = jLocale::get('havefnubb~member.memberlist.members.list') . ' - ' . $groupname . $beginningBy . ' ' . ($page + 1);
}
$rep->body->assignZone('MAIN', 'memberlist', array('page' => $page, 'grpid' => $grpid, 'letter' => $letter, 'memberSearch' => $memberSearch));
return $rep;
}
示例6: __construct
/**
* @param string $sel the selector
* @param boolean $enableRequestPart true if the selector can contain the request part
* @param boolean $toRetrieveUrl true if the goal to have this selector is to generate an url
*/
function __construct($sel, $enableRequestPart = false, $toRetrieveUrl = false)
{
$coord = jApp::coord();
$this->forUrl = $toRetrieveUrl;
// jSelectorAct is called by the url engine parser, before
// jcoordinator set its properties, so we set a value to avoid a
// parameter error on jelix_scan_action_sel. the value doesn't matter
// since the parser call jSelectorAct only for 404 page
if ($coord->actionName === null) {
$coord->actionName = 'default:index';
}
if ($this->_scan_act_sel($sel, $coord->actionName)) {
if ($this->module == '#') {
$this->module = $coord->moduleName;
} elseif ($this->module == '') {
$this->module = jApp::getCurrentModule();
}
if ($this->request == '' || !$enableRequestPart) {
$this->request = $coord->request->type;
}
$this->_createPath();
} else {
throw new jExceptionSelector('jelix~errors.selector.invalid.syntax', array($sel, $this->type));
}
}
示例7: _prepareTpl
protected function _prepareTpl()
{
$config = new \Jelix\JCommunity\Config();
$this->_tpl->assign('canRegister', $config->isRegistrationEnabled());
$this->_tpl->assign('canResetPassword', $config->isResetPasswordEnabled());
if (jAuth::isConnected()) {
$this->_tpl->assign('login', jAuth::getUserSession()->login);
} else {
$conf = jAuth::loadConfig();
$this->_tpl->assign('persistance_ok', jAuth::isPersistant());
$form = jForms::get("jcommunity~login");
if (!$form) {
$form = jForms::create("jcommunity~login");
}
$this->_tpl->assign('form', $form);
$this->_tpl->assign('url_return', '');
if ($conf['enable_after_login_override']) {
$req = jApp::coord()->request;
if ($req->getParam('auth_url_return')) {
$this->_tpl->assign('url_return', $req->getParam('auth_url_return'));
} else {
if ($this->param('as_main_content')) {
if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] && $_SERVER['HTTP_REFERER'] != jUrl::getCurrentUrl(false, true)) {
$this->_tpl->assign('url_return', $_SERVER['HTTP_REFERER']);
}
} else {
if ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') {
$this->_tpl->assign('url_return', jUrl::getCurrentUrl(false, true));
}
}
}
}
}
}
示例8: out
/**
*
*/
function out()
{
$rep = $this->getResponse('redirectUrl');
jAuth::logout();
$conf = jApp::coord()->getPlugin('auth')->config;
if ($conf['after_logout'] == '') {
throw new jException('jcommunity~login.error.no.auth_logout');
}
if (jApp::coord()->execOriginalAction()) {
if ($conf['enable_after_logout_override']) {
$url_return = $this->param('auth_url_return');
if ($url_return) {
$rep->url = $url_return;
} else {
$rep->url = jUrl::get($conf['after_logout']);
}
}
} else {
// we are here because of an internal redirection (authentication missing)
// if we can indicate the url to go after the login, let's pass this url
// to the next action (which is in most of case a login form)
if ($conf['enable_after_login_override']) {
$rep->url = jUrl::get($conf['after_logout'], array('auth_url_return' => jUrl::getCurrentUrl()));
} else {
$rep->url = jUrl::get($conf['after_logout']);
}
}
return $rep;
}
示例9: beforeAction
public function beforeAction($params)
{
if (isset($params['traceexec.log_session'])) {
$this->config['log_session'] = $params['traceexec.log_session'];
}
if (isset($params['traceexec.enabled'])) {
$this->config['enable_trace'] = $params['traceexec.enabled'];
}
if (isset($this->config['enable_trace']) && $this->config['enable_trace'] == true) {
$coord = jApp::coord();
$moduleName = $coord->moduleName;
$actionName = $coord->actionName;
$message = $moduleName . '~' . $actionName;
//Url
$message .= "\nUrl : " . $_SERVER['REQUEST_URI'];
//Module & action
$message .= "\nModule : " . $moduleName;
$message .= "\nAction : " . $actionName;
//Params
$r_params = $coord->request->params;
unset($r_params['module']);
unset($r_params['action']);
if (empty($r_params)) {
$message .= "\nNo params";
} else {
$message .= "\nParams : " . var_export($r_params, true);
}
//Session
if (isset($this->config['log_session']) && $this->config['log_session'] == true) {
$message .= "\nSession : " . var_export($_SESSION, true);
}
$message .= "\n";
jLog::log($message, 'trace');
}
}
示例10: jtpl_function_html_link_to_remote
/**
* function plugin : Ajax request
*
* it creates a javascript ajax function
* example :
* <pre>
* {link_to_remote
* 'Link', <!-- link label -->
* 'result', <!-- id dom for ajax result -->
* 'test~default:ajax', array('id'=>'34'), <!-- jurl request -->
* array(
* 'position'=>'html', <!-- html or append or prepend (default html) -->
* 'method'=>'GET', <!-- GET or POST (default POST) -->
* 'beforeSend'=>'alert("beforeSend")', <!-- JS script before send (default null) -->
* 'complete'=>'alert("complete")', <!-- JS script after send (default null)-->
* 'error'=>'alert("error")', <!-- JS if error (default null) -->
* )}
* <div id="result"></div>
* </pre>
*/
function jtpl_function_html_link_to_remote($tpl, $label, $element_id, $action_selector, $action_parameters, $option)
{
$resp = jApp::coord()->response;
static $id_link_to_remote = 0;
if ($resp && $resp->getFormatType() == 'html') {
// Add js link
$resp->addJSLink(jApp::config()->urlengine['jqueryPath'] . 'jquery.js');
}
$id_link_to_remote++;
$url = jUrl::get($action_selector, $action_parameters);
$position = array_key_exists("position", $option) ? $option['position'] : 'html';
$method = array_key_exists("method", $option) ? $option['method'] : 'GET';
$beforeSend = array_key_exists("beforeSend", $option) ? $option['beforeSend'] : '';
$complete = array_key_exists("complete", $option) ? $option['complete'] : '';
$error = array_key_exists("error", $option) ? $option['error'] : '';
// Link
echo '<a href="#" onclick="link_to_remote_' . $id_link_to_remote . '();">' . $label . "</a>\n";
// Script
echo '
<script type="text/javascript">//<![CDATA[
function link_to_remote_' . $id_link_to_remote . '() {
$.ajax({
type: \'' . $method . "',\n url: '" . $url . "',\n beforeSend: function(){" . $beforeSend . ";},\n complete: function(){" . $complete . ";},\n error: function(){" . $error . ';},
success: function(msg){
$(\'#' . $element_id . "')." . $position . "(msg);\n }\n });\n }; //]]>\n </script>";
}
示例11: beforeAction
/**
* @param array $params plugin parameters for the current action
* @return null or jSelectorAct if action should change
*/
public function beforeAction($params)
{
$langDetected = false;
$lang = '';
if ($this->config['enableUrlDetection']) {
$l = jApp::coord()->request->getParam($this->config['urlParamNameLanguage']);
if ($l !== null) {
$lang = jLocale::getCorrespondingLocale($l);
if ($lang != '') {
$langDetected = true;
}
}
}
if (!$langDetected) {
if (isset($_SESSION['JX_LANG'])) {
$lang = $_SESSION['JX_LANG'];
} else {
if ($this->config['useDefaultLanguageBrowser']) {
$lang = jLocale::getPreferedLocaleFromRequest();
}
}
}
if ($lang != '') {
$_SESSION['JX_LANG'] = $lang;
jApp::config()->locale = $lang;
}
return null;
}
示例12: outputMetaContent
public function outputMetaContent($t)
{
$resp = jApp::coord()->response;
if ($resp === null || $resp->getType() != 'html') {
return;
}
$confUrlEngine =& jApp::config()->urlengine;
$confHtmlEditor =& jApp::config()->htmleditors;
$confDate =& jApp::config()->datepickers;
$confWikiEditor =& jApp::config()->wikieditors;
$www = $confUrlEngine['jelixWWWPath'];
$jq = $confUrlEngine['jqueryPath'];
$bp = $confUrlEngine['basePath'];
$resp->addJSLink($jq . 'include/jquery.include.js');
$resp->addJSLink($www . 'js/jforms_jquery.js');
$resp->addCSSLink($www . 'design/jform.css');
foreach ($t->_vars as $k => $v) {
if (!$v instanceof jFormsBase) {
continue;
}
foreach ($v->getHtmlEditors() as $ed) {
if (isset($confHtmlEditor[$ed->config . '.engine.file'])) {
if (is_array($confHtmlEditor[$ed->config . '.engine.file'])) {
foreach ($confHtmlEditor[$ed->config . '.engine.file'] as $url) {
$resp->addJSLink($bp . $url);
}
} else {
$resp->addJSLink($bp . $confHtmlEditor[$ed->config . '.engine.file']);
}
}
if (isset($confHtmlEditor[$ed->config . '.config'])) {
$resp->addJSLink($bp . $confHtmlEditor[$ed->config . '.config']);
}
$skin = $ed->config . '.skin.' . $ed->skin;
if (isset($confHtmlEditor[$skin]) && $confHtmlEditor[$skin] != '') {
$resp->addCSSLink($bp . $confHtmlEditor[$skin]);
}
}
$datepicker_default_config = jApp::config()->forms['datepicker'];
foreach ($v->getControls() as $ctrl) {
if ($ctrl instanceof jFormsControlDate || get_class($ctrl->datatype) == 'jDatatypeDate' || get_class($ctrl->datatype) == 'jDatatypeLocaleDate') {
$config = isset($ctrl->datepickerConfig) ? $ctrl->datepickerConfig : $datepicker_default_config;
$resp->addJSLink($bp . $confDate[$config]);
}
}
foreach ($v->getWikiEditors() as $ed) {
if (isset($confWikiEditor[$ed->config . '.engine.file'])) {
$resp->addJSLink($bp . $confWikiEditor[$ed->config . '.engine.file']);
}
if (isset($confWikiEditor[$ed->config . '.config.path'])) {
$p = $bp . $confWikiEditor[$ed->config . '.config.path'];
$resp->addJSLink($p . jApp::config()->locale . '.js');
$resp->addCSSLink($p . 'style.css');
}
if (isset($confWikiEditor[$ed->config . '.skin'])) {
$resp->addCSSLink($bp . $confWikiEditor[$ed->config . '.skin']);
}
}
}
}
示例13: read_rss
/**
* display the RSS of the forum
*/
public function read_rss()
{
$ftitle = jUrl::escape($this->param('ftitle'), true);
$id_forum = (int) $this->param('id_forum');
if (!jAcl2::check('hfnu.posts.list', 'forum' . $id_forum)) {
$rep = $this->getResponse('redirect');
$rep->action = 'default:index';
return $rep;
}
if ($id_forum == 0) {
$rep = $this->getResponse('redirect');
$rep->action = 'default:index';
return $rep;
}
$forum = jClasses::getService('havefnubb~hfnuforum')->getForum($id_forum);
if (jUrl::escape($forum->forum_name, true) != $ftitle) {
$rep = $this->getResponse('redirect');
$rep->action = jApp::config()->urlengine['notfoundAct'];
return $rep;
}
jApp::coord()->getPlugin('history')->change('label', htmlentities($forum->forum_name, ENT_COMPAT, 'UTF-8'));
$feed_reader = new jFeedReader();
$feed_reader->setCacheDir(jApp::varPath('feeds'));
$feed_reader->setTimeout(2);
$feed_reader->setUserAgent('HaveFnuBB - http://www.havefnubb.org/');
$feed = $feed_reader->parse($forum->forum_url);
$rep = $this->getResponse('html');
$tpl = new jTpl();
$tpl->assign('feed', $feed);
$tpl->assign('forum', $forum);
$rep->title = $forum->forum_name;
$rep->body->assign('MAIN', $tpl->fetch('havefnubb~forum_rss.view'));
return $rep;
}
示例14: beforeAction
/**
* @param array $params plugin parameters for the current action
* @return null or jSelectorAct if action should change
*/
public function beforeAction($params)
{
$notLogged = false;
$badip = false;
$selector = null;
// Check if auth cookie exist and user isn't logged on
jAuth::checkCookieToken();
//Do we check the ip ?
if ($this->config['secure_with_ip']) {
if (!isset($_SESSION['JELIX_AUTH_SECURE_WITH_IP'])) {
$_SESSION['JELIX_AUTH_SECURE_WITH_IP'] = $this->_getIpForSecure();
} else {
if ($_SESSION['JELIX_AUTH_SECURE_WITH_IP'] != $this->_getIpForSecure()) {
session_destroy();
$selector = new jSelectorAct($this->config['bad_ip_action']);
$notLogged = true;
$badip = true;
}
}
}
//Creating the user's object if needed
if (!isset($_SESSION[$this->config['session_name']])) {
$notLogged = true;
$_SESSION[$this->config['session_name']] = new jAuthDummyUser();
} else {
$notLogged = !jAuth::isConnected();
}
if (!$notLogged && $this->config['timeout']) {
if (isset($_SESSION['JELIX_AUTH_LASTTIME'])) {
if (time() - $_SESSION['JELIX_AUTH_LASTTIME'] > $this->config['timeout'] * 60) {
$notLogged = true;
jAuth::logout();
unset($_SESSION['JELIX_AUTH_LASTTIME']);
} else {
$_SESSION['JELIX_AUTH_LASTTIME'] = time();
}
} else {
$_SESSION['JELIX_AUTH_LASTTIME'] = time();
}
}
$needAuth = isset($params['auth.required']) ? $params['auth.required'] == true : $this->config['auth_required'];
$authok = false;
if ($needAuth) {
if ($notLogged) {
if (jApp::coord()->request->isAjax() || $this->config['on_error'] == 1 || !jApp::coord()->request->isAllowedResponse('jResponseRedirect')) {
throw new jException($this->config['error_message']);
} else {
if (!$badip) {
$selector = new jSelectorAct($this->config['on_error_action']);
}
}
} else {
$authok = true;
}
} else {
$authok = true;
}
return $selector;
}
示例15: getDaoName
protected function getDaoName()
{
$plugin = jApp::coord()->getPlugin('auth');
if ($plugin === null) {
throw new jException('jelix~auth.error.plugin.missing');
}
return $plugin->config['Db']['dao'];
}