function generateSitemapFile($sitemapInfo) { $sitemapInfo['website_id'] = intval($sitemapInfo['website_id']); if (!empty($sitemapInfo['website_id'])) { # check whether the sitemap directory is writable if (!is_writable(SP_TMPPATH . "/" . $this->sitemapDir)) { hideDiv('message'); showErrorMsg("Directory '<b>" . SP_TMPPATH . "/" . $this->sitemapDir . "</b>' is not <b>writable</b>. Please change its <b>permission</b> !"); } $websiteController = new WebsiteController(); $websiteInfo = $websiteController->__getWebsiteInfo($sitemapInfo['website_id']); $baseUrl = $websiteInfo['url']; $this->section = formatFileName($websiteInfo['name']); if (!preg_match('/\\/$/', $baseUrl)) { $baseUrl = $baseUrl . "/"; } $this->baseUrl = $baseUrl; $urlInfo = parse_url($this->baseUrl); $this->hostName = str_replace('www.', '', $urlInfo['host']); $this->smType = $sitemapInfo['sm_type']; $this->excludeUrl = $sitemapInfo['exclude_url']; if (!empty($sitemapInfo['freq'])) { $this->changefreq = $sitemapInfo['freq']; } if (!empty($sitemapInfo['priority'])) { $this->priority = $sitemapInfo['priority']; } $this->createSitemap(); } else { hideDiv('message'); showErrorMsg("No Website Found!"); } }
function index() { if (isLoggedIn()) { $userId = isLoggedIn(); /*$userCtrler = New UserController(); $userInfo = $userCtrler->__getUserInfo($userId); $this->set('userInfo', $userInfo);*/ $websiteCtrler = new WebsiteController(); $list = $websiteCtrler->__getAllWebsites($userId, true); include_once SP_CTRLPATH . "/saturationchecker.ctrl.php"; include_once SP_CTRLPATH . "/rank.ctrl.php"; include_once SP_CTRLPATH . "/backlink.ctrl.php"; $rankCtrler = new RankController(); $backlinlCtrler = new BacklinkController(); $saturationCtrler = new SaturationCheckerController(); $dirCtrler = new DirectoryController(); $websiteList = array(); foreach ($list as $listInfo) { # rank reports $report = $rankCtrler->__getWebsiteRankReport($listInfo['id']); $report = $report[0]; $listInfo['alexarank'] = empty($report['alexa_rank']) ? "-" : $report['alexa_rank'] . " " . $report['rank_diff_alexa']; $listInfo['googlerank'] = empty($report['google_pagerank']) ? "-" : $report['google_pagerank'] . " " . $report['rank_diff_google']; # back links reports $report = $backlinlCtrler->__getWebsitebacklinkReport($listInfo['id']); $report = $report[0]; $listInfo['google']['backlinks'] = empty($report['google']) ? "-" : $report['google'] . " " . $report['rank_diff_google']; $listInfo['yahoo']['backlinks'] = empty($report['yahoo']) ? "-" : $report['yahoo'] . " " . $report['rank_diff_yahoo']; $listInfo['msn']['backlinks'] = empty($report['msn']) ? "-" : $report['msn'] . " " . $report['rank_diff_msn']; # rank reports $report = $saturationCtrler->__getWebsiteSaturationReport($listInfo['id']); $report = $report[0]; $listInfo['google']['indexed'] = empty($report['google']) ? "-" : $report['google'] . " " . $report['rank_diff_google']; $listInfo['yahoo']['indexed'] = empty($report['yahoo']) ? "-" : $report['yahoo'] . " " . $report['rank_diff_yahoo']; $listInfo['msn']['indexed'] = empty($report['msn']) ? "-" : $report['msn'] . " " . $report['rank_diff_msn']; $listInfo['dirsub']['total'] = $dirCtrler->__getTotalSubmitInfo($listInfo['id']); $listInfo['dirsub']['active'] = $dirCtrler->__getTotalSubmitInfo($listInfo['id'], true); $websiteList[] = $listInfo; } $this->set('websiteList', $websiteList); $this->render('user/userhome'); } else { $this->render('home'); } }
function show($info, $error = false) { if (empty($info['website_id'])) { print "<script>" . pluginGETMethod() . "</script>"; return; } $langController = new LanguageController(); $this->set('langList', $langController->__getAllLanguages()); $this->set('langNull', true); if (empty($error)) { $websiteController = new WebsiteController(); $websiteInfo = $websiteController->__getWebsiteInfo($info['website_id']); $websiteInfo['website_id'] = $info['website_id']; } else { $websiteInfo = $info; } $this->set('websiteInfo', $websiteInfo); $this->pluginRender('showsiteinfo'); }
function editKeyword($keywordId, $listInfo = '') { $userId = isLoggedIn(); $websiteController = new WebsiteController(); $this->set('websiteList', $websiteController->__getAllWebsites($userId, true)); $langController = new LanguageController(); $this->set('langList', $langController->__getAllLanguages()); $this->set('langNull', true); $countryController = new CountryController(); $this->set('countryList', $countryController->__getAllCountries()); $this->set('countryNull', true); $seController = new SearchEngineController(); $this->set('seList', $seController->__getAllSearchEngines()); if (!empty($keywordId)) { if (empty($listInfo)) { $listInfo = $this->__getKeywordInfo($keywordId); $listInfo['oldName'] = $listInfo['name']; $listInfo['searchengines'] = explode(':', $listInfo['searchengines']); } $this->set('post', $listInfo); $this->render('keyword/edit'); exit; } $this->listKeywords(); }
function isHavingWebsite() { $userId = isLoggedIn(); $websiteCtrl = new WebsiteController(); $count = isAdmin() ? $websiteCtrl->__getCountAllWebsites() : $websiteCtrl->__getCountAllWebsites($userId); if ($count <= 0) { redirectUrl(SP_WEBPATH . "/admin-panel.php?sec=newweb"); } }
public function crawlMetaData($websiteUrl, $keyInput = '', $pageContent = '', $returVal = false) { if (empty($pageContent)) { if (!preg_match('/\\w+/', $websiteUrl)) { return; } if (!stristr($websiteUrl, 'http://')) { $websiteUrl = "http://" . $websiteUrl; } $spider = new Spider(); $ret = $spider->getContent($websiteUrl); } else { $ret['page'] = $pageContent; $metaInfo = array(); } if (!empty($ret['page'])) { if (empty($keyInput)) { # meta title preg_match('/<TITLE>(.*?)<\\/TITLE>/si', $ret['page'], $matches); if (!empty($matches[1])) { if ($returVal) { $metaInfo['page_title'] = $matches[1]; } else { WebsiteController::addInputValue($matches[1], 'webtitle'); } } # meta description preg_match('/<META.*?name="description".*?content="(.*?)"/si', $ret['page'], $matches); if (empty($matches[1])) { preg_match("/<META.*?name='description'.*?content='(.*?)'/si", $ret['page'], $matches); } if (empty($matches[1])) { preg_match('/<META content="(.*?)" name="description"/si', $ret['page'], $matches); } if (!empty($matches[1])) { if ($returVal) { $metaInfo['page_description'] = $matches[1]; } else { WebsiteController::addInputValue($matches[1], 'webdescription'); } } } # meta keywords preg_match('/<META.*?name="keywords".*?content="(.*?)"/si', $ret['page'], $matches); if (empty($matches[1])) { preg_match("/<META.*?name='keywords'.*?content='(.*?)'/si", $ret['page'], $matches); } if (empty($matches[1])) { preg_match('/<META content="(.*?)" name="keywords"/si', $ret['page'], $matches); } if (!empty($matches[1])) { if ($returVal) { $metaInfo['page_keywords'] = $matches[1]; } else { WebsiteController::addInputValue($matches[1], 'webkeywords'); } } } return $metaInfo; }
function routeCronJob($websiteId, $repTools = '', $cron = false) { $websiteId = intval($websiteId); if (empty($this->websiteInfo)) { $websiteCtrler = new WebsiteController(); $this->websiteInfo = $websiteCtrler->__getWebsiteInfo($websiteId); } if ($cron) { if (empty($this->cronList)) { $this->loadCronJobTools(); } $seoTools = $this->cronList; } else { $this->loadReportGenerationTools(explode(':', $repTools)); $seoTools = $this->repTools; } foreach ($seoTools as $cronInfo) { switch ($cronInfo['url_section']) { case "keyword-position-checker": $this->keywordPositionCheckerCron($websiteId); break; case "rank-checker": $this->rankCheckerCron($websiteId); break; case "backlink-checker": $this->backlinkCheckerCron($websiteId); break; case "saturation-checker": $this->saturationCheckerCron($websiteId); break; } } }
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; }
function showReports($searchInfo = '') { $this->set('sectionHead', 'Google and Alexa Rank Reports'); $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'] : $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 rankresults 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 = array('google' => 'google_pagerank', 'alexa' => 'alexa_rank'); 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) { $signVal = -1; $greaterClass = 'green'; $lessClass = 'red'; if ($col == 'alexa') { $signVal = 1; $greaterClass = 'green'; $lessClass = 'red'; } $rankDiff[$col] = ($prevRank[$col] - $repInfo[$dbCol]) * $signVal; if ($rankDiff[$col] > 0) { $rankDiff[$col] = "<font class='{$greaterClass}'>({$rankDiff[$col]})</font>"; } elseif ($rankDiff[$col] < 0) { $rankDiff[$col] = "<font class='{$lessClass}'>({$rankDiff[$col]})</font>"; } } $reportList[$key]['rank_diff_' . $col] = empty($rankDiff[$col]) ? '' : $rankDiff[$col]; } foreach ($colList as $col => $dbCol) { $prevRank[$col] = $repInfo[$dbCol]; } $i++; } $this->set('list', array_reverse($reportList, true)); $this->render('rank/rankreport'); }
function checkSubmissionReports($searchInfo) { $userId = isLoggedIn(); $websiteController = new WebsiteController(); $this->set('websiteList', $websiteController->__getAllWebsites($userId, true)); $this->set('websiteNull', true); $this->set('onClick', "scriptDoLoadPost('directories.php', 'search_form', 'subcontent', '&sec=checksub')"); $this->render('directory/checksubmission'); }
function showGenerateReports($searchInfo = '') { $userId = isLoggedIn(); $websiteController = new WebsiteController(); $websiteList = $websiteController->__getAllWebsites($userId, true); $this->set('websiteList', $websiteList); $websiteId = empty($searchInfo['website_id']) ? '' : $searchInfo['website_id']; $this->set('websiteId', $websiteId); $keywordController = new KeywordController(); $keywordList = $keywordController->__getAllKeywords($userId, $websiteId, true); $this->set('keywordList', $keywordList); $this->set('keyNull', true); $keywordId = empty($searchInfo['keyword_id']) ? '' : $searchInfo['keyword_id']; $this->set('keywordId', $keywordId); $seController = new SearchEngineController(); $seList = $seController->__getAllSearchEngines(); $this->set('seList', $seList); $seId = empty($searchInfo['se_id']) ? '' : $searchInfo['se_id']; $this->set('seId', $seId); $this->set('seNull', true); $this->set('seStyle', 170); $this->render('report/generatereport'); }
* * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ include_once "includes/sp-load.php"; checkLoggedIn(); include_once SP_CTRLPATH . "/website.ctrl.php"; include_once SP_CTRLPATH . "/keyword.ctrl.php"; $controller = new WebsiteController(); $controller->view->menu = 'seotools'; $controller->layout = 'ajax'; $controller->spTextPanel = $controller->getLanguageTexts('panel', $_SESSION['lang_code']); $controller->set('spTextPanel', $controller->spTextPanel); $controller->spTextWeb = $controller->getLanguageTexts('website', $_SESSION['lang_code']); $controller->set('spTextWeb', $controller->spTextWeb); if ($_SERVER['REQUEST_METHOD'] == 'POST') { switch ($_POST['sec']) { case "create": $controller->createWebsite($_POST); break; case "update": $controller->updateWebsite($_POST); break; case "activateall":
function index($searchInfo = '') { $spTextHome = $this->getLanguageTexts('home', $_SESSION['lang_code']); $this->set('spTextHome', $spTextHome); if (isLoggedIn()) { isHavingWebsite(); $userId = isLoggedIn(); $exportVersion = false; switch ($searchInfo['doc_type']) { case "export": $exportVersion = true; $exportContent = ""; break; case "pdf": $this->set('pdfVersion', true); break; case "print": $this->set('printVersion', true); break; } if (isAdmin()) { $userCtrler = new UserController(); $userList = $userCtrler->__getAllUsersHavingWebsite(); if (isset($_POST['user_id']) || isset($_GET['user_id'])) { $webUserId = intval($_POST['user_id']) ? intval($_POST['user_id']) : intval($_GET['user_id']); } else { $webUserId = $userList[0]['id']; } $this->set('userList', $userList); // if print method called if ($searchInfo['doc_type'] == 'print' && !empty($webUserId)) { $userInfo = $userCtrler->__getUserInfo($webUserId); $this->set('userName', $userInfo['username']); } } else { $webUserId = $userId; } $this->set('webUserId', $webUserId); $websiteCtrler = new WebsiteController(); $adminCheck = isAdmin() && empty($webUserId) ? true : false; $list = $websiteCtrler->__getAllWebsites($webUserId, $adminCheck, $searchInfo['search_name']); include_once SP_CTRLPATH . "/saturationchecker.ctrl.php"; include_once SP_CTRLPATH . "/rank.ctrl.php"; include_once SP_CTRLPATH . "/backlink.ctrl.php"; $rankCtrler = new RankController(); $backlinlCtrler = new BacklinkController(); $saturationCtrler = new SaturationCheckerController(); $dirCtrler = new DirectoryController(); $fromTime = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')); $toTime = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $websiteList = array(); foreach ($list as $listInfo) { # rank reports $report = $rankCtrler->__getWebsiteRankReport($listInfo['id'], $fromTime, $toTime); $report = $report[0]; $listInfo['alexarank'] = empty($report['alexa_rank']) ? "-" : $report['alexa_rank'] . " " . $report['rank_diff_alexa']; $listInfo['googlerank'] = empty($report['google_pagerank']) ? "-" : $report['google_pagerank'] . " " . $report['rank_diff_google']; # back links reports $report = $backlinlCtrler->__getWebsitebacklinkReport($listInfo['id'], $fromTime, $toTime); $report = $report[0]; $listInfo['google']['backlinks'] = empty($report['google']) ? "-" : $report['google'] . " " . $report['rank_diff_google']; $listInfo['alexa']['backlinks'] = empty($report['alexa']) ? "-" : $report['alexa'] . " " . $report['rank_diff_alexa']; $listInfo['msn']['backlinks'] = empty($report['msn']) ? "-" : $report['msn'] . " " . $report['rank_diff_msn']; # rank reports $report = $saturationCtrler->__getWebsiteSaturationReport($listInfo['id'], $fromTime, $toTime); $report = $report[0]; $listInfo['google']['indexed'] = empty($report['google']) ? "-" : $report['google'] . " " . $report['rank_diff_google']; $listInfo['msn']['indexed'] = empty($report['msn']) ? "-" : $report['msn'] . " " . $report['rank_diff_msn']; $listInfo['dirsub']['total'] = $dirCtrler->__getTotalSubmitInfo($listInfo['id']); $listInfo['dirsub']['active'] = $dirCtrler->__getTotalSubmitInfo($listInfo['id'], true); $websiteList[] = $listInfo; } // if export function called if ($exportVersion) { $exportContent .= createExportContent(array()); $exportContent .= createExportContent(array()); $exportContent .= createExportContent(array('', $spTextHome['Website Statistics'], '')); if (isAdmin() && !empty($webUserId)) { $exportContent .= createExportContent(array()); $exportContent .= createExportContent(array()); $userInfo = $userCtrler->__getUserInfo($webUserId); $exportContent .= createExportContent(array($_SESSION['text']['common']['User'], $userInfo['username'])); } $exportContent .= createExportContent(array()); $headList = array($_SESSION['text']['common']['Id'], $_SESSION['text']['common']['Website'], 'Google Pagerank', 'Alexa Rank', 'Google ' . $spTextHome['Backlinks'], 'alexa ' . $spTextHome['Backlinks'], 'Bing ' . $spTextHome['Backlinks'], 'Google ' . $spTextHome['Indexed'], 'Bing ' . $spTextHome['Indexed'], $_SESSION['text']['common']['Total'] . ' Submission', $_SESSION['text']['common']['Active'] . ' Submission'); $exportContent .= createExportContent($headList); foreach ($websiteList as $websiteInfo) { $valueList = array($websiteInfo['id'], $websiteInfo['url'], strip_tags($websiteInfo['googlerank']), strip_tags($websiteInfo['alexarank']), strip_tags($websiteInfo['google']['backlinks']), strip_tags($websiteInfo['alexa']['backlinks']), strip_tags($websiteInfo['msn']['backlinks']), strip_tags($websiteInfo['google']['indexed']), strip_tags($websiteInfo['msn']['indexed']), $websiteInfo['dirsub']['total'], $websiteInfo['dirsub']['active']); $exportContent .= createExportContent($valueList); } exportToCsv('website_statistics', $exportContent); } else { $this->set('websiteList', $websiteList); // if pdf export if ($searchInfo['doc_type'] == "pdf") { $fromTimeTxt = date('Y-m-d', $fromTime); $toTimeTxt = date('Y-m-d', $toTime); exportToPdf($this->getViewContent('user/userhome'), "account_summary_{$fromTimeTxt}-{$toTimeTxt}.pdf"); } else { $layout = $searchInfo['doc_type'] == "print" ? "ajax" : ""; $this->set('searchInfo', $searchInfo); $this->render('user/userhome', $layout); } } } else { $this->render('home'); } }
public function __construct() { parent::__construct(); $this->work(); }
function showOverallReportSummary($searchInfo = '', $cronUserId = false) { $spTextHome = $this->getLanguageTexts('home', $_SESSION['lang_code']); $this->set('spTextHome', $spTextHome); $this->set('cronUserId', $cronUserId); $exportVersion = false; switch ($searchInfo['doc_type']) { case "export": $exportVersion = true; $exportContent = ""; break; case "print": $this->set('printVersion', true); break; } $this->set('sectionHead', 'Overall Report Summary'); $userId = empty($cronUserId) ? isLoggedIn() : $cronUserId; $isAdmin = isAdmin(); $websiteCtrler = new WebsiteController(); $websiteList = $websiteCtrler->__getAllWebsites($userId, true); $this->set('siteList', $websiteList); $websiteId = isset($searchInfo['website_id']) ? $searchInfo['website_id'] : $websiteList[0]['id']; $websiteId = intval($websiteId); $this->set('websiteId', $websiteId); $urlarg = "website_id={$websiteId}"; $websiteUrl = ""; foreach ($websiteList as $websiteInfo) { if ($websiteInfo['id'] == $websiteId) { $websiteUrl = $websiteInfo['url']; break; } } $this->set('websiteUrl', $websiteUrl); $reportTypes = array('keyword-position' => $this->spTextTools["Keyword Position Summary"], 'website-stats' => $spTextHome["Website Statistics"]); $this->set('reportTypes', $reportTypes); $urlarg .= "&report_type=" . $searchInfo['report_type']; if (!empty($searchInfo['from_time'])) { $fromTime = strtotime($searchInfo['from_time'] . ' 00:00:00'); } else { $fromTime = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')); } if (!empty($searchInfo['to_time'])) { $toTime = strtotime($searchInfo['to_time'] . ' 00:00:00'); } else { $toTime = mktime(0, 0, 0, date('m'), date('d'), date('Y')); } $fromTimeShort = date('Y-m-d', $fromTime); $this->set('fromTime', $fromTimeShort); $toTimeShort = date('Y-m-d', $toTime); $this->set('toTime', $toTimeShort); $urlarg .= "&from_time={$fromTimeShort}&to_time={$toTimeShort}"; $seController = new SearchEngineController(); $this->seLIst = $seController->__getAllSearchEngines(); $this->set('seList', $this->seLIst); $this->set('isAdmin', $isAdmin); $this->set('urlarg', $urlarg); # keyword position report section if (empty($searchInfo['report_type']) || $searchInfo['report_type'] == 'keyword-position') { // to find order col if (!empty($searchInfo['order_col'])) { $orderCol = $searchInfo['order_col']; $orderVal = $searchInfo['order_val']; } else { $orderCol = $this->seLIst[0]['id']; $orderVal = 'ASC'; } $this->set('orderCol', $orderCol); $this->set('orderVal', $orderVal); $keywordController = new KeywordController(); $list = $keywordController->__getAllKeywords($userId, $websiteId, true, true, $orderVal); $indexList = array(); foreach ($list as $keywordInfo) { $positionInfo = $this->__getKeywordSearchReport($keywordInfo['id'], $fromTime, $toTime); // check whether the sorting search engine is there $indexList[$keywordInfo['id']] = empty($positionInfo[$orderCol]) ? 10000 : $positionInfo[$orderCol]['rank']; $keywordInfo['position_info'] = $positionInfo; $keywordList[$keywordInfo['id']] = $keywordInfo; } // sort array according the value if ($orderCol != 'keyword') { if ($orderVal == 'DESC') { arsort($indexList); } else { asort($indexList); } } $this->set('indexList', $indexList); if ($exportVersion) { $spText = $_SESSION['text']; $reportHeading = $this->spTextTools['Keyword Position Summary'] . "({$fromTimeShort} - {$toTimeShort})"; $exportContent .= createExportContent(array('', $reportHeading, '')); $exportContent .= createExportContent(array()); $headList = array($spText['common']['Website'], $spText['common']['Keyword']); foreach ($this->seLIst as $seInfo) { $headList[] = $seInfo['domain']; } $exportContent .= createExportContent($headList); foreach ($indexList as $keywordId => $rankValue) { $listInfo = $keywordList[$keywordId]; $positionInfo = $listInfo['position_info']; $valueList = array($listInfo['weburl'], $listInfo['name']); foreach ($this->seLIst as $index => $seInfo) { $rank = empty($positionInfo[$seInfo['id']]['rank']) ? '-' : $positionInfo[$seInfo['id']]['rank']; $rankDiff = empty($positionInfo[$seInfo['id']]['rank_diff']) ? '' : $positionInfo[$seInfo['id']]['rank_diff']; $valueList[] = $rank . strip_tags($rankDiff); } $exportContent .= createExportContent($valueList); } } else { $this->set('list', $keywordList); $this->set('keywordPos', true); } } # website report section if (empty($searchInfo['report_type']) || $searchInfo['report_type'] == 'website-stats') { include_once SP_CTRLPATH . "/saturationchecker.ctrl.php"; include_once SP_CTRLPATH . "/rank.ctrl.php"; include_once SP_CTRLPATH . "/backlink.ctrl.php"; include_once SP_CTRLPATH . "/directory.ctrl.php"; $rankCtrler = new RankController(); $backlinlCtrler = new BacklinkController(); $saturationCtrler = new SaturationCheckerController(); $dirCtrler = new DirectoryController(); $websiteRankList = array(); foreach ($websiteList as $listInfo) { // if only needs to show onewebsite selected if (!empty($websiteId) && $listInfo['id'] != $websiteId) { continue; } # rank reports $report = $rankCtrler->__getWebsiteRankReport($listInfo['id'], $fromTime, $toTime); $report = $report[0]; $listInfo['alexarank'] = empty($report['alexa_rank']) ? "-" : $report['alexa_rank'] . " " . $report['rank_diff_alexa']; $listInfo['googlerank'] = empty($report['google_pagerank']) ? "-" : $report['google_pagerank'] . " " . $report['rank_diff_google']; # back links reports $report = $backlinlCtrler->__getWebsitebacklinkReport($listInfo['id'], $fromTime, $toTime); $report = $report[0]; $listInfo['google']['backlinks'] = empty($report['google']) ? "-" : $report['google'] . " " . $report['rank_diff_google']; $listInfo['alexa']['backlinks'] = empty($report['alexa']) ? "-" : $report['alexa'] . " " . $report['rank_diff_alexa']; $listInfo['msn']['backlinks'] = empty($report['msn']) ? "-" : $report['msn'] . " " . $report['rank_diff_msn']; # rank reports $report = $saturationCtrler->__getWebsiteSaturationReport($listInfo['id'], $fromTime, $toTime); $report = $report[0]; $listInfo['google']['indexed'] = empty($report['google']) ? "-" : $report['google'] . " " . $report['rank_diff_google']; $listInfo['msn']['indexed'] = empty($report['msn']) ? "-" : $report['msn'] . " " . $report['rank_diff_msn']; $listInfo['dirsub']['total'] = $dirCtrler->__getTotalSubmitInfo($listInfo['id']); $listInfo['dirsub']['active'] = $dirCtrler->__getTotalSubmitInfo($listInfo['id'], true); $websiteRankList[] = $listInfo; } // if export function called if ($exportVersion) { $exportContent .= createExportContent(array()); $exportContent .= createExportContent(array()); $exportContent .= createExportContent(array('', $spTextHome['Website Statistics'] . "({$fromTimeShort} - {$toTimeShort})", '')); if (isAdmin() && !empty($webUserId)) { $exportContent .= createExportContent(array()); $exportContent .= createExportContent(array()); $userInfo = $userCtrler->__getUserInfo($webUserId); $exportContent .= createExportContent(array($_SESSION['text']['common']['User'], $userInfo['username'])); } $exportContent .= createExportContent(array()); $headList = array($_SESSION['text']['common']['Id'], $_SESSION['text']['common']['Website'], 'Google Pagerank', 'Alexa Rank', 'Google ' . $spTextHome['Backlinks'], 'alexa ' . $spTextHome['Backlinks'], 'Bing ' . $spTextHome['Backlinks'], 'Google ' . $spTextHome['Indexed'], 'Bing ' . $spTextHome['Indexed'], $_SESSION['text']['common']['Total'] . ' Submission', $_SESSION['text']['common']['Active'] . ' Submission'); $exportContent .= createExportContent($headList); foreach ($websiteRankList as $websiteInfo) { $valueList = array($websiteInfo['id'], $websiteInfo['url'], strip_tags($websiteInfo['googlerank']), strip_tags($websiteInfo['alexarank']), strip_tags($websiteInfo['google']['backlinks']), strip_tags($websiteInfo['alexa']['backlinks']), strip_tags($websiteInfo['msn']['backlinks']), strip_tags($websiteInfo['google']['indexed']), strip_tags($websiteInfo['msn']['indexed']), $websiteInfo['dirsub']['total'], $websiteInfo['dirsub']['active']); $exportContent .= createExportContent($valueList); } } else { $this->set('websiteRankList', $websiteRankList); $this->set('websiteStats', true); } } if ($exportVersion) { exportToCsv('archived_report', $exportContent); } else { $this->set('searchInfo', $searchInfo); // if execution through cron job then just return teh content to send through mail if (!empty($cronUserId)) { return $this->getViewContent('report/archive'); } else { $this->render('report/archive'); } } }
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; }
function index($searchInfo = '') { $spTextHome = $this->getLanguageTexts('home', $_SESSION['lang_code']); $this->set('spTextHome', $spTextHome); if (isLoggedIn()) { $userId = isLoggedIn(); $exportVersion = false; switch ($searchInfo['doc_type']) { case "export": $exportVersion = true; $exportContent = ""; break; case "print": $this->set('printVersion', true); break; } $websiteCtrler = new WebsiteController(); $list = $websiteCtrler->__getAllWebsites($userId, true); include_once SP_CTRLPATH . "/saturationchecker.ctrl.php"; include_once SP_CTRLPATH . "/rank.ctrl.php"; include_once SP_CTRLPATH . "/backlink.ctrl.php"; $rankCtrler = new RankController(); $backlinlCtrler = new BacklinkController(); $saturationCtrler = new SaturationCheckerController(); $dirCtrler = new DirectoryController(); $websiteList = array(); foreach ($list as $listInfo) { # rank reports $report = $rankCtrler->__getWebsiteRankReport($listInfo['id']); $report = $report[0]; $listInfo['alexarank'] = empty($report['alexa_rank']) ? "-" : $report['alexa_rank'] . " " . $report['rank_diff_alexa']; $listInfo['googlerank'] = empty($report['google_pagerank']) ? "-" : $report['google_pagerank'] . " " . $report['rank_diff_google']; # back links reports $report = $backlinlCtrler->__getWebsitebacklinkReport($listInfo['id']); $report = $report[0]; $listInfo['google']['backlinks'] = empty($report['google']) ? "-" : $report['google'] . " " . $report['rank_diff_google']; $listInfo['yahoo']['backlinks'] = empty($report['yahoo']) ? "-" : $report['yahoo'] . " " . $report['rank_diff_yahoo']; $listInfo['msn']['backlinks'] = empty($report['msn']) ? "-" : $report['msn'] . " " . $report['rank_diff_msn']; $listInfo['altavista']['backlinks'] = empty($report['altavista']) ? "-" : $report['altavista'] . " " . $report['rank_diff_altavista']; $listInfo['alltheweb']['backlinks'] = empty($report['alltheweb']) ? "-" : $report['alltheweb'] . " " . $report['rank_diff_alltheweb']; # rank reports $report = $saturationCtrler->__getWebsiteSaturationReport($listInfo['id']); $report = $report[0]; $listInfo['google']['indexed'] = empty($report['google']) ? "-" : $report['google'] . " " . $report['rank_diff_google']; $listInfo['yahoo']['indexed'] = empty($report['yahoo']) ? "-" : $report['yahoo'] . " " . $report['rank_diff_yahoo']; $listInfo['msn']['indexed'] = empty($report['msn']) ? "-" : $report['msn'] . " " . $report['rank_diff_msn']; $listInfo['dirsub']['total'] = $dirCtrler->__getTotalSubmitInfo($listInfo['id']); $listInfo['dirsub']['active'] = $dirCtrler->__getTotalSubmitInfo($listInfo['id'], true); $websiteList[] = $listInfo; } if ($exportVersion) { $exportContent .= createExportContent(array()); $exportContent .= createExportContent(array()); $exportContent .= createExportContent(array('', $spTextHome['Website Statistics'], '')); $exportContent .= createExportContent(array()); $headList = array('Id', 'Website', 'Google Pagerank', 'Alexa Rank', 'Google Backlinks', 'Yahoo Backlinks', 'MSN Backlinks', 'Altavista Backlinks', 'Alltheweb Backlinks', 'Google Indexed', 'Yahoo Indexed', 'MSN Indexed', 'Total Submission', 'Active Submission'); $exportContent .= createExportContent($headList); foreach ($websiteList as $websiteInfo) { $valueList = array($websiteInfo['id'], $websiteInfo['url'], strip_tags($websiteInfo['googlerank']), strip_tags($websiteInfo['alexarank']), strip_tags($websiteInfo['google']['backlinks']), strip_tags($websiteInfo['yahoo']['backlinks']), strip_tags($websiteInfo['msn']['backlinks']), strip_tags($websiteInfo['altavista']['backlinks']), strip_tags($websiteInfo['alltheweb']['backlinks']), strip_tags($websiteInfo['google']['indexed']), strip_tags($websiteInfo['yahoo']['indexed']), strip_tags($websiteInfo['msn']['indexed']), $websiteInfo['dirsub']['total'], $websiteInfo['dirsub']['active']); $exportContent .= createExportContent($valueList); } exportToCsv('website_statistics', $exportContent); } else { $this->set('websiteList', $websiteList); $layout = $searchInfo['doc_type'] == "print" ? "ajax" : ""; $this->render('user/userhome', $layout); } } else { $this->render('home'); } }
function __deleteUser($userId) { $userId = intval($userId); $sql = "delete from users where id={$userId}"; $this->db->query($sql); $sql = "select id from websites where user_id={$userId}"; $webisteList = $this->db->select($sql); $webisteCtrler = new WebsiteController(); foreach ($webisteList as $webisteInfo) { $webisteCtrler->__deleteWebsite($webisteInfo['id']); } }
function updateProject($listInfo) { $userId = isLoggedIn(); $listInfo['website_id'] = intval($listInfo['website_id']); $listInfo['max_links'] = intval($listInfo['max_links']); $this->set('post', $listInfo); $errMsg['website_id'] = formatErrorMsg($this->validate->checkBlank($listInfo['website_id'])); $errMsg['max_links'] = formatErrorMsg($this->validate->checkNumber($listInfo['max_links'])); if (!$this->validate->flagErr) { $errorFlag = 0; if ($listInfo['max_links'] > SA_MAX_NO_PAGES) { $errorFlag = 1; $errMsg['max_links'] = formatErrorMsg($this->spTextSA["Number of pages is greater than"] . " " . SA_MAX_NO_PAGES); } if ($listInfo['max_links'] <= 0) { $errorFlag = 1; $errMsg['max_links'] = formatErrorMsg($this->spTextSA["Number of pages should be greater than"] . " 0"); } $webCtrler = new WebsiteController(); $websiteInfo = $webCtrler->__getWebsiteInfo($listInfo['website_id']); $excludeInfo = $this->checkExcludeLinks($listInfo['exclude_links'], $websiteInfo['url']); if (!empty($excludeInfo['err_msg'])) { $errorFlag = 1; $errMsg['exclude_links'] = formatErrorMsg($excludeInfo['err_msg']); } $listInfo['exclude_links'] = $excludeInfo['exclude_links']; if (!$errorFlag) { if (!$this->isProjectExists($listInfo['website_id'], $listInfo['id'])) { $sql = "Update auditorprojects set\r\n \t\t\t\t\t\twebsite_id={$listInfo['website_id']},\r\n \t\t\t\t\t\tmax_links={$listInfo['max_links']},\r\n \t\t\t\t\t\tcheck_pr=" . intval($listInfo['check_pr']) . ",\r\n \t\t\t\t\t\tcheck_backlinks=" . intval($listInfo['check_backlinks']) . ",\r\n \t\t\t\t\t\tcheck_indexed=" . intval($listInfo['check_indexed']) . ",\r\n \t\t\t\t\t\tstore_links_in_page=" . intval($listInfo['store_links_in_page']) . ",\r\n \t\t\t\t\t\tcheck_brocken='" . intval($listInfo['check_brocken']) . "',\r\n \t\t\t\t\t\tcron='" . intval($listInfo['cron']) . "',\r\n \t\t\t\t\t\texclude_links='" . addslashes($listInfo['exclude_links']) . "'\r\n \t\t\t\t\t\twhere id=" . $listInfo['id']; $this->db->query($sql); $this->showAuditorProjects(); exit; } else { $errMsg['website_id'] = formatErrorMsg($this->spTextSA['projectalreadyexist']); } } } $this->set('errMsg', $errMsg); $this->editProject($listInfo['id'], $listInfo); }
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'); }
/** * function to get keyword report using user id * @param Array $info The input details to process the api * $info['id'] The id of the user - Mandatory * $info['from_time'] The from time of report in (yyyy-mm-dd) Eg: 2014-12-24 - Optional - (default => Yesterday) * $info['to_time'] The to time of report in (yyyy-mm-dd) Eg: 2014-12-28 - Optional - (default => Today) * @return Array $returnInfo Contains informations about keyword reports */ function getReportByUserId($info) { $userId = intval($info['id']); if (empty($userId)) { return array('response' => 'Error', 'result' => 'Invalid user id'); } $fromTime = getFromTime($info); $toTime = getToTime($info); // get all active websites $websiteController = new WebsiteController(); $websiteList = $websiteController->__getAllWebsitesWithActiveKeywords($userId, true); // loop through websites $keywordList = array(); foreach ($websiteList as $websiteInfo) { $websiteId = $websiteInfo['id']; $list = $this->ctrler->__getAllKeywords('', $websiteId); // loop through keywords foreach ($list as $keywordInfo) { $keywordList[$keywordInfo['id']] = $this->getFormattedReport($keywordInfo, $fromTime, $toTime); } } // if position information is not empty if (empty($keywordList)) { $returnInfo['response'] = 'Error'; $returnInfo['result'] = "No reports found!"; } else { $returnInfo['response'] = 'success'; $returnInfo['result'] = $keywordList; } return $returnInfo; }
* * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ include_once "includes/sp-load.php"; checkLoggedIn(); include_once SP_CTRLPATH . "/website.ctrl.php"; include_once SP_CTRLPATH . "/keyword.ctrl.php"; $controller = new WebsiteController(); $controller->view->menu = 'seotools'; $controller->layout = 'ajax'; $controller->set('sectionHead', 'Websites'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { switch ($_POST['sec']) { case "create": $controller->createWebsite($_POST); break; case "update": $controller->updateWebsite($_POST); break; } } else { switch ($_GET['sec']) { case "Activate":
public function __construct() { parent::__construct(); Debug::write("Executing Index work() method...", 1); $this->work(); }