Location: PHPKode > projects > Write2Left > Base/Main.php
<?php
/*
+------------------------------------------------------
| Write2Left
| (c) timdorr
| http://www.write2left.com
| hide@address.com
| See License.txt for license info
|------------------------------------------------------
| Script: Main.php
| Description:
|   Handles the main page seen by users.
| Created Sep-02-2002
+------------------------------------------------------
*/

/* Class: Main
 * Description:
 *   Driver for our main page
 */
class Main
{
	var $skin = "";
	var $menu = true;
	
	function run()
	{
		global $W2L, $userinfo, $output, $db, $func;

        // Do skin related thingys
		require( "./Skin/Main.php" );
		$this->skin = new Skin_Main();
		$output->page_title = "Main Menu";
		$output->loc_add( "Main" );
		$output->add( $this->skin->body_top( $W2L->version ) );

		// Reset our log id session data back to none 
		$db->query( "UPDATE w2l_sessions SET log_id = 0 WHERE sid = '$userinfo->session_id'" );

		if( $userinfo->perms['can_options'] )
		{
			// Show the users logged in
			$output->add( "<b>Users online:</b><br /><div class='box'>");
			$db->query( "SELECT user_name, last_action FROM w2l_sessions WHERE user_id<>0" );
			while( $row = $db->fetch_array() )
			{
				$output->add( "$row[user_name] - $row[last_action]<br />\n" );
			}
			
			$output->add( "</div>" );
		}

		$output->add( "<b>Your Available Logs:</b><br />" );
		
		$id = $func->get_logs_sql_id();
		
		while( $row = $db->fetch_array( $id ) )
		{
			$posts 		= $db->query_fetch( "SELECT COUNT(*) FROM w2l_posts 	WHERE log_id = $row[log_id]" );
			$comments 	= $db->query_fetch( "SELECT COUNT(*) FROM w2l_comments 	WHERE log_id = $row[log_id]" );
			$authors	= $db->query_fetch( "SELECT COUNT(*) FROM w2l_editors 	WHERE log_id = $row[log_id] AND can_post = '1'" );
			
			$output->add( $this->skin->log( $row['log_id'], $row['name'], $authors[0], $posts[0], $comments[0] ) );
		}

/*
		// Show uptime stats if possible
		if( $uptime =  `uptime` )
		{
			$output->add( "<b>Server Info:</b><br />" );
			preg_match(  "/averages: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/", $uptime, $avgs );
			$output->add( "Load Averages: <b>$avgs[1], $avgs[2], $avgs[3]</b><br />");
		}
		
*/	

		$output->add( $this->skin->body_bottom() );
	}
}


$driver = new Main();
?>
Return current item: Write2Left