Esempio n. 1
0
 /**
  * Add unique token field 
  *
  * @param string $text
  */
 public function parse(&$text)
 {
     $contains_form = strpos($text, '</form>');
     $is_get = preg_match('/method=[\'"]get[\'"]/', $text);
     $has_token = strpos($text, 'KSecurityToken');
     if ($contains_form && !$is_get && !$has_token) {
         $text = str_replace('</form>', KSecurityToken::render() . PHP_EOL . '</form>', $text);
     }
 }
Esempio n. 2
0
 public function save()
 {
     KSecurityToken::check() or die('Invalid token or time-out, please try again');
     $item = KFactory::get('admin::com.nooku.model.metadata')->getItem();
     $item->author = KInput::get('metadata_author', 'post', 'raw', 'string');
     $item->description = KInput::get('metadata_description', 'post', 'raw', 'string');
     $item->keywords = KInput::get('metadata_keywords', 'post', 'raw', 'string');
     $item->save();
 }
Esempio n. 3
0
 public function enable()
 {
     KSecurityToken::check() or die('Invalid token or time-out, please try again');
     $cid = KInput::get('cid', 'post', 'array.ints');
     $enable = $this->getTask() == 'enable' ? 1 : 0;
     if (count($cid) < 1) {
         throw new KControllerException(JText::sprintf('Select a item to %s', JText::_($this->getTask()), true));
     }
     KFactory::get('admin::com.nooku.model.translators')->enable($enable, $cid);
     $this->setRedirect('view=translators');
 }
Esempio n. 4
0
 public function add()
 {
     KSecurityToken::check() or die('Invalid token or time-out, please try again');
     $model = KFactory::get('admin::com.nooku.model.tables');
     $tbl = KFactory::get('admin::com.nooku.table.tables');
     $cid = KInput::get('cid', 'post', 'array.cmd');
     $tables = $model->getTableData($cid);
     foreach ($tables as $table) {
         $tbl->insert($table);
     }
     $this->setRedirect('view=tables');
 }
Esempio n. 5
0
 /**
  * Generic method to modify the order of the items
  * 
  * @return KDatabaseRow The row object containing the reordered row
  */
 public function order()
 {
     KSecurityToken::check() or die('Invalid token or time-out, please try again');
     $id = KInput::get('id', 'post', 'int');
     $change = KInput::get('order_change', 'post', 'int');
     // Get the table object attached to the model
     $component = $this->getClassName('prefix');
     $name = KInflector::pluralize($this->getClassName('suffix'));
     $view = $name;
     $app = KFactory::get('lib.joomla.application')->getName();
     $table = KFactory::get($app . '::com.' . $component . '.table.' . $name);
     $row = $table->fetchRow($id)->order($change);
     $this->setRedirect('view=' . $view . '&format=' . KInput::get('format', 'get', 'cmd', null, 'html'));
     return $row;
 }
Esempio n. 6
0
 public function sold()
 {
     KSecurityToken::check() or die('Invalid token or time-out, please try again');
     $cid = KInput::get('cid', 'post', 'array.ints', null, array());
     $publish = $this->getTask() == 'sold' ? 1 : 0;
     if (count($cid) < 1) {
         throw new KControllerException(JText::sprintf('Select a item to %s', JText::_($this->getTask()), true));
     }
     // Get the table object attached to the model
     $component = $this->getClassName('prefix');
     $model = $this->getClassName('suffix');
     $view = $model;
     $app = KFactory::get('lib.joomla.application')->getName();
     $table = KFactory::get($app . '::com.' . $component . '.model.' . $model)->getTable();
     $table->update(array('sold' => $publish), $cid);
     $this->setRedirect('view=' . KInflector::pluralize($view) . '&format=' . KInput::get('format', 'get', 'cmd', null, 'html'));
 }