Beispiel #1
1
 public function store($updateNulls = true)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         $this->modified_time = $date->toSql();
         $this->modified_user_id = $user->get('id');
     } else {
         if (!(int) $this->created_time) {
             $this->created_time = $date->toSql();
         }
         if (empty($this->created_user_id)) {
             $this->created_user_id = $user->get('id');
         }
     }
     $table = JTable::getInstance('Page', 'SppagebuilderTable');
     $alias = JFilterOutput::stringURLSafe($this->alias);
     if ($alias == '') {
         $alias = JFilterOutput::stringURLSafe($this->title);
     }
     $this->alias = $alias;
     if ($table->load(array('alias' => $alias)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('COM_SPPAGEBUILDER_ERROR_UNIQUE_ALIAS'));
         return false;
     }
     return parent::store($updateNulls);
 }
 function edit()
 {
     $country_id = JRequest::getInt("country_id");
     $countries = $this->getModel("countries");
     $country = JTable::getInstance('country', 'jshop');
     $country->load($country_id);
     $first[] = JHTML::_('select.option', '0', _JSHOP_ORDERING_FIRST, 'ordering', 'name');
     $rows = array_merge($first, $countries->getAllCountries(0));
     $lists['order_countries'] = JHTML::_('select.genericlist', $rows, 'ordering', 'class="inputbox" size="1"', 'ordering', 'name', $country->ordering);
     $_lang = $this->getModel("languages");
     $languages = $_lang->getAllLanguages(1);
     $multilang = count($languages) > 1;
     $edit = $country_id ? $edit = 1 : ($edit = 0);
     JFilterOutput::objectHTMLSafe($country, ENT_QUOTES);
     $view = $this->getView("countries", 'html');
     $view->setLayout("edit");
     $view->assign('country', $country);
     $view->assign('lists', $lists);
     $view->assign('edit', $edit);
     $view->assign('languages', $languages);
     $view->assign('etemplatevar', '');
     $view->assign('multilang', $multilang);
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeEditCountries', array(&$view));
     $view->displayEdit();
 }
 function run($form, $actiondata)
 {
     $params = new JParameter($actiondata->params);
     $mainframe =& JFactory::getApplication();
     //save the data to db
     $db_save_details = $actiondata;
     $db_save_details->type = 'db_save';
     //create params
     $db_save_details_params = new JParameter('');
     $db_save_details_params->set('table_name', $mainframe->getCfg('dbprefix') . 'content');
     $db_save_details_params->set('model_id', 'Article');
     $db_save_details->params = $db_save_details_params->toString();
     //set data
     $user =& JFactory::getUser();
     $form->data['created_by'] = $user->id;
     $form->data['created'] = date("Y-m-d H:i:s");
     $form->data['catid'] = $params->get('catid', '');
     $form->data['sectionid'] = $params->get('sectionid', 0);
     $form->data['state'] = $params->get('state', 0);
     $form->data['title'] = $form->data[$params->get('title', '')];
     $form->data['fulltext'] = $form->data[$params->get('fulltext', '')];
     $form->data['introtext'] = isset($form->data[$params->get('introtext', '')]) ? $form->data[$params->get('introtext', '')] : '';
     $form->data['created_by_alias'] = $form->data[$params->get('created_by_alias', '')];
     //alias
     $form->data['alias'] = JFilterOutput::stringURLSafe($form->data['title']);
     $form->data['id'] = null;
     //$form->data['alias'] = null;
     $form->runAction($db_save_details);
 }
Beispiel #4
0
 function edit()
 {
     $db = JFactory::getDBO();
     $currency = JSFactory::getTable('currency', 'jshop');
     $currencies = JSFactory::getModel("currencies");
     $currency_id = JRequest::getInt('currency_id');
     $currency->load($currency_id);
     if ($currency->currency_value == 0) {
         $currency->currency_value = 1;
     }
     $first[] = JHTML::_('select.option', '0', _JSHOP_ORDERING_FIRST, 'currency_ordering', 'currency_name');
     $rows = array_merge($first, $currencies->getAllCurrencies());
     $lists['order_currencies'] = JHTML::_('select.genericlist', $rows, 'currency_ordering', 'class="inputbox" size="1"', 'currency_ordering', 'currency_name', $currency->currency_ordering);
     $edit = $currency_id ? $edit = 1 : ($edit = 0);
     JFilterOutput::objectHTMLSafe($currency, ENT_QUOTES);
     $view = $this->getView("currencies", 'html');
     $view->setLayout("edit");
     $view->assign('currency', $currency);
     $view->assign('lists', $lists);
     $view->assign('edit', $edit);
     $view->assign('etemplatevar', '');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeEditCurrencies', array(&$view));
     $view->displayEdit();
 }
Beispiel #5
0
function tranAlias($easyset)
{
    // set translate language
    $SourceLan = $easyset->params->get('originLan');
    $ResultLan = $easyset->params->get('tranLlan', 'en');
    // get query
    $post = JRequest::get('post');
    if (!isset($post['jform']) || !isset($post['jform']['alias'])) {
        return;
    }
    $alias = $post['jform']['alias'];
    $title = $post['jform']['title'];
    $titleTmp = explode('::', $post['jform']['title']);
    if (!empty($titleTmp[1])) {
        $title = $titleTmp[0];
        $alias = JFilterOutput::stringURLSafe($titleTmp[1]);
    }
    if (trim($alias) == '') {
        $alias = AKHelper::_('lang.translate', $title, $SourceLan, $ResultLan);
        $alias = trim($alias);
        $alias = JFilterOutput::stringURLSafe($alias);
        $replace = array('aquot' => '', 'a39' => '', '--' => '-');
        $alias = strtr($alias, $replace);
        $alias = trim($alias, '-');
    }
    $post['jform']['alias'] = $alias;
    $post['jform']['title'] = $title;
    $input = JFactory::getApplication()->input;
    JRequest::setVar('jform', $post['jform'], 'method', true);
    $input->post->set('jform', $post['jform']);
    $input->request->set('jform', $post['jform']);
}
Beispiel #6
0
function getBadgeAlias($id)
{
    $badge = FD::table('Badge');
    $badge->load($id);
    $alias = JFilterOutput::stringURLSafe($badge->alias);
    return $alias;
}
Beispiel #7
0
 /**
  * Check data integrity
  *
  * @access public
  * @return boolean True on success
  */
 public function check()
 {
     if (empty($this->name)) {
         $this->setError(JText::_('ERROR NAME REQUIRED'));
         return false;
     }
     if (empty($this->alias)) {
         $this->alias = JFilterOutput::stringURLSafe($this->name);
     } else {
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
     }
     // check if Position is unique
     // by checking: name+parent_id+sports_type_id+persontype
     if (!$this->id) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('name');
         $query->from('#__joomleague_position');
         $query->where('name =' . $db->Quote($this->name));
         $query->where('parent_id = ' . $db->Quote($this->parent_id));
         $query->where('sports_type_id = ' . $db->Quote($this->sports_type_id));
         $query->where('persontype = ' . $db->Quote($this->persontype));
         $db->setQuery($query);
         $result = $db->loadColumn();
         if ($result) {
             $app = JFactory::getApplication()->enqueueMessage('EventType already exists', 'warning');
             return false;
         }
     }
     return true;
 }
 function displayDefault()
 {
     global $mainframe;
     //Load pane behavior
     jimport('joomla.html.pane');
     //initialise variables
     $document =& JFactory::getDocument();
     $user =& JFactory::getUser();
     JHTML::_('behavior.tooltip');
     //get vars
     $cid = JRequest::getVar('cid');
     //create the toolbar
     if ($cid) {
         JToolBarHelper::title(JText::_('HG_EDIT_AD_TYPE'), 'adtypeedit');
     } else {
         JToolBarHelper::title(JText::_('HG_ADD_AD_TYPE'), 'adtypeadd');
     }
     JToolBarHelper::apply();
     JToolBarHelper::save();
     JToolBarHelper::cancel();
     //Get data from the model
     $model =& $this->getModel();
     $row =& $this->get('Type');
     // fail if checked out not by 'me'
     if ($row->id) {
         if ($model->isCheckedOut($user->get('id'))) {
             JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('HG_EDITED_BY_ANOTHER_ADMIN'));
             $mainframe->redirect('index.php?option=com_hotelguide&view=adtypes');
         }
     }
     //clean data
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES);
     //assign data to template
     $this->assignRef('row', $row);
 }
Beispiel #9
0
 function edit()
 {
     $db = JFactory::getDBO();
     $man_id = JRequest::getInt("man_id");
     $manufacturer = JSFactory::getTable('manufacturer', 'jshop');
     $manufacturer->load($man_id);
     $edit = $man_id ? 1 : 0;
     if (!$man_id) {
         $manufacturer->manufacturer_publish = 1;
     }
     $_lang = JSFactory::getModel("languages");
     $languages = $_lang->getAllLanguages(1);
     $multilang = count($languages) > 1;
     $nofilter = array();
     JFilterOutput::objectHTMLSafe($manufacturer, ENT_QUOTES, $nofilter);
     $view = $this->getView("manufacturer", 'html');
     $view->setLayout("edit");
     $view->assign('manufacturer', $manufacturer);
     $view->assign('edit', $edit);
     $view->assign('languages', $languages);
     $view->assign('etemplatevar', '');
     $view->assign('multilang', $multilang);
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeEditManufacturers', array(&$view));
     $view->displayEdit();
 }
 function onContentPrepare($context, &$article, &$params, $limitstart = 1)
 {
     preg_match_all($this->regex, $article->text, $results, PREG_PATTERN_ORDER);
     //var_dump($results);
     if (count($results[0]) > 0) {
         for ($i = 0; $i < count($results[0]); $i++) {
             $subArray = array();
             $subArray = explode("|", $results[1][$i]);
             //var_dump($subArray);
             $contactId = $subArray[0] == '' || $subArray[0] == NULL ? 0 : $subArray[0];
             if (isset($subArray[1])) {
                 $itemId = $subArray[1] == '' || $subArray[1] == NULL ? 0 : $subArray[1];
                 //echo $itemId;
             }
             $itemId = isset($itemId) ? '&Itemid=' . $itemId : NULL;
             // Get Contact Details from Contact Component
             $query = 'SELECT * FROM #__contact_details' . ' WHERE id = ' . $contactId . ' AND published = 1';
             $contactInfo = $this->_getObject($query);
             // Set contact form link
             if (isset($contactInfo->email_to)) {
                 $contactFormLink = 'index.php?option=com_contact&view=contact&id=' . $contactId . $itemId . '&tmpl=component';
                 $contactFormLink = JFilterOutput::ampReplace($contactFormLink);
                 $contactFormOutput = '<iframe id="contact-form" onload="setIframeHeight(this.id)" src="' . $contactFormLink . '" scrolling="no" style="border:none;width:100%;"></iframe>';
                 $script = 'function setIframeHeight( iframeId ){var ifDoc, ifRef = document.getElementById( iframeId );try{ifDoc = ifRef.contentWindow.document.documentElement;}catch( e ){try{ifDoc = ifRef.contentDocument.documentElement;}catch(ee){}}if( ifDoc ){ifRef.height = 1;ifRef.height = ifDoc.scrollHeight;}}';
                 $doc =& JFactory::getDocument();
                 $doc->addScriptDeclaration($script);
                 $article->text = preg_replace($this->regex, $contactFormOutput, $article->text, 1);
             }
         }
     }
     return true;
 }
 private function _fixOldAlias($tablename = "content")
 {
     require_once dirname(__FILE__) . DS . 'output.php';
     $db =& JFactory::getDBO();
     $query = $db->getQuery(true);
     // $query = "SELECT id, title FROM #__$tablename;";
     $query->select('id, title');
     $query->from($db->quoteName("#__{$tablename}"));
     $db->setQuery($query);
     $rows = $db->loadAssocList();
     // If found any rows
     if (!empty($rows) && count($rows)) {
         foreach ($rows as $row) {
             $id = (int) $row["id"];
             $alias = JFilterOutput::stringURLSafe($row["title"]);
             // $query	= "UPDATE #__$tablename SET alias='$alias' WHERE id=$id;";
             $query = $db->getQuery(true);
             $query->update($db->quoteName("#__{$tablename}"));
             $query->set('alias=' . $db->quote($alias));
             $query->where('id=' . $db->quote($id));
             $db->setQuery($query);
             $result = $db->query();
         }
     }
 }
Beispiel #12
0
 /**
  * Takes an image file, moves the file and adds database entry
  * @param the verified REAL name of the local file including path
  * @param name of file according to user/browser or just the name excluding path
  * @param desired category
  * @param title of image, if empty will be created from $name
  * @param description of image, if empty will remain empty
  * @return returns true if successfull otherwise returns an ImageUploadError
  */
 function importImage($tmpName, $name, $cat, $title = '', $desc = '')
 {
     global $rsgConfig;
     $database =& JFactory::getDBO();
     $my =& JFactory::getUser();
     $destination = fileUtils::move_uploadedFile_to_orignalDir($tmpName, $name);
     if (is_a($destination, imageUploadError)) {
         return $destination;
     }
     $parts = pathinfo($destination);
     $newName = $parts['basename'];
     // fill $title if empty
     if ($title == '') {
         $title = substr($parts['basename'], 0, -(strlen($parts['extension']) + ($parts['extension'] == '' ? 0 : 1)));
     }
     // determine ordering
     $database->setQuery("SELECT COUNT(1) FROM #__rsgallery2_files WHERE gallery_id = '{$cat}'");
     $ordering = $database->loadResult() + 1;
     //Store image details in database
     $alias = mysql_real_escape_string(JFilterOutput::stringURLSafe($title));
     $desc = mysql_real_escape_string($desc);
     $title = mysql_real_escape_string($title);
     $database->setQuery("INSERT INTO #__rsgallery2_files" . " (title, name, descr, gallery_id, date, ordering, userid, alias) VALUES" . " ('{$title}', '{$newName}', '{$desc}', '{$cat}', now(), '{$ordering}', '{$my->id}', '{$alias}')");
     if (!$database->query()) {
         audioUtils::deleteAudio($parts['basename']);
         return new imageUploadError($parts['basename'], $database->stderr(true));
     }
     return true;
 }
Beispiel #13
0
 function _displayGmap($tpl = null)
 {
     $params =& JFactory::getApplication()->getParams();
     JHTML::_('behavior.mootools');
     $document =& JFactory::getDocument();
     $document->addScript('http://maps.google.com/maps/api/js?sensor=false');
     $document->addScript(JURI::root() . '/components/com_redevent/assets/js/venuemap.js');
     JText::script("COM_REDEVENT_GET_DIRECTIONS");
     //add css file
     if (!$params->get('custom_css')) {
         $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css');
     } else {
         $document->addStyleSheet($params->get('custom_css'));
     }
     //Get Data from the model
     $row = $this->Get('Data');
     //		echo '<pre>';print_r($row); echo '</pre>';exit;
     $address = array();
     if ($row->street) {
         $address[] = $row->street;
     }
     if ($row->city) {
         $address[] = $row->city;
     }
     if ($row->country) {
         $address[] = redEVENTHelperCountries::getCountryName($row->country);
     }
     $address = implode(',', $address);
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, array('locdescription', 'locmage', 'countryimg', 'targetlink'));
     $row->target = JRoute::_('index.php?option=com_redevent&view=venueevents&id=' . $row->slug);
     $this->assignRef('row', $row);
     $this->assignRef('address', $address);
     parent::display($tpl);
 }
Beispiel #14
0
 public function filterTitle(&$alias)
 {
     if ($alias == "") {
         $alias = JRequest::getString("refField_title");
     }
     $alias = JFilterOutput::stringURLSafe($alias);
 }
Beispiel #15
0
 function edit()
 {
     $jshopConfig = JSFactory::getConfig();
     $shipping_id = JRequest::getInt("shipping_id");
     $shipping = JTable::getInstance('shippingMethod', 'jshop');
     $shipping->load($shipping_id);
     $edit = $shipping_id ? $edit = 1 : ($edit = 0);
     $_lang = $this->getModel("languages");
     $languages = $_lang->getAllLanguages(1);
     $multilang = count($languages) > 1;
     $_payments = $this->getModel("payments");
     $list_payments = $_payments->getAllPaymentMethods(0);
     $lists['payments'] = JHTML::_('select.genericlist', $list_payments, 'listpayments[]', 'class="inputbox" size="10" multiple = "multiple"', 'payment_id', 'name', $shipping->getPayments());
     $nofilter = array();
     JFilterOutput::objectHTMLSafe($shipping, ENT_QUOTES, $nofilter);
     $view = $this->getView("shippings", 'html');
     $view->setLayout("edit");
     $view->assign('shipping', $shipping);
     $view->assign('edit', $edit);
     $view->assign('languages', $languages);
     $view->assign('multilang', $multilang);
     $view->assign('lists', $lists);
     $view->assign('config', $jshopConfig);
     $view->assign('etemplatevar', '');
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeEditShippings', array(&$view));
     $view->displayEdit();
 }
 /**
  * Overloaded check method to ensure data integrity
  *
  * @access public
  * @return boolean True on success
  * @since 1.0
  */
 function check()
 {
     if (empty($this->name)) {
         $this->setError(JText::_('NAME REQUIRED'));
         return false;
     }
     // add default middle size name
     if (empty($this->middle_name)) {
         $parts = explode(" ", $this->name);
         $this->middle_name = substr($parts[0], 0, 20);
     }
     // add default short size name
     if (empty($this->short_name)) {
         $parts = explode(" ", $this->name);
         $this->short_name = substr($parts[0], 0, 2);
     }
     // setting alias
     if (empty($this->alias)) {
         $this->alias = JFilterOutput::stringURLSafe($this->name);
     } else {
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
         // make sure the user didn't modify it to something illegal...
     }
     return true;
 }
Beispiel #17
0
 /**
  * Render comments and respond form html.
  *
  * @param AppView $view The view the comments are rendered on
  * @param Item $item The item whos comments are rendered
  *
  * @return string The html output
  *
  * @since 2.0
  */
 public function renderComments($view, $item)
 {
     if ($item->getApplication()->isCommentsEnabled()) {
         // get application params
         $params = $this->app->parameter->create($item->getApplication()->getParams()->get('global.comments.'));
         if ($params->get('twitter_enable') && !function_exists('curl_init')) {
             $this->app->error->raiseWarning(500, JText::_('To use Twitter, CURL needs to be enabled in your php settings.'));
             $params->set('twitter_enable', false);
         }
         // get active author
         $active_author = $this->activeAuthor();
         // filter author output
         JFilterOutput::objectHTMLSafe($active_author, ENT_QUOTES, array('app', 'application'));
         // get comment content from session
         $content = $this->app->system->session->get('com_zoo.comment.content');
         $params->set('content', $content);
         // get comments and build tree
         $approved = $item->canManageComments() ? Comment::STATE_UNAPPROVED : Comment::STATE_APPROVED;
         $comments = $item->getCommentTree($approved);
         // build captcha
         $captcha = false;
         if ($plugin = $params->get('captcha', false) and (!$params->get('captcha_guest_only', 0) or !$this->app->user->get()->id)) {
             $captcha = JCaptcha::getInstance($plugin);
         }
         // filter redirect url
         $view->set('redirect', htmlspecialchars(JUri::getInstance()->toString()));
         if ($item->isCommentsEnabled() || count($comments) - 1) {
             // create comments html
             return $view->partial('comments', compact('item', 'active_author', 'comments', 'params', 'captcha'));
         }
     }
     return null;
 }
Beispiel #18
0
 /**
  * Generates a menu item based on given data.
  *
  * @param   array  $data  Data to insert to the menu item.
  *
  * @return null
  */
 private static function createMenuItem($data)
 {
     $count = count(self::$data);
     $defaults = array('id' => $count, 'menutype' => 'testmenu', 'title' => '', 'alias' => isset($data['title']) ? JFilterOutput::stringURLSafe($data['title']) : '', 'route' => isset($data['title']) ? JFilterOutput::stringURLSafe($data['title']) : '', 'link' => JUri::buildQuery($data['query']), 'type' => 'component', 'level' => '1', 'language' => '*', 'access' => '1', 'params' => '{}', 'home' => '0', 'component_id' => '1000', 'parent_id' => '0', 'component' => 'com_monitor', 'tree' => isset($data['id']) ? array($data['id']) : array($count), 'query' => array('option' => 'com_monitor'));
     $obj = (object) array_merge($defaults, $data);
     self::$data[$obj->id] = $obj;
 }
Beispiel #19
0
 function edit()
 {
     $value_id = JRequest::getInt("value_id");
     $attr_id = JRequest::getInt("attr_id");
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     $attributValue = JTable::getInstance('attributValue', 'jshop');
     $attributValue->load($value_id);
     $_lang = $this->getModel("languages");
     $languages = $_lang->getAllLanguages(1);
     $multilang = count($languages) > 1;
     JFilterOutput::objectHTMLSafe($attributValue, ENT_QUOTES);
     $view = $this->getView("attributesvalues", 'html');
     $view->setLayout("edit");
     $view->assign('attributValue', $attributValue);
     $view->assign('attr_id', $attr_id);
     $view->assign('config', $jshopConfig);
     $view->assign('languages', $languages);
     $view->assign('multilang', $multilang);
     $view->assign('etemplatevar', '');
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeEditAtributesValues', array(&$view));
     $view->displayEdit();
 }
Beispiel #20
0
 function display($tpl = null)
 {
     global $option, $mainframe, $layout;
     // get data
     $model =& $this->getModel();
     $product = $model->getDetail();
     $images = $model->getImages();
     $relative = $model->getRelative();
     $titleCatName = JFilterOutput::stringURLSafe($product->category);
     $titleCatName = str_replace(' ', '-', strtolower(trim($titleCatName)));
     $title = JFilterOutput::stringURLSafe($product->name);
     $title = str_replace(' ', '-', strtolower($title));
     $product->link = JRoute::_('index.php?option=' . $option . '&view=detail&id=' . $product->id . ':' . $title);
     $document =& JFactory::getDocument();
     $document->addScript('components/com_products/js/jquery-1.3.2.js');
     $document->addScript('components/com_products/js/colorbox/jquery.colorbox.js');
     $document->addStyleSheet('components/com_products/js/colorbox/colorbox.css');
     $document->addScriptDeclaration('if($===jQuery){jQuery.noConflict();} jQuery(document).ready(function(){ jQuery("a[rel=\'product_image\']").colorbox({current: "Ảnh {current} / {total}"}); });');
     $titleSEO = '';
     if ($product->name) {
         $titleSEO = $product->name;
         if ($product->category) {
             $titleSEO = $product->name . ' | ' . $product->category;
         }
     }
     $document->setTitle($titleSEO . ' | ' . $mainframe->getCfg('sitename'));
     $app =& JFactory::getApplication();
     $pathway = $app->getPathway();
     $pathway->addItem($product->name);
     $this->assignRef('relative', $relative);
     $this->assignRef('images', $images);
     $this->assignRef('product', $product);
     $this->assignRef('titleCatName', $titleCatName);
     parent::display($tpl);
 }
Beispiel #21
0
 protected function _getRequest($hash = 'default', $mask = 0)
 {
     if ($hash == 'post') {
         $post = JRequest::get('post');
         // fix up special html fields
         $text = JRequest::getVar('text', '', 'post', 'string', JREQUEST_ALLOWRAW);
         // Clean text for xhtml transitional compliance
         $text = str_replace('<br>', '<br />', $text);
         // Search for the {readmore} tag and split the text up accordingly.
         $pattern = '#<hr\\s+id=("|\')system-readmore("|\')\\s*\\/*>#i';
         $tagPos = preg_match($pattern, $text);
         if ($tagPos == 0) {
             $post['introtext'] = $text;
             $post['fulltext'] = "";
         } else {
             list($post['introtext'], $post['fulltext']) = preg_split($pattern, $text, 2);
         }
         if (empty($post['alias'])) {
             $post['alias'] = $post['name'];
         }
         $post['alias'] = JFilterOutput::stringURLSafe($post['alias']);
         return $post;
     }
     return parent::_getRequest($hash, $mask);
 }
Beispiel #22
0
 public static function cText($text, $limit, $type = 0)
 {
     //function to cut text
     $text = preg_replace('/<img[^>]+\\>/i', "", $text);
     if ($limit == 0) {
         //no limit
         $allowed_tags = '<b><i><a><small><h1><h2><h3><h4><h5><h6><sup><sub><em><strong><u><br>';
         $text = strip_tags($text, $allowed_tags);
         $text = $text;
     } else {
         if ($type == 1) {
             //character lmit
             $text = JFilterOutput::cleanText($text);
             $sep = strlen($text) > $limit ? '...' : '';
             $text = utf8_substr($text, 0, $limit) . $sep;
         } else {
             //word limit
             $text = JFilterOutput::cleanText($text);
             $text = explode(' ', $text);
             $sep = count($text) > $limit ? '...' : '';
             $text = implode(' ', array_slice($text, 0, $limit)) . $sep;
         }
     }
     return $text;
 }
Beispiel #23
0
 public static function getAliasName($name)
 {
     $paramsC = JComponentHelper::getParams('com_phocagallery');
     $alias_iconv = $paramsC->get('alias_iconv', 0);
     $iconv = 0;
     if ($alias_iconv == 1) {
         if (function_exists('iconv')) {
             $name = preg_replace('~[^\\pL0-9_.]+~u', '-', $name);
             $name = trim($name, "-");
             $name = iconv("utf-8", "us-ascii//TRANSLIT", $name);
             $name = strtolower($name);
             $name = preg_replace('~[^-a-z0-9_.]+~', '', $name);
             $iconv = 1;
         } else {
             $iconv = 0;
         }
     }
     if ($iconv == 0) {
         $name = JFilterOutput::stringURLSafe($name);
     }
     if (trim(str_replace('-', '', $name)) == '') {
         JFactory::getDate()->format("Y-m-d-H-i-s");
     }
     return $name;
 }
Beispiel #24
0
 function edit()
 {
     $mainframe = JFactory::getApplication();
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     $id = JRequest::getInt("id");
     $vendor = JTable::getInstance('vendor', 'jshop');
     $vendor->load($id);
     if (!$id) {
         $vendor->publish = 1;
     }
     $_countries = $this->getModel("countries");
     $countries = $_countries->getAllCountries(0);
     $lists['country'] = JHTML::_('select.genericlist', $countries, 'country', 'class = "inputbox" size = "1"', 'country_id', 'name', $vendor->country);
     $nofilter = array();
     JFilterOutput::objectHTMLSafe($vendor, ENT_QUOTES, $nofilter);
     $view = $this->getView("vendors", 'html');
     $view->setLayout("edit");
     $view->assign('vendor', $vendor);
     $view->assign('lists', $lists);
     $view->assign('etemplatevar', '');
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeEditVendors', array(&$view));
     $view->displayEdit();
 }
 function edit()
 {
     $id = JRequest::getInt("id");
     $configdisplayprice = JSFactory::getTable('configDisplayPrice', 'jshop');
     $configdisplayprice->load($id);
     $list_c = $configdisplayprice->getZones();
     $zone_countries = array();
     foreach ($list_c as $v) {
         $obj = new stdClass();
         $obj->country_id = $v;
         $zone_countries[] = $obj;
     }
     $display_price_list = array();
     $display_price_list[] = JHTML::_('select.option', 0, _JSHOP_PRODUCT_BRUTTO_PRICE, 'id', 'name');
     $display_price_list[] = JHTML::_('select.option', 1, _JSHOP_PRODUCT_NETTO_PRICE, 'id', 'name');
     $lists['display_price'] = JHTML::_('select.genericlist', $display_price_list, 'display_price', '', 'id', 'name', $configdisplayprice->display_price);
     $lists['display_price_firma'] = JHTML::_('select.genericlist', $display_price_list, 'display_price_firma', '', 'id', 'name', $configdisplayprice->display_price_firma);
     $countries = JSFactory::getModel("countries");
     $lists['countries'] = JHTML::_('select.genericlist', $countries->getAllCountries(0), 'countries_id[]', 'size = "10", multiple = "multiple"', 'country_id', 'name', $zone_countries);
     JFilterOutput::objectHTMLSafe($configdisplayprice, ENT_QUOTES);
     $view = $this->getView("config_display_price", 'html');
     $view->setLayout("edit");
     $view->assign('row', $configdisplayprice);
     $view->assign('lists', $lists);
     $view->assign('etemplatevar', '');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeEditConfigDisplayPrice', array(&$view));
     $view->displayEdit();
 }
Beispiel #26
0
 /**
  *
  * @return unknown_type
  */
 public function display($articleid)
 {
     $html = '';
     if (empty($articleid)) {
         return;
     }
     //try loading language associations
     if (version_compare(JVERSION, '3.3', 'gt')) {
         $id = $this->getAssociatedArticle($articleid);
         if ($id && is_int($id)) {
             $articleid = $id;
         }
     }
     $item = $this->getArticle($articleid);
     $mainframe = JFactory::getApplication();
     // Return html if the load fails
     if (!$item->id) {
         return $html;
     }
     $item->title = JFilterOutput::ampReplace($item->title);
     $item->text = '';
     $item->text = $item->introtext . chr(13) . chr(13) . $item->fulltext;
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $params = $mainframe->getParams('com_content');
     $html .= $item->text;
     return $html;
 }
Beispiel #27
0
 public function check()
 {
     $result = true;
     //Alias
     if (empty($this->alias)) {
         $this->alias = JFilterOutput::stringURLSafe($this->title);
     } else {
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
     }
     $existingAlias = FOFModel::getTmpInstance('Tags', 'SpsimpleportfolioModel')->alias($this->alias)->getList(true);
     if (!empty($existingAlias)) {
         $count = 0;
         $k = $this->getKeyName();
         foreach ($existingAlias as $item) {
             if ($item->{$k} != $this->{$k}) {
                 $count++;
             }
         }
         if ($count) {
             $this->setError(JText::_('COM_SPSIMPLEPORTFOLIO_ALIAS_ERR_SLUGUNIQUE'));
             $result = false;
         }
     }
     return $result;
 }
Beispiel #28
0
function DocmanBuildRoute(&$query)
{
    jimport('joomla.filter.output');
    $segments = array();
    // check for task=...
    if (!isset($query['task'])) {
        return $segments;
    }
    $segments[] = $query['task'];
    // check for gid=...
    $gid = isset($query['gid']) ? $query['gid'] : 0;
    if (in_array($query['task'], array('cat_view', 'upload'))) {
        // create the category slugs
        $cats =& DOCMAN_Cats::getCategoryList();
        $cat_slugs = array();
        while ($gid and isset($cats[$gid])) {
            $cat_slugs[] = $gid . ':' . JFilterOutput::stringURLSafe($cats[$gid]->name);
            $gid = $cats[$gid]->parent_id;
        }
        $segments = array_merge($segments, array_reverse($cat_slugs));
    } else {
        // create the document slug
        $doc = DocmanRouterHelper::getDoc($gid);
        if ($doc->id) {
            $segments[] = $gid . ':' . JFilterOutput::stringURLSafe($doc->dmname);
        }
    }
    unset($query['gid']);
    unset($query['task']);
    return $segments;
}
Beispiel #29
0
/**
 * SEF url parser
 *
 * @access public
 * @static
 * @param $router object of JRouter class
 * @param $uri object of JURI class
 */
function parseJumiRouter(&$router, &$uri)
{
    if ($router->getMode() == JROUTER_MODE_RAW) {
        return array();
    }
    $db =& JFactory::getDBO();
    $db->setQuery('select id, title, alias from #__jumi where published = 1');
    $apps = $db->loadRowList();
    $alias = array();
    foreach ($apps as $i => $app) {
        if (empty($app[2])) {
            $apps[$i][2] = JFilterOutput::stringURLSafe($app[1]);
        }
        $alias[$i] = $apps[$i][2];
    }
    $segments = explode('/', $uri->getPath());
    foreach ($segments as $i => $segment) {
        if (($j = array_search($segment, $alias)) !== false) {
            unset($segments[$i]);
            $uri->setVar('option', 'com_jumi');
            $uri->setVar('fileid', $apps[$j][0]);
        }
    }
    $uri->setPath(implode('/', $segments));
    return array();
}
function build_InsertQuery_Event($tablename, $param1, $param2, $suspension, $sports_type_id, $order_count)
{
    $alias = JFilterOutput::stringURLSafe($param1);
    $query = "INSERT INTO #__joomleague_" . $tablename . " (`name`,`alias`,`icon`,`suspension`,`sports_type_id`,`published`,`ordering`) VALUES ('" . $param1 . "','" . $alias . "','" . $param2 . "','" . $suspension . "','" . $sports_type_id . "','1','" . $order_count . "')";
    //echo '<br />'.$query.'<br />';
    return $query;
}