Example #1
0
 public static function getDiscounts($discounts, $params)
 {
     if (empty($discounts)) {
         return array();
     }
     $arr_params = $params->toArray();
     $types = isset($arr_params['types']) && is_array($arr_params['types']) && count($arr_params['types']) ? $arr_params['types'] : array('all');
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('d.id, d.title, d.content, d.from_date, d.to_date, d.info_methods');
     $query->from('#__ksenmart_discounts as d');
     $query->where("d.id IN (" . implode(',', $discounts) . ")");
     if (!in_array('all', $types)) {
         foreach ($types as &$type) {
             $type = $db->quote($type);
         }
         $query->where('d.type in (' . implode(',', $types) . ')');
     }
     $query = KSMedia::setItemMainImageToQuery($query, 'discount', 'd.');
     $results = $db->setQuery($query)->loadObjectList('id');
     foreach ($results as $key => $res) {
         $content = JDispatcher::getInstance()->trigger('onGetDiscountContent', array($res->id));
         if (isset($content[0]) && !empty($content[0])) {
             $results[$key]->content = $content[0];
         }
         $info_methods = json_decode($res->info_methods, true);
         $results[$key]->image = !empty($results[$key]->filename) ? KSMedia::resizeImage($results[$key]->filename, $results[$key]->folder, $params->get('img_width', 200), $params->get('img_height', 100), json_decode($results[$key]->params, true)) : '';
         if (!in_array('module', $info_methods)) {
             unset($results[$key]);
         }
     }
     unset($res);
     return $results;
 }
Example #2
0
 /**
  * Method to get the field options.
  *
  * @return	array	The field option objects.
  * @since	1.6
  */
 protected function getOptions()
 {
     $options = array();
     $params = JComponentHelper::getParams('com_joomdle');
     $app = $params->get('activities');
     $option = array('value' => 'no', 'text' => JText::_('COM_JOOMDLE_NONE'));
     $options[] = $option;
     $option = array('value' => 'jomsocial', 'text' => 'Jomsocial');
     $options[] = $option;
     // Add sources added via plugins
     JPluginHelper::importPlugin('joomdleactivities');
     $dispatcher = JDispatcher::getInstance();
     $more_sources = $dispatcher->trigger('onGetActivitiesSource', array());
     if (is_array($more_sources)) {
         foreach ($more_sources as $source) {
             $keys = array_keys($source);
             $key = $keys[0];
             $source_name = array_shift($source);
             $option['value'] = $key;
             $option['text'] = $source_name;
             $options[] = $option;
         }
     }
     return $options;
 }
 function tag()
 {
     $doc = JFactory::getDocument();
     $doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'frontendedition.css'));
     JPluginHelper::importPlugin('acymailing');
     $dispatcher = JDispatcher::getInstance();
     $tagsfamilies = $dispatcher->trigger('acymailing_getPluginType');
     $defaultFamily = reset($tagsfamilies);
     $app = JFactory::getApplication();
     $fctplug = $app->getUserStateFromRequest(ACYMAILING_COMPONENT . ".tag", 'fctplug', $defaultFamily->function, 'cmd');
     ob_start();
     $defaultContents = $dispatcher->trigger($fctplug);
     $defaultContent = ob_get_clean();
     $js = 'function insertTag(){if(window.parent.insertTag(window.document.getElementById(\'tagstring\').value)) {acymailing_js.closeBox(true);}}';
     $js .= 'function setTag(tagvalue){window.document.getElementById(\'tagstring\').value = tagvalue;}';
     $js .= 'function showTagButton(){window.document.getElementById(\'insertButton\').style.display = \'inline\'; window.document.getElementById(\'tagstring\').style.display=\'inline\';}';
     $js .= 'function hideTagButton(){}';
     $js .= 'try{window.parent.previousSelection = window.parent.getPreviousSelection(); }catch(err){window.parent.previousSelection=false; }';
     $doc->addScriptDeclaration($js);
     $this->assignRef('fctplug', $fctplug);
     $type = JRequest::getString('type', 'news');
     $this->assignRef('type', $type);
     $this->assignRef('defaultContent', $defaultContent);
     $this->assignRef('tagsfamilies', $tagsfamilies);
     $app = JFactory::getApplication();
     $this->assignRef('app', $app);
     $ctrl = JRequest::getString('ctrl');
     $this->assignRef('ctrl', $ctrl);
 }
Example #4
0
 /**
  * Returns the global Event Dispatcher object, only creating it
  * if it doesn't already exist.
  *
  * @return  JDispatcher  The EventDispatcher object.
  *
  * @since   11.1
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new JDispatcher();
     }
     return self::$instance;
 }
Example #5
0
 function listing()
 {
     JRequest::setVar('tmpl', 'component');
     $statsClass = acymailing_get('class.stats');
     $statsClass->saveStats();
     header('Cache-Control: no-store, no-cache, must-revalidate');
     header('Cache-Control: post-check=0, pre-check=0', false);
     header('Pragma: no-cache');
     header("Expires: Wed, 17 Sep 1975 21:32:10 GMT");
     ob_end_clean();
     JPluginHelper::importPlugin('acymailing');
     $this->dispatcher = JDispatcher::getInstance();
     $results = $this->dispatcher->trigger('acymailing_getstatpicture');
     $picture = reset($results);
     if (empty($picture)) {
         $picture = 'media/com_acymailing/images/statpicture.png';
     }
     $picture = ltrim(str_replace(array('\\', '/'), DS, $picture), DS);
     $imagename = ACYMAILING_ROOT . $picture;
     $handle = fopen($imagename, 'r');
     if (!$handle) {
         exit;
     }
     header("Content-type: image/png");
     $contents = fread($handle, filesize($imagename));
     fclose($handle);
     echo $contents;
     exit;
 }
Example #6
0
 public static function _getArticleHTML($userid, $limit, $limitstart, $row, $app, $total, $cat, $params)
 {
     JPluginHelper::importPlugin('content');
     $dispatcher = JDispatcher::getInstance();
     $html = "";
     if (!empty($row)) {
         $html .= '<div class="joms-app--myarticle">';
         $html .= '<ul class="joms-list">';
         foreach ($row as $data) {
             $text_limit = $params->get('limit', 50);
             $result = $dispatcher->trigger('onPrepareContent', array(&$data, &$params, 0));
             if (empty($cat[$data->catid])) {
                 $cat[$data->catid] = "";
             }
             $data->sectionid = empty($data->sectionid) ? 0 : $data->sectionid;
             $link = plgCommunityMyArticles::buildLink($data->id, $data->alias, $data->catid, $cat[$data->catid], $data->sectionid);
             $created = new JDate($data->created);
             $date = CTimeHelper::timeLapse($created);
             $html .= '	<li>';
             $html .= '		<a href="' . $link . '">' . htmlspecialchars($data->title) . '</a>';
             $html .= '<span class="joms-block joms-text--small joms-text--light">' . $date . '</span>';
             $html .= '	</li>';
         }
         $html .= '</ul>';
         $showall = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=myarticles');
         $html .= "<div class='joms-gap'></div><div class='list-articles--button'><small><a class='joms-button--link' href='" . $showall . "'>" . JText::_('PLG_MYARTICLES_SHOWALL') . "</a></small></div>";
         $html .= '</div>';
     } else {
         $html .= "<p>" . JText::_("PLG_MYARTICLES_NO_ARTICLES") . "</p>";
     }
     return $html;
 }
Example #7
0
 /**
  *  Funkce pro načtení dat 1 článku z databáze
  */
 private function prepareArticleDB($articleId, $text = 'all', $skipPlugins = false)
 {
     $db =& JFactory::getDBO();
     $db->setQuery("SELECT * FROM #__content WHERE id='{$articleId}' LIMIT 1;");
     $rows = $db->loadObjectList();
     if (count($rows) == 1) {
         $article = $rows[0]->introtext . $rows[0]->fulltext;
     } else {
         return false;
     }
     //připravíme text
     if ($text == 'introtext') {
         $rows[0]->text = $rows[0]->introtext;
     } elseif ($text == 'fulltext') {
         $rows[0]->text = $rows[0]->fulltext;
     } else {
         $rows[0]->text = $rows[0]->introtext . $rows[0]->fulltext;
     }
     if (!$skipPlugins) {
         $dispatcher =& JDispatcher::getInstance();
         JPluginHelper::importPlugin("content");
         //naimportujeme všechny pluginy pro zpracování obsahu
         $rows[0]->parameters = new JParameter($rows[0]->attribs);
         //vytvoříme objekt s parametry článku
         $results = $dispatcher->trigger('onPrepareContent', array(&$rows[0], &$rows[0]->parameters, 0));
         //načtení pluginů
     }
     /*nahradíme event. špatný tvar komentářů*/
     $rows[0]->text = str_replace('<!--gInclude{', '<!-- gInclude{', $rows[0]->text);
     $rows[0]->text = str_replace('}-->', '} -->', $rows[0]->text);
     /**/
     return $rows[0];
 }
Example #8
0
File: tax.php Project: rodhoff/MNW
 function save(&$element)
 {
     $old = $this->get($element->tax_namekey);
     JPluginHelper::importPlugin('hikashop');
     $dispatcher = JDispatcher::getInstance();
     $do = true;
     if (!empty($old)) {
         $element->old =& $old;
         $dispatcher->trigger('onBeforeTaxUpdate', array(&$element, &$do));
     } else {
         $dispatcher->trigger('onBeforeTaxCreate', array(&$element, &$do));
     }
     if (!$do) {
         return false;
     }
     if (!empty($old)) {
         $result = parent::save($element);
     } else {
         $this->database->setQuery($this->_getInsert($this->getTable(), $element));
         $result = $this->database->query();
     }
     if (!empty($old)) {
         $dispatcher->trigger('onAfterTaxUpdate', array(&$element));
     } else {
         $dispatcher->trigger('onAfterTaxCreate', array(&$element));
     }
     return $result;
 }
Example #9
0
 /**
  * get the list's active/selected plug-ins
  * @return array
  */
 public function getPlugins()
 {
     $item = $this->getItem();
     // load up the active plug-ins
     $dispatcher =& JDispatcher::getInstance();
     $plugins = JArrayHelper::getValue($item->params, 'plugins', array());
     $return = array();
     //JModel::addIncludePath(JPATH_SITE.DS.'components'.DS.'com_fabrik'.DS.'models');
     $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel');
     //@todo prob wont work for any other model that extends this class except for the form/list model
     switch (get_class($this)) {
         case 'FabrikModelList':
             $class = 'list';
             break;
         default:
             $class = 'form';
     }
     $feModel = JModel::getInstance($class, 'FabrikFEModel');
     $feModel->setId($this->getState($class . '.id'));
     foreach ($plugins as $x => $plugin) {
         $o = $pluginManager->getPlugIn($plugin, $this->pluginType);
         $o->getJForm()->model = $feModel;
         $data = (array) $item->params;
         $str = $o->onRenderAdminSettings($data, $x);
         //$str = str_replace(array("\n", "\r"), "", $str);
         $str = addslashes(str_replace(array("\n", "\r"), "", $str));
         $location = $this->getPluginLocation($x);
         $event = $this->getPluginEvent($x);
         $return[] = array('plugin' => $plugin, 'html' => $str, 'location' => $location, 'event' => $event);
     }
     return $return;
 }
Example #10
0
	/**
	 * Search areas checklist helper.
	 *
	 * @param Array $config An optional configuration object
	 */
	public function searchareas($config = array())
	{	
		$config = new KConfig($config);
		
        $areas = array();
		
		//Import the search plugins
		JPluginHelper::importPlugin('search');
		$results = JDispatcher::getInstance()->trigger('onSearchAreas');
			    
		foreach($results as $result) {
		    $areas = array_merge($areas, $result);
        }
			
		// Get and format the search areas
		foreach($areas as $value => $title) 
		{
			$search_area = new stdClass();
			$search_area->value = $value;
			$search_area->title = $title;
			$search_areas[] = $search_area;
		}
		
		$config->append(array(
		   'list' => $search_areas,
		   'name' => 'areas', 
		    'key' => 'value'
		))->append(array(
			'selected' => $config->{$config->name})
	    );
		
		return parent::checklist($config);
	
	}
 function addTitleHead()
 {
     $jshopConfig = JSFactory::getConfig();
     $vendorinfo = $this->_vendorinfo;
     $this->Image($jshopConfig->path . 'images/' . $this->img_header, 1, 1, $jshopConfig->pdf_header_width, $jshopConfig->pdf_header_height);
     $this->Image($jshopConfig->path . 'images/' . $this->img_footer, 1, 265, $jshopConfig->pdf_footer_width, $jshopConfig->pdf_footer_height);
     $this->SetFont('freesans', '', 8);
     $this->SetXY(115, 12);
     $this->SetTextColor($this->pdfcolors[2][0], $this->pdfcolors[2][1], $this->pdfcolors[2][2]);
     $_vendor_info = array();
     $_vendor_info[] = $vendorinfo->adress;
     $_vendor_info[] = $vendorinfo->zip . " " . $vendorinfo->city;
     if ($vendorinfo->phone) {
         $_vendor_info[] = _JSHOP_CONTACT_PHONE . ": " . $vendorinfo->phone;
     }
     if ($vendorinfo->fax) {
         $_vendor_info[] = _JSHOP_CONTACT_FAX . ": " . $vendorinfo->fax;
     }
     if ($vendorinfo->email) {
         $_vendor_info[] = _JSHOP_EMAIL . ": " . $vendorinfo->email;
     }
     JDispatcher::getInstance()->trigger('onBeforeAddTitleHead', array(&$vendorinfo, &$pdf, &$_vendor_info, &$this));
     $str_vendor_info = implode("\n", $_vendor_info);
     $this->MultiCell(80, 3, $str_vendor_info, 0, 'R');
     $this->SetTextColor($this->pdfcolors[0][0], $this->pdfcolors[0][1], $this->pdfcolors[0][2]);
 }
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $jinput = JFactory::getApplication()->input;
     $layout = $jinput->get("layout", 'default');
     $user = JFactory::getUser();
     $params = JComponentHelper::getParams('com_tjcpg');
     //	print"<pre>" ; print_r($params);
     if ($layout == "default") {
         //START :: getting payment gateway data
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('payment');
         if (!is_array($params->get('gateways'))) {
             $gateway_param[] = $params->get('gateways');
         } else {
             $gateway_param = $params->get('gateways');
         }
         if (!empty($gateway_param)) {
             $gateways = $dispatcher->trigger('onTP_GetInfo', array($gateway_param));
         }
         $this->gateways = $gateways;
         //START :: getting payment gateway data
     } else {
         // getting order id
         $order_id = $jinput->get("order_id", '');
         if (!empty($order_id)) {
             $model = $this->getModel('payment');
             // GETTING ORDER INFO
             $orderinfo = $model->getOrderInfo($order_id);
             $this->processor = $orderinfo->processor;
             // GETTING USER PAYMENT HTML
             $this->payhtml = $model->getHTML($orderinfo->processor, $order_id);
         }
     }
     parent::display($tpl);
 }
Example #13
0
 public function __construct($default = array())
 {
     parent::__construct($default);
     // init vars
     $this->joomla = JFactory::getApplication();
     $this->user = JFactory::getUser();
     $this->session = JFactory::getSession();
     $this->document = JFactory::getDocument();
     $this->dispatcher = JDispatcher::getInstance();
     $this->option = YRequest::getCmd('option');
     $this->link_base = 'index.php?option=' . $this->option;
     $this->controller = $this->getName();
     // add super administrator var to user
     $this->user->superadmin = UserHelper::isJoomlaSuperAdmin($this->user);
     // init additional admin vars
     if ($this->joomla->isAdmin()) {
         $this->baseurl = 'index.php?option=' . $this->option . '&controller=' . $this->getName();
     }
     // init additional site vars
     if ($this->joomla->isSite()) {
         $this->itemid = (int) $GLOBALS['Itemid'];
         $this->params = $this->joomla->getParams();
         $this->pathway = $this->joomla->getPathway();
     }
 }
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $dispatcher = JDispatcher::getInstance();
     /*$model	    = $this->getModel('addeditsocial');
       $controller = JControllerLegacy::getInstance('SWG_Events');*/
     // Get some data from the models
     $state = $this->get('State');
     $this->form = $this->get('Form');
     $this->social = $this->get('Social');
     // Check the current user can edit this walk (or add a new one)
     /*if (
     	    ($model->editing() && !$controller->canEdit($this->social)) ||
     	    (!$model->editing() && !$controller->canAdd())
         )
     	{
     	  return JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
     	}*/
     // Add CSS
     $document =& JFactory::getDocument();
     $document->addStyleSheet('components/com_swg_events/css/addedit.css');
     // Add form validation
     JHTML::_('behavior.formvalidation');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $this->showForm = true;
     // Display the view
     parent::display($tpl);
 }
Example #15
0
 /**
  * Prepare reply history display.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     $id = $this->input->getInt('id');
     $this->topic = KunenaForumTopicHelper::get($id);
     $this->history = KunenaForumMessageHelper::getMessagesByTopic($this->topic, 0, (int) $this->config->historylimit, 'DESC');
     $this->replycount = $this->topic->getReplies();
     $this->historycount = count($this->history);
     KunenaAttachmentHelper::getByMessage($this->history);
     $userlist = array();
     foreach ($this->history as $message) {
         $userlist[(int) $message->userid] = (int) $message->userid;
     }
     KunenaUserHelper::loadUsers($userlist);
     // Run events
     $params = new JRegistry();
     $params->set('ksource', 'kunena');
     $params->set('kunena_view', 'topic');
     $params->set('kunena_layout', 'history');
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('kunena');
     $dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->history, &$params, 0));
     // FIXME: need to improve BBCode class on this...
     $this->attachments = KunenaAttachmentHelper::getByMessage($this->history);
     $this->inline_attachments = array();
     $this->headerText = JText::_('COM_KUNENA_POST_EDIT') . ' ' . $this->topic->subject;
 }
Example #16
0
 /**
  * Prepare message actions display.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     $catid = $this->input->getInt('id');
     $me = KunenaUserHelper::getMyself();
     $this->category = KunenaForumCategory::getInstance($catid);
     $token = JSession::getFormToken();
     $task = "index.php?option=com_kunena&view=category&task=%s&catid={$catid}&{$token}=1";
     $layout = "index.php?option=com_kunena&view=topic&layout=%s&catid={$catid}";
     $this->template = KunenaFactory::getTemplate();
     $this->categoryButtons = new JObject();
     // Is user allowed to post new topic?
     if ($this->category->getNewTopicCategory()->exists()) {
         $this->categoryButtons->set('create', $this->getButton(sprintf($layout, 'create'), 'create', 'topic', 'communication', true));
     }
     // Is user allowed to mark forums as read?
     if ($me->exists()) {
         $this->categoryButtons->set('markread', $this->getButton(sprintf($task, 'markread'), 'markread', 'category', 'user', true));
     }
     // Is user allowed to subscribe category?
     if ($this->category->isAuthorised('subscribe')) {
         $subscribed = $this->category->getSubscribed($me->userid);
         if (!$subscribed) {
             $this->categoryButtons->set('subscribe', $this->getButton(sprintf($task, 'subscribe'), 'subscribe', 'category', 'user', true));
         } else {
             $this->categoryButtons->set('unsubscribe', $this->getButton(sprintf($task, 'unsubscribe'), 'unsubscribe', 'category', 'user', true));
         }
     }
     JPluginHelper::importPlugin('kunena');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onKunenaGetButtons', array('category.action', $this->categoryButtons, $this));
 }
Example #17
0
	public static function verify() {
		if (! self::enabled ())
			return true;

		$app = JFactory::getApplication ();
		$dispatcher = JDispatcher::getInstance ();
		$results = $dispatcher->trigger ( 'onCaptchaRequired', array ('kunena.post' ) );

		if (! JPluginHelper::isEnabled ( 'system', 'captcha' ) || ! $results [0]) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_CAPTCHA_CANNOT_CHECK_CODE' ), 'error' );
			return false;
		}

		if ($results [0]) {
			$captchaparams = array (
				JRequest::getVar ( 'captchacode', '', 'post' ),
				JRequest::getVar ( 'captchasuffix', '', 'post' ),
				JRequest::getVar ( 'captchasessionid', '', 'post' ) );
			$results = $dispatcher->trigger ( 'onCaptchaVerify', $captchaparams );
			if (! $results [0]) {
				$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_CAPTCHACODE_DO_NOT_MATCH' ), 'error' );
				return false;
			}
		}
		return true;
	}
Example #18
0
 function display($tpl = null)
 {
     $this->config = JBFactory::getConfig();
     $input = JFactory::getApplication()->input;
     AImporter::model('tour');
     $cart = JModelLegacy::getInstance('TourCart', 'bookpro');
     $cart->load();
     $cart->clear();
     $model = new BookProModelTour();
     $id = $input->getInt('id');
     $this->tour = $model->getComplexItem($id);
     $this->itineraries = TourHelper::buildItinerary($id);
     //$this->packages	= $packages;
     $date = TourHelper::getDateFirstInPackagerateFromTourid($this->tour->id);
     $this->date = JFactory::getDate($date)->format(DateHelper::getConvertDateFormat('P'));
     $this->tour->rdate = $this->date;
     $dispatcher = JDispatcher::getInstance();
     //$this->_prepareDocument();
     //		$dispatcher		= JDispatcher::getInstance();
     //		$this->event 	= new stdClass();
     //		JPluginHelper::importPlugin('bookpro');
     //		$results 		= $dispatcher->trigger('onBookproProductAfterTitle', array ($this->tour));
     //		$this->event->afterDisplayTitle=isset($results[0])?$results[0]:null;
     parent::display($tpl);
 }
Example #19
0
 function display($cachable = false, $urlparams = false)
 {
     $jshopConfig = JSFactory::getConfig();
     $position = JRequest::getInt('position');
     $filter = JRequest::getVar('filter');
     $path_length = strlen($jshopConfig->image_product_path) + 1;
     $html = "<div class='images_list_search'><input type='text' id='filter_product_image_name' value='" . $filter . "'> <input type='button' value='" . _JSHOP_SEARCH . "' onclick='product_images_request(" . $position . ", \"index.php?option=com_jshopping&controller=product_images&task=display\", jQuery(\"#filter_product_image_name\").val())'></div>";
     $html .= '<div class="images_list">';
     foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($jshopConfig->image_product_path), RecursiveIteratorIterator::SELF_FIRST) as $v) {
         $filename = substr($v, $path_length);
         if ($filter != '' && !substr_count($filename, $filter)) {
             continue;
         }
         if (file_exists($jshopConfig->image_product_path . '/' . 'thumb_' . $filename)) {
             $html .= '<div class="one_image">';
             $html .= '<table>';
             $html .= '<tr><td align="center" valign="middle"><div>';
             $html .= $this->_getLinkForImage('<img alt="" title="' . $filename . '" src="' . $jshopConfig->image_product_live_path . '/thumb_' . $filename . '"/>', $filename);
             $html .= '</div></td></tr>';
             $html .= '<tr><td valign="bottom" align="center"><div>';
             $html .= $this->_getLinkForImage($filename, $filename);
             $html .= '</div></td></tr>';
             $html .= '</table>';
             $html .= '</div>';
         }
     }
     $html .= '<div style="clear: both"></div>';
     $html .= '</div>';
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplayProductsImagesHTML', array(&$html));
     echo $html;
     die;
 }
Example #20
0
 function loadJoomlaList()
 {
     JPluginHelper::importPlugin('nextendmenutheme');
     $dispatcher = JDispatcher::getInstance();
     $this->_list = array();
     $results = $dispatcher->trigger('onNextendMenuThemeList', array(&$this->_list));
 }
Example #21
0
 public function display()
 {
     // Get model data.
     $state = $this->get('State');
     $item = $this->get('Item');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $doc = JFactory::getDocument();
     $doc->setMetaData('Content-Type', 'text/directory', true);
     // Initialise variables.
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $user = JFactory::getUser();
     $dispatcher =& JDispatcher::getInstance();
     // Compute lastname, firstname and middlename
     $item->name = trim($item->name);
     // "Lastname, Firstname Midlename" format support
     // e.g. "de Gaulle, Charles"
     $namearray = explode(',', $item->name);
     if (count($namearray) > 1) {
         $lastname = $namearray[0];
         $card_name = $lastname;
         $name_and_midname = trim($namearray[1]);
         $firstname = '';
         if (!empty($name_and_midname)) {
             $namearray = explode(' ', $name_and_midname);
             $firstname = $namearray[0];
             $middlename = count($namearray) > 1 ? $namearray[1] : '';
             $card_name = $firstname . ' ' . ($middlename ? $middlename . ' ' : '') . $card_name;
         }
     } else {
         $namearray = explode(' ', $item->name);
         $middlename = count($namearray) > 2 ? $namearray[1] : '';
         $firstname = array_shift($namearray);
         $lastname = count($namearray) ? end($namearray) : '';
         $card_name = $firstname . ($middlename ? ' ' . $middlename : '') . ($lastname ? ' ' . $lastname : '');
     }
     $rev = date('c', strtotime($item->modified));
     JResponse::setHeader('Content-disposition', 'attachment; filename="' . $card_name . '.vcf"', true);
     $vcard = array();
     $vcard[] .= 'BEGIN:VCARD';
     $vcard[] .= 'VERSION:3.0';
     $vcard[] = 'N:' . $lastname . ';' . $firstname . ';' . $middlename;
     $vcard[] = 'FN:' . $item->name;
     $vcard[] = 'TITLE:' . $item->con_position;
     $vcard[] = 'TEL;TYPE=WORK,VOICE:' . $item->telephone;
     $vcard[] = 'TEL;TYPE=WORK,FAX:' . $item->fax;
     $vcard[] = 'TEL;TYPE=WORK,MOBILE:' . $item->mobile;
     $vcard[] = 'ADR;TYPE=WORK:;;' . $item->address . ';' . $item->suburb . ';' . $item->state . ';' . $item->postcode . ';' . $item->country;
     $vcard[] = 'LABEL;TYPE=WORK:' . $item->address . "\n" . $item->suburb . "\n" . $item->state . "\n" . $item->postcode . "\n" . $item->country;
     $vcard[] = 'EMAIL;TYPE=PREF,INTERNET:' . $item->email_to;
     $vcard[] = 'URL:' . $item->webpage;
     $vcard[] = 'REV:' . $rev . 'Z';
     $vcard[] = 'END:VCARD';
     echo implode("\n", $vcard);
     return true;
 }
Example #22
0
 /**
  * Ajax action called from element
  * 11/07/2011 - I've updated things so that any plugin ajax call uses 'view=plugin' rather than controller=plugin
  * this means that the controller used is now plugin.php and not plugin.raw.php
  *
  * @return  null
  */
 public function pluginAjax()
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     $plugin = $input->get('plugin', '');
     $method = $input->get('method', '');
     $group = $input->get('g', 'element');
     /**
      * $$$ hugh - playing around trying to fix a viz AJAX issue, figured we might need
      * to set up the dispatcher first and pass it to importPlugin, which doesn't hurt, but
      * didn't fix the issue.  But leaving these two lines, as I think this might be necessary
      * at some point, to get the methods into the dispatcher?
      *
      * $dispatcher = JDispatcher::getInstance();
      * if (!JPluginHelper::importPlugin('fabrik_'.$group, $plugin, true, $dispatcher))
      */
     if (!JPluginHelper::importPlugin('fabrik_' . $group, $plugin)) {
         $o = new stdClass();
         $o->err = 'unable to import plugin fabrik_' . $group . ' ' . $plugin;
         echo json_encode($o);
         return;
     }
     if (substr($method, 0, 2) !== 'on') {
         $method = 'on' . JString::ucfirst($method);
     }
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger($method);
 }
Example #23
0
 function display($tpl = null)
 {
     JHTML::_('behavior.modal');
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $model = $this->getModel();
     $params = Djcatalog2Helper::getParams();
     $menus = $app->getMenu('site');
     $menu = $menus->getActive();
     $dispatcher = JDispatcher::getInstance();
     $categories = Djc2Categories::getInstance(array('state' => '1'));
     $item = $model->getData();
     /* If Item not published set 404 */
     if ($item->id == 0 || !$item->published) {
         throw new Exception(JText::_('COM_DJCATALOG2_PRODUCT_NOT_FOUND'), 404);
     }
     /* plugins */
     JPluginHelper::importPlugin('djcatalog2');
     $results = $dispatcher->trigger('onPrepareItemDescription', array(&$item, &$params, 0));
     $this->assignref('categories', $categories);
     $this->assignref('item', $item);
     $this->assignref('images', $images);
     $this->assignref('params', $params);
     $this->_prepareDocument();
     parent::display($tpl);
 }
Example #24
0
 /**
  * Method for to append new track into database
  *
  */
 function append()
 {
     $dispatcher = JDispatcher::getInstance();
     // Send the appropriate error code response.
     JResponse::clearHeaders();
     JResponse::setHeader('Content-Type', 'application/json; charset=utf-8');
     JResponse::sendHeaders();
     $total = $_GET['total'];
     $one_procent = 1 / ($total / 100);
     $curr_index = number_format($_GET['total'] * $_GET['status'] / 100, 0, '', '');
     $path_from_cache = explode('*|*', JFactory::getApplication()->getUserState('com_playjoom.path.array'));
     $php_array['status'] = $_GET['status'] + $one_procent;
     //$dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__.":".__LINE__, 'message' => 'Add track no '.$curr_index.' in path: '.base64_decode(($path_from_cache[$curr_index] - 1)), 'priority' => JLog::INFO, 'section' => 'admin')));
     if (isset($path_from_cache[$curr_index])) {
         $model = $this->getModel('savetracks');
         $model->AddTrackItem(base64_decode($path_from_cache[$curr_index]), 'audio');
     }
     // Bei 100% ist Schluss ;)
     if ($php_array['status'] > 100) {
         $php_array['status'] = 100;
     }
     if ($php_array['status'] != 100 && isset($path_from_cache[$curr_index])) {
         $php_array['message'] = JText::_('COM_PLAYJOOM_SAVETRACKS_CURRENT_STATUS') . ' ' . ($curr_index + 1) . ' / ' . $total . ' - ' . round($php_array['status'], 1) . '%';
         $php_array['message_path'] = JText::_('COM_PLAYJOOM_SAVETRACKS_PATH_STATUS') . ' ' . base64_decode($path_from_cache[$curr_index]);
     } else {
         //Clear UserStates in session
         JFactory::getApplication()->setUserState('com_playjoom.savetracks', null);
         JFactory::getApplication()->setUserState('com_playjoom.path.array', null);
         JFactory::getApplication()->setUserState('com_playjoom.path.data', null);
         $php_array['message'] = 'done';
     }
     // Output as PHP arrays as JSON Objekt
     echo json_encode($php_array);
 }
Example #25
0
 /**
  * Get the event dispatcher
  *
  * @return  JEventDispatcher
  */
 public static function getDispatcher()
 {
     if (!self::$dispatcher) {
         self::$dispatcher = version_compare(JVERSION, '3.0', 'lt') ? JDispatcher::getInstance() : JEventDispatcher::getInstance();
     }
     return self::$dispatcher;
 }
Example #26
0
 function approve(&$pks, $value = 1)
 {
     // Initialise variables.
     $dispatcher = JDispatcher::getInstance();
     $user = JFactory::getUser();
     $table = $this->getTable('phocagalleryuser');
     $pks = (array) $pks;
     // Include the content plugins for the change of state event.
     JPluginHelper::importPlugin('content');
     // Access checks.
     foreach ($pks as $i => $pk) {
         if ($table->load($pk)) {
             if (!$this->canEditState($table)) {
                 // Prune items that you can't change.
                 unset($pks[$i]);
                 JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_EDIT_STATE_NOT_PERMITTED'));
             }
         }
     }
     // Attempt to change the state of the records.
     if (!$table->approve($pks, $value, $user->get('id'))) {
         $this->setError($table->getError());
         return false;
     }
     $context = $this->option . '.' . $this->name;
     // Trigger the onContentChangeState event.
     /*$result = $dispatcher->trigger($this->event_change_state, array($context, $pks, $value));
     		if (in_array(false, $result, true)) {
     			$this->setError($table->getError());
     			return false;
     		}*/
     return true;
 }
Example #27
0
 /**
  * Gets an item for displaying (as opposed to saving, which requires a JTable object)
  * using the query from the model and the tbl's unique identifier
  *
  * @return database->loadObject() record
  */
 public function getItem($pk = null, $refresh = false, $emptyState = true)
 {
     if (empty($this->_item)) {
         if ($emptyState) {
             $this->emptyState();
         }
         $query = $this->getQuery();
         // TODO Make this respond to the model's state, so other table keys can be used
         // perhaps depend entirely on the _buildQueryWhere() clause?
         $keyname = $this->getTable()->getKeyName();
         $value = $this->_db->Quote($this->getId());
         $query->where("tbl.{$keyname} = {$value}");
         $this->_db->setQuery((string) $query);
         $this->_item = $this->_db->loadObject();
     }
     $overridden_methods = $this->getOverriddenMethods(get_class($this));
     if (!in_array('getItem', $overridden_methods)) {
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('onPrepare' . $this->getTable()->get('_suffix'), array(&$this->_item));
     }
     // adding this in the model so we don't have to have if statemnets all over the views and controllers'
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         if (!empty($this->_item->extension_id)) {
             $this->_item->id = $this->_item->extension_id;
         }
     }
     return $this->_item;
 }
Example #28
0
 function load($type = '')
 {
     $this->allValues = array();
     $this->allValues["text"] = JText::_('K2STORE_TEXT');
     $this->allValues["email"] = JText::_('K2STORE_EMAIL');
     //	$this->allValues["link"] = JText::_('K2STORE_LINK');
     $this->allValues["textarea"] = JText::_('K2STORE_TEXTAREA');
     $this->allValues["wysiwyg"] = JText::_('K2STORE_WYSIWYG');
     $this->allValues["radio"] = JText::_('K2STORE_RADIO');
     $this->allValues["checkbox"] = JText::_('K2STORE_CHECKBOX');
     $this->allValues["singledropdown"] = JText::_('K2STORE_SINGLEDROPDOWN');
     //	$this->allValues["multipledropdown"] = JText::_('K2STORE_MULTIPLEDROPDOWN');
     $this->allValues["zone"] = JText::_('K2STORE_ZONE');
     $this->allValues["date"] = JText::_('K2STORE_DATE');
     $this->allValues["time"] = JText::_('K2STORE_TIME');
     $this->allValues["datetime"] = JText::_('K2STORE_DATETIME');
     $this->allValues["customtext"] = JText::_('K2STORE_CUSTOM_TEXT');
     if ($this->externalValues == null) {
         $this->externalValues = array();
         JPluginHelper::importPlugin('k2store');
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('onK2StoreFieldsLoad', array(&$this->externalValues));
         if (!empty($this->externalValues)) {
             foreach ($this->externalValues as $value) {
                 if (substr($value->name, 0, 4) != 'plg.') {
                     $value->name = 'plg.' . $value->name;
                 }
                 $this->allValues[$value->name] = $value->text;
             }
         }
     }
 }
 function plgAcymailingContentplugin(&$subject, $config)
 {
     parent::__construct($subject, $config);
     if (!isset($this->params)) {
         $plugin = JPluginHelper::getPlugin('acymailing', 'contentplugin');
         $this->params = new acyParameter($plugin->params);
     }
     $this->paramsContent = JComponentHelper::getParams('com_content');
     JPluginHelper::importPlugin('content');
     $this->dispatcherContent = JDispatcher::getInstance();
     $excludedHandlers = array('plgContentEmailCloak', 'pluginImageShow');
     $excludedNames = array('system' => array('SEOGenerator', 'SEOSimple'), 'content' => array('webeecomment', 'highslide', 'smartresizer', 'phocagallery'));
     $excludedType = array_keys($excludedNames);
     if (!ACYMAILING_J16) {
         foreach ($this->dispatcherContent->_observers as $id => $observer) {
             if (is_array($observer) and in_array($observer['handler'], $excludedHandlers)) {
                 $this->dispatcherContent->_observers[$id]['event'] = '';
             } elseif (is_object($observer)) {
                 if (in_array($observer->_type, $excludedType) and in_array($observer->_name, $excludedNames[$observer->_type])) {
                     $this->dispatcherContent->_observers[$id] = null;
                 }
             }
         }
     }
     if (!class_exists('JSite')) {
         include_once ACYMAILING_ROOT . 'includes' . DS . 'application.php';
     }
 }
Example #30
0
 function remove()
 {
     $cid = JRequest::getVar("cid");
     $db = JFactory::getDBO();
     $text = '';
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeRemoveTax', array(&$cid));
     foreach ($cid as $key => $value) {
         $tax = JSFactory::getTable('tax', 'jshop');
         $tax->load($value);
         $query2 = "SELECT pr.product_id\n                       FROM `#__jshopping_products` AS pr\n                       WHERE pr.product_tax_id = '" . $db->escape($value) . "'";
         $db->setQuery($query2);
         $res = $db->query();
         if ($db->getNumRows($res)) {
             $text .= sprintf(_JSHOP_TAX_NO_DELETED, $tax->tax_name) . "<br>";
             continue;
         }
         $query = "DELETE FROM `#__jshopping_taxes` WHERE `tax_id` = '" . $db->escape($value) . "'";
         $db->setQuery($query);
         if ($db->query()) {
             $text .= sprintf(_JSHOP_TAX_DELETED, $tax->tax_name) . "<br>";
         }
         $query = "DELETE FROM `#__jshopping_taxes_ext` WHERE `tax_id` = '" . $db->escape($value) . "'";
         $db->setQuery($query);
         $db->query();
     }
     $dispatcher->trigger('onAfterRemoveTax', array(&$cid));
     $this->setRedirect("index.php?option=com_jshopping&controller=taxes", $text);
 }