Example #1
0
 /**
  *
  * 登录处理
  */
 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'));
 }
Example #2
0
function buildLink($controller, $id, $title = false)
{
    $link = APP_BOOTSTRAP;
    $link .= '/' . $controller;
    $link .= '/' . $id;
    $link .= $title ? '/' . formatUrl($title) : '';
    $link .= '/';
    return $link;
}
Example #3
0
 /**
  *
  * 活动首页
  */
 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);
 }
/**
 *
 * 检测登录
 */
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'));
        }
    }
}
Example #5
0
 /**
  *
  * 登录处理
  */
 public function actionLogin()
 {
     if (($userAccount = $this->input->post('user_login', TRUE)) == FALSE) {
         redirect(formatUrl('login/index?msg=' . urlencode('请填写账户')));
     }
     if (($userPassword = $this->input->post('user_password', TRUE)) == FALSE) {
         redirect(formatUrl('login/index?msg=' . urlencode('请填写密码')));
     }
     $this->load->model('MIS_User');
     if (($userInfo = $this->MIS_User->checkUser($userAccount, $userPassword)) === FALSE) {
         redirect(formatUrl('login/index?msg=' . urlencode('账户或密码错误')));
     }
     $info = array('user_id' => $userInfo['user_id'], 'user_name' => $userInfo['user_nickname'] ? $userInfo['user_nickname'] : $userInfo['user_name'], 'user_type' => $userInfo['user_type']);
     $this->session->set_userdata($info);
     redirect(formatUrl('myhome/index'));
 }
Example #6
0
File: sys.php Project: shaoyi88/mis
 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('保存成功'));
 }
Example #7
0
 /**
  * 
  * 回复
  */
 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'));
 }
Example #8
0
 /**
  * 
  * 确认申请
  */
 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'));
 }
Example #9
0
 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);
 }
Example #10
0
 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;
 }
Example #11
0
 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;
 }
Example #12
0
 /**
  * 
  * 删除
  */
 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) . '个用户,暂时不可删除')));
     }
 }
Example #13
0
 /**
  * 
  * 删除文件
  */
 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;
     }
 }
Example #14
0
 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');
 }
Example #15
0
 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]);
                         $matchInfo['rank'] = $rank;
                         $crawlResult[$seInfoId]['matched'][] = $matchInfo;
                     }
                     $rank++;
                 }
                 $crawlStatus = 1;
             } else {
                 // set crawl log info
                 $crawlInfo['crawl_status'] = 0;
                 $crawlInfo['log_message'] = SearchEngineController::isCaptchInSearchResults($pageContent) ? "<font class=error>Captcha found</font> in search result page" : "Regex not matched error occured while parsing search results!";
                 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;
         sleep(SP_CRAWL_DELAY);
         // update crawl log
         $logId = $result['log_id'];
         $crawlLogCtrl->updateCrawlLog($logId, $crawlInfo);
     }
     return $crawlResult;
 }
Example #16
0
 /**
  * 
  * 确认预订信息
  */
 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']);
 }
Example #17
0
 /**
  * 
  * 删除
  */
 public function productDoDel()
 {
     $data = array();
     if (checkRight('club_productDel') === FALSE) {
         $this->showView('denied', $data);
         exit;
     }
     $id = $this->input->get('id');
     $this->load->model('MIS_ClubProduct');
     $this->MIS_ClubProduct->del($id);
     redirect(formatUrl('club/productList'));
 }
 function checkExcludeLinks($excludeLinks, $websiteUrl, $exclude = true)
 {
     $linkList = explode(',', $excludeLinks);
     $newList = array();
     $errMsg = "";
     $checkUrl = formatUrl($websiteUrl);
     foreach ($linkList as $link) {
         $link = str_replace(' ', '+', trim($link));
         $linkUrl = formatUrl($link);
         if (!empty($linkUrl)) {
             $newList[] = $link;
             if (empty($errMsg)) {
                 if (!preg_match("/^" . preg_quote($checkUrl, '/') . "/", $linkUrl)) {
                     $linkLabel = $exclude ? $_SESSION['text']['label']["Exclude"] : $_SESSION['text']['label']["Include"];
                     $errMsg = "{$linkLabel} link <b>'{$link}'</b> {$this->spTextSA['should start with']} <b>'{$websiteUrl}'</b>";
                 }
             }
         }
     }
     $excludeLinks = implode(',', $newList);
     $retInfo['exclude_links'] = $excludeLinks;
     $retInfo['err_msg'] = $errMsg;
     return $retInfo;
 }
Example #19
0
 /**
  * 
  * 删除
  */
 public function doDel()
 {
     $data = array();
     if (checkRight('admin_del') === FALSE) {
         $this->showView('denied', $data);
         exit;
     }
     $id = $this->input->get('id');
     $this->load->model('APP_Admin');
     $this->APP_Admin->del($id);
     redirect(formatUrl('admin/index'));
 }
Example #20
0
 /**
  * 
  * 指派跟进人
  */
 public function doEnterpriseUserFollow()
 {
     if (checkRight('enterprise_user_assign') === FALSE) {
         $this->showView('denied', $data);
         exit;
     }
     $data = $this->input->post();
     $this->load->model('MIS_User');
     $this->MIS_User->updateRelateEnterpriseApply($data);
     redirect(formatUrl('workbench/enterprise'));
 }
Example #21
0
 function crawlKeyword($keywordInfo, $seId = '', $cron = false)
 {
     $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--]', strtolower($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 (!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']);
         $seStart = $this->seList[$seInfoId]['start'] + $this->seList[$seInfoId]['start_offset'];
         while (empty($result['error']) && $seStart < $this->seList[$seInfoId]['max_results']) {
             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;
                 foreach ($urlList as $i => $url) {
                     $url = urldecode(strip_tags($url));
                     if (!preg_match('/^http:\\/\\/|^https:\\/\\//i', $url)) {
                         continue;
                     }
                     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'] = $rank;
                         $crawlResult[$seInfoId]['matched'][] = $matchInfo;
                     }
                     $rank++;
                 }
                 $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;
         sleep(SP_CRAWL_DELAY);
     }
     return $crawlResult;
 }
Example #22
0
 /**
  * 
  * 退出
  */
 public function logout()
 {
     $this->session->sess_destroy();
     redirect(formatUrl('login/index'));
 }
Example #23
0
 /**
  * 
  * 删除
  */
 public function doDel()
 {
     $data = array();
     if (checkRight('user_del') === FALSE) {
         $this->showView('denied', $data);
         exit;
     }
     $id = $this->input->get('id');
     $this->load->model('MIS_User');
     $this->MIS_User->del($id);
     redirect(formatUrl('user/index'));
 }
Example #24
0
 /**
  *
  * 认证为企业用户do
  */
 public function do_identify()
 {
     $data = $this->input->post();
     $this->load->model('MIS_Enterprise');
     $check = $this->MIS_Enterprise->checkCode($data['code']);
     if (!empty($check)) {
         $this->load->model('MIS_User');
         $udata['user_id'] = $this->userId;
         $udata['user_second_type'] = 2;
         $udata['user_type'] = 0;
         $udata['enterprise_id'] = $check['enterprise_id'];
         $this->MIS_User->update($udata);
         redirect(formatUrl('myhome'));
     } else {
         $msg = '企业邀请码错误';
         redirect(formatUrl('home/none?msg=' . $msg));
     }
 }
Example #25
0
 public function doAddPotential()
 {
     $data = array();
     if ($this->input->post('enterprise_id')) {
         $data = $this->input->post();
         $enterprise_building = $data['enterprise_building'];
         unset($data['enterprise_building']);
         $this->load->model('MIS_EnterpriseHidden');
         $this->MIS_EnterpriseHidden->update($data);
         // 删除意向办公地点
         $this->MIS_EnterpriseHidden->delEnterpriseBuildingInfo($data['enterprise_id']);
         // 新增意向办公地点
         $addList = array();
         foreach ($enterprise_building as $item) {
             $addItem = array();
             $addItem['building_id'] = $item;
             $addItem['enterprise_id'] = $data['enterprise_id'];
             $addList[] = $addItem;
         }
         $this->MIS_EnterpriseHidden->batchAddEnterpriseBuilding($addList);
         redirect(formatUrl('investment/potential'));
     } else {
         $data = $this->input->post();
         $enterprise_building = $data['enterprise_building'];
         unset($data['enterprise_building']);
         $data['add_time'] = time();
         $this->load->model('MIS_EnterpriseHidden');
         $msg = '';
         if (($id = $this->MIS_EnterpriseHidden->add($data)) === FALSE) {
             $msg = 'msg=' . urlencode('创建失败');
         } else {
             // 新增企业所在办公地点
             $addList = array();
             foreach ($enterprise_building as $item) {
                 $addItem = array();
                 $addItem['building_id'] = $item;
                 $addItem['enterprise_id'] = $id;
                 $addList[] = $addItem;
             }
             $this->MIS_EnterpriseHidden->batchAddEnterpriseBuilding($addList);
             $msg = 'msg=' . urlencode('创建成功');
         }
         redirect(formatUrl('investment/potential?' . $msg));
     }
 }
Example #26
0
for ($i = 0; $i < sizeof($folders); $i++) {
    $f = $folders[$i];
    $a = explode("_", $f, 2);
    if (sizeof($a) == 2 && strlen($a[0]) >= 6) {
        $b = explode("@", $a[0]);
        if (isDateYYMMDD($b[0])) {
            $date = formatDate($b[0]);
            if ($date == $last_date) {
                $date = "";
            } else {
                $last_date = $date;
            }
            // save last date to detect repeats
            $version = sizeof($b) == 1 ? "" : $b[1];
            $description = formatDescription($version, urldecode($a[1]));
            $url = formatUrl($a[0]);
            if ($date != "" && $i > 0) {
                ?>
      <tr>
        <td colspan="3">&nbsp;</td>
      </tr>
	<?php 
            }
            ?>
  
      <tr>
        <td width="180" align="right" valign="top"><?php 
            echo $date;
            ?>
</td>
        <td width="30" align="right" valign="top">&nbsp;</td>
Example #27
0
 function getPageInfo($url, $domainUrl, $returnUrls = false)
 {
     $urlWithTrailingSlash = Spider::addTrailingSlash($url);
     $ret = $this->getContent($urlWithTrailingSlash);
     $pageInfo = array();
     $checkUrl = formatUrl($domainUrl);
     // if relative links of a page needs to be checked
     if (SP_RELATIVE_LINK_CRAWL) {
         $relativeUrl = $domainUrl . $this->getRelativeUrl($url);
     }
     // find main domain host link
     $domainHostInfo = parse_url($domainUrl);
     $domainHostLink = $domainHostInfo['scheme'] . "://" . $domainHostInfo['host'] . "/";
     if (!empty($ret['page'])) {
         $string = str_replace(array("\n", '\\n\\r', '\\r\\n', '\\r'), "", $ret['page']);
         $pageInfo = WebsiteController::crawlMetaData($url, '', $string, true);
         // check whether base url tag is there
         $baseTagUrl = "";
         if (preg_match("/<base (.*?)>/is", $string, $match)) {
             $baseTagUrl = $this->__getTagParam("href", $match[1]);
             $baseTagUrl = $this->addTrailingSlash($baseTagUrl);
         }
         $pattern = "/<a(.*?)>(.*?)<\\/a>/is";
         preg_match_all($pattern, $string, $matches, PREG_PATTERN_ORDER);
         // loop through matches
         for ($i = 0; $i < count($matches[1]); $i++) {
             // check links foudn valid or not
             $href = $this->__getTagParam("href", $matches[1][$i]);
             if (!empty($href) || !empty($matches[2][$i])) {
                 if (!preg_match('/mailto:/', $href) && !preg_match('/javascript:|;/', $href)) {
                     // find external links
                     $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 = $domainHostLink . $href;
                         } elseif (!empty($baseTagUrl)) {
                             $href = $baseTagUrl . $href;
                         } elseif ($url == $domainUrl) {
                             $href = $domainUrl . "/" . $href;
                         } elseif (SP_RELATIVE_LINK_CRAWL) {
                             $href = $relativeUrl . "/" . $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;
                         }
                     }
                 }
             }
         }
     }
     return $pageInfo;
 }
Example #28
0
/**
 *
 * 检测前台登录
 */
function checkUserLogin()
{
    $ci =& get_instance();
    $ci->userId = $ci->session->userdata('user_id');
    $ci->userName = $ci->session->userdata('user_name');
    $ci->userRights = $ci->session->userdata('user_rights');
    $ci->userType = $ci->session->userdata('user_type');
    if ($ci->userId == '') {
        if (strtolower($ci->rtrClass) !== 'login') {
            redirect(formatUrl('login/index'));
        }
    } else {
        if (strtolower($ci->rtrClass) === 'login') {
            redirect(formatUrl('home/index'));
        }
    }
}
Example #29
0
function formatAdUrl($adid, $url, $content, $newWindow = true)
{
    return formatUrl("adredir.php?id=" . $adid . "&amp;url=" . rawurlencode($url), $newWindow, $content);
}
Example #30
0
 function checkSubmissionStatus($dirInfo)
 {
     $dirInfo['id'] = intval($dirInfo['id']);
     $sql = "select ds.* ,d.domain,d.search_script,w.url\r\n\t\t\t\t\tfrom dirsubmitinfo ds,directories d,websites w \r\n\t\t\t\t\twhere ds.directory_id=d.id and ds.website_id=w.id \r\n\t\t\t\t\tand ds.id=" . $dirInfo['id'];
     $statusInfo = $this->db->select($sql, true);
     $searchUrl = preg_match('/\\/$/', $statusInfo['domain']) ? $statusInfo['domain'] . $statusInfo['search_script'] : $statusInfo['domain'] . "/" . $statusInfo['search_script'];
     $keyword = formatUrl($statusInfo['url']);
     $searchUrl = str_replace('[--keyword--]', urlencode($keyword), $searchUrl);
     $ret = $this->spider->getContent($searchUrl);
     if (empty($ret['error'])) {
         if (stristr($ret['page'], 'href="' . $statusInfo['url'] . '"')) {
             return 1;
         } elseif (stristr($ret['page'], "href='" . $statusInfo['url'] . "'")) {
             return 1;
         } elseif (stristr($ret['page'], 'href=' . $statusInfo['url'])) {
             return 1;
         }
     }
     return 0;
 }