File manager - Edit - /home/jardides/www/Jardi-design/images/administrator/controllers.tar
Back
hotspot.php 0000644 00000021176 15247074455 0007001 0 ustar 00 <?php /** * @package Hotspots * @author DanielDimitrov <daniel@compojoom.com> * @date 02.07.13 * * @copyright Copyright (C) 2008 - 2013 compojoom.com . All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die('Restricted access'); jimport('joomla.application.component.controllerform'); require_once JPATH_COMPONENT_ADMINISTRATOR . '/libraries/recaptcha/hotspotsRecaptcha.php'; /** * Class HotspotsControllerHotspot * * @since 3.0 */ class HotspotsControllerHotspot extends JControllerForm { /** * Method to check if you can add a new record. * * Extended classes can override this if necessary. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key; default is id. * * @return boolean */ protected function allowEdit($data = array(), $key = 'id') { $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Need to do a lookup from the model. $record = $this->getModel()->getItem($recordId); if (empty($record)) { return false; } return HotspotsHelperSecurity::authorise('edit', $record); } /** * Method to save a record. * * @param string $key The name of the primary key of the URL variable. * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). * * @return boolean True if successful, false otherwise. * * @since 11.1 */ public function save($key = null, $urlVar = "a_id") { // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); // Initialise variables. $app = JFactory::getApplication(); $input = $app->input; $lang = JFactory::getLanguage(); $model = $this->getModel(); $table = $model->getTable(); $user = JFactory::getUser(); $data = $input->get('jform', '', 'array'); $context = "$this->option.edit.$this->context"; $itemId = '&Itemid=' . HotspotsHelperUtils::getItemid('com_hotspots', 'hotspots'); // Determine the name of the primary key for the data. if (empty($key)) { $key = $table->getKeyName(); } $recordId = JFactory::getApplication()->input->getInt($urlVar); if (!$this->checkEditId($context, $recordId)) { // Somehow the person just went to the form and tried to save it. We don't allow that. $this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $recordId), 'error'); $this->setRedirect( JRoute::_( 'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false ) ); return false; } // Populate the row id from the session. $data[$key] = $recordId; // Access check. if (!$this->allowSave($data, $key)) { $this->setMessage(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error'); $this->setRedirect( JRoute::_( 'index.php?option=com_hotspots&view=hotspots' . $itemId . $this->getRedirectToListAppend(), false ) ); return false; } // Validate the posted data. // Sometimes the form needs some posted data, such as for plugins and modules. $form = $model->getForm($data, false); if (!$form) { $app->enqueueMessage($model->getError(), 'error'); return false; } // If we have a logged in user, we don't have the email field -> so we need to trick the validate function if ($user->get('id')) { $data['email'] = $user->get('email'); } // Test whether the data is valid. $validData = $model->validate($form, $data); // Check for validation errors. if ($validData === false) { // Get the validation messages. $errors = $model->getErrors(); // Push up to three validation messages out to the user. for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) { if ($errors[$i] instanceof Exception) { $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); } else { $app->enqueueMessage($errors[$i], 'warning'); } } // Save the data in the session. $app->setUserState($context . '.data', $data); // Redirect back to the edit screen. $this->setRedirect( JRoute::_( 'index.php?option=' . $this->option . '&view=form' . $this->getRedirectToItemAppend($recordId, $urlVar), false ) ); return false; } // If the user can't edit the state of the hotspot set the published value to the autopublish value if (!$user->authorise('core.edit.state', 'com_hotspots')) { $validData['state'] = HotspotsHelperSettings::get('addhs_autopublish', 1) ? 1 : 0; } // Attempt to save the data. if (!$model->save($validData)) { // Save the data in the session. $app->setUserState($context . '.data', $validData); // Redirect back to the edit screen. $this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'error'); $this->setRedirect( JRoute::_( 'index.php?option=' . $this->option . '&view=form' . $this->getRedirectToItemAppend($recordId, $urlVar), false ) ); return false; } $this->setMessage( JText::_( ($lang->hasKey($this->text_prefix . ($recordId == 0 && $app->isClient("site") ? '_SUBMIT' : '') . '_SAVE_SUCCESS') ? $this->text_prefix : 'JLIB_APPLICATION') . ($recordId == 0 && $app->isClient("site") ? '_SUBMIT' : '') . '_SAVE_SUCCESS' ) ); // Redirect the user and adjust session state. // Clear the record id and data from the session. $this->releaseEditId($context, $recordId); $app->setUserState($context . '.data', null); if (HotspotsHelperSettings::get('addhs_autopublish', 1) || ($user->authorise('core.edit.state', 'com_hotspots') && $validData['state'])) { $cat = JCategories::getInstance('Hotspots')->get($validData['catid']); if ($cat) { $urlcat = $validData['catid'] . ':' . JFilterOutput::stringURLSafe($cat->alias); } $urlid = $model->getState('hotspot.id') . ':' . JFilterOutput::stringURLSafe($validData['title']); $redirect = HotspotsHelperRoute::getHotspotRoute($urlid, $urlcat); } else { $redirect = 'index.php?option=com_hotspots&view=hotspots' . $itemId; } if ($validData['state']) { // Redirect to the single view for that item. $this->setRedirect(JRoute::_($redirect, false), JText::_('COM_HOTSPOTS_HOTSPOT_' . ($data['id'] ? 'EDITED' : 'ADDED'))); } else { // If the user can't edit the state of the hotspot let him know that the hotspot will be published by someone else if (!$user->authorise('core.edit.state', 'com_hotspots')) { $app->enqueueMessage(JText::_('COM_HOTSPOTS_HOTSPOT_SAVED_BUT_NEEDS_MODERATION')); } else { $app->enqueueMessage(JText::_('COM_HOTSPOTS_HOTSPOT_SAVED_BUT_IT_IS_SET_TO_UNPUBLISHED')); } // Redirect to the map for unpublished items $this->setRedirect( JRoute::_('index.php?option=com_hotspots&view=hotspots' . $itemId, false) ); } // Invoke the postSave method to allow for the child class to access the model. $this->postSaveHook($model, $validData); return true; } /** * Save images if necessary * * @param JModelLegacy $model The data model object. * @param array $validData The validated data. * * @return void */ protected function postSaveHook(JModelLegacy $model, $validData = array()) { $input = JFactory::getApplication()->input; $formData = new JInput($input->get('jform', '', 'array')); $this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR . '/models'); $multimediaModel = JModelLegacy::getInstance('Multimedia', 'HotspotsModel'); $files = $formData->get('picture', array(), 'array'); $meta = $formData->get('picture_data', array(), 'array'); $item = $model->getItem(); if ($item->get('id') && count($files)) { // Import the appropriate plugin group. JPluginHelper::importPlugin('hotspots'); $appl = JFactory::getApplication(); // Do whatever you want with the images before they are saved on the server $appl->triggerEvent('onMultimediaBeforeUpload', array($item->get('id'), $files, $meta)); // Save the images $multimediaModel->uploadPermanent($item->get('id'), $files, $meta); // Manipulate the images after they are uploaded $appl->triggerEvent('onMultimediaAfterUpload', array($item->get('id'), $files, $meta)); } } /** * Get the return URL. * * If a "return" variable has been passed in the request * * @return string The return URL. * * @since 1.6 */ protected function getReturnPage() { $return = $this->input->get('return', null, 'base64'); if (empty($return) || !JUri::isInternal(base64_decode($return))) { return JUri::base(); } else { return base64_decode($return); } } } hotspots.json.php 0000644 00000001562 15247074455 0010131 0 ustar 00 <?php /** * @package Hotspots * @author DanielDimitrov <daniel@compojoom.com> * @date 22.09.14 * * @copyright Copyright (C) 2008 - 2013 compojoom.com . All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die('Restricted access'); jimport('joomla.application.component.controller'); /** * Class HotspotsControllerHotspots * * @since 4 */ class HotspotsControllerHotspots extends JControllerLegacy { /** * Fetches a single hotspot and outputs it as json * * @throws Exception * * @return void */ public function hotspot() { $model = JModelLegacy::getInstance('Hotspot', 'HotspotsModel'); $hotspot = HotspotsHelperHotspot::prepareHotspotForJsonOutput( HotspotsHelperUtils::prepareHotspot($model->getHotspot()) ); echo json_encode($hotspot); jexit(); } } mail.raw.php 0000644 00000012127 15247074455 0007007 0 ustar 00 <?php /** * @package Hotspots * @author DanielDimitrov <daniel@compojoom.com> * @date 01.07.13 * * @copyright Copyright (C) 2008 - 2013 compojoom.com . All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die('Restricted access'); jimport('joomla.application.component.controller'); jimport('joomla.mail.helper'); /** * Class HotspotsControllerMail * * @since 3.5 */ class HotspotsControllerMail extends JControllerLegacy { public function send() { $model = json_decode(JFactory::getApplication()->input->get('model', '', 'json')); $model->sent = false; $token = JSession::getFormToken(); $filter = JFilterInput::getInstance(); if (!isset($model->$token)) { $model->status = "Couldn't send mail. Invalid form token."; echo json_encode($model); jexit(); } $input = JFactory::getApplication()->input; $user = JFactory::getUser(); $config = JFactory::getConfig(); // If the user is logged get his username/email from the user object if ($user->id) { $from = $user->get('email'); $sender = $user->get('name'); } else { $from = $filter->clean($model->{'sender-email'}); $sender = $filter->clean($model->sender, null); } $mailto = $model->mailto; $subject = $filter->clean($model->subject); $bodytext = $filter->clean($model->message); $url = $filter->clean($model->url); // Check the validity of the mails if (!JMailHelper::isEmailAddress($mailto) || !JMailHelper::isEmailAddress($from)) { $model->status = "Wrong email address provided."; echo json_encode($model); jexit(); } $message = '<p>' . JText::sprintf('COM_HOTSPOTS_MAP_EXCERPT_SENT', $from, $sender, $url ) . '</p>'; $message .= '<p>' . JText::_('COM_HOTSPOTS_MESSAGE') . ':</p>'; $message .= '<p>' . $bodytext . '</p>'; $mailer = JFactory::getMailer(); if ($mailer->sendMail($from, $sender, $mailto, $subject, $message, true)) { $model->sent = true; $model->status = 'Sent successfully'; echo json_encode($model); jexit(); } else { $model->sent = true; echo json_encode($model); jexit(); } } /** * This function sends a mail to the owner of a Hotspot * * @throws Exception * * @return void */ public function contact() { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); $user = JFactory::getUser(); // Check if we have a captcha and if it is valid if ((JPluginHelper::isEnabled('captcha', HotspotsHelperSettings::get('captcha')) && HotspotsHelperSettings::get('captcha'))) { JPluginHelper::importPlugin('captcha', HotspotsHelperSettings::get('captcha')); $appl = JFactory::getApplication(); $res = $appl->triggerEvent('onCheckAnswer', array($input->post->get('recaptcha_response_field'))); if (!$res[0]) { JFactory::getApplication()->enqueueMessage(JText::_('COM_HOTSPOTS_INVALID_CAPTCHA'), 'error'); // Redirect back to the hotspot $this->setRedirect($_SERVER['HTTP_REFERER'])->redirect(); jexit('exit'); } } $config = JFactory::getConfig(); $id = $input->getInt('hotspot_id'); $model = JModelLegacy::getInstance('Hotspot', 'HotspotsModel'); $hotspot = $model->getItem($id); $name = $filter->clean($input->get('name')); $from = $filter->clean($input->getString('email')); $messageContent = $filter->clean($input->getString('message')); $creatorEmail = JFactory::getUser($hotspot->created_by)->get('email'); // If the user is logged in, get the name and email from his profile if (!$user->guest) { $name = $user->get('name'); $from = $user->get('email'); } // Check the validity of the mails if (!JMailHelper::isEmailAddress($from)) { JFactory::getApplication()->enqueueMessage(JText::_('COM_HOTSPOTS_CONTACT_AUTHOR_WRONG_MAIL_ADDRESS')); // Redirect back to the hotspot $this->setRedirect($_SERVER['HTTP_REFERER'])->redirect(); jexit(); } if (!$name) { JFactory::getApplication()->enqueueMessage(JText::_('COM_HOTSPOTS_CONTACT_AUTHOR_INVALID_NAME')); // Redirect back to the hotspot $this->setRedirect($_SERVER['HTTP_REFERER'])->redirect(); jexit(); } $layout = new CompojoomLayoutFile('mail.contact'); $subject = JText::sprintf('COM_HOTSPOTS_CONTACT_AUTHOR_EMAIL_SUBJECT', '"' . $hotspot->title . '"', $name); $body = $layout->render( array('hotspot' => $hotspot, 'author' => JFactory::getUser($hotspot->created_by), 'name' => $name, 'from' => $from, 'message' => $messageContent) ); $mailer = JFactory::getMailer(); $message = JText::_('COM_HOTSPOTS_CONTACT_AUTHOR_MAIL_SENT_UNSUCCESSFUL'); $mailer->addReplyTo($from, $name); if ($mailer->sendMail($config->get('mailfrom'), $config->get('sitename'), $creatorEmail, $subject, $body, true)) { $message = JText::_('COM_HOTSPOTS_CONTACT_AUTHOR_MAIL_SENT'); } JFactory::getApplication()->enqueueMessage($message); // Redirect back to the hotspot $this->setRedirect($_SERVER['HTTP_REFERER']); } } hotspots.php 0000644 00000013063 15247074455 0007160 0 ustar 00 <?php /** * @package Hotspots * @author DanielDimitrov <daniel@compojoom.com> * @date 02.07.13 * * @copyright Copyright (C) 2008 - 2013 compojoom.com . All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die('Restricted access'); jimport('joomla.application.component.controller'); /** * Class HotspotsControllerHotspots * * @since 3 */ class HotspotsControllerHotspots extends JControllerAdmin { protected $view_list = "userhotspots"; /** * Method to get a model object, loading it if required. * * @param string $name The model name. Optional. * @param string $prefix The class prefix. Optional. * @param array $config Configuration array for model. Optional. * * @return object The model. */ public function getModel($name = 'Hotspot', $prefix = 'HotspotsModel', $config = array()) { return parent::getModel($name, $prefix, $config); } /** * Creates the rss feed * * @return void */ public function rss() { jimport('joomla.filesystem.folder'); require_once JPATH_COMPONENT_ADMINISTRATOR . "/libraries/rss/feedcreator.php"; $rss = new UniversalFeedCreator; $folderPath = JPATH_CACHE . '/com_hotspots/rss'; $folderExists = JFolder::exists($folderPath); if (!$folderExists) { JFolder::create($folderPath); } $rss->useCached("RSS2.0", $folderPath . '/hotspotsfeed.xml'); $rss->title = JURI::Base() . " - " . JTEXT::_('Newest Hotspots'); $rss->description = JTEXT::_('New Hotspots at') . ' ' . JURI::Base(); $rss->link = JURI::Base(); $image = new FeedImage; $image->title = JURI::Base() . " " . "Hotspots"; $image->url = HotspotsHelperSettings::get('rss_logopath', JURI::Base() . "media/com_hotspots/images/utils/logo.jpg"); $image->link = JURI::Base(); $image->description = JTEXT::_('Feed provided by') . " " . JURI::Base() . ". " . JTEXT::_('Click to visit'); $rss->image = $image; $hs_show_address = HotspotsHelperSettings::get('show_address', 1); $hs_show_address_country = HotspotsHelperSettings::get('show_address_country', 0); $hs_show_author = HotspotsHelperSettings::get('show_author', 1); $hs_show_detailpage = HotspotsHelperSettings::get('hotspot_detailpage', 1); $db = JFactory::getDBO(); $db->setQuery("SELECT * FROM #__hotspots_marker WHERE state = 1 ORDER BY created DESC", 0, HotspotsHelperSettings::get('rss_limit', "100")); $rows = $db->loadObjectList(); if ($rows != null) { foreach ($rows as $row) { $row->hotspots_id = $row->id; $name = htmlspecialchars("$row->title"); $street = htmlspecialchars("$row->street"); $plz = htmlspecialchars("$row->plz"); $town = htmlspecialchars("$row->town"); $country = htmlspecialchars("$row->country"); if ($hs_show_address == "1") { if ($hs_show_address_country == "1") { $adress = "$street, $plz $town<br />$country<br /><br />"; } else { $adress = "$street, $plz $town<br /><br />"; } } if ($hs_show_detailpage == "1") { $mlink = HotspotsHelperUtils::createLink($row); } $author = ''; if ($hs_show_author == "1") { if ($row->created_by_alias) { $author = $row->created_by_alias; } elseif ($row->created_by) { $user = JFactory::getUser($row->created_by); if (HotspotsHelperSettings::get('use_name', 1)) { $author = $user->name; } else { $author = $user->username; } } } if (substr(ltrim($mlink), 0, 7) != 'http://') { $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'host', 'port')); $mlink = $base . $mlink; } $rss_item = new FeedItem; $rss_item->title = $name; $rss_item->link = $mlink; $rss_item->description = $adress . $row->description_small; $rss_item->date = JFactory::getDate($row->created)->toRFC822(); $rss_item->source = JURI::Base(); $rss_item->author = $author; $rss->addItem($rss_item); } } $rss->cssStyleSheet = "http://www.w3.org/2000/08/w3c-synd/style.css"; if (HotspotsHelperSettings::get('rss_type', 0) == 0) { $rss->saveFeed("RSS2.0", $folderPath . '/hotspotsfeed.xml'); } elseif (HotspotsHelperSettings::get('rss_type', 0) == 1) { $rss->saveFeed("RSS1.0", $folderPath . '/hotspotsfeed.xml'); } else { $rss->saveFeed("ATOM", $folderPath . '/hotspotsfeed.xml'); } } /** * Deletes a single hotspot from the database. First checks if there is an entry in the Database. * * @return bool * * @throws Exception */ public function delete () { // Check for request forgeries JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN')); // Import the appropriate plugin group. JPluginHelper::importPlugin('hotspots'); $appl = JFactory::getApplication(); // Get items to remove from the request. $cid = JFactory::getApplication()->input->get('cid', array(), 'array'); if (!count($cid)) { // We have no id, so exit return false; } $model = $this->getModel(); $hotspot = $model->getItem($cid[0]); $canDelete = HotspotsHelperSecurity::authorise('delete', $hotspot); if ($canDelete) { // Remove the items. if ($model->delete($cid)) { $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid))); } else { $this->setMessage($model->getError(), 'error'); } $appl->triggerEvent('onAfterHotspotDelete', array('com_hotspots.hotspot', $cid)); } $link = JRoute::_('index.php?option=com_hotspots&view=userhotspots', false); $this->setRedirect($link); } } multimedia.php 0000644 00000001677 15247074455 0007437 0 ustar 00 <?php /** * @package Com_Hotspots * @author DanielDimitrov <daniel@compojoom.com> * @date 30.01.14 * * @copyright Copyright (C) 2008 - 2013 compojoom.com . All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die('Restricted access'); /** * Class HotspotsControllerImport * * @since 3.0 */ class HotspotsControllerMultimedia extends CompojoomControllerMultimedia { /** * Method to get a model object, loading it if required. * * @param string $name The model name. Optional. * @param string $prefix The class prefix. Optional. * @param array $config Configuration array for model. Optional. * * @return object */ public function getModel($name = 'Multimedia', $prefix = 'HotspotsModel', $config = array()) { $this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR . '/models'); return parent::getModel($name, $prefix, $config); } } index.html 0000644 00000000054 15247116377 0006555 0 ustar 00 <html><body bgcolor="#FFFFFF"></body></html>