function RetrieveAll($sorter = null, $desc = false) { $this->desc = $desc; if (!empty($sorter)) { $this->sorter = $sorter; } $items = array(); foreach (dir_read_files($this->directory, null, false) as $file) { $data = explode('|', file_get_contents($this->directory . '/' . $file)); if (count($this->fields) > count($data)) { $data = array_pad($data, count($this->fields), ''); } $data = array_combine($this->fields, $data); $data[$this->primary_key] = $file; if ($this->_filter($data)) { $items[] = DirDB::_format_outgoing($data); } } usort($items, array(&$this, '_compare')); return $items; }
?> " size="5"> %</span> <label class="short">Daily Cap:</label> <span><input type="text" name="daily_cap" value="<?php echo $item['daily_cap']; ?> " size="5"> %</span> </div> <div class="field"> <label>Exclude Trades:</label> <span> <select name="excludes[]" multiple="multiple" style="min-width: 150px; height: 6.3em;"> <?php $trades = dir_read_files(DIR_TRADES); echo form_options_multi($trades, $item['excludes']); ?> </select> </span> </div> <div class="field"> <label></label> <span> <?php echo form_checkbox('flag_external', 'Use external info', $item['flag_external']); ?> </span> </div>
E-mail Templates Search and Replace </div> <form method="post" action="xhr.php" enctype="multipart/form-data" class="xhr-form"> <div id="dialog-panel" dwidth="900px"> <div style="padding-top: 2px;"> <fieldset class="short-labels"> <legend>Search and Replace Settings</legend> <div class="field"> <label>Templates:</label> <span> <?php $templates = string_htmlspecialchars(dir_read_files(DIR_TEMPLATES, REGEX_EMAIL_TEMPLATES, true)); ?> <select name="templates[]" id="templates" multiple="multiple" size="10"> <?php echo form_options($templates); ?> </select> </span> </div> <div class="field"> <label>Search For:</label> <span><textarea name="search" id="search" rows="5" cols="88"></textarea></span> </div> <div class="field">
require_once 'dirdb.php'; $GLOBALS['current_hour'] = date('G'); $defaults = array('status' => null, 'group' => null, 'category' => null); $_REQUEST = array_merge($defaults, $_REQUEST); ?> <script language="JavaScript" type="text/javascript"> var COOKIE_NAME_TRADES = 'sh_trades'; var COOKIE_NAME_SYSTEM = 'sh_system'; var STATS_HOURLY = true; </script> <script type="text/javascript" src="js/stats-overall.js"></script> <div class="centered-header"> Hourly Stats: <span id="num-items"><?php echo format_int_to_string(count(dir_read_files(DIR_TRADES))); ?> </span> Total Trades </div> <!-- SEARCH OPTIONS START --> <div class="ta-center block-center search-fields"> <form action="index.php" method="post"> <b>Status:</b> <select name="status"> <option value="">-- ALL --</option> <?php $statuses = array(STATUS_UNCONFIRMED, STATUS_NEW, STATUS_ACTIVE, STATUS_AUTOSTOPPED, STATUS_DISABLED); echo form_options($statuses, $_REQUEST['status']); ?>
function recompile_templates() { require_once 'compiler.php'; $compiler = new Compiler(); $files = dir_read_files(DIR_TEMPLATES); foreach ($files as $file) { $compiled = DIR_COMPILED . '/' . $file; if (($code = $compiler->CompileFile($file, DIR_TEMPLATES)) === false) { return array(JSON_KEY_MESSAGE => 'Template ' . $file . ' contains errors', JSON_KEY_WARNINGS => Compiler::GetErrors()); } file_write($compiled, $code); } return true; }
function get_all_trades_logs($log = 'in') { if (!in_array($log, array('in', 'out', 'clicks'))) { $log = 'in'; } $trades = dir_read_files(DIR_TRADES); foreach ($trades as $i => $trade) { $trades[$i] = DIR_TRADE_STATS . "/{$trade}-{$log}"; } $system_trades = dir_read_files(DIR_SYSTEM); foreach ($system_trades as $i => $trade) { $system_trades[$i] = DIR_SYSTEM_STATS . "/{$trade}-{$log}"; } return array_merge($trades, $system_trades); }
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(); }
<?php require_once 'lib/global.php'; require_once 'utility.php'; $regex_search = '~\\|(\\d*)(2010\\d\\d\\d\\d)\\|~'; $regex_replace = "|\$1\n\$2|"; foreach (dir_read_files(DIR_SYSTEM) as $trade) { $file = DIR_SYSTEM_STATS . "/{$trade}-history"; $history = trim(file_get_contents($file)); $history = preg_replace($regex_search, $regex_replace, $history); file_write($file, $history . "\n"); } foreach (dir_read_files(DIR_TRADES) as $trade) { $file = DIR_TRADE_STATS . "/{$trade}-history"; $history = trim(file_get_contents($file)); $history = preg_replace($regex_search, $regex_replace, $history); file_write($file, $history . "\n"); } echo "DONE!\n";