本文整理汇总了PHP中helper::safe64Encode方法的典型用法代码示例。如果您正苦于以下问题:PHP helper::safe64Encode方法的具体用法?PHP helper::safe64Encode怎么用?PHP helper::safe64Encode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helper
的用法示例。
在下文中一共展示了helper::safe64Encode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
/**
* 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: obtain
/**
* 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: post
/**
* 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: obtain
/**
* 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: confirm
/**
* 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: qrcode
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: post
/**
* 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: post
/**
* 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: 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}"));
}
示例10: checkPriv
/**
* 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: login
/**
* 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();
}
示例12:
<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: checkIncompatible
/**
* 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: validate
/**
* 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: createActionChanges
/**
* 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;
}