public function _home() { global $config, $user, $cache; $submit2 = _button('submit2'); if (_button() || $submit2) { $news_id = request_var('news_id', 0); $sql = 'SELECT * FROM _news WHERE news_id = ?'; if (!$news_data = sql_fieldrow(sql_filter($sql, $news_id))) { fatal_error(); } if ($submit2) { $post_subject = request_var('post_subject', ''); $post_desc = request_var('post_desc', '', true); $post_message = request_var('post_text', '', true); if (empty($post_desc) || empty($post_message)) { _pre('Campos requeridos.', true); } $comments = new _comments(); $post_message = $comments->prepare($post_message); $post_desc = $comments->prepare($post_desc); // $sql = 'UPDATE _news SET post_subject = ?, post_desc = ?, post_text = ? WHERE news_id = ?'; sql_query(sql_filter($sql, $post_subject, $post_desc, $post_message, $news_id)); $cache->delete('news'); redirect(s_link('news', $news_id)); } if (_button()) { _style('edit', array( 'ID' => $news_data['news_id'], 'SUBJECT' => $news_data['post_subject'], 'DESC' => $news_data['post_desc'], 'TEXT' => $news_data['post_text']) ); } } if (!_button()) { _style('field'); } return; }
public function _help_home() { global $user; $comments = new _comments(); $ha = $this->auth->query('comments'); if ($ha) { $ha_add = $this->auth->option(array('help', 'add')); $ha_edit = $this->auth->option(array('help', 'edit')); $ha_delete = $this->auth->option(array('help', 'delete')); } $sql = 'SELECT c.*, m.* FROM _help_cat c, _help_modules m WHERE c.help_module = m.module_id ORDER BY c.help_order'; $cat = sql_rowset($sql, 'help_id'); $sql = 'SELECT * FROM _help_faq'; $faq = sql_rowset($sql, 'faq_id'); // // Loop // foreach ($cat as $help_id => $cdata) { _style('cat', array( 'HELP_ES' => $cdata['help_es'], 'HELP_EN' => $cdata['help_en'], 'HELP_EDIT' => s_link_control('comments', array('mode' => $this->mode)), 'HELP_UP' => s_link_control('comments', array('mode' => $this->mode)), 'HELP_DOWN' => s_link_control('comments', array('mode' => $this->mode))) ); if ($ha_edit) { _style('cat.edit', array( 'URL' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'edit', 'sub' => 'cat', 'id' => $help_id)), 'UP' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'edit', 'sub' => 'cat', 'id' => $help_id, 'order' => '_15')), 'DOWN' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'edit', 'sub' => 'cat', 'id' => $help_id, 'order' => '15'))) ); } if ($ha_delete) { _style('cat.delete', array( 'URL' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'delete', 'sub' => 'cat', 'id' => $help_id))) ); } foreach ($faq as $faq_id => $fdata) { if ($help_id != $fdata['help_id']) { continue; } _style('cat.faq', array( 'QUESTION_ES' => $fdata['faq_question_es'], 'ANSWER_ES' => $comments->parse_message($fdata['faq_answer_es'])) ); if ($ha_edit) { _style('cat.faq.edit', array( 'URL' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'edit', 'sub' => 'faq', 'id' => $fdata['faq_id']))) ); } if ($ha_delete) { _style('cat.faq.delete', array( 'URL' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'delete', 'sub' => 'faq', 'id' => $fdata['faq_id']))) ); } } } if ($ha_add) { _style('add', array( 'URL' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'add'))) ); } $this->nav(); return; }