本文整理汇总了PHP中Url函数的典型用法代码示例。如果您正苦于以下问题:PHP Url函数的具体用法?PHP Url怎么用?PHP Url使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index_action
function index_action()
{
if ($this->config['sy_linksq'] == "1") {
header("location:" . Url('error'));
}
if ($_POST['submit']) {
session_start();
if (md5($_POST['authcode']) != $_SESSION['authcode']) {
unset($_SESSION['authcode']);
$this->ACT_layer_msg("验证码不正确!", 8, $_SERVER['HTTP_REFERER']);
}
$data['link_name'] = trim($_POST['title']);
$data['link_url'] = $_POST['url'];
$data['link_type'] = $_POST['type'];
$data['link_time'] = mktime();
if ($_POST['phototype'] != '') {
$data['img_type'] = $_POST['phototype'];
if ($_POST['phototype'] == 1) {
$upload = $this->upload_pic("upload/friend/", false);
$pictures = $upload->picture($_FILES['uplocadpic'], false);
$data['pic'] = $pictures;
} else {
$data['pic'] = $_POST['uplocadpic'];
}
}
$M = $this->MODEL("link");
$nbid = $M->AddLink($data);
isset($nbid) ? $this->ACT_layer_msg("请等待管理员审核!", 9, $_SERVER['HTTP_REFERER']) : $this->ACT_layer_msg("添加失败!", 8, $_SERVER['HTTP_REFERER']);
}
$this->seo("friend");
$this->yun_tpl(array('index'));
}
示例2: index_action
function index_action()
{
$urlarr = array("c" => "pl", "page" => "{{page}}");
$pageurl = Url('member', $urlarr);
$rows = $this->get_page("company_msg", "`cuid`='" . $this->uid . "'", $pageurl, "10");
if (is_array($rows)) {
foreach ($rows as $k => $v) {
$uid[] = $v['uid'];
}
$uid = pylode(",", $uid);
$user = $this->obj->DB_select_all("resume", "`uid` in ({$uid})", "`uid`,`name`");
foreach ($rows as $k => $v) {
foreach ($user as $val) {
if ($v['uid'] == $val['uid']) {
$rows[$k]['name'] = $val['name'];
}
}
}
}
$this->yunset("rows", $rows);
$com = $this->obj->DB_select_once("company", "`uid`='" . $this->uid . "'");
if ($com['pl_time'] && $com['pl_time'] > time()) {
$this->yunset("pl_time", '1');
}
$this->obj->update_once("company_msg", array("status" => (int) $_POST['status']), array("id" => (int) $_POST['id']));
$this->yunset("com", $com);
$this->public_action();
$this->yunset("js_def", 7);
$this->com_tpl('pl');
}
示例3: smarty_function_searchbox
/**
* Writes the search box to the page.
*
* @param array The parameters passed into the function. This currently takes no parameters.
* @param Smarty The smarty object rendering the template.
* @return The url.
*/
function smarty_function_searchbox($Params, &$Smarty)
{
$Form = Gdn::Factory('Form');
$Form->InputPrefix = '';
$Result = $Form->Open(array('action' => Url('/search'), 'method' => 'get')) . $Form->TextBox('Search', array('placeholder' => T('Search'))) . $Form->Button('Go', array('Name' => '')) . $Form->Close();
return $Result;
}
示例4: index_action
function index_action()
{
$this->public_action();
$urlarr["c"] = "search";
$where = "`uid`='" . $this->uid . "'";
if ($_GET['keyword']) {
$where .= " and name like '%" . $_GET['keyword'] . "%'";
$urlarr['keyword'] = $_GET['keyword'];
}
$urlarr["page"] = "{{page}}";
$pageurl = Url('member', $urlarr);
$rows = $this->get_page("company_job", $where, $pageurl, "10", "`id`,`name`,`state`,`sdate`,`edate`,`lastupdate`,`jobhits`");
if (is_array($rows) && !empty($rows)) {
foreach ($rows as $v) {
$jobid[] = $v['id'];
}
$jobrows = $this->obj->DB_select_all("userid_job", "`job_id` in (" . pylode(',', $jobid) . ")");
if (is_array($jobrows)) {
foreach ($jobrows as $v) {
$jobnum[$v['job_id']]++;
}
}
}
$this->company_satic();
$this->yunset("jobnum", $jobnum);
$this->yunset("js_def", 3);
$this->com_tpl('search');
}
示例5: CheckPassword
/**
* Check a password against a stored password.
*
* The stored password can be plain, a md5 hash or a phpass hash.
* If the password wasn't a phppass hash, the Weak property is set to True.
*
* @param string $Password
* @param string $StoredHash
* @param string $Method
* @param string $Username
* @return boolean
*/
function CheckPassword($Password, $StoredHash, $Method = FALSE, $Username = NULL) {
$Result = FALSE;
switch(strtolower($Method)) {
case 'django':
$Result = $this->CheckDjango($Password, $StoredHash);
break;
case 'phpbb':
require_once(PATH_LIBRARY.'/vendors/phpbb/phpbbhash.php');
$Result = phpbb_check_hash($Password, $StoredHash);
break;
case 'reset':
throw new Gdn_UserException(sprintf(T('You need to reset your password.', 'You need to reset your password. This is most likely because an administrator recently changed your account information. Click <a href="%s">here</a> to reset your password.'), Url('entry/passwordrequest')));
break;
case 'smf':
$Result = (sha1(strtolower($Username).$Password) == $StoredHash);
break;
case 'vbulletin':
// assume vbulletin's password hash has a fixed length of 32, the salt length will vary between version 3 and 4
$SaltLength = strlen($StoredHash) - 32;
$Salt = trim(substr($StoredHash, -$SaltLength, $SaltLength));
$VbStoredHash = substr($StoredHash, 0, strlen($StoredHash) - $SaltLength);
$VbHash = md5(md5($Password).$Salt);
$Result = $VbHash == $VbStoredHash;
break;
case 'vanilla':
default:
$Result = $this->CheckVanilla($Password, $StoredHash);
}
return $Result;
}
示例6: index_action
function index_action()
{
$this->public_action();
$urlarr = array("c" => "job", "page" => "{{page}}");
if ($_GET['w'] >= 0) {
$where = " and state='" . (int) $_GET['w'] . "' and `edate`>'" . time() . "'";
$urlarr['w'] = $_GET['w'];
}
$pageurl = Url('member', $urlarr);
$rows = $this->get_page("company_job", "`uid`='" . $this->uid . "' " . $where, $pageurl, '10');
if (is_array($rows) && !empty($rows)) {
foreach ($rows as $k => $v) {
$rows[$k]['jobnum'] = $this->obj->DB_select_num("userid_job", "`job_id`='" . $v['id'] . "' and `com_id`='" . $this->uid . "'");
}
}
$urgent = $this->config['com_urgent'];
$this->yunset("rows", $rows);
$this->yunset("urgent", $urgent);
$this->company_satic();
$this->yunset("js_def", 3);
if (intval($_GET['w']) == 1) {
$this->com_tpl('joblist');
} else {
$this->com_tpl('job');
}
}
示例7: UserController_TempBan_Create
public function UserController_TempBan_Create($Sender, $Args)
{
$Sender->Permission('Garden.Moderation.Manage');
$UserID = (int) GetValue('0', $Args);
$Unban = (bool) GetValue('1', $Args);
$User = Gdn::UserModel()->GetID($UserID, DATASET_TYPE_ARRAY);
if (!$User) {
throw NotFoundException($User);
}
$UserModel = Gdn::UserModel();
if ($Sender->Form->AuthenticatedPostBack()) {
if ($Unban) {
$UserModel->Unban($UserID, array('RestoreContent' => $Sender->Form->GetFormValue('RestoreContent')));
} else {
$Minutes = $Sender->Form->GetValue('TempBanPeriodMinutes');
$Hours = $Sender->Form->GetValue('TempBanPeriodHours');
$Days = $Sender->Form->GetValue('TempBanPeriodDays');
$Months = $Sender->Form->GetValue('TempBanPeriodMonths');
$Years = $Sender->Form->GetValue('TempBanPeriodYears');
if (!(empty($Minutes) && empty($Hours) && empty($Days) && empty($Months) && empty($Years))) {
$AutoExpirePeriod = Gdn_Format::ToDateTime(strtotime("+{$Years} years {$Months} months {$Days} days {$Hours} hours {$Minutes} minutes"));
} else {
$Sender->Form->AddError('ValidateRequired', 'Ban Period');
}
if (!ValidateRequired($Sender->Form->GetFormValue('Reason'))) {
$Sender->Form->AddError('ValidateRequired', 'Reason');
}
if ($Sender->Form->GetFormValue('Reason') == 'Other' && !ValidateRequired($Sender->Form->GetFormValue('ReasonText'))) {
$Sender->Form->AddError('ValidateRequired', 'Reason Text');
}
if ($Sender->Form->ErrorCount() == 0) {
if ($Sender->Form->GetFormValue('Reason') == 'Other') {
$Reason = $Sender->Form->GetFormValue('ReasonText');
} else {
$Reason = $Sender->Form->GetFormValue('Reason');
}
Gdn::Locale()->SetTranslation('HeadlineFormat.Ban', FormatString('{RegardingUserID,You} banned {ActivityUserID,you} until {BanExpire, date}.', array('BanExpire' => $AutoExpirePeriod)));
$UserModel->Ban($UserID, array('Reason' => $Reason));
$UserModel->SetField($UserID, 'BanExpire', $AutoExpirePeriod);
}
}
if ($Sender->Form->ErrorCount() == 0) {
// Redirect after a successful save.
if ($Sender->Request->Get('Target')) {
$Sender->RedirectUrl = $Sender->Request->Get('Target');
} else {
$Sender->RedirectUrl = Url(UserUrl($User));
}
}
}
$Sender->SetData('User', $User);
$Sender->AddSideMenu();
$Sender->Title($Unban ? T('Unban User') : T('Temporary Ban User'));
if ($Unban) {
$Sender->View = 'Unban';
} else {
$Sender->View = $this->ThemeView('tempban');
}
$Sender->Render();
}
示例8: index_action
function index_action()
{
$group = $this->obj->DB_select_all("evaluate_group", "`keyid`='0'", "`id`,`name`");
$arr = array();
foreach ($group as $val) {
$arr[$val['id']] = $val['name'];
}
$search_list[] = array("param" => "keyid", "name" => '试卷类别', "value" => $arr);
$where = "1 and `keyid`!='0'";
if ($_GET['evaluate_search'] && trim($_GET['keyword'])) {
$where .= " and `name` like '%" . trim($_GET['keyword']) . "%'";
$urlarr['evaluate_search'] = $_GET['evaluate_search'];
$urlarr['keyword'] = trim($_GET['keyword']);
}
if ((int) $_GET['keyid']) {
$where .= " and `keyid`='" . (int) $_GET['keyid'] . "'";
$urlarr['keyid'] = (int) $_GET['keyid'];
}
if ($_GET['order']) {
$where .= " order by " . $_GET['t'] . " " . $_GET['order'];
$urlarr['order'] = $_GET['order'];
$urlarr['t'] = $_GET['t'];
} else {
$where .= " order by id desc";
}
$urlarr['order'] = $_GET['order'];
$urlarr['page'] = "{{page}}";
$pageurl = Url($_GET['m'], $urlarr, 'admin');
$rows = $this->get_page("evaluate_group", $where, $pageurl, $this->config['sy_listnum'], "`id`,`keyid`,`name`,`sort`,`ctime`");
$this->yunset($rows);
$this->yunset("arr", $arr);
$this->yunset("search_list", $search_list);
$this->yunset("get_type", $_GET);
$this->yuntpl(array('admin/admin_evaluate_list'));
}
示例9: index_action
function index_action()
{
include CONFIG_PATH . "db.data.php";
$this->yunset("arr_data", $arr_data);
$this->public_action();
$statis = $this->company_satic();
$urlarr = array("c" => "com", "page" => "{{page}}");
$pageurl = Url('member', $urlarr);
if ($statis['vip_etime'] > time()) {
$statis['vip_time'] = date("Y年m月d日", $statis['vip_etime']);
} else {
$statis['vip_time'] = "已过期";
}
$statis[integral] = number_format($statis[integral]);
$this->yunset("statis", $statis);
$rows = $this->get_page("company_order", "uid='" . $this->uid . "' and `type`='1' order by id desc", $pageurl, "10");
$this->yunset("rows", $rows);
$allprice = $this->obj->DB_select_once("company_pay", "`com_id`='" . $this->uid . "' and `type`='1' and `order_price`<0", "sum(order_price) as allprice");
if ($allprice['allprice'] == '') {
$allprice['allprice'] = '0';
}
$this->yunset("integral", number_format(str_replace("-", "", $allprice['allprice'])));
$this->yunset("js_def", 4);
$this->com_tpl('com');
}
示例10: index_action
function index_action()
{
$where = "`name` like '%" . $_GET['keyword'] . "%'";
$urlarr = array("c" => "searchcom", "page" => "{{page}}");
$pageurl = Url('member', $urlarr);
$rows = $this->get_page("company", $where, $pageurl, "10");
if (is_array($rows)) {
include PLUS_PATH . "/city.cache.php";
foreach ($rows as $v) {
$c_uid[] = $v['uid'];
}
$black = $this->obj->DB_select_all("blacklist", "`p_uid`='" . $this->uid . "' and `c_uid` in (" . pylode(",", $c_uid) . ")");
foreach ($rows as $k => $v) {
$rows[$k]['provinceid'] = $city_name[$v['provinceid']];
$rows[$k]['cityid'] = $city_name[$v['cityid']];
foreach ($black as $val) {
if ($v['uid'] == $val['c_uid']) {
$rows[$k]['status'] = "1";
}
}
}
}
$this->yunset("rows", $rows);
$this->public_action();
$this->user_tpl('searchcom');
}
示例11: Authenticate
public function Authenticate()
{
$ForeignIdentityUrl = C('Garden.Authenticator.AuthenticateURL');
if (!$ForeignIdentityUrl) {
return FALSE;
}
try {
$Response = $this->_GetForeignCredentials($ForeignIdentityUrl);
if (!$Response) {
throw new Exception();
}
$SQL = Gdn::Database()->SQL();
$Provider = $SQL->Select('uap.AuthenticationKey, uap.AssociationSecret')->From('UserAuthenticationProvider uap')->Get()->FirstRow(DATASET_TYPE_ARRAY);
if (!$Provider) {
throw new Exception();
}
// Got a response from the remote identity provider
$UserEmail = ArrayValue('Email', $Response);
$UserName = ArrayValue('Name', $Response);
$UserName = trim(preg_replace('/[^a-z0-9-]+/i', '', $UserName));
$AuthResponse = $this->ProcessAuthorizedRequest($Provider['AuthenticationKey'], $UserEmail, $UserName);
if ($AuthResponse == Gdn_Authenticator::AUTH_SUCCESS) {
Gdn::Request()->WithRoute('DefaultController');
} elseif ($AuthResponse == Gdn_Authenticator::AUTH_PARTIAL) {
Redirect(Url('/entry/handshake/proxy', TRUE), 302);
} else {
Gdn::Request()->WithRoute('DefaultController');
throw new Exception('authentication failed');
}
} catch (Exception $e) {
// Fallback to defer checking until the next session
$this->SetIdentity(-1, FALSE);
}
}
示例12: index_action
function index_action()
{
if ($_GET[pid]) {
$where = "`pid`='" . $_GET['pid'] . "' ";
$urlarr['pid'] = $_GET['pid'];
$this->yunset("pid", $_GET['pid']);
} else {
$where = "`pid`='0' ";
}
if ($_GET[name]) {
$where .= " and `name` like '%" . $_GET['name'] . "%' ";
$urlarr['name'] = $_GET['name'];
$this->yunset("name", $_GET['name']);
}
if ($_GET['order']) {
$where .= " order by " . $_GET['t'] . " " . $_GET['order'];
$urlarr['order'] = $_GET['order'];
$urlarr['t'] = $_GET['t'];
} else {
$where .= " order by id desc";
}
$urlarr['page'] = "{{page}}";
$pageurl = Url($_GET['m'], $urlarr, 'admin');
$q_class = $this->get_page("q_class", $where, $pageurl, $this->config['sy_listnum']);
$this->yunset("q_class", $q_class);
$this->yuntpl(array('admin/admin_q_class_list'));
}
示例13: GetOpenID
/**
* @return LightOpenID
*/
public function GetOpenID() {
if (get_magic_quotes_gpc()) {
foreach ($_GET as $Name => $Value) {
$_GET[$Name] = stripslashes($Value);
}
}
$OpenID = new LightOpenID();
if (isset($_GET['url']))
$OpenID->identity = $_GET['url'];
$Url = Url('/entry/connect/openid', TRUE);
$UrlParts = explode('?', $Url);
parse_str(GetValue(1, $UrlParts, ''), $Query);
$Query = array_merge($Query, ArrayTranslate($_GET, array('display', 'Target')));
$OpenID->returnUrl = $UrlParts[0].'?'.http_build_query($Query);
$OpenID->required = array('contact/email', 'namePerson/first', 'namePerson/last', 'pref/language');
$this->EventArguments['OpenID'] = $OpenID;
$this->FireEvent('GetOpenID');
return $OpenID;
}
示例14: index_action
function index_action()
{
$this->set_search();
$where = "1";
if ($_GET['keyword']) {
if ($_GET['type'] == "1") {
$where .= " AND `username` like '%" . $_GET['keyword'] . "%'";
} else {
$where .= " AND `content` like '%" . $_GET['keyword'] . "%'";
}
$urlarr['keyword'] = $_GET['keyword'];
$urlarr['type'] = $_GET['type'];
}
if ($_GET['end']) {
if ($_GET['end'] == '1') {
$where .= " and `ctime` >= '" . strtotime(date("Y-m-d 00:00:00")) . "'";
} else {
$where .= " and `ctime` >= '" . strtotime('-' . $_GET['end'] . 'day') . "'";
}
$urlarr['end'] = $_GET['end'];
}
if ($_GET['order']) {
$where .= " order by " . $_GET['t'] . " " . $_GET['order'];
$urlarr['order'] = $_GET['order'];
$urlarr['t'] = $_GET['t'];
} else {
$where .= " order by id desc";
}
$urlarr['status'] = $_GET['status'];
$urlarr['order'] = $_GET['order'];
$urlarr['page'] = "{{page}}";
$pageurl = Url($_GET['m'], $urlarr, 'admin');
$rows = $this->get_page("sysmsg", $where, $pageurl, $this->config['sy_listnum']);
$this->yuntpl(array('admin/sysnews'));
}
示例15: com_action
function com_action()
{
$_GET['id'] = (int) $_GET['id'];
$urlarr['c'] = $_GET['c'];
$urlarr['id'] = $_GET['id'];
$urlarr['page'] = "{{page}}";
$pageurl = Url($_GET['m'], $urlarr, 'admin');
$rows = $this->get_page("special_com", "`sid`='" . $_GET['id'] . "'", $pageurl, $this->config['sy_listnum']);
if ($rows && is_array($rows)) {
$uid = array();
foreach ($rows as $val) {
$uid[] = $val['uid'];
}
$company = $this->obj->DB_select_all("company", "`uid` in(" . pylode(',', $uid) . ")", "uid,name");
foreach ($rows as $key => $val) {
foreach ($company as $v) {
if ($val['uid'] == $v['uid']) {
$rows[$key]['name'] = $v['name'];
}
}
}
}
$this->yunset("rows", $rows);
$this->yuntpl(array('admin/admin_special_com'));
}