function siteMap() { db::table('pages'); db::where('site_id', ADMIN_SITE_ID); db::where('page_map', '1'); db::where('page_dynamic', '0'); $res = db::select(); $content = ''; while ($row = mysql_fetch_assoc($res)) { $content .= ' <url> <loc>http://' . ADMIN_SITE . $row['page_folder'] . '</loc> <lastmod>' . substr($row['page_date'], 0, 10) . '</lastmod> </url>'; } $xml = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.google.com/schemas/sitemap/0.84" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . $content . ' </urlset>'; if (files::write(ROOT . '/sitemap.xml', $xml)) { buffer::set('sitemap.xml успешно создан.'); } else { buffer::set('Не удалось записать sitemap.xml.'); } }
function save() { $array = file(ROOT . '/config.php'); $content = ''; foreach ($array as $k => $v) { if (strstr($v, '#system_style')) { $array[$k] = "define('SYS_STYLE', '" . params::get('system_style') . "'); #system_style\r\n"; } if (strstr($v, '#system_lang')) { $array[$k] = "define('LANG_INDEX', '" . params::get('system_lang') . "'); #system_lang\r\n"; } if (strstr($v, '#global_cache')) { if (params::get('global_cache')) { $array[$k] = "define('GLOBAL_CACHE', true); #global_cache\r\n"; } else { $array[$k] = "define('GLOBAL_CACHE', false); #global_cache\r\n"; } } if (strstr($v, '#global_time')) { $array[$k] = "define('GLOBAL_CACHE_TIME', " . params::get('global_cache_time') . "); #global_time\r\n"; } $content .= $array[$k]; } files::write(ROOT . '/config.php', $content); headers::self(); }
function save() { $content = ob_get_contents(); ob_clean(); files::write(self::$file, $content); echo $content; }
function write($array = false, $file = false, $sections = true) { if (!$file) { $file = self::$file; } if (!$array) { $array = self::$ini; } $string = ''; if ($sections) { foreach (array_keys($array) as $key) { $string .= '[' . $key . "]\r\n"; $string .= self::_write($array[$key], '') . "\r\n"; } } else { foreach ($array as $k => $v) { $string .= self::__write($k, $v) . "\r\n"; } } files::write($file, $string); }
function restoreVersion($app, $tmpl_file, $version_id) { db::table('templates_versions'); db::where('version_id', $version_id); $row = db::assoc(); $rows = db::rows(); $code = stripslashes($row['version_code']); $file = SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/' . $app . '/' . $tmpl_file; header("Content-Type: text/plain; charset=UTF-8"); files::write($file, $code); if ($rows != 0) { self::deleteVersion($version_id); } router::delQs('restore'); headers::selfQs(); }
function _save() { $tmpl_file = params::get('tmpl_file'); $tmpl_id = params::get('tmpl_id'); if (empty($tmpl_file)) { $tmpl_file = 'tmpl' + $tmpl_id + '.html'; } db::table('templates'); db::where('tmpl_id', $tmpl_id); db::update(array('tmpl_pub' => '1', 'tmpl_name' => params::get('tmpl_name'), 'tmpl_file' => $tmpl_file)); /* Code write */ $code = stripslashes(params::get('tmpl_code')); $file = SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/' . $tmpl_file; header("Content-Type: text/plain; charset=UTF-8"); files::write($file, $code); $allPages = params::get('allPages'); $pages = params::get('pages'); if ($allPages !== false) { db::table('pages'); db::where('site_id', ADMIN_SITE_ID); db::update('tmpl_id', $tmpl_id); } else { if ($pages) { foreach ($pages as $v) { db::table('pages'); db::where('page_id', $v); db::update('tmpl_id', $tmpl_id); } } } if (events::detect('save')) { self::saveVersion($tmpl_id, $code); } }