Beispiel #1
0
 function on_submit()
 {
     $type = intval(trim(Url::get('type')));
     $data = Url::get('data');
     if (empty($data['is_active'])) {
         $data['is_active'] = 0;
     }
     if (empty($data['id'])) {
         // if (!empty($data['name']) && faq::is_exists('name', $data['name'])) {
         //     $this->setErrorMessage('admin/faq/error', 'Exists faq with name: ' . $data['name']);
         //     Url::redirect_url('admin_faq.html?cmd=edit_faq');
         //     exit();
         // }
         // if (empty($data['name'])) {
         //     $this->setErrorMessage('admin/faq/error', 'faq name is null ');
         //     Url::redirect_url('admin_faq.html?cmd=edit_faq');
         //     exit();
         // }
         $data['created'] = TIME_NOW;
         $id = Faq::add_faq($data);
     } else {
         Faq::update_faq($data['id'], $data);
         $id = $data['id'];
     }
     Faq::remove_cache($id);
     $add_new = intval(trim(Url::get('add_new', 0)));
     if (empty($add_new)) {
         Url::redirect_url('admin_faq.html?cmd=edit_faq&id=' . $id);
     } else {
         Url::redirect_url('admin_faq.html?cmd=edit_faq');
     }
     exit;
 }