示例#1
0
 /**
  * Browse surveys.
  *
  * @param  string   $status
  * @access public
  * @return void
  */
 public function browse($status = 'installed')
 {
     $packages = $this->survey->getLocalPackages($status);
     $versions = array();
     if ($packages and $status == 'installed') {
         /* Get latest release from remote. */
         $extCodes = helper::safe64Encode(join(',', array_keys($packages)));
         $results = $this->survey->getPackagesByAPI('bycode', $extCodes, $recTotal = 0, $recPerPage = 1000, $pageID = 1);
         if (isset($results->extensions)) {
             $remoteReleases = $results->extensions;
             foreach ($remoteReleases as $release) {
                 if (!isset($packages[$release->code])) {
                     continue;
                 }
                 $package = $packages[$release->code];
                 $package->viewLink = $release->viewLink;
                 if (isset($release->latestRelease) and $package->version != $release->latestRelease->releaseVersion and $this->package->checkVersion($release->latestRelease->chanzhiCompatible)) {
                     $upgradeLink = inlink('upgrade', "package={$release->code}&downLink=" . helper::safe64Encode($release->latestRelease->downLink) . "&md5={$release->latestRelease->md5}&type={$release->type}");
                     $upgradeLink = ($release->latestRelease->charge or !$release->latestRelease->public) ? $release->latestRelease->downLink : $upgradeLink;
                     $package->upgradeLink = $upgradeLink;
                 }
             }
         }
     }
     $this->view->title = $this->lang->survey->browse;
     $this->view->position[] = $this->lang->survey->browse;
     $this->view->tab = $status;
     $this->view->packages = $packages;
     $this->view->versions = $versions;
     $this->view->status = $status;
     $this->display();
 }
示例#2
0
文件: control.php 项目: leowh/colla
 /**
  * Obtain web app. 
  * 
  * @param  string $type 
  * @param  string $param 
  * @param  int    $recTotal 
  * @param  int    $recPerPage 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function obtain($type = 'byUpdatedTime', $param = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     $this->lang->webapp->menu = $this->lang->entry->menu;
     $this->lang->menuGroups->webapp = 'entry';
     /* Init vars. */
     $type = strtolower($type);
     $moduleID = $type == 'bymodule' ? (int) $param : 0;
     $webapps = array();
     $pager = null;
     /* Set the key. */
     if ($type == 'bysearch') {
         $param = helper::safe64Encode($this->post->key);
     }
     /* Get results from the api. */
     $recPerPage = $this->cookie->pagerWebappObtain ? $this->cookie->pagerWebappObtain : $recPerPage;
     $results = $this->webapp->getAppsByAPI($type, $param, $recTotal, $recPerPage, $pageID);
     if ($results) {
         $this->app->loadClass('pager', $static = true);
         $pager = new pager($results->dbPager->recTotal, $results->dbPager->recPerPage, $results->dbPager->pageID);
         $webapps = $results->webapps;
     }
     $this->view->title = $this->lang->webapp->common . $this->lang->colon . $this->lang->webapp->obtain;
     $this->view->position[] = $this->lang->webapp->obtain;
     $this->view->moduleTree = $this->webapp->getModulesByAPI();
     $this->view->webapps = $webapps;
     $this->view->installeds = $this->webapp->getLocalApps();
     $this->view->pager = $pager;
     $this->view->tab = 'obtain';
     $this->view->type = $type;
     $this->view->moduleID = $moduleID;
     $this->display();
 }
示例#3
0
文件: control.php 项目: leowh/colla
 /** 
  * Post a thread.
  * 
  * @param  int      $boardID 
  * @access public
  * @return void
  */
 public function post($boardID = 0)
 {
     $this->loadModel('forum');
     if ($this->app->user->account == 'guest') {
         die(js::locate($this->createLink('user', 'login', "referer=" . helper::safe64Encode($this->app->getURI()))));
     }
     /* Get the board. */
     $board = $this->loadModel('tree')->getById($boardID);
     /* Checking the board exist or not. */
     if (!$board) {
         die(js::error($this->lang->forum->notExist) . js::locate('back'));
     }
     /* Checking current user can post to the board or not. */
     if (!$this->forum->canPost($board)) {
         die(js::error($this->lang->forum->readonly) . js::locate('back'));
     }
     /* Set editor for current user. */
     $this->thread->setEditor($board->id, 'post');
     /* User posted a thread, try to save it to database. */
     if ($_POST) {
         $threadID = $this->thread->post($boardID);
         if (dao::isError()) {
             $this->send(array('result' => 'fail', 'message' => dao::getError()));
         }
         $locate = inlink('view', "threadID={$threadID}");
         $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate));
     }
     $this->view->title = $board->name . $this->lang->minus . $this->lang->thread->post;
     $this->view->board = $board;
     $this->view->boards = $this->forum->getBoards();
     $this->view->canManage = $this->thread->canManage($boardID);
     $this->display();
 }
示例#4
0
 /**
  * Obtain packages from the community.
  * 
  * @param  string $type 
  * @param  string $param 
  * @access public
  * @return void
  */
 public function obtain($type = 'byUpdatedTime', $param = '', $recTotal = 0, $recPerPage = 10, $pageID = 1)
 {
     /* Init vars. */
     $type = strtolower($type);
     $moduleID = $type == 'bymodule' ? (int) $param : 0;
     $packages = array();
     $pager = null;
     /* Set the key. */
     if ($type == 'bysearch') {
         $param = helper::safe64Encode($this->post->key);
     }
     /* Get results from the api. */
     $results = $this->package->getPackagesByAPI($type, $param, $recTotal, $recPerPage, $pageID);
     if ($results) {
         $this->app->loadClass('pager', $static = true);
         $pager = new pager($results->dbPager->recTotal, $results->dbPager->recPerPage, $results->dbPager->pageID);
         $packages = $results->extensions;
     }
     $this->view->title = $this->lang->package->obtain;
     $this->view->position[] = $this->lang->package->obtain;
     $this->view->moduleTree = str_replace('/index.php', $this->server->script_name, $this->package->getModulesByAPI());
     $this->view->packages = $packages;
     $this->view->installeds = $this->package->getLocalPackages('installed');
     $this->view->pager = $pager;
     $this->view->tab = 'obtain';
     $this->view->type = $type;
     $this->view->moduleID = $moduleID;
     $this->display();
 }
示例#5
0
 /**
  * Order confirm page.
  * 
  * @param  int    $product 
  * @param  int    $count 
  * @access public
  * @return void
  */
 public function confirm($product = 0, $count = 0)
 {
     $this->loadModel('product');
     $this->app->loadLang('cart');
     $referer = helper::safe64Encode(inlink('confirm', "product={$product}&count={$count}"));
     $mobileURL = helper::createLink('order', 'confirm', "product={$product}&count={$count}", '', 'mhtml');
     $desktopURL = helper::createLink('order', 'confirm', "product={$product}&count={$count}", '', 'html');
     if ($_POST) {
         $referer = helper::safe64Encode($this->createLink('cart', "browse"));
     }
     if ($this->app->user->account == 'guest') {
         $this->locate($this->createLink('user', 'login', "referer={$referer}"));
     }
     if ($_POST) {
         $product = $this->post->product;
     }
     $this->view->products = $this->order->getPostedProducts($product, $count);
     $paymentList = explode(',', $this->config->shop->payment);
     foreach ($paymentList as $payment) {
         $paymentOptions[$payment] = $this->lang->order->paymentList[$payment];
     }
     $this->view->title = $this->lang->order->confirm;
     $this->view->paymentList = $paymentOptions;
     $this->view->addresses = $this->loadModel('address')->getListByAccount($this->app->user->account);
     $this->view->currencySymbol = $this->config->product->currencySymbol;
     $this->view->mobileURL = $mobileURL;
     $this->view->desktopURL = $desktopURL;
     $this->display();
 }
示例#6
0
 public function qrcode($referer = '')
 {
     $result = $this->api->getQrcode();
     $result->event_id = helper::safe64Encode($result->event_id);
     $this->view->result = $result;
     $this->view->referer = $referer;
     $this->view->title = $this->lang->yangcong->qrcodeInfo;
     $this->view->modalWidth = '300';
     $this->display();
 }
示例#7
0
 /**
  * Post a thread.
  *
  * @param  int      $boardID
  * @access public
  * @return void
  */
 public function post($boardID = 0)
 {
     $this->loadModel('forum');
     if ($this->app->user->account == 'guest') {
         die(js::locate($this->createLink('user', 'login', "referer=" . helper::safe64Encode($this->app->getURI()))));
     }
     /* Get the board. */
     $board = $this->loadModel('tree')->getById($boardID);
     /* Checking the board exist or not. */
     if (!$board) {
         die(js::error($this->lang->forum->notExist) . js::locate('back'));
     }
     /* Checking current user can post to the board or not. */
     if (!$this->forum->canPost($board)) {
         die(js::error($this->lang->forum->readonly) . js::locate('back'));
     }
     /* Set editor for current user. */
     $this->thread->setEditor($board->id, 'post');
     /* User posted a thread, try to save it to database. */
     if ($_POST) {
         $captchaConfig = isset($this->config->site->captcha) ? $this->config->site->captcha : 'auto';
         $needCaptcha = false;
         if ($captchaConfig == 'auto' and $this->loadModel('guarder')->isEvil($this->post->{$this->session->contentInput})) {
             $needCaptcha = true;
         }
         if ($captchaConfig == 'open') {
             $needCaptcha = true;
         }
         if ($captchaConfig == 'close') {
             $needCaptcha = false;
         }
         /* If no captcha but is garbage, return the error info. */
         $captchaInput = $this->session->captchaInput;
         if ($this->post->{$captchaInput} === false and $needCaptcha) {
             $this->send(array('result' => 'fail', 'reason' => 'needChecking', 'captcha' => $this->loadModel('guarder')->create4Thread()));
         }
         $result = $this->thread->post($boardID);
         $this->send($result);
     }
     $titleInput = helper::createRandomStr(6, $skip = 'A-Z');
     $contentInput = helper::createRandomStr(7, $skip = 'A-Z');
     $this->session->set('titleInput', $titleInput);
     $this->session->set('contentInput', $contentInput);
     $this->config->thread->require->post = "{$this->session->titleInput}, {$this->session->contentInput}";
     $this->config->thread->editor->post = array('id' => $this->session->contentInput, 'tools' => 'simple');
     $this->view->title = $board->name . $this->lang->minus . $this->lang->thread->post;
     $this->view->board = $board;
     $this->view->canManage = $this->thread->canManage($boardID);
     $this->view->titleInput = $titleInput;
     $this->view->contentInput = $contentInput;
     $this->view->board = $board;
     $this->view->mobileURL = helper::createLink('thread', 'post', "boardID={$boardID}", '', 'mhtml');
     $this->view->desktopURL = helper::createLink('thread', 'post', "boardID={$boardID}", '', 'html');
     $this->display();
 }
示例#8
0
 /** 
  * Post a thread.
  * 
  * @param  int      $boardID 
  * @access public
  * @return void
  */
 public function post($boardID = 0)
 {
     $this->loadModel('forum');
     if ($this->app->user->account == 'guest') {
         die(js::locate($this->createLink('user', 'login', "referer=" . helper::safe64Encode($this->app->getURI()))));
     }
     /* Get the board. */
     $board = $this->loadModel('tree')->getById($boardID);
     /* Checking the board exist or not. */
     if (!$board) {
         die(js::error($this->lang->forum->notExist) . js::locate('back'));
     }
     /* Checking current user can post to the board or not. */
     if (!$this->forum->canPost($board)) {
         die(js::error($this->lang->forum->readonly) . js::locate('back'));
     }
     /* Set editor for current user. */
     $this->thread->setEditor($board->id, 'post');
     /* User posted a thread, try to save it to database. */
     if ($_POST) {
         $captchaConfig = isset($this->config->site->captcha) ? $this->config->site->captcha : 'auto';
         $needCaptcha = false;
         if ($captchaConfig == 'auto' and $this->loadModel('captcha')->isEvil($this->post->content)) {
             $needCaptcha = true;
         }
         if ($captchaConfig == 'open') {
             $needCaptcha = true;
         }
         if ($captchaConfig == 'close') {
             $needCaptcha = false;
         }
         /* If no captcha but is garbage, return the error info. */
         if ($this->post->captcha === false and $needCaptcha) {
             $this->send(array('result' => 'fail', 'reason' => 'needChecking', 'captcha' => $this->loadModel('captcha')->create4Thread()));
         }
         $threadID = $this->thread->post($boardID);
         if (is_array($threadID)) {
             $this->send($threadID);
         }
         if (dao::isError()) {
             $this->send(array('result' => 'fail', 'message' => dao::getError()));
         }
         $locate = inlink('view', "threadID={$threadID}");
         $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate));
     }
     $this->view->title = $board->name . $this->lang->minus . $this->lang->thread->post;
     $this->view->board = $board;
     $this->view->canManage = $this->thread->canManage($boardID);
     $this->display();
 }
示例#9
0
 /**
  * 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}"));
 }
示例#10
0
 /**
  * Check the user has permission to access this method, if not, locate to the login page or deny page.
  * 
  * @access public
  * @return void
  */
 public function checkPriv()
 {
     $module = $this->app->getModuleName();
     $method = $this->app->getMethodName();
     if ($this->common->isOpenMethod($module, $method)) {
         return true;
     }
     if (!$this->loadModel('user')->isLogon() and $this->server->php_auth_user) {
         $this->user->identifyByPhpAuth();
     }
     if (!$this->loadModel('user')->isLogon() and $this->cookie->za) {
         $this->user->identifyByCookie();
     }
     if (isset($this->app->user)) {
         if (!common::hasPriv($module, $method)) {
             $this->common->deny($module, $method);
         }
     } else {
         $referer = helper::safe64Encode($this->app->getURI(true));
         $this->locate($this->createLink('user', 'login', "referer={$referer}"));
     }
 }
示例#11
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') {
             $checkIP = $this->user->checkIP();
             $checkLocation = $this->user->checkLocation();
             if ($user and (!$checkIP or !$checkLocation)) {
                 $error = $checkIP ? '' : $this->lang->user->ipDenied;
                 $error .= $checkLocation ? '' : $this->lang->user->locationDenied;
                 $pass = $this->loadModel('mail')->checkVerify();
                 $captchaUrl = $this->createLink('mail', 'captcha', "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->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();
 }
              <td><?php 
echo html::password('password', '', "class='form-control' placeholder='{$lang->user->inputPassword}'");
?>
</td>
            </tr>
            <tr>
              <th><?php 
echo html::a('', $lang->save, "data-toggle='modal' class='hidden captchaModal'");
?>
</th>
              <td>
               <div id="popup-captcha"></div>  
               <input type="submit" class="btn btn-primary btn" id="popup-submit" value="登录"/>
               <?php 
if (!empty($this->config->site->yangcong)) {
    echo html::a(helper::createLink('yangcong', 'qrcode', "referer=" . helper::safe64Encode($referer)), "<i class='icon icon-qrcode icon-lg'> {$lang->user->yangcongLogin}</i>", "class='btn btn-success pull-right' data-toggle='modal'");
}
?>
              </td>
            </tr>
          </table>
          <?php 
echo html::hidden('referer', $referer);
?>
        </div>
      </div>
    </form>
  </div>
</div>
<?php 
if ($config->debug) {
示例#13
0
 /**
  * Check incompatible extension
  * 
  * @param  array    $versions 
  * @access public
  * @return array
  */
 public function checkIncompatible($versions)
 {
     $apiURL = $this->apiRoot . 'apiCheckIncompatible-' . helper::safe64Encode(json_encode($versions)) . '.json';
     $data = $this->fetchAPI($apiURL);
     if (isset($data->incompatibleExts)) {
         return (array) $data->incompatibleExts;
     }
     return array();
 }
示例#14
0
 /**
  * Validate.
  *
  * @param  string $url
  * @param  string $target
  * @param  string $account
  * @param  string $type    okFile|email
  * @access public
  * @return void
  */
 public function validate($url = '', $target = 'modal', $account = '', $type = '')
 {
     if ($url == '') {
         $url = helper::safe64Encode('close');
     }
     if ($account == '') {
         $account = $this->app->user->account;
     }
     if ($type != '' and $type != 'okFile' and $type != 'email' and $type != 'securityQuestion') {
         $type = '';
     }
     $question = $this->guarder->getSecurityQuestion($account);
     if ($_POST) {
         $validateType = current($this->post->type);
         if ($validateType == 'email') {
             if (!$this->post->captcha or trim($this->post->captcha) != $this->session->verifyCode) {
                 $this->send(array('result' => 'fail', 'message' => $this->lang->guarder->emailFail));
             }
             $this->session->set('verifyCode', '');
             $this->session->set('verify', 'pass');
         } elseif ($validateType == 'securityQuestion') {
             if (!$this->post->answer or md5(trim($this->post->answer)) != $question->answer) {
                 $this->send(array('result' => 'fail', 'message' => $this->lang->guarder->questionFail));
             }
             $this->session->set('verify', 'pass');
         }
         $this->send(array('result' => 'success', 'message' => $this->lang->mail->verifySuccess, 'locate' => helper::safe64Decode($url), 'target' => $target));
     }
     $this->session->set('verify', '');
     $okFile = $this->loadModel('common')->verifyAdmin();
     $pass = $this->guarder->verify($type);
     $user = $this->loadModel('user')->getByAccount($account);
     $this->view->title = $this->lang->guarder->verify;
     $this->view->url = $url;
     $this->view->target = $target;
     $this->view->account = $account;
     $this->view->question = $question;
     $this->view->type = $type;
     $this->view->email = $user->email;
     $this->view->okFile = $okFile;
     $this->view->pass = $pass;
     $this->display();
 }
示例#15
0
 /**
  * Create changes for action from a log.
  * 
  * @param  object    $log 
  * @param  string    $repoRoot 
  * @access public
  * @return array
  */
 public function createActionChanges($log, $repoRoot)
 {
     if (!$log->files) {
         return array();
     }
     $diff = '';
     $oldSelf = $this->server->PHP_SELF;
     $this->server->set('PHP_SELF', $this->config->webRoot);
     if (!$repoRoot) {
         $repoRoot = $this->repoRoot;
     }
     foreach ($log->files as $action => $actionFiles) {
         foreach ($actionFiles as $file) {
             $param = array('url' => helper::safe64Encode($repoRoot . $file), 'revision' => $log->revision);
             $catLink = trim(html::a(helper::createLink('git', 'cat', $param, 'html'), 'view', '', "class='repolink'"));
             $diffLink = trim(html::a(helper::createLink('git', 'diff', $param, 'html'), 'diff', '', "class='repolink'"));
             $diff .= $action . " " . $file . " {$catLink} ";
             $diff .= $action == 'M' ? "{$diffLink}\n" : "\n";
         }
     }
     $changes = new stdclass();
     $changes->field = 'git';
     $changes->old = '';
     $changes->new = '';
     $changes->diff = trim($diff);
     $this->server->set('PHP_SELF', $oldSelf);
     return (array) $changes;
 }
示例#16
0
文件: control.php 项目: leowh/colla
 /**
  * Check refund privilege and locate personal if no privilege. 
  * 
  * @param  object $refund 
  * @param  string $action 
  * @param  string $errorType   html|json 
  * @access private
  * @return void
  */
 private function checkPriv($refund, $action, $errorType = '')
 {
     if ($this->app->user->admin == 'super') {
         return true;
     }
     $pass = true;
     $action = strtolower($action);
     $account = $this->app->user->account;
     if (strpos(',edit,delete,', ",{$action},") !== false) {
         if ($refund->status != 'wait' or $refund->createdBy != $account) {
             $pass = false;
         }
     }
     if (!$pass) {
         if ($errorType == '') {
             $errorType = empty($_POST) ? 'html' : 'json';
         }
         if ($errorType == 'json') {
             $this->app->loadLang('error');
             $this->send(array('result' => 'fail', 'message' => $this->lang->error->typeList['accessLimited']));
         } else {
             $locate = helper::safe64Encode($this->server->http_referer);
             $errorLink = helper::createLink('error', 'index', "type=accessLimited&locate={$locate}");
             $this->locate($errorLink);
         }
     }
     return $pass;
 }
示例#17
0
  <div class='heading'>
    <span class='prefix'><?php 
echo html::icon($lang->icons['bug']);
?>
</span>
    <strong><small class='text-muted'><?php 
echo html::icon($lang->icons['batchCreate']);
?>
</small> <?php 
echo $lang->bug->common . $lang->colon . $lang->bug->batchCreate;
?>
</strong>
    <div class='actions'>
      <?php 
if (common::hasPriv('file', 'uploadImages')) {
    echo html::a($this->createLink('file', 'uploadImages', 'module=bug&params=' . helper::safe64Encode("productID={$productID}&projectID={$projectID}&moduleID={$moduleID}")), $lang->uploadImages, '', "data-toggle='modal' data-type='iframe' class='btn' data-width='600px'");
}
?>
      <?php 
echo html::commonButton($lang->pasteText, "data-toggle='myModal'");
?>
    </div>
  </div>
</div>

<form class='form-condensed' class='form-condensed' method='post' target='hiddenwin'>
  <table class='table table-fixed table-form'>
    <thead>
      <tr>
        <th class='w-50px'>  <?php 
echo $lang->idAB;
示例#18
0
<?php

if (isset($pass) and !$pass) {
    $url = helper::safe64Encode($this->app->getURI());
    $target = 'self';
    include '../../guarder/view/validate.html.php';
} else {
    include '../../common/view/header.admin.html.php';
    js::import($jsRoot . 'fingerprint/fingerprint.js');
    ?>
<div class='panel'>
  <div class='panel-heading'><strong><i class='icon-eidt'></i> <?php 
    echo $lang->user->editProfile;
    ?>
</strong></div>
  <div class='panel-body'>
    <form method='post' id='editForm' class='form form-inline' data-checkfingerprint='1'>
      <table class='table table-form'>
        <tr>
          <th class='w-100px'><?php 
    echo $lang->user->realname;
    ?>
</th>
          <td class='w-p60'>
            <div class='multi'>
              <?php 
    if (count(explode(',', $this->config->site->lang)) > 1) {
        ?>
              <div class='input-group'>
                <?php 
        if (strpos($this->config->site->lang, 'zh-cn') !== false) {
示例#19
0
.alert.with-icon > .icon {padding-left: 35px;}
.alert-deny {max-width: 500px; margin: 8% auto; padding: 0; background-color: #FFF; border: 1px solid #DDD; box-shadow: 0px 2px 20px rgba(0, 0, 0, 0.2); border-radius: 6px;}
.btn-link {border-color: none!important}
</style>
<div class='container w-200px'>
  <div class='alert with-icon alert-deny'>
    <i class='icon-frown icon'></i>
    <div class='content'>
      <h2><?php 
echo $app->user->account, ' ', $lang->user->deny;
?>
</h2>
      <p><?php 
printf($lang->user->errorDeny, $moduleName, $methodName);
?>
</p>
      <div class='actions'>
        <?php 
if ($refererBeforeDeny) {
    echo html::a(helper::safe64Decode($refererBeforeDeny), $lang->user->goback, "class='btn btn-primary'");
}
echo html::a($this->createLink($config->default->module), $lang->index->common, "class='btn'");
echo html::a($this->createLink('user', 'logout', "referer=" . helper::safe64Encode($denyPage)), $lang->user->relogin, "class='btn btn-link'");
?>
      </div>
    </div>
  </div>
</div>
</body>
</html>
示例#20
0
文件: control.php 项目: leowh/colla
 /**
  * Edit trip.
  * 
  * @param  int    $id 
  * @access public
  * @return void
  */
 public function edit($id)
 {
     $trip = $this->trip->getById($id);
     /* check privilage. */
     if ($trip->createdBy != $this->app->user->account) {
         $locate = helper::safe64Encode(helper::createLink('oa.trip', 'browse'));
         $errorLink = helper::createLink('error', 'index', "type=accessLimited&locate={$locate}");
         die(js::locate($errorLink));
     }
     if ($_POST) {
         $result = $this->trip->update($id);
         if (is_array($result)) {
             $this->send($result);
         }
         if (dao::isError()) {
             $this->send(array('result' => 'fail', 'message' => dao::getError()));
         }
         $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
     }
     $this->view->title = $this->lang->trip->edit;
     $this->view->trip = $trip;
     $this->display();
 }
示例#21
0
 /**
  * Deny access.
  * 
  * @access public
  * @return void
  */
 public function deny($module, $method)
 {
     $vars = "module={$module}&method={$method}";
     if (isset($this->server->http_referer)) {
         $referer = helper::safe64Encode($this->server->http_referer);
         $vars .= "&referer={$referer}";
     }
     $denyLink = helper::createLink('user', 'deny', $vars);
     /* Fix the bug of IE: use js locate, can't get the referer. */
     if (strpos($this->server->http_user_agent, 'Trident') !== false) {
         echo "<a href='{$denyLink}' id='denylink' style='display:none'>deny</a>";
         echo "<script language='javascript'>document.getElementById('denylink').click();</script>";
     } else {
         echo js::locate($denyLink);
     }
     exit;
 }
示例#22
0
</td>
        <td class='w-100px'><?php 
    echo $report->pv;
    ?>
</td>
        <td class='w-100px'><?php 
    echo $report->uv;
    ?>
</td>
        <td class='w-100px'><?php 
    echo $report->ip;
    ?>
</td>
        <td class='w-100px'>
          <?php 
    $domain = helper::safe64Encode($domain);
    ?>
          <?php 
    echo html::a(inlink('domaintrend', "domain={$domain}&mode={$mode}&begin={$this->get->begin}&end={$this->get->end}"), $lang->stat->domainTrend);
    ?>
          <?php 
    echo html::a(inlink('domainpage', "domain={$domain}&mode={$mode}&begin={$this->get->begin}&end={$this->get->end}"), $lang->stat->domainPage);
    ?>
        </td>
      </tr>
      <?php 
}
?>
    </tbody>
    <tfoot><tr><td colspan='5'><?php 
$pager->show();
示例#23
0
           </p>
           <div class='text-center'>
             <div class='btn-group text-center'>
             <?php 
     echo html::a($theme->viewLink, $lang->package->view, 'class="btn theme" target="_blank"');
     if ($currentRelease->public) {
         if ($theme->type != 'computer' and $theme->type != 'mobile') {
             if (isset($installeds[$theme->code])) {
                 if ($installeds[$theme->code]->version != $theme->latestRelease->releaseVersion and $this->theme->checkVersion($theme->latestRelease->chanzhiCompatible)) {
                     commonModel::printLink('theme', 'upgrade', "theme={$theme->code}&downLink=" . helper::safe64Encode($currentRelease->downLink) . "&md5={$currentRelease->md5}&type={$theme->type}", $lang->theme->upgrade, "class='btn' data-toggle='modal'");
                 } else {
                     echo html::a('javascript:;', $lang->theme->installed, "class='btn disabled'");
                 }
             } else {
                 $label = $currentRelease->compatible ? $lang->package->installAuto : $lang->package->installForce;
                 commonModel::printLink('package', 'install', "theme={$theme->code}&downLink=" . helper::safe64Encode($currentRelease->downLink) . "&md5={$currentRelease->md5}&type={$theme->type}&overridePackage=no&ignoreCompitable=yes", $label, "data-toggle='modal' class='btn'");
             }
         }
     }
     echo html::a($currentRelease->downLink, $lang->package->downloadAB, 'class="manual btn"');
     echo html::a($theme->site, $lang->package->site, "class='btn' target='_blank'");
     ?>
             </div>
           </div>
         </div>
       </div>
     </div>
   </div>
 </div>
 <?php 
 }
示例#24
0
    <div class='col-md-6'>
      <div class='panel panel-pure'>
        <div class='panel-heading'><strong><?php 
    echo $lang->user->oauth->lblWelcome;
    ?>
</strong></div>
        <div class='panel-body'>
        <?php 
    foreach ($lang->user->oauth->providers as $providerCode => $providerName) {
        $providerConfig = isset($config->oauth->{$providerCode}) ? json_decode($config->oauth->{$providerCode}) : '';
        if (empty($providerConfig->clientID)) {
            continue;
        }
        $params = "provider={$providerCode}";
        if ($referer and !strpos($referer, 'login') and !strpos($referer, 'oauth')) {
            $params .= "&referer=" . helper::safe64Encode($referer);
        }
        echo html::a(inlink('oauthLogin', $params), "<i class='icon-{$providerCode} icon'></i> " . $providerName, "class='btn btn-default btn-oauth btn-lg btn-block btn-{$providerCode}'");
    }
    ?>
        </div>
      </div>
    </div>
    <div class='col-md-6'>
    <?php 
} else {
    ?>
    <div class='col-md-12'>
    <?php 
}
?>
示例#25
0
文件: control.php 项目: leowh/colla
 /**
  * Check privilage. 
  * 
  * @param  obejct $todo 
  * @param  string $action 
  * @param  string $errorType   html|json
  * @access public
  * @return bool
  */
 public function checkPriv($todo, $action, $errorType = '')
 {
     if (!$this->todo->checkPriv($todo, $action)) {
         if ($errorType == '') {
             $errorType = empty($_POST) ? 'html' : 'json';
         }
         if ($errorType == 'json') {
             $this->app->loadLang('error');
             $this->send(array('result' => 'fail', 'message' => $this->lang->error->typeList['accessLimited']));
         } else {
             $locate = helper::safe64Encode($this->server->http_referer);
             $errorLink = helper::createLink('error', 'index', "type=accessLimited&locate={$locate}");
             $this->locate($errorLink);
         }
     }
     return true;
 }
示例#26
0
<?php

/**
 * The export view file of file module of ZenTaoPMS.
 *
 * @copyright   Copyright 2009-2013 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
 * @license     LGPL (http://www.gnu.org/licenses/lgpl.html)
 * @author      Congzhi Chen <*****@*****.**>
 * @package     file
 * @version     $Id$
 * @link        http://www.zentao.net
 */
include '../../common/view/header.lite.html.php';
$catLink = inlink('cat', 'url=' . helper::safe64Encode($url) . "&revision={$revision}");
?>
<div class='box-title'><?php 
echo html::a($catLink, "{$url}@{$revision}");
?>
</div>
<div class='box-content'><xmp><?php 
echo $diff;
?>
</xmp></div>
<?php 
include '../../common/view/footer.lite.html.php';
示例#27
0
            ?>
            <a href='#replyDialog' data-toggle='modal' class='text-muted thread-reply-btn'><i class='icon-reply'></i> <?php 
            echo $lang->reply->common;
            ?>
</a>
            <?php 
        }
        ?>
          <?php 
    } else {
        ?>
            <?php 
        if (!$thread->readonly) {
            ?>
            <a href="<?php 
            echo $this->createLink('user', 'login', 'referer=' . helper::safe64Encode($this->app->getURI(true)));
            ?>
#reply" class="thread-reply-btn text-muted"><i class="icon-reply"></i> <?php 
            echo $lang->reply->common;
            ?>
</a>
            <?php 
        }
        ?>
          <?php 
    }
    ?>
        </div>
      </div>
    </div>
    <?php 
示例#28
0
文件: model.php 项目: fanscky/HTPMS
 /**
  * Get api link. 
  * 
  * @param  int    $filePath 
  * @param  int    $action 
  * @param  string $type 
  * @access public
  * @return string
  */
 public function getAPILink($filePath, $action)
 {
     return helper::createLink('api', 'debug', "filePath=" . helper::safe64Encode($filePath) . "&action={$action}");
 }
示例#29
0
文件: control.php 项目: ppmon/ppm
 /**
  * Link bugs.
  * 
  * @param  int    $releaseID 
  * @param  string $browseType 
  * @param  int    $param 
  * @access public
  * @return void
  */
 public function linkBug($releaseID = 0, $browseType = '', $param = 0)
 {
     if (!empty($_POST['bugs'])) {
         $this->release->linkBug($releaseID);
         die(js::locate(inlink('view', "releaseID={$releaseID}&type=bug"), 'parent'));
     }
     /* Set menu. */
     $release = $this->release->getByID($releaseID);
     $build = $this->loadModel('build')->getByID($release->build);
     $this->commonAction($release->product);
     /* Build the search form. */
     $this->loadModel('bug');
     $queryID = $browseType == 'bysearch' ? (int) $param : 0;
     unset($this->config->bug->search['fields']['product']);
     $this->config->bug->search['actionURL'] = $this->createLink('release', 'view', "releaseID={$releaseID}&type=bug&link=true&param=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID'));
     $this->config->bug->search['queryID'] = $queryID;
     $this->config->bug->search['style'] = 'simple';
     $this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product));
     $this->config->bug->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($release->product, $viewType = 'bug', $startModuleID = 0);
     $this->config->bug->search['params']['project']['values'] = $this->loadModel('product')->getProjectPairs($release->product);
     $this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($release->product);
     $this->config->bug->search['params']['resolvedBuild']['values'] = $this->config->bug->search['params']['openedBuild']['values'];
     $this->loadModel('search')->setSearchParams($this->config->bug->search);
     if ($browseType == 'bySearch') {
         $allBugs = $this->bug->getBySearch($release->product, $queryID, 'id_desc');
     } else {
         $allBugs = empty($build->project) ? array() : $this->bug->getReleaseBugs($build->id, $release->product);
     }
     $this->view->allBugs = $allBugs;
     $this->view->releaseBugs = empty($release->bugs) ? array() : $this->bug->getByList($release->bugs);
     $this->view->release = $release;
     $this->view->users = $this->loadModel('user')->getPairs('noletter');
     $this->view->browseType = $browseType;
     $this->view->param = $param;
     $this->display();
 }
示例#30
0
 /**
  * Show the deny info.
  *
  * @param mixed $module     the module
  * @param mixed $method     the method
  * @access public
  * @return void
  */
 public function deny($module, $method)
 {
     if (helper::isAjaxRequest()) {
         exit;
     }
     $vars = "module={$module}&method={$method}";
     if (isset($_SERVER['HTTP_REFERER'])) {
         $referer = helper::safe64Encode($_SERVER['HTTP_REFERER']);
         $vars .= "&referer={$referer}";
     }
     if (RUN_MODE == 'admin') {
         if (strpos($_SERVER['HTTP_REFERER'], "m=user&f=login") !== false) {
             die(js::locate(helper::createLink('admin', 'index')));
         }
     }
     $denyLink = helper::createLink('user', 'deny', $vars);
     die(js::locate($denyLink));
 }