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: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465: 466: 467: 468: 469: 470: 471: 472: 473: 474: 475: 476: 477: 478: 479: 480: 481: 482: 483: 484: 485: 486: 487: 488: 489: 490: 491: 492: 493: 494: 495: 496: 497: 498: 499: 500: 501: 502: 503: 504: 505: 506: 507: 508: 509: 510: 511: 512: 513: 514: 515: 516: 517: 518: 519: 520: 521: 522: 523: 524: 525: 526: 527: 528: 529: 530: 531: 532: 533: 534: 535: 536: 537: 538: 539: 540: 541: 542: 543: 544: 545: 546: 547: 548: 549: 550: 551: 552: 553: 554: 555: 556: 557: 558: 559: 560: 561: 562: 563: 564: 565: 566: 567: 568: 569: 570: 571: 572: 573: 574: 575: 576: 577: 578: 579: 580: 581: 582: 583: 584: 585: 586: 587: 588: 589: 590: 591: 592: 593: 594: 595: 596: 597: 598: 599: 600: 601: 602: 603: 604: 605: 606: 607: 608: 609: 610: 611: 612: 613: 614: 615: 616: 617: 618: 619: 620: 621: 622: 623: 624: 625: 626: 627: 628: 629: 630: 631: 632: 633: 634: 635: 636: 637: 638: 639: 640: 641: 642: 643: 644: 645: 646: 647: 648: 649: 650: 651: 652: 653: 654: 655: 656: 657: 658: 659: 660: 661: 662: 663: 664: 665: 666: 667: 668: 669: 670: 671: 672: 673: 674: 675: 676: 677: 678: 679: 680: 681: 682: 683: 684: 685: 686: 687: 688: 689: 690: 691: 692: 693: 694: 695: 696: 697: 698: 699: 700: 701: 702: 703: 704: 705: 706: 707: 708: 709: 710: 711: 712: 713: 714: 715: 716: 717: 718: 719: 720: 721: 722: 723: 724: 725: 726: 727: 728: 729: 730: 731: 732: 733: 734: 735: 736: 737: 738: 739: 740: 741: 742: 743: 744: 745: 746: 747: 748: 749: 750: 751: 752: 753: 754: 755: 756: 757: 758: 759: 760: 761: 762: 763: 764: 765: 766: 767: 768: 769: 770: 771: 772: 773: 774: 775: 776: 777: 778: 779:
<?php
class PHPShopSliderElement extends PHPShopElements {
var $disp_only_index = true;
var $limit = 7;
function __construct() {
$this->debug = false;
$this->objBase = $GLOBALS['SysValue']['base']['slider'];
parent::__construct();
}
function index() {
global $PHPShopModules;
static $i;
$dis = null;
if ($this->disp_only_index) {
if ($this->PHPShopNav->index())
$view = true;
else
$view = false;
}
else
$view = true;
if (!empty($view)) {
$result = $this->PHPShopOrm->select(array('image', 'alt', 'link'), array('enabled' => '="1"'), array('order' => 'num, id DESC'), array("limit" => $this->limit));
if ($this->limit > 1)
$data = $result;
else
$data[] = $result;
if (is_array($data))
foreach ($data as $row) {
$this->set('image', $row['image']);
$this->set('alt', $row['alt']);
$this->set('link', $row['link']);
if (empty($i)) {
$this->set('slideActive', 'active');
$this->set('slideIndicator', '<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>', true);
} else {
$this->set('slideActive', '');
$this->set('slideIndicator', '<li data-target="#carousel-example-generic" data-slide-to="' . $i . '"></li>', true);
}
$i++;
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, $row);
$dis.=$this->parseTemplate("/slider/slider_oneImg.tpl");
}
if (@$dis) {
$this->set('imageSliderContent', $dis);
return$this->parseTemplate("/slider/slider_main.tpl");
}
return false;
}
}
}
class PHPShopGbookElement extends PHPShopElements {
var $disp_only_index = false;
var $limit = 3;
function __construct() {
$this->debug = false;
$this->objBase = $GLOBALS['SysValue']['base']['table_name7'];
parent::__construct();
}
function index() {
global $PHPShopModules;
$dis = null;
if ($this->disp_only_index) {
if ($this->PHPShopNav->index())
$view = true;
else
$view = false;
}
else
$view = true;
if ($view) {
$data = $this->PHPShopOrm->select(array('*'), array('enabled' => "='1'"), array('order' => 'id DESC'), array("limit" => $this->limit));
if (is_array($data))
foreach ($data as $row) {
if (!empty($row['mail']))
$d_mail = PHPShopText::a('mailto:' . $row[mail], PHPShopText::b($row['name']), $row['name']);
else
$d_mail = PHPShopText::b($row['name']);
$this->set('gbookData', PHPShopDate::dataV($row['date'], false));
$this->set('gbookName', $row['name']);
$this->set('gbookTema', $row['title']);
$this->set('gbookMail', $d_mail);
$this->set('gbookOtsiv', $row['question']);
$this->set('gbookOtvet', $row['answer']);
$this->set('gbookId', $row['id']);
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, $row);
$dis.=$this->parseTemplate($this->getValue('templates.main_gbook_forma'));
}
$dis.=PHPShopText::div(PHPShopText::a('/gbook/', __('')), 'left', 'padding:20');
$this->set('leftMenuName', __(''));
$this->set('leftMenuContent', $dis);
return $this->parseTemplate($this->getValue('templates.left_menu'));
}
}
}
class PHPShopTextElement extends PHPShopElements {
function __construct() {
$this->debug = false;
$this->objBase = $GLOBALS['SysValue']['base']['table_name14'];
parent::__construct();
}
function leftMenu() {
global $PHPShopModules;
$dis = null;
$PHPShopOrm = new PHPShopOrm($this->objBase);
$data = $PHPShopOrm->select(array('*'), array("flag" => "='1'", 'element' => "='0'"), array('order' => 'num'), array("limit" => 20));
if (is_array($data))
foreach ($data as $row) {
if (empty($row['dir'])) {
$this->set('leftMenuName', $row['name']);
$this->set('leftMenuContent', Parser($row['content']));
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, $row);
$dis.=$this->parseTemplate($this->getValue('templates.left_menu'));
} else {
$dirs = explode(",", $row['dir']);
foreach ($dirs as $dir)
if ($dir == $_SERVER['REQUEST_URI']) {
$this->set('leftMenuName', $row['name']);
$this->set('leftMenuContent', Parser($row['content']));
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, $row);
$dis.=$this->parseTemplate($this->getValue('templates.left_menu'));
}
}
}
return $dis;
}
function rightMenu() {
global $PHPShopModules;
$dis = '';
$PHPShopOrm = new PHPShopOrm($this->objBase);
$data = $PHPShopOrm->select(array('*'), array("flag" => "='1'", 'element' => "='1'"), array('order' => 'num'), array("limit" => 20));
if (is_array($data))
foreach ($data as $row) {
if (empty($row['dir'])) {
$this->set('leftMenuName', $row['name']);
$this->set('leftMenuContent', Parser($row['content']));
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, $row);
$dis.=$this->parseTemplate($this->getValue('templates.right_menu'));
} else {
$dirs = explode(",", $row['dir']);
foreach ($dirs as $dir)
if ($dir == $_SERVER['REQUEST_URI']) {
$this->set('leftMenuName', $row['name']);
$this->set('leftMenuContent', Parser($row['content']));
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, $row);
$dis.=$this->parseTemplate($this->getValue('templates.right_menu'));
}
}
}
return $dis;
}
function topMenu() {
global $PHPShopModules;
$dis = null;
$hook = $PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, null, null, 'START');
if ($hook)
return $hook;
$objBase = $GLOBALS['SysValue']['base']['table_name11'];
$PHPShopOrm = new PHPShopOrm($objBase);
$data = $PHPShopOrm->select(array('*'), array("category" => "=1000", "enabled" => "!='0'"), array('order' => 'num'), array("limit" => 20));
if (is_array($data))
foreach ($data as $row) {
$this->set('topMenuName', $row['name']);
$this->set('topMenuLink', $row['link']);
$check = str_replace('..', '', $row['link']);
if ($check == $this->PHPShopNav->getName(true))
$this->set('topMenuActive', 'active');
else
$this->set('topMenuActive', '');
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, $row);
$dis.=$this->parseTemplate($this->getValue('templates.top_menu'));
}
return $dis;
}
function logo() {
return $this->PHPShopSystem->getLogo();
}
}
class PHPShopSkinElement extends PHPShopElements {
function __construct() {
parent::__construct();
}
function index() {
$dis = $name = '';
if ($this->PHPShopSystem->getValue('skin_choice')) {
$dir = $this->getValue('dir.templates') . chr(47);
if (is_dir($dir)) {
if (@$dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($_SESSION['skin'] == $file)
$sel = "selected";
else
$sel = "";
if ($file != "." and $file != ".." and $file != "index.html")
$value[] = array($file, $file, $sel);
}
closedir($dh);
}
}
$forma = PHPShopText::div(PHPShopText::form(PHPShopText::select('skin', $value, 150, $float = "none", $caption = false, $onchange = "ChangeSkin()"), 'SkinForm', 'get'), 'left', 'padding:10px');
$this->set('leftMenuContent', $forma);
$this->set('leftMenuName', "");
$dis = $this->parseTemplate($this->getValue('templates.left_menu'));
}
return $dis;
}
}
class PHPShopNewsElement extends PHPShopElements {
var $disp_only_index = false;
var $limit = 3;
function __construct() {
$this->debug = false;
$this->objBase = $GLOBALS['SysValue']['base']['table_name8'];
parent::__construct();
}
function index() {
global $PHPShopModules;
$dis = '';
if ($this->disp_only_index) {
if ($this->PHPShopNav->index())
$view = true;
else
$view = false;
}
else
$view = true;
if ($view) {
$data = $this->PHPShopOrm->select(array('*'), false, array('order' => 'id DESC'), array("limit" => $this->limit));
if (is_array($data))
foreach ($data as $row) {
$this->set('newsId', $row['id']);
$this->set('newsZag', $row['title']);
$this->set('newsData', $row['date']);
$this->set('newsKratko', $row['description']);
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, $row);
$dis.=$this->parseTemplate($this->getValue('templates.news_main_mini'));
}
return $dis;
}
}
}
class PHPShopOprosElement extends PHPShopElements {
function __construct() {
$this->debug = false;
parent::__construct();
}
function oprosDisp() {
$PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name21'));
$PHPShopOrm->debug = $this->debug;
$dataArray = $PHPShopOrm->select(array('*'), array('flag' => "='1'"), array('order' => 'id DESC'), array('limit' => 10));
$content = '';
if (is_array($dataArray))
foreach ($dataArray as $row) {
if (empty($row['dir'])) {
$this->set('oprosName', $row['name']);
$this->set('oprosContent', $this->getOprosValue($row['id'], "FORMA"));
$content.= $this->parseTemplate($this->getValue('templates.opros_list'));
} else {
if (strpos($row['dir'], ","))
$dirs = explode(",", $row['dir']);
else
$dirs[] = $row['dir'];
foreach ($dirs as $dir)
if ($dir == $_SERVER['REQUEST_URI']) {
$this->set('oprosName', $row['name']);
$this->set('oprosContent', $this->getOprosValue($row['id'], "FORMA"));
$content.= $this->parseTemplate($this->getValue('templates.opros_list'));
}
}
}
return $content;
}
function getOprosValue($n, $flag) {
$dis = '';
$PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name20'));
$PHPShopOrm->comment = 'getOprosValue';
$PHPShopOrm->debug = $this->debug;
$this->dataArray = $PHPShopOrm->select(array('*'), array('category' => '=' . $n), array('order' => 'num'), array('limit' => 100));
if (is_array($this->dataArray))
foreach ($this->dataArray as $row) {
if ($row['total'] > 0)
$total = $row['total'];
else
$total = "--";
$this->set('valueName', $row['name']);
$this->set('valueId', $row['id']);
if ($flag == "FORMA")
$dis.=$this->parseTemplate($this->getValue('templates.opros_forma'));
elseif ($flag == "RESULT") {
$sum = $this->getSumValue($row['category']);
$pr = @number_format(($total * 100) / $sum, "1", ".", "");
$this->set('valueSum', $total);
$this->set('valueProc', $pr);
$this->set('valueWidth', $pr * 3 + 1);
$dis.=$this->parseTemplate($this->getValue('templates.opros_page_forma'));
}
}
return $dis;
}
function getSumValue($n) {
$objBase = $this->getValue('base.table_name20');
$PHPShopOrm = new PHPShopOrm($objBase);
$result = $PHPShopOrm->query("select SUM(total) as sum from " . $objBase . " where category=" . $n);
$row = mysqli_fetch_array($result);
return $row['sum'];
}
}
class PHPShopBannerElement extends PHPShopElements {
function __construct() {
$this->debug = false;
$this->objBase = $GLOBALS['SysValue']['base']['table_name15'];
parent::__construct();
}
function index() {
$this->row = $this->PHPShopOrm->select(array('*'), array("enabled" => "='1'"), array('order' => 'RAND()'), array("limit" => 1));
if (is_array($this->row)) {
$this->set('banerContent', Parser($this->row['content']));
$this->set('banerTitle', $this->row['name']);
if ($this->row['count_all'] > $this->row['limit_all'])
$this->mail();
$this->update();
$dis = $this->parseTemplate($this->getValue('templates.banner_list_forma'));
}
return $dis;
}
function banner($id) {
if (PHPShopSecurity::true_num($id)) {
$this->row = $this->PHPShopOrm->select(array('*'), array("id" => "=" . $id), false, array("limit" => 1));
if (is_array($this->row)) {
$this->set('banerContent', Parser($this->row['content']));
$this->set('banerTitle', $this->row['name']);
$dis = $this->parseTemplate($this->getValue('templates.banner_list_forma'));
}
return $dis;
}
}
function update() {
if ($this->row['date'] != date("d.m.y"))
$count_today = 0;
else
$count_today = $this->row['count_today'] + 1;
$count_all = $this->row['count_all'] + 1;
$this->PHPShopOrm->update(array('count_all' => $count_all, 'count_today' => $count_today, 'date' => date("d.m.y")), array('id' => "=" . $this->row['id']), $prefix = '');
}
}
class PHPShopCloudElement extends PHPShopElements {
var $page_limit = 100;
var $word_limit = 30;
function __construct() {
$this->debug = false;
$this->objBase = $GLOBALS['SysValue']['base']['table_name11'];
parent::__construct();
if ($this->PHPShopSystem->getSerilizeParam('admoption.cloud_color') == "")
$this->color = "0x518EAD";
else
$this->color = "0x" . $this->PHPShopSystem->getSerilizeParam('admoption.cloud_color');
}
function index() {
global $PHPShopModules;
$disp = '';
$data = $this->PHPShopOrm->select(array('keywords', 'link'), array('enabled' => "='1'", 'keywords' => " !=''", 'category' => '!=2000'), array('order' => 'RAND()'), array("limit" => $this->page_limit));
if (is_array($data))
foreach ($data as $row) {
$explode = explode(", ", $row['keywords']);
foreach ($explode as $ev)
if (!empty($ev)) {
$ArrayWords[] = $ev;
$ArrayLinks[$ev] = $row['link'];
}
}
if (is_array($ArrayWords))
foreach ($ArrayWords as $k => $v) {
$count = array_keys($ArrayWords, $v);
$CloudCount[$v]['size'] = count($count);
}
$i = 0;
if (is_array($CloudCount))
foreach ($CloudCount as $k => $v) {
if ($i < $this->word_limit)
$CloudCountLimit[$k] = $v;
$i++;
}
if (is_array($CloudCountLimit))
foreach ($CloudCountLimit as $key => $val)
$disp.="<a href='/page/" . $ArrayLinks[$key] . ".html' style='font-size:12pt;'>$key</a>";
$disp = '
var dd=new Date();
var so = new SWFObject("/tagcloud/tagcloud.swf?rnd="+dd.getTime(), "tagcloudflash", "180", "180", "9", "' . $this->color . '");
so.addParam("wmode", "transparent");
so.addParam("allowScriptAccess", "always");
so.addVariable("tcolor", "' . $this->color . '");
so.addVariable("tspeed", "150");
so.addVariable("distr", "true");
so.addVariable("mode", "tags");
so.addVariable("tagcloud", "<tags>' . $disp . '</tags>");
so.write("wpcumuluscontent");</script>
';
$disp = str_replace('\n', '', $disp);
$disp = str_replace(chr(13), '', $disp);
$disp = str_replace(chr(10), '', $disp);
$this->set('leftMenuName', "");
$this->set('leftMenuContent', $disp);
$PHPShopModules->setHookHandler(__CLASS__, __FUNCTION__, $this, $ArrayLinks);
$dis = $this->parseTemplate($this->getValue('templates.left_menu'));
return $dis;
}
}
?>