Example #1
0
 /**
  * logic to massdelete unassigned images
  *
  * @access public
  * @return void
  * @since 0.9
  */
 function triggerarchive()
 {
     ELHelper::cleanup(1);
     $link = 'index.php?option=com_eventlist&view=cleanup';
     $msg = JText::_('AUTOARCHIVE DONE');
     $this->setRedirect($link, $msg);
 }
Example #2
0
 /**
  * Method to get the Categories
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     $elsettings =& ELHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
         $k = 0;
         $count = count($this->_data);
         for ($i = 0; $i < $count; $i++) {
             $category =& $this->_data[$i];
             if ($category->image != '') {
                 $attribs['width'] = $elsettings->imagewidth;
                 $attribs['height'] = $elsettings->imagehight;
                 $category->image = JHTML::image('images/stories/' . $category->image, $category->catname, $attribs);
             } else {
                 $category->image = JHTML::image('components/com_eventlist/assets/images/noimage.png', $category->catname);
             }
             //create target link
             $task = JRequest::getWord('task');
             $category->linktext = $task == 'archive' ? JText::_('SHOW ARCHIVE') : JText::_('Show Schedule');
             if ($task == 'archive') {
                 $category->linktarget = JRoute::_('index.php?view=categoryevents&id=' . $category->slug . '&task=archive');
             } else {
                 $category->linktarget = JRoute::_('index.php?view=categoryevents&id=' . $category->slug);
             }
             $k = 1 - $k;
         }
     }
     return $this->_data;
 }
Example #3
0
 /**
  * Method to get the Categories
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     $elsettings = ELHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
         $k = 0;
         $count = count($this->_data);
         for ($i = 0; $i < $count; $i++) {
             $category =& $this->_data[$i];
             if ($category->image != '') {
                 $attribs['width'] = $elsettings->imagewidth;
                 $attribs['height'] = $elsettings->imagehight;
                 $attribs['border'] = 0;
                 $category->image = JHTML::image('images/stories/' . $category->image, $category->catname, $attribs);
             } else {
                 $category->image = JHTML::image('components/com_eventlist/assets/images/noimage.png', $category->catname);
             }
             $category->assignedevents = $this->_countcatevents($category->catid);
             $k = 1 - $k;
         }
     }
     return $this->_data;
 }
Example #4
0
 /**
  * Creates the output for venue submissions
  *
  * @since 0.5
  * @param int $tpl
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $user =& JFactory::getUser();
     if (!$user->id) {
         $app->redirect(JRoute::_($_SERVER["HTTP_REFERER"]), JText::_('Please login to be able to submit venues'), 'error');
     }
     $editor =& JFactory::getEditor();
     $doc =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     // Get requests
     $id = JRequest::getInt('id');
     //Get Data from the model
     $row = $this->Get('Venue');
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'locdescription');
     JHTML::_('behavior.formvalidation');
     JHTML::_('behavior.tooltip');
     //add css file
     $doc->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $doc->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // Get the menu object of the active menu item
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $app->getParams('com_eventlist');
     $id ? $title = JText::_('EDIT VENUE') : ($title = JText::_('ADD VENUE'));
     //pathway
     $pathway =& $app->getPathWay();
     $pathway->setItemName(1, $item->name);
     $pathway->addItem($title, '');
     //Set Title
     $doc->setTitle($title);
     //editor user
     $editoruser = ELUser::editoruser();
     //transform <br /> and <br> back to \r\n for non editorusers
     if (!$editoruser) {
         $row->locdescription = ELHelper::br2break($row->locdescription);
     }
     //Get image
     $limage = ELImage::flyercreator($row->locimage);
     //Set the info image
     $infoimage = JHTML::_('image', 'components/com_eventlist/assets/images/icon-16-hint.png', JText::_('NOTES'));
     // country list
     $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);
     $this->assignRef('row', $row);
     $this->assignRef('editor', $editor);
     $this->assignRef('editoruser', $editoruser);
     $this->assignRef('limage', $limage);
     $this->assignRef('infoimage', $infoimage);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('params', $params);
     $this->assignRef('lists', $lists);
     $this->assignRef('title', $title);
     $this->assignRef('mode', JRequest::getVar('mode', ''));
     parent::display($tpl);
 }
Example #5
0
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $document =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     $rows =& $this->get('Data');
     $total =& $this->get('Total');
     $pageNav =& $this->get('Pagination');
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     //get menu information
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $app->getParams('com_eventlist');
     // Request variables
     $limitstart = JRequest::getInt('limitstart');
     $limit = JRequest::getInt('limit', $params->get('cat_num'));
     $task = JRequest::getWord('task');
     $params->def('page_title', $item->name);
     //pathway
     $pathway =& $app->getPathWay();
     $pathway->setItemName(1, $item->name);
     if ($task == 'archive') {
         $pathway->addItem(JText::_('ARCHIVE'), JRoute::_('index.php?view=categories&task=archive'));
         $pagetitle = $params->get('page_title') . ' - ' . JText::_('ARCHIVE');
     } else {
         $pagetitle = $params->get('page_title');
     }
     //Set Page title
     $app->setPageTitle($pagetitle);
     $app->addMetaTag('title', $pagetitle);
     //get icon settings
     $params->def('icons', $app->getCfg('icons'));
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=eventlist&format=feed';
     $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
     $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
     $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
     $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
     //Check if the user has access to the form
     $maintainer = ELUser::ismaintainer();
     $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes);
     if ($maintainer || $genaccess) {
         $dellink = 1;
     }
     // Create the pagination object
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $this->assignRef('rows', $rows);
     $this->assignRef('task', $task);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('item', $item);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('pagetitle', $pagetitle);
     parent::display($tpl);
 }
Example #6
0
 /**
  * Creates the Event Feed
  *
  * @since 0.9
  */
 function display()
 {
     global $mainframe;
     $doc =& JFactory::getDocument();
     $elsettings = ELHelper::config();
     // Get some data from the model
     JRequest::setVar('limit', $mainframe->getCfg('feed_limit'));
     $rows =& $this->get('Data');
     foreach ($rows as $row) {
         // strip html from feed item title
         $title = htmlspecialchars($row->title);
         $title = html_entity_decode($title);
         // strip html from feed item category
         $category = htmlspecialchars($row->catname);
         $category = html_entity_decode($category);
         //Format date
         $date = strftime($elsettings->formatdate, strtotime($row->dates));
         if (!$row->enddates) {
             $displaydate = $date;
         } else {
             $enddate = strftime($elsettings->formatdate, strtotime($row->enddates));
             $displaydate = $date . ' - ' . $enddate;
         }
         //Format time
         if ($row->times) {
             $time = strftime($elsettings->formattime, strtotime($row->times));
             $time = $time . ' ' . $elsettings->timename;
             $displaytime = $time;
         }
         if ($row->endtimes) {
             $endtime = strftime($elsettings->formattime, strtotime($row->endtimes));
             $endtime = $endtime . ' ' . $elsettings->timename;
             $displaytime = $time . ' - ' . $endtime;
         }
         // url link to article
         // & used instead of &amp; as this is converted by feed creator
         $link = JURI::base() . 'index.php?option=com_eventlist&view=details&id=' . $row->id;
         $link = JRoute::_($link);
         // feed item description text
         $description = JText::_('TITLE') . ': ' . $title . '<br />';
         $description .= JText::_('VENUE') . ': ' . $row->venue . ' / ' . $row->city . '<br />';
         $description .= JText::_('CATEGORY') . ': ' . $category . '<br />';
         $description .= JText::_('DATE') . ': ' . $displaydate . '<br />';
         $description .= JText::_('TIME') . ': ' . $displaytime . '<br />';
         $description .= JText::_('DESCRIPTION') . ': ' . $row->datdescription;
         @($created = $row->created ? date('r', strtotime($row->created)) : '');
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = $link;
         $item->description = $description;
         $item->date = $created;
         $item->category = $category;
         // loads item info into rss array
         $doc->addItem($item);
     }
 }
Example #7
0
 /**
  * Method to get the Venues
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     $app =& JFactory::getApplication();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     $elsettings =& ELHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
         $k = 0;
         for ($i = 0; $i < count($this->_data); $i++) {
             $venue =& $this->_data[$i];
             //Create image information
             $venue->limage = ELImage::flyercreator($venue->locimage);
             //Generate Venuedescription
             if (empty($venue->locdescription)) {
                 $venue->locdescription = JText::_('NO DESCRIPTION');
             } else {
                 //execute plugins
                 $venue->text = $venue->locdescription;
                 $venue->title = $venue->venue;
                 JPluginHelper::importPlugin('content');
                 $results = $app->triggerEvent('onPrepareContent', array(&$venue, &$params, 0));
                 $venue->locdescription = $venue->text;
             }
             //build the url
             if (!empty($venue->url) && strtolower(substr($venue->url, 0, 7)) != "http://") {
                 $venue->url = 'http://' . $venue->url;
             }
             //prepare the url for output
             if (strlen(htmlspecialchars($venue->url, ENT_QUOTES)) > 35) {
                 $venue->urlclean = substr(htmlspecialchars($venue->url, ENT_QUOTES), 0, 35) . '...';
             } else {
                 $venue->urlclean = htmlspecialchars($venue->url, ENT_QUOTES);
             }
             //create flag
             if ($venue->country) {
                 $venue->countryimg = ELOutput::getFlag($venue->country);
             }
             //create target link
             $task = JRequest::getVar('task', '', '', 'string');
             if ($task == 'archive') {
                 $venue->targetlink = JRoute::_('index.php?view=venueevents&id=' . $venue->slug . '&task=archive');
             } else {
                 $venue->targetlink = JRoute::_('index.php?view=venueevents&id=' . $venue->slug);
             }
             $k = 1 - $k;
         }
     }
     return $this->_data;
 }
Example #8
0
 /**
  * Method to get the Venues
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     global $mainframe;
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     $elsettings = ELHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
         $k = 0;
         for ($i = 0; $i < count($this->_data); $i++) {
             $venue =& $this->_data[$i];
             //Create image information
             $venue->limage = ELImage::flyercreator($venue->locimage, $elsettings);
             //Generate Venuedescription
             if (empty($venue->locdescription)) {
                 $venue->locdescription = JText::_('NO DESCRIPTION');
             } else {
                 //execute plugins
                 $venue->text = $venue->locdescription;
                 $venue->title = $venue->venue;
                 JPluginHelper::importPlugin('content');
                 $results = $mainframe->triggerEvent('onPrepareContent', array(&$venue, &$params, 0));
                 $venue->locdescription = $venue->text;
             }
             //build the url
             if (!empty($venue->url) && strtolower(substr($venue->url, 0, 7)) != "http://") {
                 $venue->url = 'http://' . $venue->url;
             }
             //prepare the url for output
             if (strlen(htmlspecialchars($venue->url, ENT_QUOTES)) > 35) {
                 $venue->urlclean = substr(htmlspecialchars($venue->url, ENT_QUOTES), 0, 35) . '...';
             } else {
                 $venue->urlclean = htmlspecialchars($venue->url, ENT_QUOTES);
             }
             //create flag
             if ($venue->country) {
                 $venue->countryimg = ELOutput::getFlag($venue->country);
             }
             //Get total of assigned events of each venue
             $venue->assignedevents = $this->_assignedevents($venue->id);
             $k = 1 - $k;
         }
     }
     return $this->_data;
 }
Example #9
0
 /**
  * Creates the output for venue submissions
  *
  * @since 0.5
  * @param int $tpl
  */
 function display($tpl = null)
 {
     global $mainframe;
     $editor =& JFactory::getEditor();
     $doc =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     // Get requests
     $id = JRequest::getInt('id');
     //Get Data from the model
     $row = $this->Get('Venue');
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'locdescription');
     JHTML::_('behavior.formvalidation');
     JHTML::_('behavior.tooltip');
     //add css file
     $doc->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $doc->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // Get the menu object of the active menu item
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams('com_eventlist');
     $id ? $title = JText::_('EDIT VENUE') : ($title = JText::_('ADD VENUE'));
     //pathway
     $pathway =& $mainframe->getPathWay();
     $pathway->setItemName(1, $item->name);
     $pathway->addItem($title, '');
     //Set Title
     $doc->setTitle($title);
     //editor user
     $editoruser = ELUser::editoruser();
     //transform <br /> and <br> back to \r\n for non editorusers
     if (!$editoruser) {
         $row->locdescription = ELHelper::br2break($row->locdescription);
     }
     //Get image
     $limage = ELImage::flyercreator($row->locimage);
     //Set the info image
     $infoimage = JHTML::_('image', 'components/com_eventlist/assets/images/icon-16-hint.png', JText::_('NOTES'));
     $this->assignRef('row', $row);
     $this->assignRef('editor', $editor);
     $this->assignRef('editoruser', $editoruser);
     $this->assignRef('limage', $limage);
     $this->assignRef('infoimage', $infoimage);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
Example #10
0
 /**
  * Method to get the Categories
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     global $mainframe;
     $params =& $mainframe->getParams();
     $elsettings =& ELHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_categories)) {
         $query = $this->_buildQuery();
         $this->_categories = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
         $k = 0;
         $count = count($this->_categories);
         for ($i = 0; $i < $count; $i++) {
             $category =& $this->_categories[$i];
             //Generate description
             if (empty($category->catdescription)) {
                 $category->catdescription = JText::_('NO DESCRIPTION');
             } else {
                 //execute plugins
                 $category->text = $category->catdescription;
                 $category->title = $category->catname;
                 JPluginHelper::importPlugin('content');
                 $results = $mainframe->triggerEvent('onPrepareContent', array(&$category, &$params, 0));
                 $category->catdescription = $category->text;
             }
             if ($category->image != '') {
                 $attribs['width'] = $elsettings->imagewidth;
                 $attribs['height'] = $elsettings->imagehight;
                 $category->image = JHTML::image('images/stories/' . $category->image, $category->catname, $attribs);
             } else {
                 $category->image = JHTML::image('components/com_eventlist/assets/images/noimage.png', $category->catname);
             }
             //create target link
             $task = JRequest::getWord('task');
             $category->linktext = $task == 'archive' ? JText::_('SHOW ARCHIVE') : JText::_('SHOW EVENTS');
             if ($task == 'archive') {
                 $category->linktarget = JRoute::_('index.php?view=categoryevents&id=' . $category->slug . '&task=archive');
             } else {
                 $category->linktarget = JRoute::_('index.php?view=categoryevents&id=' . $category->slug);
             }
             $k = 1 - $k;
         }
     }
     return $this->_categories;
 }
Example #11
0
 /**
  * Creates the Calendar View
  *
  * @since 1.1
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     // Load tooltips behavior
     JHTML::_('behavior.tooltip');
     //initialize variables
     $document =& JFactory::getDocument();
     $menu =& JSite::getMenu();
     $elsettings =& ELHelper::config();
     $item = $menu->getActive();
     $params =& $app->getParams();
     $uri =& JFactory::getURI();
     $pathway =& $app->getPathWay();
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlistcalendar.css');
     // add javascript
     $document->addScript($this->baseurl . '/components/com_eventlist/assets/js/calendar.js');
     $year = (int) JRequest::getVar('yearID', strftime("%Y"));
     $month = (int) JRequest::getVar('monthID', strftime("%m"));
     //get data from model and set the month
     $model =& $this->getModel();
     $model->setDate(mktime(0, 0, 1, $month, 1, $year));
     $rows =& $this->get('Data');
     //Set Meta data
     $document->setTitle($item->name);
     //Set Page title
     $pagetitle = $params->def('page_title', $item->name);
     $app->setPageTitle($pagetitle);
     $app->addMetaTag('title', $pagetitle);
     //init calendar
     $cal = new ELCalendar($year, $month, 0, $app->getCfg('offset'));
     $cal->enableMonthNav('index.php?view=calendar');
     $cal->setFirstWeekDay($params->get('firstweekday', 1));
     $cal->enableDayLinks(false);
     $this->assignRef('rows', $rows);
     $this->assignRef('params', $params);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('cal', $cal);
     parent::display($tpl);
 }
 /**
  * Method to get the Categories
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     global $mainframe;
     $params =& $mainframe->getParams();
     $elsettings = ELHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_categories)) {
         $query = $this->_buildQuery();
         $this->_categories = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
         $k = 0;
         $count = count($this->_categories);
         for ($i = 0; $i < $count; $i++) {
             $category =& $this->_categories[$i];
             //Generate description
             if (empty($category->catdescription)) {
                 $category->catdescription = JText::_('NO DESCRIPTION');
             } else {
                 //execute plugins
                 $category->text = $category->catdescription;
                 $category->title = $category->catname;
                 JPluginHelper::importPlugin('content');
                 $results = $mainframe->triggerEvent('onPrepareContent', array(&$category, &$params, 0));
                 $category->catdescription = $category->text;
             }
             if ($category->image != '') {
                 $attribs['width'] = $elsettings->imagewidth;
                 $attribs['height'] = $elsettings->imagehight;
                 $attribs['border'] = 0;
                 $category->image = JHTML::image('images/stories/' . $category->image, $category->catname, $attribs);
             } else {
                 $category->image = JHTML::image('components/com_eventlist/assets/images/noimage.png', $category->catname);
             }
             //Get total of assigned events of each venue
             $category->assignedevents = $this->_assignedevents($category->id);
             $k = 1 - $k;
         }
     }
     return $this->_categories;
 }
Example #13
0
 /**
  * Method to build the sortlists
  *
  * @access private
  * @return array
  * @since 0.9
  */
 function _buildSortLists()
 {
     $elsettings =& ELHelper::config();
     $filter_order = JRequest::getCmd('filter_order', 'a.dates');
     $filter_order_Dir = JRequest::getWord('filter_order_Dir', 'ASC');
     $filter = JRequest::getString('filter');
     $filter_type = JRequest::getString('filter_type');
     $sortselects = array();
     $sortselects[] = JHTML::_('select.option', 'title', $elsettings->titlename);
     $sortselects[] = JHTML::_('select.option', 'venue', $elsettings->locationname);
     $sortselects[] = JHTML::_('select.option', 'city', $elsettings->cityname);
     if ($elsettings->showcat) {
         $sortselects[] = JHTML::_('select.option', 'type', $elsettings->catfroname);
     }
     $sortselect = JHTML::_('select.genericlist', $sortselects, 'filter_type', 'size="1" class="inputbox"', 'value', 'text', $filter_type);
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $lists['filter'] = $filter;
     $lists['filter_types'] = $sortselect;
     $lists['months'] = "1, 2";
     return $lists;
 }
Example #14
0
 /**
  * Formats time
  *
  * @param string $date
  * @param string $time
  * 
  * @return string $formattime
  *
  * @since 0.9
  */
 function formattime($date, $time)
 {
     $settings =& ELHelper::config();
     if (!$time) {
         return;
     }
     //Format time
     $formattime = strftime($settings->formattime, strtotime($date . ' ' . $time));
     $formattime .= ' ' . $settings->timename;
     return $formattime;
 }
Example #15
0
 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&amp;view=imagehandler&amp;layout=uploadimage&amp;task=venueimg&amp;tmpl=component';
     $link2 = 'index.php?option=com_eventlist&amp;view=imagehandler&amp;task=selectvenueimg&amp;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&nbsp;<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);
 }
Example #16
0
 /**
  * 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;
 }
Example #17
0
 /**
  * Creates the Categoryevents View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     global $mainframe, $option;
     //initialize variables
     $document =& JFactory::getDocument();
     $menu =& JSite::getMenu();
     $elsettings = ELHelper::config();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     //cleanup events
     ELHelper::cleanevents($elsettings->lastupdate);
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // Request variables
     $limitstart = JRequest::getInt('limitstart');
     $limit = $mainframe->getUserStateFromRequest('com_eventlist.categoryevents.limit', 'limit', $params->def('display_num', 0), 'int');
     $task = JRequest::getWord('task');
     $pop = JRequest::getBool('pop');
     //get data from model
     $rows =& $this->get('Data');
     $category =& $this->get('Category');
     $total =& $this->get('Total');
     //are events available?
     if (!$rows) {
         $noevents = 1;
     } else {
         $noevents = 0;
     }
     //does the category exist
     if ($category->id == 0) {
         return JError::raiseError(404, JText::sprintf('Category #%d not found', $category->id));
     }
     //Set Meta data
     $document->setTitle($item->name . ' - ' . $category->catname);
     $document->setMetadata('keywords', $category->meta_keywords);
     $document->setDescription(strip_tags($category->meta_description));
     //Print function
     $params->def('print', !$mainframe->getCfg('hidePrint'));
     $params->def('icons', $mainframe->getCfg('icons'));
     if ($pop) {
         $params->set('popup', 1);
     }
     $print_link = JRoute::_('index.php?option=com_eventlist&view=categoryevents&id=' . $category->id . '&pop=1&tmpl=component');
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=categoryevents&format=feed&id=' . $category->id;
     $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
     $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
     $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
     $document->addHeadLink(JRoute::_($link . '&type=atom', 'alternate', 'rel'), $attribs);
     //create the pathway
     if ($task == 'catarchive') {
         $pathway =& $mainframe->getPathWay();
         $pathway->setItemName(1, $item->name);
         $pathway->addItem(JText::_('ARCHIVE') . ' - ' . $category->catname, JRoute::_('index.php?option=' . $option . '&view=categoryevents&task=catarchive&id=' . $category->id));
         $link = JRoute::_('index.php?option=com_eventlist&view=categoryevents&task=catarchive&id=' . $category->id);
     } else {
         $pathway =& $mainframe->getPathWay();
         $pathway->setItemName(1, $item->name);
         $pathway->addItem($category->catname, JRoute::_('index.php?option=' . $option . '&view=categoryevents&id=' . $category->id));
         $link = JRoute::_('index.php?option=com_eventlist&view=categoryevents&id=' . $category->id);
     }
     //Check if the user has access to the form
     $maintainer = ELUser::ismaintainer();
     $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes);
     if ($maintainer || $genaccess) {
         $dellink = 1;
     }
     // Create the pagination object
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     //Generate Categorydescription
     if (empty($category->catdescription)) {
         $catdescription = JText::_('NO DESCRIPTION');
     } else {
         //execute plugins
         $category->text = $category->catdescription;
         $category->title = $category->catname;
         JPluginHelper::importPlugin('content');
         $results = $mainframe->triggerEvent('onPrepareContent', array(&$category, &$params, 0));
         $catdescription = $category->text;
     }
     if ($category->image != '') {
         $attribs['width'] = $elsettings->imagewidth;
         $attribs['height'] = $elsettings->imagehight;
         $attribs['border'] = 0;
         $category->image = JHTML::image('images/stories/' . $category->image, $category->catname, $attribs);
     } else {
         $category->image = JHTML::image('components/com_eventlist/assets/images/noimage.png', $category->catname);
     }
     //create select lists
     $lists = $this->_buildSortLists($elsettings);
     $this->assign('lists', $lists);
     $this->assignRef('rows', $rows);
     $this->assignRef('noevents', $noevents);
     $this->assignRef('category', $category);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('task', $task);
     $this->assignRef('catdescription', $catdescription);
     $this->assignRef('link', $link);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     parent::display($tpl);
 }
Example #18
0
        			</small>
        			<?php 
}
?>
      		</div>

          <div class="el_date el_endtime floattext">
              <label for="el_endtime">
                  <?php 
echo JText::_('ENDTIME') . ':';
?>
              </label>
        			<?php 
/* <input class="inputbox validate-time" id="el_endtime" name="endtimes" value="<?php echo substr($this->row->endtimes, 0, 5); ?>" size="15" maxlength="8" />&nbsp; */
echo ELHelper::buildtimeselect(23, 'endhours', substr($this->row->endtimes, 0, 2)) . ' : ';
echo ELHelper::buildtimeselect(59, 'endminutes', substr($this->row->endtimes, 4, 6));
?>
        			<small class="editlinktip hasTip" title="<?php 
echo JText::_('NOTES');
?>
::<?php 
echo JText::_('ENDTIME HINT');
?>
">
        			    <?php 
echo $this->infoimage;
?>
        			</small>
      		</div>

        </fieldset>
Example #19
0
 /**
  * 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&amp;view=imagehandler&amp;layout=uploadimage&amp;task=venueimg&amp;tmpl=component';
     $link2 = 'index.php?option=com_eventlist&amp;view=imagehandler&amp;task=selectvenueimg&amp;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&nbsp;<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);
 }
Example #20
0
 /**
  * Creates the Venuesview
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     global $mainframe;
     $document =& JFactory::getDocument();
     $elsettings = ELHelper::config();
     //get menu information
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     //cleanup events
     ELHelper::cleanevents($elsettings->lastupdate);
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // Request variables
     $limitstart = JRequest::getInt('limitstart');
     $limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int');
     $pop = JRequest::getBool('pop', 0, '', 'int');
     $rows =& $this->get('Data');
     $total =& $this->get('Total');
     //Add needed scripts if the lightbox effect is enabled
     if ($elsettings->lightbox == 1) {
         JHTML::_('behavior.modal');
     }
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=venues&format=feed';
     $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
     $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
     $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
     $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
     $params->def('page_title', $item->name);
     //set Page title
     $document->setTitle($params->get('page_title'));
     $document->setMetadata('keywords', $params->get('page_title'));
     //pathway
     $pathway =& $mainframe->getPathWay();
     $pathway->setItemName(1, $item->name);
     //Printfunction
     $params->def('print', !$mainframe->getCfg('hidePrint'));
     $params->def('icons', $mainframe->getCfg('icons'));
     if ($params->def('page_title', 1)) {
         $params->def('header', $item->name);
     }
     if ($pop) {
         $params->set('popup', 1);
     }
     $print_link = JRoute::_('index.php?view=venues&pop=1&tmpl=component');
     //Check if the user has access to the form
     $maintainer = ELUser::ismaintainer();
     $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes);
     if ($maintainer || $genaccess) {
         $dellink = 1;
     }
     // Create the pagination object
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $link = 'index.php?option=com_eventlist&view=venues';
     $this->assignRef('rows', $rows);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('link', $link);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('limit', $limit);
     $this->assignRef('total', $total);
     $this->assignRef('item', $item);
     $this->assignRef('elsettings', $elsettings);
     parent::display($tpl);
 }
Example #21
0
 /**
  * Creates the Simple List View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     global $mainframe;
     //initialize variables
     $document =& JFactory::getDocument();
     $elsettings = ELHelper::config();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     //print_r($params);
     //$mainframe->close();
     //cleanup events
     ELHelper::cleanevents($elsettings->lastupdate);
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // get variables
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int');
     $pop = JRequest::getBool('pop');
     $pathway =& $mainframe->getPathWay();
     //get data from model
     $rows =& $this->get('Data');
     $total =& $this->get('Total');
     //are events available?
     if (!$rows) {
         $noevents = 1;
     } else {
         $noevents = 0;
     }
     //params
     $params->def('page_title', $item->name);
     if ($pop) {
         //If printpopup set true
         $params->set('popup', 1);
     }
     $print_link = JRoute::_('index.php?view=eventlist&tmpl=component&pop=1');
     //pathway
     $pathway->setItemName(1, $item->name);
     //Set Page title
     if (!$item->name) {
         $document->setTitle($params->get('page_title'));
         $document->setMetadata('keywords', $params->get('page_title'));
     }
     //Check if the user has access to the form
     $maintainer = ELUser::ismaintainer();
     $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes);
     if ($maintainer || $genaccess) {
         $dellink = 1;
     }
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=eventlist&format=feed';
     $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
     $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
     $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
     $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
     // Create the pagination object
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     //create select lists
     $lists = $this->_buildSortLists($elsettings);
     $this->assign('lists', $lists);
     $this->assignRef('rows', $rows);
     $this->assignRef('noevents', $noevents);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('lists', $lists);
     parent::display($tpl);
 }
Example #22
0
 /**
  * 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;
 }
Example #23
0
 /**
  * Saves the registration to the database
  *
  * @access public
  * @return true on success
  * @since 0.7
  */
 function userregister()
 {
     $app =& JFactory::getApplication();
     $user =& JFactory::getUser();
     $elsettings =& ELHelper::config();
     $tzoffset = $app->getCfg('offset');
     $event = (int) $this->_id;
     $uid = (int) $user->get('id');
     // Must be logged in
     if ($uid < 1) {
         JError::raiseError(403, JText::_('ALERTNOTAUTH'));
         return;
     }
     //IP
     $uip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED';
     $obj = new stdClass();
     $obj->event = (int) $event;
     $obj->uid = (int) $uid;
     $obj->uregdate = gmdate('Y-m-d H:i:s');
     $obj->uip = $uip;
     $this->_db->insertObject('#__eventlist_register', $obj);
     return true;
 }
Example #24
0
 * @license GNU/GPL, see LICENSE.php
 * EventList is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License 2
 * as published by the Free Software Foundation.
 * EventList is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with EventList; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
defined('_JEXEC') or die('Restricted access');
//Require helperfile
require_once JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'helper.php';
require_once JPATH_COMPONENT_SITE . DS . 'classes' . DS . 'user.class.php';
require_once JPATH_COMPONENT_SITE . DS . 'classes' . DS . 'image.class.php';
require_once JPATH_COMPONENT_SITE . DS . 'classes' . DS . 'output.class.php';
//perform cleanup if it wasn't done today (archive, delete, recurrence)
ELHelper::cleanup();
// Set the table directory
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
// Require the controller
require_once JPATH_COMPONENT . DS . 'controller.php';
// Create the controller
$classname = 'EventListController';
$controller = new $classname();
// Perform the Request task
$controller->execute(JRequest::getVar('task', null, 'default', 'cmd'));
// Redirect if set by the controller
$controller->redirect();
Example #25
0
 /**
  * this methode calculate the next date
  */
 function calculate_recurrence($recurrence_row)
 {
     // get the recurrence information
     $recurrence_number = $recurrence_row['recurrence_number'];
     $recurrence_type = $recurrence_row['recurrence_type'];
     $day_time = 86400;
     // 60 sec. * 60 min. * 24 h
     $week_time = 604800;
     // $day_time * 7days
     $date_array = ELHelper::generate_date($recurrence_row['dates'], $recurrence_row['enddates']);
     switch ($recurrence_type) {
         case "1":
             // +1 hour for the Summer to Winter clock change
             $start_day = mktime(1, 0, 0, $date_array["month"], $date_array["day"], $date_array["year"]);
             $start_day = $start_day + $recurrence_number * $day_time;
             break;
         case "2":
             // +1 hour for the Summer to Winter clock change
             $start_day = mktime(1, 0, 0, $date_array["month"], $date_array["day"], $date_array["year"]);
             $start_day = $start_day + $recurrence_number * $week_time;
             break;
         case "3":
             // month recurrence
             /*
              * warning here, we have to make sure the date exists: 31 of october + 1 month = 31 of november, which doesn't exists => skip the date!
              */
             $start_day = mktime(1, 0, 0, $date_array["month"] + $recurrence_number, $date_array["day"], $date_array["year"]);
             $interval = $recurrence_number;
             while ((date('m', $start_day) + 12 - $date_array["month"]) % 12 != $interval) {
                 $interval += $recurrence_number;
                 $start_day = mktime(1, 0, 0, $date_array["month"] + $interval, $date_array["day"], $date_array["year"]);
             }
             break;
         case "4":
             $selected = ELHelper::convert2CharsDaysToInt(explode(',', $recurrence_row['recurrence_byday']), $recurrence_row['weekstart']);
             // the selected weekdays
             $current_weekday = (int) $date_array["weekday"];
             if ($recurrence_row['weekstart'] == 1) {
                 // O for monday, not sunday
                 $current_weekday = ($current_weekday + 6) % 7;
             }
             if (count($selected) == 0) {
                 // this shouldn't happen, but if it does, to prevent problem use the current weekday for the repetition.
                 JError::raiseWarning(500, JText::_('Empty weekday recurrence'));
                 $selected = array($current_weekday);
             }
             sort($selected);
             if ($recurrence_number < 5) {
                 // 1. - 4. week in a month
                 // look for the position of current start date in 'selected' days.
                 if ($current_weekday >= max($selected)) {
                     // last selected day of the week => next occurence is first selected day of next (interval) week
                     $start_day = $date_array["unixtime"] - ($current_weekday - $selected[0]) * $day_time + $week_time * $recurrence_number;
                 } else {
                     // next weekday
                     foreach ($selected as $k => $day) {
                         if ($current_weekday < $day) {
                             $next_weekday = $day;
                             break;
                         }
                     }
                     $start_day = $date_array["unixtime"] + ($next_weekday - $current_weekday) * $day_time;
                 }
             } else {
                 if ($current_weekday >= max($selected)) {
                     // next occurence is next month
                     // the last or the before last week in a month
                     // the last day in the new month
                     $start_day = mktime(1, 0, 0, $date_array["month"] + 2, 1, $date_array["year"]) - $day_time;
                     $weekday_is = date("w", $start_day);
                     // first selected day of the week
                     $weekday_must = $selected[0];
                     // calculate the day difference between these days
                     if ($weekday_is >= $weekday_must) {
                         $day_diff = $weekday_is - $weekday_must;
                     } else {
                         $day_diff = $weekday_is - $weekday_must + 7;
                     }
                     $start_day = $start_day - $day_diff * $day_time;
                     if ($recurrence_number == 6) {
                         // before last?
                         $start_day = $start_day - $week_time;
                     }
                 } else {
                     // next weekday
                     foreach ($selected as $k => $day) {
                         if ($current_weekday < $day) {
                             $next_weekday = $day;
                             break;
                         }
                     }
                     // next occurence is next selected weekday
                     $start_day = $date_array["unixtime"] + ($next_weekday - $current_weekday) * $day_time;
                 }
             }
             break;
     }
     $recurrence_row['dates'] = date("Y-m-d", $start_day);
     if ($recurrence_row['enddates']) {
         $recurrence_row['enddates'] = date("Y-m-d", $start_day + $date_array["day_diff"]);
     }
     if ($start_day < $date_array["unixtime"]) {
         JError::raiseError(500, JText::_('Recurrence date generation error'));
     }
     return $recurrence_row;
 }
Example #26
0
 /**
  * Creates image information of an image
  *
  * @author Christoph Lukes
  * @since 0.9
  *
  * @param string $image The image name
  * @param array $settings
  * @param string $type event or venue
  *
  * @return imagedata if available
  */
 function flyercreator($image, $type = 'venue')
 {
     $settings =& ELHelper::config();
     jimport('joomla.filesystem.file');
     //define the environment based on the type
     if ($type == 'event') {
         $folder = 'events';
     } else {
         $folder = 'venues';
     }
     if ($image) {
         //Create thumbnail if enabled and it does not exist already
         if ($settings->gddisabled == 1 && !file_exists(JPATH_SITE . '/images/eventlist/' . $folder . '/small/' . $image)) {
             $filepath = JPATH_SITE . '/images/eventlist/' . $folder . '/' . $image;
             $save = JPATH_SITE . '/images/eventlist/' . $folder . '/small/' . $image;
             ELImage::thumb($filepath, $save, $settings->imagewidth, $settings->imagehight);
         }
         //set paths
         $dimage['original'] = 'images/eventlist/' . $folder . '/' . $image;
         $dimage['thumb'] = 'images/eventlist/' . $folder . '/small/' . $image;
         //get imagesize of the original
         $iminfo = @getimagesize('images/eventlist/' . $folder . '/' . $image);
         //if the width or height is too large this formula will resize them accordingly
         if ($iminfo[0] > $settings->imagewidth || $iminfo[1] > $settings->imagehight) {
             $iRatioW = $settings->imagewidth / $iminfo[0];
             $iRatioH = $settings->imagehight / $iminfo[1];
             if ($iRatioW < $iRatioH) {
                 $dimage['width'] = round($iminfo[0] * $iRatioW);
                 $dimage['height'] = round($iminfo[1] * $iRatioW);
             } else {
                 $dimage['width'] = round($iminfo[0] * $iRatioH);
                 $dimage['height'] = round($iminfo[1] * $iRatioH);
             }
         } else {
             $dimage['width'] = $iminfo[0];
             $dimage['height'] = $iminfo[1];
         }
         if (JFile::exists(JPATH_SITE . '/images/eventlist/' . $folder . '/small/' . $image)) {
             //get imagesize of the thumbnail
             $thumbiminfo = @getimagesize('images/eventlist/' . $folder . '/small/' . $image);
             $dimage['thumbwidth'] = $thumbiminfo[0];
             $dimage['thumbheight'] = $thumbiminfo[1];
         }
         return $dimage;
     }
     return false;
 }
Example #27
0
 /**
  * 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;
 }
Example #28
0
 /**
  * Method to get the Categories
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     $app =& JFactory::getApplication();
     $params =& $app->getParams();
     $elsettings =& ELHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_categories)) {
         $query = $this->_buildQuery();
         $pagination = $this->getPagination();
         $this->_categories = $this->_getList($query, $pagination->limitstart, $pagination->limit);
         $k = 0;
         $count = count($this->_categories);
         for ($i = 0; $i < $count; $i++) {
             $category =& $this->_categories[$i];
             if ($params->get('usecat', 1)) {
                 //child categories
                 $query = $this->_buildQuery($category->id);
                 $this->_db->setQuery($query);
                 $category->subcats = $this->_db->loadObjectList();
             } else {
                 $category->subcats = array();
             }
             //Generate description
             if (empty($category->catdescription)) {
                 $category->catdescription = JText::_('NO DESCRIPTION');
             } else {
                 //execute plugins
                 $category->text = $category->catdescription;
                 $category->title = $category->catname;
                 JPluginHelper::importPlugin('content');
                 $results = $app->triggerEvent('onPrepareContent', array(&$category, &$params, 0));
                 $category->catdescription = $category->text;
             }
             //create target link
             $task = JRequest::getWord('task');
             $category->linktext = $task == 'archive' ? JText::_('SHOW ARCHIVE') : JText::_('SHOW EVENTS');
             if ($task == 'archive') {
                 $category->linktarget = JRoute::_('index.php?view=categoryevents&id=' . $category->slug . '&task=archive');
             } else {
                 $category->linktarget = JRoute::_('index.php?view=categoryevents&id=' . $category->slug);
             }
             $k = 1 - $k;
         }
     }
     return $this->_categories;
 }
Example #29
0
 /**
  * Creates the output for event submissions
  *
  * @since 0.4
  *
  */
 function display($tpl = null)
 {
     global $mainframe;
     if ($this->getLayout() == 'selectvenue') {
         $this->_displayselectvenue($tpl);
         return;
     }
     // Initialize variables
     $editor =& JFactory::getEditor();
     $doc =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     //Get Data from the model
     $row = $this->Get('Event');
     $categories = $this->Get('Categories');
     //Get requests
     $id = JRequest::getInt('id');
     //Clean output
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'datdescription');
     JHTML::_('behavior.formvalidation');
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.modal', 'a.modal');
     //add css file
     $doc->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $doc->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     //Set page title
     $id ? $title = JText::_('EDIT EVENT') : ($title = JText::_('ADD EVENT'));
     $doc->setTitle($title);
     // Get the menu object of the active menu item
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams('com_eventlist');
     //pathway
     $pathway =& $mainframe->getPathWay();
     $pathway->setItemName(1, $item->name);
     $pathway->addItem($title, '');
     //Has the user access to the editor and the add venue screen
     $editoruser = ELUser::editoruser();
     $delloclink = ELUser::validate_user($elsettings->locdelrec, $elsettings->deliverlocsyes);
     //transform <br /> and <br> back to \r\n for non editorusers
     if (!$editoruser) {
         $row->datdescription = ELHelper::br2break($row->datdescription);
     }
     //Get image information
     $dimage = ELImage::flyercreator($row->datimage, 'event');
     //Set the info image
     $infoimage = JHTML::_('image', 'components/com_eventlist/assets/images/icon-16-hint.png', JText::_('NOTES'));
     //Create the stuff required for the venueselect functionality
     $url = $mainframe->isAdmin() ? $mainframe->getSiteURL() : JURI::base();
     $js = "\r\n\t\tfunction elSelectVenue(id, venue) {\r\n\t\t\tdocument.getElementById('a_id').value = id;\r\n\t\t\tdocument.getElementById('a_name').value = venue;\r\n\t\t\tdocument.getElementById('sbox-window').close();\r\n\t\t}";
     $doc->addScriptDeclaration($js);
     // include the recurrence script
     $doc->addScript($url . 'components/com_eventlist/assets/js/recurrence.js');
     // include the unlimited script
     $doc->addScript($url . 'components/com_eventlist/assets/js/unlimited.js');
     $this->assignRef('row', $row);
     $this->assignRef('categories', $categories);
     $this->assignRef('editor', $editor);
     $this->assignRef('dimage', $dimage);
     $this->assignRef('infoimage', $infoimage);
     $this->assignRef('delloclink', $delloclink);
     $this->assignRef('editoruser', $editoruser);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
Example #30
0
 /**
  * this methode calculate the next date
  */
 function calculate_recurrence($recurrence_row)
 {
     // get the recurrence information
     $recurrence_number = $recurrence_row['recurrence_number'];
     $recurrence_type = $recurrence_row['recurrence_type'];
     $day_time = 86400;
     // 60 sec. * 60 min. * 24 h
     $week_time = 604800;
     // $day_time * 7days
     $date_array = ELHelper::generate_date($recurrence_row['dates'], $recurrence_row['enddates']);
     switch ($recurrence_type) {
         case "1":
             // +1 hour for the Summer to Winter clock change
             $start_day = mktime(1, 0, 0, $date_array["month"], $date_array["day"], $date_array["year"]);
             $start_day = $start_day + $recurrence_number * $day_time;
             break;
         case "2":
             // +1 hour for the Summer to Winter clock change
             $start_day = mktime(1, 0, 0, $date_array["month"], $date_array["day"], $date_array["year"]);
             $start_day = $start_day + $recurrence_number * $week_time;
             break;
         case "3":
             $start_day = mktime(1, 0, 0, $date_array["month"] + $recurrence_number, $date_array["day"], $date_array["year"]);
             break;
         default:
             $weekday_must = $recurrence_row['recurrence_type'] - 3;
             // the 'must' weekday
             if ($recurrence_number < 5) {
                 // 1. - 4. week in a month
                 // the first day in the new month
                 $start_day = mktime(1, 0, 0, $date_array["month"] + 1, 1, $date_array["year"]);
                 $weekday_is = date("w", $start_day);
                 // get the weekday of the first day in this month
                 // calculate the day difference between these days
                 if ($weekday_is <= $weekday_must) {
                     $day_diff = $weekday_must - $weekday_is;
                 } else {
                     $day_diff = $weekday_must + 7 - $weekday_is;
                 }
                 $start_day = $start_day + $day_diff * $day_time + $week_time * ($recurrence_number - 1);
             } else {
                 // the last or the before last week in a month
                 // the last day in the new month
                 $start_day = mktime(1, 0, 0, $date_array["month"] + 2, 1, $date_array["year"]) - $day_time;
                 $weekday_is = date("w", $start_day);
                 // calculate the day difference between these days
                 if ($weekday_is >= $weekday_must) {
                     $day_diff = $weekday_is - $weekday_must;
                 } else {
                     $day_diff = $weekday_is - $weekday_must + 7;
                 }
                 $start_day = $start_day - $day_diff * $day_time;
                 if ($recurrence_number == 6) {
                     // before last?
                     $start_day = $start_day - $week_time;
                 }
             }
             break;
     }
     $recurrence_row['dates'] = date("Y-m-d", $start_day);
     if ($recurrence_row['enddates']) {
         $recurrence_row['enddates'] = date("Y-m-d", $start_day + $date_array["day_diff"]);
     }
     return $recurrence_row;
 }