/**
  * редактируем выбранный материал
  */
 function newAction()
 {
     if ($_POST) {
         $this->_width = mysql::query_findpole('select zna from config where id=23', 'zna');
         $this->_height = mysql::query_findpole('select zna from config where id=24', 'zna');
         $this->_width_b = mysql::query_findpole('select zna from config where id=25', 'zna');
         $this->_height_b = mysql::query_findpole('select zna from config where id=26', 'zna');
         // проверяем на checkbox
         forms::check_box(array('status', 'firstpage', 'alt'));
         // записываем в базу
         forms::multy_update_form($this->tablename, $_POST['id'], 0);
         $this->msg = general::messages(1, v::getI18n('backend_after_save'));
         // загружаем фото
         forms::multy_update_photo(HOST . IMG_GALLERY_PATH, 1, $_POST['id'], $this->_width, $this->_height, $this->_width_b, $this->_height_b, true);
         //  строим запрос
         $_sql = 'SELECT * FROM ' . $this->tablename . ' where id=' . $_POST['id'];
     } else {
         // строим запрос
         $_sql = 'SELECT * FROM ' . $this->tablename . ' where id=' . $_GET['id'];
     }
     // выполняем запрос + при необходимости выводим сам запрос
     $result = mysql::query_one($_sql, 0);
     // выбираем фотоальбомы
     $_sql = 'SELECT * FROM gallery_grupa WHERE id_parent=0 order by sort';
     $select = mysql::query($_sql, 0);
     return system::show_tpl(array('obj' => $result, 'msg' => $this->msg, 'select' => $select, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/new.php');
 }
 /**
  * редактируем выбранный материал
  */
 function newAction()
 {
     if ($_POST) {
         // проверяем на checkbox
         forms::check_box(array('status'));
         // записываем в базу
         forms::multy_update_form($this->tablename, $_POST['id'], 0);
         $this->msg = general::messages(1, v::getI18n('backend_after_save'));
         // загружаем фото
         forms::multy_update_photo(HOST . IMG_SPLASH_PATH, 1, $_POST['id'], 618, 281, 385, 220);
         //  строим запрос
         $_sql = 'SELECT * FROM ' . $this->tablename . ' where id=' . $_POST['id'];
     } else {
         // строим запрос
         $_sql = 'SELECT * FROM ' . $this->tablename . ' where id=' . $_GET['id'];
     }
     // выполняем запрос + при необходимости выводим сам запрос
     $result = mysql::query_one($_sql, 0);
     return system::show_tpl(array('obj' => $result, 'msg' => $this->msg, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/new.php');
 }
 /**
  * добавляем новый материал
  */
 function addAction()
 {
     if ($_POST) {
         $this->_width = mysql::query_findpole('select zna from config where id=42', 'zna');
         $this->_height = mysql::query_findpole('select zna from config where id=43', 'zna');
         $this->_width_b = mysql::query_findpole('select zna from config where id=44', 'zna');
         $this->_height_b = mysql::query_findpole('select zna from config where id=45', 'zna');
         // проверяем на checkbox
         forms::check_box(array('status'));
         // записываем в базу
         forms::multy_insert_form($this->tablename, 0);
         $this->msg = general::messages(1, v::getI18n('backend_after_save'));
         // загружаем фото
         forms::multy_update_photo(HOST . IMG_BRAND_PATH, 1, mysql_insert_id(), $this->_width, $this->_height, $this->_width_b, $this->_height_b);
         header('Location: /backend/' . $this->tpl_folder . '/index');
     }
     return system::show_tpl(array('msg' => $this->msg, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/add.php');
 }
 /**
  * добавляем новый материал
  */
 function addAction()
 {
     if ($_POST) {
         // даты
         $_POST['FORM']['date_news'] = general::date_to_database($_POST['FORM']['date_news']);
         $this->_width = mysql::query_findpole('select zna from config where id=16', 'zna');
         $this->_height = mysql::query_findpole('select zna from config where id=17', 'zna');
         $this->_width_b = mysql::query_findpole('select zna from config where id=19', 'zna');
         $this->_height_b = mysql::query_findpole('select zna from config where id=20', 'zna');
         // проверяем на checkbox
         forms::check_box(array('status'));
         // проверяем на существование такого action, если есть - добавляем несколько символов
         $_sql = 'SELECT count(*) as count FROM ' . $this->tablename . ' where url="' . $_POST['FORM']['url'] . '"';
         // выполняем запрос + при необходимости выводим сам запрос
         if (mysql::query_findpole($_sql, 'count', 0) > 0) {
             $_POST['FORM']['url'] .= '_new';
         }
         // записываем в базу
         forms::multy_insert_form($this->tablename, 0);
         $this->msg = general::messages(1, v::getI18n('backend_after_save'));
         // загружаем фото
         forms::multy_update_photo(HOST . IMG_NEWS_PATH, 1, mysql_insert_id(), $this->_width, $this->_height, $this->_width_b, $this->_height_b);
     }
     // массив типов
     global $_type_news;
     return system::show_tpl(array('msg' => $this->msg, 'select' => $_type_news, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/add.php');
 }
 /**
  * добавляем новый материал
  */
 function addAction()
 {
     if ($_POST) {
         // проверяем на существование такого action, если есть - добавляем несколько символов
         $_sql = 'SELECT count(*) as count FROM ' . $this->tablename . ' where url="' . $_POST['FORM']['url'] . '"';
         // выполняем запрос + при необходимости выводим сам запрос
         if (mysql::query_findpole($_sql, 'count', 0) > 0) {
             $_POST['FORM']['url'] .= '_' . rand(0, 99999);
         }
         $this->_width = mysql::query_findpole('select zna from config where id=21', 'zna');
         $this->_height = mysql::query_findpole('select zna from config where id=22', 'zna');
         $this->_width_b = mysql::query_findpole('select zna from config where id=21', 'zna');
         $this->_height_b = mysql::query_findpole('select zna from config where id=22', 'zna');
         // проверяем на checkbox
         forms::check_box(array('status'));
         // записываем в базу
         forms::multy_insert_form($this->tablename, 0);
         $this->msg = general::messages(1, v::getI18n('backend_after_save'));
         // загружаем фото
         forms::multy_update_photo(HOST . IMG_GALLERY_GRUPA_PATH, 1, mysql_insert_id(), $this->_width, $this->_height, $this->_width_b, $this->_height_b);
         header('Location: /backend/' . $this->tpl_folder . '/index');
     }
     return system::show_tpl(array('select' => dbh::get_gallery_grupa_tree(), 'msg' => $this->msg, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/add.php');
 }