function _add() { $array = array('news_date' => 'NOW()', 'news_pub' => '1', 'news_title' => params::get('news_title'), 'news_content' => params::get('news_content'), 'news_desc' => params::get('news_desc')); db::table('news'); db::smartInsert($array); headers::app('news'); }
function _add() { $array = array('file_date' => 'NOW()', 'file_name' => params::get('file_name'), 'section_id' => params::get('section_id')); db::table('info_files'); db::smartInsert($array); $file_id = mysql_insert_id(); $dir = FILES_ROOT . 'info/'; if (!empty($_FILES['file']['name'])) { $file_size = $_FILES['file']['size']; $file_type = files::info($_FILES['file']['name'], 'type'); $file_name = str_replace('.' . $file_type, '', $_FILES['file']['name']); $file = $dir . $_FILES['file']['name']; copy($_FILES['file']['tmp_name'], $file); $array = array('file_type' => $file_type, 'file_realname' => $file_name, 'file_size' => $file_size); db::table('info_files'); db::where('file_id', $file_id); db::update($array); } headers::app('info'); }
function _add() { $array = array('item_date' => 'NOW()', 'item_name' => params::get('item_name'), 'item_desc' => params::get('item_desc'), 'item_content' => params::get('item_content'), 'section_id' => params::get('section_id'), 'item_pub' => '1'); db::table('catalog_items'); db::smartInsert($array); $item_id = mysql_insert_id(); $photos = params::get('photos_id'); if ($photos) { foreach ($photos as $v) { db::table('catalog_items_photos'); db::where('file_id', $v); db::update(array('item_id' => $item_id)); } } $files = params::get('files_id'); if ($files) { foreach ($files as $v) { db::table('catalog_items_files'); db::where('file_id', $v); db::update(array('item_id' => $item_id)); } } $part_number = params::get('part_number'); $part_index = params::get('part_index'); $part_name = params::get('part_name'); $part_desc = params::get('part_desc'); if ($part_number) { foreach ($part_number as $k => $v) { $v = trim($v); if (!empty($v)) { $array = array('part_number' => $v, 'part_index' => trim($part_index[$k]), 'part_name' => trim($part_name[$k]), 'part_desc' => trim($part_desc[$k]), 'item_id' => $item_id); db::table('catalog_items_parts'); db::smartInsert($array); } } } headers::app('catalog'); }
function installApp() { if ($_FILES['app']['name']) { if ($_FILES['app']['type'] != 'application/zip') { s::set('ERRORS', '<ul><li>Неверный формат архива приложения.</li></ul>'); } else { $arr = explode('.', $_FILES['app']['name']); if (count($arr) < 5) { s::set('ERRORS', '<ul><li>Неверный формат архива приложения.</li></ul>'); } else { define('INSTALL_APP', $arr[0]); define('INSTALL_APP_VERSION', $arr[1] . '.' . $arr[2] . '.' . $arr[3]); files::fullRemoveDir(SYS_ROOT . 'var/tmp/apps/'); $path = SYS_ROOT . 'var/tmp/apps/'; zipfile::read($_FILES['app']['tmp_name']); zipfile::extract($path); $install_file = $path . 'install.php'; if (!file_exists($install_file)) { s::set('ERRORS', '<ul><li>Не найден инсталляционый файл приложения.</li></ul>'); } else { include $install_file; // copy lang files $tmp_lang_dir = SYS_ROOT . 'var/tmp/apps/langs/'; $lang_dir = SYS_ROOT . 'langs/admin/'; if (file_exists($lang_dir)) { $array = files::getFiles($tmp_lang_dir); foreach ($array as $v) { if (!file_exists($lang_dir . $v)) { copy($tmp_lang_dir . $v, $lang_dir . $v); } else { $lang = ini::parse($tmp_lang_dir . $v); ini::parse($lang_dir . $v); ini::add($lang); ini::write(); } } } // copy app files $dir = SYS_ROOT . 'var/tmp/apps/' . INSTALL_APP . '/'; $new_dir = SYS_ROOT . 'apps/' . INSTALL_APP . '/'; files::copyDir($dir, $new_dir); // clear tmp files::fullRemoveDir(SYS_ROOT . 'var/tmp/apps/'); headers::app('manage'); } } } } }
function _add() { self::_save(); headers::app('templates'); }
function _save() { $menu_id = params::get('menu_id'); db::table('menus'); db::where('menu_id', $menu_id); db::update(array('menu_pub' => '1', 'menu_name' => params::get('menu_name'), 'menu_title' => params::get('menu_title'), 'menu_tmpl' => params::get('menu_tmpl'), 'menu_tmpl_link' => params::get('menu_tmpl_link'), 'menu_tmpl_act' => params::get('menu_tmpl_act'), 'menu_tmpl_inact' => params::get('menu_tmpl_inact'))); $allPages = params::isCheck('allPages'); $allPagesOut = params::isCheck('allPagesOut'); $pages = params::get('pages'); if ($allPages == 1) { conf::deleteAll('menus', $menu_id, 'in'); conf::addPageIn('menus', $menu_id, 0); conf::deleteAll('menus', $menu_id, 'out'); conf::addPageOut('menus', $menu_id, 0); } else { if ($allPagesOut == 1 && $pages) { conf::deleteAll('menus', $menu_id, 'in'); conf::addPageIn('menus', $menu_id, 0); conf::deleteAll('menus', $menu_id, 'out'); foreach ($pages as $v) { conf::addPageOut('menus', $menu_id, $v); } } else { if ($pages) { conf::deleteAll('menus', $menu_id, 'out'); conf::addPageOut('menus', $menu_id, 0); conf::deleteAll('menus', $menu_id, 'in'); foreach ($pages as $v) { conf::addPageIn('menus', $menu_id, $v); } } else { conf::deleteAll('menus', $menu_id, 'in'); conf::addPageIn('menus', $menu_id, 0); conf::deleteAll('menus', $menu_id, 'out'); conf::addPageOut('menus', $menu_id, 0); } } } if (events::detect('add')) { headers::app('menus'); } else { headers::self(); } }
function _save() { $block_id = params::get('block_id'); db::table('blocks'); db::where('block_id', $block_id); db::update(array('block_pub' => '1', 'block_code' => params::get('block_code'), 'block_title' => params::get('block_title'), 'block_name' => params::get('block_name'))); $allPages = params::isCheck('allPages'); $allPagesOut = params::isCheck('allPagesOut'); $pages = params::get('pages'); if ($allPages == 1) { conf::deleteAll('blocks', $block_id, 'in'); conf::addPageIn('blocks', $block_id, 0); conf::deleteAll('blocks', $block_id, 'out'); conf::addPageOut('blocks', $block_id, 0); } else { if ($allPagesOut == 1 && $pages) { conf::deleteAll('blocks', $block_id, 'in'); conf::addPageIn('blocks', $block_id, 0); conf::deleteAll('blocks', $block_id, 'out'); foreach ($pages as $v) { conf::addPageOut('blocks', $block_id, $v); } } else { if ($pages) { conf::deleteAll('blocks', $block_id, 'out'); conf::addPageOut('blocks', $block_id, 0); conf::deleteAll('blocks', $block_id, 'in'); foreach ($pages as $v) { conf::addPageIn('blocks', $block_id, $v); } } else { conf::deleteAll('blocks', $block_id, 'in'); conf::addPageIn('blocks', $block_id, 0); conf::deleteAll('blocks', $block_id, 'out'); conf::addPageOut('blocks', $block_id, 0); } } } if (events::detect('add')) { headers::app('blocks'); } else { if (params::isCheck('go_structure')) { headers::app('blocks'); } else { headers::self(); } } }
function savePage() { self::_save(); params::send(); if (params::isCheck('go_structure')) { headers::app('pages'); } else { headers::self(); } }
function addMail() { db::table('mails'); db::insert('', params::get('mail_subject'), params::get('mail_content'), params::get('mail_name'), ADMIN_SITE_ID); headers::app('mails'); }