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


PHP common::getSysURL方法代码示例

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


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

示例1: request

 /**
  * Request the api.
  * 
  * @param  string $moduleName 
  * @param  string $methodName 
  * @param  string $action 
  * @access public
  * @return void
  */
 public function request($moduleName, $methodName, $action)
 {
     $host = common::getSysURL() . $this->config->webRoot;
     $param = '';
     if ($action == 'extendModel') {
         if (!isset($_POST['noparam'])) {
             foreach ($_POST as $key => $value) {
                 $param .= ',' . $key . '=' . $value;
             }
             $param = ltrim($param, ',');
         }
         $url = rtrim($host, '/') . inlink('getModel', "moduleName={$moduleName}&methodName={$methodName}&params={$param}", 'json');
         $url .= $this->config->requestType == "PATH_INFO" ? '?' : '&';
         $url .= $this->config->sessionVar . '=' . session_id();
     } else {
         if (!isset($_POST['noparam'])) {
             foreach ($_POST as $key => $value) {
                 $param .= '&' . $key . '=' . $value;
             }
             $param = ltrim($param, '&');
         }
         $url = rtrim($host, '/') . helper::createLink($moduleName, $methodName, $param, 'json');
         $url .= $this->config->requestType == "PATH_INFO" ? '?' : '&';
         $url .= $this->config->sessionVar . '=' . session_id();
     }
     /* Unlock session. After new request, restart session. */
     session_write_close();
     $content = file_get_contents($url);
     session_start();
     return array('url' => $url, 'content' => $content);
 }
开发者ID:caiwenhao,项目名称:zentao,代码行数:40,代码来源:model.php

示例2: login

 /**
  * SSO login.
  * 
  * @param  string $type 
  * @access public
  * @return void
  */
 public function login($type = 'notify')
 {
     $referer = empty($_GET['referer']) ? '' : $this->get->referer;
     $locate = empty($referer) ? getWebRoot() : base64_decode($referer);
     if ($this->loadModel('user')->isLogon()) {
         die($this->locate($locate));
     }
     $this->app->loadConfig('sso');
     if (!$this->config->sso->turnon) {
         die($this->locate($locate));
     }
     $userIP = $this->server->remote_addr;
     $code = $this->config->sso->code;
     $key = $this->config->sso->key;
     if ($type != 'return') {
         $token = $this->get->token;
         $auth = md5($code . $userIP . $token . $key);
         $callback = urlencode(common::getSysURL() . inlink('login', "type=return"));
         $location = $this->config->sso->addr;
         if (strpos($location, '&') !== false) {
             $location = rtrim($location, '&') . "&token={$token}&auth={$auth}&userIP={$userIP}&callback={$callback}&referer={$referer}";
         } else {
             $location = rtrim($location, '?') . "?token={$token}&auth={$auth}&userIP={$userIP}&callback={$callback}&referer={$referer}";
         }
         $this->locate($location);
     }
     if ($this->get->status == 'success' and md5($this->get->data) == $this->get->md5) {
         $last = $this->server->request_time;
         $data = json_decode(base64_decode($this->get->data));
         $token = $data->token;
         if ($data->auth == md5($code . $userIP . $token . $key)) {
             $user = $this->sso->getBindUser($data->account);
             if (!$user) {
                 $this->session->set('ssoData', $data);
                 $this->locate($this->createLink('sso', 'bind', "referer=" . helper::safe64Encode($locate)));
             }
             $this->user->cleanLocked($user->account);
             /* Authorize him and save to session. */
             $user->rights = $this->user->authorize($user->account);
             $user->groups = $this->user->getGroups($user->account);
             $this->dao->update(TABLE_USER)->set('visits = visits + 1')->set('ip')->eq($userIP)->set('last')->eq($last)->where('account')->eq($user->account)->exec();
             $user->last = date(DT_DATETIME1, $last);
             $this->session->set('user', $user);
             $this->app->user = $this->session->user;
             $this->loadModel('action')->create('user', $user->id, 'login');
             die($this->locate($locate));
         }
     }
     $this->locate($this->createLink('user', 'login', empty($referer) ? '' : "referer={$referer}"));
 }
开发者ID:caiwenhao,项目名称:zentao,代码行数:57,代码来源:control.php

示例3: export

 /**
  * Export the stories of release to HTML.
  * 
  * @param  string $type story | bug
  * @access public
  * @return void
  */
 public function export()
 {
     if (!empty($_POST)) {
         $type = $this->post->type;
         $html = '';
         if ($type == 'story' or $type == 'all') {
             $html .= "<h3>{$this->lang->release->stories}</h3>";
             $this->loadModel('story');
             $stories = $this->dao->select('id, title')->from(TABLE_STORY)->where($this->session->storyQueryCondition)->beginIF($this->session->storyOrderBy != false)->orderBy($this->session->storyOrderBy)->fi()->fetchAll('id');
             foreach ($stories as $story) {
                 $story->title = "<a href='" . common::getSysURL() . $this->createLink('story', 'view', "storyID={$story->id}") . "' target='_blank'>{$story->title}</a>";
             }
             $fields = array('id' => $this->lang->story->id, 'title' => $this->lang->story->title);
             $rows = $stories;
             $html .= '<table><tr>';
             foreach ($fields as $fieldLabel) {
                 $html .= "<th><nobr>{$fieldLabel}</nobr></th>\n";
             }
             $html .= '</tr>';
             foreach ($rows as $row) {
                 $html .= "<tr valign='top'>\n";
                 foreach ($fields as $fieldName => $fieldLabel) {
                     $fieldValue = isset($row->{$fieldName}) ? $row->{$fieldName} : '';
                     $html .= "<td><nobr>{$fieldValue}</nobr></td>\n";
                 }
                 $html .= "</tr>\n";
             }
             $html .= '</table>';
         }
         if ($type == 'bug' or $type == 'all') {
             $html .= "<h3>{$this->lang->release->bugs}</h3>";
             $this->loadModel('bug');
             $bugs = $this->dao->select('id, title')->from(TABLE_BUG)->where($this->session->linkedBugQueryCondition)->beginIF($this->session->bugOrderBy != false)->orderBy($this->session->bugOrderBy)->fi()->fetchAll('id');
             foreach ($bugs as $bug) {
                 $bug->title = "<a href='" . common::getSysURL() . $this->createLink('bug', 'view', "bugID={$bug->id}") . "' target='_blank'>{$bug->title}</a>";
             }
             $fields = array('id' => $this->lang->bug->id, 'title' => $this->lang->bug->title);
             $rows = $bugs;
             $html .= '<table><tr>';
             foreach ($fields as $fieldLabel) {
                 $html .= "<th><nobr>{$fieldLabel}</nobr></th>\n";
             }
             $html .= '</tr>';
             foreach ($rows as $row) {
                 $html .= "<tr valign='top'>\n";
                 foreach ($fields as $fieldName => $fieldLabel) {
                     $fieldValue = isset($row->{$fieldName}) ? $row->{$fieldName} : '';
                     $html .= "<td><nobr>{$fieldValue}</nobr></td>\n";
                 }
                 $html .= "</tr>\n";
             }
             $html .= '</table>';
         }
         if ($type == 'newbug' or $type == 'all') {
             $html .= "<h3>{$this->lang->release->generatedBugs}</h3>";
             $bugs = $this->dao->select('id, title')->from(TABLE_BUG)->where($this->session->newBugsQueryCondition)->beginIF($this->session->bugOrderBy != false)->orderBy($this->session->bugOrderBy)->fi()->fetchAll('id');
             foreach ($bugs as $bug) {
                 $bug->title = "<a href='" . common::getSysURL() . $this->createLink('bug', 'view', "bugID={$bug->id}") . "' target='_blank'>{$bug->title}</a>";
             }
             $fields = array('id' => $this->lang->bug->id, 'title' => $this->lang->bug->title);
             $rows = $bugs;
             $html .= '<table><tr>';
             foreach ($fields as $fieldLabel) {
                 $html .= "<th><nobr>{$fieldLabel}</nobr></th>\n";
             }
             $html .= '</tr>';
             foreach ($rows as $row) {
                 $html .= "<tr valign='top'>\n";
                 foreach ($fields as $fieldName => $fieldLabel) {
                     $fieldValue = isset($row->{$fieldName}) ? $row->{$fieldName} : '';
                     $html .= "<td><nobr>{$fieldValue}</nobr></td>\n";
                 }
                 $html .= "</tr>\n";
             }
             $html .= '</table>';
         }
         $html = "<html><head><meta charset='utf-8'><title>{$this->post->fileName}</title><style>table, th, td{font-size:12px; border:1px solid gray; border-collapse:collapse;}</style></head><body>{$html}</body></html>";
         die($this->fetch('file', 'sendDownHeader', array('fileName' => $this->post->fileName, 'html', $html)));
     }
     $this->display();
 }
开发者ID:ppmon,项目名称:ppm,代码行数:88,代码来源:control.php

示例4: getSysURL

 /**
  * Get System URL.
  * 
  * @access public
  * @return void
  */
 public function getSysURL()
 {
     /* Ger URL when run in shell. */
     if (PHP_SAPI == 'cli') {
         $url = parse_url(trim($this->server->argv[1]));
         $port = (empty($url['port']) or $url['port'] == 80) ? '' : $url['port'];
         $host = empty($port) ? $url['host'] : $url['host'] . ':' . $port;
         return $url['scheme'] . '://' . $host;
     } else {
         return common::getSysURL();
     }
 }
开发者ID:JameTheSmart,项目名称:zentaopms,代码行数:18,代码来源:model.php

示例5: login


//.........这里部分代码省略.........
         $account = '';
         $password = '';
         if ($this->post->account) {
             $account = $this->post->account;
         }
         if ($this->get->account) {
             $account = $this->get->account;
         }
         if ($this->post->password) {
             $password = $this->post->password;
         }
         if ($this->get->password) {
             $password = $this->get->password;
         }
         if ($this->user->checkLocked($account)) {
             $failReason = sprintf($this->lang->user->loginLocked, $this->config->user->lockMinutes);
             if ($this->app->getViewType() == 'json') {
                 die(helper::removeUTF8Bom(json_encode(array('status' => 'failed', 'reason' => $failReason))));
             }
             die(js::error($failReason));
         }
         $user = $this->user->identify($account, $password);
         if ($user) {
             $this->user->cleanLocked($account);
             /* Authorize him and save to session. */
             $user->rights = $this->user->authorize($account);
             $user->groups = $this->user->getGroups($account);
             $this->session->set('user', $user);
             $this->app->user = $this->session->user;
             $this->loadModel('action')->create('user', $user->id, 'login');
             /* Keep login. */
             if ($this->post->keepLogin) {
                 $this->user->keepLogin($user);
             }
             /* Check password. */
             if (isset($this->config->safe->mode) and $this->user->computePasswordStrength($password) < $this->config->safe->mode) {
                 echo js::alert($this->lang->user->weakPassword);
             }
             /* Go to the referer. */
             if ($this->post->referer and strpos($this->post->referer, $loginLink) === false and strpos($this->post->referer, $denyLink) === false) {
                 if ($this->app->getViewType() == 'json') {
                     $data = $this->user->getDataInJSON($user);
                     die(helper::removeUTF8Bom(json_encode(array('status' => 'success') + $data)));
                 }
                 /* Get the module and method of the referer. */
                 if ($this->config->requestType == 'PATH_INFO') {
                     $path = substr($this->post->referer, strrpos($this->post->referer, '/') + 1);
                     $path = rtrim($path, '.html');
                     if (empty($path)) {
                         $path = $this->config->requestFix;
                     }
                     list($module, $method) = explode($this->config->requestFix, $path);
                 } else {
                     $url = html_entity_decode($this->post->referer);
                     $param = substr($url, strrpos($url, '?') + 1);
                     list($module, $method) = explode('&', $param);
                     $module = str_replace('m=', '', $module);
                     $method = str_replace('f=', '', $method);
                 }
                 if (common::hasPriv($module, $method)) {
                     die(js::locate($this->post->referer, 'parent'));
                 } else {
                     die(js::locate($this->createLink($this->config->default->module), 'parent'));
                 }
             } else {
                 if ($this->app->getViewType() == 'json') {
                     $data = $this->user->getDataInJSON($user);
                     die(helper::removeUTF8Bom(json_encode(array('status' => 'success') + $data)));
                 }
                 die(js::locate($this->createLink($this->config->default->module), 'parent'));
             }
         } else {
             $fails = $this->user->failPlus($account);
             if ($this->app->getViewType() == 'json') {
                 die(helper::removeUTF8Bom(json_encode(array('status' => 'failed', 'reason' => $this->lang->user->loginFailed))));
             }
             $remainTimes = $this->config->user->failTimes - $fails;
             if ($remainTimes <= 0) {
                 die(js::error(sprintf($this->lang->user->loginLocked, $this->config->user->lockMinutes)));
             } else {
                 if ($remainTimes <= 3) {
                     die(js::error(sprintf($this->lang->user->lockWarning, $remainTimes)));
                 }
             }
             die(js::error($this->lang->user->loginFailed));
         }
     } else {
         if (!empty($this->config->global->showDemoUsers)) {
             $demoUsers = $this->user->getPairs('nodeleted, noletter, noempty, noclosed');
             $this->view->demoUsers = $demoUsers;
         }
         $this->app->loadLang('misc');
         $this->view->noGDLib = sprintf($this->lang->misc->noGDLib, common::getSysURL() . $this->config->webRoot);
         $this->view->title = $this->lang->user->login;
         $this->view->referer = $this->referer;
         $this->view->s = zget($this->config->global, 'sn');
         $this->view->keepLogin = $this->cookie->keepLogin ? $this->cookie->keepLogin : 'off';
         $this->display();
     }
 }
开发者ID:heeeello,项目名称:zentaopms,代码行数:101,代码来源:control.php

示例6:

/**
 * The mail file of bug module of ZenTaoPMS.
 *
 * @copyright   Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
 * @license     LGPL (http://www.gnu.org/licenses/lgpl.html)
 * @author      Chunsheng Wang <chunsheng@cnezsoft.com>
 * @package     bug
 * @version     $Id: sendmail.html.php 2963 2012-05-22 01:08:20Z chencongzhi520@gmail.com $
 * @link        http://www.zentao.net
 */
?>
<table width='98%' align='center'>
  <tr class='header'>
    <td>
      BUG #<?php 
echo $bug->id . "=>{$bug->assignedTo} " . html::a(common::getSysURL() . $this->createLink('bug', 'view', "bugID={$bug->id}"), $bug->title);
?>
    </td>
  </tr>
  <tr>
    <td>
    <fieldset>
      <legend><?php 
echo $lang->bug->legendSteps;
?>
</legend>
      <div class='content'>
      <?php 
if (strpos($bug->steps, '<img src="data/upload')) {
    $bug->steps = str_replace('<img src="', '<img src="http://' . $this->server->http_host . $this->config->webRoot, $bug->steps);
}
开发者ID:huokedu,项目名称:zentao,代码行数:31,代码来源:sendmail.html.php

示例7: export2HTML

 /**
  * export as html format
  * 
  * @access public
  * @return void
  */
 public function export2HTML()
 {
     $this->view->fields = $this->post->fields;
     $this->view->rows = $this->post->rows;
     $this->host = common::getSysURL();
     switch ($this->post->kind) {
         case 'task':
             foreach ($this->view->rows as $row) {
                 $row->name = html::a($this->host . $this->createLink('task', 'view', "taskID={$row->id}"), $row->name);
             }
             break;
         case 'story':
             foreach ($this->view->rows as $row) {
                 $row->title = html::a($this->host . $this->createLink('story', 'view', "storyID={$row->id}"), $row->title);
             }
             break;
         case 'bug':
             foreach ($this->view->rows as $row) {
                 $row->title = html::a($this->host . $this->createLink('bug', 'view', "bugID={$row->id}"), $row->title);
             }
             break;
         case 'testcase':
             foreach ($this->view->rows as $row) {
                 $row->title = html::a($this->host . $this->createLink('testcase', 'view', "caseID={$row->id}"), $row->title);
             }
             break;
     }
     $this->view->fileName = $this->post->fileName;
     $output = $this->parse('file', 'export2Html');
     $this->sendDownHeader($this->post->fileName, 'html', $output);
 }
开发者ID:XMGmen,项目名称:zentao,代码行数:37,代码来源:control.php

示例8:

/**
 * The mail file of task module of ZenTaoPMS.
 *
 * @copyright   Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
 * @license     LGPL (http://www.gnu.org/licenses/lgpl.html)
 * @author      Yangyang Shi<shiyangyang@cnezsoft.com>
 * @package     task
 * @version     $Id$
 * @link        http://www.zentao.net
 */
?>
<table width='98%' align='center'>
  <tr class='header'>
    <td>
      TASK #<?php 
echo $task->id . "=>{$task->assignedTo} " . html::a(common::getSysURL() . $this->createLink('task', 'view', "taskID={$task->id}"), $task->name);
?>
    </td>
  </tr>
  <tr>
    <td>
    <fieldset>
      <legend><?php 
echo $lang->task->legendDesc;
?>
</legend>
      <div class='content'>
      <?php 
if (strpos($task->desc, '<img src="data/upload')) {
    $task->desc = str_replace('<img src="', '<img src="http://' . $this->server->http_host . $this->config->webRoot, $task->desc);
}
开发者ID:huokedu,项目名称:zentao,代码行数:31,代码来源:sendmail.html.php

示例9: export

 /**
  * Export the stories of release to HTML.
  * 
  * @param  string $type story | bug
  * @access public
  * @return void
  */
 public function export($type)
 {
     if (!empty($_POST)) {
         if ($type == 'story') {
             $this->loadModel('story');
             $stories = $this->dao->select('id, title')->from(TABLE_STORY)->where($this->session->storyQueryCondition)->beginIF($this->session->storyOrderBy != false)->orderBy($this->session->storyOrderBy)->fi()->fetchAll('id');
             foreach ($stories as $story) {
                 $story->title = "<a href='" . common::getSysURL() . $this->createLink('story', 'view', "storyID={$story->id}") . "' target='_blank'>{$story->title}</a>";
             }
             $this->post->set('fields', array('id' => $this->lang->story->id, 'title' => $this->lang->story->title));
             $this->post->set('rows', $stories);
             $this->fetch('file', 'export2HTML', $_POST);
         } else {
             if ($type == 'bug') {
                 $this->loadModel('bug');
                 $bugs = $this->dao->select('id, title')->from(TABLE_BUG)->where($this->session->linkedBugQueryCondition)->beginIF($this->session->bugOrderBy != false)->orderBy($this->session->bugOrderBy)->fi()->fetchAll('id');
                 foreach ($bugs as $bug) {
                     $bug->title = "<a href='" . common::getSysURL() . $this->createLink('bug', 'view', "bugID={$bug->id}") . "' target='_blank'>{$bug->title}</a>";
                 }
                 $this->post->set('fields', array('id' => $this->lang->bug->id, 'title' => $this->lang->bug->title));
                 $this->post->set('rows', $bugs);
                 $this->fetch('file', 'export2HTML', $_POST);
             } else {
                 if ($type == 'newBugs') {
                     $this->loadModel('bug');
                     $bugs = $this->dao->select('id, title')->from(TABLE_BUG)->where($this->session->newBugsQueryCondition)->beginIF($this->session->bugOrderBy != false)->orderBy($this->session->bugOrderBy)->fi()->fetchAll('id');
                     foreach ($bugs as $bug) {
                         $bug->title = "<a href='" . common::getSysURL() . $this->createLink('bug', 'view', "bugID={$bug->id}") . "' target='_blank'>{$bug->title}</a>";
                     }
                     $this->post->set('fields', array('id' => $this->lang->bug->id, 'title' => $this->lang->bug->title));
                     $this->post->set('rows', $bugs);
                     $this->fetch('file', 'export2HTML', $_POST);
                 }
             }
         }
     }
     $this->display();
 }
开发者ID:fanscky,项目名称:HTPMS,代码行数:45,代码来源:control.php

示例10: isonlybody

 * @license     LGPL (http://www.gnu.org/licenses/lgpl.html)
 * @author      Chunsheng Wang <chunsheng@cnezsoft.com>
 * @package     bug
 * @version     $Id: sendmail.html.php 3717 2012-12-10 00:37:07Z zhujinyonging@gmail.com $
 * @link        http://www.zentao.net
 */
$onlybody = isonlybody() ? true : false;
if ($onlybody) {
    $_GET['onlybody'] = 'no';
}
?>
<table width='98%' align='center'>
  <tr class='header'>
    <td>
      TESTTASK #<?php 
echo $testtask->id . "=>{$testtask->owner} " . html::a(common::getSysURL() . $this->createLink('testtask', 'view', "testtaskID={$testtask->id}"), $testtask->name);
?>
    </td>
  </tr>
  <tr>
    <td>
    <fieldset>
      <legend><?php 
echo $lang->testtask->desc;
?>
</legend>
      <div class='content'><?php 
echo $testtask->desc;
?>
</div>
    </fieldset>
开发者ID:fanscky,项目名称:HTPMS,代码行数:31,代码来源:sendmail.html.php

示例11: isonlybody

 * @license     ZPL (http://zpl.pub/page/zplv12.html)
 * @author      Chunsheng Wang <chunsheng@cnezsoft.com>
 * @package     bug
 * @version     $Id: sendmail.html.php 4129 2013-01-18 01:58:14Z wwccss $
 * @link        http://www.zentao.net
 */
$onlybody = isonlybody() ? true : false;
if ($onlybody) {
    $_GET['onlybody'] = 'no';
}
?>
<table width='98%' align='center'>
  <tr class='header'>
    <td>
      STORY #<?php 
echo $story->id . "=>{$story->assignedTo} " . html::a(common::getSysURL() . $this->createLink('story', 'view', "storyID={$story->id}"), $story->title);
?>
    </td>
  </tr>
  <tr>
    <td>
    <fieldset>
      <legend><?php 
echo $lang->story->legendSpec;
?>
</legend>
      <div class='content'><?php 
echo $story->spec;
?>
</div>
    </fieldset>
开发者ID:caiwenhao,项目名称:zentao,代码行数:31,代码来源:sendmail.html.php

示例12:

<h1 class="caption"><?php 
echo $lang->info->mailModify;
?>
</h1>
<table width='98%' align='center'>
  <tr class='header'>
    <td>
      INFO #<?php 
echo $info->id . html::a(common::getSysURL() . $this->createLink('info', 'view', "infoID={$info->id}"), $info->title);
?>
    </td>
  </tr>
  <tr>
    <td><?php 
include '../../common/view/mail.html.php';
?>
</td>
  </tr>
</table>
<h1 class="caption"><?php 
echo $lang->info->mailMain;
?>
</h1>
<table width='98%' align='center'>
  <tr>
    <td class="content"><?php 
echo $info->content;
?>
</td>
  </tr>
</table>
开发者ID:huokedu,项目名称:zentao,代码行数:31,代码来源:sendmail.html.php

示例13: qrCode

 /**
  * Create qrcode for mobile login.
  * 
  * @access public
  * @return void
  */
 public function qrCode()
 {
     $loginAPI = common::getSysURL() . $this->config->webRoot;
     $session = $this->loadModel('user')->isLogon() ? '?sid=' . session_id() : '';
     if (!extension_loaded('gd')) {
         $this->view->noGDLib = sprintf($this->lang->misc->noGDLib, $loginAPI);
         die($this->display());
     }
     $this->app->loadClass('qrcode');
     QRcode::png($loginAPI . $session, false, 4, 9);
 }
开发者ID:XMGmen,项目名称:zentao,代码行数:17,代码来源:control.php

示例14: qrCode

 /**
  * Create qrcode for mobile login.
  * 
  * @access public
  * @return void
  */
 public function qrCode()
 {
     $loginAPI = common::getSysURL() . $this->config->webRoot;
     if ($this->loadModel('user')->isLogon()) {
         $loginAPI .= "?sid=" . session_ID();
     }
     if (!extension_loaded('gd')) {
         die(printf($this->lang->misc->noGDLib, $loginAPI));
     }
     $ciqrcode = $this->app->loadClass('qrcode');
     QRcode::png($loginAPI, false, 4, 9);
 }
开发者ID:laiello,项目名称:zentaoms,代码行数:18,代码来源:control.php

示例15: login


//.........这里部分代码省略.........
             $this->locate($this->createLink($this->config->default->module));
         }
     }
     /* Passed account and password by post or get. */
     if (!empty($_POST) or isset($_GET['account']) and isset($_GET['password'])) {
         $account = '';
         $password = '';
         if ($this->post->account) {
             $account = $this->post->account;
         }
         if ($this->get->account) {
             $account = $this->get->account;
         }
         if ($this->post->password) {
             $password = $this->post->password;
         }
         if ($this->get->password) {
             $password = $this->get->password;
         }
         if ($this->user->checkLocked($account)) {
             die(js::error(sprintf($this->lang->user->loginLocked, $this->config->user->lockMinutes)));
         }
         $user = $this->user->identify($account, $password);
         if ($user) {
             $this->user->cleanLocked($account);
             /* Authorize him and save to session. */
             $user->rights = $this->user->authorize($account);
             $user->groups = $this->user->getGroups($account);
             $this->session->set('user', $user);
             $this->app->user = $this->session->user;
             $this->loadModel('action')->create('user', $user->id, 'login');
             /* Keep login. */
             if ($this->post->keepLogin) {
                 $this->user->keepLogin($user);
             }
             $isDefult = $this->dao->select('password')->from(TABLE_DEFAULTPASSWORD)->Where('password')->eq($password)->fetchAll();
             //如果用户使用默认密码则跳到修改密码界面
             if ($isDefult) {
                 die(js::locate($this->createLink('my', 'changePassword', 'type=type'), 'parent'));
             }
             /* Go to the referer. */
             if ($this->post->referer and strpos($this->post->referer, $loginLink) === false and strpos($this->post->referer, $denyLink) === false) {
                 if ($this->app->getViewType() == 'json') {
                     die(json_encode(array('status' => 'success')));
                 }
                 /* Get the module and method of the referer. */
                 if ($this->config->requestType == 'PATH_INFO') {
                     $path = substr($this->post->referer, strrpos($this->post->referer, '/') + 1);
                     $path = rtrim($path, '.html');
                     if (empty($path)) {
                         $path = $this->config->requestFix;
                     }
                     list($module, $method) = explode($this->config->requestFix, $path);
                 } else {
                     $url = html_entity_decode($this->post->referer);
                     $param = substr($url, strrpos($url, '?') + 1);
                     list($module, $method) = explode('&', $param);
                     $module = str_replace('m=', '', $module);
                     $method = str_replace('f=', '', $method);
                 }
                 if (common::hasPriv($module, $method)) {
                     die(js::locate($this->post->referer, 'parent'));
                 } else {
                     die(js::locate($this->createLink($this->config->default->module), 'parent'));
                 }
             } else {
                 if ($this->app->getViewType() == 'json') {
                     die(json_encode(array('status' => 'success')));
                 }
                 die(js::locate($this->createLink($this->config->default->module), 'parent'));
             }
         } else {
             if ($this->app->getViewType() == 'json') {
                 die(json_encode(array('status' => 'failed')));
             }
             $fails = $this->user->failPlus($account);
             $remainTimes = $this->config->user->failTimes - $fails;
             if ($remainTimes <= 0) {
                 die(js::error(sprintf($this->lang->user->loginLocked, $this->config->user->lockMinutes)));
             } else {
                 if ($remainTimes <= 3) {
                     die(js::error(sprintf($this->lang->user->lockWarning, $remainTimes)));
                 }
             }
             die(js::error($this->lang->user->loginFailed));
         }
     } else {
         if (!empty($this->config->global->showDemoUsers)) {
             $demoUsers = $this->user->getPairs('nodeleted, noletter, noempty, noclosed');
             $this->view->demoUsers = $demoUsers;
         }
         $this->app->loadLang('misc');
         $this->view->noGDLib = sprintf($this->lang->misc->noGDLib, common::getSysURL() . $this->config->webRoot);
         $this->view->title = $this->lang->user->login;
         $this->view->referer = $this->referer;
         $this->view->s = zget($this->config->global, 'sn');
         $this->view->keepLogin = $this->cookie->keepLogin ? $this->cookie->keepLogin : 'off';
         $this->display();
     }
 }
开发者ID:xupnge1314,项目名称:project,代码行数:101,代码来源:login.php


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