示例#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);
 }
示例#2
0
	/**
	 * Overloaded check function
	 *
	 * @access public
	 * @return boolean
	 *
	 */
	function check()
	{
		// Not typed in a category name?
		if (trim($this->catname) == '') {
			$this->_error = JText::_('COM_JEM_ADD_NAME_CATEGORY');
			JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
			return false;
		}

		$alias = JFilterOutput::stringURLSafe($this->catname);

		if(empty($this->alias) || $this->alias === $alias) {
			$this->alias = $alias;
		}

		/** check for existing name */
		/* in fact, it can happen for subcategories
		$query = 'SELECT id FROM #__jem_categories WHERE catname = '.$this->_db->Quote($this->catname);
		$this->_db->setQuery($query);

		$xid = intval($this->_db->loadResult());
		if ($xid && $xid != intval($this->id)) {
			JError::raiseWarning('SOME_ERROR_CODE', JText::sprintf('COM_JEM_CATEGORY_NAME_ALREADY_EXIST', $this->catname));
			return false;
		}
		*/

		return true;
	}
示例#3
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;
 }
示例#4
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']);
}
示例#5
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);
 }
示例#6
0
function getBadgeAlias($id)
{
    $badge = FD::table('Badge');
    $badge->load($id);
    $alias = JFilterOutput::stringURLSafe($badge->alias);
    return $alias;
}
示例#7
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);
 }
 /**
  * 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;
 }
示例#9
0
 public function check()
 {
     if (JString::trim($this->name) == '') {
         $this->setError(JText::_('K2_TAG_MUST_HAVE_A_NAME'));
         return false;
     }
     $this->normalize();
     $this->alias = $this->name;
     if (JFactory::getConfig()->get('unicodeslugs') == 1) {
         $this->alias = JFilterOutput::stringURLUnicodeSlug($this->alias);
     } else {
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
     }
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     $query->select($db->quoteName('id'))->from($db->quoteName('#__k2_tags'))->where($db->quoteName('alias') . ' = ' . $db->quote($this->alias));
     if ($this->id) {
         $query->where($db->quoteName('id') . ' != ' . (int) $this->id);
     }
     $db->setQuery($query);
     if ($db->loadResult()) {
         $this->alias .= '-' . uniqid();
     }
     return true;
 }
示例#10
0
 function save($list)
 {
     if (empty($list->listid)) {
         if (empty($list->userid)) {
             $user =& JFactory::getUser();
             $list->userid = $user->id;
         }
         if (empty($list->alias)) {
             $list->alias = $list->name;
         }
     }
     if (isset($list->alias)) {
         if (empty($list->alias)) {
             $list->alias = $list->name;
         }
         $list->alias = JFilterOutput::stringURLSafe(trim($list->alias));
     }
     if (empty($list->listid)) {
         $status = $this->database->insertObject(acymailing::table('list'), $list);
     } else {
         $status = $this->database->updateObject(acymailing::table('list'), $list, 'listid');
     }
     if ($status) {
         return empty($list->listid) ? $this->database->insertid() : $list->listid;
     }
     return false;
 }
示例#11
0
 /**
  * @return boolean
  */
 function check()
 {
     $this->menutype = JFilterOutput::stringURLSafe($this->menutype);
     if (empty($this->menutype)) {
         $this->setError("Cannot save: Empty menu type");
         return false;
     }
     // correct spurious data
     if (trim($this->title) == '') {
         $this->title = $this->menutype;
     }
     $db =& JFactory::getDBO();
     // check for unique menutype for new menu copy
     $query = 'SELECT menutype' . ' FROM #__menu_types';
     if ($this->id) {
         $query .= ' WHERE id != ' . (int) $this->id;
     }
     $db->setQuery($query);
     $menus = $db->loadResultArray();
     foreach ($menus as $menutype) {
         if ($menutype == $this->menutype) {
             $this->setError("Cannot save: Duplicate menu type '{$this->menutype}'");
             return false;
         }
     }
     return true;
 }
示例#12
0
 /**
  * translateAlias
  *
  * @return  void
  */
 public static function translateAlias()
 {
     $easyset = \Ezset::getInstance();
     $input = \JFactory::getApplication()->input;
     // Set translate language
     $SourceLan = $easyset->params->get('originLan');
     $ResultLan = $easyset->params->get('tranLan', 'en');
     // Get query
     $jform = $input->post->getRaw('jform', array());
     if (!isset($jform) || !isset($jform['alias']) || !isset($jform['title'])) {
         return;
     }
     $alias = $jform['alias'];
     $title = $jform['title'];
     $titleTmp = explode('::', $jform['title']);
     if (!empty($titleTmp[1])) {
         $title = $titleTmp[0];
         $alias = \JFilterOutput::stringURLSafe($titleTmp[1]);
     }
     if ('' == (string) trim($alias)) {
         $alias = LanguageHelper::translate($title, $SourceLan, $ResultLan);
         $alias = trim($alias);
         $alias = \JFilterOutput::stringURLSafe($alias);
         $alias = strtr($alias, static::$replace);
         $alias = trim($alias, '-');
     }
     $jform['alias'] = $alias;
     $jform['title'] = $title;
     $input = \JFactory::getApplication()->input;
     $input->post->set('jform', $jform, 'method', true);
     $input->request->set('jform', $jform);
 }
示例#13
0
 function check()
 {
     $mainframe = JFactory::getApplication();
     // check for valid name
     if (trim($this->title) == '') {
         $this->setError(JText::_('Your Poll must contain a title.'));
         return false;
     }
     // check for valid lag
     $this->lag = floatval($this->lag * 60);
     if ($this->lag == 0) {
         $this->setError(JText::_('Your Poll must have a non-zero lag time.'));
         return false;
     }
     if (empty($this->alias)) {
         $this->alias = $this->title;
     }
     $this->alias = JFilterOutput::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $datenow =& JFactory::getDate();
         $datenow->setOffset($mainframe->getCfg('offset'));
         $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
     }
     return true;
 }
示例#14
0
 /**
  * Override parent's store function
  *
  * @author Jason Rey <*****@*****.**>
  * @since  1.2
  * @access public
  */
 public function store($updateNulls = null)
 {
     // Store this flag first because there are some actions that we might need to do only after saving, and that point isNew() won't return the correct flag.
     $isNew = $this->isNew();
     // Check alias
     $alias = !empty($this->alias) ? $this->alias : $this->title;
     $alias = JFilterOutput::stringURLSafe($alias);
     $model = FD::model('clusters');
     $i = 2;
     do {
         $aliasExists = $model->clusterCategoryAliasExists($alias, $this->id);
         if ($aliasExists) {
             $alias .= '-' . $i++;
         }
     } while ($aliasExists);
     $this->alias = $alias;
     if (empty($this->ordering)) {
         $this->ordering = $this->getNextOrder('type = ' . FD::db()->quote($this->type));
     }
     if (empty($this->created)) {
         $this->created = FD::date()->toSql();
     }
     if (empty($this->uid)) {
         $this->uid = FD::user()->id;
     }
     $state = parent::store($updateNulls);
     if ($isNew) {
         // Create default fields
         FD::model('fields')->createDefaultItems($this->id, SOCIAL_TYPE_CLUSTERS, $this->type);
     }
     return $state;
 }
示例#15
0
 /**
  * Check data integrity
  *
  * @access public
  * @return boolean True on success
  */
 public function check()
 {
     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...
     }
     // check if project is unique
     // by checking if name+league+season alrerady exist
     if (!$this->id) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('name');
         $query->from('#__joomleague_project');
         $query->where('name =' . $db->Quote($this->name));
         $query->where('league_id = ' . $this->league_id);
         $query->where('season_id = ' . $this->season_id);
         $db->setQuery($query);
         $result = $db->loadColumn();
         if ($result) {
             $app = JFactory::getApplication()->enqueueMessage('Project with this name already exists', 'warning');
             return false;
         }
     }
     return true;
 }
示例#16
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;
 }
 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();
         }
     }
 }
 function getAliasName($name)
 {
     //$paramsC		= &JComponentHelper::getParams( 'com_phocaguestbook' );
     //$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)) == '') {
         $datenow =& JFactory::getDate();
         $name = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
     }
     return $name;
 }
示例#19
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;
 }
示例#20
0
 public function store($data = null)
 {
     $app = JFactory::getApplication();
     $data = $app->input->get('jform', array(), 'array');
     $row = JTable::getInstance($data['table'], 'Table');
     $date = date("Y-m-d H:i:s");
     // Bind the form fields to the table
     if (!$row->bind($data)) {
         return false;
     }
     $row->modified = $date;
     if (!$row->created) {
         $row->created = $date;
     }
     if ($data['table'] == 'ddcaccounttypes') {
         if ($data['alias'] == null) {
             $row->alias = JFilterOutput::stringURLSafe($data['account_type']);
         }
     }
     // Make sure the record is valid
     if (!$row->check()) {
         return false;
     }
     if (!$row->store()) {
         return false;
     }
     return $row;
 }
示例#21
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;
}
 /**
  * Get the raw data for this part of the upgrade.
  *
  * @return	array	Returns a reference to the source data array.
  * @since	0.5.6
  * @throws	Exception
  */
 public function databaseHook($rows = null)
 {
     // Initialize values
     $aliases = array();
     $unique_alias_suffix = 1;
     // Do some custom post processing on the list.
     foreach ($rows as &$row) {
         $row = (array) $row;
         $row['params'] = $this->convertParams($row['params']);
         $row['title'] = str_replace("'", "&#39;", $row['title']);
         $row['description'] = str_replace("'", "&#39;", $row['description']);
         if ($row['extension'] == 'com_banner') {
             $row['extension'] = "com_banners";
         } else {
             if ($row['extension'] == 'com_contact_details') {
                 $row['extension'] = "com_contact";
             }
         }
         // Correct alias
         if ($row['alias'] == "") {
             $row['alias'] = JFilterOutput::stringURLSafe($row['title']);
         }
         // The Joomla 2.5/3.0+ database structure does not allow duplicate aliases
         if (in_array($row['alias'], $aliases, true)) {
             $row['alias'] = $row['alias'] . $unique_alias_suffix;
             $unique_alias_suffix++;
         }
         $aliases[] = $row['alias'];
     }
     return $rows;
 }
示例#23
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;
 }
示例#24
0
 function check()
 {
     if (empty($this->alias)) {
         $this->alias = JFilterOutput::stringURLSafe($this->title);
     }
     return true;
 }
示例#25
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;
 }
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;
}
示例#27
0
 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);
 }
示例#28
0
 public function filterTitle(&$alias)
 {
     if ($alias == "") {
         $alias = JRequest::getString("refField_title");
     }
     $alias = JFilterOutput::stringURLSafe($alias);
 }
示例#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();
}
示例#30
0
 function display($tpl = null)
 {
     global $mainframe;
     $app = JFactory::getApplication();
     $pathway = $app->getPathWay();
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     // Load the form validation behavior
     JHTML::_('behavior.formvalidation');
     $params = $app->getParams();
     $this->assignRef('params', $params);
     $id = $params->get('course_id');
     if (!$id) {
         $id = JRequest::getVar('course_id');
     }
     $id = (int) $id;
     if (!$id) {
         echo JText::_('COM_JOOMDLE_NO_COURSE_SELECTED');
         return;
     }
     $user = JFactory::getUser();
     $username = $user->username;
     $this->course_info = JoomdleHelperContent::getCourseInfo($id, $username);
     /* pathway */
     $cat_slug = $this->course_info['cat_id'] . ":" . JFilterOutput::stringURLSafe($this->course_info['cat_name']);
     if (is_object($menu) && $menu->query['view'] != 'detail') {
         $pathway->addItem($this->course_info['cat_name'], 'index.php?view=coursecategory&cat_id=' . $cat_slug);
         $pathway->addItem($this->course_info['fullname'], '');
     }
     $document = JFactory::getDocument();
     $document->setTitle($this->course_info['fullname']);
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     parent::display($tpl);
 }