Subversion Repositories cheapmusic

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
<?php
2
 
3
/***************************************************************************
4
 *   Copyright (C) 2009-2011 by Geo Varghese(www.seofreetools.net)  	   *
5
 *   sendtogeo@gmail.com   												   *
6
 *                                                                         *
7
 *   This program is free software; you can redistribute it and/or modify  *
8
 *   it under the terms of the GNU General Public License as published by  *
9
 *   the Free Software Foundation; either version 2 of the License, or     *
10
 *   (at your option) any later version.                                   *
11
 *                                                                         *
12
 *   This program is distributed in the hope that it will be useful,       *
13
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15
 *   GNU General Public License for more details.                          *
16
 *                                                                         *
17
 *   You should have received a copy of the GNU General Public License     *
18
 *   along with this program; if not, write to the                         *
19
 *   Free Software Foundation, Inc.,                                       *
20
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
21
 ***************************************************************************/
22
 
23
if(!empty($_SERVER['REQUEST_METHOD'])){
24
 
25
	# to section to generate report from admin area
26
	include_once("includes/sp-load.php");
27
	checkAdminLoggedIn();
28
	include_once(SP_CTRLPATH."/cron.ctrl.php");
29
    include_once(SP_CTRLPATH."/moz.ctrl.php");
30
	$controller = New CronController();
31
	$controller->timeStamp = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
32
	$controller->set('spTextTools', $controller->getLanguageTexts('seotools', $_SESSION['lang_code']));
33
	$controller->set('spTextPanel', $controller->getLanguageTexts('panel', $_SESSION['lang_code']));
34
	$controller->spTextKeyword = $controller->getLanguageTexts('keyword', $_SESSION['lang_code']);
35
	$controller->set('spTextKeyword', $controller->spTextKeyword);
36
 
37
	if($_SERVER['REQUEST_METHOD'] == 'POST'){
38
 
39
		switch($_POST['sec']){
40
 
41
			case "generate":
42
				$controller->executeReportGenerationScript($_POST);
43
				break;
44
		}
45
 
46
	}else{
47
 
48
		switch($_GET['sec']){
49
 
50
			case "generate":
51
				$controller->routeCronJob($_GET['website_id'], $_GET['repTools']);
52
				break;
53
 
54
			case "croncommand":
55
				$controller->showCronCommand();
56
				break;
57
 
58
			default:
59
				$controller->showReportGenerationManager();
60
				break;
61
		}
62
	}
63
 
64
}else{
65
 
66
	# the section for generate reports using system cron job
67
	include_once("includes/sp-load.php");
68
	include_once(SP_CTRLPATH."/cron.ctrl.php");
69
	include_once(SP_CTRLPATH."/report.ctrl.php");
70
    include_once(SP_CTRLPATH."/searchengine.ctrl.php");
71
    include_once(SP_CTRLPATH."/keyword.ctrl.php");
72
    include_once(SP_CTRLPATH."/moz.ctrl.php");
73
    include_once(SP_CTRLPATH."/webmaster.ctrl.php");
74
    include_once(SP_CTRLPATH."/social_media.ctrl.php");
75
    include_once(SP_CTRLPATH."/review_manager.ctrl.php");
76
    include_once(SP_CTRLPATH."/analytics.ctrl.php");
77
	$controller = New CronController();
78
	$controller->timeStamp = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
79
 
80
	$includeList = array();
81
	$userList = array();
82
 
83
	// check whether user is passed with script as argument
84
	if (!empty($argv[1])) {
85
		$userId = intval($argv[1]);
86
		$userCtrler = new UserController();
87
		$userInfo = $userCtrler->__getUserInfo($userId);
88
		$userList[] = $userInfo;
89
 
90
		// check whether seo tools id passed with the script as second argument
91
		if (!empty($argv[2])) {
92
			$includeList[] = intval($argv[2]);
93
		}
94
 
95
	}
96
 
97
	// call cronjob function
98
	echo "\n\n=== Cron job execution started on - " . date("Y-m-d H:i:s") . " ===\n";
99
 
100
	// sync search engines
101
	$seCtrler = new SearchEngineController();
102
	$ret_sync = $seCtrler->doSyncSearchEngines(true, true);
103
	echo $ret_sync['result'] . "\n";
104
 
105
	$controller->executeCron($includeList, $userList);
106
	echo "\n=== Cron job execution completed on - " . date("Y-m-d H:i:s") . " ===\n\n";
107
 
108
	// delete crawl logs before 2 months
109
	include_once(SP_CTRLPATH."/crawllog.ctrl.php");
110
	$crawlLog = new CrawlLogController();
111
	$crawlLog->clearCrawlLog(SP_CRAWL_LOG_CLEAR_TIME);
112
	echo "Clearing crawl logs before " . SP_CRAWL_LOG_CLEAR_TIME . " days";
113
 
114
}
115
?>