当前位置: 首页>>代码示例>>PHP>>正文


PHP Jaws_Utils::getRequestURL方法代码示例

本文整理汇总了PHP中Jaws_Utils::getRequestURL方法的典型用法代码示例。如果您正苦于以下问题:PHP Jaws_Utils::getRequestURL方法的具体用法?PHP Jaws_Utils::getRequestURL怎么用?PHP Jaws_Utils::getRequestURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Jaws_Utils的用法示例。


在下文中一共展示了Jaws_Utils::getRequestURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ShowNoPermission

 /**
  * Builds the NoPermission UI
  *
  * @access  public
  * @param   string  $user    Username
  * @param   string  $gadget  The Gadget user is requesting
  * @param   string  $action  The 'denied' action
  * @return  string  XHTML content
  */
 function ShowNoPermission($user, $gadget, $action)
 {
     // Load the template
     $tpl = $this->gadget->template->load('NoPermission.html');
     $tpl->SetBlock('NoPermission');
     $tpl->SetVariable('nopermission', _t('USERS_NO_PERMISSION_TITLE'));
     $tpl->SetVariable('description', _t('USERS_NO_PERMISSION_DESC', $gadget, $action));
     $tpl->SetVariable('admin_script', BASE_SCRIPT);
     $tpl->SetVariable('site-name', $this->gadget->registry->fetch('site_name', 'Settings'));
     $tpl->SetVariable('site-slogan', $this->gadget->registry->fetch('site_slogan', 'Settings'));
     $tpl->SetVariable('BASE_URL', $GLOBALS['app']->GetSiteURL('/'));
     $tpl->SetVariable('.dir', _t('GLOBAL_LANG_DIRECTION') == 'rtl' ? '.rtl' : '');
     if ($GLOBALS['app']->Session->Logged()) {
         $tpl->SetBlock('NoPermission/known');
         $logoutLink = $this->gadget->urlMap('Logout');
         $referLink = empty($_SERVER['HTTP_REFERER']) ? $GLOBALS['app']->getSiteURL('/') : Jaws_XSS::filter($_SERVER['HTTP_REFERER']);
         $tpl->SetVariable('known_description', _t('USERS_NO_PERMISSION_KNOWN_DESC', $logoutLink, $referLink));
         $tpl->ParseBlock('NoPermission/known');
     } else {
         $tpl->SetBlock('NoPermission/anon');
         $loginLink = $this->gadget->urlMap('LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(false))));
         $referLink = empty($_SERVER['HTTP_REFERER']) ? $GLOBALS['app']->getSiteURL('/') : Jaws_XSS::filter($_SERVER['HTTP_REFERER']);
         $tpl->SetVariable('anon_description', _t('USERS_NO_PERMISSION_ANON_DESC', $loginLink, $referLink));
         $tpl->ParseBlock('NoPermission/anon');
     }
     $tpl->ParseBlock('NoPermission');
     return $tpl->Get();
 }
开发者ID:juniortux,项目名称:jaws,代码行数:37,代码来源:Default.php

示例2: Display

 /**
  * Displays the emblems
  *
  * @access  public
  * @return  string   XHTML UI
  */
 function Display()
 {
     $tpl = $this->gadget->template->load('Emblems.html');
     $tpl->SetBlock('emblems');
     $tpl->SetVariable('title', _t('EMBLEMS_ACTION_TITLE'));
     $model = $this->gadget->model->load('Emblems');
     $emblems = $model->GetEmblems(true);
     if (!Jaws_Error::IsError($emblems)) {
         $site = urlencode(Jaws_Utils::getBaseURL('/', false));
         $page = urlencode(Jaws_Utils::getRequestURL(false));
         $name = urlencode($this->gadget->registry->fetch('site_name', 'Settings'));
         $slogan = urlencode($this->gadget->registry->fetch('site_slogan', 'Settings'));
         $title = $GLOBALS['app']->Layout->GetTitle();
         foreach ($emblems as $e) {
             $e['url'] = str_replace(array('{url}', '{base_url}', '{requested_url}', '{site_name}', '{site_slogan}', '{title}'), array($page, $site, $page, $name, $slogan, $title), $e['url']);
             $tpl->SetBlock('emblems/emblem');
             $tpl->SetVariable('id', $e['id']);
             $tpl->SetVariable('title', _t('EMBLEMS_TYPE_' . $e['type'], $e['title']));
             $tpl->SetVariable('image', $GLOBALS['app']->getDataURL('emblems/' . $e['image']));
             $tpl->SetVariable('url', $e['url']);
             $tpl->ParseBlock('emblems/emblem');
         }
     }
     $tpl->ParseBlock('emblems');
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:32,代码来源:Emblems.php

示例3: Jaws_Template

 /**
  * Class constructor
  *
  * @access  public
  * @param   bool    $loadFromTheme          Try to load template from theme
  * @param   bool    $loadGlobalVariables    Fetch and set global variables 
  * @return  void
  */
 function Jaws_Template($loadFromTheme = false, $loadGlobalVariables = true)
 {
     $this->IdentifierRegExp = '[\\.[:digit:][:lower:]_-]+';
     $this->BlockRegExp = '@<!--\\s+begin\\s+(' . $this->IdentifierRegExp . ')\\s+([^>]*)-->(.*)<!--\\s+end\\s+\\1\\s+-->@sim';
     $this->VarsRegExp = '@{{\\s*(' . $this->IdentifierRegExp . ')\\s*}}@sim';
     $this->IsBlockRegExp = '@##\\s*(' . $this->IdentifierRegExp . ')\\s*##@sim';
     $namexp = '[[:digit:][:lower:]_]+';
     $this->NewBlockRegExp = '@<!--\\s+begin\\s+(' . $namexp . ')\\s+' . '(?:if\\((!)?(' . $namexp . ')\\)\\s+|)' . '(?:loop\\((' . $namexp . ')\\)\\s+|)' . '-->(.*)<!--\\s+end\\s+\\1\\s+-->@sim';
     $this->globalVariables['theme_url'] = '';
     $this->globalVariables['.dir'] = _t('GLOBAL_LANG_DIRECTION') == 'rtl' ? '.rtl' : '';
     $this->globalVariables['base_url'] = Jaws_Utils::getBaseURL('/');
     $this->globalVariables['requested_url'] = Jaws_Utils::getRequestURL();
     $this->globalVariables['base_script'] = BASE_SCRIPT;
     if ($loadGlobalVariables) {
         $this->loadFromTheme = $loadFromTheme;
         $this->theme = $GLOBALS['app']->GetTheme();
         $layout = $GLOBALS['app']->Layout->GetLayoutName() . '/';
         $this->layout = @is_dir($this->theme['path'] . $layout) ? $layout : '';
         $browser = $GLOBALS['app']->GetBrowserFlag();
         $this->globalVariables['theme_url'] = $this->theme['url'];
         $this->globalVariables['data_url'] = $GLOBALS['app']->getDataURL();
         $this->globalVariables['.browser'] = empty($browser) ? '' : ".{$browser}";
         $this->globalVariables['main_index'] = $GLOBALS['app']->mainIndex ? 'index' : '';
         $this->globalVariables['main_gadget'] = strtolower($GLOBALS['app']->mainGadget);
         $this->globalVariables['main_action'] = strtolower($GLOBALS['app']->mainAction);
     } else {
         $this->loadFromTheme = false;
     }
 }
开发者ID:uda,项目名称:jaws,代码行数:37,代码来源:Template.php

示例4: Execute

 /**
  * Event execute method
  *
  */
 function Execute($shouter, $code)
 {
     $reqURL = Jaws_Utils::getRequestURL(true);
     $uModel = $this->gadget->model->loadAdmin('ErrorMaps');
     $res = $uModel->GetHTTPError($reqURL, $code);
     if (!Jaws_Error::IsError($res) && !empty($res) && ($res['code'] == 301 || $res['code'] == 302)) {
         Jaws_Header::Location($res['url'], $res['code']);
     }
     return $res;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:14,代码来源:HTTPError.php

示例5: UpdateAccount

 /**
  * Updates user account information
  *
  * @access  public
  * @return  void
  */
 function UpdateAccount()
 {
     if (!$GLOBALS['app']->Session->Logged()) {
         Jaws_Header::Location($this->gadget->urlMap('LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(true)))));
     }
     $this->gadget->CheckPermission('EditUserName,EditUserNickname,EditUserEmail,EditUserPassword', '', false);
     $post = jaws()->request->fetch(array('username', 'nickname', 'email', 'password', 'chkpassword'), 'post');
     if ($post['password'] === $post['chkpassword']) {
         // check edit username permission
         if (empty($post['username']) || !$this->gadget->GetPermission('EditUserName')) {
             $post['username'] = $GLOBALS['app']->Session->GetAttribute('username');
         }
         // check edit nickname permission
         if (empty($post['nickname']) || !$this->gadget->GetPermission('EditUserNickname')) {
             $post['nickname'] = $GLOBALS['app']->Session->GetAttribute('nickname');
         }
         // check edit email permission
         if (empty($post['email']) || !$this->gadget->GetPermission('EditUserEmail')) {
             $post['email'] = $GLOBALS['app']->Session->GetAttribute('email');
         }
         // set new email
         $post['new_email'] = '';
         if ($post['email'] != $GLOBALS['app']->Session->GetAttribute('email')) {
             $post['new_email'] = $post['email'];
             $post['email'] = $GLOBALS['app']->Session->GetAttribute('email');
         }
         // check edit password permission
         if (empty($post['password']) || !$this->gadget->GetPermission('EditUserPassword')) {
             $post['password'] = null;
         }
         $model = $this->gadget->model->load('Account');
         $result = $model->UpdateAccount($GLOBALS['app']->Session->GetAttribute('user'), $post['username'], $post['nickname'], $post['email'], $post['new_email'], $post['password']);
         // unset unnecessary account data
         unset($post['password'], $post['chkpassword']);
         if (!Jaws_Error::IsError($result)) {
             $message = _t('USERS_MYACCOUNT_UPDATED');
             if (!empty($post['new_email'])) {
                 $mResult = $this->ReplaceEmailNotification($GLOBALS['app']->Session->GetAttribute('user'), $post['username'], $post['nickname'], $post['new_email'], $post['email']);
                 if (Jaws_Error::IsError($mResult)) {
                     $message = $message . "\n" . $mResult->getMessage();
                 } else {
                     $message = $message . "\n" . _t('USERS_EMAIL_REPLACEMENT_SENT');
                 }
             }
             $GLOBALS['app']->Session->PushResponse($message, 'Users.Account.Response');
         } else {
             $GLOBALS['app']->Session->PushResponse($result->GetMessage(), 'Users.Account.Response', RESPONSE_ERROR, $post);
         }
     } else {
         // unset unnecessary account data
         unset($post['password'], $post['chkpassword']);
         $GLOBALS['app']->Session->PushResponse(_t('USERS_USERS_PASSWORDS_DONT_MATCH'), 'Users.Account.Response', RESPONSE_ERROR, $post);
     }
     Jaws_Header::Location($this->gadget->urlMap('Account'));
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:61,代码来源:Account.php

示例6: Menu

 /**
  * Displays the menus with their items
  *
  * @access  public
  * @param   int     $gid    Menu group ID
  * @return  string  XHTML template content
  */
 function Menu($gid = 0)
 {
     $mModel = $this->gadget->model->load('Menu');
     $gModel = $this->gadget->model->load('Group');
     $group = $gModel->GetGroups($gid);
     if (Jaws_Error::IsError($group) || empty($group) || !$group['published']) {
         return false;
     }
     $this->_ReqURL = Jaws_Utils::getRequestURL();
     $this->_ReqURL = str_replace(BASE_SCRIPT, '', $this->_ReqURL);
     $tpl = $this->gadget->template->load('Menu.html', array('rawStore' => true));
     $tpl->SetBlock('levels');
     $tpl_str = $tpl->GetRawBlockContent();
     $tpl->SetBlock('menu');
     $tpl->SetVariable('gid', $group['id']);
     $tpl->SetVariable('menus_tree', $this->GetNextLevel($mModel, $tpl_str, $group['id'], 0));
     if ($group['title_view'] == 1) {
         $tpl->SetBlock("menu/group_title");
         $tpl->SetVariable('title', $group['title']);
         $tpl->ParseBlock("menu/group_title");
     }
     $tpl->ParseBlock('menu');
     return $tpl->Get();
 }
开发者ID:juniortux,项目名称:jaws,代码行数:31,代码来源:Menu.php

示例7: Get

 /**
  * Get HTTP status reponse
  *
  * @access  public
  * @param   int     $code       Status code
  * @param   string  $title      Reponse page title
  * @param   string  $message    Response message
  * @return  string  HTML template content
  */
 static function Get($code, $title = null, $message = null)
 {
     header('Content-Type: text/html; charset=utf-8');
     header('Cache-Control: no-cache, must-revalidate');
     header('Pragma: no-cache');
     // Let everyone know a HTTP error has been happened
     $result = $GLOBALS['app']->Listener->Shout('HTTPError', 'HTTPError', $code, 'UrlMapper');
     if (!Jaws_Error::IsError($result) && !empty($result)) {
         $code = empty($result['code']) ? $code : $result['code'];
     }
     switch ($code) {
         case 401:
             $realm = $GLOBALS['app']->Registry->fetch('realm', 'Settings');
             jaws()->http_response_code(401);
             // using invalid authentication type for avoid popup login box
             header('WWW-Authenticate: LoginBox realm="' . $realm . '"');
             $urlLogin = $GLOBALS['app']->Map->GetURLFor('Users', 'LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(true))));
             $title = empty($title) ? _t('GLOBAL_HTTP_ERROR_TITLE_401') : $title;
             $message = empty($message) ? _t('GLOBAL_HTTP_ERROR_CONTENT_401', $urlLogin) : $message;
             break;
         case 403:
             jaws()->http_response_code(403);
             $title = empty($title) ? _t('GLOBAL_HTTP_ERROR_TITLE_403') : $title;
             $message = empty($message) ? _t('GLOBAL_HTTP_ERROR_CONTENT_403') : $message;
             break;
         case 404:
             $uri = Jaws_XSS::filter(Jaws_Utils::getRequestURL(false));
             if (empty($message)) {
                 $message = _t('GLOBAL_HTTP_ERROR_CONTENT_404', $uri);
             }
             jaws()->http_response_code(404);
             $title = empty($title) ? _t('GLOBAL_HTTP_ERROR_TITLE_404') : $title;
             break;
         case 410:
             jaws()->http_response_code(410);
             $title = empty($title) ? _t('GLOBAL_HTTP_ERROR_TITLE_410') : $title;
             $message = empty($message) ? _t('GLOBAL_HTTP_ERROR_CONTENT_410') : $message;
             break;
         case 500:
             jaws()->http_response_code(500);
             $title = empty($title) ? _t('GLOBAL_HTTP_ERROR_TITLE_500') : $title;
             $message = empty($message) ? _t('GLOBAL_HTTP_ERROR_CONTENT_500') : $message;
             break;
         case 503:
             jaws()->http_response_code(503);
             $title = empty($title) ? _t('GLOBAL_HTTP_ERROR_TITLE_503') : $title;
             $message = empty($message) ? _t('GLOBAL_HTTP_ERROR_CONTENT_503') : $message;
             break;
         default:
             $title = empty($title) ? _t("GLOBAL_HTTP_ERROR_TITLE_{$code}") : $title;
             $message = empty($message) ? _t("GLOBAL_HTTP_ERROR_CONTENT_{$code}") : $message;
     }
     // if current theme has a error code html file, return it, if not return the messages.
     $theme = $GLOBALS['app']->GetTheme();
     $site_name = $GLOBALS['app']->Registry->fetch('site_name', 'Settings');
     if (file_exists($theme['path'] . "{$code}.html")) {
         $tpl = new Jaws_Template();
         $tpl->Load("{$code}.html", $theme['path']);
         $tpl->SetBlock($code);
         //set global site config
         $direction = _t('GLOBAL_LANG_DIRECTION');
         $dir = $direction == 'rtl' ? '.' . $direction : '';
         $brow = $GLOBALS['app']->GetBrowserFlag();
         $brow = empty($brow) ? '' : '.' . $brow;
         $tpl->SetVariable('.dir', $dir);
         $tpl->SetVariable('.browser', $brow);
         $tpl->SetVariable('site-name', $site_name);
         $tpl->SetVariable('site-title', $site_name);
         $tpl->SetVariable('site-slogan', $GLOBALS['app']->Registry->fetch('site_slogan', 'Settings'));
         $tpl->SetVariable('site-author', $GLOBALS['app']->Registry->fetch('site_author', 'Settings'));
         $tpl->SetVariable('site-copyright', $GLOBALS['app']->Registry->fetch('copyright', 'Settings'));
         $tpl->SetVariable('site-description', $GLOBALS['app']->Registry->fetch('site_description', 'Settings'));
         $tpl->SetVariable('title', $title);
         $tpl->SetVariable('content', $message);
         $tpl->ParseBlock($code);
         return $tpl->Get();
     }
     return "<div class=\"gadget_header\"><div class=\"gadget_title\"><h3>{$title}</h3></div></div>" . "<div class=\"gadget_container\"><div class=\"content\">{$message}</div></div>";
 }
开发者ID:uda,项目名称:jaws,代码行数:88,代码来源:HTTPError.php

示例8: UpdateContacts

 /**
  * Updates user contacts information
  *
  * @access  public
  * @return  void
  */
 function UpdateContacts()
 {
     if (!$GLOBALS['app']->Session->Logged()) {
         Jaws_Header::Location($this->gadget->urlMap('LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(true)))));
     }
     $this->gadget->CheckPermission('EditUserContacts');
     $post = jaws()->request->fetch(array('country', 'city', 'address', 'postal_code', 'phone_number', 'mobile_number', 'fax_number'), 'post');
     $uModel = $this->gadget->model->load('Contacts');
     $result = $uModel->UpdateContacts($GLOBALS['app']->Session->GetAttribute('user'), $post['country'], $post['city'], $post['address'], $post['postal_code'], $post['phone_number'], $post['mobile_number'], $post['fax_number']);
     if (Jaws_Error::IsError($result)) {
         $GLOBALS['app']->Session->PushResponse($result->GetMessage(), 'Users.Contacts', RESPONSE_ERROR, $post);
     } else {
         $GLOBALS['app']->Session->PushResponse(_t('USERS_USERS_CONTACTINFO_UPDATED'), 'Users.Contacts');
     }
     Jaws_Header::Location($this->gadget->urlMap('Contacts'), 'Users.Contacts');
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:22,代码来源:Contacts.php

示例9: terminate

        } else {
            $loginMsg = $resCheck->GetMessage();
        }
    }
    if ($httpAuthEnabled) {
        $httpAuth->showLoginBox();
    }
    // Init layout
    $GLOBALS['app']->InstanceLayout();
    $cpl = Jaws_Gadget::getInstance('ControlPanel')->action->loadAdmin('Login');
    $data = $cpl->LoginBox($loginMsg);
    terminate($data, 401);
}
// remove checksess(check session) parameter from requested url
if (!is_null(jaws()->request->fetch('checksess', 'get'))) {
    Jaws_Header::Location(substr(Jaws_Utils::getRequestURL(false), 0, -10));
}
// Can use Control Panel?
$GLOBALS['app']->Session->CheckPermission('ControlPanel', 'default_admin');
if (Jaws_Gadget::IsGadgetEnabled($ReqGadget)) {
    $GLOBALS['app']->Session->CheckPermission($ReqGadget, 'default_admin');
    $objAction = Jaws_Gadget::getInstance($ReqGadget)->action->loadAdmin();
    if (Jaws_Error::IsError($objAction)) {
        Jaws_Error::Fatal("Error loading gadget: {$ReqGadget}");
    }
    $ReqAction = empty($ReqAction) ? $objAction->gadget->default_admin_action : $ReqAction;
    // set requested gadget/action
    $GLOBALS['app']->mainGadget = $ReqGadget;
    $GLOBALS['app']->mainAction = $ReqAction;
    // Init layout
    $GLOBALS['app']->InstanceLayout();
开发者ID:uda,项目名称:jaws,代码行数:31,代码来源:admin.php

示例10: ManageGroup

 /**
  * Manage group
  *
  * @access  public
  * @return  string  XHTML template of a form
  */
 function ManageGroup()
 {
     if (!$GLOBALS['app']->Session->Logged()) {
         Jaws_Header::Location($this->gadget->urlMap('LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(true)))));
     }
     $this->gadget->CheckPermission('ManageUserGroups');
     $gid = (int) jaws()->request->fetch('gid', 'get');
     $user = $GLOBALS['app']->Session->GetAttribute('user');
     // Load the template
     $tpl = $this->gadget->template->load('Groups.html');
     $tpl->SetBlock('manage_group');
     $jUser = new Jaws_User();
     $group = $jUser->GetGroup($gid, $user);
     $response = $GLOBALS['app']->Session->PopResponse('Users.GroupMember');
     if (!empty($response)) {
         $tpl->SetVariable('type', $response['type']);
         $tpl->SetVariable('text', $response['text']);
     }
     $tpl->SetVariable('title', _t('USERS_MANAGE_GROUPS', $group['title']));
     $tpl->SetVariable('menubar', $this->MenuBar('Groups'));
     $tpl->SetVariable('submenubar', $this->SubMenuBar('Members', array('Members', 'EditGroup'), array('gid' => $gid)));
     $tpl->SetVariable('base_script', BASE_SCRIPT);
     $tpl->SetVariable('lbl_actions', _t('GLOBAL_ACTIONS'));
     $tpl->SetVariable('lbl_no_action', _t('GLOBAL_NO_ACTION'));
     $tpl->SetVariable('lbl_delete', _t('GLOBAL_DELETE'));
     $tpl->SetVariable('icon_ok', STOCK_OK);
     $tpl->SetVariable('gid', $gid);
     $tpl->SetVariable('lbl_edit_group', _t('USERS_EDIT_GROUP'));
     $tpl->SetVariable('url_edit_group', $this->gadget->urlMap('EditUserGroup', array('gid' => $gid)));
     $members = $jUser->GetUsers($gid);
     $tpl->SetVariable('lbl_members', _t('USERS_GROUPS_MEMBERS'));
     $tpl->SetVariable('lbl_username', _t('USERS_USERS_USERNAME'));
     $tpl->SetVariable('lbl_nickname', _t('USERS_USERS_NICKNAME'));
     foreach ($members as $member) {
         $tpl->SetBlock('manage_group/member');
         $tpl->SetVariable('id', $member['id']);
         $tpl->SetVariable('username', $member['username']);
         $tpl->SetVariable('nickname', $member['nickname']);
         // user's profile
         $tpl->SetVariable('user_url', $this->gadget->urlMap('Profile', array('user' => $member['username'])));
         $tpl->ParseBlock('manage_group/member');
     }
     $allUsers = $jUser->GetUsers();
     if (count($allUsers) != count($members)) {
         $tpl->SetBlock('manage_group/all_users');
         $tpl->SetVariable('lbl_group_member', _t('USERS_MANAGE_GROUPS_MEMBERS'));
         $tpl->SetVariable('lbl_users', _t('USERS_USERS'));
         $tpl->SetVariable('lbl_add_user_to_group', _t('USERS_GROUPS_ADD_USER'));
         foreach ($allUsers as $user) {
             if (in_array($user, $members)) {
                 continue;
             }
             $tpl->SetBlock('manage_group/all_users/user');
             $tpl->SetVariable('user', $user['id']);
             $tpl->SetVariable('username', $user['username']);
             $tpl->SetVariable('nickname', $user['nickname']);
             $tpl->ParseBlock('manage_group/all_users/user');
         }
         $tpl->ParseBlock('manage_group/all_users');
     }
     $tpl->ParseBlock('manage_group');
     return $tpl->Get();
 }
开发者ID:juniortux,项目名称:jaws,代码行数:69,代码来源:Groups.php

示例11: LoginLinks

 /**
  * Builds the login links
  *
  * @access  public
  * @return  string  XHTML content
  */
 function LoginLinks()
 {
     $tpl = $this->gadget->template->load('LoginLinks.html');
     if ($GLOBALS['app']->Session->Logged()) {
         $tpl->SetBlock('UserLinks');
         $tpl->SetVariable('title', _t('GLOBAL_MY_ACCOUNT'));
         // welcome
         $tpl->SetVariable('welcome', _t('USERS_WELCOME'));
         $tpl->SetVariable('profile', _t('USERS_PROFILE'));
         $uInfo = $GLOBALS['app']->Session->GetAttributes('username', 'nickname', 'avatar', 'email');
         // username
         $tpl->SetVariable('username', $uInfo['username']);
         // nickname
         $tpl->SetVariable('nickname', $uInfo['nickname']);
         // avatar
         $tpl->SetVariable('avatar', $uInfo['avatar']);
         // profile link
         $tpl->SetVariable('profile_url', $this->gadget->urlMap('Profile', array('user' => $uInfo['username'])));
         // email
         $tpl->SetVariable('email', $uInfo['email']);
         // manage friends
         if ($this->gadget->GetPermission('ManageFriends')) {
             $tpl->SetBlock('UserLinks/groups');
             $tpl->SetVariable('user_groups', _t('USERS_MANAGE_GROUPS'));
             $tpl->SetVariable('groups_url', $this->gadget->urlMap('Groups'));
             $tpl->ParseBlock('UserLinks/groups');
         }
         // fetch current layout user
         $layout_user = $GLOBALS['app']->Session->GetAttribute('layout');
         // Layout/Dashboard manager
         if (empty($layout_user)) {
             // global site layout
             if ($GLOBALS['app']->Session->GetPermission('Layout', 'ManageLayout')) {
                 $tpl->SetBlock('UserLinks/layout');
                 $tpl->SetVariable('layout', _t('LAYOUT_TITLE'));
                 $tpl->SetVariable('layout_url', $this->gadget->urlMap('Layout', array('user' => $layout_user), false, 'Layout'));
                 $tpl->ParseBlock('UserLinks/layout');
             }
         } else {
             // user's dashboard layout
             if ($this->gadget->GetPermission('ManageDashboard')) {
                 $tpl->SetBlock('UserLinks/layout');
                 $tpl->SetVariable('layout', _t('LAYOUT_TITLE'));
                 $tpl->SetVariable('layout_url', $this->gadget->urlMap('Layout', array('user' => $layout_user), false, 'Layout'));
                 $tpl->ParseBlock('UserLinks/layout');
             }
         }
         // Dashboard
         if ($this->gadget->GetPermission('AccessDashboard')) {
             $tpl->SetBlock('UserLinks/dashboard');
             if (empty($layout_user)) {
                 $tpl->SetVariable('dashboard', _t('USERS_DASHBOARD_USER'));
             } else {
                 $tpl->SetVariable('dashboard', _t('USERS_DASHBOARD_GLOBAL'));
             }
             $tpl->SetVariable('dashboard_url', $this->gadget->urlMap('Dashboard', array(), false, 'Layout'));
             $tpl->ParseBlock('UserLinks/dashboard');
         }
         // ControlPanel
         if ($this->gadget->GetPermission('default_admin', '', false, 'ControlPanel')) {
             $tpl->SetBlock('UserLinks/cpanel');
             $tpl->SetVariable('cpanel', _t('USERS_CONTROLPANEL'));
             $admin_script = $this->gadget->registry->fetch('admin_script', 'Settings');
             $tpl->SetVariable('cpanel_url', empty($admin_script) ? 'admin.php' : $admin_script);
             $tpl->ParseBlock('UserLinks/cpanel');
         }
         // Logout
         $tpl->SetVariable('logout', _t('GLOBAL_LOGOUT'));
         $tpl->SetVariable('logout_url', $this->gadget->urlMap('Logout'));
         $tpl->ParseBlock('UserLinks');
     } else {
         $referrer = jaws()->request->fetch('referrer', 'get');
         $referrer = is_null($referrer) ? bin2hex(Jaws_Utils::getRequestURL(true)) : $referrer;
         $login_url = $this->gadget->urlMap('LoginBox', array('referrer' => $referrer));
         $tpl->SetBlock('LoginLinks');
         $tpl->SetVariable('title', _t('USERS_LOGINLINKS'));
         // welcome
         $tpl->SetVariable('welcome', _t('USERS_WELCOME'));
         // login
         $tpl->SetVariable('user_login', _t('USERS_LOGIN_TITLE'));
         $tpl->SetVariable('login_url', $login_url);
         // registration
         if ($this->gadget->registry->fetch('anon_register') == 'true') {
             $tpl->SetBlock('LoginLinks/registration');
             $tpl->SetVariable('user_registeration', _t('USERS_REGISTER'));
             $tpl->SetVariable('registeration_url', $this->gadget->urlMap('Registration'));
             $tpl->ParseBlock('LoginLinks/registration');
         }
         // forget user/password
         if ($this->gadget->registry->fetch('password_recovery') == 'true') {
             $tpl->SetBlock('LoginLinks/forgot');
             $tpl->SetVariable('user_forgot', _t('USERS_FORGOT_LOGIN'));
             $tpl->SetVariable('forgot_url', $this->gadget->urlMap('ForgotLogin'));
             $tpl->ParseBlock('LoginLinks/forgot');
//.........这里部分代码省略.........
开发者ID:Dulciane,项目名称:jaws,代码行数:101,代码来源:Login.php

示例12: UpdatePreferences

 /**
  * Updates user information
  *
  * @access  public
  * @return  void
  */
 function UpdatePreferences()
 {
     /**
      * determine value isn't set?
      *
      * @access  private
      * @param   mixed   $option
      * @return  bool
      */
     function definedFilter($option)
     {
         return $option !== '';
     }
     if (!$GLOBALS['app']->Session->Logged()) {
         Jaws_Header::Location($this->gadget->urlMap('LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(true)))));
     }
     // check permission
     $this->gadget->CheckPermission('EditUserPreferences');
     $post = jaws()->request->fetchAll('post');
     $gadget = $post['component'];
     unset($post['gadget'], $post['action'], $post['component']);
     // filter defined options
     $post = array_filter($post, 'definedFilter');
     $this->gadget->registry->deleteByUser($gadget);
     $result = $this->gadget->registry->insertAllByUser(array_map(null, array_keys($post), array_values($post)), $gadget);
     if (!Jaws_Error::IsError($result)) {
         $GLOBALS['app']->Session->PushResponse(_t('USERS_PREFERENCES_UPDATED'), 'Users.Preferences');
     } else {
         $GLOBALS['app']->Session->PushResponse($result->GetMessage(), 'Users.Preferences', RESPONSE_ERROR);
     }
     Jaws_Header::Location($this->gadget->urlMap('Preferences'), 'Users.Preferences');
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:38,代码来源:Preferences.php

示例13: Init

 /**
  * Initializes the Jaws URL Mapping
  *
  * @access  public
  * @param   string  $request_uri    Requested URL
  * @return  bool    True on success, or False on failure
  */
 function Init($request_uri = '')
 {
     $urlMapper = Jaws_Gadget::getInstance('UrlMapper');
     if (Jaws_Error::isError($urlMapper)) {
         Jaws_Error::Fatal($urlMapper->getMessage());
     }
     $this->_MapsModel = Jaws_Gadget::getInstance('UrlMapper')->model->load('Maps');
     if (Jaws_Error::isError($this->_MapsModel)) {
         Jaws_Error::Fatal($this->_MapsModel->getMessage());
     }
     $this->_AliasesModel = Jaws_Gadget::getInstance('UrlMapper')->model->load('Aliases');
     if (Jaws_Error::isError($this->_AliasesModel)) {
         Jaws_Error::Fatal($this->_AliasesModel->getMessage());
     }
     // fetch all registry keys
     $regKeys = $urlMapper->registry->fetchAll();
     $extension = $regKeys['map_extensions'];
     $this->_enabled = $regKeys['map_enabled'] == 'true';
     $this->_use_rewrite = $regKeys['map_use_rewrite'] == 'true';
     $this->_use_aliases = $regKeys['map_use_aliases'] == 'true';
     $this->_custom_precedence = $regKeys['map_custom_precedence'] == 'true';
     $this->_restrict_multimap = $regKeys['map_restrict_multimap'] == 'true';
     if (!empty($extension) && $extension[0] != '.') {
         $extension = '.' . $extension;
     }
     $this->_extension = $extension;
     if (empty($request_uri)) {
         // ?\d+$ for force browsers to update cached file e.g. (?12345)
         $this->_request_uri = preg_replace(array('/^index\\.php[\\/|\\?]?/iu', '/\\?\\d+$/u'), '', Jaws_Utils::getRequestURL());
     } elseif (strpos($request_uri, 'http') !== false) {
         //prepare it manually
         if (false !== ($strPos = stripos($request_uri, BASE_SCRIPT))) {
             $strPos = $strPos + strlen(BASE_SCRIPT);
             $this->_request_uri = substr($request_uri, $strPos);
         }
     } else {
         $this->_request_uri = $request_uri;
     }
     // fetch apptype
     $params = explode('/', $this->_request_uri);
     if (false !== ($apptype_key = array_search('apptype', $params))) {
         jaws()->request->update('apptype', $params[$apptype_key + 1], 'get');
         unset($params[$apptype_key], $params[$apptype_key + 1]);
     }
     // decode url parts
     $this->_request_uri = implode('/', array_map('rawurldecode', $params));
     //Moment.. first check if we are running on aliases_mode
     if ($this->_use_aliases && ($realURI = $this->_AliasesModel->GetAliasPath($this->_request_uri))) {
         $this->_request_uri = str_ireplace(BASE_SCRIPT, '', $realURI);
     }
     // load maps
     if ($this->_enabled) {
         $maps = $this->_MapsModel->GetMaps();
         if (Jaws_Error::IsError($maps)) {
             return false;
         }
         foreach ($maps as $map) {
             $this->_actions_maps[$map['gadget']][$map['action']][] = $map['map'];
             $this->_maps[$map['gadget']][$map['map']] = array('params' => null, 'action' => $map['action'], 'map' => $map['map'], 'regexp' => $map['regexp'], 'extension' => $map['extension'], 'regexp_vars' => array_keys(unserialize($map['vars_regexps'])), 'custom_map' => $map['custom_map'], 'custom_regexp' => $map['custom_regexp']);
         }
     }
     return true;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:70,代码来源:URLMapping.php

示例14: LoginBox

 /**
  * Get HTML login form
  *
  * @access  public
  * @param   string  $message If a message is needed
  * @return  string  XHTML template of the login form
  */
 function LoginBox($message = '')
 {
     // Init layout
     $GLOBALS['app']->Layout->Load('gadgets/ControlPanel/Templates', 'LoginBox.html');
     $ltpl =& $GLOBALS['app']->Layout->_Template;
     $GLOBALS['app']->Layout->AddHeadLink('gadgets/ControlPanel/Resources/style.css?' . $this->gadget->version);
     $ltpl->SetVariable('admin_script', BASE_SCRIPT);
     $ltpl->SetVariable('control-panel', _t('GLOBAL_CONTROLPANEL'));
     $reqpost = jaws()->request->fetch(array('username', 'authtype', 'remember', 'usecrypt', 'redirect_to'), 'post');
     if (is_null($reqpost['authtype'])) {
         $reqpost['authtype'] = jaws()->request->fetch('authtype', 'get');
     }
     // referrer page link
     $reqURL = Jaws_Utils::getRequestURL();
     $reqURL = empty($reqURL) || $reqURL == BASE_SCRIPT ? BASE_SCRIPT . '?checksess' : "{$reqURL}&checksess";
     $redirect_to = is_null($reqpost['redirect_to']) ? bin2hex($reqURL) : $reqpost['redirect_to'];
     $ltpl->SetVariable('redirect_to', $redirect_to);
     $JCrypt = Jaws_Crypt::getInstance();
     if (!Jaws_Error::IsError($JCrypt)) {
         $GLOBALS['app']->Layout->AddScriptLink('libraries/js/rsa.lib.js');
         $ltpl->SetBlock('layout/onsubmit');
         $ltpl->ParseBlock('layout/onsubmit');
         $ltpl->SetBlock('layout/encryption');
         $ltpl->SetVariable('length', $JCrypt->length());
         $ltpl->SetVariable('modulus', $JCrypt->modulus());
         $ltpl->SetVariable('exponent', $JCrypt->exponent());
         $ltpl->ParseBlock('layout/encryption');
         // usecrypt
         $ltpl->SetBlock('layout/usecrypt');
         $ltpl->SetVariable('lbl_usecrypt', _t('GLOBAL_LOGIN_SECURE'));
         if (empty($reqpost['username']) || !empty($reqpost['usecrypt'])) {
             $ltpl->SetBlock('layout/usecrypt/selected');
             $ltpl->ParseBlock('layout/usecrypt/selected');
         }
         $ltpl->ParseBlock('layout/usecrypt');
     }
     $ltpl->SetVariable('legend_title', _t('CONTROLPANEL_LOGIN_TITLE'));
     $ltpl->SetVariable('lbl_username', _t('GLOBAL_USERNAME'));
     $ltpl->SetVariable('username', $reqpost['username']);
     $ltpl->SetVariable('lbl_password', _t('GLOBAL_PASSWORD'));
     $authtype = $this->gadget->registry->fetch('authtype', 'Users');
     if (!is_null($reqpost['authtype']) || $authtype !== 'Default') {
         $authtype = is_null($reqpost['authtype']) ? $authtype : $reqpost['authtype'];
         $ltpl->SetBlock('layout/authtype');
         $ltpl->SetVariable('lbl_authtype', _t('GLOBAL_AUTHTYPE'));
         foreach ($GLOBALS['app']->GetAuthTypes() as $method) {
             $ltpl->SetBlock('layout/authtype/item');
             $ltpl->SetVariable('method', $method);
             if ($method == $authtype) {
                 $ltpl->SetVariable('selected', 'selected="selected"');
             } else {
                 $ltpl->SetVariable('selected', '');
             }
             $ltpl->ParseBlock('layout/authtype/item');
         }
         $ltpl->ParseBlock('layout/authtype');
     }
     // remember
     $ltpl->SetBlock('layout/remember');
     $ltpl->SetVariable('lbl_remember', _t('GLOBAL_REMEMBER_ME'));
     if (!empty($reqpost['remember'])) {
         $ltpl->SetBlock('layout/remember/selected');
         $ltpl->ParseBlock('layout/remember/selected');
     }
     $ltpl->ParseBlock('layout/remember');
     //captcha
     $mPolicy = Jaws_Gadget::getInstance('Policy')->action->load('Captcha');
     $mPolicy->loadCaptcha($ltpl, 'layout', 'login');
     $ltpl->SetVariable('login', _t('GLOBAL_LOGIN'));
     $ltpl->SetVariable('back', _t('CONTROLPANEL_LOGIN_BACK_TO_SITE'));
     $message = is_null(jaws()->request->fetch('checksess')) ? $message : _t('GLOBAL_ERROR_SESSION_NOTFOUND');
     if (!empty($message)) {
         $ltpl->SetBlock('layout/message');
         $ltpl->SetVariable('message', $message);
         $ltpl->ParseBlock('layout/message');
     }
     return $GLOBALS['app']->Layout->Get();
 }
开发者ID:juniortux,项目名称:jaws,代码行数:85,代码来源:Login.php

示例15: UpdatePersonal

 /**
  * Updates user personal
  *
  * @access  public
  * @return  void
  */
 function UpdatePersonal()
 {
     if (!$GLOBALS['app']->Session->Logged()) {
         Jaws_Header::Location($this->gadget->urlMap('LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(true)))));
     }
     $this->gadget->CheckPermission('EditUserPersonal');
     $post = jaws()->request->fetch(array('fname', 'lname', 'gender', 'ssn', 'dob', 'url', 'signature', 'about', 'avatar', 'delete_avatar', 'experiences', 'occupations', 'interests'), 'post');
     if (!empty($post['dob'])) {
         $post['dob'] = Jaws_Date::getInstance()->ToBaseDate(explode('-', $post['dob']), 'Y-m-d');
     } else {
         $post['dob'] = null;
     }
     // validate url
     if (!preg_match('|^\\S+://\\S+\\.\\S+.+$|i', $post['url'])) {
         $post['url'] = '';
     }
     unset($post['avatar']);
     if (empty($post['delete_avatar'])) {
         $res = Jaws_Utils::UploadFiles($_FILES, Jaws_Utils::upload_tmp_dir(), 'gif,jpg,jpeg,png,svg');
         if (Jaws_Error::IsError($res)) {
             $GLOBALS['app']->Session->PushResponse($res->GetMessage(), 'Users.Personal.Response', RESPONSE_ERROR, $post);
             Jaws_Header::Location($this->gadget->urlMap('Personal'));
         } elseif (!empty($res)) {
             $post['avatar'] = $res['avatar'][0]['host_filename'];
         }
     } else {
         $post['avatar'] = '';
     }
     $model = $this->gadget->model->load('Personal');
     $result = $model->UpdatePersonal($GLOBALS['app']->Session->GetAttribute('user'), $post);
     if (Jaws_Error::IsError($result)) {
         $GLOBALS['app']->Session->PushResponse($result->GetMessage(), 'Users.Personal.Response', RESPONSE_ERROR, $post);
     } else {
         $GLOBALS['app']->Session->PushResponse(_t('USERS_USERS_PERSONALINFO_UPDATED'), 'Users.Personal.Response');
     }
     Jaws_Header::Location($this->gadget->urlMap('Personal'));
 }
开发者ID:juniortux,项目名称:jaws,代码行数:43,代码来源:Personal.php


注:本文中的Jaws_Utils::getRequestURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。