public static function getTimeline($user = array(), $privacy = 2, $template = 'timeline/helpers/timeline') { loader::model('timeline/timeline'); // Get actions $actions = codebreeder::instance()->timeline_model->getActions($user ? $user['user_id'] : 0, true, 0, config::item('actions_per_page', 'timeline')); $ratings = array(); // Do we have actions and are we logged in? if ($actions && users_helper::isLoggedin()) { foreach ($actions as $action) { if ($action['rating']) { $ratings[$action['relative_resource']][] = $action['item_id']; } else { $ratings['timeline'][] = $action['action_id']; } } // Load votes and like models loader::model('comments/votes'); loader::model('comments/likes'); // Get likes and votes $likes = codebreeder::instance()->likes_model->getMultiLikes($ratings); $votes = codebreeder::instance()->votes_model->getMultiVotes($ratings); $ratings = $likes + $votes; } // Can we post messages? $post = session::permission('messages_post', 'timeline') && codebreeder::instance()->users_model->getPrivacyAccess($user['user_id'], $privacy, false) ? true : false; view::assign(array('actions' => $actions, 'user' => $user, 'post' => $post, 'ratings' => $ratings), '', $template); // Update comments pagination config::set('comments_per_page', config::item('comments_per_page', 'timeline'), 'comments'); return view::load($template, array(), 1); }
function update014() { global $url, $smarty; //Checking if this Update already done if (CURRENT_DB_UPDATE < "014") { if (is_null(config::get('014updatestatus'))) { config::set('014updatestatus', 0); } $qry = DBFactory::getDBQuery(true); if (config::get('014updatestatus') < 1) { // Add killmail summary. time, hash, trust. $sql = 'CREATE TABLE IF NOT EXISTS `kb3_mails` ( `kll_id` int(11) NOT NULL auto_increment, `kll_timestamp` datetime NOT NULL default "0000-00-00 00:00:00", `kll_external_id` int(8) default NULL, `kll_hash` BINARY(16) NOT NULL, `kll_trust` TINYINT NOT NULL DEFAULT 0, PRIMARY KEY (`kll_id`), UNIQUE KEY `external_id` (`kll_external_id`), UNIQUE KEY `time_hash` (`kll_timestamp`,`kll_hash`) ) Engine=InnoDB'; $qry->execute($sql); } killCache(); config::set("DBUpdate", "014"); $qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '014' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '014'"); config::del("014updatestatus"); $smarty->assign('refresh', 1); $smarty->assign('content', "Update 014 completed."); $smarty->display('update.tpl'); die; } }
/** * @package EDK */ function update016() { global $url, $smarty; //Checking if this Update already done if (CURRENT_DB_UPDATE < "016") { $qry = DBFactory::getDBQuery(true); $sql = "ALTER TABLE `kb3_mails` ADD `kll_modified_time` DATETIME NOT NULL "; $qry->execute("SHOW COLUMNS FROM kb3_mails LIKE 'kll_modified_time'"); if (!$qry->recordCount()) { $qry->execute($sql); } $sql = "ALTER TABLE `kb3_mails` ADD INDEX ( `kll_modified_time` ) "; $qry->execute("SHOW INDEXES FROM kb3_mails"); $indexexists = false; while ($testresult = $qry->getRow()) { if ($testresult['Column_name'] == 'kll_modified_time') { $indexexists = true; } } if (!$indexexists) { $qry->execute($sql); } config::set("DBUpdate", "016"); $qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '016' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '016'"); $smarty->assign('refresh', 1); $smarty->assign('content', "Update 016 completed."); $smarty->display('update.tpl'); die; } }
static function boot() { $pathinfo = request::getPathInfo(); // 生成part if (isset($pathinfo[1])) { if ($p = strpos($pathinfo, '/', 2)) { $part = substr($pathinfo, 0, $p); } else { $part = $pathinfo; } } else { $part = '/'; } if ($part == '/openapi') { return kernel::single('base_rpc_service')->process($pathinfo); } elseif ($part == '/app-doc') { //cachemgr::init(); return kernel::single('base_misc_doc')->display($pathinfo); } // 确认是否安装流程. 如果是安装流程则开启debug. 如果不是则检查是否安装, 如果未安装则跳到安装流程 // 目前其他的url, 都应移到routes中进行 // if ($part == '/setup') { config::set('app.debug', true); } else { static::checkInstalled(); } cacheobject::init(); static::registRouteMiddleware(); $response = route::dispatch(request::instance()); // 临时处理方式 kernel::single('base_session')->close(); $response->send(); exit; }
/** * Preparation of the form. * * @return none */ function start() { $this->page = new Page(); $this->page->setTitle('Include custom code settings'); $this->page->addHeader('<link rel="stylesheet" type="text/css" href="' . KB_HOST . '/mods/inc_cc/style.css" />'); if (isset($_POST['clear'])) { config::set('inc_cc_settings', null); } $this->_opt = config::get('inc_cc_settings'); if (isset($_POST['add'])) { if (isset($_POST['add_options']) && !empty($_POST['add_options'])) { $this->_opt[$_POST['add_options']['position']][] = $_POST['add_options']['code']; config::set('inc_cc_settings', $this->_opt); } } if (isset($_POST['rm']) || isset($_POST['set'])) { if (isset($_POST['set_options']) && !empty($_POST['set_options'])) { foreach ($_POST['set_options'] as $position => $arr) { foreach ($arr as $key => $val) { if (isset($_POST['set_options'][$position][$key]['check'])) { unset($this->_opt[$position][$key]); if (isset($_POST['set'])) { $this->_opt[$val['position']][] = $val['code']; } } } } } config::set('inc_cc_settings', $this->_opt); } }
public function sendTemplate($keyword, $email, $tags = array(), $language = '') { loader::model('system/emailtemplates'); if (!$language) { $language = config::item('language_id', 'system'); } if (is_numeric($language)) { $language = config::item('languages', 'core', 'keywords', $language); } elseif (!in_array($language, config::item('languages', 'core', 'keywords'))) { return false; } if (!($template = config::item($keyword . '_' . $language, '_system_emails_cache'))) { if (!($template = $this->cache->item('core_email_template_' . $keyword . '_' . $language))) { $template = $this->emailtemplates_model->prepareTemplate($keyword, $language); if (count($template) == 3) { if ($template[$keyword]['active']) { $template = array('subject' => $template[$keyword]['subject'], 'message_html' => utf8::trim($template['header']['message_html'] . $template[$keyword]['message_html'] . $template['footer']['message_html']), 'message_text' => utf8::trim($template['header']['message_text'] . "\n\n" . $template[$keyword]['message_text'] . "\n\n" . $template['footer']['message_text'])); } else { $template = 'none'; } } else { error::show('Could not fetch email template from the database: ' . $keyword); } $this->cache->set('core_email_template_' . $keyword . '_' . $language, $template, 60 * 60 * 24 * 30); } config::set(array($keyword . '_' . $language => $template), '', '_system_emails_cache'); } $retval = true; if (is_array($template) && $template) { $retval = $this->sendEmail($email, $template['subject'], $template['message_text'], $template['message_html'], $tags); } return $retval; }
/** * @package EDK */ function update034() { global $url, $smarty; //Checking if this Update already done if (CURRENT_DB_UPDATE < "034") { if (is_null(config::get('034updatestatus'))) { config::set('034updatestatus', 0); } $qry = DBFactory::getDBQuery(true); if (config::get('034updatestatus') < 1) { $qry->execute("SHOW COLUMNS FROM kb3_invtypes LIKE 'radius'"); if ($qry->recordCount()) { $sql = "ALTER TABLE `kb3_invtypes` DROP COLUMN `radius` "; $qry->execute($sql); } } config::set("DBUpdate", "034"); $qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '034' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '034'"); config::del("034updatestatus"); $smarty->assign('refresh', 1); $smarty->assign('content', "Update 034 completed."); $smarty->display('update.tpl'); die; } }
function index() { $page = sf::getModel("pages")->showPage($this->type, input::getInput("get.id")); config::set('title', $page->getSubject()); view::set("page", $page); view::apply("inc_body", "template/about_us"); view::display("template/page"); }
public function handle($request, Clousure $next) { if (isset($_COOKIE['site']['preview']) && $_COOKIE['site']['preview'] == 'true') { config::set('cache.enabled', false); theme::preview(); } return $next($request); }
public function autor() { $params = $this->getParams(); if (isset($params[0])) { $alias = strtolower($params[0]); $this->data['one_autor'] = $this->model->getOneAutor($alias); config::set('heading', $this->data['one_autor'][0]['name'] . ':'); } }
/** * 查看新闻 */ function show() { $article = sf::getModel("articles", input::getInput("get.id")); //设置页面title config::set('title', $article->getSubject()); view::set("article", $article); view::apply("inc_body", "template/article_show"); view::display("template/page"); }
/** * 查看产品 */ function show() { $product = sf::getModel("products", input::getInput("get.id")); //设置页面title config::set('title', $product->getSubject()); view::set("product", $product); view::apply("inc_body", "template/product_show"); view::display("template/page"); }
private static function init() { if (!config::get("cfg_language")) { config::set("cfg_language", "en"); } @(include_once "common/language/" . config::get("cfg_language") . ".php"); include_once "common/language/en.php"; self::$lang = $language; }
function build($sCollectFunctionName = 'declareadminmenu', $bCheckAccess = false) { $this->collect($sCollectFunctionName, $bCheckAccess); $aTabs = $this->getTabs(); $this->sm->assign('menuTabs', $aTabs); config::set('tpl_page_title', $this->getPageTitle()); $first = current($aTabs); return $first['url']; }
public static function install() { $version = (int) module::version('google_analytics'); // module is not installed yet if ($version === 0) { config::set('google_analytics.id', 0); module::version('google_analytics', 1); } }
public static function install() { $version = (int) module::version('akismet'); // module is not installed yet if ($version === 0) { config::set('akismet.api_key', NULL); module::version('akismet', 1); } }
function update022() { global $url, $smarty; //Checking if this Update already done if (CURRENT_DB_UPDATE < "022") { if (is_null(config::get('022updatestatus'))) { config::set('022updatestatus', 0); } $qry = DBFactory::getDBQuery(true); if (config::get('022updatestatus') < 1) { $qry->execute("DELETE FROM `kb3_ships` WHERE `shp_externalid` = 0 AND `shp_name` NOT LIKE '%Unknown%'"); $qry->execute("DELETE FROM `kb3_ships` WHERE `shp_id` IN (206, 497, 348, 349,352, 354, 606)"); config::set('022updatestatus', 1); $smarty->assign('refresh', 1); $smarty->assign('content', "22. Delete unused and duplicated ships from ships table."); $smarty->display('update.tpl'); die; } if (config::get('022updatestatus') < 2) { // Add timestamp column to kb3_inv_detail $qry->execute("SHOW INDEX FROM `kb3_ships`"); $indextexists = false; while ($testresult = $qry->getRow()) { if ($testresult['Column_name'] == 'shp_externalid') { $indextexists = true; } } if (!$indextexists) { $qry->execute("ALTER TABLE `kb3_ships` ADD UNIQUE `shp_externalid` ( `shp_externalid` ) "); config::set('022updatestatus', 2); $smarty->assign('refresh', 1); $smarty->assign('content', "22. Ships table added unique index for external IDs."); $smarty->display('update.tpl'); die; } } if (config::get('022updatestatus') < 3) { //not too happy about this one but it does force the ships to use *my* IDs, as it would be if i dumped it - FRK $qry->execute("INSERT IGNORE INTO `kb3_ships` (`shp_id` ,`shp_name` ,`shp_class` ,`shp_externalid` ,`shp_rce_id` ,`shp_baseprice` ,`shp_techlevel` ,`shp_isfaction`) VALUES (704 , 'Guristas Shuttle', '11', '21628', '1', '10000000', '1', '1');"); $qry->execute("INSERT IGNORE INTO `kb3_ships` (`shp_id` ,`shp_name` ,`shp_class` ,`shp_externalid` ,`shp_rce_id` ,`shp_baseprice` ,`shp_techlevel` ,`shp_isfaction`) VALUES (705 , 'Civilian Gallente Shuttle', '11', '27303', '8', '0', '1', '0');"); config::set('022updatestatus', 3); $smarty->assign('refresh', 1); $smarty->assign('content', "22. Insert missing shuttles."); $smarty->display('update.tpl'); die; } killCache(); config::set("DBUpdate", "022"); $qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '022' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '022'"); config::del("022updatestatus"); $smarty->assign('refresh', 1); $smarty->assign('content', "Update 022 completed."); $smarty->display('update.tpl'); die; } }
public function set($setting, $siteid) { $setting = $this->addslashes($setting); $ssetting = array('title' => $setting['title'], 'keywords' => $setting['keywords'], 'description' => $setting['description'], 'template' => $setting['template'], 'registercheckcode' => $setting['registercheckcode'], 'logincheckcode' => $setting['logincheckcode'], 'membertokentype' => $setting['membertokentype']); if ($ssetting['template'] != Config::cms('view_name') || $setting['view_cache'] != Config::cms('view_cache') || $setting['view_cache_time'] != Config::cms('view_cache_time')) { $uset = array('view_name' => $ssetting['template'], 'view_cache' => $setting['view_cache'], 'view_cache_time' => $setting['view_cache_time']); config::set($uset, 'cms', 1); } return $this->where('siteid', 1)->update($ssetting); }
public static function addKill($kill) { $qry = DBFactory::getDBQuery(); $qry->execute("BEGIN"); allianceSummary::addKill($kill); corpSummary::addKill($kill); pilotSummary::addKill($kill); config::set('last_summary_id', $lastkillid); $qry->execute("COMMIT"); }
function update021() { global $url, $smarty; //Checking if this Update already done if (CURRENT_DB_UPDATE < "021") { $qry = DBFactory::getDBQuery(true); if (is_null(config::get('021updatestatus'))) { config::set('021updatestatus', 0); } if (config::get('021updatestatus') < 1) { // Add timestamp column to kb3_inv_detail $qry->execute("SHOW COLUMNS FROM kb3_ships LIKE 'shp_isfaction'"); if (!$qry->recordCount()) { $qry->execute("ALTER TABLE `kb3_ships` ADD `shp_isfaction` TINYINT(1) DEFAULT '0' AFTER `shp_techlevel`;"); config::set('021updatestatus', 1); $smarty->assign('refresh', 1); $smarty->assign('content', "21. kb3_ships shp_isfaction column added"); $smarty->display('update.tpl'); die; } } if (config::get('021updatestatus') < 3) { $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 3628;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17715;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17718;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17720;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17722;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17736;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17738;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17740;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17918;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17920;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17922;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17924;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17926;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17928;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17930;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 17932;"); $qry->execute("UPDATE kb3_ships SET shp_isfaction = '1' WHERE shp_externalid = 32207;"); config::set('021updatestatus', 3); $smarty->assign('refresh', 1); $smarty->assign('content', "21. faction tags added"); $smarty->display('update.tpl'); die; } killCache(); config::set("DBUpdate", "021"); $qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '021' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '021'"); config::del("021updatestatus"); $smarty->assign('refresh', 1); $smarty->assign('content', "Update 021 completed."); $smarty->display('update.tpl'); die; } }
public function getFriend($userID, $active = true) { if (($user = config::item('u' . $userID, '_users_cache_friends')) === false) { $user = $this->db->query("SELECT `user_id`, `friend_id`, `post_date`, `active`\n\t\t\t\tFROM `:prefix:users_friends`\n\t\t\t\tWHERE (`user_id`=? AND `friend_id`=? OR `user_id`=? AND `friend_id`=?) LIMIT 1", array(session::item('user_id'), $userID, $userID, session::item('user_id')))->row(); config::set(array('u' . $userID => $user), '', '_users_cache_friends'); } if ($active && (!isset($user['active']) || !$user['active'])) { return array(); } return $user; }
public function __construct($app) { kernel::set_online(false); if (kernel::single('base_setup_lock')->lockfile_exists()) { if (!kernel::single('base_setup_lock')->check_lock_code()) { $this->lock(); } } parent::__construct($app); config::set('log.default', 'file'); }
/** * Construct a Page class with the given title. * * Page generation timer is started on Page creation. */ function Page($title = '', $cachable = true) { global $timeStarted; $this->timestart =& $timeStarted; event::call('page_initialisation', $this); if (!config::get('public_stats')) { config::set('public_stats', 'do nothing'); } $this->title = htmlspecialchars($title); $this->cachable = $cachable; }
public function index() { if ($_POST) { config::set('google_analytics.id', $this->input->post('google_analytics_id')); message::info('Settings changed successfully', 'admin/google_analytics'); } else { $this->head->title->append('Settings'); $this->template->title .= 'Settings'; $this->template->content = new View('google_analytics/settings'); $this->template->content->google_analytics_id = config::get('google_analytics.id'); } }
public function index() { $this->head->title->append(__('Settings')); $this->template->title = __('Settings'); $form = Formo::factory()->plugin('csrf')->add('text', 'site_title', array('label' => __('Site title'), 'value' => config::get('s7n.site_title')))->add_select('theme', theme::available(), array('label' => __('Theme'), 'value' => config::get('s7n.theme')))->add('submit', 'submit', array('label' => __('Save'))); if ($form->validate()) { config::set('s7n.site_title', $form->site_title->value); config::set('s7n.theme', $form->theme->value); message::info(__('Settings edited successfully'), 'admin/settings'); } $this->template->content = View::factory('settings/settings', $form->get(TRUE)); }
public static function run($argv) { error_reporting(E_ALL ^ E_NOTICE); $console = $argv[1] ? $argv[1] : ''; unset($argv[0]); unset($argv[1]); $param = array_values($argv); config::set('console', $console); config::set('param', $param); $route = new System\Route(); return $route->make($console, $param); }
/** * @package EDK */ function update039() { global $url, $smarty; //Checking if this Update already done if (CURRENT_DB_UPDATE < "039") { if (is_null(config::get('039updatestatus'))) { config::set('039updatestatus', 0); } $qry = DBFactory::getDBQuery(true); if (config::get('039updatestatus') < 1) { $qry->execute("UPDATE kb3_inv_detail SET ind_shp_id = 11194 WHERE ind_shp_id = 206"); // Kitsune $qry->execute("UPDATE kb3_inv_detail SET ind_shp_id = 22428 WHERE ind_shp_id = 348"); // Redeemer $qry->execute("UPDATE kb3_inv_detail SET ind_shp_id = 22430 WHERE ind_shp_id = 349"); // Sin $qry->execute("UPDATE kb3_inv_detail SET ind_shp_id = 22436 WHERE ind_shp_id = 352"); // Widow $qry->execute("UPDATE kb3_inv_detail SET ind_shp_id = 22440 WHERE ind_shp_id = 354"); // Panther config::set('039updatestatus', 1); $smarty->assign('refresh', 1); $smarty->assign('content', "39. Update kb3_inv_detail."); $smarty->display('update.tpl'); die; } if (config::get('039updatestatus') < 2) { $qry->execute("UPDATE kb3_kills SET kll_ship_id = 11194 WHERE kll_ship_id = 206"); // Kitsune $qry->execute("UPDATE kb3_kills SET kll_ship_id = 22428 WHERE kll_ship_id = 348"); // Redeemer $qry->execute("UPDATE kb3_kills SET kll_ship_id = 22430 WHERE kll_ship_id = 349"); // Sin $qry->execute("UPDATE kb3_kills SET kll_ship_id = 22436 WHERE kll_ship_id = 352"); // Widow $qry->execute("UPDATE kb3_kills SET kll_ship_id = 22440 WHERE kll_ship_id = 354"); // Panther config::set('039updatestatus', 2); $smarty->assign('refresh', 1); $smarty->assign('content', "39. Update kb3_kills."); $smarty->display('update.tpl'); die; } killCache(); config::set("DBUpdate", "039"); $qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '039' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '039'"); config::del("039updatestatus"); $smarty->assign('refresh', 1); $smarty->assign('content', "Update 039 completed."); $smarty->display('update.tpl'); die; } }
public function index() { if ($_POST) { config::set('akismet.api_key', $this->input->post('akismet_api_key')); message::info(__('Settings changed successfully'), 'admin/akismet'); } else { $this->head->title->append(__('Settings')); $this->template->title .= __('Settings'); $this->template->content = new View('akismet/settings'); $this->template->content->akismet_api_key = config::get('akismet.api_key'); } }
function changeJQTheme() { global $themename; if (options::getPrevious('jqtheme_name') == $_POST['option_jqtheme_name']) { return; } $jqthemename = preg_replace('/[^a-zA-Z0-9-_]/', '', $_POST['option_jqtheme_name']); if (!is_dir("themes/default/jquerythemes/{$jqtheme_name}")) { $jqthemename = 'base'; } $_POST['option_jqtheme_name'] = $jqthemename; config::set('jqtheme_name', $jqthemename); }
public function getUser($userID, $self = false) { if (($user = config::item('u' . $userID, '_users_cache_blacklist')) === false) { $user = $this->db->query("SELECT `user_id`, `blocked_id`, `post_date`\n\t\t\t\tFROM `:prefix:users_blocked`\n\t\t\t\tWHERE `user_id`=? AND `blocked_id`=? " . (!$self ? "OR `user_id`=? AND `blocked_id`=?" : "") . " LIMIT 1", array(session::item('user_id'), $userID, $userID, session::item('user_id')))->row(); if (!$self) { config::set(array('u' . $userID => $user), '', '_users_cache_blacklist'); } } if ($self && (!isset($user['user_id']) || $user['blocked_id'] != $userID)) { return array(); } return $user; }