При обновлении Joomla c 1.5 на 2.5 не работает шаблон

Тема в разделе "Установка и обновление Joomla!", создана пользователем kuzik36, 10.06.2016.

  1. Offline

    kuzik36 Недавно здесь

    Регистрация:
    10.06.2016
    Сообщения:
    1
    Симпатии:
    0
    Пол:
    Мужской
    Добрый подскажите как решить проблему с шаблоном сайта после обновления движка с 1.5 на 2.5 при заходе на сайт выдает ошибку в файле /functions.php on line 184

    Код (CODE):
    1. <?php
    2. defined('_JEXEC') or die('Restricted access'); // no direct access
    3.  
    4. if (!defined('_ARTX_FUNCTIONS')) {
    5.  
    6.     define('_ARTX_FUNCTIONS', 1);
    7.  
    8.     $GLOBALS['artx_settings'] = array(
    9.         'block' => array('has_header' => true),
    10.         'menu' => array('show_submenus' => false),
    11.         'vmenu' => array('show_submenus' => false, 'simple' => false)
    12.     );
    13.  
    14.     function artxHasMessages()
    15.     {
    16.         global $mainframe;
    17.         $messages = $mainframe->getMessageQueue();
    18.         if (is_array($messages) && count($messages))
    19.             foreach ($messages as $msg)
    20.                 if (isset($msg['type']) && isset($msg['message']))
    21.                     return true;
    22.         return false;
    23.     }
    24.  
    25.     function artxPost($caption, $content)
    26.     {
    27.         $hasCaption = (null !== $caption && strlen(trim($caption)) > 0);
    28.         $hasContent = (null !== $content && strlen(trim($content)) > 0);
    29.  
    30.         if (!$hasCaption && !$hasContent)
    31.             return '';
    32.  
    33.         ob_start();
    34. ?>
    35. <div class="art-post">
    36.            <div class="art-post-body">
    37.         <div class="art-post-inner">
    38.  
    39.         <?php if ($hasCaption): ?>
    40. <h2 class="art-postheader">
    41.         <?php echo $caption; ?>
    42.  
    43.         </h2>
    44.  
    45.         <?php endif; ?>
    46.         <?php if ($hasContent): ?>
    47. <div class="art-postcontent">
    48.            <!-- article-content -->
    49.  
    50.         <?php echo artxReplaceButtons($content); ?>
    51.  
    52.            <!-- /article-content -->
    53.         </div>
    54.         <div class="cleared"></div>
    55.  
    56.         <?php endif; ?>
    57.  
    58.         </div>
    59.  
    60.                 <div class="cleared"></div>
    61.            </div>
    62.         </div>
    63.  
    64. <?php
    65.         return ob_get_clean();
    66.     }
    67.  
    68.     function artxBlock($caption, $content)
    69.     {
    70.         $hasCaption = ($GLOBALS['artx_settings']['block']['has_header']
    71.             && null !== $caption && strlen(trim($caption)) > 0);
    72.         $hasContent = (null !== $content && strlen(trim($content)) > 0);
    73.  
    74.         if (!$hasCaption && !$hasContent)
    75.             return '';
    76.  
    77.         ob_start();
    78. ?>
    79. <div class="art-block">
    80.            <div class="art-block-tl"></div>
    81.            <div class="art-block-tr"></div>
    82.            <div class="art-block-bl"></div>
    83.            <div class="art-block-br"></div>
    84.            <div class="art-block-tc"></div>
    85.            <div class="art-block-bc"></div>
    86.            <div class="art-block-cl"></div>
    87.            <div class="art-block-cr"></div>
    88.            <div class="art-block-cc"></div>
    89.            <div class="art-block-body">
    90.  
    91.         <?php if ($hasCaption): ?>
    92. <div class="art-blockheader">
    93.             <div class="t">
    94.         <?php echo $caption; ?>
    95. </div>
    96.         </div>
    97.  
    98.         <?php endif; ?>
    99.         <?php if ($hasContent): ?>
    100. <div class="art-blockcontent">
    101.            <div class="art-blockcontent-tl"></div>
    102.            <div class="art-blockcontent-tr"></div>
    103.            <div class="art-blockcontent-bl"></div>
    104.            <div class="art-blockcontent-br"></div>
    105.            <div class="art-blockcontent-tc"></div>
    106.            <div class="art-blockcontent-bc"></div>
    107.            <div class="art-blockcontent-cl"></div>
    108.            <div class="art-blockcontent-cr"></div>
    109.            <div class="art-blockcontent-cc"></div>
    110.            <div class="art-blockcontent-body">
    111.         <!-- block-content -->
    112.  
    113.         <?php echo artxReplaceButtons($content); ?>
    114.  
    115.         <!-- /block-content -->
    116.  
    117.                 <div class="cleared"></div>
    118.            </div>
    119.         </div>
    120.  
    121.         <?php endif; ?>
    122.  
    123.                 <div class="cleared"></div>
    124.            </div>
    125.         </div>
    126.  
    127. <?php
    128.         return ob_get_clean();
    129.     }
    130.  
    131.  
    132.     function artxVMenuBlock($caption, $content)
    133.     {
    134.         $hasCaption = (null !== $caption && strlen(trim($caption)) > 0);
    135.         $hasContent = (null !== $content && strlen(trim($content)) > 0);
    136.  
    137.         if (!$hasCaption && !$hasContent)
    138.             return '';
    139.  
    140.         ob_start();
    141. ?><div class="art-vmenublock">
    142.     <div class="art-vmenublock-tl"></div>
    143.     <div class="art-vmenublock-tr"></div>
    144.     <div class="art-vmenublock-bl"></div>
    145.     <div class="art-vmenublock-br"></div>
    146.     <div class="art-vmenublock-tc"></div>
    147.     <div class="art-vmenublock-bc"></div>
    148.     <div class="art-vmenublock-cl"></div>
    149.     <div class="art-vmenublock-cr"></div>
    150.     <div class="art-vmenublock-cc"></div>
    151.     <div class="art-vmenublock-body">
    152.  
    153.         <?php if ($hasCaption): ?><div class="art-vmenublockheader">
    154.      <div class="t">
    155.         <?php echo $caption; ?></div>
    156. </div>
    157.  
    158.         <?php endif; ?>
    159.         <?php if ($hasContent): ?><div class="art-vmenublockcontent">
    160.     <div class="art-vmenublockcontent-body">
    161. <!-- block-content -->
    162.  
    163.         <?php echo $content; ?>
    164. <!-- /block-content -->
    165.  
    166.         <div class="cleared"></div>
    167.     </div>
    168. </div>
    169.  
    170.         <?php endif; ?>
    171.         <div class="cleared"></div>
    172.     </div>
    173. </div>
    174.  
    175. <?php
    176.         return ob_get_clean();
    177.     }
    178.  
    179.     function artxPageTitle($page, $criteria = null, $key = null)
    180.     {
    181.         if ($criteria === null)
    182.             $criteria = $page->params->def('show_page_title', 1);
    183.         return $criteria
    184.             ? ('<span class="componentheading' . $page->params->get('pageclass_sfx') . '">'
    185.                 . $page->escape($page->params->get($key === null ? 'page_title' : $key)) . '</span>')
    186.             : '';
    187.     }
    188.  
    189.     function artxCountModules(&$document, $position)
    190.     {
    191.         return $document->countModules($position);
    192.     }
    193.  
    194.     function artxPositions(&$document, $positions, $style)
    195.     {
    196.         ob_start();
    197.         if (count($positions) == 3) {
    198.             if (artxCountModules($document, $positions[0])
    199.                 && artxCountModules($document, $positions[1])
    200.                 && artxCountModules($document, $positions[2]))
    201.             {
    202.                 ?>
    203. <table class="position" cellpadding="0" cellspacing="0" border="0">
    204. <tr valign="top">
    205.   <td width="33%"><?php echo artxModules($document, $positions[0], $style); ?></td>
    206.   <td width="33%"><?php echo artxModules($document, $positions[1], $style); ?></td>
    207.   <td><?php echo artxModules($document, $positions[2], $style); ?></td>
    208. </tr>
    209. </table>
    210. <?php
    211.             } elseif (artxCountModules($document, $positions[0]) && artxCountModules($document, $positions[1])) {
    212. ?>
    213. <table class="position" cellpadding="0" cellspacing="0" border="0">
    214. <tr valign="top">
    215.   <td width="33%"><?php echo artxModules($document, $positions[0], $style); ?></td>
    216.   <td><?php echo artxModules($document, $positions[1], $style); ?></td>
    217. </tr>
    218. </table>
    219. <?php
    220.             } elseif (artxCountModules($document, $positions[1]) && artxCountModules($document, $positions[2])) {
    221. ?>
    222. <table class="position" cellpadding="0" cellspacing="0" border="0">
    223. <tr valign="top">
    224.   <td width="67%"><?php echo artxModules($document, $positions[1], $style); ?></td>
    225.   <td><?php echo artxModules($document, $positions[2], $style); ?></td>
    226. </tr>
    227. </table>
    228. <?php
    229.             } elseif (artxCountModules($document, $positions[0]) && artxCountModules($document, $positions[2])) {
    230. ?>
    231. <table class="position" cellpadding="0" cellspacing="0" border="0">
    232. <tr valign="top">
    233.   <td width="50%"><?php echo artxModules($document, $positions[0], $style); ?></td>
    234.   <td><?php echo artxModules($document, $positions[2], $style); ?></td>
    235. </tr>
    236. </table>
    237. <?php
    238.             } else {
    239.                 echo artxModules($document, $positions[0], $style);
    240.                 echo artxModules($document, $positions[1], $style);
    241.                 echo artxModules($document, $positions[2], $style);
    242.             }
    243.         } elseif (count($positions) == 2) {
    244.             if (artxCountModules($document, $positions[0]) && artxCountModules($document, $positions[1])) {
    245. ?>
    246. <table class="position" cellpadding="0" cellspacing="0" border="0">
    247. <tr valign="top">
    248. <td width="50%"><?php echo artxModules($document, $positions[0], $style); ?></td>
    249. <td><?php echo artxModules($document, $positions[1], $style); ?></td>
    250. </tr>
    251. </table>
    252. <?php
    253.             } else {
    254.                 echo artxModules($document, $positions[0], $style);
    255.                 echo artxModules($document, $positions[1], $style);
    256.             }
    257.         } // count($positions)
    258.         return ob_get_clean();
    259.     }
    260.  
    261.     function artxGetContentCellStyle(&$document)
    262.     {
    263.         $leftCnt = artxCountModules($document, 'left');
    264.         $rightCnt = artxCountModules($document, 'right');
    265.         if ($leftCnt > 0 && $rightCnt > 0)
    266.             return 'content';
    267.         if ($rightCnt > 0)
    268.             return 'content-sidebar1';
    269.         if ($leftCnt > 0)
    270.             return 'content-sidebar2';
    271.         return 'content-wide';
    272.     }
    273.  
    274.     function artxHtmlFixMoveScriptToHead($re, $content)
    275.     {
    276.         if (preg_match($re, $content, $matches, PREG_OFFSET_CAPTURE)) {
    277.             $content = substr($content, 0, $matches[0][1])
    278.                 . substr($content, $matches[0][1] + strlen($matches[0][0]));
    279.             $document =& JFactory::getDocument();
    280.             $document->addScriptDeclaration($matches[1][0]);
    281.         }
    282.         return $content;
    283.     }
    284.  
    285.     function artxHtmlFixRemove($re, $content)
    286.     {
    287.         if (preg_match($re, $content, $matches, PREG_OFFSET_CAPTURE)) {
    288.             $content = substr($content, 0, $matches[0][1])
    289.                 . substr($content, $matches[0][1] + strlen($matches[0][0]));
    290.         }
    291.         return $content;
    292.     }
    293.  
    294.     function artxComponentWrapper(&$document)
    295.     {
    296.         if ($document->getType() != 'html')
    297.             return;
    298.         $option = JRequest::getCmd('option');
    299.         $view = JRequest::getCmd('view');
    300.         $layout = JRequest::getCmd('layout');
    301.         $content = $document->getBuffer('component');
    302.         // fixes for w3.org validation
    303.         if ('com_contact' == $option) {
    304.             if ('category' == $view) {
    305.                 $content = artxHtmlFixFormAction($content);
    306.             } elseif ('contact' == $view) {
    307.                 $content = artxHtmlFixMoveScriptToHead('~<script [^>]+>\s*(<!--[^>]*-->)\s*</script>~', $content);
    308.             }
    309.         } elseif ('com_content' == $option) {
    310.             if ('category' == $view) {
    311.                 if ('' == $layout) {
    312.                     $content = artxHtmlFixMoveScriptToHead('~<script [^>]+>([^<]*)</script>~', $content);
    313.                     $content = artxHtmlFixFormAction($content);
    314.                 }
    315.             } elseif ('archive' == $view) {
    316.                 $content = artxHtmlFixRemove('~<ul id="archive-list" style="list-style: none;">\s*</ul>~', $content);
    317.             }
    318.         } elseif ('com_user' == $option) {
    319.             if ('user' == $view) {
    320.                 if ('form' == $layout) {
    321.                     $content = artxHtmlFixRemove('~autocomplete="off"~', $content);
    322.                 }
    323.             }
    324.         }
    325.         if (false === strpos($content, '<div class="art-post">')) {
    326.             $title = null;
    327.             if (preg_match('~<div\s+class="(componentheading[^"]*)"([^>]*)>([^<]+)</div>~', $content, $matches, PREG_OFFSET_CAPTURE)) {
    328.                 $content = substr($content, 0, $matches[0][1]) . substr($content, $matches[0][1] + strlen($matches[0][0]));
    329.                 $title = '<span class="' . $matches[1][0] . '"' . $matches[2][0] . '>' . $matches[3][0] . '</span>';
    330.             }
    331.             $document->setBuffer(artxPost($title, $content), 'component');
    332.         }
    333.     }
    334.  
    335.     function artxModules(&$document, $position, $style = null)
    336.     {
    337.         return '<jdoc:include type="modules" name="' . $position . '"' . (null != $style ? ' style="artstyle" artstyle="' . $style . '"' : '') . ' />';
    338.     }
    339.  
    340.  
    341.         function artxUrlToHref($url)
    342.         {
    343.             $result = '';
    344.             $p = parse_url($url);
    345.             if (isset($p['scheme']) && isset($p['host'])) {
    346.                 $result = $p['scheme'] . '://';
    347.                 if (isset($p['user'])) {
    348.                     $result .= $p['user'];
    349.                     if (isset($p['pass']))
    350.                         $result .= ':' . $p['pass'];
    351.                     $result .= '@';
    352.                 }
    353.                 $result .= $p['host'];
    354.                 if (isset($p['port']))
    355.                     $result .= ':' . $p['port'];
    356.                 if (!isset($p['path']))
    357.                     $result .= '/';
    358.             }
    359.             if (isset($p['path']))
    360.                 $result .= $p['path'];
    361.             if (isset($p['query'])) {
    362.                 $result .= '?' . str_replace('&', '&amp;', $p['query']);
    363.             }
    364.             if (isset($p['fragment']))
    365.                 $result .= '#' . $p['fragment'];
    366.             return $result;
    367.         }
    368.  
    369.         function artxReplaceButtonsRegex() {
    370.             return '' .
    371.                 '~<input\b[^>]*'
    372.                     . '(?:'
    373.                         . '[^>]*\bclass=(?:"(?:[^"]*\s)?button(?:\s[^"]*)?"|\'(?:[^\']*\s)?button(?:\s[^\']*)?\'|button\b)[^>]*'
    374.                         . '(?:\bvalue=(?:"[^"]*"|\'[^\']*\'|[^>\s]*))'
    375.                     . '|'
    376.                         . '(?:\bvalue=(?:"[^"]*"|\'[^\']*\'|[^>\s]*))'
    377.                         . '[^>]*\bclass=(?:"(?:[^"]*\s)?button(?:\s[^"]*)?"|\'(?:[^\']*\s)?button(?:\s[^\']*)?\'|button\b)[^>]*'
    378.                     . '|'
    379.                         . '[^>]*\bclass=(?:"(?:[^"]*\s)?button(?:\s[^"]*)?"|\'(?:[^\']*\s)?button(?:\s[^\']*)?\'|button\b)[^>]*'
    380.                     . ')'
    381.                 . '[^>]*/?\s*>~i';
    382.         }
    383.  
    384.         function artxReplaceButtons($content)
    385.         {
    386.             $re = artxReplaceButtonsRegex();
    387.             if (!preg_match_all($re, $content, $matches, PREG_OFFSET_CAPTURE))
    388.                 return $content;
    389.  
    390.             $result = '';
    391.             $position = 0;
    392.             foreach ($matches[0] as $match) {
    393.                 $result .= substr($content, $position, $match[1] - $position);
    394.                 $position = $match[1] + strlen($match[0]);
    395.                 $result .= '<span class="art-button-wrapper"><span class="l"> </span><span class="r"> </span>'
    396.                     . preg_replace('~\bclass=(?:"([^"]*\s)?button(\s[^"]*)?"|\'([^\']*\s)?button(\s[^\']*)?\'|button\b)~i',
    397.                         'class="\1\3button art-button\2\4"', $match[0]) . '</span>';
    398.             }
    399.             $result .= substr($content, $position);
    400.             return $result;
    401.         }
    402.  
    403.         function artxHtmlFixFormAction($content)
    404.         {
    405.             if (preg_match('~ action="([^"]+)" ~', $content, $matches, PREG_OFFSET_CAPTURE)) {
    406.                 $content = substr($content, 0, $matches[0][1])
    407.                     . ' action="' . artxUrlToHref($matches[1][0]) . '" '
    408.                     . substr($content, $matches[0][1] + strlen($matches[0][0]));
    409.             }
    410.             return $content;
    411.         }
    412.  
    413.         $artxFragments = array();
    414.  
    415.         function artxFragmentBegin($head = '')
    416.         {
    417.             global $artxFragments;
    418.             $artxFragments[] = array('head' => $head, 'content' => '', 'tail' => '');
    419.         }
    420.  
    421.         function artxFragmentContent($content = '')
    422.         {
    423.             global $artxFragments;
    424.             $artxFragments[count($artxFragments) - 1]['content'] = $content;
    425.         }
    426.  
    427.         function artxFragmentEnd($tail = '', $separator = '')
    428.         {
    429.             global $artxFragments;
    430.             $fragment = array_pop($artxFragments);
    431.             $fragment['tail'] = $tail;
    432.             $content = trim($fragment['content']);
    433.             if (count($artxFragments) == 0) {
    434.                 echo (trim($content) == '') ? '' : ($fragment['head'] . $content . $fragment['tail']);
    435.             } else {
    436.                 $result = (trim($content) == '') ? '' : ($fragment['head'] . $content . $fragment['tail']);
    437.                 $fragment =& $artxFragments[count($artxFragments) - 1];
    438.                 $fragment['content'] .= (trim($fragment['content']) == '' ? '' : $separator) . $result;
    439.             }
    440.         }
    441.  
    442.         function artxFragment($head = '', $content = '', $tail = '', $separator = '')
    443.         {
    444.             global $artxFragments;
    445.             if ($head != '' && $content == '' && $tail == '' && $separator == '') {
    446.                 $content = $head;
    447.                 $head = '';
    448.             } elseif ($head != '' && $content != '' && $tail == '' && $separator == '') {
    449.                 $separator = $content;
    450.                 $content = $head;
    451.                 $head = '';
    452.             }
    453.             artxFragmentBegin($head);
    454.             artxFragmentContent($content);
    455.             artxFragmentEnd($tail, $separator);
    456.         }
    457.  
    458.  
    459. }
     
  2.  

Поделиться этой страницей

Загрузка...