/** * 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(); } }
/** * Method to store the venue * * @access public * @return id * @since 0.9 */ function store($data, $file) { global $mainframe; jimport('joomla.utilities.date'); $user =& JFactory::getUser(); $elsettings = ELHelper::config(); //Get mailinformation $SiteName = $mainframe->getCfg('sitename'); $MailFrom = $mainframe->getCfg('mailfrom'); $FromName = $mainframe->getCfg('fromname'); $tzoffset = $mainframe->getCfg('offset'); $row =& JTable::getInstance('eventlist_venues', ''); //bind it to the table if (!$row->bind($data)) { JError::raiseError(500, $this->_db->stderr()); return false; } //Are we saving from an item edit? if ($row->id) { $owner = ELUser::isOwner($row->id, 'venues'); //check if user is allowed to edit venues $allowedtoeditvenue = ELUser::editaccess($elsettings->venueowner, $owner, $elsettings->venueeditrec, $elsettings->venueedit); if ($allowedtoeditvenue == 0) { $row->checkin(); $mainframe->enqueueMessage(JText::_('NO ACCESS')); return false; } $date = new JDate($row->modified, $tzoffset); $row->modified = $date->toMySQL(); $row->modified_by = $user->get('id'); //Is editor the owner of the venue //This extra Check is needed to make it possible //that the venue is published after an edit from an owner if ($elsettings->venueowner == 1 && $owner == $user->get('id')) { $owneredit = 1; } else { $owneredit = 0; } } else { //check if user is allowed to submit new venues $delloclink = ELUser::validate_user($elsettings->locdelrec, $elsettings->deliverlocsyes); if ($delloclink == 0) { $mainframe->enqueueMessage(JText::_('NO ACCESS')); return false; } //get IP, time and userid $date = new JDate($row->created, $tzoffset); $row->created = $date->toMySQL(); $row->author_ip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED'; $row->created_by = $user->get('id'); //set owneredit to false $owneredit = 0; } //Image upload //If image upload is required we will stop here if no file was attached if (empty($file['name']) && $elsettings->imageenabled == 2) { $this->setError(JText::_('IMAGE EMPTY')); return false; } if (($elsettings->imageenabled == 2 || $elsettings->imageenabled == 1) && !empty($file['name'])) { jimport('joomla.filesystem.file'); $base_Dir = JPATH_SITE . '/images/eventlist/venues/'; //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; if (!JFile::upload($file['tmp_name'], $filepath)) { $this->setError(JText::_('UPLOAD FAILED')); return false; } else { $row->locimage = $filename; } } else { //keep image if edited and left blank $row->locimage = $row->curimage; } //end image upload if //Check description $editoruser = ELUser::editoruser(); if (!$editoruser) { //check datdescription --> wipe out code $row->locdescription = strip_tags($row->locdescription, '<br />'); //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks $row->locdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->locdescription); //cut too long words $row->locdescription = wordwrap($row->locdescription, 75, " ", 1); //check length $length = JString::strlen($row->locdescription); if ($length > $elsettings->datdesclimit) { // if required shorten it $row->locdescription = JString::substr($row->locdescription, 0, $elsettings->datdesclimit); //if shortened add ... $row->locdescription = $row->locdescription . '...'; } } $row->venue = trim(JFilterOutput::ampReplace($row->venue)); //Autopublish //check if the user has the required rank for autopublish $autopublloc = ELUser::validate_user($elsettings->locpubrec, $elsettings->autopublocate); //Check if user is the owner of the venue //If yes enable autopublish if ($autopublloc || $owneredit) { $row->published = 1; } else { $row->published = 0; } //Make sure the data is valid if (!$row->check($elsettings)) { $this->setError($row->getError()); return false; } //is this an edited venue or not? //after store we allways have an id $edited = $row->id ? $row->id : false; //store it in the db if (!$row->store()) { $this->setError($this->_db->getErrorMsg()); return false; } jimport('joomla.utilities.mail'); $link = JURI::base() . JRoute::_('index.php?view=details&id=' . $row->id, false); //create mail if ($elsettings->mailinform == 2 || $elsettings->mailinform == 3) { $mail = JFactory::getMailer(); $state = $row->published ? JText::sprintf('MAIL VENUE PUBLISHED', $link) : JText::_('MAIL VENUE UNPUBLISHED'); if ($edited) { $modified_ip = getenv('REMOTE_ADDR'); $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('MAIL EDIT VENUE', $user->name, $user->username, $user->email, $modified_ip, $edited, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state); $mail->setSubject($SiteName . JText::_('EDIT VENUE MAIL')); } else { $created = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('MAIL NEW VENUE', $user->name, $user->username, $user->email, $row->author_ip, $created, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state); $mail->setSubject($SiteName . JText::_('NEW VENUE MAIL')); } $receivers = explode(',', trim($elsettings->mailinformrec)); $mail->addRecipient($receivers); $mail->setSender(array($MailFrom, $FromName)); $mail->setBody($mailbody); $sent = $mail->Send(); } //create the mail for the user if ($elsettings->mailinformuser == 2 || $elsettings->mailinformuser == 3) { $usermail = JFactory::getMailer(); $state = $row->published ? JText::sprintf('USER MAIL VENUE PUBLISHED', $link) : JText::_('USER MAIL VENUE UNPUBLISHED'); if ($edited) { $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('USER MAIL EDIT VENUE', $user->name, $user->username, $edited, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state); $usermail->setSubject($SiteName . JText::_('EDIT USER VENUE MAIL')); } else { $created = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('USER MAIL NEW VENUE', $user->name, $user->username, $created, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state); $usermail->setSubject($SiteName . JText::_('NEW USER VENUE MAIL')); } $usermail->addRecipient($user->email); $usermail->setSender(array($MailFrom, $FromName)); $usermail->setBody($mailbody); $sent = $usermail->Send(); } //update item order $row->reorder(); return $row->id; }
/** * Method to store the event * * @access public * @return id * @since 0.9 */ function store($data, $file) { global $mainframe; $user =& JFactory::getUser(); $elsettings =& ELHelper::config(); //Get mailinformation $SiteName = $mainframe->getCfg('sitename'); $MailFrom = $mainframe->getCfg('mailfrom'); $FromName = $mainframe->getCfg('fromname'); $tzoffset = $mainframe->getCfg('offset'); $row =& JTable::getInstance('eventlist_events', ''); //Sanitize $data['datdescription'] = JRequest::getVar('datdescription', '', 'post', 'string', JREQUEST_ALLOWRAW); //include the metatags $data['meta_description'] = addslashes(htmlspecialchars(trim($elsettings->meta_description))); if (strlen($data['meta_description']) > 255) { $data['meta_description'] = substr($data['meta_description'], 0, 254); } $data['meta_keywords'] = addslashes(htmlspecialchars(trim($elsettings->meta_keywords))); if (strlen($data['meta_keywords']) > 200) { $data['meta_keywords'] = substr($data['meta_keywords'], 0, 199); } $curimage = JRequest::getVar('curimage', '', 'post', 'string'); //bind it to the table if (!$row->bind($data)) { JError::raiseError(500, $this->_db->stderr()); return false; } //Are we saving from an item edit? if ($row->id) { //check if user is allowed to edit events $editaccess = ELUser::editaccess($elsettings->eventowner, $row->created_by, $elsettings->eventeditrec, $elsettings->eventedit); $maintainer = ELUser::ismaintainer(); if ($maintainer || $editaccess) { $allowedtoeditevent = 1; } if ($allowedtoeditevent == 0) { JError::raiseError(403, JText::_('NO ACCESS')); } $row->modified = gmdate('Y-m-d H:i:s'); $row->modified_by = $user->get('id'); /* * Is editor the owner of the event * This extra Check is needed to make it possible * that the venue is published after an edit from an owner */ if ($elsettings->venueowner == 1 && $row->created_by == $user->get('id')) { $owneredit = 1; } else { $owneredit = 0; } } else { //check if user is allowed to submit new events $maintainer = ELUser::ismaintainer(); $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes); if ($maintainer || $genaccess) { $dellink = 1; } if ($dellink == 0) { JError::raiseError(403, JText::_('NO ACCESS')); } //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'); //Set owneredit to false $owneredit = 0; } /* * Autopublish * check if the user has the required rank for autopublish */ $autopubev = ELUser::validate_user($elsettings->evpubrec, $elsettings->autopubl); if ($autopubev || $owneredit) { $row->published = 1; } else { $row->published = 0; } //Image upload //If image upload is required we will stop here if no file was attached if (empty($file['name']) && $elsettings->imageenabled == 2) { $this->setError(JText::_('IMAGE EMPTY')); return false; } if (($elsettings->imageenabled == 2 || $elsettings->imageenabled == 1) && !empty($file['name'])) { jimport('joomla.filesystem.file'); $base_Dir = JPATH_SITE . '/images/eventlist/events/'; //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; if (!JFile::upload($file['tmp_name'], $filepath)) { $this->setError(JText::_('UPLOAD FAILED')); return false; } else { $row->datimage = $filename; } } else { //keep image if edited and left blank $row->datimage = $curimage; } //end image if $editoruser = ELUser::editoruser(); if (!$editoruser) { //check datdescription --> wipe out code $row->datdescription = strip_tags($row->datdescription, '<br><br/>'); //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks $row->datdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->datdescription); // cut too long words $row->datdescription = wordwrap($row->datdescription, 75, ' ', 1); //check length $length = JString::strlen($row->datdescription); if ($length > $elsettings->datdesclimit) { //too long then shorten datdescription $row->datdescription = JString::substr($row->datdescription, 0, $elsettings->datdesclimit); //add ... $row->datdescription = $row->datdescription . '...'; } } $row->title = trim(JFilterOutput::ampReplace($row->title)); //set registration regarding the el settings switch ($elsettings->showfroregistra) { case 0: $row->registra = 0; break; case 1: $row->registra = 1; break; case 2: $row->registra = $row->registra; break; } switch ($elsettings->showfrounregistra) { case 0: $row->unregistra = 0; break; case 1: $row->unregistra = 1; break; case 2: if ($elsettings->showfroregistra >= 1) { $row->unregistra = $row->unregistra; } else { $row->unregistra = 0; } break; } //Make sure the table is valid if (!$row->check($elsettings)) { $this->setError($row->getError()); return false; } //is this an edited event or not? //after store we allways have an id $edited = $row->id ? $row->id : false; //store it in the db if (!$row->store(true)) { JError::raiseError(500, $this->_db->stderr()); return false; } $this->_db->setQuery('SELECT * FROM #__eventlist_venues WHERE id = ' . (int) $row->locid); $rowloc = $this->_db->loadObject(); jimport('joomla.utilities.mail'); $link = JURI::base() . JRoute::_('index.php?view=details&id=' . $row->id, false); //create the mail for the site owner if ($elsettings->mailinform == 1 || $elsettings->mailinform == 3) { $mail = JFactory::getMailer(); $state = $row->published ? JText::sprintf('MAIL EVENT PUBLISHED', $link) : JText::_('MAIL EVENT UNPUBLISHED'); if ($edited) { $modified_ip = getenv('REMOTE_ADDR'); $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('MAIL EDIT EVENT', $user->name, $user->username, $user->email, $modified_ip, $edited, $row->title, $row->dates, $row->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state); $mail->setSubject($SiteName . JText::_('EDIT EVENT MAIL')); } else { $created = JHTML::Date($row->created, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('MAIL NEW EVENT', $user->name, $user->username, $user->email, $row->author_ip, $created, $row->title, $row->dates, $row->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state); $mail->setSubject($SiteName . JText::_('NEW EVENT MAIL')); } $receivers = explode(',', trim($elsettings->mailinformrec)); $mail->addRecipient($receivers); $mail->setSender(array($MailFrom, $FromName)); $mail->setBody($mailbody); $sent = $mail->Send(); } //mail end //create the mail for the user if ($elsettings->mailinformuser == 1 || $elsettings->mailinformuser == 3) { $usermail = JFactory::getMailer(); $state = $row->published ? JText::sprintf('USER MAIL EVENT PUBLISHED', $link) : JText::_('USER MAIL EVENT UNPUBLISHED'); if ($edited) { $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('USER MAIL EDIT EVENT', $user->name, $user->username, $edited, $row->title, $row->dates, $row->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state); $usermail->setSubject($SiteName . JText::_('EDIT USER EVENT MAIL')); } else { $created = JHTML::Date($row->created, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('USER MAIL NEW EVENT', $user->name, $user->username, $created, $row->title, $row->dates, $row->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state); $usermail->setSubject($SiteName . JText::_('NEW USER EVENT MAIL')); } $usermail->addRecipient($user->email); $usermail->setSender(array($MailFrom, $FromName)); $usermail->setBody($mailbody); $sent = $usermail->Send(); } return $row->id; }
/** * Method to store the venue * * @access public * @return id * @since 0.9 */ function store($data, $file) { $app =& JFactory::getApplication(); $user =& JFactory::getUser(); $elsettings =& ELHelper::config(); $tzoffset = $app->getCfg('offset'); $row =& JTable::getInstance('eventlist_venues', ''); //bind it to the table if (!$row->bind($data)) { JError::raiseError(500, $this->_db->stderr()); return false; } //Are we saving from an item edit? if ($row->id) { //check if user is allowed to edit venues $allowedtoeditvenue = ELUser::editaccess($elsettings->venueowner, $row->created_by, $elsettings->venueeditrec, $elsettings->venueedit); if ($allowedtoeditvenue == 0) { $row->checkin(); $app->enqueueMessage(JText::_('NO ACCESS')); return false; } $row->modified = gmdate('Y-m-d H:i:s'); $row->modified_by = $user->get('id'); //Is editor the owner of the venue //This extra Check is needed to make it possible //that the venue is published after an edit from an owner if ($elsettings->venueowner == 1 && $row->created_by == $user->get('id')) { $owneredit = 1; } else { $owneredit = 0; } } else { //check if user is allowed to submit new venues $delloclink = ELUser::validate_user($elsettings->locdelrec, $elsettings->deliverlocsyes); if ($delloclink == 0) { $app->enqueueMessage(JText::_('NO ACCESS')); return false; } //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'); //set owneredit to false $owneredit = 0; } //Image upload //If image upload is required we will stop here if no file was attached if (empty($file['name']) && $elsettings->imageenabled == 2) { $this->setError(JText::_('IMAGE EMPTY')); return false; } if (($elsettings->imageenabled == 2 || $elsettings->imageenabled == 1) && !empty($file['name'])) { jimport('joomla.filesystem.file'); $base_Dir = JPATH_SITE . '/images/eventlist/venues/'; //check the image $check = ELImage::check($file, $elsettings); if ($check === false) { $app->redirect($_SERVER['HTTP_REFERER']); } //sanitize the image filename $filename = ELImage::sanitize($base_Dir, $file['name']); $filepath = $base_Dir . $filename; if (!JFile::upload($file['tmp_name'], $filepath)) { $this->setError(JText::_('UPLOAD FAILED')); return false; } else { $row->locimage = $filename; } } else { //keep image if edited and left blank $row->locimage = $row->curimage; } //end image upload if //Check description $editoruser = ELUser::editoruser(); if (!$editoruser) { //check description --> wipe out code $row->locdescription = strip_tags($row->locdescription, '<br><br/>'); //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks $row->locdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->locdescription); //cut too long words $row->locdescription = wordwrap($row->locdescription, 75, " ", 1); //check length $length = JString::strlen($row->locdescription); if ($length > $elsettings->datdesclimit) { // if required shorten it $row->locdescription = JString::substr($row->locdescription, 0, $elsettings->datdesclimit); //if shortened add ... $row->locdescription = $row->locdescription . '...'; } } //Autopublish //check if the user has the required rank for autopublish $autopublloc = ELUser::validate_user($elsettings->locpubrec, $elsettings->autopublocate); //Check if user is the owner of the venue //If yes enable autopublish if ($autopublloc || $owneredit) { $row->published = 1; } else { $row->published = 0; } $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()) { $this->setError($this->_db->getErrorMsg()); return false; } //update item order $row->reorder(); return $row->id; }
/** * Method to store the event * * @access public * @return id * @since 0.9 */ function store($data, $file) { $app =& JFactory::getApplication(); $user =& JFactory::getUser(); $elsettings =& ELHelper::config(); $cats = JRequest::getVar('cid', array(), 'post', 'array'); $row =& JTable::getInstance('eventlist_events', ''); //Sanitize $data['datdescription'] = JRequest::getVar('datdescription', '', 'post', 'string', JREQUEST_ALLOWRAW); //include the metatags if (strlen($data['meta_description']) > 255) { $data['meta_description'] = substr($data['meta_description'], 0, 254); } if (strlen($data['meta_keywords']) > 200) { $data['meta_keywords'] = substr($data['meta_keywords'], 0, 199); } $curimage = JRequest::getVar('curimage', '', 'post', 'string'); //bind it to the table if (!$row->bind($data)) { JError::raiseError(500, $this->_db->stderr()); 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; //Are we saving from an item edit? if ($row->id) { //check if user is allowed to edit events $editaccess = ELUser::editaccess($elsettings->eventowner, $row->created_by, $elsettings->eventeditrec, $elsettings->eventedit); $maintainer = ELUser::ismaintainer(); if ($maintainer || $editaccess) { $allowedtoeditevent = 1; } if ($allowedtoeditevent == 0) { JError::raiseError(403, JText::_('NO ACCESS')); } $row->modified = gmdate('Y-m-d H:i:s'); $row->modified_by = $user->get('id'); /* * Is editor the owner of the event * This extra Check is needed to make it possible * that the venue is published after an edit from an owner */ if ($elsettings->venueowner == 1 && $row->created_by == $user->get('id')) { $owneredit = 1; } else { $owneredit = 0; } } else { //check if user is allowed to submit new events $maintainer = ELUser::ismaintainer(); $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes); if (!($maintainer || $genaccess)) { JError::raiseError(403, JText::_('NO ACCESS')); } //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'); //Set owneredit to false $owneredit = 0; } /* * Autopublish * check if the user has the required rank for autopublish */ $autopubev = ELUser::validate_user($elsettings->evpubrec, $elsettings->autopubl); if ($autopubev || $owneredit) { $row->published = 1; } else { $row->published = 0; } //Image upload //If image upload is required we will stop here if no file was attached if (empty($file['name']) && $elsettings->imageenabled == 2) { $this->setError(JText::_('IMAGE EMPTY')); return false; } if (($elsettings->imageenabled == 2 || $elsettings->imageenabled == 1) && !empty($file['name'])) { jimport('joomla.filesystem.file'); $base_Dir = JPATH_SITE . '/images/eventlist/events/'; //check the image $check = ELImage::check($file, $elsettings); if ($check === false) { $app->redirect($_SERVER['HTTP_REFERER']); } //sanitize the image filename $filename = ELImage::sanitize($base_Dir, $file['name']); $filepath = $base_Dir . $filename; if (!JFile::upload($file['tmp_name'], $filepath)) { $this->setError(JText::_('UPLOAD FAILED')); return false; } else { $row->datimage = $filename; } } else { //keep image if edited and left blank $row->datimage = $curimage; } //end image if $editoruser = ELUser::editoruser(); if (!$editoruser) { //check datdescription --> wipe out code $row->datdescription = strip_tags($row->datdescription, '<br><br/>'); //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks $row->datdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->datdescription); // cut too long words $row->datdescription = wordwrap($row->datdescription, 75, ' ', 1); //check length $length = JString::strlen($row->datdescription); if ($length > $elsettings->datdesclimit) { //too long then shorten datdescription $row->datdescription = JString::substr($row->datdescription, 0, $elsettings->datdesclimit); //add ... $row->datdescription = $row->datdescription . '...'; } } //set registration regarding the el settings switch ($elsettings->showfroregistra) { case 0: $row->registra = 0; break; case 1: $row->registra = 1; break; case 2: $row->registra = $row->registra; break; } switch ($elsettings->showfrounregistra) { case 0: $row->unregistra = 0; break; case 1: $row->unregistra = 1; break; case 2: if ($elsettings->showfroregistra >= 1) { $row->unregistra = $row->unregistra; } else { $row->unregistra = 0; } break; } //Make sure the table is valid if (!$row->check($elsettings)) { $this->setError($row->getError()); return false; } $row->version++; //store it in the db if (!$row->store(true)) { JError::raiseError(500, $this->_db->stderr()); 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; }