Пример #1
0
 function get($key)
 {
     $value = parent::get($key);
     if (!is_null($value)) {
         return $value;
     }
     if (EXTERNAL_CACHE_DEBUG) {
         SugarCache::log('grabbing via zget(' . $this->_realKey($key) . ')');
     }
     return $this->_processGet($key, zget($this->_realKey($key)));
 }
Пример #2
0
 /**
  * Dump db. 
  * 
  * @param  string $fileName 
  * @param  array  $tables 
  * @access public
  * @return object
  */
 public function dump($fileName, $tables = array(), $fields = array(), $mode = 'data,schema', $condations = array(), $replaces = array())
 {
     /* Init the return. */
     $return = new stdclass();
     $return->result = true;
     $return->error = '';
     /* Get all tables in database. */
     $allTables = array();
     $stmt = $this->dbh->query('show tables');
     while ($table = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $table = current($table);
         $allTables[$table] = $table;
     }
     /* Dump all tables when tables is empty. */
     if (empty($tables)) {
         $tables = $allTables;
     }
     /* Check file. */
     if (empty($fileName)) {
         $return->result = false;
         $return->error = 'Has not file';
         return $return;
     }
     if (!is_writable(dirname($fileName))) {
         $return->result = false;
         $return->error = 'The directory is not writable';
         return $return;
     }
     /* Open this file. */
     $fp = fopen($fileName, 'w');
     fwrite($fp, "SET NAMES utf8;\n");
     foreach ($tables as $table) {
         /* Check table exists. */
         if (!isset($allTables[$table])) {
             continue;
         }
         /* Create sql code. */
         $backupSql = '';
         if (strpos($mode, 'schema') !== false) {
             $backupSql .= "DROP TABLE IF EXISTS `{$table}`;\n";
         }
         if (strpos($mode, 'schema') !== false) {
             $backupSql .= $this->getSchemaSQL($table);
         }
         if (strpos($mode, 'data') !== false) {
             $backupSql .= $this->getDataSQL($table, zget($condations, $table), zget($fields, $table), zget($replaces, $table));
         }
         /* Write sql code. */
         fwrite($fp, $backupSql);
     }
     fclose($fp);
     return $return;
 }
Пример #3
0
 /**
  * Pages admin list.
  * 
  * @access public
  * @return void
  */
 public function pages()
 {
     $template = $this->config->template->{$this->device}->name;
     $theme = $this->config->template->{$this->device}->theme;
     $this->block->loadTemplateLang($template);
     $this->view->title = $this->lang->block->browseRegion;
     $this->view->plans = $this->block->getPlans($template);
     $this->view->plan = zget($this->config->layout, $template . '_' . $theme);
     $this->view->template = $template;
     $this->view->uiHeader = true;
     $this->display();
 }
Пример #4
0
 /**
  * Set search params to session. 
  * 
  * @param  array    $searchConfig 
  * @access public
  * @return void
  */
 public function setSearchParams($searchConfig)
 {
     $searchParams['module'] = $searchConfig['module'];
     $searchParams['searchFields'] = json_encode($searchConfig['fields']);
     $searchParams['fieldParams'] = json_encode($searchConfig['params']);
     $searchParams['actionURL'] = $searchConfig['actionURL'];
     $searchParams['style'] = zget($searchConfig, 'style', 'full');
     $searchParams['queryID'] = isset($searchConfig['queryID']) ? $searchConfig['queryID'] : 0;
     /* remove onlybody for url*/
     $onlybodyParam = $this->config->requestType == 'GET' ? '&onlybody=yes' : '?onlybody=yes';
     $searchParams['actionURL'] = str_replace($onlybodyParam, '', $searchParams['actionURL']);
     $this->session->set('searchParams', $searchParams);
 }
Пример #5
0
 /**
  * Index page.
  * @access public
  * @return void
  */
 public function index()
 {
     $community = zget($this->config->global, 'community');
     if (!$community or $community == 'na') {
         $this->view->bind = false;
         $this->view->account = false;
         $this->view->ignore = $community == 'na';
     } else {
         $this->view->bind = true;
         $this->view->account = $community;
         $this->view->ignore = false;
     }
     $this->app->loadLang('misc');
     $this->view->title = $this->lang->admin->common;
     $this->display();
 }
Пример #6
0
 /**
  * Edit the mail config.
  * 
  * @access public
  * @return void
  */
 public function edit()
 {
     if ($this->config->mail->turnon) {
         $mailConfig = $this->config->mail->smtp;
         $mailConfig->fromAddress = $this->config->mail->fromAddress;
         $mailConfig->fromName = $this->config->mail->fromName;
         $mailConfig->charset = zget($mailConfig, 'charset', 'utf-8');
     } elseif ($this->session->mailConfig) {
         $mailConfig = $this->session->mailConfig;
     } else {
         $this->locate(inlink('detect'));
     }
     $this->view->title = $this->lang->mail->common . $this->lang->colon . $this->lang->mail->edit;
     $this->view->position[] = html::a(inlink('index'), $this->lang->mail->common);
     $this->view->position[] = $this->lang->mail->edit;
     $this->view->mailExist = $this->mail->mailExist();
     $this->view->mailConfig = $mailConfig;
     $this->display();
 }
Пример #7
0
 /**
  * Get list.
  * 
  * @param  string  $objectType 
  * @param  int    $objectID 
  * @access public
  * @return array
  */
 public function getList($objectType, $objectID)
 {
     $addresses = $this->getByObject($objectType, $objectID);
     if ($objectType == 'contact') {
         $contact = $this->loadModel('contact')->getByID($objectID);
         if (isset($contact->customer)) {
             $addresses = array_merge($this->getByObject('customer', $contact->customer), $addresses);
         }
     }
     /* Join area and location to fullLocation. */
     $areaList = $this->loadModel('tree')->getOptionMenu('area');
     foreach ($addresses as $address) {
         $address->fullLocation = '';
         if (isset($address->area)) {
             $address->fullLocation .= str_replace('/', ' ', zget($areaList, $address->area));
         }
         $address->fullLocation .= ' ' . $address->location;
     }
     return $addresses;
 }
Пример #8
0
    echo $todo->id;
    ?>
      </td>
      <td><?php 
    echo $todo->date == '2030-01-01' ? $lang->todo->periods['future'] : $todo->date;
    ?>
</td>
      <td><?php 
    echo $lang->todo->typeList[$todo->type];
    ?>
</td>
      <td><span class='<?php 
    echo 'pri' . zget($lang->todo->priList, $todo->pri, $todo->pri);
    ?>
'><?php 
    echo zget($lang->todo->priList, $todo->pri, $todo->pri);
    ?>
</span></td>
      <td class='text-left'><?php 
    echo html::a($this->createLink('todo', 'view', "id={$todo->id}&from=my", '', true), $todo->name, '', "data-toggle='modal' data-type='iframe' data-title='" . $lang->todo->view . "' data-icon='check'");
    ?>
</td>
      <td><?php 
    echo $todo->begin;
    ?>
</td>
      <td><?php 
    echo $todo->end;
    ?>
</td>
      <td class='<?php 
Пример #9
0
 * @license     ZPLV1.2 (http://zpl.pub/page/zplv12.html)
 * @author      Xiying Guan <*****@*****.**>
 * @package     order
 * @version     $Id$
 * @link        http://www.zentao.net
 */
include '../../common/view/header.modal.html.php';
?>
<table class='table table-form'>
  <tr>
    <th class='w-100px'><?php 
echo $lang->order->express;
?>
</th>
    <td><?php 
echo zget($expressList, $order->express);
?>
</td>
  </tr>
  <tr>
    <th class='w-100px'><?php 
echo $lang->order->waybill;
?>
</th>
    <td><?php 
echo $order->waybill;
?>
</td>
  </tr>
  <tr>
    <th class='w-100px'><?php 
Пример #10
0
?>
    <ul class='nav navbar-nav' id='navbarSwitcher'>
      <li><a href='###'><i class='icon-chevron-sign-right icon-large'></i></a></li>
    </ul>
    <?php 
echo commonModel::createManagerMenu();
?>
  </div>
</nav>

<div class="clearfix row-main">
  <?php 
$moduleName = $this->moduleName;
?>
  <?php 
$menuGroup = zget($lang->menuGroups, $moduleName);
?>
  <?php 
if ($moduleName != 'ui' && $menuGroup != 'ui') {
    ?>
  <?php 
    $moduleMenu = commonModel::createModuleMenu($this->moduleName);
    ?>
  <?php 
    if ($moduleMenu or !empty($treeModuleMenu)) {
        ?>
  <div class='col-md-2'>
    <div class="leftmenu affix hiddden-xs hidden-sm">
      <?php 
        if ($moduleMenu) {
            echo $moduleMenu;
Пример #11
0
    if ($action->appName == 'sys') {
        $action->appName = 'superadmin';
    }
    ?>
  <?php 
    if ($action->objectType == 'todo') {
        $action->appName = 'dashboard';
    }
    ?>
  <tr class='text-center'>
    <td class='text-left'><?php 
    echo $action->date;
    ?>
</td>
    <td><?php 
    echo zget($users, $action->actor, $action->actor);
    ?>
</td>
    <td><?php 
    echo $action->actionLabel;
    ?>
</td>
    <td><?php 
    echo $lang->action->objectTypes[$action->objectType];
    ?>
</td>
    <td><?php 
    echo $action->objectID;
    ?>
</td>
    <td class='text-left'><?php 
Пример #12
0
?>
</th>
          <td>
            <?php 
echo html::input('key', zget($setting, 'key', ' '), "class='form-control'");
?>
          </td>
        </tr>
        <tr>
          <th><?php 
echo $lang->site->yangcong->auth;
?>
</th>
          <td>
            <?php 
echo html::input('auth', zget($setting, 'auth', ' '), "class='form-control'");
?>
          </td>
        </tr>
        <tr>
         <th></th> <td><?php 
echo html::submitButton();
?>
</td>
        </tr>
      </table>
    </form>
  </div>
</div>
<?php 
include '../../common/view/footer.admin.html.php';
Пример #13
0
 /**
  * Create a comapny, set admin.
  * 
  * @access public
  * @return void
  */
 public function grantPriv()
 {
     if ($this->post->password == '') {
         die(js::error($this->lang->install->errorEmptyPassword));
     }
     /* Insert a company. */
     $company = new stdclass();
     $company->name = $this->post->company;
     $company->admins = ",{$this->post->account},";
     $this->dao->insert(TABLE_COMPANY)->data($company)->autoCheck()->batchCheck('name', 'notempty')->exec();
     if (!dao::isError()) {
         /* Set admin. */
         $admin = new stdclass();
         $admin->account = $this->post->account;
         $admin->realname = $this->post->account;
         $admin->password = md5($this->post->password);
         $admin->gender = '';
         $this->dao->insert(TABLE_USER)->data($admin)->check('account', 'notempty')->exec();
         /* Update group name and desc on dafault lang. */
         $groups = $this->dao->select('*')->from(TABLE_GROUP)->orderBy('id')->fetchAll();
         foreach ($groups as $group) {
             $data = zget($this->lang->install->groupList, $group->name, '');
             if ($data) {
                 $this->dao->update(TABLE_GROUP)->data($data)->where('id')->eq($group->id)->exec();
             }
         }
     }
 }
Пример #14
0
            <th><?php 
echo $lang->project->QD;
?>
</th>
            <td><?php 
echo zget($users, $project->QD, $project->QD);
?>
</td>
          </tr>
          <tr>
            <th><?php 
echo $lang->project->RD;
?>
</th>
            <td><?php 
echo zget($users, $project->RD, $project->RD);
?>
</td>
          </tr>
          <tr>
            <th><?php 
echo $lang->project->products;
?>
</th>
            <td>
              <?php 
foreach ($products as $productID => $productName) {
    echo html::a($this->createLink('product', 'browse', "productID={$productID}"), $productName) . '<br />';
}
?>
            </td>
Пример #15
0
 /**
  * User login, identify him and authorize him.
  * 
  * @access public
  * @return void
  */
 public function login($referer = '', $from = '')
 {
     $this->setReferer($referer);
     $loginLink = $this->createLink('user', 'login');
     $denyLink = $this->createLink('user', 'deny');
     /* Reload lang by lang of get when viewType is json. */
     if ($this->app->getViewType() == 'json' and $this->get->lang and $this->get->lang != $this->app->getClientLang()) {
         $this->app->setClientLang($this->get->lang);
         $this->app->loadLang('user');
     }
     /* If user is logon, back to the rerferer. */
     if ($this->user->isLogon()) {
         if ($this->app->getViewType() == 'json') {
             $data = $this->user->getDataInJSON($this->app->user);
             die(helper::removeUTF8Bom(json_encode(array('status' => 'success') + $data)));
         }
         if (strpos($this->referer, $loginLink) === false and strpos($this->referer, $denyLink) === false and $this->referer) {
             die(js::locate($this->referer, 'parent'));
         } else {
             die(js::locate($this->createLink($this->config->default->module), 'parent'));
         }
     }
     /* 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)) {
             $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 : '******';
         $this->display();
     }
 }
Пример #16
0
</h5>
              <div class='chart-canvas'><canvas id='chart-<?php 
    echo $chartType;
    ?>
' width='<?php 
    echo $chartOption->width;
    ?>
' height='<?php 
    echo $chartOption->height;
    ?>
' data-responsive='true'></canvas></div>
            </div>
          </td>
          <td style='width: 320px'>
            <?php 
    $height = zget($lang->bug->report->{$chartType}, 'height', $lang->bug->report->options->height) . 'px';
    ?>
            <div style="overflow:auto" class='table-wrapper'>
              <table class='table table-condensed table-hover table-striped table-bordered table-chart' data-chart='<?php 
    echo $chartOption->type;
    ?>
' data-target='#chart-<?php 
    echo $chartType;
    ?>
' data-animation='false'>
                <thead>
                  <tr>
                    <th class='chart-label' colspan='2'><?php 
    echo $lang->report->item;
    ?>
</th>
Пример #17
0
  </div>
  <div class='panel-body'>
    <form method='post' id='ajaxForm' class='form-inline'>
      <table class='table table-form'>
        <?php 
foreach ($lang->guarder->operationList->{$type} as $item => $operation) {
    ?>
        <tr>
          <th class='text-middle text-center w-100px'><?php 
    echo $operation;
    ?>
</th>
          <td>
            <div class='input-group'>
              <?php 
    echo html::input("interval[{$item}]", zget($this->config->guarder->interval->{$type}, $item), "class='form-control'");
    ?>
              <span class='input-group-addon'><?php 
    echo $lang->guarder->interval;
    echo $lang->guarder->exceed;
    ?>
</span>
              <?php 
    echo html::input("limits[interval][{$item}]", $this->config->guarder->limits->{$type}->interval->{$item}, "class='form-control'");
    ?>
              <span class='input-group-addon'><?php 
    echo $lang->guarder->times . $lang->guarder->then . $lang->guarder->disable;
    ?>
</span>
              <?php 
    echo html::select("punishment[interval][{$item}]", $lang->guarder->punishOptions, $this->config->guarder->punishment->{$type}->interval->{$item}, "class='form-control'");
Пример #18
0
 /**
  * Get results by runID or caseID
  * 
  * @param  int   $runID 
  * @param  int   $caseID 
  * @access public
  * @return array
  */
 public function getResults($runID, $caseID = 0)
 {
     if ($caseID > 0) {
         $results = $this->dao->select('*')->from(TABLE_TESTRESULT)->where('`case`')->eq($caseID)->orderBy('id desc')->fetchAll('id');
     } else {
         $results = $this->dao->select('*')->from(TABLE_TESTRESULT)->where('run')->eq($runID)->orderBy('id desc')->fetchAll('id');
     }
     if (!$results) {
         return array();
     }
     $relatedVersions = array();
     $runIdList = array();
     foreach ($results as $result) {
         $runIdList[$result->run] = $result->run;
         $relatedVersions[] = $result->version;
         $runCaseID = $result->case;
     }
     $relatedVersions = array_unique($relatedVersions);
     $relatedSteps = $this->dao->select('*')->from(TABLE_CASESTEP)->where('`case`')->eq($runCaseID)->andWhere('version')->in($relatedVersions)->fetchAll();
     $runs = $this->dao->select('t1.id,t2.build')->from(TABLE_TESTRUN)->alias('t1')->leftJoin(TABLE_TESTTASK)->alias('t2')->on('t1.task=t2.id')->where('t1.id')->in($runIdList)->fetchPairs();
     foreach ($results as $resultID => $result) {
         $result->stepResults = unserialize($result->stepResults);
         $result->build = $result->run ? zget($runs, $result->run, 0) : 0;
         $results[$resultID] = $result;
         foreach ($relatedSteps as $key => $step) {
             if ($result->version == $step->version) {
                 $result->stepResults[$step->id]['desc'] = $step->desc;
                 $result->stepResults[$step->id]['expect'] = $step->expect;
             }
         }
     }
     return $results;
 }
Пример #19
0
 /**
  * Get roles for some users.
  * 
  * @param  string    $users 
  * @access public
  * @return array
  */
 public function getUserRoles($users)
 {
     $users = $this->dao->select('account, role')->from(TABLE_USER)->where('account')->in($users)->fetchPairs();
     if (!$users) {
         return array();
     }
     foreach ($users as $account => $role) {
         $users[$account] = zget($this->lang->user->roleList, $role, $role);
     }
     return $users;
 }
Пример #20
0
 /**
  * Get pie chart data of one type.
  * 
  * @param  string  $type
  * @param  int     $begin 
  * @param  int     $end 
  * @access public
  * @return array
  */
 public function getPieByType($type, $begin, $end, $groupBy = 'item')
 {
     $charts = array();
     $reports = $this->dao->select('*, sum(ip) as ip, sum(pv) as pv, sum(uv) as uv')->from(TABLE_STATREPORT)->where('type')->eq($type)->andWhere('timeType')->eq('day')->beginIf($begin != '')->andWhere('timeValue')->ge($begin)->fi()->beginIf($end != '')->andWhere('timeValue')->le($end)->fi()->groupBy($groupBy)->fetchAll($groupBy);
     $colors = $this->config->stat->chartColors;
     $this->loadModel('log');
     $i = 0;
     foreach ($reports as $item => $report) {
         $color[$item] = isset($color[$item]) ? $color[$item] : $colors[$i];
         $i++;
         $pv = new stdclass();
         $pv->value = $report->pv;
         $pv->color = $color[$item];
         $pv->label = zget($this->lang->stat->itemList, $item);
         $uv = new stdclass();
         $uv->value = $report->uv;
         $uv->color = $color[$item];
         $uv->label = zget($this->lang->stat->itemList, $item);
         $ip = new stdclass();
         $ip->value = $report->ip;
         $ip->color = $color[$item];
         $ip->label = zget($this->lang->stat->itemList, $item);
         $charts['pv'][] = $pv;
         $charts['uv'][] = $uv;
         $charts['ip'][] = $ip;
     }
     return $charts;
 }
Пример #21
0
          </tr>
          <tr>
            <th><?php 
echo $lang->task->closedReason;
?>
</th>
            <td><?php 
echo $lang->task->reasonList[$task->closedReason];
?>
</td>
          </tr>
          <tr>
            <th><?php 
echo $lang->task->lastEdited;
?>
</th>
            <td><?php 
if ($task->lastEditedBy) {
    echo zget($users, $task->lastEditedBy, $task->lastEditedBy) . $lang->at . $task->lastEditedDate;
}
?>
</td>
          </tr>
        </table>
      </fieldset>
    </div>
  </div>
</div>
<?php 
include '../../common/view/syntaxhighlighter.html.php';
include '../../common/view/footer.html.php';
Пример #22
0
 /**
  * Login.
  * 
  * @param string $referer 
  * @access public
  * @return void
  */
 public function login($referer = '')
 {
     $this->setReferer($referer);
     /* Load mail config for reset password. */
     $this->app->loadConfig('mail');
     $loginLink = $this->createLink('user', 'login');
     $denyLink = $this->createLink('user', 'deny');
     $regLink = $this->createLink('user', 'register');
     /* If the user logon already, goto the pre page. */
     if ($this->user->isLogon()) {
         if (helper::isAjaxRequest()) {
             if ($this->referer and strpos($loginLink . $denyLink . $regLink, $this->referer) === false and strpos($this->referer, $loginLink) === false) {
                 $this->send(array('result' => 'success', 'locate' => $this->referer));
             }
             $this->send(array('result' => 'success', 'locate' => $this->createLink($this->config->default->module)));
         }
         if ($this->referer and strpos($loginLink . $denyLink . $regLink, $this->referer) === false and strpos($this->referer, $loginLink) === false) {
             $this->locate($this->referer);
         }
         $this->locate($this->createLink($this->config->default->module));
         exit;
     }
     /* If the user sumbit post, check the user and then authorize him. */
     if (!empty($_POST)) {
         $user = $this->user->getByAccount($this->post->account);
         /* check client ip and location if login is admin. */
         if (RUN_MODE == 'admin') {
             if (zget($this->config->site, 'forceYangcong') == 'open' and strtolower($this->app->getMethodName()) != 'yangconglogin') {
                 $error = $this->lang->user->forceYangcong;
                 $pass = $this->loadModel('guarder')->verify();
                 $captchaUrl = $this->createLink('guarder', 'validate', "url=&target=modal&account={$this->post->account}&type=");
                 if (!$pass) {
                     $this->send(array('result' => 'fail', 'reason' => 'captcha', 'message' => $error, 'url' => $captchaUrl));
                 }
             }
             $checkIP = $this->user->checkIP();
             $checkAllowedLocation = $this->user->checkAllowedLocation();
             $checkLoginLocation = $this->user->checkLoginLocation($this->post->account);
             if ($user and (!$checkIP or !$checkAllowedLocation or !$checkLoginLocation)) {
                 $error = $checkIP ? '' : $this->lang->user->ipDenied;
                 $error .= $checkAllowedLocation ? '' : $this->lang->user->locationDenied;
                 $error .= $checkLoginLocation ? '' : $this->lang->user->loginLocationChanged;
                 $pass = $this->loadModel('guarder')->verify();
                 $captchaUrl = $this->createLink('guarder', 'validate', "url=&target=modal&account={$this->post->account}");
                 if (!$pass) {
                     $this->send(array('result' => 'fail', 'reason' => 'captcha', 'message' => $error, 'url' => $captchaUrl));
                 }
             }
         }
         if (!$this->user->login($this->post->account, $this->post->password)) {
             $this->loadModel('guarder')->logOperation('ip', 'logonFailure');
             $this->loadModel('guarder')->logOperation('account', 'logonFailure', $this->post->account);
             $this->send(array('result' => 'fail', 'message' => $this->lang->user->loginFailed));
         }
         if (RUN_MODE == 'front') {
             if (isset($this->config->site->checkEmail) and $this->config->site->checkEmail == 'open' and $this->config->mail->turnon and !$user->emailCertified) {
                 $referer = helper::safe64Encode($this->post->referer);
                 if (!helper::isAjaxRequest()) {
                     helper::header301("http://" . $_SERVER['HTTP_HOST'] . inlink('checkEmail', "referer={$referer}"));
                 }
                 $this->send(array('result' => 'success', 'locate' => inlink('checkEmail', "referer={$referer}")));
             }
         }
         /* Goto the referer or to the default module */
         if ($this->post->referer != false and strpos($loginLink . $denyLink . $regLink, $this->post->referer) === false) {
             if (!helper::isAjaxRequest()) {
                 helper::header301(urldecode($this->post->referer));
             }
             $this->send(array('result' => 'success', 'locate' => urldecode($this->post->referer)));
         } else {
             $default = $this->config->user->default;
             if (!helper::isAjaxRequest()) {
                 helper::header301("http://" . $_SERVER['HTTP_HOST'] . $this->createLink($default->module, $default->method));
             }
             $this->send(array('result' => 'success', 'locate' => $this->createLink($default->module, $default->method)));
         }
     }
     if (!$this->session->random) {
         $this->session->set('random', md5(time() . mt_rand()));
     }
     $this->view->title = $this->lang->user->login->common;
     $this->view->referer = $this->referer;
     if (RUN_MODE == 'front') {
         $this->view->mobileURL = helper::createLink('user', 'login', "referer={$referer}", '', 'mhtml');
         $this->view->desktopURL = helper::createLink('user', 'login', "referer={$referer}", '', 'html');
     }
     $this->display();
 }
Пример #23
0
                      <input class='ml-10px' type='checkbox' name='unlinkBugs[]'  value='<?php 
        echo $bug->id;
        ?>
'/> 
                      <?php 
    }
    ?>
                      <?php 
    echo html::a($this->createLink('bug', 'view', "bugID={$bug->id}"), sprintf("%03d", $bug->id));
    ?>
                    </td>
                    <td><span class='<?php 
    echo 'pri' . zget($lang->bug->priList, $bug->pri, $bug->pri);
    ?>
'><?php 
    echo zget($lang->bug->priList, $bug->pri, $bug->pri);
    ?>
</span></td>
                    <td class='text-left nobr'><?php 
    echo html::a($this->createLink('bug', 'view', "bugID={$bug->id}"), $bug->title);
    ?>
</td>
                    <td><?php 
    echo $users[$bug->openedBy];
    ?>
</td>
                    <td><?php 
    echo $users[$bug->assignedTo];
    ?>
</td>
                    <td class='bug-<?php 
Пример #24
0
 /**
  * Get bug info from a result.
  * 
  * @param  int    $resultID 
  * @param  int    $caseID
  * @param  int    $version
  * @access public
  * @return array
  */
 public function getBugInfoFromResult($resultID, $caseID = 0, $version = 0)
 {
     $title = '';
     $bugSteps = '';
     $steps = zget($_POST, 'stepIDList', array());
     $result = $this->dao->findById($resultID)->from(TABLE_TESTRESULT)->fetch();
     if ($caseID > 0) {
         $run = new stdclass();
         $run->case = $this->loadModel('testcase')->getById($caseID, $result->version);
     } else {
         $run = $this->loadModel('testtask')->getRunById($result->run);
     }
     if ($result and $result->caseResult == 'fail') {
         $title = $run->case->title;
         $caseSteps = $run->case->steps;
         $stepResults = unserialize($result->stepResults);
         if ($run->case->precondition != '') {
             $bugSteps = "<p>[" . $this->lang->testcase->precondition . "]</p>" . "\n" . $run->case->precondition;
         }
         $bugSteps .= $this->lang->bug->tplStep;
         if (!empty($stepResults)) {
             $i = 0;
             foreach ($caseSteps as $key => $step) {
                 if (!in_array($step->id, $steps)) {
                     continue;
                 }
                 $i++;
                 $bugSteps .= $i . '. ' . $step->desc . "<br />";
             }
             $bugSteps .= $this->lang->bug->tplResult;
             $i = 0;
             foreach ($caseSteps as $key => $step) {
                 if (!in_array($step->id, $steps)) {
                     continue;
                 }
                 $i++;
                 if (empty($stepResults[$step->id]['real'])) {
                     continue;
                 }
                 $bugSteps .= $i . '. ' . $stepResults[$step->id]['real'] . "<br />";
             }
             $bugSteps .= $this->lang->bug->tplExpect;
             $i = 0;
             foreach ($caseSteps as $key => $step) {
                 if (!in_array($step->id, $steps)) {
                     continue;
                 }
                 $i++;
                 if (!$step->expect) {
                     continue;
                 }
                 $bugSteps .= $i . '. ' . $step->expect . "<br />";
             }
         } else {
             $bugSteps .= $this->lang->bug->tplResult;
             $bugSteps .= $this->lang->bug->tplExpect;
         }
     }
     return array('title' => $title, 'steps' => $bugSteps, 'storyID' => $run->case->story, 'moduleID' => $run->case->module, 'version' => $run->case->version);
 }
Пример #25
0
        <label>
          <input type='checkbox' name='titleless' value='1' <?php 
if (zget($block, 'borderless') == 1) {
    echo 'checked';
}
?>
/>
          <?php 
echo $this->lang->block->titleless;
?>
        <label>
      </td>
      <td class='w-100px'>
        <label>
        <input type='checkbox' name='borderless' value='1' <?php 
if (zget($block, 'borderless') == 1) {
    echo 'checked';
}
?>
/>
          <?php 
echo $this->lang->block->borderless;
?>
        <label>
      </td>
    </tr>
    <tr>
      <td></td>
      <td colspan='2'> <?php 
echo html::submitButton() . html::hidden('page', $layout->page) . html::hidden('region', $layout->region) . html::hidden('block', $block->id);
?>
Пример #26
0
    echo $story->id;
    ?>
' /> 
          <?php 
    if ($canView) {
        echo html::a($viewLink, sprintf('%03d', $story->id));
    } else {
        printf('%03d', $story->id);
    }
    ?>
        </td>
        <td><span class='<?php 
    echo 'pri' . zget($lang->story->priList, $story->pri, $story->pri);
    ?>
'><?php 
    echo zget($lang->story->priList, $story->pri, $story->pri);
    ?>
</span></td>
        <td class='text-left' title="<?php 
    echo $story->title;
    ?>
"><nobr><?php 
    echo html::a($viewLink, $story->title);
    ?>
</nobr></td>
        <td title="<?php 
    echo $story->planTitle;
    ?>
"><?php 
    echo $story->planTitle;
    ?>
Пример #27
0
 /**                                                                                                         
  * Display express info.                                                                                    
  *                                                                                                          
  * @param $order                                                                                            
  * @access public                                                                                           
  * @return string                                                                                           
  */
 public function expressInfo($order = '')
 {
     $expressList = $this->loadModel('tree')->getPairs(0, 'express');
     $expressInfo = zget($expressList, $order->express);
     return $expressInfo;
 }
Пример #28
0
  <?php 
    $appid = isset($_GET['entry']) ? "class='app-btn' data-id='{$this->get->entry}'" : '';
    ?>
  <tr data-url='<?php 
    echo $sso . $sign . 'referer=' . base64_encode($this->createLink('testcase', 'view', "caseID={$case->id}"));
    ?>
' <?php 
    echo $appid;
    ?>
>
    <td><?php 
    echo $case->id;
    ?>
</td>
    <td><?php 
    echo zget($lang->case->priList, $case->pri, $case->pri);
    ?>
</td>
    <td title='<?php 
    echo $case->title;
    ?>
'><?php 
    echo $case->title;
    ?>
</td>
    <td><?php 
    if (!helper::isZeroDate($case->lastRunDate)) {
        echo date(DT_MONTHTIME1, strtotime($case->lastRunDate));
    }
    ?>
</td>
Пример #29
0
        <td class='text-left'><?php 
    if ($thread->replies) {
        echo substr($thread->repliedDate, 5, -3) . ' ' . $thread->repliedByRealname;
    }
    ?>
</td>
        <?php 
    if ($this->config->forum->postReview == 'open') {
        ?>
        <td>
          <span class="<?php 
        echo $thread->status == 'approved' ? 'text-success' : 'text-warning';
        ?>
">
            <?php 
        echo zget($lang->thread->statusList, $thread->status);
        ?>
          </span>
        </td>
        <?php 
    }
    ?>
        <td><?php 
    if ($thread->status != 'wait') {
        echo $thread->hidden ? '<span class="text-warning"><i class="icon-eye-close"></i> ' . $lang->thread->displayList['hidden'] . '</span>' : '<span class="text-success"><i class="icon-ok-sign"></i> ' . $lang->thread->displayList['normal'] . '</span>';
    }
    ?>
</td>
        <td>
          <?php 
    if ($this->config->forum->postReview == 'open' and $thread->status == 'wait') {
  </div><?php 
/* end '.outer' in 'header.html.php'. */
?>
  <script>setTreeBox()</script>
  <?php 
if ($extView = $this->getExtViewFile(__FILE__)) {
    include $extView;
    return helper::cd();
}
?>
  
  <div id='divider'></div>
  <iframe frameborder='0' name='hiddenwin' id='hiddenwin' scrolling='no' class='debugwin hidden'></iframe>
<?php 
$onlybody = zget($_GET, 'onlybody', 'no');
if ($onlybody != 'yes') {
    ?>
</div><?php 
    /* end '#wrap' in 'header.html.php'. */
    ?>
<div id='footer'>
  <div id="crumbs">
    <?php 
    commonModel::printBreadMenu($this->moduleName, isset($position) ? $position : '');
    ?>
  </div>
  <div id="poweredby">
  <a href='http://www.zentao.net' target='_blank' class='text-primary'><i class='icon-zentao'></i> <?php 
    echo $lang->zentaoPMS . $config->version;
    ?>
</a> &nbsp;