Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

von821

Newbie
  
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

von821's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Week One Done
  • One Month Later
  • One Year In
  • Conversation Starter

Recent Badges

1

Reputation

  1. правильный код public function refresh($force = false) { $currencies = array(); if ($force) { $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "'"); } else { $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "' AND date_modified < '" . $this->db->escape(date('Y-m-d H:i:s', strtotime('-1 day'))) . "'"); } foreach ($query->rows as $result) { $currencies[$result['code']] = $result['value']; } if ($currencies) { $xml_data = $this->cache->get('currencies'); if (empty($xml_data)) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'http://www.cbr.ru/scripts/XML_daily.asp'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $content = curl_exec($curl); curl_close($curl); if ($content) { $xml_data = json_decode( json_encode( (array)simplexml_load_string($content) ), true ); file_put_contents( DIR_CACHE . 'cache.currencies.' . strtotime('tomorrow'), serialize($xml_data) ); } else { $this->log->write('Automatic currency update failed: Link is broken or empty data feed!'); return false; } } $date_modified = date('Y-m-d H:i:s'); if ( isset($xml_data['@attributes']) && isset($xml_data['@attributes']['Date']) ) { $date_modified = date('Y-m-d H:i:s', strtotime($xml_data['@attributes']['Date']) ); } if ( isset($xml_data['Valute']) ) { foreach ($xml_data['Valute'] as $Valute) { if ( isset($currencies[$Valute['CharCode']]) && isset($Valute['Value'])) { $value = floatval( str_replace(',', '.', $Valute['Value']) ); if ($value) { $this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . 1/($value/$Valute['Nominal']) . "', date_modified = '" . $this->db->escape($date_modified) . "' WHERE code = '" . $this->db->escape($Valute['CharCode']) . "'"); } unset($currencies[$Valute['CharCode']]); } if (empty($currencies)) { break; } } $this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '1.00000', date_modified = '" . $this->db->escape($date_modified) . "' WHERE code = '" . $this->db->escape($this->config->get('config_currency')) . "'"); $this->cache->delete('currency'); } else { $this->log->write('Automatic currency update failed: Unable to parse data feed!'); $this->cache->delete('currencies'); } } }
  2. скачал. не отображается в модулях., только в модификациях. права на модуль поставил. как включить модуль?
  3. Проблема в том что все перевилось в шаблоне. но на главную страницу сайта не заходит. все остальные страницы в порядке
×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.