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: 780: 781: 782: 783: 784: 785: 786: 787: 788: 789: 790: 791: 792: 793: 794: 795: 796: 797: 798: 799: 800: 801: 802: 803: 804: 805: 806: 807: 808: 809: 810: 811: 812: 813: 814: 815: 816: 817: 818: 819: 820: 821: 822: 823: 824: 825: 826: 827: 828: 829: 830: 831: 832: 833: 834: 835: 836: 837: 838: 839: 840: 841: 842: 843: 844: 845: 846: 847: 848: 849: 850: 851: 852: 853: 854: 855: 856: 857: 858: 859: 860: 861: 862: 863: 864: 865: 866: 867: 868: 869: 870: 871: 872: 873: 874: 875: 876: 877: 878: 879: 880: 881: 882: 883: 884: 885: 886: 887: 888: 889: 890: 891: 892: 893: 894: 895: 896: 897: 898: 899: 900: 901: 902: 903: 904: 905: 906: 907: 908: 909: 910: 911: 912: 913: 914: 915: 916: 917: 918: 919: 920: 921: 922: 923: 924: 925: 926: 927: 928: 929: 930: 931: 932: 933: 934: 935: 936: 937: 938: 939: 940: 941: 942: 943: 944: 945:
<?php
class PHPShopCore {
var $objBase;
var $objPath;
var $debug = false;
var $template_debug = true;
var $mysql_error = false;
var $Disp, $ListInfoItems;
var $action = array("nav" => "index");
var $action_prefix = null;
var $title, $description, $keywords, $lastmodified;
var $navigation_link, $navigation_array = null;
var $template = 'templates.shop';
var $navigationBase = 'base.categories';
var $arrayPath;
var $nav_len = 3;
var $cache = false;
var $garbage_enabled = false;
var $empty_index_action = true;
var $memory = true;
var $max_item = 300;
function __construct() {
global $PHPShopSystem, $PHPShopNav, $PHPShopModules;
if ($this->objBase) {
$this->PHPShopOrm = new PHPShopOrm($this->objBase);
$this->PHPShopOrm->debug = $this->debug;
$this->PHPShopOrm->cache = $this->cache;
}
$this->SysValue = &$GLOBALS['SysValue'];
$this->PHPShopSystem = $PHPShopSystem;
$this->num_row = $this->PHPShopSystem->getParam('num_row');
$this->PHPShopNav = $PHPShopNav;
$this->PHPShopModules = &$PHPShopModules;
$this->page = $this->PHPShopNav->getId();
if (strlen($this->page) == 0)
$this->page = 1;
$this->set('pageProduct', $this->SysValue['license']['product_name']);
}
function __call($name, $arguments) {
if ($name == __CLASS__) {
self::__construct();
}
}
function ifValue($paramName, $paramValue = false) {
if (empty($paramValue))
$paramValue = 1;
if ($this->objRow[$paramName] == $paramValue)
return true;
}
function getNavigationPath($id) {
$PHPShopOrm = new PHPShopOrm($this->getValue($this->navigationBase));
$PHPShopOrm->debug = $this->debug;
$PHPShopOrm->cache = $this->cache;
if (!empty($id)) {
$PHPShopOrm->comment = "";
$v = $PHPShopOrm->select(array('name,id,parent_to'), array('id' => '=' . $id), false, array('limit' => 1));
if (is_array($v)) {
$this->navigation_array[] = array('id' => $v['id'], 'name' => $v['name'], 'parent_to' => $v['parent_to']);
if (!empty($v['parent_to']))
$this->getNavigationPath($v['parent_to']);
}
}
}
function navigation($id, $name, $title = false) {
global $SysValue;
$dis = null;
$elementTemplate = $SysValue['dir']['templates'] . chr(47) . $_SESSION['skin'] . chr(47) . $this->getValue('templates.breadcrumbs_splitter');
$lastElemTemplate = $SysValue['dir']['templates'] . chr(47) . $_SESSION['skin'] . chr(47) . $this->getValue('templates.breadcrumbs_splitter_last');
if ((bool) PHPShopParser::check($this->getValue('templates.breadcrumbs_splitter'), 'breadcrumbElemTitle') === false) {
$elementTemplate = './phpshop/lib/templates/breadcrumbs/breadcrumbs_splitter.tpl';
}
$lastTemplatePath = $this->getValue('templates.breadcrumbs_splitter_last');
if (empty($lastTemplatePath) || PHPShopParser::checkFile($lastElemTemplate, true) === false) {
$lastElemTemplate = './phpshop/lib/templates/breadcrumbs/breadcrumbs_last.tpl';
}
$home = ParseTemplateReturn($this->getValue('templates.breadcrumbs_home'), false, $this->template_debug);
if (empty($home))
$home = PHPShopText::a('/', __(''));
$this->getNavigationPath($id);
if (is_array($this->navigation_array))
$arrayPath = array_reverse($this->navigation_array);
$currentIndex = 2;
if (is_array($arrayPath)) {
foreach ($arrayPath as $v) {
if ($this->PHPShopNav->getPath() == "shop")
$this->set('thisCat' . $i++, $v['id']);
if ($name != $v['name']) {
$this->set('breadcrumbElemLink', '/' . $this->PHPShopNav->getPath() . '/CID_' . $v['id'] . '.html');
$this->set('breadcrumbElemTitle', $v['name']);
$this->set('breadcrumbElemIndex', $currentIndex++);
$dis .= ParseTemplateReturn($elementTemplate, true, $this->template_debug);
}
}
}
if (!empty($this->PHPShopNav) and $this->PHPShopNav->getPath() == "shop")
$this->set('thisCat' . $i++, $this->PHPShopNav->getId());
if (empty($dis) and is_array($title)) {
$this->set('breadcrumbElemLink', $title['url']);
$this->set('breadcrumbElemTitle', $title['name']);
$this->set('breadcrumbElemIndex', $currentIndex++);
$dis = ParseTemplateReturn($elementTemplate, true, $this->template_debug);
}
$this->set('breadcrumbElemTitle', PHPShopText::b($name));
$dis = $home . $dis . '' . ParseTemplateReturn($lastElemTemplate, true, $this->template_debug);
$this->set('breadCrumbs', $dis);
$this->set('pageNameId', $id);
}
function header() {
if ($this->getValue("cache.last_modified") == "true" and empty($_SESSION['cart'])) {
@header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
@header("Pragma: no-cache");
if (!empty($this->lastmodified)) {
$updateDate = @gmdate("D, d M Y H:i:s", $this->lastmodified);
} else {
$updateDate = gmdate("D, d M Y H:i:s", (date("U") - 21600));
}
@header("Last-Modified: " . $updateDate . " GMT");
}
if(!$this->PHPShopSystem instanceof PHPShopSystem) {
$this->PHPShopSystem = new PHPShopSystem();
}
if ($this->PHPShopSystem->ifSerilizeParam('admoption.hsts', 1))
@header("Strict-Transport-Security:max-age=63072000");
@header("X-Powered-By: PHPShop");
}
function meta() {
if ($this->PHPShopSystem) {
if (!empty($this->title))
$this->set('pageTitl', strip_tags($this->title));
else
$this->set('pageTitl', $this->PHPShopSystem->getValue("title"));
if (!empty($this->description))
$this->set('pageDesc', str_replace('"', "", strip_tags($this->description)));
else
$this->set('pageDesc', $this->PHPShopSystem->getValue("descrip"));
if (!empty($this->keywords))
$this->set('pageKeyw', str_replace('"', "", strip_tags($this->keywords)));
else
$this->set('pageKeyw', $this->PHPShopSystem->getValue("keywords"));
}
if ($this->get('breadCrumbs') == '') {
if (strstr($this->title, '-'))
$title = explode("-", $this->title);
else
$title[0] = $this->title;
$this->navigation(false, $title[0]);
}
}
function loadAction() {
$this->setAction();
$this->Compile();
}
function getListInfoItem($select = false, $where = false, $order = false, $class_name = false, $function_name = false, $sql = false) {
$this->ListInfoItems = null;
$this->where = $where;
if (!PHPShopSecurity::true_num($this->page) and strtoupper($this->page) != 'ALL')
return $this->setError404();
if (empty($this->page)) {
$num_ot = 0;
$num_do = $this->num_row;
} else {
$num_ot = $this->num_row * ($this->page - 1);
$num_do = $this->num_row;
}
if (strtoupper($this->page) == 'ALL') {
$num_ot = 0;
$num_do = $this->max_item;
}
$option = array('limit' => intval($num_ot) . ',' . intval($num_do));
$this->set('productFound', $this->getValue('lang.found_of_products'));
$this->set('productNumOnPage', $this->getValue('lang.row_on_page'));
$this->set('productPage', $this->getValue('lang.page_now'));
$this->PHPShopOrm->comment = __CLASS__ . '.' . __FUNCTION__;
if (!empty($sql)) {
$this->PHPShopOrm->sql = 'select *, (price_n - price) as discount from ' . $this->objBase . ' where ' . $sql . ' limit ' . $option['limit'];
}
return $this->PHPShopOrm->select($select, $where, $order, $option, $class_name, $function_name);
}
function setPaginator($count = null, $sql = null) {
$type = $this->memory_get(__CLASS__ . '.' . __FUNCTION__);
if (!$type) {
if (!PHPShopParser::checkFile("paginator/paginator_one_link.tpl")) {
$type = "lib";
} else {
$type = "templates";
}
$this->memory_set(__CLASS__ . '.' . __FUNCTION__, $type);
}
if ($type == "lib") {
$template_location = "./phpshop/lib/templates/";
$template_location_bool = true;
}
$this->count = $count;
$SQL = null;
$nWhere = 1;
if (is_array($this->where)) {
$SQL .= ' where ';
foreach ($this->where as $pole => $value) {
$SQL .= $pole . $value;
if ($nWhere < count($this->where))
$SQL .= $this->PHPShopOrm->Option['where'];
$nWhere++;
}
}
$this->PHPShopOrm->comment = __CLASS__ . '.' . __FUNCTION__;
$result = $this->PHPShopOrm->query("select COUNT('id') as count from " . $this->objBase . $SQL);
$row = mysqli_fetch_array($result);
$this->num_page = $row['count'];
$i = 1;
$num = ceil($this->num_page / $this->num_row);
$this->max_page = $num;
if ($this->page > $this->num_page and $this->page != 'ALL') {
return $this->setError404();
}
if ($num > 1) {
if ($this->page >= $num) {
$p_to = $i - 1;
$p_do = $this->page - 1;
} else {
$p_to = $this->page + 1;
$p_do = 1;
}
if ($this->page != 'ALL')
$this->set("paginPageCurnet", $this->page);
else
$this->set("paginPageCurnet", '-');
$this->set("paginPageCount", $num);
while ($i <= $num) {
if ($i > 1) {
$p_start = $this->num_row * ($i - 1) + 1;
$p_end = $p_start + $this->num_row;
} else {
$p_start = $i;
$p_end = $this->num_row;
}
$this->set("paginPageRangeStart", $p_start);
$this->set("paginPageRangeEnd", $p_end);
$this->set("paginPageNumber", $i);
if ($i != $this->page) {
if ($i == 1) {
$this->set("paginLink", substr($this->objPath, 0, strlen($this->objPath) - 1) . '.html' . $sort);
$navigat .= parseTemplateReturn($template_location . "paginator/paginator_one_link.tpl", $template_location_bool);
} else {
if ($i > ($this->page - $this->nav_len) and $i < ($this->page + $this->nav_len)) {
$this->set("paginLink", $this->objPath . $i . '.html' . $sort);
$navigat .= parseTemplateReturn($template_location . "paginator/paginator_one_link.tpl", $template_location_bool);
} else if ($i - ($this->page + $this->nav_len) < 3 and ( ($this->page - $this->nav_len) - $i) < 3) {
$navigat .= parseTemplateReturn($template_location . "paginator/paginator_one_more.tpl", $template_location_bool);
}
}
} else
$navigat .= parseTemplateReturn($template_location . "paginator/paginator_one_selected.tpl", $template_location_bool);
$i++;
}
$this->set("pageNow", $this->getValue('lang.page_now'));
$this->set("navBack", $this->lang('nav_back'));
$this->set("navNext", $this->lang('nav_forw'));
$this->set("navigation", $navigat);
if ($p_do == 1)
$this->set("previousLink", substr($this->objPath, 0, strlen($this->objPath) - 1) . '.html' . $sort);
else
$this->set("previousLink", $this->objPath . ($p_do) . '.html' . $sort);
if ($p_to == 0)
$this->set("nextLink", substr($this->objPath, 0, strlen($this->objPath) - 1) . '.html' . $sort);
else
$this->set("nextLink", $this->objPath . ($p_to) . '.html' . $sort);
if (strtoupper($this->page) == 'ALL')
$this->set("allPages", parseTemplateReturn($template_location . "paginator/paginator_all_pages_link_selected.tpl", $template_location_bool));
else {
$this->set("allPagesLink", $this->objPath . 'ALL.html' . $sort);
$this->set("allPages", parseTemplateReturn($template_location . "paginator/paginator_all_pages_link.tpl", $template_location_bool));
}
$nav = parseTemplateReturn($template_location . "paginator/paginator_main.tpl", $template_location_bool);
$this->set('productPageNav', $nav);
$this->setHook(__CLASS__, __FUNCTION__, $nav, 'END');
}
}
function getFullInfoItem($select, $where, $class_name = false, $function_name = false) {
$result = $this->PHPShopOrm->select($select, $where, false, array('limit' => '1'), $class_name, $function_name);
return $result;
}
function addToTemplate($template, $mod = false, $replace = null) {
if ($mod)
$template_file = $template;
else
$template_file = $this->getValue('dir.templates') . chr(47) . $_SESSION['skin'] . chr(47) . $template;
if (is_file($template_file)) {
$dis = ParseTemplateReturn($template, $mod, $this->template_debug);
if (is_array($replace)) {
foreach ($replace as $key => $val)
$dis = str_replace($key, $val, $dis);
}
$this->ListInfoItems .= $dis;
$this->set('pageContent', $this->ListInfoItems);
} else
$this->setError("addToTemplate", $template_file);
}
function add($content, $list = false) {
if ($list)
$this->ListInfoItems .= $content;
else
$this->Disp .= $content;
}
function parseTemplate($template, $mod = false, $replace = null) {
$this->set('productPageDis', $this->ListInfoItems);
$dis = ParseTemplateReturn($template, $mod, $this->template_debug);
if (is_array($replace)) {
foreach ($replace as $key => $val)
$dis = str_replace($key, $val, $dis);
}
$this->Disp = $dis;
}
function setError($name, $action) {
echo '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<div class="alert alert-danger alert-dismissible" id="debug-message" role="alert" style="margin:10px">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong><span class="glyphicon glyphicon-alert"></span> ' . $name . '()</strong> ' . $action . '
</div>';
}
function Compile() {
$this->set('DispShop', $this->Disp, false);
$hook = $this->setHook(__CLASS__, __FUNCTION__, false, 'START');
if ($hook)
return $hook;
$this->meta();
$this->header();
writeLangFile();
$hook = $this->setHook(__CLASS__, __FUNCTION__, false, 'END');
if ($hook) {
return $hook;
} else {
ParseTemplate($this->getValue($this->template));
}
$this->garbage();
}
function set($var, $value, $flag = false) {
if (!is_array($var))
$name_array[] = $var;
else
$name_array = $var;
foreach ($name_array as $name) {
if ($flag)
$this->SysValue['other'][$name] .= $value;
else
$this->SysValue['other'][$name] = $value;
}
}
function get($name) {
return $this->SysValue['other'][$name];
}
function getValue($param) {
$param = explode(".", $param);
if (count($param) > 2 and ! empty($this->SysValue[$param[0]][$param[1]][$param[2]]))
return $this->SysValue[$param[0]][$param[1]][$param[2]];
if (!empty($this->SysValue[$param[0]][$param[1]]))
return $this->SysValue[$param[0]][$param[1]];
}
function setValue($param, $value) {
$param = explode(".", $param);
if ($param[0] == "var")
$param[0] = "other";
$this->SysValue[$param[0]][$param[1]] = $value;
}
function setAction() {
if (is_array($this->action)) {
foreach ($this->action as $k => $v) {
switch ($k) {
case("post"):
if (is_array($v)) {
foreach ($v as $function)
if (!empty($_POST[$function]) and $this->isAction($function))
return call_user_func(array(&$this, $this->action_prefix . $function));
} else {
if (!empty($_POST[$v]) and $this->isAction($v))
return call_user_func(array(&$this, $this->action_prefix . $v));
}
break;
case("get"):
if (is_array($v)) {
foreach ($v as $function)
if (!empty($_GET[$function]) and $this->isAction($function))
return call_user_func(array(&$this, $this->action_prefix . $function));
} else {
if (!empty($_GET[$v]) and $this->isAction($v))
return call_user_func(array(&$this, $this->action_prefix . $v));
}
break;
case("name"):
if (is_array($v)) {
foreach ($v as $function)
if ($this->PHPShopNav->getName() == $function and $this->isAction($function))
return call_user_func(array(&$this, $this->action_prefix . $function));
} else {
if ($this->PHPShopNav->getName() == $v and $this->isAction($v))
return call_user_func(array(&$this, $this->action_prefix . $v));
}
break;
case("nav"):
if (is_array($v)) {
foreach ($v as $function) {
if ($this->PHPShopNav->getNav() == $function and $this->isAction($function)) {
return call_user_func(array(&$this, $this->action_prefix . $function));
$call_user_func = true;
}
}
if (empty($call_user_func)) {
if ($this->isAction('index')) {
if ($this->PHPShopNav->getNav() and ! $this->empty_index_action)
$this->setError404();
else
call_user_func(array(&$this, $this->action_prefix . 'index'));
} else
$this->setError($this->action_prefix . "index", "");
}
} else {
if (@$this->PHPShopNav and @ $this->PHPShopNav->getNav() == $v and $this->isAction($v))
return call_user_func(array(&$this, $this->action_prefix . $v));
elseif ($this->isAction('index')) {
if (@$this->PHPShopNav->getNav() and ! $this->empty_index_action)
$this->setError404();
else
call_user_func(array(&$this, $this->action_prefix . 'index'));
}
elseif ($this->PHPShopNav)
$this->setError($this->action_prefix . "phpshop" . $this->PHPShopNav->getPath() . "->index", "");
}
break;
}
}
} else
$this->setError("action", "");
}
function isAction($method_name) {
if (method_exists($this, $this->action_prefix . $method_name))
return true;
}
function waitAction($method_name) {
if (!empty($_REQUEST[$method_name]) and $this->isAction($method_name))
call_user_func(array(&$this, $this->action_prefix . $method_name));
}
function setError404() {
if ($this->setHook(__CLASS__, __FUNCTION__))
return true;
$this->title = "" . $this->PHPShopSystem->getValue("name");
@header("HTTP/1.0 404 Not Found");
@header("Status: 404 Not Found");
$this->parseTemplate($this->getValue('templates.error_page_forma'));
}
function doLoadFunction($class_name, $function_name, $function_row = false, $path = false) {
if (empty($path))
$path = $GLOBALS['SysValue']['nav']['path'];
$function_path = './phpshop/core/' . $path . '.core/' . $function_name . '.php';
if (is_file($function_path)) {
include_once($function_path);
if (function_exists($function_name)) {
return call_user_func_array($function_name, array(&$this, $function_row));
}
}
}
function lang($str) {
if ($this->SysValue['lang'][$str])
return $this->SysValue['lang'][$str];
else
return $str;
}
function memory_set($param, $value) {
if (!empty($this->memory)) {
$param = explode(".", $param);
$_SESSION['Memory'][__CLASS__][$param[0]][$param[1]] = $value;
$_SESSION['Memory'][__CLASS__]['time'] = time();
}
}
function memory_get($param, $check = false) {
$this->memory_clean();
if (!empty($this->memory)) {
$param = explode(".", $param);
if (isset($_SESSION['Memory'][__CLASS__][$param[0]][$param[1]])) {
if (!empty($check)) {
if (!empty($_SESSION['Memory'][__CLASS__][$param[0]][$param[1]]))
return true;
} else
return $_SESSION['Memory'][__CLASS__][$param[0]][$param[1]];
}
elseif (!empty($check))
return true;
} else
return true;
}
function memory_clean($clean_now = false) {
if (!empty($_SESSION['Memory'])) {
if (!empty($clean_now))
unset($_SESSION['Memory'][__CLASS__]);
elseif (@$_SESSION['Memory'][__CLASS__]['time'] < (time() - 60 * 10))
unset($_SESSION['Memory'][__CLASS__]);
}
}
function setHook($class_name, $function_name, $data = false, $rout = false) {
if ($this->PHPShopModules)
return $this->PHPShopModules->setHookHandler($class_name, $function_name, array(&$this), $data, $rout);
else
return false;
}
function setHtmlOption($class_name) {
if (!empty($GLOBALS['SysValue']['html'][strtolower($class_name)]))
$this->cell_type = $GLOBALS['SysValue']['html'][strtolower($class_name)];
}
function message($title, $content) {
$message = PHPShopText::b(PHPShopText::notice($title, false, '14px')) . PHPShopText::br();
$message .= PHPShopText::message($content, false, '12px', 'black');
return $message;
}
function garbage() {
if ($this->garbage_enabled) {
timer('start', 'Garbage');
unset($this->SysValue['other']);
timer('end', 'Garbage');
}
}
}
?>