Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some problem #137

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion controllers/googleapi.ctrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GoogleAPIController extends Controller{
/*
* contructor
*/
function GoogleAPIController() {
function __construct() {
parent::__construct();
$this->tokenCtrler = new UserTokenController();
}
Expand Down
21 changes: 12 additions & 9 deletions controllers/report.ctrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,8 @@ function generateReports( $searchInfo='' ) {
if(empty($this->seFound)){
echo "<p class='note notefailed'>".$_SESSION['text']['common']['Keyword']." <b>{$keywordInfo['name']}</b> ".$this->spTextKeyword['not assigned to required search engines']."........</p>";
}
sleep(SP_CRAWL_DELAY);
}
sleep(SP_CRAWL_DELAY);
}
}

# function to format pagecontent
Expand Down Expand Up @@ -804,7 +804,7 @@ function crawlKeyword( $keywordInfo, $seId='', $cron=false, $removeDuplicate=tru

}

return $crawlResult;
return $crawlResult;
}

# func to save the report
Expand Down Expand Up @@ -1247,7 +1247,10 @@ function showOverallReportSummary($searchInfo='', $cronUserId=false) {

# website search report section
if (empty($searchInfo['report_type']) || in_array($searchInfo['report_type'], array('social-media-reports', 'website-search-reports', 'keyword-search-reports', 'sitemap-reports')) ) {
$webMasterCtrler = new WebMasterController();

include_once(SP_CTRLPATH."/social_media.ctrl.php");

$webMasterCtrler = new WebMasterController();
$socialMediaCtrler = New SocialMediaController();
$webMasterCtrler->set('spTextTools', $this->spTextTools);
$webMasterCtrler->spTextTools = $this->spTextTools;
Expand Down Expand Up @@ -1357,7 +1360,7 @@ function updateUserReportSetting($userId, $col, $val) {
function updateUserReportGenerationLogs($userId, $generateDate) {
$dataList = array(
'user_id|int' => $userId,
'report_date' => $generateDate,
'report_date' => $generateDate,
);

$this->dbHelper->insertRow("user_report_logs", $dataList);
Expand Down Expand Up @@ -1419,11 +1422,11 @@ function isGenerateReportsForUser($userId) {
// if monthly interval generate on first of each month
if ($repSetInfo['report_interval'] == 30) {
$genReport = (date('d') == 1) ? true : false;
} else {
} else {
$nextGenTime = $lastGeneratedTime + ( $repSetInfo['report_interval'] * 86400);
$genReport = (mktime() > $nextGenTime) ? true : false;
}
}
$genReport = (time() > $nextGenTime) ? true : false;
}
}
}
$repSetInfo['generate_report'] = $genReport;
return $repSetInfo;
Expand Down
4 changes: 2 additions & 2 deletions controllers/user-type.ctrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class UserTypeController extends Controller {
/**
* constructor
*/
function UserTypeController() {
function __construct() {

// call parent constructor
parent::__construct();

Expand Down
2 changes: 1 addition & 1 deletion controllers/webmaster.ctrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class WebMasterController extends GoogleAPIController {
var $sourceList = array('google');
var $colList = array();

function WebMasterController() {
function __construct() {
parent::__construct();

$this->spTextWB = $this->getLanguageTexts('webmaster', $_SESSION['lang_code']);
Expand Down
5 changes: 3 additions & 2 deletions controllers/website.ctrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
class WebsiteController extends Controller{

# func to show websites
function listWebsites($info=''){
function listWebsites($info=''){

$userId = isLoggedIn();
$userId = isLoggedIn();
if( isset($info['pageno']) ) {} else { $info['pageno'] = 0; }
$info['pageno'] = intval($info['pageno']);
$pageScriptPath = 'websites.php?stscheck=';
$pageScriptPath .= isset($info['stscheck']) ? $info['stscheck'] : "select";
Expand Down
15 changes: 6 additions & 9 deletions libs/captcha.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,8 @@ class PhpCaptcha {
var $bUseColour;
var $sFileType;
var $sCode = '';

function PhpCaptcha(
$aFonts, // array of TrueType fonts to use - specify full path
$iWidth = CAPTCHA_WIDTH, // width of image
$iHeight = CAPTCHA_HEIGHT // height of image
) {

function __construct($aFonts,$iWidth = CAPTCHA_WIDTH,$iHeight = CAPTCHA_HEIGHT) {
// get parameters
$this->aFonts = $aFonts;
$this->SetNumChars(CAPTCHA_NUM_CHARS);
Expand Down Expand Up @@ -476,15 +472,16 @@ function Create() {
@unlink("$this->sAudioPath$sFile.wav");
}
}

// example sub class
class PhpCaptchaColour extends PhpCaptcha {
function PhpCaptchaColour($aFonts, $iWidth = CAPTCHA_WIDTH, $iHeight = CAPTCHA_HEIGHT) {
function __construct($aFonts, $iWidth = CAPTCHA_WIDTH, $iHeight = CAPTCHA_HEIGHT) {
// call parent constructor
parent::PhpCaptcha($aFonts, $iWidth, $iHeight);

// set options
$this->UseColour(true);
}
}
?>

?>
4 changes: 2 additions & 2 deletions libs/controller.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class Controller extends Seopanel{
var $layout = 'default';
var $sessionCats = array('common','login','button','label');

function Controller(){
function __construct() {

# create database object
$dbObj = New Database(DB_ENGINE);
$this->dbHelper = $dbObj;
Expand Down
2 changes: 1 addition & 1 deletion libs/database.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Database{
var $dbConObj;

# constructor
function database($dbEngine='mysql'){
function __construct($dbEngine='mysql') {

// if db engine is mysql
if ($dbEngine == 'mysql') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function release(EasyHandle $easy)
$resource = $easy->handle;
unset($easy->handle);

if (count($this->handles) >= $this->maxHandles) {
if ( $this->handles && ( count($this->handles) >= $this->maxHandles ) ) {
curl_close($resource);
} else {
// Remove all callback functions as they can hold onto references
Expand Down
28 changes: 28 additions & 0 deletions libs/mysqlihelper/mysqlihelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ function MysqliHelper($dbServer, $dbUser, $dbPassword, $dbName, $debug){

// func to execute a select query
function select($query, $fetchFirst = false){

$dbName = DB_NAME;
$dbUser = DB_USER;
$dbPassword = DB_PASSWORD;
$dbServer = DB_HOST;

if( $this->connectionId ) {
if( @mysqli_ping($this->connectionId) ) {} else {
$this->connectionId = @mysqli_connect($dbServer, $dbUser, $dbPassword, $dbName);
}
} else {
$this->connectionId = @mysqli_connect($dbServer, $dbUser, $dbPassword, $dbName);
}

$res = mysqli_query($this->connectionId, $query);
$this->showError();

Expand All @@ -79,6 +93,20 @@ function select($query, $fetchFirst = false){

// func to Execute a general mysql query
function query($query, $noRows=false){

$dbName = DB_NAME;
$dbUser = DB_USER;
$dbPassword = DB_PASSWORD;
$dbServer = DB_HOST;

if( $this->connectionId ) {
if( @mysqli_ping($this->connectionId) ) {} else {
$this->connectionId = @mysqli_connect($dbServer, $dbUser, $dbPassword, $dbName);
}
} else {
$this->connectionId = @mysqli_connect($dbServer, $dbUser, $dbPassword, $dbName);
}

$res = @mysqli_query($this->connectionId, $query);

if ($res){
Expand Down
3 changes: 1 addition & 2 deletions libs/pchart.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ class pChart
var $AntialiasQuality = 10;

/* This function create the background picture */
function pChart($XSize,$YSize)
{
function __construct($XSize,$YSize) {
$this->XSize = $XSize;
$this->YSize = $YSize;
$this->Picture = imagecreatetruecolor($XSize,$YSize);
Expand Down
3 changes: 1 addition & 2 deletions libs/pdata.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ class pData
var $Data;
var $DataDescription;

function pData()
{
function __construct() {
$this->Data = "";
$this->DataDescription = "";
$this->DataDescription["Position"] = "Name";
Expand Down
25 changes: 13 additions & 12 deletions libs/spider.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class Spider{
var $_CURL_HTTPHEADER = array();
var $userAgentList = array();
var $effectiveUrl = null;

# spider constructor
function Spider() {
function __construct() {
$this -> _CURLOPT_COOKIEJAR = SP_TMPPATH.'/'.$this -> _CURLOPT_COOKIEJAR;
$this -> _CURLOPT_COOKIEFILE = SP_TMPPATH.'/'.$this -> _CURLOPT_COOKIEFILE;
$this -> _CURL_RESOURCE = curl_init( );
Expand All @@ -60,9 +60,8 @@ function Spider() {
$this->userAgentList[] = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.0; search bar)";
$this->userAgentList[] = "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))";
$this->userAgentList[] = defined('SP_USER_AGENT') ? SP_USER_AGENT : $this->_CURLOPT_USERAGENT;

}

}

# func to format urls
public static function formatUrl($url){
$scheme = "";
Expand Down Expand Up @@ -103,7 +102,7 @@ function getPageInfo($url, $domainUrl, $returnUrls=false){
$ret = $this->getContent($urlWithTrailingSlash);
$pageInfo = array(
'external' => 0,
'total_links' => 0,
'total_links' => 0,
);

$checkUrl = formatUrl($domainUrl);
Expand Down Expand Up @@ -403,7 +402,7 @@ function debugRunTime($ret) {
}

}

# func to get session id
function getSessionId($page){
if (preg_match('/PHPSESSID=(.*?);/', $page, $result)) {
Expand All @@ -412,7 +411,7 @@ function getSessionId($page){
return false;
}
}

# func to check proxy
function checkProxy($proxyInfo) {

Expand Down Expand Up @@ -494,7 +493,7 @@ public static function getHeader($url, $followRedirects = true){
curl_close ($ch);
return $content;
}

// function to check whether link is brocke
public static function isLInkBrocken($url) {
$header = Spider::getHeader($url);
Expand All @@ -504,16 +503,18 @@ public static function isLInkBrocken($url) {
return 0;
}
}

// function to check whether link is a redirect
public static function isLinkRedirect($url) {
$followRedirects = false; //don't follow with cURL as we need that info.
$header = $this->getHeader($url, $followRedirects);
$header = Spider::getHeader($url, $followRedirects);
if (stristr($header, '301 Moved Permanently') || stristr($header, '308 Permanent Redirect')) {
return true;
} else {
return 0;
}
}

}
?>

?>
2 changes: 1 addition & 1 deletion libs/validation.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Validation{

var $flagErr;

function Validation(){
function __construct() {
$this->Filters['email'] = "/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i" ;
$this->Filters['number'] = "/^[0-9]+$/";
$this->Filters['floatnumber'] = "/^\d+$|^\d+\.\d+$|^\.\d+$|^\-\d+$/";
Expand Down
4 changes: 2 additions & 2 deletions libs/xmlparser.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class XMLParser{
/**
* The class constructor.
*/
function XMLParser(){ }
function __construct() {}


/**
* parse the XML file (or URL)
Expand Down
3 changes: 2 additions & 1 deletion themes/classic/views/website/list.ctp.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<form name="listform" id="listform">
<?php echo showSectionHead($spTextPanel['Website Manager']); ?>
<?php $submitLink = "scriptDoLoadPost('websites.php', 'listform', 'content')";?>
<?php $submitLink = "scriptDoLoadPost('websites.php', 'listform', 'content')"; ?>
<?php if( isset($info['search_name']) ) {} else { $info['search_name'] = ''; } ?>
<table width="80%" border="0" cellspacing="0" cellpadding="0" class="search">
<tr>
<th><?php echo $spText['common']['Name']?>: </th>
Expand Down