本文整理汇总了PHP中Site::gI方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::gI方法的具体用法?PHP Site::gI怎么用?PHP Site::gI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::gI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: menu
function menu($count = 1, $type = 'news')
{
global $sets;
if ($sets['view_news_premium']) {
$this->refresh_antics();
}
if (!Site::gI()->check_is_main() && $sets['news_only_main']) {
return false;
}
$show_title = 0;
$width = 135;
//максимальная длина превью новости
News::gI()->update_type($type);
$this->pref_link = $type;
$date_str_t = '';
$news = $this->db->get_rows("SELECT * FROM " . $this->table . " WHERE type=" . quote_smart($type) . " && antic != 1 ORDER BY date DESC, id DESC LIMIT " . $count . "");
$news_antic = $this->db->get_rows("SELECT * FROM " . $this->table . " WHERE type=" . quote_smart($type) . " && antic = 1 ORDER BY date DESC, id DESC LIMIT " . $count . "");
$news_menu = '';
//Вроде вывод новостей
if (count($news) > 0) {
$news_title = $show_title ? $this->the_title[$this->type] : '';
foreach ($news as $id => $res) {
$news_href = !empty($res['vlink']) ? SITE_URL . htmlspecialchars($res['vlink']) : SITE_URL . $this->pref_link . '/' . $res['id'];
//$news_href = SITE_URL.$this->pref_link
$news_menu .= '<div class="news news_block_' . $id . '">';
$news_menu .= '<div class="news_datetitle">';
$news_menu .= '<div class="news_title"><a href="' . $news_href . '">' . htmlspecialchars(str_replace(' ', ' ', $res['t'])) . '</a></div>';
/*datetitle*/
if ($this->show_date) {
$news_menu .= '</div>';
}
$minheight = $this->show_photo() && is_file($res['photo']) ? ' style="min-height: 84px;" ' : '';
$news_menu .= '<div class="news_text"' . $minheight . '>';
if ($this->show_photo() && is_file($res['photo'])) {
$news_menu .= '<img class="news_image" src="' . SITE_URL . 'imgtmp/80_80/' . $res['photo'] . '" width="80" height="80" title="' . $res['t'] . '">';
}
$news_menu .= substr2(Strip_Tags(Trim(str_replace(' ', ' ', $res['txt']))), $width) . '</div>';
/*news_text*/
$news_menu .= '</div>';
/*news_block_id*/
}
$news_menu .= '<div class="news_all"><div><a href="' . $this->pref_link . '/page/1">' . lg($this->all_title[$this->type]) . '</a></div>';
if (count($news_antic) > 0) {
$news_menu .= '<div><a href="' . $this->pref_link . '/antic/1">Архив</a></div>';
}
$news_menu .= '</div>';
}
return $news_menu;
}
示例2: session_start
<?php
session_start();
include_once "../../../../includes/kanfih.php";
//require_once('backup.php');
require INC_DIR . 'dbconnect.php';
require INC_DIR . 'functions.php';
$site = Site::gI();
$sets = $site->GetSettings();
$ebox = $site->GetEditBoxes(array_keys($edit_boxes));
define('DEF_ID', $ebox['id_main']);
if (isset($_GET['id'])) {
if ($_GET['id'] == '0') {
if (file_exists(ROOT_DIR . 'modules/site/i.php')) {
echo '<li class="closed" id="site_0"><a onclick="insert_link(\'/\')" href="#" href2="/"><ins> </ins>Меню сайта</a></li>';
}
if (file_exists(ROOT_DIR . 'modules/ishop/ishop.php')) {
echo '<li class="closed" id="ishop_0"><a onclick="insert_link(\'ishop/0\')" href="#" href2="ishop/0"><ins> </ins>Интернет магазин</a></li>';
}
if (file_exists(ROOT_DIR . 'modules/news/i.php')) {
echo '<li class="closed" id="news_0"><a onclick="insert_link(\'news/page/1\')" href="#" href2="news/page/1"><ins> </ins>Новости</a></li>';
}
} else {
$inf = explode('_', $_GET['id']);
$cat_id = $inf['1'];
if ($inf['0'] == 'site') {
$rows = $db->get_rows("SELECT * FROM " . TABLE_SITEMENU . " WHERE pid=" . $cat_id . " && deleted = 0");
foreach ($rows as $id => $val) {
$g = $db->get_rows("SELECT count(*) as cnt FROM " . TABLE_SITEMENU . " WHERE pid = " . $val['id'] . " && deleted = 0");
$class = $g['0']['cnt'] > 0 ? 'class="closed"' : '';
$link = 'page/' . $val['id'];
示例3: __construct
private function __construct()
{
$this->db = Site::gI()->db;
}
示例4: form
static function form($type = 0)
{
$str = !empty($_SESSION['search_str']) ? htmlspecialchars($_SESSION['search_str']) : '';
$search = Site::gI()->view('search/search_form', array('type' => $type, 'str' => $str));
return $search;
}
示例5: __construct
private function __construct()
{
if (!empty(Site::gI()->sets['ddos_on'])) {
$this->time_query = Site::gI()->sets['ddos_time'] * 60;
$this->count_query = Site::gI()->sets['ddos_q'];
$this->ddos_query = Site::gI()->sets['ddoc_c'];
$db = MySQL::gI();
$rows = $db->get_rows("SELECT * FROM " . TABLE_IP . " WHERE ip = " . quote_smart(ip()) . " LIMIT 1");
if (count($rows) == 0) {
$data = array('ip' => ip(), 'blocked' => 0, 'tmp_block' => 0, 'tmp_time' => 0, 'ddos' => 0);
$db->insert(TABLE_IP, $data);
$ip_id = $db->insert_id();
} else {
$ip_id = $rows['0']['id'];
$rows['0']['ddos'] = 0;
}
if (!empty($rows['0']['ddos']) && $rows['0']['ddos'] >= $this->ddos_query) {
$db->update(TABLE_IP, array('id' => $ip_id), array('tmp_block' => 0, 'ddos' => 0));
$db->delete(TABLE_IP_TIME, array('id_ip' => $ip_id));
echo 'IP адрес заблокирован';
$file_array = file(".htaccess");
$h = 0;
$ed_str = count($file_array) - 1;
$file_array[$ed_str + 1] = 'Deny from ' . ip() . "\n";
$c = "";
for ($y = 0; $y < count($file_array); $y++) {
$c .= $file_array[$y];
}
$f = @fopen('.htaccess', 'w');
if ($f) {
fwrite($f, $c);
}
fclose($f);
exit;
} else {
if (@$rows['0']['tmp_time'] > time() - $this->time_query && @$rows['0']['tmp_block'] == 1) {
if (Site::gI()->sets['ddos_act']) {
echo 'Слишком много запросов, подождите ' . abs(time() - $this->time_query - $rows['0']['tmp_time']) . ' секунд(ы)';
exit;
}
} else {
if (!empty($rows['0']['tmp_block'])) {
$db->update(TABLE_IP, array('id' => $ip_id), array('tmp_block' => 0));
$db->delete(TABLE_IP_TIME, array('id_ip' => $ip_id));
}
}
$db->insert(TABLE_IP_TIME, array('id_ip' => $ip_id, 'time' => time()));
$qr = $db->get_rows("SELECT count(id) as cnt, MAX(time) as time FROM " . TABLE_IP_TIME . " WHERE id_ip = " . $ip_id . " && time > " . (time() - 1) . " LIMIT " . $this->count_query . "");
if ($qr['0']['cnt'] >= $this->count_query && $rows['0']['tmp_block'] == 0) {
if (Site::gI()->sets['alert_on_ddos']) {
$mail_content = '
<html>
<body>
<p>Письмо с сайта ' . SITE_NAME . '.</p>
<p>ИП <b>' . ip() . '</b> совершил ' . $this->count_query . ' запросов в секунду и был заблокирован на <b>' . $this->time_query . ' секунд(ы)</b></p>
</body>
</html>';
ob_start();
require_once INC_DIR . 'PHPMailer/class.phpmailer.php';
$mail = new PHPMailer();
$mail->SetFrom('Сайт ' . SITE_NAME, 'Сайт ' . SITE_NAME);
$mail->AddAddress(Site::gI()->sets['mn_email2'], Site::gI()->sets['mn_email2']);
$mail->Subject = $_SERVER['HTTP_HOST'] . " - " . 'письмо с сайта';
$mail->MsgHTML($mail_content);
foreach ($_FILES['p2']['name'] as $fileid => $fileval) {
$mail->AddAttachment($_FILES['p2']['tmp_name'][$fileid], $_FILES['p2']['name'][$fileid]);
}
$mail->Send();
ob_end_clean();
}
if (Site::gI()->sets['ddos_act']) {
echo 'Слишком много запросов, подождите ' . $this->time_query . ' секунд(ы)';
$db->update(TABLE_IP, array('id' => $ip_id), array('tmp_time' => time(), 'tmp_block' => 1, 'ddos' => $rows['0']['ddos'] + 1));
exit;
}
}
$db->delete(TABLE_IP_TIME, array('time' => array('<', time() - 3)));
}
}
}
示例6: intval
<?php
if (!isset($_GET['page'])) {
$_GET['page'] = 1;
}
$page = intval($_GET['page']);
//================
define('CAT_SIZE', 3);
$row_size = '1';
$col_size = '4';
$catalog = '';
$nav_ar = explode('_', $_GET['id']);
$page = !isset($nav_ar['1']) ? 1 : $nav_ar['1'];
$_GET['id'] = !empty($nav_ar['0']) ? $nav_ar['0'] : '0';
$cat_inf = $this->cat($_GET['id']);
if (!empty($cat_inf['vlink']) && $cat_inf['vlink'] != Site::gI()->rel_url && $page == 1) {
header("HTTP/1.1 301 Moved Permanently");
$this->redirect($cat_inf['vlink']);
exit;
}
$cats_dir = $this->cats($_GET['id']);
$this->update_all();
//if($this->sets['mod_search']) $catalog .= $this->view('ishop/adv_search');
if (count($cats_dir) > 0) {
$catalog .= $this->view('ishop/cat_list', array('cats' => $cats_dir, 'type' => 'ishop/brand'));
}
//==============
$prd_list = '';
//СОРТИРОВКА
$sort_params = array('0' => array('name' => 'title', 'descr' => 'названию', 'sort' => 'asc'), '1' => array('name' => 'tsena', 'descr' => 'цене', 'sort' => 'asc'), '2' => array('name' => 'views', 'descr' => 'популярности', 'sort' => 'desc'));
if ($this->sets['mod_sort'] && isset($_SESSION['sort'])) {
示例7: get_blog_cmt
function get_blog_cmt($parent_id = 0)
{
$db = Site::gI()->db;
ob_start();
?>
<div class="<?php
if ($parent_id != 0) {
?>
b_c_msg_b<?php
}
?>
b_c_lns">
<?php
$rows = $db->get_rows("SELECT * FROM " . TABLE_BLOG_COMMENTS . " WHERE blog_id = " . $_GET['id'] . " && parent_id = " . $parent_id . "");
foreach ($rows as $id => $val) {
?>
<div class="b_c_box">
<?php
if ($val['deleted'] == 1) {
?>
<div class="b_c_ttl_d">Комментарий удален</div>
<?php
} else {
?>
<div class="b_c_ttl"><b class="name"><?php
echo htmlspecialchars($val['name']);
?>
</b> <span><?php
echo date('d.m.Y H:i', $val['date']);
?>
</span></div>
<div class="b_c_msg"><?php
echo htmlspecialchars($val['msg']);
?>
</div>
<div class="b_c_btn"><a onclick="b_cm_show(<?php
echo $val['id'];
?>
)" href="javascript:void(0)">[Ответить]</a></div>
<div style="display:none" class="b_cm_otv b_cm_<?php
echo $val['id'];
?>
">
<form action="" method="post">
<div class="b_c_f_lb">Имя:</div>
<div class="b_c_f_t"><input name="fio" style="width:200px;" class="fbinps" type="text" /><input name="b_c_id" value="<?php
echo $val['id'];
?>
" type="hidden" /></div>
<div class="b_c_f_lb">Сообщение:</div>
<div class="b_c_f_t"><textarea name="msg" style="width:300px; height:100px;" class="fbinps"></textarea></div>
<div class="b_c_f_te"><input onclick="b_cm_show(<?php
echo $val['id'];
?>
)" style="margin-right:10px;" class="fbbs" type="button" value="Отменить" />
<input name="send" class="fbbs" type="submit" value="Ответить" /></div>
</form>
</div>
<?php
}
?>
</div>
<?php
echo get_blog_cmt($val['id']);
}
?>
</div>
<?php
$cnt = ob_get_contents();
ob_end_clean();
return $cnt;
}
示例8: array
$mail->SetFrom("admin@" . SITE_NAME, "Оформление заказа");
$mail->AddAddress($this->sets['ishop_mail'], $this->sets['ishop_mail']);
$mail->Subject = $_SERVER['HTTP_HOST'] . " - " . 'новый комментарий к товару';
$inf = $this->db->get(TABLE_PRODUCTS, array('id' => $_GET['id']));
$mail->MsgHTML('<p>Новый комментарий к товару <a href="' . SITE_URL . 'ishop/product/' . $_GET['id'] . '">' . $inf['0']['title'] . '</a></p>
<p>' . date('Y.m.d H:i:s') . ' <b>' . $_POST['name'] . ' [' . ip() . ']</b></p>
<p>' . $_POST['msg'] . '</p>
');
$mail->Send();
ob_end_clean();
if (is_ajax()) {
?>
$('input[name="name"]').val("");
$('textarea[name="msg"]').val("");
$('body').append('<?php
echo Site::gI()->view('ishop/flow_comment');
?>
');
pop_ups();
<?php
exit;
}
$this->redirect(SITE_URL . "ishop/product/" . $_GET['id']);
}
if (!empty($product) > 0) {
$this->db->query("UPDATE " . TABLE_PRODUCTS . " SET views=views+1 where `id` = '" . $_GET['id'] . "'");
$parametrs = $this->db->get_rows("SELECT param_descr, id FROM " . TABLE_PRD_P . " ORDER BY sort ASC, id ASC");
$q_p = "SELECT gr_pr FROM " . TABLE_PRD_GR . " WHERE gr_id = 5";
$row = $this->db->fetch_array($this->db->query($q_p));
$p_ar = explode(',', $row['gr_pr']);
示例9: session_start
}
session_start();
//TODO подключение файлов с настройкими бд, путей, редактируемых полей
require_once "includes/kanfih.php";
/* подключение бд */
require INC_DIR . 'dbconnect.php';
/* подключение разных полезных функций */
require_once INC_DIR . "functions.php";
if (file_exists('extraSystem.class.php') && file_exists(INC_DIR . 'smspilot.class.php')) {
include_once 'extraSystem.class.php';
include_once INC_DIR . 'smspilot.class.php';
ExtraCMS::initIndexFile();
}
l('start');
$site = Site::gI();
Site::gI()->Check_Mysql();
$sets = $site->GetSettings();
include_once "includes/beznal_eboxes.php";
$ebox = $site->GetEditBoxes(array_keys($edit_boxes));
if (!isset($_SESSION['langv'])) {
$_SESSION['langv'] = 'rus';
}
//TODO Переадресация с других доменов на $domen_name
// $domen_name = ((!empty($sets['redirect'])) ? 'www.' : '').SITE_NAME;
// if($_SERVER['HTTP_HOST'] != $domen_name)
// {
// header("HTTP/1.1 301 Moved Permanently");
// header("Location:http://".$domen_name."".$_SERVER['REQUEST_URI']."");
// exit();
// }
/* проверка файлов в кеше, для очистки && проверка на изменение файлов */
示例10: get_content
function get_content()
{
global $sets;
if (!empty($_SESSION['user']) || empty($this->sets['mod_hide_text'])) {
$res = $this->db->get(isset($_GET['type']) && $_GET['type'] == 'backup' ? TABLE_SITEMENU_BK : TABLE_SITEMENU, array('id' => isset($_GET['type']) && $_GET['type'] == 'backup' ? intval($_GET['id']) : $this->id, 'deleted' => 0));
} else {
$res = $this->db->get(isset($_GET['type']) && $_GET['type'] == 'backup' ? TABLE_SITEMENU_BK : TABLE_SITEMENU, array('id' => isset($_GET['type']) && $_GET['type'] == 'backup' ? intval($_GET['id']) : $this->id, 'deleted' => 0, 'reg' => 0));
}
if (count($res) > 0) {
$res = $res['0'];
}
//if(!empty($res['vlink']) && trim($res['vlink']) != substr($_SERVER['REQUEST_URI'], 1))
if (!empty($res['vlink']) && trim($res['vlink']) != Site::gI()->rel_url) {
header("HTTP/1.1 301 Moved Permanently");
$this->redirect($res['vlink']);
exit;
}
$enabled = !empty($res['enabled']) == 1 ? "1" : "0";
$html = '';
if (!$enabled || in_array($res['id'], $this->disabled)) {
$html = $this->_404();
} else {
$html = !empty($html) ? $html : ' ';
$html = HTML::del_mso_code($res['html']);
}
if (count($res) == 0) {
$html = $this->_404();
}
if ($sets['yashare1'] && !empty($html)) {
$html .= '<div class="yashare_text"><div class="yashare-auto-init" data-yashareL10n="ru" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,gplus" data-yashareTheme="counter"></div></div>';
}
$content = array('html' => $html, 'id' => $res['id'], 'print' => $res['print'], 'foto_head' => $res['foto_head'], 'comm' => $res['comm'], 'title' => !empty($res['title']) ? htmlspecialchars($res['title']) : '', 'meta_title' => !empty($res['pagetitle']) ? htmlspecialchars($res['pagetitle']) : '', 'meta_keys' => !empty($res['metakey']) ? htmlspecialchars($res['metakey']) : '', 'meta_desc' => !empty($res['metadesc']) ? htmlspecialchars($res['metadesc']) : '', 'path' => $this->get_path($res['id']));
$this->content = $content;
}
示例11:
<?php
if (!empty($_GET['id'])) {
$this->inc_cnt_prds($_GET['id']);
if (is_ajax()) {
?>
$('.cart').replaceWith('<span class="cart full_cart" onclick="check_cart()"><span class="tv_count"></span> <span class="currency">шт.</span><br><span class="tv_sum"></span></span>');
$('.tv_count').html('<?php
echo $this->getCountProducts();
?>
');
$('.tv_sum').html('<?php
echo $this->s_price($this->get_summa_skidki(Cart::gI()->get_cart_info()));
?>
');
$('body').append('<?php
echo Site::gI()->view('ishop/flow_cart');
?>
');
pop_ups();
<?php
exit;
}
$this->redirect($_SERVER['HTTP_REFERER']);
}
示例12: lg
<div class="kolvo_buy_button_add noselect">
<?php
$sets = Site::gI()->sets;
if (($product->paramNotEmpty('param_kolichestvo') && $product->get('param_kolichestvo') > 0 || !$sets['nal_sklad']) && (!$sets['status_tovara'] || $product->get('param_vnalichii') == 0)) {
if ($sets['mod_show_cart']) {
if ($sets['show_kolvo']) {
?>
<div class="kolvo">
<div class="kolvo_arrow kolvo_arrow_down color1 noselect">◁</div><!--
--><input type="text" value="1" name="kolvo" class="kolvo_inp input_text" id="kolvo_inp"><!--
--><div class="kolvo_arrow kolvo_arrow_up color1 noselect">▷</div>
</div>
<?php
}
?>
<div class="btn_add">
<a href="javascript:void(0)" class="buy_link button button2"
data-id="<?php
echo $product->get('id');
?>
" active="1"
title="<?php
echo lg('Добавить в корзину');
?>
<?php
echo $product->getTitle();
示例13: __construct
private function __construct()
{
$this->db = Site::gI()->db;
$this->sets = Site::gI()->sets;
$this->ebox = Site::gI()->ebox;
$this->setVar('pre', 'ishop/');
$this->setVar('fix', '');
$this->setVar('hidden_path', array());
//скрыть разделы в пути
$this->setVar('sitemap_ttl', 'Каталог');
$this->setVar('module', 'ishop');
if ($this->ml == 0 && isset($_GET['id'])) {
$this->get_menu($_GET['id'], $this->getMenuRows());
$this->ml = 1;
}
define('CART', 'ishop_cart');
define('COOKIE_CART', 'cart');
/*if(!empty($_COOKIE[COOKIE_CART]))
{
@$_SESSION[CART] = unserialize(gzinflate($_COOKIE[COOKIE_CART]));
}*/
define('PAGES_TOP_ENABLED', 1);
define('PAGES_BOTTOM_ENABLED', 1);
define('PAGES', $this->sets['prd_count']);
define('CTIME', 30);
$config = TEMP_FOLDER . 'ishop_config.php';
if (file_exists($config)) {
require $config;
}
$_GET['type'] = !empty($_GET['type']) ? $_GET['type'] : '';
if (empty($_GET['id'])) {
$_GET['id'] = 0;
}
if (!empty($this->sets['mod_cbr'])) {
$this->rate_usd = cache('getCurse', 'USD', 3600);
}
$crcs = $this->get_crcs();
$crct = array();
$cpr = array();
foreach ($crcs as $crc) {
$crct[] = $crc['id'];
$cpr[$crc['id']] = $crc['rate'];
$cpt[$crc['id']] = $crc['ed'];
}
if (!empty($_SESSION['card_nomer'])) {
$card_inf = $this->db->get_rows("SELECT skidka FROM " . TABLE_CARDS . " WHERE nomer = " . quote_smart($_SESSION['card_nomer']) . " LIMIT 1");
if (!empty($card_inf['0']['skidka'])) {
$this->card = $card_inf['0']['skidka'];
}
}
$this->crct = $crct;
$this->cpt = $cpt;
$this->cpr = $cpr;
$this->crcs = $crcs;
if (empty($_SESSION['currency'])) {
$_SESSION['currency'] = $crcs['0']['id'];
}
if (!$this->sets['mod_currency']) {
$_SESSION['currency'] = $crcs['0']['id'];
}
}
示例14: header
<?php
$row_size = '1';
$col_size = '4';
$catalog = '';
$cat_inf = $this->cat($_GET['id']);
//print_r($cat_inf);
//if(!empty($cat_inf['vlink']) && $cat_inf['vlink'] != substr($_SERVER['REQUEST_URI'], 1) && !isset($_GET['page']))
if (!empty($cat_inf['vlink']) && $cat_inf['vlink'] != Site::gI()->rel_url && !isset($_GET['page'])) {
header("HTTP/1.1 301 Moved Permanently");
$this->redirect($cat_inf['vlink']);
exit;
}
if (!empty($this->sets['mod_hide_text']) && empty($_SESSION['user']) && $this->check_reg_cat($_GET['id'])) {
$path = $this->get_path($_GET['id']);
$content = array('html' => 'Для просмотра раздела необходимо <a href="' . SITE_URL . 'reg/registr">зарегистрироваться</a>', 'foto_head' => !empty($cat_inf['foto_head']) ? $cat_inf['foto_head'] : '', 'meta_title' => !empty($cat_inf['metatitle']) ? $cat_inf['metatitle'] : '', 'meta_keys' => !empty($cat_inf['metakeys']) ? $cat_inf['metakeys'] : '', 'meta_desc' => !empty($cat_inf['metadesc']) ? $cat_inf['metadesc'] : '', 'path' => $path);
} else {
$cats_dir = $this->cats($_GET['id']);
$this->update_all();
if ($cat_inf === false || in_array($_GET['id'], $this->disabled) || !empty($this->ebox['id_proizv']) && $cat_inf['parent_id'] == $this->ebox['id_proizv']) {
$catalog .= $this->_404();
}
//if($this->sets['mod_search']) $catalog .= $this->view('ishop/adv_search');
if (!$this->show_only_prds) {
if (count($cats_dir) > 0) {
$catalog .= $this->view('ishop/cat_list', array('cats' => $cats_dir, 'type' => 'ishop'));
}
}
$page = isset($_GET['page']) ? $_GET['page'] : 1;
//СОРТИРОВКА
$sort_params = array('0' => array('name' => 'title', 'descr' => 'названию', 'sort' => 'asc'), '1' => array('name' => 'tsena', 'descr' => 'цене', 'sort' => 'asc'), '2' => array('name' => 'views', 'descr' => 'популярности', 'sort' => 'desc'));
示例15: getPhotoH
public function getPhotoH($width = 0, $height = 0)
{
if (empty($width)) {
$width = Ishop::gI()->image_width;
}
if (empty($height)) {
$height = Ishop::gI()->image_height;
}
$photo = '<div class="product_photo">';
$product_size = '';
if (Ishop::gI()->sets['mod_p_size']) {
$product_size = 'class="highslide" onclick="return hs.expand(this, config1 )"';
if (Ishop::gI()->sets['cloud_zoom']) {
$product_size = ' class="cloud-zoom" rel="zoomWidth: 360, zoomHeight: 400, adjustX: 40, adjustY: -15"';
}
}
$link = '' . SITE_URL . 'imgtmp/orign_w/' . ($this->product->get('foto') ? $this->product->get('foto') : 'data/nophoto.jpg') . '';
if (Ishop::gI()->resize_big_image) {
$link = '<img src="' . SITE_URL . 'imgtmp/800_800_w/' . $this->product->get('foto') . '" width="800" height="800" title="' . $this->getTitle() . '">';
}
$photo .= '<a id="flink" ' . $product_size . ' href="' . $link . '">';
$width_str = '';
$height_str = '';
if ($width != 'auto') {
$width_str = ' width="' . $width . '" ';
}
if ($height != 'auto') {
$height_str = ' height="' . $height . '" ';
}
$result_path = '';
if (preg_match('/(http.*?\\/\\/)/i', $this->product->get('foto'))) {
$src = file_get_contents($this->product->get('foto'));
$source_path = preg_replace('/(http.*?\\/\\/)/i', '', $this->product->get('foto'));
$source_path = preg_replace('/(\\..*?\\/)/i', '/', $source_path);
$result_path = preg_replace('/(^.*?$)/i', 'data/$1', $source_path);
if (!file_exists($result_path)) {
$source_path_array = explode('/', $source_path);
$break_point = count($source_path_array) - 1;
$path = 'data/';
foreach ($source_path_array as $id => $dir) {
if ($id == $break_point) {
break;
}
$dir = str_replace('//', '', $dir);
$path = $path . '/' . $dir;
$rs = @mkdir($path, 0777);
chmod($path, 0777);
}
file_put_contents($result_path, $src);
}
}
if (file_exists($this->product->get('foto')) || file_exists($result_path)) {
$photo .= '<img src="' . SITE_URL . '' . $this->product->get('foto') . '" style="min-height:20px; max-height:200px;" title="' . $this->getTitle() . '">';
} else {
$photo .= '<img src="' . SITE_URL . 'imgtmp/' . $width . '_' . $height . '_w/data/nophoto.jpg" ' . $width_str . $height_str . '>';
}
$photo .= '<div class="prod_options">';
//иконки доп опций (скидка, хит, новинка)
if (!isset($options['icon']) || $options['icon'] == 1) {
if (Site::gI()->sets['mod_new']) {
$photo .= $this->product->paramNotEmpty('new') ? ' <img class="new_m" vspace="0" hspace="0" src="' . TEMP_FOLDER . '/images/new.png">' : '';
}
if (Site::gI()->sets['mod_hit']) {
$photo .= $this->product->paramNotEmpty('hit') ? ' <img class="hit_m" vspace="0" hspace="0" src="' . TEMP_FOLDER . '/images/hit.png">' : '';
}
if (Site::gI()->sets['mod_spec']) {
$photo .= $this->product->paramNotEmpty('spec') ? ' <img class="skidka_m" vspace="0" hspace="0" src="' . TEMP_FOLDER . '/images/spec.png">' : '';
}
}
$photo .= '</div></a></div>';
return $photo;
}