Advertisement
Guest User

action

a guest
Jan 24th, 2020
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 44.22 KB | None | 0 0
  1. <?php class Action extends Controller { function __construct() { parent::__construct(); global $fttdb, $dbg; global $admin_locale, $FTT_TIMEZONE, $FTT_SHOW_ERRORS; if(FTT_DEBUG) $FTT_SHOW_ERRORS = true; header ('charset: '.FTT_CHARSET); $dbg = new FTT_Database('GLOBAL'); $this->dbg =& $dbg; $this->db =& $fttdb; $this->load->helper('cookie'); require_once(FTT_SITE_BASE.'/system/application/libraries/smarty.php'); $this->smarty = new Smarty(); $this->load->library('form_validation'); $this->load->helper("url"); $this->load->helper('date'); $this->load->helper('iadmin'); $this->load->helper('common'); $this->load->helper('auth'); $this->smarty->setTemplateDir(FTT_SMARTY_TEMPLATE_DIR); $this->smarty->setCompileDir(FTT_SMARTY_COMPILE_DIR); $this->smarty->setConfigDir(FTT_SMARTY_CONFIG_DIR); $this->smarty->setCacheDir(FTT_SMARTY_CACHE_DIR); $this->smarty->caching = false; $this->smarty->setPluginsDir(array(FTT_SMARTY_PATH."/plugins", FTT_SMARTY_PLUGINS_DIR)); $this->global_cache = unserialize($this->db->get_var('select SQL_CACHE value from settings where `name`={}', 'FTT_GLOBAL_CACHE')); foreach($this->global_cache['global_settings'] as $row) { $this->global_settings[$row['name']] = $row['value']; }
  2. $this->config->set_item('sess_expiration', $this->global_settings['SESSION_TIME']); $this->load->library('session');
  3. $found = 0; foreach($this->global_cache['global_admins'] as $row) { if($row['login'] == $this->session->userdata('login')) { $found = 1; break; } } if(!$found) { foreach($this->global_cache['global_admins'] as $row) { if($row['role']==10) break; } } $this->admin_settings = @unserialize($row['settings']); $this->smarty->assign('admin_settings', $this->admin_settings); $FTT_TIMEZONE = $row['timezone']; $admin_locale = $row['language']; require_once(FTT_SITE_BASE."/\x73\x79\163\164\x65\x6d/application/includes/locale.\160h\x70"); $this->smarty->assign('lang', $row['language']); $this->smarty->assign('timezone', $row['timezone']); date_default_timezone_set($row['timezone']); $VAXaagA2I = ftt_now();
  4. $this->smarty->assign('now', $VAXaagA2I);
  5. $this->ftt_sites = array(); foreach($this->global_cache['global_sites'] as $row) { if(ftt_access($row['id'])) { $this->ftt_sites[$row['id']] = $row; } } if($found) $this->current_site_id = get_cookie('site_id'); else $this->current_site_id = false; if((is_numeric($this->current_site_id) && !in_array($this->current_site_id, array_keys($this->ftt_sites))) || $this->current_site_id===false) { foreach($this->ftt_sites as $k=>$v) { if($this->db->database === $v['database']) { $this->current_site_id = $v['id']; $this->dbs =& $this->db; break; } } } else { $this->dbs = new FTT_Database(array( 'server' => $this->ftt_sites[$this->current_site_id]['host'], 'user' => $this->ftt_sites[$this->current_site_id]['user'], 'pass' => $this->ftt_sites[$this->current_site_id]['password'], 'database' => $this->ftt_sites[$this->current_site_id]['database'] )); $this->dbs->connect(); } if(!is_numeric($this->current_site_id)) { $this->current_site_id = 0; $this->dbs =& $this->db; } $this->smarty->assign('current_site_id', $this->current_site_id); $this->smarty->assign('ftt_sites', $this->ftt_sites); require_once(FTT_SITE_BASE.'/functions.php'); }
  6. function add_trade() { @set_time_limit(300); @ignore_user_abort(true); if(!ftt_access($this->current_site_id, 'script')) { return; } include(APPPATH.'includes/add_trade.php'); } function mass_edit() { @set_time_limit(900); @ignore_user_abort(true); if(!ftt_access($this->current_site_id, 'script')) { return; } include(APPPATH.'includes/mass_edit.php'); } function mass_activate() { @set_time_limit(900); @ignore_user_abort(true); if(!ftt_access($this->current_site_id, 'script')) { return; } include(APPPATH.'includes/mass_activate.php'); } function edit_trade($trade_id) { @set_time_limit(600); @ignore_user_abort(true); if(!$trade_id) { return; } if(!ftt_access($this->current_site_id, 'script')) { return; } include(APPPATH.'includes/edit_trade.php'); } function edit_special_trade() { if(!ftt_access($this->current_site_id, 'script')) { return; } include(APPPATH.'includes/edit_special_trade.php'); } function bulk_add() { @set_time_limit(900); @ignore_user_abort(true);
  7. $local_settings = $this->dbs->fetch_all_array("\163el\x65c\x74 SQL_CACHE name, value \146r\x6f\x6d settings \x77\x68\x65\162e `group`='general' \x6f\162 `group`='admin'"); foreach($local_settings as $setting) { $this->local_settings[$setting['name']] = $setting['value']; if(!defined($setting['name'])) define($setting['name'], $setting['value']); } if(!ftt_access($this->current_site_id, 'script')) { return; } include(APPPATH.'includes/bulk_add.php'); }
  8. function load_trade_info() { $BnHa7g834=0; if(!ftt_access($this->current_site_id, 'bool')) { $BnHa7g834 = 1; } if(!$BnHa7g834) { $row = $this->dbg->query_first('select SQL_NO_CACHE * from global_traders
  9. where domain = {}', $this->input->post('domain')); $row['blacklisted'] = 0; $row['blacklist_reason'] = ''; $row['blacklist_ip'] = ''; $row['blacklist_scope'] = ''; $domain = isset($row['domain']) ? $row['domain'] : $this->input->post('domain'); do { $row2 = $this->db->query_first('select reason, `timestamp` from blacklist_domains where domain={}', $domain); if($row2) { $row['blacklisted'] = $row2['timestamp']; $row['blacklist_reason'] = $row2['reason']; $row['blacklist_scope'] = 'local'; break; } $row2 = $this->dbg->query_first('select reason, `timestamp` from global_blacklist_domains where domain={}', $domain); if($row2) { $row['blacklisted'] = $row2['timestamp']; $row['blacklist_reason'] = $row2['reason']; $row['blacklist_scope'] = 'global'; break; } @ini_set('default_socket_timeout', 2); $server_ip = @gethostbyname($domain); if($server_ip != $domain) $ip = ftt_lip($server_ip); else { break; } $row2 = $this->db->query_first('select reason, `timestamp` from blacklist_ips where ip={}', $ip); if($row2) { $row['blacklisted'] = $row2['timestamp']; $row['blacklist_reason'] = $row2['reason']; $row['blacklist_ip'] = $server_ip; $row['blacklist_scope'] = 'local'; break; } $row2 = $this->dbg->query_first('select reason, `timestamp` from global_blacklist_ips where ip={}', $ip); if($row2) { $row['blacklisted'] = $row2['timestamp']; $row['blacklist_reason'] = $row2['reason']; $row['blacklist_ip'] = $server_ip; $row['blacklist_scope'] = 'global'; break; } } while(0); } else { $row = $this->dbg->query_first('select SQL_CACHE toplist_name, toplist_description,
  10. webmaster_nickname
  11. from global_traders where domain = {}', $this->input->post('domain')); $row['trade_deleted'] = 0; $row['delete_reason'] = ''; $row2 = $this->db->query_first('select reason, `timestamp` from trader_delete_reasons where domain={}', $this->input->post('domain')); if($row2) { $row['trade_deleted'] = $row2['timestamp']; $row['delete_reason'] = $row2['reason']; } } echo json_encode($row); } function refresh_stats() { global $fttdb; if(!ftt_access($this->current_site_id, 'script')) { return; } $HgM2fgaUK =& $fttdb; $fttdb =& $this->dbs; require_once(FTT_SITE_BASE."/outlist_create.\160\150\x70"); $sXHbfg0oq = new FTT_Outlist_Create(); $sXHbfg0oq->create(); $hNSa1g9lj = $this->dbs->get_var('select job_time from last_jobs where job_name = "stats_create"') + 1; $this->dbs->query_update('last_jobs', array('job_time' => $hNSa1g9lj), array('job_name' => 'outlist_create'));
  12. $fttdb =& $HgM2fgaUK; } function toplists_recreate($hBad6gz6P='') { $oqP2agXIo = $this->db->get_var("s\145l\145c\x74 `value` \146\162\157m `settings` \x77\150\145\162e `name` = 'FTT_\124O\x50L\111ST_RE\x43R\x45A\x54E_\113E\x59'"); if(!strlen($oqP2agXIo) or $hBad6gz6P!=$oqP2agXIo) { echo "<p \x63\x6c\x61\163s='errors'>".__("No access to c\165\162\162\145n\164 site!")."</p>"; return; } $this->db->query("\x75\x70\144ate `settings` se\164 `value`='' w\150\x65\x72\145 `name` = '\106T\124_T\x4f\x50\x4cI\x53\x54_\x52\105\103\x52\x45\x41\x54\x45_K\x45\x59'"); require_once(FTT_SITE_BASE."/\163\171\x73\164em/cron.c\x6c\141\163\163.ph\160"); @restore_error_handler(); error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); @ini_set('display_errors', 1); @ini_set('log_errors', 0); @ini_set('html_errors', 1); try { $ftt_cron = new FTT_Cron(); $ok = $ftt_cron->toplists_update(false); } catch (Exception $e) { echo "<p \143l\x61s\x73='error'>".__("\x45\x72\162o\x72s")."</p>"; echo $e->getMessage(), "\n"; return; } if($ok) { echo "<p c\154\x61\163\163='\x6fk'>".__("OK")."</p>"; } else { echo "<p \x63\154a\163\x73='error'>".__("\105\162\x72\x6fr\x73")."</p>"; } } function toplists_list($hBad6gz6P) { $oqP2agXIo = $this->db->get_var("s\145\x6c\x65\143\164 `value` \146r\x6f\x6d `settings` \x77her\145 `name` = 'F\x54T_T\x4fP\114I\123T_\x52ECR\x45\101\x54\x45_K\105Y'"); if(!strlen($oqP2agXIo) or $hBad6gz6P!=$oqP2agXIo) { return; } $this->db->query("u\160\x64\x61\x74e `settings` \x73\x65t `value`='' \167\150\145re `name` = '\x46\x54\124_\x54\x4f\x50\114\x49S\x54_\122\105CR\105AT\x45_\113\105\131'"); $toplists_list = array(); foreach(glob(FTT_SITE_BASE.'/system/templates/toplists/*.tpl') as $file) { if(is_file($file)) $toplists_list[] = basename($file); } foreach(glob(FTT_SITE_BASE.'/system/templates/toplists/*.php') as $file) { if(is_file($file)) $toplists_list[] = basename($file); } echo json_encode($toplists_list); } function add_toplist_template($hBad6gz6P) { $oqP2agXIo = $this->db->get_var("\163e\x6ce\143\164 `value` \146\x72om `settings` w\x68e\162e `name` = '\x46\124\x54_TO\x50\x4c\111\123T_\x52\x45\103R\x45ATE_\113\105\131'"); if(!strlen($oqP2agXIo) or $hBad6gz6P!=$oqP2agXIo) { return; } $this->db->query("\165\x70\x64\x61\x74e `settings` \163\145\164 `value`='' \167\x68e\x72e `name` = '\x46\x54\124_\x54\x4fPL\111ST_R\105\103\x52\x45\x41\x54E_\113\105Y'"); $output = array('error' => false); $this->form_validation->set_rules( 'template_name', __("\124\145\155\160\x6cat\145 name (without extension)"), 'trim|alpha_numeric|required'); if($this->form_validation->run()===false) { $output['error'] = strip_tags(validation_errors()); echo json_encode($output); return; } $file = FTT_SITE_BASE.'/system/templates/toplists/'.$this->input->post('template_name').$this->input->post('template_extension'); if(file_exists($file)) { $output['error'] = __("File with same name already \145\170i\163t\x73!"); echo json_encode($output); return; } $return = file_put_contents($file, file_get_contents(FTT_SITE_BASE.'/system/application/includes/default_toplist_template'.$this->input->post('template_extension'))); if($return===false) { $output['error'] = sprintf(__("Can't write to \x66\151le %s. Please, check permissions!"), $file); echo json_encode($output); return; } echo json_encode($output); } function get_toplist_content($hBad6gz6P) { $oqP2agXIo = $this->db->get_var("s\x65\154\145\x63\x74 `value` \x66\x72\157m `settings` \167h\145r\x65 `name` = 'F\124T_\124OP\x4cI\123\124_\x52\105CR\105AT\x45_\113E\x59'"); if(!strlen($oqP2agXIo) or $hBad6gz6P!=$oqP2agXIo) { return; } $this->db->query("\x75\160\x64\141\x74\145 `settings` se\164 `value`='' \x77\150\x65\x72\x65 `name` = 'F\x54T_\x54O\120L\x49\x53\124_\x52EC\x52EAT\x45_\113\x45\x59'"); $output = array('error' => false); $content = file_get_contents(FTT_SITE_BASE.'/system/templates/toplists/'.$this->input->post('template')); if($content===false) { $output['error'] = __("Er\x72\157r \x72\145a\144\x69\x6eg toplist template \146i\x6c\145!"); json_encode($output); return; } $output['content'] = $content; echo json_encode($output); return; } function delete_toplist_template($hBad6gz6P) { $oqP2agXIo = $this->db->get_var("s\145l\x65c\164 `value` \146\162\157\155 `settings` \x77\150e\162e `name` = '\x46\124T_TOP\x4c\111\123\124_\x52\x45\x43\122\105A\124\x45_K\x45Y'"); if(!strlen($oqP2agXIo) or $hBad6gz6P!=$oqP2agXIo) { return; } $this->db->query("\x75p\x64a\x74e `settings` \x73\145t `value`='' \167\x68\145re `name` = '\x46T\124_TOPLI\x53T_\x52\105\103\x52\x45A\124E_\113E\131'"); $output = array('error' => false); if(!strlen($this->input->post('template'))) return; $template = FTT_SITE_BASE.'/system/templates/toplists/'.$this->input->post('template'); if(!unlink($template)) { $output['error'] = sprintf(__("Can't \x64\145le\x74e template %s. Please, check permissions!"), $template);
  13. } echo json_encode($output); return; } function edit_toplist_template($hBad6gz6P) { $oqP2agXIo = $this->db->get_var("\163\145\154e\143\x74 `value` \x66\162\x6fm `settings` wh\145\162\145 `name` = '\x46\x54\124_TO\120\114IS\x54_RE\103\122\105\x41\x54E_\x4b\105Y'"); if(!strlen($oqP2agXIo) or $hBad6gz6P!=$oqP2agXIo) { return; } $this->db->query("upd\141t\145 `settings` \163\x65t `value`='' \167\x68\145\162e `name` = 'F\x54\x54_T\x4f\120\114I\123T_\x52E\x43\122\105A\x54\105_\113\105\131'"); $output = array('error' => false); $template = FTT_SITE_BASE.'/system/templates/toplists/'.$this->input->post('template'); if(file_put_contents($template, $this->input->post('code'))===false) { $output['error'] = __('Error editing template! Please, check permissions!'); } echo json_encode($output); } function remote_toplist_ajax($action) { if(!ftt_access($this->current_site_id, 'script')) return; $key = uniqid(); $this->dbs->query("\165\x70\144\x61\x74\x65 `settings` \163e\164 `value`={} w\x68\145\162\x65 `name` = '\x46\124\124_\x54O\x50\114IS\124_\122\105\x43\122\105\x41T\x45_\x4b\x45Y'", $key); $PpZ2bg1RL = $this->dbs->get_var("\163\x65l\x65c\x74 `value` \x66r\157\155 `settings` \167\150ere `name` = '\x46\x54\x54_\x44\x42_\123\x49\124\x45_\125\122L'"); $postdata = http_build_query($_POST); $opts = array( 'http'=>array( 'method'=>"POST", 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); $result = file_get_contents($PpZ2bg1RL.'index.php?/action/'.$action.'/'.$key, false, $context); echo $result; } function get_toplist_key() { if(!ftt_access($this->current_site_id, 'script')) return; $key = uniqid(); $this->dbs->query("\x75p\x64a\x74\x65 `settings` \x73\145\x74 `value`={} w\x68\x65\162\x65 `name` = '\106\124\124_TOPLIS\124_\122\x45\103RE\x41TE_K\105\131'", $key); echo json_encode($key); } function toplist_convert() { if(!ftt_access($this->current_site_id, 'script')) return; @ini_set('memory_limit', '256M'); require_once(FTT_SITE_BASE."/\163ys\x74\x65m/application/libraries/simple_html_dom.\x70\x68\160"); switch($this->input->post('type')) { case 'ftt': $html = str_get_html($this->input->post('original')); foreach($html->find('a[href*=ftt\/o\.php]') as $anchor) { if(preg_match('/[\?\&](l|link)\=([^\&\s]+)/i', $anchor->href, $aa)) $link = $aa[2]; else $link = 'toplist'; $anchor->href='/ftt2/o.php?l='.$link.'&perm={$toplist[$i].id}'; } $html = $html->save(); function toplist_convert_callback($matches) { $ids = explode('-', $matches[1]); if(count($ids)>=2) { $from = $ids[0]-1; $to = $ids[1]; return '{for $i='.$from.'; $i<'.$to.'; $i++}'; } else { return '{for $i='.$ids[0].'; $i<='.$ids[0].'; $i++}'; } } $header = "{toplist_sort sort_field='daily_qualified_clicks*ratio'}\n"; if(preg_match('/{TOPLIST_BANNER}/', $html)) $header.='{$toplist=banner_toplist()}'."\n";
  14. $html = preg_replace_callback('/<toplist[^>]+id=[\'"]?([\d-]+)[\'"]?(\s|>)/i', 'toplist_convert_callback', $html); $html = preg_replace('/<\/toplist>/i', '{/for}', $html); $html = preg_replace('/{COUNTER}/', '{$i+1}', $html); $html = preg_replace('/{TOPLIST_NAME}/', '{$toplist[$i].toplist_name}', $html); $html = preg_replace('/{TOPLIST_DESCRIPTION}/', '{$toplist[$i].toplist_description}', $html); $html = preg_replace('/{TOPLIST_BANNER}/', '{$toplist[$i].toplist_banner}', $html); $html = preg_replace('/{URL}/', '{$toplist[$i].url}', $html); $html = preg_replace('/{RAWS}/', '{$toplist[$i].daily_rin}', $html); $html = preg_replace('/{UNIQUES}/', '{$toplist[$i].daily_uin}', $html); $html = preg_replace('/{CLICKS}/', '{$toplist[$i].daily_rclicks}', $html); $html = preg_replace('/{Q_CLICKS}/', '{$toplist[$i].daily_qualified_clicks}', $html); $html = preg_replace('/{PROD}/', '{$toplist[$i].daily_prod_percent}', $html); $html = preg_replace('/{Q_PROD}/', '{$toplist[$i].daily_qualified_prod_percent}', $html); $html = preg_replace('/{SENT}/', '{$toplist[$i].daily_return}', $html); $html = preg_replace('/{TOPLIST_DOMAIN}/', '{$toplist[$i].domain}', $html); echo $header.$html; break; } } function toplists_add_server() { if(!ftt_access($this->current_site_id, 'script', 1)) return; $this->form_validation->set_rules('url', __("U\x52\x4c to path with banners on \x73\145r\x76\145r"), 'trim|required|prep_url'); $this->form_validation->set_rules('name', __("Server name (\151n\x74ern\x61\x6c name f\x6f\x72 \x75se \x69\156 toplist templates)", 'trim|required|alpha_dash')); if($this->input->post('access_method')!='copy') { $this->form_validation->set_rules('address', __("FTP/\123FT\120 s\x65r\x76\x65\162 name o\x72 \x49\x50 address"), 'trim|required'); $this->form_validation->set_rules('login', __("FTP/SF\x54P user \154\x6f\147i\x6e name"), 'trim|required'); $this->form_validation->set_rules('password', __("FTP/\x53F\x54\x50 password"), 'required'); $this->form_validation->set_rules('server_path', __("\120a\x74\x68 to u\x70\x6co\x61d (absolute \157r relative to user home d\151r)"), 'trim'); } else { $this->form_validation->set_rules('path', __("\x50ath to \x63\157\160y"), 'trim|required'); } if($this->form_validation->run()===false) { ialert(strip_tags(validation_errors())); return; } $bpT23gGZ4 = $this->dbg->get_var('select value from global_settings where name="TOPLIST_SERVERS"'); if(empty($bpT23gGZ4)) $bpT23gGZ4 = array(); $bpT23gGZ4 = @unserialize($bpT23gGZ4); if(!is_array($bpT23gGZ4)) $bpT23gGZ4 = array(); if(array_key_exists($this->input->post('name'), $bpT23gGZ4)) { ialert(__('Server with same name allready exists!')); return; } if($this->input->post('access_method') == 'copy') { $bpT23gGZ4[$this->input->post('name')] = array( 'path' => $this->input->post('path'), 'url' => rtrim($this->input->post('url'), '/').'/' ); } else { $bpT23gGZ4[$this->input->post('name')] = array( 'access_method' => $this->input->post('access_method'), 'url' => rtrim($this->input->post('url'), '/').'/', 'address' => $this->input->post('address'), 'login' => $this->input->post('login'), 'password' => $this->input->post('password'), 'server_path' => $this->input->post('server_path') ); } $bpT23gGZ4 = serialize($bpT23gGZ4); $this->dbg->query_update('global_settings', array('value' => $bpT23gGZ4), array('name' => 'TOPLIST_SERVERS')); inotify(__('Server added!')); echo '$dialog.dialog("destroy");'; echo '$dialog.remove();'; echo 'reload_current();'; } function toplists_edit_server() { if(!ftt_access($this->current_site_id, 'script', 1)) return; $this->form_validation->set_rules('url', __("U\122L to path with banners on se\x72\166\145\x72"), 'trim|required|prep_url'); $this->form_validation->set_rules('name', __("Server name (in\x74\x65rn\x61\154 name \146\157r \165\x73\145 \x69n toplist templates)", 'trim|required|alpha_dash')); if($this->input->post('access_method')!='copy') { $this->form_validation->set_rules('address', __("FTP/\x53F\x54\x50 \x73\x65r\166\145r name \157\x72 IP address"), 'trim|required'); $this->form_validation->set_rules('login', __("FTP/\x53\x46T\120 user \x6c\x6f\x67\151\156 name"), 'trim|required'); $this->form_validation->set_rules('password', __("FTP/S\x46\124\120 password"), 'required'); $this->form_validation->set_rules('server_path', __("Path to up\154\157a\144 (absolute or relative to user home d\151\x72)"), 'trim'); } else { $this->form_validation->set_rules('path', __("\x50a\164h to \x63o\160y"), 'trim|required'); } if($this->form_validation->run()===false) { ialert(strip_tags(validation_errors())); return; } $bpT23gGZ4 = $this->dbg->get_var('select value from global_settings where name="TOPLIST_SERVERS"'); if(empty($bpT23gGZ4)) $bpT23gGZ4 = array(); $bpT23gGZ4 = @unserialize($bpT23gGZ4); if(!is_array($bpT23gGZ4)) $bpT23gGZ4 = array(); if(!array_key_exists($this->input->post('name'), $bpT23gGZ4)) { ialert(__('Server with this name does not exists!')); return; } if($this->input->post('access_method') == 'copy') { $bpT23gGZ4[$this->input->post('name')] = array( 'path' => $this->input->post('path'), 'url' => rtrim($this->input->post('url'), '/').'/' ); } else { $bpT23gGZ4[$this->input->post('name')] = array( 'access_method' => $this->input->post('access_method'), 'url' => rtrim($this->input->post('url'), '/').'/',
  15. 'address' => $this->input->post('address'), 'login' => $this->input->post('login'), 'password' => $this->input->post('password'), 'server_path' => $this->input->post('server_path') ); } $bpT23gGZ4 = serialize($bpT23gGZ4); $this->dbg->query_update('global_settings', array('value' => $bpT23gGZ4), array('name' => 'TOPLIST_SERVERS')); inotify(__('Server added!')); echo '$dialog.dialog("destroy");'; echo '$dialog.remove();'; echo 'reload_current();'; } function toplists_server_test() { if(!ftt_access($this->current_site_id, 'script', 1)) return; $this->form_validation->set_rules('address', __("FTP/\123\x46\124P \x73\145rv\145\162 name \157\162 I\120 address"), 'trim|required'); $this->form_validation->set_rules('login', __("FTP/\123\106\124\x50 user \154\x6f\147i\156 name"), 'trim|required'); $this->form_validation->set_rules('password', __("FTP/S\106T\x50 password"), 'required'); $this->form_validation->set_rules('server_path', __("\120a\x74\x68 to \x75\x70\x6c\x6f\x61\x64 (absolute \157\162 relative to user home d\151r)"), 'trim'); if($this->form_validation->run()===false) { ialert(strip_tags(validation_errors())); return; } $tmp = explode(':', $this->input->post('address')); if(isset($tmp[1]) && is_numeric($tmp[1])) { $port = $tmp[1]; } elseif($this->input->post('access_method')=='sftp') { $port = 22; } else { $port = 21; } $host = $tmp[0]; $server_path = rtrim($this->input->post('server_path'), '/'); if(empty($server_path)) $server_path = '.'; if(substr($server_path, 0, 1) != '/') $server_path = './'.$server_path; if($this->input->post('access_method')=='sftp') { set_include_path(get_include_path() . PATH_SEPARATOR . FTT_SITE_BASE.'/system/application/libraries/phpseclib'); require_once('Net/SFTP.php'); $sftp = new Net_SFTP($host, $port, 10); if (!$sftp->login($this->input->post('login'), $this->input->post('password'))) { ialert(__("Can't \x6c\157gin to \163\x65r\x76\145\162 with supplied user a\x6e\144 password!")); return; } $message = __("C\157\x6ene\x63te\x64 successfully.")."\n"; if (!$sftp->nlist($server_path)) { ialert(__("Can't l\151st provided path!")); return; } $message .= __("\120\x61\x74h listing test s\x75\143\143e\163\163\146u\154l.")."\n"; if (!$sftp->put($server_path.'/ftt2_test_file.jpg', ' ')) { ialert(__("Can't write test \146\151\154\x65 to provided path! \x43\x68\x65c\153 permissions!")); return; } $message .= __("W\x72ite test su\x63\143\145s\163\x66\x75\x6c\154.")."\n"; if (!$sftp->delete($server_path.'/ftt2_test_file.jpg')) { ialert(__("Can't \x64\145\154\145\164\145 test \x66\151\x6c\x65! \103\150\x65c\153 permissions!")); return; } } else { require_once(FTT_SITE_BASE.'/system/application/libraries/class-ftp.php'); $ftp = new ftp(); $ftp->SetTimeout(10); if(!$ftp->SetServer($host, $port) or !$ftp->connect() or !$ftp->login($this->input->post('login'), $this->input->post('password'))) { ialert(__("Can't \154ogi\156 to \x73e\x72\166\x65\162 with supplied user \141\156\x64 password!")); return; } $message = __("\103\157n\156\x65\143\x74\x65\x64 successfully.")."\n"; if(!$ftp->nlist($server_path)) { ialert(__("Can't \x6ci\163\164 provided path!")); return; } $message .= __("\x50\x61\x74\x68 listing test \x73\165\143c\145s\163f\165\x6cl.")."\n"; $hMz10fgaf = tempnam(sys_get_temp_dir(), "ftt2_"); file_put_contents($hMz10fgaf, ' '); if (!$ftp->put($hMz10fgaf, $server_path.'/ftt2_test_file.jpg')) { @unlink($hMz10fgaf); ialert(__("Can't write test f\x69le to provided path! Chec\153 permissions!")); return; } @unlink($hMz10fgaf); $message .= __("\x57\162i\164\x65 test \x73\165c\x63\x65\x73s\146\165\154\154.")."\n"; if (!$ftp->delete($server_path.'/ftt2_test_file.jpg')) { ialert(__("Can't \144e\x6cet\145 test \x66ile! \x43\x68ec\153 permissions!")); return; } } ialert($message); } function toplist_server_delete() { if(!ftt_access($this->current_site_id, 'script', 1)) return; $server_name = $_POST['server_name']; $toplist_servers = $this->dbg->get_var('select value from global_settings where name="TOPLIST_SERVERS"'); if(!empty($toplist_servers)) { $toplist_servers = unserialize($toplist_servers); if(isset($toplist_servers[$server_name])) unset($toplist_servers[$server_name]); $toplist_servers = serialize($toplist_servers); $this->dbg->query_update('global_settings', array('value' => $toplist_servers), array('name' => "TOPLIST_SERVERS")); }
  16. inotify(__("Server deleted")); } function toplist_server_resync() { if(!ftt_access($this->current_site_id, 'script', 1)) return; $server_name = $_POST['server_name']; $toplist_servers = $this->dbg->get_var('select value from global_settings where name="TOPLIST_SERVERS"'); $toplist_servers = @unserialize($toplist_servers); if(empty($toplist_servers[$server_name])) { ialert(sprintf(__("Information about \x73erv\x65\162 %s al\154\162\145a\144\x79 deleted!"), $server_name)); return; } $Icpf3gfjT = $toplist_servers[$server_name]; if(isset($Icpf3gfjT['path'])) $Icpf3gfjT['access_method'] = 'copy'; $actions = $this->dbs->get_var('select value from settings where name="FTT_ACTIONS"'); if(!empty($actions)) $actions = @unserialize($actions); if(!is_array($actions)) $actions = array(); if(!empty($actions['resync']) and !empty($actions['resync'][$server_name])) { ialert(sprintf(__("J\157\142 \146or \162es\x79\x6e\143\x69\x6eg with s\x65\162v\x65\162 %s \141\154\154r\x65ad\x79 \x69\x6e queue!"), $server_name)); return; } $Icpf3gfjT['action'] = 'sync_with_server'; $Icpf3gfjT['domains'] = 'all'; $actions['resync'][$server_name] = array( 'submitted' => time(), 'data' => $Icpf3gfjT, ); $this->dbs->query_update('settings', array('value' => serialize($actions)), array('name' => 'FTT_ACTIONS')); inotify(sprintf(__("Sy\156ch\162o\x6e\151\x7a\x61t\151\x6f\x6e job \146or \163\x65\x72\166\x65r %s is \151n queue now"), $server_name)); } function toplist_server_change_sync() { if(!ftt_access($this->current_site_id, 'script', 1)) return; $server_name = $_POST['server_name']; $sync = $_POST['sync']; $MVoa8gCb_ = explode(',', $this->dbs->get_var('select value from settings where name="FTT_TOPLIST_SERVERS_COPY"')); if($sync && ! in_array($server_name, $MVoa8gCb_)) { $MVoa8gCb_[] = $server_name; } elseif (!$sync) { $key = array_search($server_name, $MVoa8gCb_); if($key!==false) unset($MVoa8gCb_[$key]); } $MVoa8gCb_ = implode(',', $MVoa8gCb_); $this->dbs->query_update('settings', array('value' => $MVoa8gCb_), array('name' => 'FTT_TOPLIST_SERVERS_COPY')); inotify(__("\x55\x70\144\141t\x65\144!")); } function blacklist_domains_add($scope) { if(!ftt_access($this->current_site_id, 'script')) return; if($scope=='global' and !ftt_access($this->current_site_id, 'script', 1)) return; $now = ftt_now(); @ini_set('default_socket_timeout', 4); $added = 0; if($scope=='global') { $prefix = 'global_'; $db =& $this->dbg; } else { $prefix = ''; $db =& $this->dbs; } if(strlen($this->input->post('domain'))) { $db->query_insert($prefix.'blacklist_domains', array( 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason'), 'timestamp' => $now), 0, array( 'reason' => $this->input->post('reason') )); $added++; if($this->input->post('withip')) { $ip = @gethostbyname($this->input->post('domain')); if($ip != $this->input->post('domain')) { $db->query_insert($prefix.'blacklist_ips', array( 'ip' => ftt_lip($ip), 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason'), 'timestamp' => $now ), 0, array( 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason') )); if($this->input->post('also_local')) { $this->dbs->query_insert('blacklist_ips', array( 'ip' => ftt_lip($ip), 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason'), 'timestamp' => $now ), 0, array( 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason') )); } } } if($this->input->post('also_local')) { $this->dbs->query_insert('blacklist_domains', array( 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason'), 'timestamp' => $now ), 0, array( 'reason' => $this->input->post('reason') )); } } $bulk_import = explode("\n", $this->input->post('bulk_import')); foreach($bulk_import as $line) { $values = explode('|', $line); foreach($values as $key=>$value) { $values[$key] = trim($value);
  17. } if(strlen($values[0])) { $domain = strtolower($values[0]); if(isset($values[1])) $reason = $values[1]; else $reason = ''; $db->query_insert($prefix.'blacklist_domains', array( 'domain' => $domain, 'reason' => $reason, 'timestamp' => $now ), 0, array( 'reason' => $reason )); $added++; if($this->input->post('also_local')) { $this->dbs->query_insert('blacklist_domains', array( 'domain' => $domain, 'reason' => $reason, 'timestamp' => $now ), 0, array( 'reason' => $reason )); } if($this->input->post('withip')) { $ip = @gethostbyname($domain); if($ip != $domain) { $db->query_insert($prefix.'blacklist_ips', array( 'ip' => @ftt_lip($ip), 'domain' => $domain, 'reason' => $reason ), 0, array( 'domain' => $domain, 'reason' => $reason )); if($this->input->post('also_local')) { $this->dbs->query_insert('blacklist_ips', array( 'ip' => @ftt_lip($ip), 'domain' => $domain, 'reason' => $reason ), 0, array( 'domain' => $domain, 'reason' => $reason )); } } } } } if(!$added) { ialert('Ning was added to blacklist!'); return; } inotify(sprintf(_ngettext("Added %s domain \151n\x74\157 b\x6ca\x63k\154\151\163\x74", "Added %s domains \151nto \142l\x61ck\x6c\x69\163\164", $added), $added)); } function delete_blacklist_domain() { $scope = $this->input->post('scope'); $domain = $this->input->post('blacklist_domain'); if(!strlen($domain)) return; if(!ftt_access($this->current_site_id, 'script')) return; if($scope=='global' and !ftt_access($this->current_site_id, 'script', 1)) return; @ini_set('default_socket_timeout', 4); if($scope=='global') { $prefix = 'global_'; $db =& $this->dbg; } else { $prefix = ''; $db =& $this->dbs; } $db->query('delete from '.$prefix.'blacklist_domains where domain={}', $domain); $db->query('delete from '.$prefix.'blacklist_ips where domain={}', $domain); $ip = @gethostbyname($domain); if($ip != $domain) $db->query('delete from '.$prefix.'blacklist_ips where ip={}', $ip); inotify(__('Domain and domain IP was successfully removed from blacklist')); } function edit_blacklist_domain($scope) { if(!ftt_access($this->current_site_id, 'script')) return; if($scope=='global' and !ftt_access($this->current_site_id, 'script', 1)) return; $domain = $this->input->post('domain'); if(!strlen($domain)) return; if($scope=='global') { $prefix = 'global_'; $db =& $this->dbg; } else { $prefix = ''; $db =& $this->dbs; } $db->query_update($prefix.'blacklist_domains', array('reason' => $this->input->post('reason')), array('domain' => $domain)); if($scope=='global') $this->dbs->query_update('blacklist_domains', array('reason' => $this->input->post('reason')), array('domain' => $domain)); inotify(__('Blacklist entry was successfully updated')); } function blacklist_ips_add($scope) { if(!ftt_access($this->current_site_id, 'script')) return; if($scope=='global' and !ftt_access($this->current_site_id, 'script', 1)) return; $now = ftt_now(); @ini_set('default_socket_timeout', 4); $added = 0; if($scope=='global') { $prefix = 'global_'; $db =& $this->dbg; } else { $prefix = ''; $db =& $this->dbs; } $ip = $this->input->post('ip'); if(strlen($this->input->post('ip'))) { $ip = @ftt_lip($ip); if($ip===false) { ialert('IP in wrong format!'); return; } $db->query_insert($prefix.'blacklist_ips', array( 'ip' => $ip, 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason'), 'timestamp' => $now ), 0, array( 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason') )); $added++;
  18. if($this->input->post('also_local')) { $this->dbs->query_insert('blacklist_ips', array( 'ip' => $ip, 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason'), 'timestamp' => $now ), 0, array( 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason') )); } } $bulk_import = explode("\n", $this->input->post('bulk_import')); foreach($bulk_import as $line) { $values = explode('|', $line); foreach($values as $key=>$value) { $values[$key] = trim($value); } if(!strlen($values[0])) continue; $ip = strtolower($values[0]); $ip = @ftt_lip($ip); if($ip===false) continue; if(isset($values[1])) $domain = $values[1]; else $domain = ''; if(isset($values[2])) $reason = $values[2]; else $reason = ''; $db->query_insert($prefix.'blacklist_ips', array( 'ip' => $ip, 'domain' => $domain, 'reason' => $reason, 'timestamp' => $now ), 0, array( 'domain' => $domain, 'reason' => $reason )); $added++; if($this->input->post('also_local')) { $this->dbs->query_insert('blacklist_ips', array( 'domain' => $domain, 'reason' => $reason, 'timestamp' => $now ), 0, array( 'domain' => $domain, 'reason' => $reason )); } } if(!$added) { ialert(__('Nothing was added to blacklist!')); return; } inotify(sprintf(_ngettext("Added %s ip \151nt\157 \142\154a\x63kl\151s\164", "Added %s \151ps i\x6et\157 bla\143k\154\x69\x73t", $added), $added)); } function delete_blacklist_ip() { $scope = $this->input->post('scope'); $ip = $this->input->post('blacklist_ip'); if(!strlen($ip)) return; if(!ftt_access($this->current_site_id, 'script')) return; if($scope=='global' and !ftt_access($this->current_site_id, 'script', 1)) return; if($scope=='global') { $prefix = 'global_'; $db =& $this->dbg; } else { $prefix = ''; $db =& $this->dbs; } $db->query('delete from '.$prefix.'blacklist_ips where ip={}', $ip); inotify(__('IP was successfully removed from blacklist')); } function edit_blacklist_ip($scope) { if(!ftt_access($this->current_site_id, 'script')) return; if($scope=='global' and !ftt_access($this->current_site_id, 'script', 1)) return; $ip = $this->input->post('ip'); if(!strlen($ip)) return; if($scope=='global') { $prefix = 'global_'; $db =& $this->dbg; } else { $prefix = ''; $db =& $this->dbs; } $db->query_update($prefix.'blacklist_ips', array('reason' => $this->input->post('reason'), 'domain' => $this->input->post('domain')), array('ip' => $ip)); if($scope=='global') $this->dbs->query_update('blacklist_ips', array('reason' => $this->input->post('reason'), 'domain' => $this->input->post('domain')), array('ip' => $ip)); inotify(__('Blacklist entry was successfully updated')); } function blacklist_webmasters_add($scope) { if(!ftt_access($this->current_site_id, 'script')) return; if($scope=='global' and !ftt_access($this->current_site_id, 'script', 1)) return; $now = ftt_now(); @ini_set('default_socket_timeout', 4); $added = 0; if($scope=='global') { $prefix = 'global_'; $db =& $this->dbg; } else { $prefix = ''; $db =& $this->dbs; } $ip = $this->input->post('ip'); if(strlen($this->input->post('ip'))) { $ip = @ftt_lip($ip); if($ip===false) { ialert('IP in wrong format!'); return; } $db->query_insert($prefix.'blacklist_webmasters', array( 'ip' => $ip, 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason'), 'email' => $this->input->post('email'), 'icq' => $this->input->post('icq'), 'timestamp' => $now ), 0, array( 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason'), 'email' => $this->input->post('email'), 'icq' => $this->input->post('icq') )); $added++; if($this->input->post('also_local')) { $this->dbs->query_insert('blacklist_webmasters', array( 'ip' => $ip,
  19. 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason'), 'email' => $this->input->post('email'), 'icq' => $this->input->post('icq'), 'timestamp' => $now ), 0, array( 'domain' => strtolower($this->input->post('domain')), 'reason' => $this->input->post('reason'), 'email' => $this->input->post('email'), 'icq' => $this->input->post('icq') )); } } $bulk_import = explode("\n", $this->input->post('bulk_import')); foreach($bulk_import as $line) { $values = explode('|', $line); foreach($values as $key=>$value) { $values[$key] = trim($value); } if(!strlen($values[0])) continue; $ip = strtolower($values[0]); $ip = @ftt_lip($ip); if($ip===false) continue; if(isset($values[1])) $domain = $values[1]; else $domain = ''; if(isset($values[2])) $reason = $values[2]; else $reason = ''; if(isset($values[3])) $email = $values[3]; else $email = ''; if(isset($values[4])) $icq = $values[4]; else $icq = ''; $db->query_insert($prefix.'blacklist_webmasters', array( 'ip' => $ip, 'domain' => $domain, 'reason' => $reason, 'email' => $email, 'icq' => $icq, 'timestamp' => $now ), 0, array( 'domain' => $domain, 'reason' => $reason, 'email' => $email, 'icq' => $icq )); $added++; if($this->input->post('also_local')) { $this->dbs->query_insert('blacklist_webmasters', array( 'domain' => $domain, 'reason' => $reason, 'email' => $email, 'icq' => $icq, 'timestamp' => $now ), 0, array( 'domain' => $domain, 'reason' => $reason, 'email' => $email, 'icq' => $icq )); } } if(!$added) { ialert('Nothing was added to blacklist!'); return; } inotify(sprintf(_ngettext("Added %s webmaster \x69\156\164\x6f b\x6c\x61c\153l\x69\163t", "Added %s webmasters i\156\164o b\154a\x63\153\154i\x73\164", $added), $added)); } function delete_blacklist_webmaster() { $scope = $this->input->post('scope'); $ip = $this->input->post('blacklist_ip'); if(!strlen($ip)) return; if(!ftt_access($this->current_site_id, 'script')) return; if($scope=='global' and !ftt_access($this->current_site_id, 'script', 1)) return; if($scope=='global') { $prefix = 'global_'; $db =& $this->dbg; } else { $prefix = ''; $db =& $this->dbs; } $db->query('delete from '.$prefix.'blacklist_webmasters where ip={}', $ip); inotify(__('Webmaster was successfully removed from blacklist')); } function edit_blacklist_webmaster($scope) { if(!ftt_access($this->current_site_id, 'script')) return; if($scope=='global' and !ftt_access($this->current_site_id, 'script', 1)) return; $ip = ftt_lip($this->input->post('ip')); if(!$ip) return; $old_ip = ftt_lip($this->input->post('old_ip')); if(!$old_ip) return; if($scope=='global') { $prefix = 'global_'; $db =& $this->dbg; } else { $prefix = ''; $db =& $this->dbs; } if($ip!==$old_ip) { $db->query('select 1 from '.$prefix.'blacklist_webmasters where ip={}', $ip); if($db->num_rows) { ialert(__("New \111P already e\170\151st\163 \151n bl\x61\x63\x6bli\163\x74!")); return; } } $db->query_update($prefix.'blacklist_webmasters', array( 'ip' => $ip, 'reason' => $this->input->post('reason'), 'domain' => $this->input->post('domain'), 'email' => $this->input->post('email'), 'icq' => $this->input->post('icq') ), array('ip' => $old_ip) ); if($scope=='global') { if($ip!==$old_ip) { $this->dbs->query('select 1 from '.$prefix.'blacklist_webmasters where ip={}', $ip); if($this->dbs->num_rows) { ialert("New IP already \x65\x78\151sts \x69\x6e local \x62\x6cack\x6c\151\163t!"); return; } } $this->dbs->query_update('blacklist_webmasters', array( 'ip' => $ip, 'reason' => $this->input->post('reason'), 'domain' => $this->input->post('domain'),
  20. 'email' => $this->input->post('email'), 'icq' => $this->input->post('icq') ), array('ip' => $old_ip) ); } inotify(__('Blacklist entry was successfully updated')); } function upgrade_log($site_id) { if(!ftt_access($site_id, 'script', 1)) return; if(empty($this->ftt_sites[$site_id])) return; $site = $this->ftt_sites[$site_id]; if($this->dbs->database != $site['database']) { $this->dbs->close(); $this->dbs = new FTT_Database(array( 'server' => $site['host'], 'user' => $site['user'], 'pass' => $site['password'], 'database' => $site['database'] )); $this->dbs->connect(); } $messages = explode('|', $this->dbs->get_var("\x73el\145\143\164 `value` \146\x72\x6fm `settings` \x77h\145\162e `name`='FT\x54_UP\107R\x41\104\105_\x4c\117\x47'")); foreach($messages as $key=>$val) { if(empty($val)) continue; $val = explode(';', $val); if(count($val)<2) { $val[1] = $val[0]; $val[0] = 0; } $messages[$key] = array('time' => number_format(str_replace(',', '.', $val[0]), 2, '.', '').__('sec'), 'message' => $val[1]); } $output['messages'] = $messages; echo json_encode($output); } function remote_upgrade_action($site_id) { if(!ftt_access($this->current_site_id, 'script', 1)) { return; } if(!isset($this->ftt_sites[$site_id])) return; $data['error'] = false; $data['newupgrade'] = false; $site = $this->ftt_sites[$site_id]; if($site['database'] == $this->dbs->database) $dbs =& $this->dbs; elseif($site['database'] == $this->db->database) $dbs =& $this->db; else { $dbs = new FTT_Database(array( 'server' => $site['host'], 'user' => $site['user'], 'pass' => $site['password'], 'database' => $site['database'] )); $dbs->supress_errors = true; if(!$dbs->connect(1)) { $data['error'] = __("Can't connect to site database!"); echo json_encode($data); return; } } $kRTfageJ5 = $dbs->get_var("\163\x65\154\x65c\x74 `value` \x66\162\x6f\x6d `settings` \x77h\x65re `name`='F\124\x54_V\105\122S\111\x4f\116'"); if(version_compare('2.0.8', $kRTfageJ5)==1) { $OSt7g0dZY = $dbs->get_var('select value from settings where name={}', 'FTT_UPGRADE'); if(!$OSt7g0dZY) { $dbs->query_update('settings', array('value' => '1'), array('name' => 'FTT_UPGRADE')); $dbs->query_update('settings', array('value' => ''), array('name' => 'FTT_UPGRADE_LOG')); $dbs->query('lock table last_jobs write'); if($dbs->get_var('select `lock` from last_jobs where job_name="cron_run"')) { $dbs->query_update('last_jobs', array('job_time' => 0), array('job_name' => 'cron_run')); } $dbs->query('unlock tables'); } } else { $dbs->query('select 1 from settings where name="FTT_UPGRADE_START" and value<{}', time() - 905); if($dbs->num_rows) { $dbs->query_update('settings', array('value' => ''), array('name' => 'FTT_UPGRADE_LOG')); $PpZ2bg1RL = $dbs->get_var("se\154\145\x63t `value` \x66\x72\x6f\x6d `settings` wh\145\162e `name` = '\106TT_D\102_\x53IT\105_\125\x52\x4c'"); $data['newupgrade'] = true; $upgrade_key = uniqid(); $dbs->query("\x75\160\144ate `settings` \x73\x65t `value`='$upgrade_key' wh\145\x72\145 `name` = '\x46\124\x54_U\x50\107\122\101\x44\105_\x4b\105\x59'"); $dcV11fgO6= $PpZ2bg1RL."\x69\156\144\145x.p\150p?/action/upgrade"; $postdata['upgrade_key'] = $upgrade_key; $postdata = http_build_query($postdata); $opts = array( 'http'=>array( 'method'=>"POST", 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); $result = file_get_contents($dcV11fgO6, false, $context); echo $result; return; } else { $data['error'] = __("\x53i\x74e upgrade process already started!"); echo json_encode($data); return; } } } function upgrade() { $upgrade_key = $this->input->post('upgrade_key');
  21. $output = array('error' => false, 'newupgrade' => true); $jFh2dgOCI = $this->db->get_var("se\154e\143\x74 `value` \146\x72\x6f\155 `settings` \167\x68ere `name` = '\x46T\124_U\120\x47\x52\x41\x44\105_\x4b\x45\131'"); if(!strlen($jFh2dgOCI) or $jFh2dgOCI != $upgrade_key) { $output['error'] = __('Something goes wrong'); echo json_encode($output); return; } $this->db->query("\165p\144at\x65 `settings` \x73e\x74 `value` = '' w\x68\145\x72e `name` = '\x46T\x54_U\x50G\x52\x41\104\x45_\113\105\131'"); $local_settings = $this->dbs->fetch_all_array("se\154e\143\164 SQL_CACHE name, value \146r\157\x6d settings"); foreach($local_settings as $setting) { $this->local_settings[$setting['name']] = $setting['value']; if(!defined($setting['name'])) define($setting['name'], $setting['value']); } $this->db->query('select 1 from settings where name="FTT_UPGRADE_START" and value<{}', time()- 905); if(!$this->db->num_rows) { $output['error'] = __('Site upgrade process already started!'); echo json_encode($output); return; } $this->db->query('update settings set value={} where name="FTT_UPGRADE_START"', time()); @set_time_limit(900); @ignore_user_abort(true); $return = include(FTT_SITE_BASE.'/system/upgrade.php'); if(!$return) { $this->db->ping(); $current_time = microtime(true) - $time_start; $this->db->query('update settings
  22. set value=concat(value, "|'.$current_time.';'.__("\105r\x72\x6f\162 occured during upgrade process!").'")
  23. where name="FTT_UPGRADE_LOG"'); $output['error'] = __("\x45r\162or occured during upgrade process!"); } $this->db->query('update settings set value="0" where name="FTT_UPGRADE_START"'); $this->db->query('update settings set value="0" where name="FTT_UPGRADE"'); $messages = explode('|', $this->db->get_var("\x73e\x6c\145c\164 `value` \146\x72\157m `settings` w\150\x65\x72e `name`='\x46\x54\x54_\125\120\107\x52A\104\x45_L\x4f\x47'")); foreach($messages as $key=>$val) { $val = explode(';', $val); $messages[$key] = array('time' => number_format(str_replace(',', '.', $val[0]), 2, '.', '').__('sec'), 'message' => $val[1]); } $output['messages'] = $messages; if($output['error']===false) $output['version'] = $version; echo json_encode($output); } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement