1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
16:
17: cInclude('includes', 'functions.file.php');
18:
19: 20: 21: 22: 23: 24: 25: 26: 27:
28: function getAvailableContentTypes($idartlang) {
29: global $db, $cfg, $a_content, $a_description;
30:
31: $sql = "SELECT
32: *
33: FROM
34: " . $cfg["tab"]["content"] . " AS a,
35: " . $cfg["tab"]["art_lang"] . " AS b,
36: " . $cfg["tab"]["type"] . " AS c
37: WHERE
38: a.idtype = c.idtype AND
39: a.idartlang = b.idartlang AND
40: b.idartlang = " . (int) $idartlang;
41:
42: $db->query($sql);
43:
44: while ($db->nextRecord()) {
45: $a_content[$db->f('type')][$db->f('typeid')] = $db->f('value');
46: $a_description[$db->f('type')][$db->f('typeid')] = i18n($db->f('description'));
47: }
48: }
49:
50: 51: 52: 53: 54: 55:
56: function isArtInMultipleUse($idart) {
57: global $cfg;
58:
59: $db = cRegistry::getDb();
60: $sql = "SELECT idart FROM " . $cfg["tab"]["cat_art"] . " WHERE idart = " . (int) $idart;
61: $db->query($sql);
62:
63: return ($db->affectedRows() > 1);
64: }
65:
66: 67: 68: 69: 70: 71: 72:
73: function isAlphanumeric($test, $umlauts = true) {
74: if ($umlauts == true) {
75: $match = "/^[a-z0-9ÄäÖöÜüß ]+$/i";
76: } else {
77: $match = "/^[a-z0-9 ]+$/i";
78: }
79:
80: return (preg_match($match, $test));
81: }
82:
83: 84: 85: 86: 87: 88:
89: function isUtf8($input) {
90: $len = strlen($input);
91:
92: for ($i = 0; $i < $len; $i++) {
93: $char = ord($input[$i]);
94: $n = 0;
95:
96: if ($char < 0x80) {
97: continue;
98: } else if (($char & 0xE0) === 0xC0 && $char > 0xC1) {
99:
100: $n = 1;
101: } else if (($char & 0xF0) === 0xE0) {
102: $n = 2;
103: } else if (($char & 0xF8) === 0xF0 && $char < 0xF5) {
104:
105: $n = 3;
106: } else {
107: return false;
108: }
109:
110: for ($j = 0; $j < $n; $j++) {
111: $i++;
112:
113: if ($i == $len || (ord($input[$i]) & 0xC0) !== 0x80) {
114: return false;
115: }
116: }
117: }
118: return true;
119: }
120:
121: 122: 123: 124: 125: 126:
127: function getCanonicalMonth($month) {
128: switch ($month) {
129: case 1:
130: return (i18n("January"));
131: break;
132: case 2:
133: return (i18n("February"));
134: break;
135: case 3:
136: return (i18n("March"));
137: break;
138: case 4:
139: return (i18n("April"));
140: break;
141: case 5:
142: return (i18n("May"));
143: break;
144: case 6:
145: return (i18n("June"));
146: break;
147: case 7:
148: return (i18n("July"));
149: break;
150: case 8:
151: return (i18n("August"));
152: break;
153: case 9:
154: return (i18n("September"));
155: break;
156: case 10:
157: return (i18n("October"));
158: break;
159: case 11:
160: return (i18n("November"));
161: break;
162: case 12:
163: return (i18n("December"));
164: break;
165: }
166: }
167:
168: 169: 170: 171: 172: 173:
174: function getCanonicalDay($iDay) {
175: switch ($iDay) {
176: case 1:
177: return (i18n("Monday"));
178: break;
179: case 2:
180: return (i18n("Tuesday"));
181: break;
182: case 3:
183: return (i18n("Wednesday"));
184: break;
185: case 4:
186: return (i18n("Thursday"));
187: break;
188: case 5:
189: return (i18n("Friday"));
190: break;
191: case 6:
192: return (i18n("Saturday"));
193: break;
194: case 0:
195: return (i18n("Sunday"));
196: break;
197: default:
198: break;
199: }
200: }
201:
202: 203: 204: 205: 206: 207: 208: 209: 210:
211: function displayDatetime($timestamp = "", $date = false, $time = false) {
212: if ($timestamp == "") {
213: $timestamp = time();
214: } else {
215: $timestamp = strtotime($timestamp);
216: }
217:
218: $ret = "";
219:
220: if ($date && !$time) {
221: $ret = date(getEffectiveSetting("dateformat", "date", "Y-m-d"), $timestamp);
222: } else if ($time && !$date) {
223: $ret = date(getEffectiveSetting("dateformat", "time", "H:i:s"), $timestamp);
224: } else {
225: $ret = date(getEffectiveSetting("dateformat", "full", "Y-m-d H:i:s"), $timestamp);
226: }
227: return $ret;
228: }
229:
230: 231: 232: 233: 234: 235:
236: function getIDForArea($area) {
237: if (!is_numeric($area)) {
238: $oArea = new cApiArea();
239: if ($oArea->loadBy('name', $area)) {
240: $area = $oArea->get('idarea');
241: }
242: }
243:
244: return $area;
245: }
246:
247: 248: 249: 250: 251: 252:
253: function getParentAreaId($area) {
254: $oAreaColl = new cApiAreaCollection();
255: return $oAreaColl->getParentAreaID($area);
256: }
257:
258: 259: 260: 261: 262: 263:
264: function ($menuitem, $return = false) {
265: $str = '
266: <script type="text/javascript">
267: // @todo Use conMarkSubmenuItem(id) in general.js, but we have to ensure to load the file!
268: (function(id){
269: var menuItem;
270:
271: try {
272: // Check if we are in a dual-frame or a quad-frame
273: if (parent.parent.frames[0].name == "header") {
274: if (parent.frames["right_top"].document.getElementById(id)) {
275: menuItem = parent.frames["right_top"].document.getElementById(id).getElementsByTagName("a")[0];
276: parent.frames["right_top"].sub.clicked(menuItem);
277: }
278: } else {
279: // Check if submenuItem is existing and mark it
280: if (parent.parent.frames["right"].frames["right_top"].document.getElementById(id)) {
281: menuItem = parent.parent.frames["right"].frames["right_top"].document.getElementById(id).getElementsByTagName("a")[0];
282: parent.parent.frames["right"].frames["right_top"].sub.clicked(menuItem);
283: }
284: }
285: } catch (e) {}
286: })("c_' . $menuitem . '");
287: </script>';
288:
289: if ($return) {
290: return $str;
291: } else {
292: echo $str;
293: }
294: }
295:
296: 297: 298: 299: 300:
301: function backToMainArea($send) {
302: if ($send) {
303:
304: global $area, $sess, $idart, $idcat, $idartlang, $idcatart, $frame;
305:
306:
307: $oAreaColl = new cApiAreaCollection();
308: $parent = $oAreaColl->getParentAreaID($area);
309:
310:
311: $url_str = 'main.php?' . 'area=' . $parent . '&' . 'idcat=' . $idcat . '&' . 'idart=' . $idart . '&' . 'idartlang=' . $idartlang . '&' . 'idcatart=' . $idcatart . '&' . 'force=1&' . 'frame=' . $frame;
312: $url = $sess->url($url_str);
313:
314:
315: header("location: $url");
316: }
317: }
318:
319: 320: 321: 322: 323: 324:
325: function getLanguagesByClient($client) {
326: $oClientLangColl = new cApiClientLanguageCollection();
327: return $oClientLangColl->getLanguagesByClient($client);
328: }
329:
330: 331: 332: 333: 334: 335: 336:
337: function getLanguageNamesByClient($client) {
338: $oClientLangColl = new cApiClientLanguageCollection();
339: return $oClientLangColl->getLanguageNamesByClient($client);
340: }
341:
342: 343: 344: 345: 346:
347: function set_magic_quotes_gpc(&$code) {
348: global $cfg;
349: if (!$cfg['simulate_magic_quotes']) {
350: if (get_magic_quotes_gpc() == 0) {
351: $code = addslashes($code);
352: }
353: }
354: }
355:
356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367:
368: function getAllClientsAndLanguages() {
369: global $db, $cfg;
370:
371: $sql = "SELECT
372: a.idlang as idlang,
373: a.name as langname,
374: b.name as clientname,
375: b.idclient as idclient
376: FROM
377: " . $cfg["tab"]["lang"] . " as a,
378: " . $cfg["tab"]["clients_lang"] . " as c,
379: " . $cfg["tab"]["clients"] . " as b
380: WHERE
381: a.idlang = c.idlang AND
382: c.idclient = b.idclient";
383: $db->query($sql);
384:
385: $aRs = array();
386: while ($db->nextRecord()) {
387: $aRs[] = array(
388: 'idlang' => $db->f('idlang'),
389: 'langname' => $db->f('langname'),
390: 'idclient' => $db->f('idclient'),
391: 'clientname' => $db->f('clientname')
392: );
393: }
394: return $aRs;
395: }
396:
397: function getmicrotime() {
398: list($usec, $sec) = explode(' ', microtime());
399: return ((float) $usec + (float) $sec);
400: }
401:
402: function isGroup($uid) {
403: $user = new cApiUser();
404: if ($user->loadByPrimaryKey($uid) === false) {
405: return true;
406: } else {
407: return false;
408: }
409: }
410:
411: function getGroupOrUserName($uid) {
412: $user = new cApiUser();
413: if ($user->loadByPrimaryKey($uid) === false) {
414: $group = new cApiGroup();
415:
416: if ($group->loadByPrimaryKey($uid) === false) {
417: return false;
418: } else {
419: return $group->getGroupName(true);
420: }
421: } else {
422: return $user->getField('realname');
423: }
424: }
425:
426: 427: 428: 429: 430: 431:
432: function isValidMail($email, $strict = false) {
433: $validator = cValidatorFactory::getInstance('email');
434: return $validator->isValid($email);
435: }
436:
437: function htmldecode($string) {
438: $trans_tbl = conGetHtmlTranslationTable(HTML_ENTITIES);
439: $trans_tbl = array_flip($trans_tbl);
440: $ret = strtr($string, $trans_tbl);
441: return $ret;
442: }
443:
444: 445: 446: 447: 448: 449: 450: 451: 452: 453:
454: function updateClientCache($idclient = 0, $htmlpath = '', $frontendpath = '') {
455: global $cfg, $cfgClient, $errsite_idcat, $errsite_idart, $db;
456:
457: if (!is_array($cfgClient)) {
458: $cfgClient = array();
459: }
460:
461: if (!is_object($db)) {
462: $db = cRegistry::getDb();
463: }
464:
465: if ($idclient != 0 && $htmlpath != '' && $frontendpath != '') {
466: $cfgClient[$idclient]['path']['frontend'] = cSecurity::escapeString($frontendpath);
467: $cfgClient[$idclient]['path']['htmlpath'] = cSecurity::escapeString($htmlpath);
468: }
469:
470: $sql = 'SELECT idclient, name, errsite_cat, errsite_art FROM ' . $cfg['tab']['clients'];
471: $db->query($sql);
472:
473: $htmlpaths = array();
474: $frontendpaths = array();
475: foreach ($cfgClient as $id => $aclient) {
476: if (is_array($aclient)) {
477: $htmlpaths[$id] = $aclient["path"]["htmlpath"];
478: $frontendpaths[$id] = $aclient["path"]["frontend"];
479: }
480: }
481: unset($cfgClient);
482: $cfgClient = array();
483:
484: foreach ($htmlpaths as $id => $path) {
485: $cfgClient[$id]["path"]["htmlpath"] = $htmlpaths[$id];
486: $cfgClient[$id]["path"]["frontend"] = $frontendpaths[$id];
487: }
488:
489: while ($db->nextRecord()) {
490: $iClient = $db->f('idclient');
491: $cfgClient['set'] = 'set';
492:
493: $cfgClient[$iClient]['name'] = conHtmlSpecialChars(str_replace(array(
494: '*/',
495: '/*',
496: '//'
497: ), '', $db->f('name')));
498:
499: $errsite_idcat[$iClient] = $db->f('errsite_cat');
500: $errsite_idart[$iClient] = $db->f('errsite_art');
501: $cfgClient[$iClient]["errsite"]["idcat"] = $errsite_idcat[$iClient];
502: $cfgClient[$iClient]["errsite"]["idart"] = $errsite_idart[$iClient];
503:
504: $cfgClient[$iClient]['images'] = $cfgClient[$iClient]['path']['htmlpath'] . 'images/';
505: $cfgClient[$iClient]['upload'] = 'upload/';
506:
507: $cfgClient[$iClient]['htmlpath']['frontend'] = $cfgClient[$iClient]['path']['htmlpath'];
508:
509: $cfgClient[$iClient]['upl']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'upload/';
510: $cfgClient[$iClient]['upl']['htmlpath'] = $cfgClient[$iClient]['htmlpath']['frontend'] . 'upload/';
511: $cfgClient[$iClient]['upl']['frontendpath'] = 'upload/';
512:
513: $cfgClient[$iClient]['css']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'css/';
514:
515: $cfgClient[$iClient]['js']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'js/';
516:
517: $cfgClient[$iClient]['tpl']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'templates/';
518:
519: $cfgClient[$iClient]['cache']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'cache/';
520: $cfgClient[$iClient]['cache']['frontendpath'] = 'cache/';
521:
522: $cfgClient[$iClient]['code']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'cache/code/';
523: $cfgClient[$iClient]['code']['frontendpath'] = 'cache/code/';
524:
525: $cfgClient[$iClient]['xml']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'xml/';
526: $cfgClient[$iClient]['xml']['frontendpath'] = 'xml/';
527:
528: $cfgClient[$iClient]['template']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'templates/';
529: $cfgClient[$iClient]['template']['frontendpath'] = 'templates/';
530:
531: $cfgClient[$iClient]['data']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'data/';
532:
533: $cfgClient[$iClient]['module']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'data/modules/';
534: $cfgClient[$iClient]['module']['frontendpath'] = 'data/modules/';
535:
536: $cfgClient[$iClient]['config']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'data/config/' . CON_ENVIRONMENT . '/';
537: $cfgClient[$iClient]['config']['frontendpath'] = 'data/config/';
538:
539: $cfgClient[$iClient]['layout']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'data/layouts/';
540: $cfgClient[$iClient]['layout']['frontendpath'] = 'data/layouts/';
541:
542: $cfgClient[$iClient]['log']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'data/logs/';
543: $cfgClient[$iClient]['log']['frontendpath'] = 'data/logs/';
544:
545: $cfgClient[$iClient]['version']['path'] = $cfgClient[$iClient]['path']['frontend'] . 'data/version/';
546: $cfgClient[$iClient]['version']['frontendpath'] = 'data/version/';
547: }
548:
549: $aConfigFileContent = array();
550: $aConfigFileContent[] = '<?php';
551: $aConfigFileContent[] = 'global $cfgClient;';
552: $aConfigFileContent[] = '';
553:
554: foreach ($cfgClient as $iIdClient => $aClient) {
555: if ((int) $iIdClient > 0 && is_array($aClient)) {
556:
557: $aConfigFileContent[] = '/* ' . $aClient['name'] . ' */';
558: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["name"] = "' . $aClient['name'] . '";';
559: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["errsite"]["idcat"] = "' . $aClient["errsite"]["idcat"] . '";';
560: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["errsite"]["idart"] = "' . $aClient["errsite"]["idart"] . '";';
561: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["images"] = "' . $aClient["path"]["htmlpath"] . 'images/";';
562: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["upload"] = "upload/";';
563:
564: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["path"]["frontend"] = "' . $aClient["path"]["frontend"] . '";';
565:
566: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["htmlpath"]["frontend"] = "' . $aClient["path"]["htmlpath"] . '";';
567:
568: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["upl"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "upload/";';
569: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["upl"]["htmlpath"] = "' . $aClient["htmlpath"]["frontend"] . 'upload/";';
570: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["upl"]["frontendpath"] = "upload/";';
571:
572: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["css"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "css/";';
573:
574: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["js"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "js/";';
575:
576: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["tpl"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "templates/";';
577:
578: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["cache"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "cache/";';
579: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["cache"]["frontendpath"] = "cache/";';
580:
581: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["code"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "cache/code/";';
582: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["code"]["frontendpath"] = "cache/code/";';
583:
584: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["xml"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "xml/";';
585: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["xml"]["frontendpath"] = "xml/";';
586:
587: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["template"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "templates/";';
588: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["template"]["frontendpath"] = "templates/";';
589:
590: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["data"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "data/";';
591:
592: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["module"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "data/modules/";';
593: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["module"]["frontendpath"] = "data/modules/";';
594:
595: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["config"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "data/config/' . CON_ENVIRONMENT . '/";';
596: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["config"]["frontendpath"] = "data/config/";';
597:
598: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["layout"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "data/layouts/";';
599: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["layout"]["frontendpath"] = "data/layouts/";';
600:
601: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["log"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "data/logs/";';
602: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["log"]["frontendpath"] = "data/logs/";';
603:
604: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["version"]["path"] = $cfgClient[' . $iIdClient . ']["path"]["frontend"] . "data/version/";';
605: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["version"]["frontendpath"] = "data/version/";';
606: $aConfigFileContent[] = '$cfgClient[' . $iIdClient . ']["path"]["htmlpath"] = "' . $aClient['path']['htmlpath'] . '";';
607: $aConfigFileContent[] = '';
608: }
609: }
610: $aConfigFileContent[] = '$cfgClient["set"] = "set";';
611: $aConfigFileContent[] = '?>';
612:
613: cFileHandler::write($cfg['path']['contenido_config'] . 'config.clients.php', implode(PHP_EOL, $aConfigFileContent));
614:
615: return $cfgClient;
616: }
617:
618: 619: 620: 621: 622: 623: 624: 625: 626: 627: 628:
629: function setSystemProperty($type, $name, $value, $idsystemprop = 0) {
630: if ($type == '' || $name == '') {
631: return false;
632: }
633:
634: $idsystemprop = (int) $idsystemprop;
635:
636: $systemPropColl = new cApiSystemPropertyCollection();
637:
638: if ($idsystemprop == 0) {
639: $prop = $systemPropColl->setValueByTypeName($type, $name, $value);
640: } else {
641: $prop = $systemPropColl->setTypeNameValueById($type, $name, $value, $idsystemprop);
642: }
643: }
644:
645: 646: 647: 648: 649: 650: 651:
652: function deleteSystemProperty($type, $name) {
653: $systemPropColl = new cApiSystemPropertyCollection();
654: $systemPropColl->deleteByTypeName($type, $name);
655: }
656:
657: 658: 659: 660: 661: 662: 663: 664: 665: 666: 667: 668: 669: 670: 671: 672:
673: function getSystemProperties($bGetPropId = false) {
674: $return = array();
675:
676: $systemPropColl = new cApiSystemPropertyCollection();
677: $props = $systemPropColl->fetchAll('type ASC, name ASC, value ASC');
678: foreach ($props as $prop) {
679: $item = $prop->toArray();
680:
681: if ($bGetPropId) {
682: $return[$item['type']][$item['name']]['value'] = $item['value'];
683: $return[$item['type']][$item['name']]['idsystemprop'] = $item['idsystemprop'];
684: } else {
685: $return[$item['type']][$item['name']] = $item['value'];
686: }
687: }
688:
689: return $return;
690: }
691:
692: 693: 694: 695: 696: 697: 698:
699: function getSystemProperty($type, $name) {
700: $systemPropColl = new cApiSystemPropertyCollection();
701: $prop = $systemPropColl->fetchByTypeName($type, $name);
702: return ($prop)? $prop->get('value') : false;
703: }
704:
705: 706: 707: 708: 709: 710:
711: function getSystemPropertiesByType($type) {
712: $return = array();
713:
714: $systemPropColl = new cApiSystemPropertyCollection();
715: $props = $systemPropColl->fetchByType($type);
716: foreach ($props as $prop) {
717: $return[$prop->get('name')] = $prop->get('value');
718: }
719: if (count($return) > 1) {
720: ksort($return);
721: }
722: return $return;
723: }
724:
725: 726: 727: 728: 729: 730: 731: 732: 733: 734: 735: 736: 737: 738:
739: function getEffectiveSetting($type, $name, $default = '') {
740: return cEffectiveSetting::get($type, $name, $default);
741: }
742:
743: 744: 745: 746: 747: 748: 749: 750: 751: 752: 753: 754:
755: function getEffectiveSettingsByType($type) {
756: return cEffectiveSetting::getByType($type);
757: }
758:
759: 760: 761: 762: 763:
764: function getArtspec() {
765: global $db, $cfg, $lang, $client;
766: $sql = "SELECT artspec, idartspec, online, artspecdefault FROM " . $cfg['tab']['art_spec'] . "
767: WHERE client = " . (int) $client . " AND lang = " . (int) $lang . " ORDER BY artspec ASC";
768: $db->query($sql);
769:
770: $artspec = array();
771:
772: while ($db->nextRecord()) {
773: $artspec[$db->f("idartspec")]['artspec'] = $db->f("artspec");
774: $artspec[$db->f("idartspec")]['online'] = $db->f("online");
775: $artspec[$db->f("idartspec")]['default'] = $db->f("artspecdefault");
776: }
777: return $artspec;
778: }
779:
780: 781: 782: 783: 784: 785: 786:
787: function addArtspec($artspectext, $online) {
788: global $db, $cfg, $lang, $client;
789:
790: if (isset($_POST['idartspec'])) {
791: $fields = array(
792: 'artspec' => $artspectext,
793: 'online' => (int) $online
794: );
795: $where = array(
796: 'idartspec' => (int) $_POST['idartspec']
797: );
798: $sql = $db->buildUpdate($cfg['tab']['art_spec'], $fields, $where);
799: } else {
800: $fields = array(
801: 'client' => (int) $client,
802: 'lang' => (int) $lang,
803: 'artspec' => $artspectext,
804: 'online' => 0,
805: 'artspecdefault' => 0
806: );
807: $sql = $db->buildInsert($cfg['tab']['art_spec'], $fields);
808: }
809: $db->query($sql);
810: }
811:
812: 813: 814: 815: 816:
817: function deleteArtspec($idartspec) {
818: global $db, $cfg;
819: $sql = "DELETE FROM " . $cfg['tab']['art_spec'] . " WHERE idartspec = " . (int) $idartspec;
820: $db->query($sql);
821:
822: $sql = "UPDATE " . $cfg["tab"]["art_lang"] . " SET artspec = 0 WHERE artspec = " . (int) $idartspec;
823: $db->query($sql);
824: }
825:
826: 827: 828: 829: 830: 831: 832: 833: 834:
835: function setArtspecOnline($idartspec, $online) {
836: global $db, $cfg;
837: $sql = "UPDATE " . $cfg['tab']['art_spec'] . " SET online = " . (int) $online . " WHERE idartspec = " . (int) $idartspec;
838: $db->query($sql);
839: }
840:
841: 842: 843: 844: 845: 846: 847: 848:
849: function setArtspecDefault($idartspec) {
850: global $db, $cfg, $lang, $client;
851: $sql = "UPDATE " . $cfg['tab']['art_spec'] . " SET artspecdefault=0 WHERE client = " . (int) $client . " AND lang = " . (int) $lang;
852: $db->query($sql);
853:
854: $sql = "UPDATE " . $cfg['tab']['art_spec'] . " SET artspecdefault = 1 WHERE idartspec = " . (int) $idartspec;
855: $db->query($sql);
856: }
857:
858: 859: 860: 861: 862: 863: 864: 865:
866: function buildArticleSelect($sName, $iIdCat, $sValue) {
867: global $cfg, $lang;
868:
869: $db = cRegistry::getDb();
870:
871: $selectElem = new cHTMLSelectElement($sName, "", $sName);
872: $selectElem->appendOptionElement(new cHTMLOptionElement(i18n("Please choose"), ""));
873:
874: $sql = "SELECT b.title, b.idart FROM
875: " . $cfg["tab"]["art"] . " AS a, " . $cfg["tab"]["art_lang"] . " AS b, " . $cfg["tab"]["cat_art"] . " AS c
876: WHERE c.idcat = " . (int) $iIdCat . "
877: AND b.idlang = " . (int) $lang . " AND b.idart = a.idart and b.idart = c.idart
878: ORDER BY b.title";
879:
880: $db->query($sql);
881:
882: while ($db->nextRecord()) {
883: if ($sValue != $db->f('idart')) {
884: $selectElem->appendOptionElement(new cHTMLOptionElement($db->f('title'), $db->f('idart')));
885: } else {
886: $selectElem->appendOptionElement(new cHTMLOptionElement($db->f('title'), $db->f('idart'), true));
887: }
888: }
889:
890: return $selectElem->toHTML();
891: }
892:
893: 894: 895: 896: 897: 898: 899: 900: 901:
902: function buildCategorySelect($sName, $sValue, $sLevel = 0, $sClass = '') {
903: global $cfg, $client, $lang;
904:
905: $db = cRegistry::getDb();
906: $db2 = cRegistry::getDb();
907:
908: $selectElem = new cHTMLSelectElement($sName, "", $sName);
909: $selectElem->setClass($sClass);
910: $selectElem->appendOptionElement(new cHTMLOptionElement(i18n("Please choose"), ""));
911:
912: if ($sLevel > 0) {
913: $addString = "AND c.level < " . (int) $sLevel;
914: }
915:
916: $sql = "SELECT a.idcat AS idcat, b.name AS name, c.level FROM
917: " . $cfg["tab"]["cat"] . " AS a, " . $cfg["tab"]["cat_lang"] . " AS b,
918: " . $cfg["tab"]["cat_tree"] . " AS c WHERE a.idclient = " . (int) $client . "
919: AND b.idlang = " . (int) $lang . " AND b.idcat = a.idcat AND c.idcat = a.idcat " . $addString . "
920: ORDER BY c.idtree";
921:
922: $db->query($sql);
923:
924: $categories = array();
925:
926: while ($db->nextRecord()) {
927: $categories[$db->f("idcat")]["name"] = $db->f("name");
928:
929: $sql2 = "SELECT level FROM " . $cfg["tab"]["cat_tree"] . " WHERE idcat = " . (int) $db->f("idcat");
930: $db2->query($sql2);
931:
932: if ($db2->nextRecord()) {
933: $categories[$db->f("idcat")]["level"] = $db2->f("level");
934: }
935:
936: $sql2 = "SELECT a.title AS title, b.idcatart AS idcatart FROM
937: " . $cfg["tab"]["art_lang"] . " AS a, " . $cfg["tab"]["cat_art"] . " AS b
938: WHERE b.idcat = '" . $db->f("idcat") . "' AND a.idart = b.idart AND
939: a.idlang = " . (int) $lang;
940:
941: $db2->query($sql2);
942:
943: while ($db2->nextRecord()) {
944: $categories[$db->f("idcat")]["articles"][$db2->f("idcatart")] = $db2->f("title");
945: }
946: }
947:
948: foreach ($categories as $tmpidcat => $props) {
949: $spaces = " ";
950:
951: for ($i = 0; $i < $props["level"]; $i++) {
952: $spaces .= " ";
953: }
954:
955: $tmp_val = $tmpidcat;
956:
957: if ($sValue != $tmp_val) {
958: $selectElem->appendOptionElement(new cHTMLOptionElement($spaces . ">" . $props["name"], $tmp_val));
959: } else {
960: $selectElem->appendOptionElement(new cHTMLOptionElement($spaces . ">" . $props["name"], $tmp_val, true));
961: }
962: }
963:
964: return $selectElem->toHTML();
965: }
966:
967: 968: 969: 970: 971: 972:
973: function humanReadableSize($number) {
974: $base = 1024;
975: $suffixes = array(
976: 'Bytes',
977: 'KiB',
978: 'MiB',
979: 'GiB',
980: 'TiB',
981: 'PiB',
982: 'EiB'
983: );
984:
985: $usesuf = 0;
986: $n = (float) $number;
987: while ($n >= $base) {
988: $n /= (float) $base;
989: $usesuf++;
990: }
991:
992: $places = 2 - floor(log10($n));
993: $places = max($places, 0);
994: $retval = number_format($n, $places, '.', '') . ' ' . $suffixes[$usesuf];
995: return $retval;
996: }
997:
998: 999: 1000: 1001: 1002: 1003:
1004: function machineReadableSize($sizeString) {
1005: $val = trim($sizeString);
1006: $last = strtolower($val[strlen($val) - 1]);
1007: $val = (float) substr($val, 0, strlen($val) - 1);
1008: switch ($last) {
1009: case 'g':
1010: $val *= 1024;
1011: case 'm':
1012: $val *= 1024;
1013: case 'k':
1014: $val *= 1024;
1015: }
1016:
1017: return $val;
1018: }
1019:
1020: 1021: 1022: 1023: 1024:
1025: function isRunningFromWeb() {
1026: if ($_SERVER['PHP_SELF'] == '' || php_sapi_name() == 'cgi' || php_sapi_name() == 'cli') {
1027: return false;
1028: }
1029:
1030: return true;
1031: }
1032:
1033: 1034: 1035: 1036: 1037: 1038: 1039: 1040: 1041: 1042: 1043: 1044: 1045: 1046: 1047: 1048: 1049: 1050: 1051: 1052:
1053: function scanPlugins($entity) {
1054: global $cfg;
1055:
1056: $basedir = cRegistry::getBackendPath() . $cfg['path']['plugins'] . $entity . '/';
1057: if (is_dir($basedir) === false) {
1058: return;
1059: }
1060:
1061: $pluginorder = getSystemProperty('plugin', $entity . '-pluginorder');
1062: $lastscantime = getSystemProperty('plugin', $entity . '-lastscantime');
1063:
1064: $plugins = array();
1065:
1066:
1067: if ($pluginorder != '') {
1068: $plugins = explode(',', $pluginorder);
1069: foreach ($plugins as $key => $plugin) {
1070: $plugins[$key] = trim($plugin);
1071: }
1072: }
1073:
1074:
1075: if ($lastscantime + 300 < time()) {
1076: setSystemProperty('plugin', $entity . '-lastscantime', time());
1077: if (is_dir($basedir)) {
1078: if (false !== $dh = opendir($basedir)) {
1079: while (($file = readdir($dh)) !== false) {
1080: if (is_dir($basedir . $file) && $file != 'includes' && $file != '.' && $file != '..') {
1081: if (!in_array($file, $plugins)) {
1082: if (cFileHandler::exists($basedir . $file . '/' . $file . '.php')) {
1083: $plugins[] = $file;
1084: }
1085: }
1086: }
1087: }
1088: closedir($dh);
1089: }
1090: }
1091:
1092: foreach ($plugins as $key => $value) {
1093: if (!is_dir($basedir . $value) || !cFileHandler::exists($basedir . $value . '/' . $value . '.php')) {
1094: unset($plugins[$key]);
1095: }
1096: }
1097:
1098: sort($plugins);
1099:
1100: $pluginorder = implode(',', $plugins);
1101: setSystemProperty('plugin', $entity . '-pluginorder', $pluginorder);
1102: }
1103:
1104: foreach ($plugins as $key => $value) {
1105: if (!is_dir($basedir . $value) || !cFileHandler::exists($basedir . $value . '/' . $value . '.php')) {
1106: unset($plugins[$key]);
1107: } else {
1108: i18nRegisterDomain($entity . '_' . $value, $basedir . $value . '/locale/');
1109: }
1110: }
1111:
1112: $cfg['plugins'][$entity] = $plugins;
1113: }
1114:
1115: 1116: 1117: 1118: 1119:
1120: function includePlugins($entity) {
1121: global $cfg;
1122:
1123: if (is_array($cfg['plugins'][$entity])) {
1124: foreach ($cfg['plugins'][$entity] as $plugin) {
1125: plugin_include($entity, $plugin . '/' . $plugin . '.php');
1126: }
1127: }
1128: }
1129:
1130: 1131: 1132: 1133: 1134:
1135: function callPluginStore($entity) {
1136: global $cfg;
1137:
1138:
1139: if (is_array($cfg['plugins'][$entity])) {
1140: foreach ($cfg['plugins'][$entity] as $plugin) {
1141: if (function_exists($entity . '_' . $plugin . '_wantedVariables') && function_exists($entity . '_' . $plugin . '_store')) {
1142: $wantVariables = call_user_func($entity . '_' . $plugin . '_wantedVariables');
1143:
1144: if (is_array($wantVariables)) {
1145: $varArray = array();
1146: foreach ($wantVariables as $value) {
1147: $varArray[$value] = stripslashes($GLOBALS[$value]);
1148: }
1149: }
1150: $store = call_user_func($entity . '_' . $plugin . '_store', $varArray);
1151: }
1152: }
1153: }
1154: }
1155:
1156: 1157: 1158: 1159: 1160: 1161:
1162: function createRandomName($nameLength) {
1163: $NameChars = 'abcdefghijklmnopqrstuvwxyz';
1164: $Vouel = 'aeiou';
1165: $Name = '';
1166:
1167: for ($index = 1; $index <= $nameLength; $index++) {
1168: if ($index % 3 == 0) {
1169: $randomNumber = rand(1, strlen($Vouel));
1170: $Name .= substr($Vouel, $randomNumber - 1, 1);
1171: } else {
1172: $randomNumber = rand(1, strlen($NameChars));
1173: $Name .= substr($NameChars, $randomNumber - 1, 1);
1174: }
1175: }
1176:
1177: return $Name;
1178: }
1179:
1180: function setHelpContext($area) {
1181: global $cfg;
1182:
1183: if ($cfg['help'] == true) {
1184: $hc = "parent.parent.parent.frames[0].document.getElementById('help').setAttribute('data', '$area');";
1185: } else {
1186: $hc = '';
1187: }
1188:
1189: return $hc;
1190: }
1191:
1192: 1193: 1194: 1195: 1196: 1197:
1198: function defineIfNotDefined($constant, $value) {
1199: if (!defined($constant)) {
1200: define($constant, $value);
1201: }
1202: }
1203:
1204: 1205: 1206: 1207: 1208: 1209: 1210: 1211:
1212: function cDie($file, $line, $message) {
1213: cError($file, $line, $message);
1214: die("$file $line: $message");
1215: }
1216:
1217: 1218: 1219: 1220: 1221: 1222: 1223: 1224: 1225: 1226:
1227: function buildStackString($startlevel = 2) {
1228: $e = new Exception();
1229: $stack = $e->getTrace();
1230:
1231: $msg = '';
1232:
1233: for ($i = $startlevel; $i < count($stack); $i++) {
1234: $filename = basename($stack[$i]['file']);
1235:
1236: $msg .= "\t" . $stack[$i]['function'] . "() called in file " . $filename . "(" . $stack[$i]['line'] . ")\n";
1237: }
1238:
1239: return $msg;
1240: }
1241:
1242: 1243: 1244: 1245: 1246: 1247: 1248: 1249: 1250: 1251: 1252: 1253: 1254:
1255: function cWarning() {
1256: global $cfg;
1257:
1258: $args = func_get_args();
1259: if (count($args) == 3) {
1260:
1261: $file = $args[0];
1262: $line = $args[1];
1263: $message = $args[2];
1264: } else {
1265:
1266: $file = '';
1267: $line = '';
1268: $message = $args[0];
1269: }
1270:
1271: $msg = "[" . date("Y-m-d H:i:s") . "] ";
1272: $msg .= "Warning: \"" . $message . "\" at ";
1273:
1274: $e = new Exception();
1275: $stack = $e->getTrace();
1276: $function_name = $stack[1]['function'];
1277:
1278: $msg .= $function_name . "() [" . basename($stack[0]['file']) . "(" . $stack[0]['line'] . ")]\n";
1279:
1280: if ($cfg['debug']['log_stacktraces'] == true) {
1281: $msg .= buildStackString();
1282: $msg .= "\n";
1283: }
1284:
1285: cFileHandler::write($cfg['path']['contenido_logs'] . 'errorlog.txt', $msg, true);
1286:
1287: trigger_error($message, E_USER_WARNING);
1288: }
1289:
1290: 1291: 1292: 1293: 1294: 1295: 1296: 1297: 1298: 1299: 1300: 1301: 1302:
1303: function cError($message) {
1304: global $cfg;
1305:
1306: $args = func_get_args();
1307: if (count($args) == 3) {
1308:
1309: $file = $args[0];
1310: $line = $args[1];
1311: $message = $args[2];
1312: } else {
1313:
1314: $file = '';
1315: $line = '';
1316: $message = $args[0];
1317: }
1318:
1319: $msg = "[" . date("Y-m-d H:i:s") . "] ";
1320: $msg .= "Error: \"" . $message . "\" at ";
1321:
1322: $e = new Exception();
1323: $stack = $e->getTrace();
1324: $function_name = $stack[1]['function'];
1325:
1326: $msg .= $function_name . "() called in " . basename($stack[1]['file']) . "(" . $stack[1]['line'] . ")\n";
1327:
1328: if ($cfg['debug']['log_stacktraces'] == true) {
1329: $msg .= buildStackString();
1330: $msg .= "\n";
1331: }
1332:
1333: cFileHandler::write($cfg['path']['contenido_logs'] . 'errorlog.txt', $msg, true);
1334:
1335: trigger_error($message, E_USER_ERROR);
1336: }
1337:
1338: 1339: 1340: 1341: 1342:
1343: function cDeprecated($message = '') {
1344: global $cfg;
1345:
1346: if (isset($cfg['debug']['log_deprecations']) && $cfg['debug']['log_deprecations'] == false) {
1347: return;
1348: }
1349:
1350: $e = new Exception();
1351: $stack = $e->getTrace();
1352: $function_name = $stack[1]['function'];
1353:
1354: $msg = "Deprecated call: " . $function_name . "() [" . basename($stack[0]['file']) . "(" . $stack[0]['line'] . ")]: ";
1355: if ($message != '') {
1356: $msg .= "\"" . $message . "\"" . "\n";
1357: } else {
1358: $msg .= "\n";
1359: }
1360:
1361: if ($cfg['debug']['log_stacktraces'] == true) {
1362: $msg .= buildStackString(2);
1363: $msg .= "\n";
1364: }
1365:
1366: cFileHandler::write($cfg['path']['contenido_logs'] . 'deprecatedlog.txt', $msg, true);
1367: }
1368:
1369: 1370: 1371: 1372: 1373: 1374:
1375: function getNamedFrame($frame) {
1376: switch ($frame) {
1377: case 1:
1378: return 'left_top';
1379: break;
1380: case 2:
1381: return 'left_bottom';
1382: break;
1383: case 3:
1384: return 'right_top';
1385: break;
1386: case 4:
1387: return 'right_bottom';
1388: break;
1389: default:
1390: return '';
1391: break;
1392: }
1393: }
1394:
1395: 1396: 1397: 1398: 1399: 1400: 1401:
1402: function startTiming($function, $parameters = array()) {
1403: global $_timings, $cfg;
1404:
1405: if ($cfg['debug']['functiontiming'] == false) {
1406: return;
1407: }
1408:
1409:
1410: $uuid = md5(uniqid(rand(), true));
1411:
1412: if (!is_array($parameters)) {
1413: cWarning(__FILE__, __LINE__, "Warning: startTiming's parameters parameter expects an array");
1414: $parameters = array();
1415: }
1416:
1417: $_timings[$uuid]['parameters'] = $parameters;
1418: $_timings[$uuid]['function'] = $function;
1419:
1420: $_timings[$uuid]['start'] = getmicrotime();
1421:
1422: return $uuid;
1423: }
1424:
1425: 1426: 1427: 1428: 1429:
1430: function endAndLogTiming($uuid) {
1431: global $_timings, $cfg;
1432:
1433: if ($cfg['debug']['functiontiming'] == false) {
1434: return;
1435: }
1436:
1437: $_timings[$uuid]['end'] = getmicrotime();
1438:
1439: $timeSpent = $_timings[$uuid]['end'] - $_timings[$uuid]['start'];
1440:
1441: $myparams = array();
1442:
1443:
1444: foreach ($_timings[$uuid]['parameters'] as $parameter) {
1445: switch (gettype($parameter)) {
1446: case 'string':
1447: $myparams[] = '"' . $parameter . '"';
1448: break;
1449: case 'boolean':
1450: if ($parameter == true) {
1451: $myparams[] = 'true';
1452: } else {
1453: $myparams[] = 'false';
1454: }
1455: break;
1456: default:
1457: if ($parameter == '') {
1458: $myparams[] = '"' . $parameter . '"';
1459: } else {
1460: $myparams[] = $parameter;
1461: }
1462: }
1463: }
1464:
1465: $parameterString = implode(', ', $myparams);
1466:
1467: cDebug::out('calling function ' . $_timings[$uuid]['function'] . '(' . $parameterString . ') took ' . $timeSpent . ' seconds');
1468: }
1469:
1470: 1471: 1472: 1473: 1474: 1475: 1476: 1477: 1478: 1479:
1480: function ($db, $cfg, $lang, $contentType = 'text/html') {
1481: if (isset($_GET['use_encoding'])) {
1482: $use_encoding = trim(strip_tags($_GET['use_encoding']));
1483: } elseif (isset($_POST['use_encoding'])) {
1484: $use_encoding = trim(strip_tags($_POST['use_encoding']));
1485: } else {
1486: $use_encoding = true;
1487: }
1488:
1489: if (is_string($use_encoding)) {
1490: $use_encoding = ($use_encoding == 'false')? false : true;
1491: }
1492:
1493: if ($use_encoding != false) {
1494: $aLanguageEncodings = array();
1495:
1496: $oLangColl = new cApiLanguageCollection();
1497: $oLangColl->select();
1498: while (($oItem = $oLangColl->next()) !== false) {
1499: $aLanguageEncodings[$oItem->get('idlang')] = $oItem->get('encoding');
1500: }
1501:
1502: $charset = 'ISO-8859-1';
1503: if (isset($aLanguageEncodings[$lang])) {
1504: if (in_array($aLanguageEncodings[$lang], $cfg['AvailableCharsets'])) {
1505: $charset = $aLanguageEncodings[$lang];
1506: }
1507: }
1508: header('Content-Type: ' . $contentType . '; charset=' . $charset);
1509: }
1510: }
1511:
1512: 1513: 1514: 1515: 1516: 1517: 1518: 1519:
1520: function ipMatch($network, $mask, $ip) {
1521: bcscale(3);
1522: $ip_long = ip2long($ip);
1523: $mask_long = ip2long($network);
1524:
1525:
1526: if (preg_match('/^[0-9]+$/', $mask)) {
1527:
1528: $divider = bcpow(2, (32 - $mask));
1529: } else {
1530:
1531: $xmask = ip2long($mask);
1532: if ($xmask < 0) {
1533: $xmask = bcadd(bcpow(2, 32), $xmask);
1534: }
1535: $divider = bcsub(bcpow(2, 32), $xmask);
1536: }
1537:
1538: if (floor(bcdiv($ip_long, $divider)) == floor(bcdiv($mask_long, $divider))) {
1539:
1540: return true;
1541: } else {
1542:
1543: return false;
1544: }
1545: }
1546:
1547: 1548: 1549: 1550: 1551: 1552: 1553:
1554: function endsWith($haystack, $needle) {
1555: $length = strlen($needle);
1556: if ($length == 0) {
1557: return true;
1558: }
1559:
1560: return (substr($haystack, -$length) === $needle);
1561: }
1562:
1563: 1564: 1565: 1566: 1567: 1568: 1569:
1570: function renderBackendBreadcrumb($syncoptions, $showArticle = true, $return = false) {
1571: $tplBread = new cTemplate();
1572: $tplBread->set('s', 'LABEL', i18n("You are here"));
1573: $syncoptions = (int) $syncoptions;
1574:
1575: $helper = cCategoryHelper::getInstance();
1576: $categories = $helper->getCategoryPath(cRegistry::getCategoryId(), 1);
1577: $catCount = count($categories);
1578: $tplCfg = new cApiTemplateConfiguration();
1579: $sess = cRegistry::getSession();
1580: $cfg = cRegistry::getConfig();
1581: $lang = cRegistry::getLanguageId();
1582: $idart = cRegistry::getArticleId();
1583:
1584:
1585: for ($i = 0; $i<$catCount; $i++) {
1586: $idcat_tpl = 0;
1587: $idcat_bread = $categories[$i]->getField('idcat');
1588: $idcat_name = $categories[$i]->getField('name');
1589: $idcat_tplcfg = $categories[$i]->getField('idtplcfg');
1590: if ((int) $idcat_tplcfg > 0) {
1591: $tplCfg->loadByPrimaryKey($idcat_tplcfg);
1592: if ($tplCfg->isLoaded()) {
1593: $idcat_tpl = $tplCfg->getField('idtpl');
1594: }
1595: }
1596:
1597: $linkUrl = $sess->url(cRegistry::getBackendUrl() . "main.php?area=con&frame=4&idcat=$idcat_bread&idtpl=$idcat_tpl&syncoptions=$syncoptions&contenido=1");
1598: $tplBread->set('d', 'LINK', $linkUrl);
1599: $tplBread->set('d', 'NAME', $idcat_name);
1600:
1601: $sepArrow = '';
1602: if ($i < $catCount-1) {
1603: $sepArrow = ' > ';
1604: } else {
1605: if ((int) $idart > 0 && $showArticle === true) {
1606: $art = new cApiArticleLanguage();
1607: $art->loadByArticleAndLanguageId($idart, $lang);
1608: if ($art->isLoaded()) {
1609: $name = $art->getField('title');
1610: $sepArrow = ' > ' . $name;
1611: }
1612: }
1613: }
1614: $tplBread->set('d', 'SEP_ARROW', $sepArrow);
1615:
1616: $tplBread->next();
1617: }
1618:
1619: return $tplBread->generate($cfg['path']['templates'] . $cfg['templates']['breadcrumb'], $return);
1620: }
1621:
1622: ?>