本文整理汇总了PHP中iPHP::router方法的典型用法代码示例。如果您正苦于以下问题:PHP iPHP::router方法的具体用法?PHP iPHP::router怎么用?PHP iPHP::router使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iPHP
的用法示例。
在下文中一共展示了iPHP::router方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: public_qrcode
function public_qrcode($vars = null)
{
$data = $vars['data'];
$query = array('app' => 'public', 'do' => 'qrcode', 'url' => $data);
isset($vars['cache']) && ($query['cache'] = true);
$url = iPHP::router('/api', iCMS_REWRITE);
echo buildurl($url, $query);
}
示例2: do_login
function do_login()
{
if ($this->uid) {
$user = iDB::row("SELECT * FROM `#iCMS@__user` WHERE `uid`='{$this->uid}' LIMIT 1;", ARRAY_A);
iPHP::app('user.class', 'static');
user::set_cookie($user['username'], $user['password'], $user);
$url = iPHP::router(array('/{uid}/', $this->uid), iPHP_ROUTER_REWRITE);
iPHP::gotourl($url);
}
}
示例3: favorite_list
function favorite_list($vars = null)
{
$maxperpage = isset($vars['row']) ? (int) $vars['row'] : "10";
$where_sql = "WHERE 1=1 ";
isset($vars['userid']) && ($where_sql .= " AND `uid`='" . (int) $vars['userid'] . "' ");
isset($vars['fid']) && ($where_sql .= " AND `fid`='" . (int) $vars['fid'] . "' ");
isset($vars['mode']) && ($where_sql .= " AND `mode`='" . (int) $vars['mode'] . "'");
isset($vars['appid']) && ($where_sql .= " AND `appid`='" . (int) $vars['appid'] . "' ");
$cache_time = isset($vars['time']) ? (int) $vars['time'] : -1;
$by = $vars['by'] == "ASC" ? "ASC" : "DESC";
switch ($vars['orderby']) {
case 'hot':
$order_sql = " ORDER BY `count` {$by}";
break;
default:
$order_sql = " ORDER BY `id` {$by}";
}
$md5 = md5($where_sql . $order_sql);
$offset = 0;
if ($vars['page']) {
$total = iPHP::total($md5, "SELECT count(*) FROM `#iCMS@__favorite` {$where_sql} ");
iPHP::assign("fav_total", $total);
$multi = iCMS::page(array('total' => $total, 'perpage' => $maxperpage, 'unit' => iPHP::lang('iCMS:page:list'), 'nowindex' => $GLOBALS['page']));
$offset = $multi->offset;
}
if ($vars['cache']) {
$cache_name = iPHP_DEVICE . '/favorite/' . $md5 . "/" . (int) $GLOBALS['page'];
$resource = iCache::get($cache_name);
}
if (empty($resource)) {
$rs = iDB::all("SELECT * FROM `#iCMS@__favorite` {$where_sql} {$order_sql} LIMIT {$offset},{$maxperpage}");
iPHP_SQL_DEBUG && iDB::debug(1);
$resource = array();
$vars['user'] && iPHP::app('user.class', 'static');
if ($rs) {
foreach ($rs as $key => $value) {
$value['url'] = iPHP::router(array('/favorite/{id}/', $value['id']), iPHP_ROUTER_REWRITE);
$vars['user'] && ($value['user'] = user::info($value['uid'], $value['nickname']));
if (isset($vars['loop'])) {
$resource[$key] = $value;
} else {
$resource[$value['id']] = $value;
}
}
}
$vars['cache'] && iCache::set($cache_name, $resource, $cache_time);
}
return $resource;
}
示例4: iCMS_router
/**
* @package iCMS
* @copyright 2007-2010, iDreamSoft
* @license http://www.idreamsoft.com iDreamSoft
* @author coolmoo <idreamsoft@qq.com>
* @$Id: iCMS.push.php 148 2013-03-14 16:15:12Z coolmoo $
*/
function iCMS_router($vars)
{
if (empty($vars['url'])) {
echo 'javascript:;';
return;
}
$router = $vars['url'];
unset($vars['url'], $vars['app']);
$url = iPHP::router($router, iCMS_REWRITE);
$vars['query'] && ($url = buildurl($url, $vars['query']));
if ($url && stripos($url, 'http://') === false && $vars['host']) {
$url = rtrim(iCMS_URL, '/') . '/' . ltrim($url, '/');
}
echo $url ? $url : 'javascript:;';
}
示例5: router
public static function router($uid, $type, $size = 0)
{
switch ($type) {
case 'avatar':
return iCMS_FS_URL . get_user_pic($uid, $size);
break;
case 'url':
return iPHP::router(array('/{uid}/', $uid), iPHP_ROUTER_REWRITE);
break;
case 'coverpic':
$dir = get_user_dir($uid, 'coverpic');
return array('pc' => iFS::fp($dir . '/' . $uid . ".jpg", '+http'), 'mo' => iFS::fp($dir . '/m_' . $uid . ".jpg", '+http'));
break;
case 'urls':
return array('inbox' => iPHP::router(array('/user/inbox/{uid}', $uid), iPHP_ROUTER_REWRITE), 'home' => iPHP::router(array('/{uid}/', $uid), iPHP_ROUTER_REWRITE), 'comment' => iPHP::router(array('/{uid}/comment/', $uid), iPHP_ROUTER_REWRITE), 'favorite' => iPHP::router(array('/{uid}/favorite/', $uid), iPHP_ROUTER_REWRITE), 'fans' => iPHP::router(array('/{uid}/fans/', $uid), iPHP_ROUTER_REWRITE), 'follower' => iPHP::router(array('/{uid}/follower/', $uid), iPHP_ROUTER_REWRITE));
break;
}
}
示例6: search_url
function search_url($vars)
{
$q = rawurlencode($vars['query']);
if (empty($q)) {
return;
}
$query['app'] = 'search';
if (isset($vars['_app'])) {
$query['app'] = $vars['_app'];
$query['do'] = 'search';
}
$query['q'] = $q;
$url = iPHP::router('/api', iPHP_ROUTER_REWRITE);
$url = buildurl($url, $query);
if ($vars['ret']) {
return $url;
}
echo $url;
}
示例7: user_inbox
function user_inbox($vars = null)
{
$maxperpage = 30;
$where_sql = "WHERE `status` ='1'";
if ($_GET['user']) {
if ($_GET['user'] == "10000") {
$where_sql .= " AND `userid`='10000' AND `friend` IN ('" . user::$userid . "','0')";
} else {
$friend = (int) $_GET['user'];
$where_sql .= " AND `userid`='" . user::$userid . "' AND `friend`='" . $friend . "'";
}
$group_sql = '';
$p_fields = 'COUNT(*)';
$s_fields = '*';
iPHP::assign("msg_count", false);
} else {
// $where_sql.= " AND (`userid`='".user::$userid."' OR (`userid`='10000' AND `friend`='0'))";
$where_sql .= " AND `userid`='" . user::$userid . "'";
$group_sql = ' GROUP BY `friend` DESC';
$p_fields = 'COUNT(DISTINCT id)';
$s_fields = 'max(id) AS id ,COUNT(id) AS msg_count,`userid`, `friend`, `send_uid`, `send_name`, `receiv_uid`, `receiv_name`, `content`, `type`, `sendtime`, `readtime`';
iPHP::assign("msg_count", true);
}
$offset = 0;
$total = iPHP::total($md5, "SELECT {$p_fields} FROM `#iCMS@__message` {$where_sql} {$group_sql}", 'nocache');
iPHP::assign("msgs_total", $total);
$multi = iCMS::page(array('total' => $total, 'perpage' => $maxperpage, 'unit' => iPHP::lang('iCMS:page:list'), 'nowindex' => $GLOBALS['page']));
$offset = $multi->offset;
$resource = iDB::all("SELECT {$s_fields} FROM `#iCMS@__message` {$where_sql} {$group_sql} ORDER BY `id` DESC LIMIT {$offset},{$maxperpage}");
iPHP_SQL_DEBUG && iDB::debug(1);
$msg_type_map = array('0' => '系统信息', '1' => '私信', '2' => '提醒', '3' => '留言');
if ($resource) {
foreach ($resource as $key => $value) {
$value['sender'] = user::info($value['send_uid'], $value['send_name']);
$value['receiver'] = user::info($value['receiv_uid'], $value['receiv_name']);
$value['label'] = $msg_type_map[$value['type']];
if ($value['userid'] == $value['send_uid']) {
$value['is_sender'] = true;
$value['user'] = $value['receiver'];
}
if ($value['userid'] == $value['receiv_uid']) {
$value['is_sender'] = false;
$value['user'] = $value['sender'];
}
$value['url'] = iPHP::router(array('/user/inbox/{uid}', $value['user']['uid']), iPHP_ROUTER_REWRITE);
$resource[$key] = $value;
}
}
return $resource;
}
示例8: ACTION_findpwd
public function ACTION_findpwd()
{
$seccode = iS::escapeStr($_POST['seccode']);
iPHP::seccode($seccode, true) or iPHP::code(0, 'iCMS:seccode:error', 'seccode', 'json');
$uid = (int) $_POST['uid'];
$auth = iS::escapeStr($_POST['auth']);
if ($auth && $uid) {
//print_r($_POST);
$authcode = rawurldecode($auth);
$authcode = base64_decode($authcode);
$authcode = authcode($authcode);
if (empty($authcode)) {
iPHP::code(0, 'user:findpwd:error', 'uname', 'json');
}
list($uid, $username, $password, $timeline) = explode(USER_AUTHASH, $authcode);
$now = time();
if ($now - $timeline > 86400) {
iPHP::code(0, 'user:findpwd:error', 'time', 'json');
}
$user = user::get($uid, false);
if ($username != $user->username || $password != $user->password) {
iPHP::code(0, 'user:findpwd:error', 'user', 'json');
}
$rstpassword = md5(trim($_POST['rstpassword']));
if ($rstpassword == $user->password) {
iPHP::code(0, 'user:findpwd:same', 'password', 'json');
}
iDB::update("user", array('password' => $rstpassword), array('uid' => $uid));
iPHP::code(1, 'user:findpwd:success', 0, 'json');
} else {
$uname = iS::escapeStr($_POST['uname']);
$uname or iPHP::code(0, 'user:findpwd:username:empty', 'uname', 'json');
$uid = user::check($uname, 'username');
$uid or iPHP::code(0, 'user:findpwd:username:noexist', 'uname', 'json');
$user = user::get($uid, false);
$user or iPHP::code(0, 'user:findpwd:username:noexist', 'uname', 'json');
$authcode = authcode($uid . USER_AUTHASH . $user->username . USER_AUTHASH . $user->password . USER_AUTHASH . time(), 'ENCODE');
$authcode = base64_encode($authcode);
$authcode = rawurlencode($authcode);
$find_url = iPHP::router('/api/user/findpwd', iPHP_ROUTER_REWRITE, '?&');
if (iPHP_ROUTER_REWRITE) {
$find_url = iFS::fp($find_url, '+http');
}
$find_url .= 'auth=' . $authcode;
$config = iCMS::$config['mail'];
$config['title'] = iCMS::$config['site']['name'];
$config['subject'] = '[' . $config['title'] . '] 找回密码(重要)!';
$config['body'] = '
<p>尊敬的' . $user->nickname . ',您好:</p>
<br />
<p>您在' . $config['title'] . '申请找回密码,重设密码地址:</p>
<a href="' . $find_url . '" target="_blank">' . $find_url . '</a>
<p>本链接将在24小时后失效!</p>
<p>如果上面的链接无法点击,您也可以复制链接,粘贴到您浏览器的地址栏内,然后按“回车”打开重置密码页面。</p>
<p>如果您有其他问题,请联系我们:' . $config['replyto'] . '。</p>
<p>如果您没有进行过找回密码的操作,请不要点击上述链接,并删除此邮件。</p>
<p>谢谢!</p>
';
$config['address'] = array(array($user->username, $user->nickname));
//var_dump(iCMS::$config);
$result = iPHP::sendmail($config);
if ($result === true) {
iPHP::code(1, 'user:findpwd:send:success', 'mail', 'json');
} else {
iPHP::code(0, 'user:findpwd:send:failure', 'mail', 'json');
}
}
}
示例9:
<thead>
<tr>
<th><i class="fa fa-arrows-v"></i></th>
<th>ID</th>
<th>账号</th>
<th>昵称</th>
<th>用户组</th>
<th>最后登陆IP</th>
<th style="width:130px;"><a class="fa fa-clock-o tip-top" title="注册时间/最后登陆时间"></a></th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $i < $_count; $i++) {
$url = iPHP::router(array('/{uid}/', $rs[$i]['uid']), iPHP_ROUTER_REWRITE);
?>
<tr id="tr<?php
echo $rs[$i]['uid'];
?>
">
<td><?php
if ($rs[$i]['uid'] != "1") {
?>
<input type="checkbox" name="id[]" value="<?php
echo $rs[$i]['uid'];
?>
" /><?php
}
?>
</td>
示例10:
<thead>
<tr>
<th><i class="fa fa-arrows-v"></i></th>
<th>ID</th>
<th>账号</th>
<th>昵称</th>
<th>用户组</th>
<th>最后登陆IP</th>
<th style="width:130px;"><a class="fa fa-clock-o tip-top" title="注册时间/最后登陆时间"></a></th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $i < $_count; $i++) {
$url = iPHP::router(array('/{uid}/', $rs[$i]['uid']), iCMS_REWRITE);
?>
<tr id="tr<?php
echo $rs[$i]['uid'];
?>
">
<td><?php
if ($rs[$i]['uid'] != "1") {
?>
<input type="checkbox" name="id[]" value="<?php
echo $rs[$i]['uid'];
?>
" /><?php
}
?>
</td>