本文整理汇总了PHP中formatUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP formatUrl函数的具体用法?PHP formatUrl怎么用?PHP formatUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了formatUrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionLogin
/**
*
* 登录处理
*/
public function actionLogin()
{
if (($userAccount = $this->input->post('userAccount', TRUE)) === FALSE) {
redirect(formatUrl('login/index?msg=' . urlencode('请填写账户')));
}
if (($userPassword = $this->input->post('userPassword', TRUE)) === FALSE) {
redirect(formatUrl('login/index?msg=' . urlencode('请填写密码')));
}
$this->load->model('MIS_Admin');
if (($adminInfo = $this->MIS_Admin->checkAdmin($userAccount, $userPassword)) === FALSE) {
redirect(formatUrl('login/index?msg=' . urlencode('账户或密码错误')));
}
$info = array('admin_id' => $adminInfo['admin_id'], 'admin_name' => $adminInfo['admin_name']);
if ($adminInfo['admin_role'] == 0) {
$info['admin_role'] = 0;
$info['admin_rights'] = 'all';
} else {
$this->load->model('MIS_Admin');
$roleInfo = $this->MIS_Admin->getRoleInfo($adminInfo['admin_role']);
$info['admin_role'] = $adminInfo['admin_role'];
$info['admin_rights'] = $roleInfo['role_rights'];
}
$this->session->set_userdata($info);
redirect(formatUrl('home/index'));
}
示例2: buildLink
function buildLink($controller, $id, $title = false)
{
$link = APP_BOOTSTRAP;
$link .= '/' . $controller;
$link .= '/' . $id;
$link .= $title ? '/' . formatUrl($title) : '';
$link .= '/';
return $link;
}
示例3: index
/**
*
* 活动首页
*/
public function index()
{
$data = array();
$this->load->model('MIS_Activity');
$offset = 0;
$pageUrl = '';
page(formatUrl('activity/index') . '?', $this->MIS_Activity->getCount(array()), PER_COUNT, $offset, $pageUrl);
$dataList = $this->MIS_Article->getList(array(), $offset, PER_COUNT);
$data['pageUrl'] = $pageUrl;
$data['dataList'] = $dataList;
$this->showView('activity', $data);
}
示例4: checkLogin
/**
*
* 检测登录
*/
function checkLogin()
{
$ci =& get_instance();
if ($ci->userId == '') {
if (strtolower($ci->rtrClass) !== 'login') {
redirect(formatUrl('login/index'));
}
} else {
if (strtolower($ci->rtrClass) === 'login') {
redirect(formatUrl('home/index'));
}
}
}
示例5: doConfig
public function doConfig()
{
$data = array();
if (checkRight('sys_config') === FALSE) {
$this->showView('denied', $data);
exit;
}
$this->load->model('MIS_Sys');
$data = $this->input->post();
if ($data['sys_id']) {
$this->MIS_Sys->update($data);
} else {
$this->MIS_Sys->add($data);
}
redirect(formatUrl('sys/index?msg=') . urlencode('保存成功'));
}
示例6: doReply
/**
*
* 回复
*/
public function doReply()
{
$data = $this->input->post();
if (checkRight('feedback_reply') === FALSE) {
$this->showView('denied', $data);
exit;
}
$data['reply_time'] = strtotime('now');
$data['admin_id'] = $this->userId;
$data['admin_name'] = $this->userName;
$this->load->model('MIS_Feedback');
$this->MIS_Feedback->addReply($data);
$updateData = array();
$updateData['feedback_id'] = $data['feedback_id'];
$updateData['feedback_status'] = 1;
$this->MIS_Feedback->update($updateData);
redirect(formatUrl('feedback/index'));
}
示例7: doConfirmApply
/**
*
* 确认申请
*/
public function doConfirmApply()
{
$data = $this->input->post();
unset($data['file']);
if (!$data['follow_by'] && checkRight('project_apply_confirm') === FALSE) {
$this->showView('denied', $data);
exit;
}
if ($data['follow_by'] && checkRight('project_apply_assign') === FALSE) {
$this->showView('denied', $data);
exit;
}
if (!$data['follow_by']) {
$data['status'] = 1;
}
$this->load->model('MIS_Apply');
$msg = '';
$this->MIS_Apply->update($data);
redirect(formatUrl('project/index'));
}
示例8: fee
public function fee()
{
$data = array();
if (checkRight('finance_fee') === FALSE) {
$this->showView('denied', $data);
exit;
}
$this->load->model('MIS_Fee');
$keyword = $this->input->get();
$offset = 0;
$pageUrl = '';
page(formatUrl('finance/fee'), $this->MIS_Fee->getCount($keyword), PER_COUNT, $offset, $pageUrl);
$list = $this->MIS_Fee->getList($keyword, $offset, PER_COUNT);
$feeInfo = $this->MIS_Fee->getEnterpriseFee();
$dataList = array();
foreach ($list as $item) {
$item['curPay'] = $item['rent_fee'] + $item['property_fee'] + $item['water_fee_unit_price'] * $item['water_fee_num'] + $item['elec_fee_unit_price'] * $item['elec_fee_num'];
if (isset($feeInfo[$item['enterprise_id']])) {
$item['fee'] = $feeInfo[$item['enterprise_id']]['fee'];
} else {
$item['fee'] = 0;
}
if ($item['pay_status'] == 0) {
$item['otherPay'] = $item['fee'] - $item['curPay'];
$item['totalPay'] = $item['curPay'] + $item['otherPay'];
} else {
$item['totalPay'] = $item['otherPay'] = $item['fee'];
}
$item['curPay'] = round($item['curPay'], 2);
$item['otherPay'] = round($item['otherPay'], 2);
$item['totalPay'] = round($item['totalPay'], 2);
$dataList[] = $item;
}
$data['pageUrl'] = $pageUrl;
$data['dataList'] = $dataList;
$data['keyword'] = $keyword;
$this->showView('financeFee', $data);
}
示例9: crawlKeyword
function crawlKeyword($keywordInfo, $seId = '')
{
$crawlResult = array();
$websiteUrl = formatUrl($keywordInfo['url']);
if (empty($websiteUrl)) {
return $crawlResult;
}
if (empty($keywordInfo['name'])) {
return $crawlResult;
}
$seList = explode(':', $keywordInfo['searchengines']);
foreach ($seList as $seInfoId) {
if (!empty($seId) && $seInfoId != $seId) {
continue;
}
$this->seFound = 1;
$searchUrl = str_replace('[--keyword--]', urlencode($keywordInfo['name']), $this->seList[$seInfoId]['url']);
$searchUrl = str_replace('[--lang--]', $keywordInfo['lang_code'], $searchUrl);
$searchUrl = str_replace('[--country--]', $keywordInfo['country_code'], $searchUrl);
$seUrl = str_replace('[--start--]', $this->seList[$seInfoId]['start'], $searchUrl);
if (!empty($this->seList[$seInfoId]['cookie_send'])) {
$this->seList[$seInfoId]['cookie_send'] = str_replace('[--lang--]', $keywordInfo['lang_code'], $this->seList[$seInfoId]['cookie_send']);
$this->spider->_CURLOPT_COOKIE = $this->seList[$seInfoId]['cookie_send'];
}
$result = $this->spider->getContent($seUrl);
$pageContent = $result['page'];
$seStart = $this->seList[$seInfoId]['start'] + $this->seList[$seInfoId]['no_of_results_page'];
while (empty($result['error']) && $seStart < $this->seList[$seInfoId]['max_results']) {
$seUrl = str_replace('[--start--]', $seStart, $searchUrl);
$result = $this->spider->getContent($seUrl);
$pageContent .= $result['page'];
$seStart += $this->seList[$seInfoId]['no_of_results_page'];
sleep(SP_CRAWL_DELAY);
}
$crawlStatus = 0;
if (empty($result['error'])) {
if (preg_match_all($this->seList[$seInfoId]['regex'], $pageContent, $matches)) {
$urlList = $matches[$this->seList[$seInfoId]['url_index']];
$crawlResult[$seInfoId]['matched'] = array();
foreach ($urlList as $i => $url) {
$url = strip_tags($url);
if ($this->showAll || stristr($url, $websiteUrl)) {
if ($this->showAll && stristr($url, $websiteUrl)) {
$matchInfo['found'] = 1;
} else {
$matchInfo['found'] = 0;
}
$matchInfo['url'] = $url;
$matchInfo['title'] = strip_tags($matches[$this->seList[$seInfoId]['title_index']][$i]);
$matchInfo['description'] = strip_tags($matches[$this->seList[$seInfoId]['description_index']][$i]);
$matchInfo['rank'] = $i + 1;
$crawlResult[$seInfoId]['matched'][] = $matchInfo;
}
}
$crawlStatus = 1;
} else {
if (SP_DEBUG) {
echo "<p class='note' style='text-align:left;'>Error occured while parsing {$seUrl} " . formatErrorMsg("Regex not matched <br>\n") . "</p>";
}
}
} else {
if (SP_DEBUG) {
echo "<p class='note' style='text-align:left;'>Error occured while crawling {$seUrl} " . formatErrorMsg($result['errmsg'] . "<br>\n") . "</p>";
}
}
$crawlResult[$seInfoId]['status'] = $crawlStatus;
}
return $crawlResult;
}
示例10: getPageInfo
function getPageInfo($url, $domainUrl, $returnUrls = false)
{
$urlWithTrailingSlash = Spider::addTrailingSlash($url);
$ret = $this->getContent($urlWithTrailingSlash);
$pageInfo = array();
$checkUrl = formatUrl($domainUrl);
if (!empty($ret['page'])) {
$string = str_replace(array("\n", '\\n\\r', '\\r\\n', '\\r'), "", $ret['page']);
$pageInfo = WebsiteController::crawlMetaData($url, '', $string, true);
$pattern = "/<a(.*?)>(.*?)<\\/a>/is";
preg_match_all($pattern, $string, $matches, PREG_PATTERN_ORDER);
for ($i = 0; $i < count($matches[1]); $i++) {
$href = $this->__getTagParam("href", $matches[1][$i]);
if (!empty($href) || !empty($matches[2][$i])) {
if (!preg_match('/mailto:/', $href) && !preg_match('/javascript:|;/', $href)) {
$pageInfo['total_links'] += 1;
$external = 0;
if (stristr($href, 'http://') || stristr($href, 'https://')) {
if (!preg_match("/^" . preg_quote($checkUrl, '/') . "/", formatUrl($href))) {
$external = 1;
$pageInfo['external'] += 1;
}
} else {
// if url starts with / then append with base url of site
if (preg_match('/^\\//', $href)) {
$href = $domainUrl . $href;
} elseif ($url == $domainUrl) {
$href = $domainUrl . "/" . $href;
} else {
$pageInfo['total_links'] -= 1;
continue;
}
// if contains back directory operator
if (stristr($href, '/../')) {
$hrefParts = explode('/../', $href);
preg_match('/.*\\//', $hrefParts[0], $matchpart);
$href = $matchpart[0] . $hrefParts[1];
}
}
// if details of urls to be checked
if ($returnUrls) {
$linkInfo['link_url'] = $href;
if (stristr($matches[2][$i], '<img')) {
$linkInfo['link_anchor'] = $this->__getTagParam("alt", $matches[2][$i]);
} else {
$linkInfo['link_anchor'] = strip_tags($matches[2][$i]);
}
$linkInfo['nofollow'] = stristr($matches[1][$i], 'nofollow') ? 1 : 0;
$linkInfo['link_title'] = $this->__getTagParam("title", $matches[1][$i]);
if ($external) {
$pageInfo['external_links'][] = $linkInfo;
} else {
$pageInfo['site_links'][] = $linkInfo;
}
}
}
}
}
}
//echo "<pre>";print_r($pageInfo);exit;
return $pageInfo;
}
示例11: doDel
/**
*
* 删除
*/
public function doDel()
{
$data = array();
if (checkRight('role_del') === FALSE) {
$this->showView('denied', $data);
exit;
}
$id = $this->input->get('id');
$this->load->model('APP_Admin');
$adminList = $this->APP_Admin->queryAdminByRole($id);
$this->load->model('APP_Role');
if (empty($adminList)) {
$this->APP_Role->del($id);
redirect(formatUrl('role/index'));
} else {
redirect(formatUrl('role/index?msg=' . urlencode('该分组下存在' . count($adminList) . '个用户,暂时不可删除')));
}
}
示例12: fileDoDel
/**
*
* 删除文件
*/
public function fileDoDel()
{
$data = array();
$did = $this->input->get('did');
$fid = $this->input->get('id');
$this->load->model('MIS_Netdisk');
$info = $this->MIS_Netdisk->getDirInfo($did);
if ($this->userId == $info['admin_id'] || $this->userRole == 0 || in_array($this->userRole, explode(',', $info['dir_role']))) {
$this->MIS_Netdisk->delFile($fid);
redirect(formatUrl('netdisk/dir?id=') . $did);
} else {
$this->showView('denied', $data);
exit;
}
}
示例13: showReports
function showReports($searchInfo = '')
{
$userId = isLoggedIn();
if (!empty($searchInfo['from_time'])) {
$fromTime = strtotime($searchInfo['from_time'] . ' 00:00:00');
} else {
$fromTime = @mktime(0, 0, 0, date('m'), date('d') - 30, date('Y'));
}
if (!empty($searchInfo['to_time'])) {
$toTime = strtotime($searchInfo['to_time'] . ' 23:59:59');
} else {
$toTime = @mktime();
}
$this->set('fromTime', date('Y-m-d', $fromTime));
$this->set('toTime', date('Y-m-d', $toTime));
$websiteController = new WebsiteController();
$websiteList = $websiteController->__getAllWebsites($userId, true);
$this->set('websiteList', $websiteList);
$websiteId = empty($searchInfo['website_id']) ? $websiteList[0]['id'] : intval($searchInfo['website_id']);
$this->set('websiteId', $websiteId);
$conditions = empty($websiteId) ? "" : " and s.website_id={$websiteId}";
$sql = "select s.* ,w.name\r\n\t\t\t\t\t\t\t\tfrom backlinkresults s,websites w \r\n\t\t\t\t\t\t\t\twhere s.website_id=w.id \r\n\t\t\t\t\t\t\t\tand result_time>= {$fromTime} and result_time<={$toTime} {$conditions} \r\n\t\t\t\t\t\t\t\torder by result_time";
$reportList = $this->db->select($sql);
$i = 0;
$colList = $this->colList;
foreach ($colList as $col => $dbCol) {
$prevRank[$col] = 0;
}
# loop throgh rank
foreach ($reportList as $key => $repInfo) {
foreach ($colList as $col => $dbCol) {
$rankDiff[$col] = '';
}
foreach ($colList as $col => $dbCol) {
if ($i > 0) {
$rankDiff[$col] = ($prevRank[$col] - $repInfo[$dbCol]) * -1;
if ($rankDiff[$col] > 0) {
$rankDiff[$col] = "<font class='green'>({$rankDiff[$col]})</font>";
} elseif ($rankDiff[$col] < 0) {
$rankDiff[$col] = "<font class='red'>({$rankDiff[$col]})</font>";
}
}
$reportList[$key]['rank_diff_' . $col] = empty($rankDiff[$col]) ? '' : $rankDiff[$col];
}
foreach ($colList as $col => $dbCol) {
$prevRank[$col] = $repInfo[$dbCol];
}
$i++;
}
$websiteInfo = $websiteController->__getWebsiteInfo($websiteId);
$websiteUrl = @Spider::removeTrailingSlash(formatUrl($websiteInfo['url']));
$websiteUrl = urldecode($websiteUrl);
$this->set('directLinkList', array('google' => $this->backUrlList['google'] . $websiteUrl, 'msn' => $this->backUrlList['msn'] . $websiteUrl, 'alexa' => $this->backUrlList['alexa'] . $websiteUrl));
$this->set('list', array_reverse($reportList, true));
$this->render('backlink/backlinkreport');
}
示例14: crawlKeyword
function crawlKeyword($keywordInfo, $seId = '', $cron = false, $removeDuplicate = true)
{
$crawlResult = array();
$websiteUrl = formatUrl($keywordInfo['url'], false);
if (empty($websiteUrl)) {
return $crawlResult;
}
if (empty($keywordInfo['name'])) {
return $crawlResult;
}
$time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$seList = explode(':', $keywordInfo['searchengines']);
foreach ($seList as $seInfoId) {
if (!empty($seId) && $seInfoId != $seId) {
continue;
}
$this->seFound = 1;
// if execution from cron check whether cron already executed
/*if ($cron) {
if (SP_MULTIPLE_CRON_EXEC && $this->isCronExecuted($keywordInfo['id'], $seInfoId, $time)) continue;
}*/
$searchUrl = str_replace('[--keyword--]', urlencode(stripslashes($keywordInfo['name'])), $this->seList[$seInfoId]['url']);
$searchUrl = str_replace('[--lang--]', $keywordInfo['lang_code'], $searchUrl);
$searchUrl = str_replace('[--country--]', $keywordInfo['country_code'], $searchUrl);
if (empty($keywordInfo['country_code']) && stristr($searchUrl, '&cr=country&')) {
$searchUrl = str_replace('&cr=country&', '&cr=&', $searchUrl);
}
$seUrl = str_replace('[--start--]', $this->seList[$seInfoId]['start'], $searchUrl);
// if google add special parameters
$isGoogle = false;
if (stristr($this->seList[$seInfoId]['url'], 'google')) {
$isGoogle = true;
$seUrl .= "&ie=utf-8&pws=0&gl=" . $keywordInfo['country_code'];
}
if (!empty($this->seList[$seInfoId]['cookie_send'])) {
$this->seList[$seInfoId]['cookie_send'] = str_replace('[--lang--]', $keywordInfo['lang_code'], $this->seList[$seInfoId]['cookie_send']);
$this->spider->_CURLOPT_COOKIE = $this->seList[$seInfoId]['cookie_send'];
}
$result = $this->spider->getContent($seUrl);
$pageContent = $this->formatPageContent($seInfoId, $result['page']);
$crawlLogCtrl = new CrawlLogController();
$crawlInfo['crawl_type'] = 'keyword';
$crawlInfo['ref_id'] = empty($keywordInfo['id']) ? $keywordInfo['name'] : $keywordInfo['id'];
$crawlInfo['subject'] = $seInfoId;
$seStart = $this->seList[$seInfoId]['start'] + $this->seList[$seInfoId]['start_offset'];
while (empty($result['error']) && $seStart < $this->seList[$seInfoId]['max_results']) {
$logId = $result['log_id'];
$crawlLogCtrl->updateCrawlLog($logId, $crawlInfo);
sleep(SP_CRAWL_DELAY);
$seUrl = str_replace('[--start--]', $seStart, $searchUrl);
$result = $this->spider->getContent($seUrl);
$pageContent .= $this->formatPageContent($seInfoId, $result['page']);
$seStart += $this->seList[$seInfoId]['start_offset'];
}
# to check whether utf8 conversion needed
if (!empty($this->seList[$seInfoId]['encoding'])) {
$pageContent = mb_convert_encoding($pageContent, "UTF-8", $this->seList[$seInfoId]['encoding']);
}
$crawlStatus = 0;
if (empty($result['error'])) {
// to update cron that report executed for akeyword on a search engine
if (SP_MULTIPLE_CRON_EXEC && $cron) {
$this->saveCronTrackInfo($keywordInfo['id'], $seInfoId, $time);
}
if (preg_match_all($this->seList[$seInfoId]['regex'], $pageContent, $matches)) {
$urlList = $matches[$this->seList[$seInfoId]['url_index']];
$crawlResult[$seInfoId]['matched'] = array();
$rank = 1;
$previousDomain = "";
foreach ($urlList as $i => $url) {
$url = urldecode(strip_tags($url));
// add special condition for baidu
if (stristr($this->seList[$seInfoId]['domain'], "baidu")) {
$url = addHttpToUrl($url);
$url = str_replace("...", "", $url);
}
if (!preg_match('/^http:\\/\\/|^https:\\/\\//i', $url)) {
continue;
}
// check for to remove msn ad links in page
if (stristr($url, 'r.msn.com')) {
continue;
}
// check to remove duplicates from same domain if google is the search engine
if ($removeDuplicate && $isGoogle) {
$currentDomain = parse_url($url, PHP_URL_HOST);
if ($previousDomain == $currentDomain) {
continue;
}
$previousDomain = $currentDomain;
}
if ($this->showAll || stristr($url, $websiteUrl)) {
if ($this->showAll && stristr($url, $websiteUrl)) {
$matchInfo['found'] = 1;
} else {
$matchInfo['found'] = 0;
}
$matchInfo['url'] = $url;
$matchInfo['title'] = strip_tags($matches[$this->seList[$seInfoId]['title_index']][$i]);
$matchInfo['description'] = strip_tags($matches[$this->seList[$seInfoId]['description_index']][$i]);
//.........这里部分代码省略.........
示例15: doConfirmBooking
/**
*
* 确认预订信息
*/
public function doConfirmBooking()
{
$data = $this->input->post();
unset($data['file']);
if (!$data['follow_by'] && checkRight('room_booking_confirm') === FALSE) {
$this->showView('denied', $data);
exit;
}
if ($data['follow_by'] && checkRight('room_booking_assign') === FALSE) {
$this->showView('denied', $data);
exit;
}
$this->load->model('MIS_Room');
if (!$data['follow_by']) {
$info = $this->MIS_Room->getBookingInfo($data['booking_id']);
$bookingInfo = $this->MIS_Room->searchBookingByTime($info['booking_id'], $info['room_id'], $info['start_time'], $info['end_time']);
foreach ($bookingInfo as $info) {
if ($info['status'] == 1) {
redirect(formatUrl('room/viewBooking?id=') . $data['booking_id'] . '&msg=' . urlencode('该时段已被预约'));
exit;
}
}
}
$this->MIS_Room->updateBooking($data);
redirect(formatUrl('room/viewBooking?id=') . $data['booking_id']);
}