<!-- SEARCH OPTIONS END --> <!-- NETWORK STATS START --> <table id="network-stats" class="item-table no-wrap" border="0" cellspacing="0" cellpadding="4" align="center" style="min-width: 1000px;"> <?php _stats_network_table_header(); ?> <tbody> <?php $all_cached = true; $so_total = new StatsOverall(array('domain' => 'Network Totals')); $db->AddFilter('owner', $_REQUEST['owner']); $db->AddFilter('category', $_REQUEST['category']); foreach ($db->RetrieveAll() as $site) { if (!$site['flag_stats']) { continue; } if (isset($cache[$site['domain']]) && $cache[$site['domain']]['timestamp'] >= time() - 300) { $so = $cache[$site['domain']]['so']; } else { $all_cached = false; $so = new StatsOverall($site); $so->SetUnknown(); } _stats_network_table_row($so, $site); $so_total->AddStats($so); } ?> </tbody>
function network_site_update_stored_values() { require_once 'textdb.php'; $db = new NetworkDB(); $values = array('categories' => array(), 'owners' => array()); foreach ($db->RetrieveAll() as $site) { if (!string_is_empty($site['category'])) { $values['categories'][] = $site['category']; } if (!string_is_empty($site['owner'])) { $values['owners'][] = $site['owner']; } } $values['categories'] = array_unique($values['categories']); $values['owners'] = array_unique($values['owners']); file_write(FILE_NETWORK_SITES_VALUES, serialize($values)); }
<?php include 'global-header.php'; include 'global-menu.php'; require_once 'textdb.php'; $db = new NetworkDB(); $sites = $db->RetrieveAll('domain'); ?> <script type="text/javascript" src="js/network-sites.js"></script> <div class="centered-header"> Network Sites: <span id="num-items"><?php echo count($sites); ?> </span> Configured </div> <table id="network-sites" align="center" width="1000" cellspacing="0" class="item-table"> <thead> <tr class="ta-center"> <th style="width: 25px;"> <input type="checkbox" class="check-all"/> </th> <th> Domain </th> <th style="width: 150px;"> Owner </th> <th style="width: 150px;">
function _xNetworkSync() { require_once 'network-util.php'; $settings = null; // Cache settings for next request if (isset($_REQUEST['cache'])) { $settings = array(); $to_sync = explode(',', $_REQUEST['settings']); if (in_array(NETWORK_SYNC_BLACKLIST, $to_sync)) { $settings[NETWORK_SYNC_BLACKLIST] = array(); foreach (dir_read_files(DIR_BLACKLIST) as $bl_file) { $settings[NETWORK_SYNC_BLACKLIST][$bl_file] = file_get_contents(DIR_BLACKLIST . '/' . $bl_file); } } if (in_array(NETWORK_SYNC_CATEGORIES, $to_sync)) { $settings[NETWORK_SYNC_CATEGORIES] = file_get_contents(FILE_CATEGORIES); } if (in_array(NETWORK_SYNC_COUNTRIES, $to_sync)) { $settings[NETWORK_SYNC_COUNTRIES] = file_get_contents(FILE_COUNTRIES); } if (in_array(NETWORK_SYNC_GROUPS, $to_sync)) { $settings[NETWORK_SYNC_GROUPS] = file_get_contents(FILE_GROUPS); } if (in_array(NETWORK_SYNC_NETWORK_SITES, $to_sync)) { require_once 'textdb.php'; $db = new NetworkDB(); $settings[NETWORK_SYNC_NETWORK_SITES] = $db->RetrieveAll(); } if (in_array(NETWORK_SYNC_SEARCH_ENGINES, $to_sync)) { $settings[NETWORK_SYNC_SEARCH_ENGINES] = file_get_contents(FILE_SEARCH_ENGINES); } if (in_array(NETWORK_SYNC_SKIM_SCHEMES, $to_sync)) { $settings[NETWORK_SYNC_SKIM_SCHEMES] = array(); foreach (dir_read_files(DIR_SKIM_SCHEMES) as $ss_file) { $settings[NETWORK_SYNC_SKIM_SCHEMES][$ss_file] = array(); $settings[NETWORK_SYNC_SKIM_SCHEMES][$ss_file]['merged'] = file_get_contents(DIR_SKIM_SCHEMES . '/' . $ss_file); $settings[NETWORK_SYNC_SKIM_SCHEMES][$ss_file]['base'] = file_get_contents(DIR_SKIM_SCHEMES_BASE . '/' . $ss_file); $settings[NETWORK_SYNC_SKIM_SCHEMES][$ss_file]['dynamic'] = file_get_contents(DIR_SKIM_SCHEMES_DYNAMIC . '/' . $ss_file); } } if (in_array(NETWORK_SYNC_TRADES, $to_sync)) { $trades = explode(',', $_REQUEST['trades']); require_once 'dirdb.php'; $db = new TradeDB(); $settings[NETWORK_SYNC_TRADES] = array(); foreach ($trades as $trade) { $trade = $db->Retrieve($trade); if (!empty($trade)) { $settings[NETWORK_SYNC_TRADES][] = $trade; } } } if (in_array(NETWORK_SYNC_TRADE_RULES, $to_sync)) { $settings[NETWORK_SYNC_TRADE_RULES] = file_get_contents(FILE_TRADE_RULES); } $settings = base64_encode(serialize($settings)); file_write(FILE_NETWORK_SYNC_CACHE, $settings); } else { // Read settings from cache $settings = file_get_contents(FILE_NETWORK_SYNC_CACHE); } require_once 'textdb.php'; $db = new NetworkDB(); $site = $db->Retrieve($_REQUEST['domain']); if (empty($site)) { return JSON::Warning(array('response' => 'Site no longer exists in the database')); } // Sync settings to network site $nr = new NetworkRequest($site, NETWORK_FNC_SYNC, array('sync' => $settings)); if (($response = $nr->Execute()) === false) { return JSON::Warning(array('response' => $nr->error)); } JSON::Success(); }