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

playou

Newbie
  
  • Posts

    10
  • Joined

  • Last visited

Recent Profile Visitors

1,183 profile views

playou's Achievements

Rookie

Rookie (2/14)

  • First Post
  • Collaborator
  • Conversation Starter
  • Week One Done
  • One Month Later

Recent Badges

0

Reputation

  1. <?php final class MySQL { private $link; public function __construct($hostname, $username, $password, $database) { if (!$this->link = ($GLOBALS["___mysqli_ston"] = mysqli_connect($hostname, $username, $password))) { trigger_error('Error: Could not make a database link using ' . $username . '@' . $hostname); } if (!((bool)mysqli_query( $this->link, "USE $database"))) { trigger_error('Error: Could not connect to database ' . $database); } mysqli_query( $this->link, "SET NAMES 'utf8'"); mysqli_query( $this->link, "SET CHARACTER SET utf8"); mysqli_query( $this->link, "SET CHARACTER_SET_CONNECTION=utf8"); mysqli_query( $this->link, "SET SQL_MODE = ''"); } public function query($sql) { if ($this->link) { if(!defined('IS_ADMIN')){ $limit = 7; $expire_default = 3600; $expire_main = 3600 * 24 * 30; $expire_product = 3600 * 7; $tag_cache = array( 'main' => array( 'expire' => false, ), 'Currency::__construct' => array( 'expire' => $expire_main, 'tag' => 'main', ), 'Weight::__construct' => array( 'expire' => $expire_main, 'tag' => 'main', ), 'Length::__construct'=> array( 'expire' => $expire_main, 'tag' => 'main', ), 'ModelDesignLayout::getLayout' => array( 'expire' => $expire_main, 'tag' => 'main', ), 'ModelSettingExtension::getExtensions' => array( 'expire' => $expire_main, 'tag' => 'main', ), 'ModelDesignBanner::getBanner' => array( 'expire' => $expire_main, 'tag' => 'main', ), 'ModelCatalogProduct::getTotalProducts' => array( 'expire' => $expire_product, 'tag' => 'product', ), 'ControllerCommonSeoUrl::rewrite' => array( 'expire' => $expire_product, 'tag' => 'product', ), 'ControllerCommonSeoUrl::rewrite' => array( 'expire' => $expire_product, 'tag' => 'product', ), 'ModelCatalogCategory::getCategories'=> array( 'expire' => $expire_product, 'tag' => 'product', ), ); if(!Staticstore::get('expire_cache')){ mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM " . DB_PREFIX . "cache WHERE expire < '" . time(true) . "' LIMIT $limit"); Staticstore::set('expire_cache', true); } $caller = debug_backtrace(); $hash = md5($sql); $method = (!empty($caller[2]['class']) ? $caller[2]['class'].'::'.$caller[2]['function'] : 'main'); $expire = (isset($tag_cache[$method])) ? (($tag_cache[$method]['expire']) ? time(true) + $tag_cache[$method]['expire'] : false) : time(true) + $expire_default; $tag = (isset($tag_cache[$method]['tag'])) ? $tag_cache[$method]['tag'] : $method; if($expire){ if(isset($tag_cache[$method])){ if($return = Staticstore::get($tag)){ if (isset($return[$hash])){ return unserialize($return[$hash]); } }else{ $resource = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT hash, data FROM " . DB_PREFIX . "cache WHERE tag = '" . $tag . "'"); if($resource){ $return = array(); while ($result = mysqli_fetch_assoc($resource)) { $return[$result['hash']] = $result['data']; } Staticstore::set($tag, $return); if(($return = Staticstore::get($tag)) && isset($return[$hash])) return unserialize($return[$hash]); } } } $resource = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT data FROM " . DB_PREFIX . "cache WHERE hash = '" . $hash . "'"); if (is_resource($resource)) { $result = mysqli_fetch_assoc($resource); if($result){ return unserialize($result['data']); } } } } $resource = mysqli_query( $this->link, $sql); if ($resource) { if (is_resource($resource)) { $i = 0; $data = array(); while ($result = mysqli_fetch_assoc($resource)) { $data[$i] = $result; $i++; } ((mysqli_free_result($resource) || (is_object($resource) && (get_class($resource) == "mysqli_result"))) ? true : false); $query = new stdClass(); $query->row = isset($data[0]) ? $data[0] : array(); $query->rows = $data; $query->num_rows = $i; unset($data); if(!defined('IS_ADMIN')) $r = mysqli_query($GLOBALS["___mysqli_ston"], "INSERT INTO " . DB_PREFIX . "cache SET hash = '{$hash}', data = '" . $this->escape(serialize($query)) . "', tag = '{$tag}', expire = '{$expire}' "); return $query; } else { return true; } } else { trigger_error('Error: ' . ((is_object($this->link)) ? mysqli_error($this->link) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)) . '<br />Error No: ' . ((is_object($this->link)) ? mysqli_errno($this->link) : (($___mysqli_res = mysqli_connect_errno()) ? $___mysqli_res : false)) . '<br />' . $sql); exit(); } } } public function escape($value) { if ($this->link) { return mysqli_real_escape_string( $this->link, $value); } } public function countAffected() { if ($this->link) { return mysqli_affected_rows($this->link); } } public function getLastId() { if ($this->link) { return ((is_null($___mysqli_res = mysqli_insert_id($this->link))) ? false : $___mysqli_res); } } public function __destruct() { if ($this->link) { ((is_null($___mysqli_res = mysqli_close($this->link))) ? false : $___mysqli_res); } } } ?> Что не так?
  2. А это столь важно? Я задал вопрос на форуме в специальном разделе..Отвечать на подобные вопросы не вижу смысла..
  3. Приветствую всех. Помогите данный модуль встроить с соединением mysqli (который в топике) Спасибо.
  4. Проблема с кешем, не записываеться, или права у папки посмотри.
  5. http://static.freepik.com/darmowe-zdjecie/ciemne-tło-z-gwiazdami-psd_277-292934587.jpg Данное изображения загружаеться со стороннего сервера, на котором ранее был обнаружен вирус. Подгружаеться оно в /catalog/view/theme/default/stylesheet/stylesheet.css строка 88 Удалите: background: #000 url(http://static.freepik.com/darmowe-zdjecie/ciemne-tło-z-gwiazdami-psd_277-292934587.jpg) right top no-repeat; Или загрузите к себе на сервер данное изображения и укажите путь на него.
  6. Помогите. Интересует вот такая схема мульти магазина.. youdomain.com/store1/, youdomain.com/store2/ и т.д. Спасибо.
  7. Ни у кого нету предположений? На сабдоменнах работает, а в подпапках нет.
  8. Здравствуйте. Интересует вопрос создания мультимагазина в подпапках.(не поддоменах(сабдоменнах)) Делать также по аналогии данной инструкции? Спасибо.
Guest
×
  • 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.