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 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');
 }
Exemple #3
0
 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 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 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 submitSite($submitInfo)
 {
     $submitInfo['dir_id'] = intval($submitInfo['dir_id']);
     $submitInfo['website_id'] = intval($submitInfo['website_id']);
     $dirInfo = $this->__getDirectoryInfo($submitInfo['dir_id']);
     $websiteController = new WebsiteController();
     $websiteInfo = $websiteController->__getWebsiteInfo($submitInfo['website_id']);
     $websiteInfo = $this->__getSubmitTitleDes($websiteInfo);
     $postData = $dirInfo['title_col'] . "=" . $websiteInfo['title'];
     $postData .= "&" . $dirInfo['url_col'] . "=" . $websiteInfo['url'];
     $postData .= "&" . $dirInfo['description_col'] . "=" . $websiteInfo['description'];
     $postData .= "&" . $dirInfo['name_col'] . "=" . $websiteInfo['owner_name'];
     $postData .= "&" . $dirInfo['email_col'] . "=" . $websiteInfo['owner_email'];
     $postData .= "&" . $dirInfo['category_col'] . "=" . $submitInfo[$dirInfo['category_col']];
     $postData .= "&" . $dirInfo['cptcha_col'] . "=" . $submitInfo[$dirInfo['cptcha_col']];
     if (!empty($submitInfo[$dirInfo['imagehash_col']])) {
         $postData .= "&" . $dirInfo['imagehash_col'] . "=" . $submitInfo[$dirInfo['imagehash_col']];
     }
     // check for reciprocal link
     if (!empty($submitInfo['reciprocal_url'])) {
         $reciprocalUrl = addHttpToUrl($submitInfo['reciprocal_url']);
         $scriptInfo = $this->getDirectoryScriptMetaInfo($dirInfo['script_type_id']);
         $dirInfo['extra_val'] = preg_replace("/&{$scriptInfo['reciprocal_col']}=(.*)/", "&{$scriptInfo['reciprocal_col']}={$reciprocalUrl}", $dirInfo['extra_val']);
     }
     $postData .= "&" . $dirInfo['extra_val'];
     $spider = new Spider();
     $spider->_CURLOPT_POSTFIELDS = $postData;
     $spider->_CURLOPT_REFERER = $dirInfo['submit_url'];
     if (!empty($submitInfo['phpsessid'])) {
         $spider->_CURLOPT_COOKIE = 'PHPSESSID=' . $submitInfo['phpsessid'] . '; path=/';
     }
     $ret = $spider->getContent($dirInfo['submit_url']);
     if ($ret['error']) {
         $this->set('error', 1);
         $this->set('msg', $ret['errmsg']);
     } else {
         $page = $ret['page'];
         // if(SP_DEBUG) $this->logSubmissionResult($page, $submitInfo['dir_id'], $submitInfo['website_id']);
         if (preg_match('/<td.*?class="msg".*?>(.*?)<\\/td>/is', $page, $matches)) {
             $this->set('msg', $matches[1]);
             $status = 1;
             // to update the rank of directory
             $sql = "update directories set rank=rank+1 where id=" . $submitInfo['dir_id'];
             $this->db->query($sql);
         } else {
             $status = 0;
             $this->set('msg', $this->spTextDir['nosuccessnote']);
         }
         $sql = "select id from dirsubmitinfo where website_id={$submitInfo['website_id']} and directory_id={$submitInfo['dir_id']}";
         $subInfo = $this->db->select($sql);
         if (empty($subInfo[0][id])) {
             $sql = "insert into dirsubmitinfo(website_id,directory_id,status,submit_time) values({$submitInfo['website_id']}, {$submitInfo['dir_id']}, {$status}," . mktime() . ")";
         } else {
             $sql = "update dirsubmitinfo set status={$status},submit_time=" . mktime() . " where id={$subInfo[0][id]}";
         }
         $this->db->query($sql);
     }
     $this->render('directory/showsubmissionstats');
     $this->set('error', 0);
     $this->set('msg', '');
     $this->startSubmission($submitInfo['website_id']);
 }
Exemple #7
0
            $controller->__changeStatus($_GET['websiteId'], 1);
            $controller->listWebsites($_GET);
            break;
        case "Inactivate":
            $controller->__changeStatus($_GET['websiteId'], 0);
            $controller->listWebsites($_GET);
            break;
        case "delete":
            $controller->__deleteWebsite($_GET['websiteId']);
            $controller->listWebsites($_GET);
            break;
        case "edit":
            $controller->editWebsite($_GET['websiteId']);
            break;
        case "new":
            $controller->newWebsite($_GET);
            break;
        case "crawlmeta":
            $keyInput = empty($_GET['keyinput']) ? "" : $_GET['keyinput'];
            $controller->crawlMetaData(urldecode($_GET['url']), $keyInput);
            break;
        case "updateurl":
            $websiteId = intval($_GET['website_id']);
            $websiteInfo = $controller->__getWebsiteInfo($websiteId);
            print '<input type="hidden" name="weburl" id="weburl" value="' . $websiteInfo['url'] . '">';
            break;
        default:
            $controller->listWebsites($_GET);
            break;
    }
}
 function submitSite($submitInfo)
 {
     $dirInfo = $this->__getDirectoryInfo($submitInfo['dir_id']);
     $websiteController = new WebsiteController();
     $websiteInfo = $websiteController->__getWebsiteInfo($submitInfo['website_id']);
     $websiteInfo = $this->__getSubmitTitleDes($websiteInfo);
     $postData = $dirInfo['title_col'] . "=" . $websiteInfo['title'];
     $postData .= "&" . $dirInfo['url_col'] . "=" . $websiteInfo['url'];
     $postData .= "&" . $dirInfo['description_col'] . "=" . $websiteInfo['description'];
     $postData .= "&" . $dirInfo['name_col'] . "=" . $websiteInfo['owner_name'];
     $postData .= "&" . $dirInfo['email_col'] . "=" . $websiteInfo['owner_email'];
     $postData .= "&" . $dirInfo['category_col'] . "=" . $submitInfo[$dirInfo['category_col']];
     $postData .= "&" . $dirInfo['cptcha_col'] . "=" . $submitInfo[$dirInfo['cptcha_col']];
     if (!empty($submitInfo[$dirInfo['imagehash_col']])) {
         $postData .= "&" . $dirInfo['imagehash_col'] . "=" . $submitInfo[$dirInfo['imagehash_col']];
     }
     $postData .= "&" . $dirInfo['extra_val'];
     $spider = new Spider();
     $spider->_CURLOPT_POSTFIELDS = $postData;
     $spider->_CURLOPT_REFERER = $dirInfo['submit_url'];
     if (!empty($submitInfo['phpsessid'])) {
         $spider->_CURLOPT_COOKIE = 'PHPSESSID=' . $submitInfo['phpsessid'] . '; path=/';
     }
     $ret = $spider->getContent($dirInfo['submit_url']);
     if ($ret['error']) {
         $this->set('error', 1);
         $this->set('msg', $ret['errmsg']);
     } else {
         $page = $ret['page'];
         if (preg_match('/<td.*?class="msg".*?>(.*?)<\\/td>/is', $page, $matches)) {
             $this->set('msg', $matches[1]);
             $status = 1;
         } else {
             $status = 0;
             $this->set('msg', "Didn't get success message, Please check your mail to find the confirm message");
         }
         $sql = "select id from dirsubmitinfo where website_id={$submitInfo['website_id']} and directory_id={$submitInfo['dir_id']}";
         $subInfo = $this->db->select($sql);
         if (empty($subInfo[0][id])) {
             $sql = "insert into dirsubmitinfo(website_id,directory_id,status,submit_time) values({$submitInfo['website_id']}, {$submitInfo['dir_id']}, {$status}," . mktime() . ")";
         } else {
             $sql = "update dirsubmitinfo set status={$status},submit_time=" . mktime() . " where id={$subInfo[0][id]}";
         }
         $this->db->query($sql);
     }
     $this->render('directory/showsubmissionstats');
     $this->set('error', 0);
     $this->set('msg', '');
     $this->startSubmission($submitInfo['website_id']);
 }
 function submitSite($submitInfo)
 {
     $submitInfo['dir_id'] = intval($submitInfo['dir_id']);
     $submitInfo['website_id'] = intval($submitInfo['website_id']);
     $dirInfo = $this->__getDirectoryInfo($submitInfo['dir_id']);
     $websiteController = new WebsiteController();
     $websiteInfo = $websiteController->__getWebsiteInfo($submitInfo['website_id']);
     $websiteInfo = $this->__getSubmitTitleDes($websiteInfo);
     $postData = $dirInfo['title_col'] . "=" . $websiteInfo['title'];
     $postData .= "&" . $dirInfo['url_col'] . "=" . $websiteInfo['url'];
     $postData .= "&" . $dirInfo['description_col'] . "=" . $websiteInfo['description'];
     $postData .= "&" . $dirInfo['name_col'] . "=" . $websiteInfo['owner_name'];
     $postData .= "&" . $dirInfo['email_col'] . "=" . $websiteInfo['owner_email'];
     $postData .= "&" . $dirInfo['category_col'] . "=" . $submitInfo[$dirInfo['category_col']];
     $postData .= "&" . $dirInfo['cptcha_col'] . "=" . $submitInfo[$dirInfo['cptcha_col']];
     $postData .= $submitInfo['add_params'];
     // check image hash there
     if (!empty($submitInfo[$dirInfo['imagehash_col']])) {
         $postData .= "&" . $dirInfo['imagehash_col'] . "=" . $submitInfo[$dirInfo['imagehash_col']];
     }
     // check for reciprocal link
     $scriptInfo = $this->getDirectoryScriptMetaInfo($dirInfo['script_type_id']);
     if (!empty($submitInfo['reciprocal_url'])) {
         // if extra values contain the reciprocal col name
         $reciprocalUrl = addHttpToUrl($submitInfo['reciprocal_url']);
         if (stristr($dirInfo['extra_val'], $scriptInfo['reciprocal_col'])) {
             $dirInfo['extra_val'] = preg_replace("/&{$scriptInfo['reciprocal_col']}=(.*)/", "&{$scriptInfo['reciprocal_col']}={$reciprocalUrl}", $dirInfo['extra_val']);
         } else {
             $postData .= "&" . $dirInfo['reciprocal_col'] . "={$reciprocalUrl}";
         }
     }
     $postData .= "&" . $dirInfo['extra_val'];
     // check phpLD directory. Then add extra values
     if ($scriptInfo['name'] == 'phpLD') {
         $postData .= "&OWNER_NEWSLETTER_ALLOW=on&META_KEYWORDS={$websiteInfo['keywords']}\r\n\t\t\t&META_DESCRIPTION=" . substr($websiteInfo['description'], 0, 249) . "&META_DESCRIPTION_limit=250&formSubmitted=1";
     }
     $spider = new Spider();
     $spider->_CURLOPT_POSTFIELDS = $postData;
     $spider->_CURLOPT_REFERER = $dirInfo['submit_url'];
     if (!empty($submitInfo['phpsessid'])) {
         $spider->_CURLOPT_COOKIE = 'PHPSESSID=' . $submitInfo['phpsessid'] . '; path=/';
     }
     $ret = $spider->getContent($dirInfo['submit_url']);
     if ($ret['error']) {
         $this->set('error', 1);
         $this->set('msg', $ret['errmsg']);
     } else {
         $page = $ret['page'];
         if (SP_DEBUG) {
             $this->logSubmissionResult($page, $submitInfo['dir_id'], $submitInfo['website_id']);
         }
         // check success messages
         if (preg_match('/<td.*?class="msg".*?>(.*?)<\\/td>/is', $page, $matches)) {
         } elseif (preg_match('/<p.*?class="box success".*?>(.*?)<\\/p>/is', $page, $matches)) {
         } else {
             $status = 0;
             $this->set('msg', $this->spTextDir['nosuccessnote']);
         }
         // if $matches[1] is not empty
         if (!empty($matches[1])) {
             $this->set('msg', $matches[1]);
             $status = 1;
             // to update the rank of directory
             $sql = "update directories set rank=rank+1 where id=" . $submitInfo['dir_id'];
             $this->db->query($sql);
         }
         $sql = "select id from dirsubmitinfo where website_id={$submitInfo['website_id']} and directory_id={$submitInfo['dir_id']}";
         $subInfo = $this->db->select($sql);
         if (empty($subInfo[0][id])) {
             $sql = "insert into dirsubmitinfo(website_id,directory_id,status,submit_time) values({$submitInfo['website_id']}, {$submitInfo['dir_id']}, {$status}," . mktime() . ")";
         } else {
             $sql = "update dirsubmitinfo set status={$status},submit_time=" . mktime() . " where id={$subInfo[0][id]}";
         }
         $this->db->query($sql);
     }
     $this->render('directory/showsubmissionstats');
     $this->set('error', 0);
     $this->set('msg', '');
     $this->startSubmission($submitInfo['website_id']);
 }