public function __construct() { parent::__construct(); $this->_update = filter_input(INPUT_GET, 'update'); $this->_settingsUpdate = filter_input(INPUT_POST, 'updatebutton'); $this->_extension = filter_input(INPUT_GET, 'extension'); }
/** * SettingsController constructor function */ public function __construct() { parent::__construct(); /** Get update, updatebutton and extension parameters from request URL */ $this->_update = filter_input(INPUT_GET, 'update'); $this->_settingsUpdate = filter_input(INPUT_POST, 'updatebutton'); $this->_extension = filter_input(INPUT_GET, 'extension'); }
public static function getfile($module_name, $module_id) { $file_key = sha1($module_name . $module_id . 'o'); if (isset(static::$cache[$file_key])) { return static::$cache[$file_key]; } else { return static::$cache[$file_key] = Files::where('module_name', $module_name)->where('module_id', intval($module_id))->remember(SettingsModel::one('cachelife'))->first(); } }
public static function put($key, $value) { $set = SettingsModel::where('key', $key)->first(); if ($set) { SettingsModel::where('key', $key)->update(array('value' => $value)); } else { SettingsModel::insert(array('value' => $value, 'key' => $key)); } }
public function __construct() { $model = SettingsModel::model()->where("`id`='1'")->findRow(); $this->smtpServer = $model->smtp; $this->port = $model->port; $this->username = $model->username; $this->password = $model->password; $this->from = $model->username; }
public function postSave() { $settings = Input::get('set'); if (is_array($settings)) { foreach ($settings as $key => $set) { $sett = SettingsModel::find($key); if (!$sett) { $sett = new SettingsModel(); $sett->key = $key; } $sett->value = $set; $sett->save(); } } $jsn = @json_encode($settings); Log::info('Edit settings ' . $jsn); return []; }
public function __construct() { parent::__construct(); $this->loadClass(array('CalendarModel', 'CalendarLangModel')); Route::get('calendar/cron', [$this, 'email_notifications']); $cron_date = \SettingsModel::one('calendar_cron_time'); if (date("Y-m-d", intval($cron_date)) !== date('Y-m-d')) { \SettingsModel::put('calendar_cron_time', time()); $this->email_notifications(); } Template::registerViewMethod('page', $this->page_view_mod, 'Pagina calendar', array($this, 'calendarViewMod'), true); }
public function display() { \User::onlyHas('chat-view'); $data = array('person' => \PersonModel::where('user_id', \Auth::user()->id)->first()); if ($data['person']) { $tokenGen = new FireBaseAuth(\SettingsModel::one('firechat_key')); $data['token'] = $tokenGen->createToken(array("uid" => "person-{$data['person']->id}"), array("admin" => True)); $data['person_lang'] = $data['person']->langs()->where('lang_id', \WebAPL\Language::getId())->first(); return Template::moduleView($this->module_name, 'views.chat-display', $data); } else { throw new Exception('Person not found'); } }
public static function getPostProperties($id) { if (isset(static::$properties[$id])) { return static::$properties[$id]; } $list = PostPropertyRel::join(PostProperty::getTableName(), PostProperty::getField('id'), '=', PostPropertyRel::getField('post_property_id'))->where(PostPropertyRel::getField('post_id'), $id)->remember(SettingsModel::one('cachelife'))->get(); $names = array(); foreach ($list as $item) { $names[] = $item->key; } static::$properties[$id] = $names; return $names; }
public static function getInstance() { $userid = SettingsModel::getApiKey(); $secret = SettingsModel::getSecretKey(); $station = SettingsModel::getStation(); $spinpapiCacheFolder = dirname(__FILE__) . '/../spinpapi/tmp'; $logerrors = true; $apiVersion = 2; if (!isset(self::$spinpapi)) { self::$spinpapi = new \SpinPapiClient($userid, $secret, $station, $logerrors, $apiVersion); self::$spinpapi->fcInit($spinpapiCacheFolder); } return self::$spinpapi; }
/** * Редактирование */ public function anyEdit() { //die; $id = (int) $this->getRequestParam('id') ?: null; $item = \SettingsModel::find($id); if (null !== Arr::get($this->getPostData(), 'submit')) { $data = Arr::get($this->getPostData(), 'value'); $item->value = $data; try { //изменения елемента по id $item->save(); Event::fire('Admin.settingsUpdate'); } catch (QueryException $e) { // Message::instance()->warning('Setting was don\'t edited'); //echo '<pre>'; //print_r($e->getMessage());die; } } $this->layout->content = View::make('back/setting/edit')->with('id', $id)->with('item', $item); }
<?php namespace WPSpin; // get program schedule from Spinitron $station = SettingsModel::getStation(); $data = file_get_contents('http://spinitron.com/radio/playlist.php?station=' . $station . '&show=schedule&ptype=s'); // remove some header information that we're not using $data = preg_replace('/<p id="catselector">.*\\n.*\\n.*/', '', $data); // Remove links // Links look like: // <a href="playlist.php?station=kwva&ptype=s&showid=380" title="Democracy Now! playlists">Democracy Now!</a> // and // <a href="playlist.php?station=kwva&ptype=s&djuid=38" title="Abulikah's playlists"> // TODO: Figure out how to make these links go to our custom posts for show/dj. Something like: // $data = preg_replace('/playlist.php?.*showid=/', '?page_id=', $data); // For now, remove spinitron links and replace with links to our archives $site_root = get_option("siteurl"); $data = preg_replace('/playlist.php\\?[^>]*showid[^"]*/', "{$site_root}/wpspin_shows/", $data); $data = preg_replace('/playlist.php\\?[^>]*djuid[^"]*/', "{$site_root}/wpspin_profiles/", $data); // link stylesheet from view and render processed data $stylesheet = plugin_dir_url(__FILE__) . '../views/showschedule.css'; print '<link rel="stylesheet" href="' . $stylesheet . '" />'; print $data;
echo varlang('street'); ?> </span> <span><?php echo varlang('city'); ?> </span> </p> </div> </div> <div class="clearfix"> </div> </footer> <?php Event::fire('bottom_contructor'); echo SettingsModel::one('stats_code'); ?> <script src="<?php echo res('assets/js/plugins.js'); ?> "></script> <script src="<?php echo res('assets/js/icheck.js'); ?> "></script> <script src="<?php echo res('assets/js/jquery.bxslider.min.js'); ?> "></script> <script src="<?php
/** * Set language * @param string[2] $ext * @throws Exception */ public static function setLanguage($ext) { $language = DB::table('apl_lang')->where('ext', $ext)->first(); if (!$language) { $language = DB::table('apl_lang')->where('id', '=', \SettingsModel::one('default_language'))->first(); } if (!$language) { $language = DB::table('apl_lang')->first(); } if ($language) { self::$language = $language; self::$id = $language->id; Session::put('lang', self::ext()); } else { throw new Exception("Available language not found"); } }
public function __construct() { $this->models = SettingsModel::all(); }
</head> <body> <div class="overlay hidden"></div> <div class="overlay2 hidden"></div> <div class="overlay3 hidden"></div> <header style="background:url('<?php echo isset($page->background) && $page->background ? url($page->background->path) : res("assets/img/backgr1.png"); ?> ') center "> <div class="row1"> <div class="left"> <a href="<?php echo Language::url('/'); ?> " class="l_box"><span><?php echo str_replace(" ", "</span><span>", SettingsModel::one('sitename_' . Language::ext())); ?> </span></a> <div class="mini_header"> <div class="mh_button"></div> <div class="content hidden"> <ul class="m_menu"> <?php if (isset($general_pages)) { foreach ($general_pages as $item) { ?> <li><a href='<?php echo $item->url; ?> '><?php echo $item->title;
setInterval(function() { chat._chat.getRoomList(function(list) { for (var roomId in list) { if (list[roomId].person_id == person_id && list[roomId].closed == 0) { chat._chat.enterRoom(roomId); } } }); }, 2000); } }); chat._chat.on('room-exit', function(roomId) { (new Firebase('<?php echo SettingsModel::one('firechat_host'); ?> /room-metadata/' + roomId)).child('closed').set(1); jQuery.post('<?php echo url('firechat/closeroom'); ?> ', {roomId: roomId, person_id: '<?php echo $person->id; ?> '}); }); chat._chat.on('room-exit-after', function(roomId) { var save_messages = confirm('<?php echo varlang('send-chat-on-email'); ?>
throw new Exception("'{$Extension}' load failed!"); } } }); Event::listen('APL.core.prepare', function () use($APLExtensions) { foreach ($APLExtensions as $Extension) { $full_class = "WebAPL\\" . $Extension; $full_class::__init(); class_alias($full_class, $Extension); } }); Event::listen('APL.website.check', function () { if (Input::get('is_admin')) { Session::put('is_admin', true); } Session::put('in_maintenance', !SettingsModel::one('website_on') && !Session::get('is_admin')); }); Event::listen('APL.modules.load', function () { Event::fire('APL.core.load'); Event::fire('APL.core.prepare'); Event::fire('APL.website.check'); Event::fire('APL.modules.beforeload'); Module::where('enabled', '1')->get()->each(function ($module) { ClassLoader::addDirectories(app_path() . '/modules/' . $module->extension . '/'); ClassLoader::load($module->extension); Modules::addInstance($module->extension); }); Event::fire('APL.modules.afterload'); }); Event::listen('APL.install.check', function () { return file_exists($_SERVER['DOCUMENT_ROOT'] . '/install/uninstalled');
/** * Конструктор */ protected function __construct() { // Кешировка данных $cache = new Cache(); $cache->setLocalPath('settings'); $cache->load(); if ($cache->isValid()) { $this->_items = json_decode($cache->getData(), true); } else { $data = \SettingsModel::all(); if (!empty($data)) { foreach ($data as $i) { $this->_items[$i->group][$i->name] = array('id' => $i->id, 'name' => $i->name, 'value' => $i->value, 'title' => $i->title, 'desc' => $i->desc); } } $cache->setData(json_encode($this->_items)); $cache->save(); } }
public function actionSettings() { $model = SettingsModel::model()->where("`id`='1'")->findRow(); if (isset($_POST['Settings'])) { $model->setAttrs($_POST['Settings']); $model->save(); } $this->view("admin/settings", array("model" => $model), false); }
<?php echo '<?xml version="1.0" encoding="UTF-8" ?>'; ?> <rss version="2.0"> <channel> <title><?php echo SettingsModel::one('sitename_' . \WebAPL\Language::ext()); ?> </title> <link><?php echo url(); ?> </link> <description></description> <?php foreach ($posts as $item) { ?> <item> <title><?php echo htmlspecialchars($item->title); ?> </title> <link><?php echo \WebAPL\Language::url('topost/' . $item->id); ?> </link> <description><?php echo htmlspecialchars(htmlspecialchars_decode(Str::words(strip_tags($item->text), 200))); ?>
public static function loadGeneralResources() { $data = array('general_pages' => Post::findGeneral(), 'buttom_pages' => PostProperty::postsWithProperty('button_site', 3), 'favicon' => Files::getfile('website_favicon', 1), 'alert_post' => Post::findAlertPost()); Template::setMetaMultiple(array('og:type' => 'page', 'og:image' => Files::extract('website_logo_' . WebAPL\Language::ext(), 1, 'path'), 'og:site_name' => SettingsModel::one('sitename'))); View::share($data); }
echo WebAPL\Template::getPageTitle(isset($page) ? $page : null); ?> '; var disqus_config = function () { this.language = "<?php echo WebAPL\Language::ext(); ?> "; }; var loc_lat = <?php echo SettingsModel::one('pos_lat') ? SettingsModel::one('pos_lat') : 0; ?> ; var loc_long = <?php echo SettingsModel::one('pos_long') ? SettingsModel::one('pos_long') : 0; ?> ; </script> <script src="<?php echo res('assets/js/jquery-2.1.1.js'); ?> "></script> </head> <body> <div class="overlay hidden"></div> <div class="overlay2 hidden"></div> <div class="overlay3 hidden"></div> <header class="page"> <div class="left">
<h1>{L:INDEX_TITLE}</h1> <?php $model = new SettingsModel(); $email = mysqli_fetch_object($model->getEmail()); if ($this->error) { echo $this->error; } ?> <form action="<?php echo url('settings'); ?> " method="post" enctype="multipart/form-data"> <div class="formRow"> <div class="formRowTitle"> <?php echo Lang::translate('INDEX_OLD_PASSWORD'); ?> : </div> <div class="formRowField"> <input type="password" name="password" autocomplete="off"> </div> </div> <div class="formRow"> <div class="formRowTitle"> <?php echo Lang::translate('INDEX_NEW_PASSWORD'); ?> :
public static function findExistsDates($feed_id) { $posts = Post::prepareQuery(2)->join(FeedPost::getTableName(), Post::getField("id"), '=', FeedPost::getField("post_id"))->where(FeedPost::getField("feed_id"), $feed_id)->where(PostLang::getField('enabled'), 1)->where(Post::getField('is_trash'), 0)->orderBy(DB::raw("DATE(" . Post::getField('created_at') . ")"), 'asc')->select(DB::raw("DATE(" . Post::getField('created_at') . ") as data"))->remember(SettingsModel::one('cachelife'))->get(); $dates = ['years' => [], 'months' => []]; foreach ($posts as $post) { $tmst = strtotime($post->data); $y = (int) date("Y", $tmst); $m = (int) date("m", $tmst); $d = (int) date("d", $tmst); $dates['years'][$y] = $y; if (isset($dates['months'][$y])) { if (isset($dates['months'][$y][$m])) { $dates['months'][$y][$m]++; } else { $dates['months'][$y][$m] = 1; } } else { $dates['months'][$y] = [$m => 1]; } } return $dates; }
echo varlang('limba-implicita'); ?> </h3> <form action="<?php echo url('settings/save'); ?> " method="post" class="ajax-auto-submit"> <select name="set[default_language]" class="form-control"> <?php foreach (WebAPL\Language::getList() as $language) { ?> <option value="<?php echo $language->id; ?> " <?php echo SettingsModel::one('default_language') == $language->id ? 'selected' : ''; ?> ><?php echo $language->name; ?> </option> <?php } ?> </select> </form> ---> <h3><?php echo varlang('limbi-disponibile'); ?>
public function getIndex() { User::onlyHas("template-edit"); $this->data['setts'] = SettingsModel::getAll(); $this->layout->content = View::make('sections.template.change', $this->data); }
/** * Get current color schema * @return boolean */ public static function getCurrentSchema() { $schema = \SettingsModel::one('templateSchema'); if ($schema && isset(static::$colorSchemes[$schema])) { return static::$colorSchemes[$schema]; } else { return false; } }
public function postChecktpl() { if (!Session::get('step3')) { return Redirect::to('install/step3'); } $tpl = trim(Input::get('tpl'), './'); $templatesDir = '/apps/frontend/views/templates/'; $tempalteDir = $_SERVER['DOCUMENT_ROOT'] . $templatesDir . $tpl; if ($tpl && is_dir($tempalteDir)) { $templates = glob($_SERVER['DOCUMENT_ROOT'] . $templatesDir . "*", GLOB_ONLYDIR); foreach ($templates as $template) { if ($tempalteDir != $template) { //File::deleteDirectory($template); } } SettingsModel::put('template_frontend', $tpl); Session::put('step4', true); return Illuminate\Support\Facades\Redirect::to('install/step5'); } else { Session::put('step4', false); return Illuminate\Support\Facades\Redirect::to('install/step4')->with('tplerror', 'Șablon invalid.'); } }
public function social_saveAction() { if (empty($_SERVER['HTTP_X_REQUESTED_WITH'])) { error404(); } $model = new SettingsModel(); $save['facebook'] = post('__facebook'); $save['steam'] = post('__steam'); $save['twitch'] = post('__twitch'); $save['twitter'] = post('__twitter'); $save['youtube'] = post('__youtube'); $model->setSettings(Request::getParam('user')->id, $save); $status = '<div class="">' . Lang::translate('SOCIAL_SAVED') . '</div>'; $response['error'] = 0; $response['target_h']['#status'] = $status; echo json_encode($response); exit; }