1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332:
<?php
class PHPShopPhotoElement extends PHPShopElements {
function __construct() {
$this->debug = false;
$this->objBase = $GLOBALS['SysValue']['base']['table_name22'];
parent::__construct();
}
function getPhotos() {
global $PHPShopModules;
$dis = null;
$url = addslashes(substr($this->SysValue['nav']['url'], 1));
if (empty($url))
$url = '/';
$PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name22'));
$PHPShopOrm->debug = $this->debug;
$data = $PHPShopOrm->select(array('*'), array('enabled' => "='1'", "page" => " LIKE '%$url%'"), array('order' => 'num'), array("limit" => 100));
if (is_array($data))
foreach ($data as $row) {
$this->set('photoTitle', $row['name']);
$this->set('photoLink', '/photo/CID_'.$row['id']. '.html');
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, $row);
$this->set('photoContent', $this->ListPhoto($row['id'], $row['num']));
$dis.=$this->parseTemplate('./phpshop/lib/templates/photo/photo_list_forma.tpl', true);
}
return $dis;
}
function ListPhoto($cat, $num) {
$dis = null;
$PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name23'));
$PHPShopOrm->debug = $this->debug;
$data = $PHPShopOrm->select(array('*'), array('category' => '=' . intval($cat), 'enabled' => "='1'"), array('order' => 'num'), array('limit' => $num));
if ($num == 1)
$this->dataArray[] = $data;
else
$this->dataArray = $data;
if (is_array($this->dataArray))
foreach ($this->dataArray as $row) {
$name_s = str_replace(".", "s.", $row['name']);
$this->set('photoIcon', $name_s);
$this->set('photoInfo', $row['info']);
$this->set('photoImg', $row['name']);
$dis.=$this->parseTemplate('./phpshop/lib/templates/photo/photo_element_forma.tpl', true);
}
return $dis;
}
function randPhoto($cat) {
$dis = null;
$PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name23'));
$PHPShopOrm->debug = $this->debug;
$this->dataArray[] = $PHPShopOrm->select(array('*'), array('enabled' => "='1'", "category" => "=" . intval($cat)), array('order' => 'RAND()'), array("limit" => 1));
if (is_array($this->dataArray))
foreach ($this->dataArray as $row) {
$name_s = str_replace(".", "s.", $row['name']);
$this->set('photoIcon', $name_s);
$this->set('photoInfo', $row['info']);
$this->set('photoImg', $row['name']);
$dis.=$this->parseTemplate('./phpshop/lib/templates/photo/photo_element_forma.tpl', true);
}
return $dis;
}
function mainMenuPhoto() {
global $PHPShopModules;
$dis = null;
$i = 0;
$data = $this->PHPShopOrm->select(array('*'), array('parent_to' => '=0', 'enabled' => "='1'"), array('order' => 'num'), array("limit" => 100));
if (is_array($data))
foreach ($data as $row) {
$this->set('catalogId', $row['id']);
$this->set('catalogI', $i);
$this->set('catalogTemplates', $this->getValue('dir.templates') . chr(47) . $this->PHPShopSystem->getValue('skin') . chr(47));
$this->LoadItems['CatalogPhoto'][$row['id']]['name'] = $row['name'];
$this->LoadItems['CatalogPhoto'][$row['id']]['parent_to'] = $row['parent_to'];
if (!empty($row['content']))
$this->LoadItems['CatalogPhoto'][$row['id']]['content_enabled'] = true;
else
$this->LoadItems['CatalogPhoto'][$row['id']]['content_enabled'] = false;
$this->set('catalogName', $row['name']);
$this->set('catalogLink', '/photo/CID_' . $row['id'] . '.html');
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, $row);
$this->set('menu', $this->parseTemplate($this->getValue('templates.catalog_photo_1_point')));
$dis.=$this->parseTemplate($this->getValue('templates.catalog_photo_1'));
}
return $dis;
}
}
class PHPShopCatalogElement extends PHPShopElements {
var $chek_page = true;
function __construct() {
$this->debug = false;
$this->objBase = $GLOBALS['SysValue']['base']['table_name'];
parent::__construct();
}
function mainMenuPage() {
$dis = '';
$i = 0;
$data = $this->PHPShopOrm->select(array('*'), array('parent_to' => '=0'), array('order' => 'num'), array("limit" => 100));
if (is_array($data))
foreach ($data as $row) {
$this->set('catalogId', $row['id']);
$this->set('catalogI', $i);
$this->set('catalogTemplates', $this->getValue('dir.templates') . chr(47) . $this->PHPShopSystem->getValue('skin') . chr(47));
$this->LoadItems['CatalogPage'][$row['id']]['name'] = $row['name'];
$this->LoadItems['CatalogPage'][$row['id']]['parent_to'] = $row['parent_to'];
if (!empty($row['content']))
$this->LoadItems['CatalogPage'][$row['id']]['content_enabled'] = true;
else
$this->LoadItems['CatalogPage'][$row['id']]['content_enabled'] = false;
if ($this->chek($row['id'])) {
$link = $this->chek_page($row['id']);
if ($link and $this->chek_page) {
$this->set('catalogName', $row['name']);
$this->set('catalogId', $link);
$dis.=$this->parseTemplate($this->getValue('templates.catalog_forma_3'));
} else {
$this->set('catalogPodcatalog', $this->page($row['id']));
$this->set('catalogName', $row['name']);
$dis.=$this->parseTemplate($this->getValue('templates.catalog_forma'));
}
} else {
$this->set('catalogPodcatalog', $this->podcatalog($row['id']));
$this->set('catalogName', $row['name']);
$dis.=$this->parseTemplate($this->getValue('templates.catalog_forma_2'));
}
$i++;
}
return $dis;
}
function chek($id) {
$PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name'));
$PHPShopOrm->debug = $this->debug;
$num = $PHPShopOrm->select(array('id'), array('parent_to' => "=$id"), false, array('limit' => 1));
if (empty($num['id']))
return true;
}
function chek_page($id) {
$PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name11'));
$PHPShopOrm->debug = false;
$num = $PHPShopOrm->select(array('link'), array('category' => "=$id"), false, array('limit' => 5));
if (is_array($num))
if (count($num) == 1)
return $num[0]['link'];
}
function page($n) {
global $PHPShopModules, $dis;
$dis = '';
$n = intval($n);
$PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name11'));
$PHPShopOrm->debug = $this->debug;
$data = $PHPShopOrm->select(array('*'), array('category' => '=' . $n, 'enabled' => "='1'"), array('order' => 'num'), array("limit" => 100));
if (is_array($data))
foreach ($data as $row) {
$this->set('catalogId', $n);
$this->set('catalogUid', $row['id']);
$this->set('catalogLink', $row['link']);
$this->set('catalogName', $row['name']);
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, array($row, &$dis));
$dis.=$this->parseTemplate($this->getValue('templates.podcatalog_forma'));
}
return $dis;
}
function podcatalog($n) {
global $PHPShopModules;
$dis = '';
$i = 0;
$n = intval($n);
$PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name'));
$data = $PHPShopOrm->select(array('*'), array('parent_to' => '=' . $n), array('order' => 'num'), array("limit" => 100));
if (is_array($data))
foreach ($data as $row) {
$this->set('catalogId', $n);
$this->set('catalogI', $i);
$this->set('catalogLink', 'CID_' . $row['id']);
$this->set('catalogName', $row['name']);
$this->set('catalogTemplates', $this->getValue('dir.templates') . chr(47) . $this->PHPShopSystem->getValue('skin') . chr(47));
$this->set('catalogName', $row['name']);
$i++;
$this->LoadItems['CatalogPage'][$row['id']]['name'] = $row['name'];
$this->LoadItems['CatalogPage'][$row['id']]['parent_to'] = $row['parent_to'];
if (!empty($row['content']))
$this->LoadItems['CatalogPage'][$row['id']]['content_enabled'] = true;
else
$this->LoadItems['CatalogPage'][$row['id']]['content_enabled'] = false;
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, $row);
$dis.=$this->parseTemplate($this->getValue('templates.podcatalog_forma'));
}
return $dis;
}
}
?>