Beispiel #1
0
 /**
  * Prepare and sanitise the table prior to saving.
  *
  * @param UserIdeasTableItem $table
  *
  * @since    1.6
  */
 protected function prepareTable($table)
 {
     // get maximum order number
     if (!$table->get('id') and !$table->get('ordering')) {
         // Set ordering to the last item if not set
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('MAX(a.ordering)')->from($db->quoteName('#__uideas_items', 'a'))->where('a.catid = ' . (int) $table->catid);
         $db->setQuery($query, 0, 1);
         $max = (int) $db->loadResult();
         $table->set('ordering', $max + 1);
     }
     // Fix magic quotes.
     if (get_magic_quotes_gpc()) {
         $table->set('title', stripcslashes($table->get('title')));
         $table->set('description', stripcslashes($table->get('description')));
     }
     // If does not exist alias, I will generate the new one from the title
     if (!$table->get('alias')) {
         $table->set('alias', $table->get('title'));
     }
     $table->set('alias', JApplicationHelper::stringURLSafe($table->get('alias')));
 }
Beispiel #2
0
 /**
  * Prepare and sanitise the table prior to saving.
  *
  * @param UserIdeasTableItem $table
  * @since    1.6
  */
 protected function prepareTable(&$table)
 {
     // get maximum order number
     if (!$table->get("id")) {
         // Set ordering to the last item if not set
         if (empty($table->ordering)) {
             $db = $this->getDbo();
             $query = $db->getQuery(true);
             $query->select("MAX(a.ordering)")->from($db->quoteName("#__uideas_items", "a"));
             $db->setQuery($query, 0, 1);
             $max = $db->loadResult();
             $table->set("ordering", $max + 1);
         }
     }
     // Fix magic quotes
     if (get_magic_quotes_gpc()) {
         $table->set("alias", stripcslashes($table->title));
         $table->set("description", stripcslashes($table->description));
     }
     // If does not exist alias, I will generate the new one from the title
     if (!$table->get("alias")) {
         $table->set("alias", $table->get("title"));
     }
     $table->set("alias", JApplicationHelper::stringURLSafe($table->get("alias")));
 }