コード例 #1
0
 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;
 }
コード例 #2
0
    function proceedInstallation($info)
    {
        $db = new DB();
        # checking db settings
        $errMsg = $db->connectDatabase($info['db_host'], $info['db_user'], $info['db_pass'], $info['db_name']);
        if ($db->error) {
            $this->startInstallation($info, $errMsg);
            return;
        }
        # checking config file settings
        if (!is_writable(SP_INSTALL_CONFIG_FILE)) {
            $this->checkRequirements(true);
            return;
        }
        # checking seo panel web path
        $info['web_path'] = $this->getWebPath();
        if (empty($info['web_path'])) {
            $errMsg = "Error occured while parsing installation url. Please <a href='http://www.seopanel.in/contact/' target='_blank'>contact</a> Seo Panel team.<br> or <br> Try manual installation by steps specified in <a href='http://www.seopanel.in/install/manual/' target='_blank'>http://www.seopanel.in/install/manual/</a>";
            $this->startInstallation($info, $errMsg);
            return;
        }
        # importing data to db
        $errMsg = $db->importDatabaseFile(SP_INSTALL_DB_FILE);
        if ($db->error) {
            $errMsg = "Error occured while importing data: " . $errMsg;
            $this->startInstallation($info, $errMsg);
            return;
        }
        # importing text file
        $errMsg = $db->importDatabaseFile(SP_INSTALL_DB_LANG_FILE);
        if ($db->error) {
            $errMsg = "Error occured while importing data: " . $errMsg;
            $this->startInstallation($info, $errMsg);
            return;
        }
        # write to config file
        $this->writeConfigFile($info);
        # create API Key if not exists
        $this->createSeoPanelAPIKey($db);
        if (gethostbynamel('seopanel.in')) {
            include_once SP_INSTALL_DIR . '/../libs/spider.class.php';
            include_once SP_INSTALL_CONFIG_FILE;
            $installUpdateUrl = "http://www.seopanel.in/installupdate.php?url=" . urlencode($info['web_path']) . "&ip=" . $_SERVER['SERVER_ADDR'] . "&email=" . urlencode($info['email']);
            $installUpdateUrl .= "&version=" . SP_INSTALLED;
            $spider = new Spider();
            $spider->getContent($installUpdateUrl, false);
        }
        $db = new DB();
        $db->connectDatabase($info['db_host'], $info['db_user'], $info['db_pass'], $info['db_name']);
        // update email for admin
        $sql = "update users set email='" . addslashes($info['email']) . "' where id=1";
        $db->query($sql);
        // select languages list
        $sql = "select * from languages where translated=1";
        $langList = $db->select($sql);
        ?>
		
		<form method="post" action="<?php 
        echo $info['web_path'] . "/login.php";
        ?>
">
		<h1 class="BlockHeader">Seo Panel Installation Success</h1>
		<table width="100%" cellspacing="8px" cellpadding="0px" class="formtab">
			<tr><th colspan="2" class="headersuccess">Seo Panel installed successfully!</th></tr>
			<tr>
				<td class="warning" colspan="2">Warning!</td>
			</tr>
			<tr>
				<td style="border: none;" colspan="2">
					<ul class="list">
						<li> Please change permission of config file <b><?php 
        echo SP_CONFIG_FILE;
        ?>
</b> to avoid security issues.</li>
						<li>Please remove installation directory <b>install</b> to avoid security issues.</li>
					</ul>
				</td>
			</tr>
			<tr>
				<td class="warning" style="color:black;" colspan="2">Admin Login</td>
			</tr>
			<tr>
				<td style="border-left: none;">Default Language:</td>
				<td>
					<select name="lang_code">
            			<?php 
        foreach ($langList as $langInfo) {
            $selected = $langInfo['lang_code'] == 'en' ? "selected" : "";
            ?>
			
            				<option value="<?php 
            echo $langInfo['lang_code'];
            ?>
" <?php 
            echo $selected;
            ?>
><?php 
            echo $langInfo['lang_name'];
            ?>
</option>
            				<?php 
        }
        ?>
            		</select>
				</td>
			</tr>
			<tr>
				<td style="border: none;font-weight: normal;font-size: 13px;" colspan="2">
					<b>Username:</b> <?php 
        echo SP_ADMIN_USER;
        ?>
<br>
					<b>Password:</b> <?php 
        echo SP_ADMIN_PASS;
        ?>
<br><br>
					<b>Note:</b> Please change password of admin after first login.
				</td>
			</tr>
		</table>
		<input type="hidden" name="sec" value="login">
		<input type="hidden" name="userName" value="spadmin">
		<input type="hidden" name="password" value="spadmin">
		<input type="submit" value="Proceed to admin login >>" name="submit" class="button">
		</form>
		<?php 
    }
コード例 #3
0
    function checkDirectoryStatus($dirId, $nodebug = 0)
    {
        $dirId = intval($dirId);
        $dirInfo = $this->getDirectoryInfo($dirId);
        $active = 0;
        $captcha = 0;
        $spider = new Spider();
        $ret = $spider->getContent(addHttpToUrl($dirInfo['submit_url']));
        $prUpdate = '';
        $searchUpdate = '';
        $extraValUpdate = '';
        if (empty($ret['error']) && !empty($ret['page'])) {
            $page = $ret['page'];
            $matches = $this->isCategoryExists($page, $dirInfo['category_col']);
            $active = empty($matches[0]) ? 0 : 1;
            $captcha = stristr($page, $dirInfo['captcha_script']) ? 1 : 0;
            // to check search script
            if (stristr($page, 'name="search"')) {
                $searchUpdate = ",search_script='index.php?search=[--keyword--]'";
            }
            // to check  the value of the LINK_TYPE if phpld directory
            if ($dirInfo['script_type_id'] == 1 && preg_match('/name="LINK_TYPE" value="(\\d)"/s', $page)) {
                $subject = array('LINK_TYPE=reciprocal', 'LINK_TYPE=normal', 'LINK_TYPE=free');
                $replace = array('reciprocal=1&LINK_TYPE=1', 'LINK_TYPE=2', 'LINK_TYPE=3');
                $dirInfo['extra_val'] = str_replace($subject, $replace, $dirInfo['extra_val']);
                $extraValUpdate = ",extra_val='{$dirInfo['extra_val']}'";
            }
            if ($this->checkPR) {
                include_once SP_CTRLPATH . "/rank.ctrl.php";
                $rankCtrler = new RankController();
                $pagerank = $rankCtrler->__getGooglePageRank($dirInfo['domain']);
                $prUpdate = ",google_pagerank={$pagerank}";
            }
        }
        $sql = "update directories set working={$active},is_captcha={$captcha},checked=1 {$prUpdate} {$searchUpdate} {$extraValUpdate} where id={$dirId}";
        $this->db->query($sql);
        if ($nodebug) {
            $captchaLabel = $captcha ? $_SESSION['text']['common']['Yes'] : $_SESSION['text']['common']['No'];
            ?>
			<script type="text/javascript">
				document.getElementById('captcha_<?php 
            echo $dirId;
            ?>
').innerHTML = '<?php 
            echo $captchaLabel;
            ?>
';
			</script>
			<?php 
            if ($this->checkPR) {
                ?>
				<script type="text/javascript">
					document.getElementById('pr_<?php 
                echo $dirId;
                ?>
').innerHTML = '<?php 
                echo $pagerank;
                ?>
';
				</script>
				<?php 
            }
            echo $this->getStatusLink($dirId, $active);
        } else {
            echo "<p class='note notesuccess'>Saved status of directory <b>{$dirInfo['domain']}</b>.....</p>";
        }
    }
コード例 #4
0
ファイル: sp-common.php プロジェクト: codegooglecom/seopanel
function exportToPdf($content, $fileName = "reports.pdf")
{
    include_once SP_LIBPATH . "/mpdf/mpdf.php";
    $mpdf = new mPDF();
    $mpdf->useAdobeCJK = true;
    $mpdf->SetAutoFont(AUTOFONT_ALL);
    $spider = new Spider();
    $ret = $spider->getContent(SP_CSSPATH . "/screen.css");
    $stylesheet = str_replace("../../../images", SP_IMGPATH, $ret['page']);
    $mpdf->WriteHTML($stylesheet, 1);
    $mpdf->SetDisplayMode('fullpage');
    $mpdf->WriteHTML($content, 2);
    $mpdf->Output($fileName, "I");
    exit;
}
コード例 #5
0
    function checkDirectoryStatus($dirId, $nodebug = 0)
    {
        $dirId = intval($dirId);
        $dirInfo = $this->getDirectoryInfo($dirId);
        $active = 0;
        $captcha = 0;
        $spider = new Spider();
        $ret = $spider->getContent(addHttpToUrl($dirInfo['submit_url']));
        $prUpdate = '';
        if (empty($ret['error']) && !empty($ret['page'])) {
            $page = $ret['page'];
            $matches = $this->isCategoryExists($page, $dirInfo['category_col']);
            $active = empty($matches[0]) ? 0 : 1;
            $captcha = stristr($page, $dirInfo['captcha_script']) ? 1 : 0;
            if ($this->checkPR) {
                include_once SP_CTRLPATH . "/rank.ctrl.php";
                $rankCtrler = new RankController();
                $pagerank = $rankCtrler->__getGooglePageRank($dirInfo['domain']);
                $prUpdate = ",google_pagerank={$pagerank}";
            }
        }
        $sql = "update directories set working={$active},is_captcha={$captcha},checked=1 {$prUpdate} where id={$dirId}";
        $this->db->query($sql);
        if ($nodebug) {
            $captchaLabel = $captcha ? $_SESSION['text']['common']['Yes'] : $_SESSION['text']['common']['No'];
            ?>
			<script type="text/javascript">
				document.getElementById('captcha_<?php 
            echo $dirId;
            ?>
').innerHTML = '<?php 
            echo $captchaLabel;
            ?>
';
			</script>
			<?php 
            if ($this->checkPR) {
                ?>
				<script type="text/javascript">
					document.getElementById('pr_<?php 
                echo $dirId;
                ?>
').innerHTML = '<?php 
                echo $pagerank;
                ?>
';
				</script>
				<?php 
            }
            echo $this->getStatusLink($dirId, $active);
        } else {
            echo "<p class='note notesuccess'>Saved status of directory <b>{$dirInfo['domain']}</b>.....</p>";
        }
    }
コード例 #6
0
    function proceedInstallation($info)
    {
        $db = new DB();
        # checking db settings
        $errMsg = $db->connectDatabase($info['db_host'], $info['db_user'], $info['db_pass'], $info['db_name']);
        if ($db->error) {
            $this->startInstallation($info, $errMsg);
            return;
        }
        # checking config file settings
        if (!is_writable(SP_INSTALL_CONFIG_FILE)) {
            $this->checkRequirements(true);
            return;
        }
        # checking seo panel web path
        $info['web_path'] = $this->getWebPath();
        if (empty($info['web_path'])) {
            $errMsg = "Error occured while parsing installation url. Please <a href='http://www.seopanel.in/contact/' target='_blank'>contact</a> Seo Panel team.";
            $this->startInstallation($info, $errMsg);
            return;
        }
        # importing data to db
        $errMsg = $db->importDatabaseFile(SP_INSTALL_DB_FILE);
        if ($db->error) {
            $errMsg = "Error occured while importing data: " . $errMsg;
            $this->startInstallation($info, $errMsg);
            return;
        }
        # write to config file
        $this->writeConfigFile($info);
        if (gethostbynamel('seopanel.in')) {
            include_once SP_INSTALL_DIR . '/../libs/spider.class.php';
            $installUpdateUrl = "http://www.seopanel.in/installupdate.php?url=" . urlencode($info['web_path']) . "&ip=" . $_SERVER['SERVER_ADDR'] . "&email=" . urlencode($info['email']);
            $spider = new Spider();
            $spider->getContent($installUpdateUrl);
        }
        ?>
		
		<form method="post" action="<?php 
        echo $info['web_path'] . "/login.php";
        ?>
">
		<h1 class="BlockHeader">Seo Panel Installation Success</h1>
		<table width="100%" cellspacing="8px" cellpadding="0px" class="formtab">
			<tr><th colspan="2" class="headersuccess">Seo Panel installed successfully!</th></tr>
			<tr>
				<td class="warning">Warning!</td>
			</tr>
			<tr>
				<td style="border: none;">
					<ul class="list">
						<li> Please change permission of config file <b><?php 
        echo SP_CONFIG_FILE;
        ?>
</b> to avoid security issues.</li>
						<li>Please remove installation directory <b>install</b> to avoid security issues.</li>
					</ul>
				</td>
			</tr>
			<tr>
				<td class="warning" style="color:black;">Admin Login</td>
			</tr>
			<tr>
				<td style="border: none;font-weight: normal;font-size: 13px;">
					<b>Username:</b> <?php 
        echo SP_ADMIN_USER;
        ?>
<br>
					<b>Password:</b> <?php 
        echo SP_ADMIN_PASS;
        ?>
<br><br>
					<b>Note:</b> Please change password of admin after first login.
				</td>
			</tr>
		</table>				
		<input type="submit" value="Proceed to admin login >>" name="submit" class="button">
		</form>
		<?php 
    }
コード例 #7
0
    function checkDirectoryStatus($dirId, $nodebug = 0)
    {
        $dirInfo = $this->getDirectoryInfo($dirId);
        $active = 0;
        $captcha = 0;
        $spider = new Spider();
        $ret = $spider->getContent(addHttpToUrl($dirInfo['submit_url']));
        if (empty($ret['error']) && !empty($ret['page'])) {
            $page = $ret['page'];
            $matches = $this->isCategoryExists($page, $dirInfo['category_col']);
            $active = empty($matches[0]) ? 0 : 1;
            $captcha = stristr($page, $dirInfo['captcha_script']) ? 1 : 0;
        }
        $sql = "update directories set working={$active},is_captcha={$captcha} where id={$dirId}";
        $this->db->query($sql);
        if ($nodebug) {
            $captchaLabel = $captcha ? "Yes" : "No";
            ?>
			<script type="text/javascript">
				document.getElementById('captcha_<?php 
            echo $dirId;
            ?>
').innerHTML = '<?php 
            echo $captchaLabel;
            ?>
';
			</script>
			<?php 
            echo $this->getStatusLink($dirId, $active);
        } else {
            echo "<p class='note notesuccess'>Saved status of directory <b>{$dirInfo['domain']}</b>.....</p>";
        }
    }