Просмотр файла admin/includes/common.php

Размер файла: 1.38Kb
<?php
/*
// include the class file
include "includes/common.php";

// instantiate the class
$common = new common();
*/

// class
class common {

	// declare a class member variables
	var $emulator_url;
	var $emulator_name;
	var $time_offset;

	// constructor function
	function common() {
		$this->setup_default_emulator();
		$this->set_time_offset();
	}

	function setup_emulator($name, $url) {
		$this->emulator_name = $name;
		$this->emulator_url = $url;
	}

	function setup_default_emulator() {
		$query = "SELECT name, url FROM wps_site LIMIT 1";
		$result = mysql_query($query);
		$row = mysql_fetch_object ($result);
    	$this->emulator_name = $row->name;
    	$this->emulator_url = $row->url;
	}

	function display_emulator() {
		$query = "SELECT link FROM wps_emulator LIMIT 1";
		$result = mysql_query($query);
		$row = mysql_fetch_object ($result);
		$name = $this->emulator_name;
		$row->link = str_replace('$name', $name, $row->link);
		$url = $this->emulator_url;
		$row->link = str_replace('$url', $url, $row->link);
		echo $row->link;
		//eval ('echo "'.$row->link.'";');
	}

	function set_time_offset() {
		$query = "SELECT * FROM wps_timediff";
		$result = mysql_query($query);
		$row = mysql_fetch_object ($result);
		$this->time_offset = $row->timediff * 60 * 60;
	}

	function get_time_offset() {
		return $this->time_offset;
	}

}
?>