250 lines
7.1 KiB
PHP
250 lines
7.1 KiB
PHP
<?php
|
|
|
|
/* $Id: class_core.php 14 2009-01-12 09:36:11Z john $ */
|
|
|
|
|
|
class SECore
|
|
{
|
|
function &getInstance()
|
|
{
|
|
static $instance;
|
|
|
|
if( !is_a($instance, 'SECore') )
|
|
{
|
|
$instance = new SECore();
|
|
}
|
|
|
|
return $instance;
|
|
}
|
|
|
|
|
|
|
|
function &getSettings()
|
|
{
|
|
static $settings;
|
|
|
|
if( !is_array($settings) )
|
|
{
|
|
$cache = SECache::getInstance('serial', array('lifetime' => 3600));
|
|
|
|
// Get from cache
|
|
if( is_object($cache) )
|
|
{
|
|
$settings = $cache->get('site_settings');
|
|
}
|
|
|
|
// Get from database
|
|
if( !is_array($settings) )
|
|
{
|
|
$database = SEDatabase::getInstance();
|
|
//$resource = $database->database_query("SELECT * FROM se_settings WHERE setting_id=1 LIMIT 1");
|
|
//$settings = $database->database_fetch_assoc($resource);
|
|
//if($_SERVER["REMOTE_ADDR"]=="76.111.155.21"){
|
|
$settings=unserialize(file_get_contents($_SERVER['DOCUMENT_ROOT']."/include/settings"));
|
|
//var_dump($settings);
|
|
//echo $settings["updated"]."<br>".(time()-(60*5));
|
|
|
|
if(($settings["updated"]*1)<(time()-(60*5))){
|
|
//echo "AAA";
|
|
|
|
$resource = $database->database_query("SELECT * FROM se_settings WHERE setting_id=1 LIMIT 1");
|
|
$settings = $database->database_fetch_assoc($resource);
|
|
$settings["updated"]=time();
|
|
file_put_contents($_SERVER['DOCUMENT_ROOT']."/include/settings", serialize($settings));
|
|
}
|
|
|
|
|
|
//}
|
|
// Store in cache
|
|
if( is_object($cache) )
|
|
{
|
|
$cache->store($settings, 'site_settings');
|
|
|
|
}
|
|
}
|
|
}
|
|
if(SE_DEBUG1){$settings["setting_cache_enabled"]=1; $settings["setting_cache_default"]="memcached"; $settings["setting_cache_lifetime"]="10"; }
|
|
return $settings;
|
|
}
|
|
|
|
|
|
|
|
function &getPlugins()
|
|
{
|
|
static $plugins;
|
|
|
|
if( !is_array($plugins) )
|
|
{
|
|
//$cache = SECache::getInstance('serial', array('lifetime' => 3600));
|
|
|
|
// Get from cache
|
|
//if( is_object($cache) )
|
|
//{
|
|
//$plugins = $cache->get('site_plugins');
|
|
//}
|
|
|
|
// Get from database
|
|
//if( !is_array($plugins) )
|
|
{
|
|
//$database = SEDatabase::getInstance();
|
|
//$resource = $database->database_query("SELECT plugin_type, plugin_icon FROM se_plugins WHERE plugin_disabled=0 ORDER BY plugin_order ASC");
|
|
//$plugins = $database->database_load_all_assoc('plugin_type');
|
|
|
|
|
|
{
|
|
//Plugin Database removal
|
|
$plugins=array();
|
|
//$plugins["imobile"]["plugin_type"]="imobile";
|
|
//$plugins["imobile"]["plugin_icon"]="imobile_imobile16.gif";
|
|
|
|
$plugins["he_user_note"]["plugin_type"]="he_user_note";
|
|
$plugins["he_user_note"]["plugin_icon"]="he_user_note_icon.png";
|
|
|
|
|
|
$plugins["he_core"]["plugin_type"]="he_core";
|
|
$plugins["he_core"]["plugin_icon"]="he_core_icon.png";
|
|
|
|
//$plugins["he_mass_mail"]["plugin_type"]="he_mass_mail";
|
|
//$plugins["he_mass_mail"]["plugin_icon"]="he_mass_message16.gif";
|
|
//$plugins["classified"]["plugin_type"]= "classified";
|
|
//$plugins["classified"]["plugin_icon"]="";
|
|
|
|
$plugins["event"]["plugin_type"]= "event";
|
|
$plugins["event"]["plugin_icon"]="event_event16.gif";
|
|
|
|
$plugins["music"]["plugin_type"]= "music";
|
|
$plugins["music"]["plugin_icon"]="music_music16.gif";
|
|
|
|
$plugins["album"]["plugin_type"]="album";
|
|
$plugins["album"]["plugin_icon"]="album_album16.gif";
|
|
|
|
$plugins["video"]["plugin_type"]="video";
|
|
$plugins["video"]["plugin_icon"]= "video_video16.gif";
|
|
|
|
$plugins["group"]["plugin_type"]="group";
|
|
$plugins["group"]["plugin_icon"]="group_group16.gif";
|
|
|
|
$plugins["blog"]["plugin_type"]= "blog";
|
|
$plugins["blog"]["plugin_icon"]="blog_blog16.gif";
|
|
|
|
$plugins["forum"]["plugin_type"]="forum";
|
|
$plugins["forum"]["plugin_icon"]= "forum_forum16.gif";
|
|
|
|
$plugins["subscriber"]["plugin_type"]="subscriber";
|
|
$plugins["subscriber"]["plugin_icon"]="subscriber16.png";
|
|
|
|
$plugins["payment"]["plugin_type"]= "payment";
|
|
$plugins["payment"]["plugin_icon"]= "payment16.png";
|
|
|
|
//$plugins["scheduler"]["plugin_type"]= "scheduler";
|
|
//$plugins["scheduler"]["plugin_icon"]= "scheduler16.gif";
|
|
|
|
//$plugins["radcodes"]["plugin_type"]="radcodes";
|
|
//$plugins["radcodes"]["plugin_icon"]= "radcodes16.gif";
|
|
|
|
/*$plugins["avchat3"]["plugin_type"]= "avchat3";
|
|
$plugins["avchat3"]["plugin_icon"]= "avchat3_logo.gif";
|
|
|
|
$plugins["page"]["plugin_type"]= "page";
|
|
$plugins["page"]["plugin_icon"]= "page_page16.gif";
|
|
*/
|
|
|
|
$plugins["tracking"]["plugin_type"]="tracking";
|
|
$plugins["tracking"]["plugin_icon"]="";
|
|
|
|
$plugins["poll"]["plugin_type"]= "poll";
|
|
$plugins["poll"]["plugin_icon"]="poll_poll16.gif";
|
|
|
|
$plugins["birthdayEmails"]["plugin_type"]="birthdayEmails";
|
|
$plugins["birthdayEmails"]["plugin_icon"]="birthday.gif";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
// Store in cache
|
|
/*if( is_object($cache) )
|
|
{
|
|
$cache->store($plugins, 'site_plugins');
|
|
}*/
|
|
}
|
|
}
|
|
|
|
return $plugins;
|
|
}
|
|
|
|
|
|
|
|
function &getLanguages()
|
|
{
|
|
static $languages;
|
|
|
|
if( !is_array($languages) )
|
|
{
|
|
$cache = SECache::getInstance('serial', array('lifetime' => 3600));
|
|
|
|
// Get from cache
|
|
if( is_object($cache) )
|
|
{
|
|
$languages = $cache->get('site_languages');
|
|
}
|
|
|
|
// Get from database
|
|
if( !is_array($languages) )
|
|
{
|
|
//$database = SEDatabase::getInstance();
|
|
//$resource = $database->database_query("SELECT * FROM se_languages ORDER BY language_default DESC");
|
|
//$languages = $database->database_load_all_assoc('language_id');
|
|
$languages = SELanguage::_languages();
|
|
|
|
// Store in cache
|
|
if( is_object($cache) )
|
|
{
|
|
$cache->store($languages, 'site_languages');
|
|
}
|
|
}
|
|
}
|
|
|
|
return $languages;
|
|
}
|
|
|
|
|
|
|
|
function &getSubnetworkInfo($subnet_id)
|
|
{
|
|
static $subnetwork_info;
|
|
|
|
if( !is_array($subnetwork_info) ) $subnetwork_info = array();
|
|
|
|
if( !isset($subnetwork_info[$subnet_id]) )
|
|
{
|
|
$cache = SECache::getInstance('serial', array('lifetime' => 3600));
|
|
|
|
// Get from cache
|
|
if( is_object($cache) )
|
|
{
|
|
$subnetwork_info[$subnet_id] = $cache->get('site_subnetworks_'.$subnet_id);
|
|
}
|
|
|
|
// Get from database
|
|
if( !is_array($subnetwork_info[$subnet_id]) )
|
|
{
|
|
$database = SEDatabase::getInstance();
|
|
$resource = $database->database_query("SELECT subnet_id, subnet_name FROM se_subnets WHERE subnet_id='{$subnet_id}' LIMIT 1");
|
|
$subnetwork_info[$subnet_id] = $database->database_fetch_assoc($resource);
|
|
|
|
// Store in cache
|
|
if( is_object($cache) )
|
|
{
|
|
$cache->store($subnetwork_info[$subnet_id], 'site_subnetworks_'.$subnet_id);
|
|
}
|
|
}
|
|
}
|
|
|
|
return $subnetwork_info[$subnet_id];
|
|
}
|
|
}
|
|
|
|
|
|
?>
|