Location: PHPKode > projects > eBlog > admin/global.php
<?php

/**************************************************************************
 *                                                                        *
 *                                                                        *
 *         Solution: eBlog                                                *
 *          Release: 1.7                                                  *
 *             File: admin/global.php                                     *
 *               By: Emuci inc.                                           *
 *          Website: http://www.emuci.com                                 *
 *        Copyright: (C) 2010 Emcui inc.                                  *
 *                                                                        *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *                                                                        *
 *   This script is NOT freeware and is subjected to Emuci terms of use   *
 *   located in the docs folder.                                          *
 *                                                                        *
 *                                                                        *
 *************************************************************************/
 
 
 
include '../includes/config.php';
include_once '../includes/session.php';
include_once '../includes/template.php';


$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ($lang_erorr_connectivity);
mysql_select_db($dbname);



$testTable = "eblog_settings";
if(!mysql_num_rows( mysql_query("SHOW TABLES LIKE '".$testTable."'")))
{
  die("eBlog is not properly configured. If this is the first run, please <a href=\"../install/index.php\">click here</a> to install the script.");
}

// settings
$result = mysql_query("SELECT * FROM eblog_settings WHERE id = '1'");	
$row = mysql_fetch_row($result);
$blog_name = $row[1];
$site_url = $row[2];
$DBusername = $row[3];
$DBpassword = $row[4];
$admin_email = $row[5];
$meta = $row[6];
$css = $row[7];
$badWords = $row[8];
$replaceWords = $row[9];
$allowComments = $row[10];
$visitors = $row[11];
$limit = $row[12];
$lang = $row[13];
$defaultTemplate = $row[14];
$popup = $row[15]; 
$enable1 = $row[16]; 
$enable2 = $row[17]; 	
$enable3 = $row[18]; 
$enable4 = $row[19]; 
$enableThumb = $row[20];
$thumb_width = $row[21];
$thumb_height = $row[22];		
$sort_by = $row[23];
$sort_order = $row[24];
$autoValidate = $row[25];
$location = $row[26];
$topicsPP = $row[27];
$monthsPL = $row[28];
$cellPR = $row[29];
$topicPR = $row[30];	
$ww = $row[31];
$wh = $row[32];
$GPP = $row[33];
$bw = $row[34];
$wrap = $row[35];	


include('../lang/' . $lang . '.php');


// Alerts
$alerts = "";

// Notifications
	$notifications = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">";
	$alertCount = 0;
	$totalAlerts = 0;
	
	// Test1: install folder still exist
		$path = "./../";
		$dir_handle = @opendir($path);
		while (false !== ($file = readdir($dir_handle))) {
			if($file == "install"){
			$alertCount++;
			}
		}
	
	if ($alertCount > $totalAlerts)
	{
		$tempAlert = "<tr><td valign =\"top\" width=\"22\"><img src=\"../images/icons/icon_erorr.gif\"></td>
		<td><font style=\"font-size: 0.7em;\" face=\"Tahoma\">$lang_alert_installExist</font></td>
		</tr>";
		
		
		$alerts = $alerts . "<table bordercolor=\"#727272\" style=\"border-collapse: collapse\" width=\"100%\" cellSpacing=\"0\" cellPadding=\"5\"  border=\"1\">
		<tr bgcolor=\"#f2f2f2\">
		<td valign=\"top\" width=\"16\">
		<img src=\"../images/icons/icon_erorr.gif\">
		</td>			
		<td>
		<font size=\"2\" face=\"Tahoma\"><b>101</b><br>$lang_alert_code101</font>
		</td>
		</tr>
		</table>
		<br>
		";
		
		
		$notifications =  $notifications . $tempAlert;
		$totalAlerts++;
	}
		
	
	// Test2: .htaccess file does not exist
	$path = "./";
	$counter = 1;
	$dir_handle = @opendir($path);
	while (false !== ($file = readdir($dir_handle))) {
		if($file == ".htaccess")
			$counter--;
	}	
	$alertCount = $alertCount +	$counter;
	if ($alertCount > $totalAlerts)
	{		
		$tempAlert = "
		<tr><td valign =\"top\" width=\"22\"><img src=\"../images/icons/icon_caution.gif\"></td>
		<td><font style=\"font-size: 0.7em;\" face=\"Tahoma\">$lang_alert_htaccessDoesNotExist</font></td>
		</tr>";
		
		$alerts = $alerts . "<table bordercolor=\"#727272\" style=\"border-collapse: collapse\" width=\"100%\" cellSpacing=\"0\" cellPadding=\"5\"  border=\"1\">
		<tr bgcolor=\"#dadada\">
		<td valign=\"top\" width=\"16\">
		<img src=\"../images/icons/icon_caution.gif\">
		</td>
		<td>
		<font size=\"2\" face=\"Tahoma\"><b>202</b><br>$lang_alert_code202</font>
		</td>
		</tr>
		</table>
		<br>
		";			
		
		$notifications =  $notifications . $tempAlert;
		$totalAlerts++;
	}
	
	
	
	
	
	// Test3: unauthorized attempts to login
	$conn = mysql_connect($dbhost, $dbuser, $dbpass);
	mysql_select_db($dbname);
	$totlaThreats = 0;	


	$result = mysql_query("SELECT * FROM eblog_blacklist", $conn);
	$totlaThreats = mysql_num_rows($result);

	if($totlaThreats > 0)
	{
		$tempAlert ="
		<tr><td valign =\"top\" width=\"22\"><img src=\"../images/icons/icon_caution.gif\"></td>
		<td><font style=\"font-size: 0.7em;\" face=\"Tahoma\">$lang_alert_blacklist</font></td>
		</tr>";
		
		$alerts = $alerts . "<table bordercolor=\"#727272\" style=\"border-collapse: collapse\" width=\"100%\" cellSpacing=\"0\" cellPadding=\"5\"  border=\"1\">
		<tr bgcolor=\"#dadada\">
		<td valign=\"top\" width=\"16\">
		<img src=\"../images/icons/icon_caution.gif\">
		</td>
		<td>
		<font size=\"2\" face=\"Tahoma\"><b>303</b><br>$lang_alert_code303</font>
		</td>
		</tr>
		</table>
		<br>
		";			
		
		$notifications =  $notifications . $tempAlert;
	
	}
	else
	{
	$totalAlerts++;
	}
			
	
	
	if ($totalAlerts < 1){
	$notifications = $notifications . "<tr><td><table><tr><td><img src=\"../images/icons/icon_approve.gif\"></td><td><font style=\"font-size: 0.7em;\" face=\"Tahoma\">". $lang_admin_noAlerts. "</font></td></tr></table></td></tr>";
	}		
	
	

	// Test4: is this product registered?
	   $result = mysql_query("SELECT * FROM eblog_sync WHERE id = '1'");	
	   $row = mysql_fetch_row($result);
	   $sn = $row[1];
	   if(empty($sn))	
	   {
			$tempAlert ="
			<tr><td valign =\"top\" width=\"22\"><img src=\"../images/icons/icon_info.gif\"></td>
			<td><font style=\"font-size: 0.7em;\" face=\"Tahoma\">$lang_alert_sync</font></td>
			</tr>";
			
			$alerts = $alerts . "<table bordercolor=\"#727272\" style=\"border-collapse: collapse\" width=\"100%\" cellSpacing=\"0\" cellPadding=\"5\"  border=\"1\">
			<tr bgcolor=\"#dadada\">
			<td valign=\"top\" width=\"16\">
			<img src=\"../images/icons/icon_info.gif\">
			</td>
			<td>
			<font size=\"2\" face=\"Tahoma\"><b>404</b><br>$lang_alert_code404</font>
			</td>
			</tr>
			</table>
			<br>
			";			
			
			$notifications =  $notifications . $tempAlert;	   
	   }
	   
	
	// close notifications table
	$notifications = $notifications . "</table>";
	
	// Splash alerts
	$statment = $lang_admin_thereAre;
	$result3 = mysql_query("SELECT enable1, enable2, enable3 FROM eblog_settings WHERE id = '1'");	
	$row3 = mysql_fetch_row($result3);
	$enable1 = $row3[0];
	$enable2 = $row3[1];
	$enable3 = $row3[2];		
	$totalPOPUP = 0;
	
	
	// Check for new comments	
	if($enable1 == 1){
		$result3 = mysql_query("SELECT comments FROM eblog_alerts WHERE id = '1'");	
		$row3 = mysql_fetch_row($result3);
		$thisAlert = $row3[0];
		if($thisAlert > 0)
		{
			$statment = $statment . " " . $thisAlert . " " . $lang_admin_newComments;
			$totalPOPUP++;
		}
	}	
	
	// Check for new guestbook entries
	if($enable2 == 1){	
		$result3 = mysql_query("SELECT gb FROM eblog_alerts WHERE id = '1'");	
		$row3 = mysql_fetch_row($result3);
		$thisAlert = $row3[0];
		if($thisAlert > 0)
		{
			$statment = $statment  . " " . $thisAlert . " " . $lang_admin_newGPP;
			$totalPOPUP++;
		}
	}
	
	
	// Check for new subscriptions		
	if($enable3 == 1){	
		$result3 = mysql_query("SELECT sub FROM eblog_alerts WHERE id = '1'");	
		$row3 = mysql_fetch_row($result3);
		$thisAlert = $row3[0];
		if($thisAlert > 0)
		{
			$statment = $statment . " " . $thisAlert . " " . $lang_admin_newSub;
			$totalPOPUP++;
		}	
	}
	
	
	// Check for new messages		
	if($enable3 == 1){	
		$result3 = mysql_query("SELECT mails FROM eblog_alerts WHERE id = '1'");	
		$row3 = mysql_fetch_row($result3);
		$thisAlert = $row3[0];
		if($thisAlert > 0)
		{
			$statment = $statment . " " . $thisAlert . " " . $lang_admin_newMails;
			$totalPOPUP++;
		}	
	}			
	
	$statment = $statment . ". " . $lang_admin_suspendAlert;
			
	if($totalPOPUP > 0){
	$JAVA_ALERTS = "
	<script type=\"text/javascript\">
	var popup = window.confirm(\"$statment\")
	if (popup)
	window.location = \"clear.php\";
	</script>";	
	}	
	
	
	// the Knowledge center menu
	$kc = "
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">

				 
				 <tr><td valign =\"top\" width=\"22\"><img src=\"../images/icons/icon_bullet.gif\"></td>
				 <td><a href=\"news.php\" title=\"$lang_admin_eBlogNews\" rel=\"gb_page_center[640, 500]\"><font style=\"font-size: 0.7em;\" face=\"Tahoma\">$lang_admin_eBlogNews</font></a></td>
				 </tr>
				 </tr>
				 				 
				 <tr><td valign =\"top\" width=\"22\"><img src=\"../images/icons/icon_bullet.gif\"></td>
				 <td><a href=\"http://www.emuci.com/home/support/faqs.php\" target=\"_blank\"><font style=\"font-size: 0.7em;\" face=\"Tahoma\">$lang_admin_footer2_4</font></a></td>
				 </tr>
				 				 
				 
				 <tr><td valign =\"top\" width=\"22\"><img src=\"../images/icons/icon_bullet.gif\"></td>
				 <td><a href=\"http://www.emuci.com/resources/privacy.php?product=eBlog\" title=\"$lang_admin_footer3_2\" rel=\"gb_page_center[640, 500]\"><font style=\"font-size: 0.7em;\" face=\"Tahoma\">$lang_admin_footer3_2</font></a></td>
				 </tr>
				 					 					 				 					 					 
				 
				 
				 </table>		
	";
	
$MonthsArray = array(
			 "01" => $lang_blog_01,
			 "02" => $lang_blog_02,
			 "03" => $lang_blog_03,
			 "04" => $lang_blog_04,
			 "05" => $lang_blog_05,
			 "06" => $lang_blog_06,
			 "07" => $lang_blog_07,
			 "08" => $lang_blog_08,
			 "09" => $lang_blog_09,
			 "10" => $lang_blog_10,			 			 
			 "11" => $lang_blog_11,
			 "12" => $lang_blog_12
			 );
			 			
						
mysql_close($conn);			


?>
Return current item: eBlog