Сегодня выдала админка при попытке создать пункт меню.
Полный текст сообщения
Parse error: syntax error, unexpected end of file in /home/u108159901/public_html/administrator/components/com_menus/models/item.php on line 1237
Файл в кодировке UTF8 без BOM.
Коротких тегов <?...?> в index.php шаблона (слышал, бывает причина в этом) -нет.
Пробовал удалять фрагмент кода, в конце которого сбойная строка. Сообщение то же, только номер строки другой.
Хостер ни при чем- на локалке та же проблема.
Ошибка, как я понимаю, распространенная.
код: Указанная строка 1237 - последняя. if (стр 1232-1237) закрывал - не помогает.
<?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access.
defined('_JEXEC') or die;
// Include dependencies.
jimport('joomla.application.component.modeladmin');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
jimport('joomla.tablenested');
require_once JPATH_COMPONENT.'/helpers/menus.php';
/**
* Menu Item Model for Menus.
*
* @package Joomla.Administrator
* @subpackage com_menus
* @since 1.6
*/
class MenusModelItem extends JModelAdmin
{
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_MENUS_ITEM';
/**
* @var string The help screen key for the menu item.
* @since 1.6
*/
protected $helpKey = 'JHELP_MENUS_MENU_ITEM_MANAGER_EDIT';
/**
* @var string The help screen base URL for the menu item.
* @since 1.6
*/
protected $helpURL;
/**
* @var boolean True to use local lookup for the help screen.
* @since 1.6
*/
protected $helpLocal = false;
/**
* Method to test whether a record can be deleted.
*
* @param object A record object.
*
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
* @since 1.6
*/
protected function canDelete($record)
{
if (!empty($record->id)) {
if ($record->published != -2) {
return ;
}
$user = JFactory::getUser();
return $user->authorise('core.delete', 'com_menus.item.'.(int) $record->id);
}
}
/**
* Method to test whether a record can have its state edited.
*
* @param object A record object.
*
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
* @since 1.6
*/
protected function canEditState($record)
{
$user = JFactory::getUser();
if (!empty($record->id)) {
return $user->authorise('core.edit.state', 'com_menus.item.'.(int) $record->id);
}
// Default to component settings if menu item not known.
else {
return parent::canEditState($record);
}
}
/**
* Method to perform batch operations on an item or a set of items.
*
* @param array $commands An array of commands to perform.
* @param array $pks An array of item ids.
* @param array $contexts An array of item contexts.
*
* @return boolean Returns true on success, false on failure.
*
* @since 1.6
*/
public function batch($commands, $pks, $contexts)
{
// Sanitize user ids.
$pks = array_unique($pks);
JArrayHelper::toInteger($pks);
// Remove any values of zero.
if (array_search(0, $pks, true))
{
unset($pks[array_search(0, $pks, true)]);
}
if (empty($pks))
{
$this->setError(JText::_('COM_MENUS_NO_ITEM_SELECTED'));
return false;
}
$done = false;
if (!empty($commands['menu_id']))
{
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c')
{
$result = $this->batchCopy($commands['menu_id'], $pks, $contexts);
if (is_array($result))
{
$pks = $result;
}
else
{
return false;
}
}
elseif ($cmd == 'm' && !$this->batchMove($commands['menu_id'], $pks, $contexts))
{
return false;
}
$done = true;
}
if (!empty($commands['assetgroup_id']))
{
if (!$this->batchAccess($commands['assetgroup_id'], $pks, $contexts))
{
return false;
}
$done = true;
}
if (!empty($commands['language_id']))
{
if (!$this->batchLanguage($commands['language_id'], $pks, $contexts))
{
return false;
}
$done = true;
}
if (!$done)
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
return true;
}
/**
* Batch copy menu items to a new menu or parent.
*
* @param integer $value The new menu or sub-item.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return mixed An array of new IDs on success, boolean false on failure.
*
* @since 1.6
*/
protected function batchCopy($value, $pks, $contexts)
{
// $value comes as {menutype}.{parent_id}
$parts = explode('.', $value);
$menuType = $parts[0];
$parentId = (int) JArrayHelper::getValue($parts, 1, 0);
$table = $this->getTable();
$db = $this->getDbo();
$query = $db->getQuery(true);
$i = 0;
// Check that the parent exists
if ($parentId)
{
if (!$table->load($parentId))
{
if ($error = $table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Non-fatal error
$this->setError(JText::_('JGLOBAL_BATCH_MOVE_PARENT_NOT_FOUND'));
$parentId = 0;
}
}
}
// If the parent is 0, set it to the ID of the root item in the tree
if (empty($parentId))
{
if (!$parentId = $table->getRootId())
{
$this->setError($db->getErrorMsg());
return false;
}
}
// Check that user has create permission for menus
$user = JFactory::getUser();
if (!$user->authorise('core.create', 'com_menus'))
{
$this->setError(JText::_('COM_MENUS_BATCH_MENU_ITEM_CANNOT_CREATE'));
return false;
}
// We need to log the parent ID
$parents = array();
// Calculate the emergency stop count as a precaution against a runaway loop bug
$query->select('COUNT(id)');
$query->from($db->quoteName('#__menu'));
$db->setQuery($query);
$count = $db->loadResult();
if ($error = $db->getErrorMsg())
{
$this->setError($error);
return false;
}
// Parent exists so we let's proceed
while (!empty($pks) && $count > 0)
{
// Pop the first id off the stack
$pk = array_shift($pks);
$table->reset();
// Check that the row actually exists
if (!$table->load($pk))
{
if ($error = $table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JGLOBAL_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// Copy is a bit tricky, because we also need to copy the children
$query->clear();
$query->select('id');
$query->from($db->quoteName('
Что еще делать - не знаю. Прошу помощи.
Спасибо!