function __deleteWebsite($websiteId)
 {
     $websiteId = intval($websiteId);
     $sql = "delete from websites where id={$websiteId}";
     $this->db->query($sql);
     # delete all keywords under this website
     $sql = "select id from keywords where website_id={$websiteId}";
     $keywordList = $this->db->select($sql);
     $keywordCtrler = new KeywordController();
     foreach ($keywordList as $keywordInfo) {
         $keywordCtrler->__deleteKeyword($keywordInfo['id']);
     }
 }
Exemple #2
0
 *   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 . "/keyword.ctrl.php";
include_once SP_CTRLPATH . "/website.ctrl.php";
#include_once(SP_CTRLPATH."/language.ctrl.php");
include_once SP_CTRLPATH . "/searchengine.ctrl.php";
$controller = new KeywordController();
$controller->view->menu = 'seotools';
$controller->layout = 'ajax';
$controller->set('spTextTools', $controller->getLanguageTexts('seotools', $_SESSION['lang_code']));
$controller->spTextKeyword = $controller->getLanguageTexts('keyword', $_SESSION['lang_code']);
$controller->set('spTextKeyword', $controller->spTextKeyword);
$userId = isLoggedIn();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        case "create":
            $controller->createKeyword($_POST);
            break;
        case "update":
            $controller->updateKeyword($_POST);
            break;
        case "import":
 function __deleteWebsite($websiteId)
 {
     $websiteId = intval($websiteId);
     $sql = "delete from websites where id={$websiteId}";
     $this->db->query($sql);
     # delete all keywords under this website
     $sql = "select id from keywords where website_id={$websiteId}";
     $keywordList = $this->db->select($sql);
     $keywordCtrler = new KeywordController();
     foreach ($keywordList as $keywordInfo) {
         $keywordCtrler->__deleteKeyword($keywordInfo['id']);
     }
     # remove rank results
     $sql = "delete from rankresults where website_id={$websiteId}";
     $this->db->query($sql);
     # remove backlink results
     $sql = "delete from backlinkresults where website_id={$websiteId}";
     $this->db->query($sql);
     # remove saturation results
     $sql = "delete from saturationresults where website_id={$websiteId}";
     $this->db->query($sql);
     # remove site auditor results
     $sql = "select id from auditorprojects where website_id={$websiteId}";
     $info = $this->db->select($sql, true);
     if (!empty($info['id'])) {
         $auditorObj = $this->createController('SiteAuditor');
         $auditorObj->__deleteProject($info['id']);
     }
     #remove directory results
     $sql = "delete from dirsubmitinfo where website_id={$websiteId}";
     $this->db->query($sql);
     $sql = "delete from skipdirectories where website_id={$websiteId}";
     $this->db->query($sql);
 }
 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 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');
 }
Exemple #6
0
 *   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 . "/keyword.ctrl.php";
include_once SP_CTRLPATH . "/website.ctrl.php";
#include_once(SP_CTRLPATH."/language.ctrl.php");
include_once SP_CTRLPATH . "/searchengine.ctrl.php";
$controller = new KeywordController();
$controller->view->menu = 'seotools';
$controller->layout = 'ajax';
$controller->set('sectionHead', 'Keywords');
$userId = isLoggedIn();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        case "create":
            $controller->createKeyword($_POST);
            break;
        case "update":
            $controller->updateKeyword($_POST);
            break;
    }
} else {
    switch ($_GET['sec']) {