本文整理汇总了PHP中ELAdmin::config方法的典型用法代码示例。如果您正苦于以下问题:PHP ELAdmin::config方法的具体用法?PHP ELAdmin::config怎么用?PHP ELAdmin::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ELAdmin
的用法示例。
在下文中一共展示了ELAdmin::config方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUpdatedata
/**
* Logic for the Update Check
*
* @access public
* @return object
* @since 0.9
*/
function getUpdatedata()
{
$elsettings = ELAdmin::config();
include_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'Snoopy.class.php';
$snoopy = new Snoopy();
//set the source file
$file = 'http://update.schlu.net/elupdate.php';
$snoopy->read_timeout = 30;
$snoopy->agent = "Mozilla/5.0 (compatible; Konqueror/3.2; Linux 2.6.2) (KHTML, like Gecko)";
$snoopy->fetch($file);
$_updatedata = null;
if ($snoopy->status != 200 || $snoopy->error) {
$_updatedata->failed = 1;
} else {
$data = explode('|', $snoopy->results);
$_updatedata->version = $data[0];
$_updatedata->versiondetail = $data[1];
$_updatedata->date = strftime($elsettings->formatdate, strtotime($data[2]));
$_updatedata->info = $data[3];
$_updatedata->download = $data[4];
$_updatedata->notes = $data[5];
$_updatedata->changes = explode(';', $data[6]);
$_updatedata->failed = 0;
$_updatedata->current = version_compare('0.9.0.0.alpha', $_updatedata->version);
}
return $_updatedata;
}
示例2: display
function display($tpl = null)
{
global $mainframe, $option;
//initialise variables
$db =& JFactory::getDBO();
$elsettings = ELAdmin::config();
$document =& JFactory::getDocument();
JHTML::_('behavior.tooltip');
JHTML::_('behavior.modal');
//get var
$filter_order = $mainframe->getUserStateFromRequest($option . '.eventelement.filter_order', 'filter_order', 'a.dates', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.eventelement.filter_order_Dir', 'filter_order_Dir', '', 'word');
$filter = $mainframe->getUserStateFromRequest($option . '.eventelement.filter', 'filter', '', 'int');
$filter_state = $mainframe->getUserStateFromRequest($option . '.eventelement.filter_state', 'filter_state', '*', 'word');
$search = $mainframe->getUserStateFromRequest($option . '.eventelement.search', 'search', '', 'string');
$search = $db->getEscaped(trim(JString::strtolower($search)));
$template = $mainframe->getTemplate();
//prepare the document
$document->setTitle(JText::_('SELECTEVENT'));
$document->addStyleSheet('templates/' . $template . '/css/general.css');
$document->addStyleSheet('components/com_eventlist/assets/css/eventlistbackend.css');
//Get data from the model
$rows =& $this->get('Data');
// $total = & $this->get( 'Total');
$pageNav =& $this->get('Pagination');
//publish unpublished filter
$lists['state'] = JHTML::_('grid.state', $filter_state);
// table ordering
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
//Create the filter selectlist
$filters = array();
$filters[] = JHTML::_('select.option', '1', JText::_('EVENT TITLE'));
$filters[] = JHTML::_('select.option', '2', JText::_('VENUE'));
$filters[] = JHTML::_('select.option', '3', JText::_('CITY'));
$filters[] = JHTML::_('select.option', '4', JText::_('CATEGORY'));
$lists['filter'] = JHTML::_('select.genericlist', $filters, 'filter', 'size="1" class="inputbox"', 'value', 'text', $filter);
// search filter
$lists['search'] = $search;
//assign data to template
$this->assignRef('lists', $lists);
$this->assignRef('rows', $rows);
$this->assignRef('pageNav', $pageNav);
$this->assignRef('elsettings', $elsettings);
parent::display($tpl);
}
示例3: uploadimage
/**
* logic for uploading an image
*
* @access public
* @return void
* @since 0.9
*/
function uploadimage()
{
global $mainframe;
// Check for request forgeries
JRequest::checkToken() or die('Invalid Token');
$elsettings = ELAdmin::config();
$file = JRequest::getVar('userfile', '', 'files', 'array');
$task = JRequest::getVar('task');
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
//$ftp = JClientHelper::getCredentials('ftp');
//set the target directory
if ($task == 'venueimgup') {
$base_Dir = JPATH_SITE . DS . 'images' . DS . 'eventlist' . DS . 'venues' . DS;
} else {
$base_Dir = JPATH_SITE . DS . 'images' . DS . 'eventlist' . DS . 'events' . DS;
}
//do we have an upload?
if (empty($file['name'])) {
echo "<script> alert('" . JText::_('IMAGE EMPTY') . "'); window.history.go(-1); </script>\n";
$mainframe->close();
}
//check the image
$check = ELImage::check($file, $elsettings);
if ($check === false) {
$mainframe->redirect($_SERVER['HTTP_REFERER']);
}
//sanitize the image filename
$filename = ELImage::sanitize($base_Dir, $file['name']);
$filepath = $base_Dir . $filename;
//upload the image
if (!JFile::upload($file['tmp_name'], $filepath)) {
echo "<script> alert('" . JText::_('UPLOAD FAILED') . "'); window.history.go(-1); </script>\n";
$mainframe->close();
} else {
echo "<script> alert('" . JText::_('UPLOAD COMPLETE') . "'); window.history.go(-1); window.parent.elSelectImage('{$filename}', '{$filename}'); </script>\n";
$mainframe->close();
}
}
示例4: display
function display($tpl = null)
{
$app =& JFactory::getApplication();
// Load pane behavior
jimport('joomla.html.pane');
JHTML::_('behavior.tooltip');
// Load the form validation behavior
JHTML::_('behavior.formvalidation');
//initialise variables
$editor =& JFactory::getEditor();
$document =& JFactory::getDocument();
$pane =& JPane::getInstance('sliders');
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
$settings = ELAdmin::config();
$nullDate = $db->getNullDate();
//get vars
$cid = JRequest::getInt('cid');
//add css and js to document
$document->addScript('../includes/js/joomla/popup.js');
$document->addStyleSheet('../includes/js/joomla/popup.css');
$document->addStyleSheet('components/com_eventlist/assets/css/eventlistbackend.css');
// Get data from the model
$model =& $this->getModel();
$row =& $this->get('Data');
// fail if checked out not by 'me'
if ($row->id) {
if ($model->isCheckedOut($user->get('id'))) {
JError::raiseWarning('SOME_ERROR_CODE', $row->venue . ' ' . JText::_('EDITED BY ANOTHER ADMIN'));
$app->redirect('index.php?option=com_eventlist&view=venues');
}
}
//create the toolbar
if ($cid) {
JToolBarHelper::title(JText::_('EDIT VENUE'), 'venuesedit');
//makes data safe
JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'locdescription');
} else {
JToolBarHelper::title(JText::_('ADD VENUE'), 'venuesedit');
//set the submenu
JSubMenuHelper::addEntry(JText::_('EVENTLIST'), 'index.php?option=com_eventlist');
JSubMenuHelper::addEntry(JText::_('EVENTS'), 'index.php?option=com_eventlist&view=events');
JSubMenuHelper::addEntry(JText::_('VENUES'), 'index.php?option=com_eventlist&view=venues');
JSubMenuHelper::addEntry(JText::_('CATEGORIES'), 'index.php?option=com_eventlist&view=categories');
JSubMenuHelper::addEntry(JText::_('ARCHIVESCREEN'), 'index.php?option=com_eventlist&view=archive');
JSubMenuHelper::addEntry(JText::_('GROUPS'), 'index.php?option=com_eventlist&view=groups');
JSubMenuHelper::addEntry(JText::_('HELP'), 'index.php?option=com_eventlist&view=help');
if ($user->get('gid') > 24) {
JSubMenuHelper::addEntry(JText::_('SETTINGS'), 'index.php?option=com_eventlist&controller=settings&task=edit');
}
}
JToolBarHelper::apply();
JToolBarHelper::spacer();
JToolBarHelper::save();
JToolBarHelper::spacer();
JToolBarHelper::cancel();
JToolBarHelper::spacer();
JToolBarHelper::help('el.editvenues', true);
//Build the image select functionality
$js = "\n\t\tfunction elSelectImage(image, imagename) {\n\t\t\tdocument.getElementById('a_image').value = image;\n\t\t\tdocument.getElementById('a_imagename').value = imagename;\n\t\t\tdocument.getElementById('imagelib').src = '../images/eventlist/venues/' + image;\n\t\t\tdocument.getElementById('sbox-window').close();\n\t\t}";
$link = 'index.php?option=com_eventlist&view=imagehandler&layout=uploadimage&task=venueimg&tmpl=component';
$link2 = 'index.php?option=com_eventlist&view=imagehandler&task=selectvenueimg&tmpl=component';
$document->addScriptDeclaration($js);
JHTML::_('behavior.modal', 'a.modal');
$imageselect = "\n<input style=\"background: #ffffff;\" type=\"text\" id=\"a_imagename\" value=\"{$row->locimage}\" disabled=\"disabled\" onchange=\"javascript:if (document.forms[0].a_imagename.value!='') {document.imagelib.src='../images/eventlist/venues/' + document.forms[0].a_imagename.value} else {document.imagelib.src='../images/blank.png'}\"; /><br />";
$imageselect .= "<div class=\"button2-left\"><div class=\"blank\"><a class=\"modal\" title=\"" . JText::_('Upload') . "\" href=\"{$link}\" rel=\"{handler: 'iframe', size: {x: 650, y: 375}}\">" . JText::_('Upload') . "</a></div></div>\n";
$imageselect .= "<div class=\"button2-left\"><div class=\"blank\"><a class=\"modal\" title=\"" . JText::_('SELECTIMAGE') . "\" href=\"{$link2}\" rel=\"{handler: 'iframe', size: {x: 650, y: 375}}\">" . JText::_('SELECTIMAGE') . "</a></div></div>\n";
$imageselect .= "\n <input class=\"inputbox\" type=\"button\" onclick=\"elSelectImage('', '" . JText::_('SELECTIMAGE') . "' );\" value=\"" . JText::_('Reset') . "\" />";
$imageselect .= "\n<input type=\"hidden\" id=\"a_image\" name=\"locimage\" value=\"{$row->locimage}\" />";
$countries = array();
$countries[] = JHTML::_('select.option', '', JText::_('Select country'));
$countries = array_merge($countries, ELHelper::getCountryOptions());
$lists['countries'] = JHTML::_('select.genericlist', $countries, 'country', 'class="inputbox"', 'value', 'text', $row->country);
unset($countries);
//assign data to template
$this->assignRef('row', $row);
$this->assignRef('pane', $pane);
$this->assignRef('editor', $editor);
$this->assignRef('settings', $settings);
$this->assignRef('nullDate', $nullDate);
$this->assignRef('imageselect', $imageselect);
$this->assignRef('lists', $lists);
parent::display($tpl);
}
示例5: _displayaddvenue
/**
* Creates the output for the add venue screen
*
* @since 0.9
*
*/
function _displayaddvenue($tpl)
{
//initialise variables
$editor =& JFactory::getEditor();
$document =& JFactory::getDocument();
$uri =& JFactory::getURI();
$elsettings = ELAdmin::config();
//add css and js to document
JHTML::_('behavior.modal', 'a.modal');
JHTML::_('behavior.tooltip');
//Build the image select functionality
$js = "\n\t\tfunction elSelectImage(image, imagename) {\n\t\t\tdocument.getElementById('a_image').value = image;\n\t\t\tdocument.getElementById('a_imagename').value = imagename;\n\t\t\tdocument.getElementById('sbox-window').close();\n\t\t}";
$link = 'index.php?option=com_eventlist&view=imagehandler&layout=uploadimage&task=venueimg&tmpl=component';
$link2 = 'index.php?option=com_eventlist&view=imagehandler&task=selectvenueimg&tmpl=component';
$document->addScriptDeclaration($js);
$imageselect = "\n<input style=\"background: #ffffff;\" type=\"text\" id=\"a_imagename\" value=\"" . JText::_('SELECTIMAGE') . "\" disabled=\"disabled\" onchange=\"javascript:if (document.forms[0].a_imagename.value!='') {document.imagelib.src='../images/eventlist/venues/' + document.forms[0].a_imagename.value} else {document.imagelib.src='../images/blank.png'}\"; /><br />";
$imageselect .= "<div class=\"button2-left\"><div class=\"blank\"><a class=\"modal\" title=\"" . JText::_('Upload') . "\" href=\"{$link}\" rel=\"{handler: 'iframe', size: {x: 650, y: 375}}\">" . JText::_('Upload') . "</a></div></div>\n";
$imageselect .= "<div class=\"button2-left\"><div class=\"blank\"><a class=\"modal\" title=\"" . JText::_('SELECTIMAGE') . "\" href=\"{$link2}\" rel=\"{handler: 'iframe', size: {x: 650, y: 375}}\">" . JText::_('SELECTIMAGE') . "</a></div></div>\n";
$imageselect .= "\n <input class=\"inputbox\" type=\"button\" onclick=\"elSelectImage('', '" . JText::_('SELECTIMAGE') . "' );\" value=\"" . JText::_('Reset') . "\" />";
$imageselect .= "\n<input type=\"hidden\" id=\"a_image\" name=\"locimage\" value=\"" . JText::_('SELECTIMAGE') . "\" />";
$countries = array();
$countries[] = JHTML::_('select.option', '', JText::_('Select country'));
$countries = array_merge($countries, ELHelper::getCountryOptions());
$lists['countries'] = JHTML::_('select.genericlist', $countries, 'country', 'class="inputbox"', 'value', 'text');
unset($countries);
//set published
$published = 1;
//assign to template
$this->assignRef('editor', $editor);
$this->assignRef('imageselect', $imageselect);
$this->assignRef('published', $published);
$this->assignRef('request_url', $uri->toString());
$this->assignRef('elsettings', $elsettings);
$this->assignRef('lists', $lists);
parent::display($tpl);
}
示例6: store
/**
* Method to store the event
*
* @access public
* @return boolean True on success
* @since 1.5
*/
function store($data)
{
global $mainframe;
$elsettings = ELAdmin::config();
$user =& JFactory::getUser();
$tzoffset = $mainframe->getCfg('offset');
$row =& JTable::getInstance('eventlist_events', '');
// Bind the form fields to the table
if (!$row->bind($data)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Check/sanitize the metatags
$row->meta_description = htmlspecialchars(trim(addslashes($row->meta_description)));
if (JString::strlen($row->meta_description) > 255) {
$row->meta_description = JString::substr($row->meta_description, 0, 254);
}
$row->meta_keywords = htmlspecialchars(trim(addslashes($row->meta_keywords)));
if (JString::strlen($row->meta_keywords) > 200) {
$row->meta_keywords = JString::substr($row->meta_keywords, 0, 199);
}
//Check if image was selected
jimport('joomla.filesystem.file');
$format = JFile::getExt('JPATH_SITE/images/eventlist/events/' . $row->datimage);
$allowable = array('gif', 'jpg', 'png');
if (in_array($format, $allowable)) {
$row->datimage = $row->datimage;
} else {
$row->datimage = '';
}
// sanitise id field
$row->id = (int) $row->id;
$nullDate = $this->_db->getNullDate();
// Are we saving from an item edit?
if ($row->id) {
$row->modified = gmdate('Y-m-d H:i:s');
$row->modified_by = $user->get('id');
} else {
$row->modified = $nullDate;
$row->modified_by = '';
//get IP, time and userid
$row->created = gmdate('Y-m-d H:i:s');
$row->author_ip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED';
$row->created_by = $user->get('id');
}
// Make sure the data is valid
if (!$row->check($elsettings)) {
$this->setError($row->getError());
return false;
}
// Store the table to the database
if (!$row->store(true)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
return $row->id;
}
示例7: store
/**
* Method to store the venue
*
* @access public
* @return boolean True on success
* @since 1.5
*/
function store($data)
{
$elsettings = ELAdmin::config();
$user =& JFactory::getUser();
$config =& JFactory::getConfig();
$tzoffset = $config->getValue('config.offset');
$row =& $this->getTable('eventlist_venues', '');
// bind it to the table
if (!$row->bind($data)) {
JError::raiseError(500, $this->_db->getErrorMsg());
return false;
}
// Check if image was selected
jimport('joomla.filesystem.file');
$format = JFile::getExt(JPATH_SITE . '/images/eventlist/venues/' . $row->locimage);
$allowable = array('gif', 'jpg', 'png');
if (in_array($format, $allowable)) {
$row->locimage = $row->locimage;
} else {
$row->locimage = '';
}
// sanitise id field
$row->id = (int) $row->id;
$nullDate = $this->_db->getNullDate();
// Are we saving from an item edit?
if ($row->id) {
$row->modified = gmdate('Y-m-d H:i:s');
$row->modified_by = $user->get('id');
} else {
$row->modified = $nullDate;
$row->modified_by = '';
//get IP, time and userid
$row->created = gmdate('Y-m-d H:i:s');
$row->author_ip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED';
}
//uppercase needed by mapservices
if ($row->country) {
$row->country = JString::strtoupper($row->country);
}
//update item order
if (!$row->id) {
$row->ordering = $row->getNextOrder();
}
$row->version++;
// Make sure the data is valid
if (!$row->check($elsettings)) {
$this->setError($row->getError());
return false;
}
// Store it in the db
if (!$row->store()) {
JError::raiseError(500, $this->_db->getErrorMsg());
return false;
}
return $row->id;
}
示例8: _displayuploadimage
/**
* Prepares the upload image screen
*
* @param $tpl
*
* @since 0.9
*/
function _displayuploadimage($tpl = null)
{
//initialise variables
$document =& JFactory::getDocument();
$uri =& JFactory::getURI();
$elsettings = ELAdmin::config();
//get vars
$task = JRequest::getVar('task');
//add css
$document->addStyleSheet('components/com_eventlist/assets/css/eventlistbackend.css');
jimport('joomla.client.helper');
$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
//assign data to template
$this->assignRef('task', $task);
$this->assignRef('elsettings', $elsettings);
$this->assignRef('request_url', $uri->toString());
$this->assignRef('ftp', $ftp);
parent::display($tpl);
}
示例9: display
function display($tpl = null)
{
global $mainframe, $option;
//initialise variables
$user =& JFactory::getUser();
$document =& JFactory::getDocument();
$db =& JFactory::getDBO();
$elsettings = ELAdmin::config();
//get vars
$filter_order = $mainframe->getUserStateFromRequest($option . '.events.filter_order', 'filter_order', 'a.dates', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.events.filter_order_Dir', 'filter_order_Dir', '', 'word');
$filter_state = $mainframe->getUserStateFromRequest($option . '.events.filter_state', 'filter_state', '*', 'word');
$filter = $mainframe->getUserStateFromRequest($option . '.events.filter', 'filter', '', 'int');
$search = $mainframe->getUserStateFromRequest($option . '.events.search', 'search', '', 'string');
$search = $db->getEscaped(trim(JString::strtolower($search)));
$template = $mainframe->getTemplate();
//add css and submenu to document
$document->addStyleSheet('components/com_eventlist/assets/css/eventlistbackend.css');
//Create Submenu
JSubMenuHelper::addEntry(JText::_('EVENTLIST'), 'index.php?option=com_eventlist');
JSubMenuHelper::addEntry(JText::_('EVENTS'), 'index.php?option=com_eventlist&view=events', true);
JSubMenuHelper::addEntry(JText::_('VENUES'), 'index.php?option=com_eventlist&view=venues');
JSubMenuHelper::addEntry(JText::_('CATEGORIES'), 'index.php?option=com_eventlist&view=categories');
JSubMenuHelper::addEntry(JText::_('ARCHIVE'), 'index.php?option=com_eventlist&view=archive');
JSubMenuHelper::addEntry(JText::_('GROUPS'), 'index.php?option=com_eventlist&view=groups');
JSubMenuHelper::addEntry(JText::_('HELP'), 'index.php?option=com_eventlist&view=help');
if ($user->get('gid') > 24) {
JSubMenuHelper::addEntry(JText::_('SETTINGS'), 'index.php?option=com_eventlist&controller=settings&task=edit');
}
JHTML::_('behavior.tooltip');
//create the toolbar
JToolBarHelper::title(JText::_('EVENTS'), 'events');
JToolBarHelper::archiveList();
JToolBarHelper::spacer();
JToolBarHelper::publishList();
JToolBarHelper::spacer();
JToolBarHelper::unpublishList();
JToolBarHelper::spacer();
JToolBarHelper::addNew();
JToolBarHelper::spacer();
JToolBarHelper::editList();
JToolBarHelper::spacer();
JToolBarHelper::deleteList();
JToolBarHelper::spacer();
JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'Copy');
JToolBarHelper::spacer();
JToolBarHelper::help('el.listevents', true);
// Get data from the model
$rows =& $this->get('Data');
//$total = & $this->get( 'Total');
$pageNav =& $this->get('Pagination');
//publish unpublished filter
$lists['state'] = JHTML::_('grid.state', $filter_state);
// table ordering
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
//search filter
$filters = array();
$filters[] = JHTML::_('select.option', '1', JText::_('EVENT TITLE'));
$filters[] = JHTML::_('select.option', '2', JText::_('VENUE'));
$filters[] = JHTML::_('select.option', '3', JText::_('CITY'));
$filters[] = JHTML::_('select.option', '4', JText::_('CATEGORY'));
$lists['filter'] = JHTML::_('select.genericlist', $filters, 'filter', 'size="1" class="inputbox"', 'value', 'text', $filter);
// search filter
$lists['search'] = $search;
//assign data to template
$this->assignRef('lists', $lists);
$this->assignRef('rows', $rows);
$this->assignRef('pageNav', $pageNav);
$this->assignRef('user', $user);
$this->assignRef('template', $template);
$this->assignRef('elsettings', $elsettings);
parent::display($tpl);
}
示例10: _displayprint
/**
* Prepares the print screen
*
* @param $tpl
*
* @since 0.9
*/
function _displayprint($tpl = null)
{
$elsettings = ELAdmin::config();
$document =& JFactory::getDocument();
$document->addStyleSheet('components/com_eventlist/assets/css/eventlistbackend.css');
$rows =& $this->get('Data');
$event =& $this->get('Event');
$event->dates = strftime($elsettings->formatdate, strtotime($event->dates));
//assign data to template
$this->assignRef('rows', $rows);
$this->assignRef('event', $event);
parent::display($tpl);
}
示例11: store
/**
* Method to store the event
*
* @access public
* @return boolean True on success
* @since 1.5
*/
function store($data)
{
//$app = & JFactory::getApplication();
$elsettings = ELAdmin::config();
$user =& JFactory::getUser();
$cats = JRequest::getVar('cid', array(), 'post', 'array');
$row =& JTable::getInstance('eventlist_events', '');
// Bind the form fields to the table
if (!$row->bind($data)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
//get values from time selectlist and concatenate them accordingly
$starthours = JRequest::getCmd('starthours');
$startminutes = JRequest::getCmd('startminutes');
$endhours = JRequest::getCmd('endhours');
$endminutes = JRequest::getCmd('endminutes');
$row->times = $starthours . ':' . $startminutes;
$row->endtimes = $endhours . ':' . $endminutes;
// Check the metatags
if (JString::strlen($row->meta_description) > 255) {
$row->meta_description = JString::substr($row->meta_description, 0, 254);
}
if (JString::strlen($row->meta_keywords) > 200) {
$row->meta_keywords = JString::substr($row->meta_keywords, 0, 199);
}
//Check if image was selected
jimport('joomla.filesystem.file');
$format = JFile::getExt('JPATH_SITE/images/eventlist/events/' . $row->datimage);
$allowable = array('gif', 'jpg', 'png');
if (in_array($format, $allowable)) {
$row->datimage = $row->datimage;
} else {
$row->datimage = '';
}
// sanitise id field
$row->id = (int) $row->id;
$nullDate = $this->_db->getNullDate();
// Are we saving from an item edit?
if ($row->id) {
$row->modified = gmdate('Y-m-d H:i:s');
$row->modified_by = $user->get('id');
} else {
$row->modified = $nullDate;
$row->modified_by = '';
//get IP, time and userid
$row->created = gmdate('Y-m-d H:i:s');
$row->author_ip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED';
}
$row->version++;
// Make sure the data is valid
if (!$row->check($elsettings)) {
$this->setError($row->getError());
return false;
}
// Store the table to the database
if (!$row->store(true)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
//store cat relation
$query = 'DELETE FROM #__eventlist_cats_event_relations WHERE itemid = ' . $row->id;
$this->_db->setQuery($query);
$this->_db->query();
foreach ($cats as $cat) {
$query = 'INSERT INTO #__eventlist_cats_event_relations (`catid`, `itemid`) VALUES(' . $cat . ',' . $row->id . ')';
$this->_db->setQuery($query);
$this->_db->query();
}
return $row->id;
}