/** * @return bool */ public function Init() { if (Config::Get('plugin.beautypo.enable_formatter')) { Config::Set('head.rules.beautypo', array('path' => '___path.root.web___/', 'js' => array('include' => array(Plugin::GetTemplateWebPath(__CLASS__) . 'js/markitup-settings.js?')))); } return true; }
function _smarty_prefilter_tplhook_mark($sSource, Smarty_Internal_Template $oTemplate) { $sTemplateFile = ACE::FilePath($oTemplate->smarty->_current_file); $nLevel = intval(Config::Get('plugin.aceadminpanel.smarty.options.mark_template_lvl')); $sSource = ($nLevel ? "\n\n" : "") . "<!-- TEMPLATE BEGIN ({$nLevel} " . $sTemplateFile . ") -->" . ($nLevel ? "\n" : "") . $sSource . ($nLevel ? "\n" : "") . "<!-- TEMPLATE END ({$nLevel} " . $sTemplateFile . ") -->" . ($nLevel ? "\n" : ""); Config::Set('plugin.aceadminpanel.smarty.options.mark_template_lvl', ++$nLevel); return $sSource; }
/** * Инициализация плагина */ public function Init() { $this->Viewer_AppendScript($this->GetTemplateFilePath(__CLASS__, 'js/comments.js')); $this->Viewer_AppendStyle($this->GetTemplateFilePath(__CLASS__, 'css/style.css')); if (Config::Get('plugin.editcomment.max_history_depth') < 0) { Config::Set('plugin.editcomment.max_history_depth', 0); } }
private function _preInit() { $oUser = $this->_getUser(); if ($oUser and $oUser->isAdministrator()) { Config::Set($this->sPlugin . '.saved.view.skin', Config::Get('view.skin')); Config::Set($this->sPlugin . '.saved.path.smarty.template', Config::Get('path.smarty.template')); Config::Set($this->sPlugin . '.saved.path.static.skin', Config::Get('path.static.skin')); Config::Set('view.skin', 'admin_' . $this->sSkinName); Config::Set('path.smarty.template', '___path.root.server___/plugins/aceadminpanel/templates/skin/___view.skin___'); Config::Set('path.static.skin', '___path.root.web___/plugins/aceadminpanel/templates/skin/___view.skin___'); } }
protected function _preInit() { //$oUser = $this->_getUser(); if ($this->_checkAdmin()) { Config::Set($this->sPlugin . '.saved.view.skin', Config::Get('view.skin')); Config::Set($this->sPlugin . '.saved.path.smarty.template', Config::Get('path.smarty.template')); Config::Set($this->sPlugin . '.saved.path.static.skin', Config::Get('path.static.skin')); Config::Set('saved.view.skin', Config::Get('view.skin')); Config::Set('saved.path.smarty.template', Config::Get('path.smarty.template')); Config::Set('saved.path.static.skin', Config::Get('path.static.skin')); Config::Set('view.skin', 'admin_' . $this->sSkinName); Config::Set('path.smarty.template', '___path.root.server___/plugins/aceadminpanel/templates/skin/___view.skin___'); Config::Set('path.static.skin', '___path.root.web___/plugins/aceadminpanel/templates/skin/___view.skin___'); } }
public function testRetrieveAirport() { echo '<h3>Core API Tests</h3>'; echo "<strong>Checking geonames server</strong><br />"; Config::Set('AIRPORT_LOOKUP_SERVER', 'geonames'); OperationsData::RemoveAirport('PANC'); $return = OperationsData::RetrieveAirportInfo('PANC'); $this->assertNotEqual($return, false); echo "<strong>Checking phpVMS API server</strong><br />"; Config::Set('AIRPORT_LOOKUP_SERVER', 'phpvms'); Config::Set('PHPVMS_API_SERVER', 'http://apidev.phpvms.net'); OperationsData::RemoveAirport('PANC'); $return = OperationsData::RetrieveAirportInfo('PANC'); $this->assertNotEqual($return, false); }
public function RenderInitDone() { $aMenus = Config::Get('menu.data'); $bChanged = false; if ($aMenus && is_array($aMenus)) { foreach ($aMenus as $sMenuId => $aMenu) { if (isset($aMenu['init']['fill'])) { $aMenus[$sMenuId] = E::ModuleMenu()->Prepare($sMenuId, $aMenu); $bChanged = true; } } if ($bChanged) { Config::Set('menu.data', null); Config::Set('menu.data', $aMenus); } } }
/** * Инициализация плагина * * @return void */ public function Init() { if (preg_match('/^([\\d\\.]+)([^\\d\\.].*)$/', ACEADMINPANEL_VERSION, $m)) { $sVersion = $m[1] . '.' . ACEADMINPANEL_VERSION_BUILD . $m[2]; } else { $sVersion = ACEADMINPANEL_VERSION . '.' . ACEADMINPANEL_VERSION_BUILD; } Config::Set('plugin.aceadminpanel.version', $sVersion); //HelperPlugin::InitPlugin($this); HelperPlugin::AutoLoadRegister(array($this, 'Autoloader')); $sDataFile = $this->PluginAceadminpanel_Admin_GetCustomConfigFile(); if (!file_exists($sDataFile)) { $aConfigSet = $this->PluginAceadminpanel_Admin_GetValueArrayByPrefix('config.all.'); @file_put_contents($sDataFile, serialize($aConfigSet)); } $this->_loadPluginsConfig(); $this->_ActionAdminInerits(); }
public static function Delete($Index) { $Admins = Config::Get('Admins'); if ($Admins !== false) { $Index = intval($Index); if (isset($Admins[$Index])) { $Admin = $Admins[$Index]; unset($Admins[$Index]); $Saved = Config::Set('Admins', array_values($Admins)); if ($Saved) { Std::Out("[Info] [Admin] {$Admin[0]}" . (empty($Admin[1]) ? null : ":{$Admin[1]}") . ' deleted'); return array($Index, $Admin[0], $Admin[1]); } else { Std::Out("[Warning] [Admin] Error while trying to delete {$Admin[0]}" . (empty($Admin[1]) ? null : ":{$Admin[1]}")); return false; } } return 1; } return false; }
Config::Set('FLIGHT_TYPES', array('P' => 'Passenger', 'C' => 'Cargo', 'H' => 'Charter')); # Set the types of expenses we have Config::Set('EXPENSE_TYPES', array('M' => 'Monthly', 'F' => 'Per Flight', 'P' => 'Percent (month)', 'G' => 'Percent (per flight)')); define('SIGNATURE_PATH', '/lib/signatures'); define('AVATAR_PATH', '/lib/avatars'); define('PIREP_PENDING', 0); define('PIREP_ACCEPTED', 1); define('PIREP_REJECTED', 2); define('PIREP_INPROGRESS', 3); define('PILOT_PENDING', 0); define('PILOT_ACCEPTED', 1); define('PILOT_REJECTED', 2); define('NAV_NDB', 2); define('NAV_VOR', 3); define('NAV_DME', 4); define('NAV_FIX', 5); define('NAV_TRACK', 6); define('LOAD_VARIATION', 5); define('SECONDS_PER_DAY', 86400); define('GEONAME_URL', 'http://ws.geonames.org'); define('VMS_AUTH_COOKIE', 'VMSAUTH'); /** * Library Includes (from 3rd Party) */ # Bit-masks for permission sets $permission_set = array('EDIT_NEWS' => 0x1, 'EDIT_PAGES' => 0x2, 'EDIT_DOWNLOADS' => 0x4, 'EMAIL_PILOTS' => 0x8, 'EDIT_AIRLINES' => 0x10, 'EDIT_FLEET' => 0x20, 'EDIT_SCHEDULES' => 0x80, 'IMPORT_SCHEDULES' => 0x100, 'MODERATE_REGISTRATIONS' => 0x200, 'EDIT_PILOTS' => 0x400, 'EDIT_GROUPS' => 0x800, 'EDIT_RANKS' => 0x1000, 'EDIT_AWARDS' => 0x2000, 'MODERATE_PIREPS' => 0x4000, 'VIEW_FINANCES' => 0x8000, 'EDIT_EXPENSES' => 0x10000, 'EDIT_SETTINGS' => 0x20000, 'EDIT_PIREPS_FIELDS' => 0x40000, 'EDIT_PROFILE_FIELDS' => 0x80000, 'EDIT_VACENTRAL' => 0x100000, 'ACCESS_ADMIN' => 0x2000000, 'FULL_ADMIN' => 35651519); Config::Set('permission_set', $permission_set); define('NO_ADMIN_ACCESS', 0); foreach ($permission_set as $key => $value) { define($key, $value); }
Config::Set('db.table.adminban', '___db.table.prefix___adminban'); Config::Set('db.table.adminips', '___db.table.prefix___adminips'); define('ROUTE_PAGE_ADMIN', 'admin'); //таблицы шаблонов Config::Set('db.table.templates', '___db.table.prefix___templates'); Config::Set('db.table.tplusers', '___db.table.prefix___tplusers'); Config::Set('db.table.tplfav', '___db.table.prefix___tplfav'); //таблицы виджетов Config::Set('db.table.widgets', '___db.table.prefix___widgets'); Config::Set('db.table.widusers', '___db.table.prefix___widusers'); Config::Set('db.table.widfav', '___db.table.prefix___widfav'); Config::Set('db.table.widproducers', '___db.table.prefix___widproducers'); //таблицы украшений Config::Set('db.table.decor', '___db.table.prefix___decor'); Config::Set('db.table.decusers', '___db.table.prefix___decusers'); Config::Set('db.table.decfav', '___db.table.prefix___decfav'); /** * Категории шаблонов (текстовые данные редактируются в lang файле плагина админпанели) */ $config['tplcats'] = array('nature', 'techno'); /** * категории виджетов (текстовые данные редактируются в lang файле плагина админпанели) */ $config['widcats'] = array('nature', 'techno'); /** * категории украшений (текстовые данные редактируются в lang файле плагина админпанели) */ $config['deccats'] = array('nature', 'techno'); /** * категории украшений (текстовые данные редактируются в lang файле плагина админпанели) */
/** * SchedulePIREPTest::testPIREPRejected() * * @return void */ public function testPIREPRejected() { $this->resetPilot(); $sched = $this->findSchedule(); Config::Set('PIREP_CHECK_DUPLICATE', false); Config::Set('EMAIL_SEND_PIREP', false); # Update this schedule to only pay per-hour SchedulesData::editScheduleFields($sched->id, array('payforflight' => 0)); $sched = $this->findSchedule(); $this->assertEquals(0, $sched->payforflight, 'Pay per-flight set to 0'); $pirep_test = array('pilotid' => $this->samplePilotID, 'code' => $sched->code, 'flightnum' => $sched->flightnum, 'route' => $sched->route, 'depicao' => $sched->depicao, 'arricao' => $sched->arricao, 'aircraft' => $sched->aircraft, 'flighttime' => $sched->flighttime, 'submitdate' => 'NOW()', 'fuelused' => 6000, 'source' => 'unittest', 'comment' => 'Test Flight'); # Update Pilot Pay to be set to zero PilotData::updateProfile($this->samplePilotID, array('totalpay' => 0)); $pilot_data = PilotData::getPilotData($this->samplePilotID); $this->assertEquals($pilot_data->totalpay, 0, 'Reset Pilot Pay to 0'); # File the flight report $pirepid = PIREPData::fileReport($pirep_test); $this->assertGreaterThan(0, $pirepid, PIREPData::$lasterror); $pirepdata = PIREPData::findPIREPS(array('p.pirepid' => $pirepid)); $this->assertGreaterThan(0, count($pirepdata), 'No PIREPs returned'); # Work on one... $pirepdata = $pirepdata[0]; # Verify the little bits of this PIREP.... $this->assertEquals(PILOT_PAY_HOURLY, $pirepdata->paytype, 'PIREP Pay Type'); $this->assertEquals($pilot_data->payrate, $pirepdata->pilotpay, 'PIREP Pay Amount'); # Check the pilot pay $pilot_data = PilotData::getPilotData($this->samplePilotID); $this->assertEquals(0, $pilot_data->totalpay, 'Check pilot pay after PIREP FILE'); # Reject the PIREP and then check the pilot pay $status = PIREPData::changePIREPStatus($pirepdata->pirepid, PIREP_REJECTED); $pirepdata = PIREPData::findPIREPS(array('p.pirepid' => $pirepid)); $this->assertEquals(PIREP_REJECTED, $pirepdata[0]->accepted, 'changePIREPStatus to ACCEPTED'); $pirepdata = $pirepdata[0]; # Check the schedule flown count: $post_accept = $this->findSchedule(); $this->assertEquals($sched->timesflown, $post_accept->timesflown, "Schedule increment count"); $post_pilot_data = PilotData::getPilotData($this->samplePilotID); $this->assertEquals(0, $post_pilot_data->totalpay, 'Check pilot pay after PIREP REJECT'); $this->assertEquals($pilot_data->totalflights, $post_pilot_data->totalflights, 'Total Flights'); # Delete the PIREP PIREPData::deletePIREP($pirepid); # Verify delete $data = PIREPData::findPIREPS(array('p.pirepid' => $pirepid)); $this->assertEmpty($data, 'PIREPDdata::deletePIREP()'); }
<?php //address router Config::Set('router.page.mine', 'PluginMystuff_ActionMystuff'); //database setting $config['table']['topic_commented'] = '___db.table.prefix___topic_commented'; return $config;
<?php /** * config.php * Файл конфига плагина Rating * * @author Андрей Воронов <*****@*****.**> * Является частью плагина Rating * @version 0.0.1 от 30.01.2015 15:30 */ $config = array('user' => array('vote' => TRUE, 'dislike' => TRUE, 'min_change' => '0.42', 'max_change' => '3.2', 'max_rating' => '500', 'right_border' => '200', 'left_border' => '50', 'left_divider' => '70', 'mid_divider' => '40', 'right_divider' => '2'), 'blog' => array('vote' => TRUE, 'dislike' => TRUE, 'min_change' => '0.130', 'max_change' => '15', 'max_rating' => '500', 'right_border' => '200', 'left_border' => '50', 'left_divider' => '50', 'mid_divider' => '20', 'right_divider' => '10'), 'comment' => array('vote' => TRUE, 'dislike' => TRUE, 'min_change' => '0.004', 'max_change' => '0.5', 'max_rating' => '500', 'right_border' => '200', 'left_border' => '50', 'left_divider' => '130', 'mid_divider' => '70', 'right_divider' => '10'), 'topic' => array('vote' => TRUE, 'min_change' => '0.1', 'max_change' => '8', 'max_rating' => '500', 'right_border' => '200', 'left_border' => '50', 'left_divider' => '100', 'mid_divider' => '70', 'right_divider' => '10', 'auth_coef' => '2.73'), 'rating' => array('vote' => TRUE, 'topic_border_1' => '100', 'topic_border_2' => '250', 'topic_border_3' => '400', 'topic_k1' => '1', 'topic_k2' => '2', 'topic_k3' => '3', 'topic_k4' => '4')); Config::Set('rating.enabled', true); return $config;
define('LOGS_PATH', CORE_PATH . DS . 'logs'); define('TEMPLATES_PATH', CORE_PATH . DS . 'templates'); define('MODULES_PATH', CORE_PATH . DS . 'modules'); define('CACHE_PATH', CORE_PATH . DS . 'cache'); define('COMMON_PATH', CORE_PATH . DS . 'common'); define('PAGES_PATH', CORE_PATH . DS . 'pages'); define('LIB_PATH', SITE_ROOT . DS . 'lib'); define('VENDORS_PATH', CORE_PATH . DS . 'vendors'); $version = phpversion(); if (intval($version[0]) < 5) { die('You are not running PHP 5+'); } require CLASS_PATH . DS . 'autoload.php'; spl_autoload_register('codon_autoload'); Config::Set('MODULES_PATH', CORE_PATH . DS . 'modules'); Config::Set('MODULES_AUTOLOAD', true); Template::init(); require CORE_PATH . DS . 'app.config.php'; @(include CORE_PATH . DS . 'local.config.php'); /* Set the language */ Lang::set_language(Config::Get('SITE_LANGUAGE')); error_reporting(Config::Get('ERROR_LEVEL')); Debug::$debug_enabled = Config::Get('DEBUG_MODE'); if (Debug::$debug_enabled == true) { ini_set('log_errors', 'On'); ini_set('display_errors', 'Off'); ini_set('error_log', LOGS_PATH . '/errors.txt'); } /* Init caching engine */ CodonCache::init($cache_settings); if (DBASE_NAME != '' && DBASE_SERVER != '' && DBASE_NAME != 'DBASE_NAME') {
<?php // Добавляем rewrite rules для sitemap'ов в роутер $aRouterUri = Config::Get('router.uri'); $aRouterUri['/^sitemap\\.xml/i'] = "sitemap"; $aRouterUri['/^sitemap_(\\w+)_(\\d+)\\.xml/i'] = "sitemap/sitemap/\\1/\\2"; Config::Set('router.uri', $aRouterUri); // Добавляем экшен плагина в роутер Config::Set('router.page.sitemap', 'PluginSitemap_ActionSitemap'); $config = array(); $config['objects_per_page'] = 50000; // максимальное количество ссылок на одной странице карты $config['users_per_page'] = 1000; // максимальное количество пользователей на одной странице карты /** * Настройки времени жизни кеша данных, приоритета страниц, вероятной частоты изменений страницы * * cache_lifetime - время жизни кеша для наборов извлекаемых из БД. значение задается в секундах * sitemap_priority - приоритет страницы. значение от 0 до 1 * sitemap_changefreq - вероятная частота изменений страницы. значения always|hourly|daily|weekly|monthly|yearly|never */ // Главная страница и комментарии $config['general'] = array('mainpage' => array('sitemap_priority' => '1', 'sitemap_changefreq' => 'hourly'), 'comments' => array('sitemap_priority' => '0.7', 'sitemap_changefreq' => 'hourly')); // Блоги $config['blogs'] = array('cache_lifetime' => 60 * 60 * 8, 'sitemap_priority' => '0.8', 'sitemap_changefreq' => 'weekly'); // Записи $config['topics'] = array('cache_lifetime' => 60 * 60 * 0.5, 'sitemap_priority' => '0.9', 'sitemap_changefreq' => 'weekly'); // Пользователи $config['users'] = array('cache_lifetime' => 60 * 60 * 1, 'profile' => array('sitemap_priority' => '0.5', 'sitemap_changefreq' => 'weekly'), 'comments' => array('sitemap_priority' => '0.7', 'sitemap_changefreq' => 'weekly'), 'my' => array('sitemap_priority' => '0.8', 'sitemap_changefreq' => 'weekly')); return $config;
/** * Сохраняем меню * * @param ModuleMenu_EntityMenu $oMenu */ public function SaveMenu($oMenu) { // Установим объект для дальнейшего использования Config::Set("menu.data.{$oMenu->getId()}.items", $oMenu->GetItems()); // И конфиг сохраним $aNewConfigData = array(); /** @var ModuleMenu_EntityItem $oMenuItem */ foreach ($oMenu->GetItems() as $sMenuId => $oMenuItem) { $aNewConfigData[$sMenuId] = $oMenuItem ? $oMenuItem->getItemConfig() : ""; } Config::WriteCustomConfig(array("menu.data.{$oMenu->getId()}.list" => $aNewConfigData)); Config::Set("menu.data.{$oMenu->getId()}.list", $aNewConfigData); }
} if (defined('ACEADMINPANEL_VERSION')) { return array(); } define('ACEADMINPANEL_VERSION', '2.0'); define('ACEADMINPANEL_VERSION_BUILD', '354'); //$config = array('version' => ACEADMINPANEL_VERSION . '.' . ACEADMINPANEL_VERSION_BUILD); // определение таблиц Config::Set('db.table.adminset', '___db.table.prefix___adminset'); Config::Set('db.table.adminban', '___db.table.prefix___adminban'); Config::Set('db.table.adminips', '___db.table.prefix___adminips'); define('ROUTE_PAGE_ADMIN', 'admin'); Config::Set('router.page.less', 'PluginAceadminpanel_ActionLess'); Config::Set('head.rules.admin', array('path' => '___path.root.web___' . '/admin/', 'js' => array('exclude' => array("___path.static.skin___/js/favourites.js", "___path.static.skin___/js/questions.js")))); Config::Set('head.admin.css', array("___path.static.skin___/css/admin.css?v=" . ACEADMINPANEL_VERSION_BUILD, "___path.static.skin___/css/style.css?v=1", "___path.static.skin___/css/Roar.css", "___path.static.skin___/css/piechart.css", "___path.static.skin___/css/Autocompleter.css", "___path.static.skin___/css/prettify.css")); Config::Set('head.admin.js', array("___path.static.skin___/js/admin.js?v=" . ACEADMINPANEL_VERSION_BUILD, "___path.static.skin___/js/vote.js", "___path.static.skin___/js/favourites.js", "___path.static.skin___/js/questions.js", "___path.static.skin___/js/block_loader.js", "___path.static.skin___/js/friend.js", "___path.static.skin___/js/blog.js", "___path.static.skin___/js/other.js?v=" . ACEADMINPANEL_VERSION_BUILD, "___path.static.skin___/js/login.js", "___path.static.skin___/js/panel.js", "___path.static.skin___/js/vote.js")); /** * Проверка URL действий администратора * Если задано, то проверяется URL действия администратора. * Этот параметр увеличивает безопасность. */ $config['check_url'] = false; /** * Использовать "выплывающую" иконку меню * Параметр больше не используется */ //$config['icon_menu'] = true; /** * Разрешить админу голосовать несколько раз */ $config['admin_many_votes'] = true;
public function EventAjaxUserAdd() { E::ModuleViewer()->SetResponseAjax('json'); if ($this->IsPost()) { Config::Set('module.user.captcha_use_registration', false); $oUser = E::GetEntity('ModuleUser_EntityUser'); $oUser->_setValidateScenario('registration'); // * Заполняем поля (данные) $oUser->setLogin($this->GetPost('user_login')); $oUser->setMail($this->GetPost('user_mail')); $oUser->setPassword($this->GetPost('user_password')); $oUser->setPasswordConfirm($this->GetPost('user_password')); $oUser->setDateRegister(F::Now()); $oUser->setIpRegister(''); $oUser->setActivate(1); if ($oUser->_Validate()) { E::ModuleHook()->Run('registration_validate_after', array('oUser' => $oUser)); $oUser->setPassword($oUser->getPassword(), true); if (E::ModuleUser()->Add($oUser)) { E::ModuleHook()->Run('registration_after', array('oUser' => $oUser)); // Подписываем пользователя на дефолтные события в ленте активности E::ModuleStream()->SwitchUserEventDefaultTypes($oUser->getId()); if ($this->IsPost('user_setadmin')) { E::ModuleAdmin()->SetAdministrator($oUser->GetId()); } } E::ModuleMessage()->AddNoticeSingle(E::ModuleLang()->Get('registration_ok')); } else { E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('error')); E::ModuleViewer()->AssignAjax('aErrors', $oUser->_getValidateErrors()); } } else { E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('system_error')); } }
<?php /** * config.php * Файл конфигурационных параметров плагина Recaptcha * * @author Андрей Воронов <*****@*****.**> * @copyrights Copyright © 2014, Андрей Воронов * Является частью плагина Recaptcha * @version 0.0.1 от 08.01.2014 19:04 */ $config = array('public_key' => '', 'secret_key' => '', 'dark_theme' => false, 'audio' => false); // Экшен капчи уже не нужен, выпилим его Config::Set('router.page.captcha', 'ActionError'); Config::Set('captcha', FALSE); return $config;
<?php /*------------------------------------------------------- * * LiveStreet Engine Social Networking * Copyright © 2008 Mzhelskiy Maxim * *-------------------------------------------------------- * * Official site: www.livestreet.ru * Contact e-mail: rus.engine@gmail.com * * GNU General Public License, version 2: * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * --------------------------------------------------------- */ $config = array(); $config['table']['user'] = '******'; Config::Set('router.page.umanager', 'PluginUmanager_ActionUmanager'); $config['user_count'] = '5'; // Количество пользователей в блоке // Settings for plugin Sitemap $config['sitemap'] = array('cache_lifetime' => 60 * 60 * 24, 'sitemap_priority' => '0.8', 'sitemap_changefreq' => 'monthly'); return $config;
<?php //=============================================================== Config::Set('router.page.subscription', 'PluginSubscription_ActionSubscription'); Config::Set('db.table.subscription_mail', '___db.table.prefix___subscription_mail'); Config::Set('block.rule_subscription', array('action' => array('index'), 'blocks' => array('footer' => array('subscription' => array('params' => array('plugin' => 'subscription'), 'priority' => 100))), 'clear' => false)); Config::Set('plugin.subscription.subscription_blog_id', 2); //===============================================================
/** * This generates the forum signature of a pilot which * can be used wherever. It's dynamic, and adjusts it's * size, etc based on the background image. * * Each image is output into the /lib/signatures directory, * and is named by the pilot code+number (ie, VMA0001.png) * * This is called whenever a PIREP is accepted by an admin, * as not to burden a server with image generation * * Also requires GD to be installed on the server * * @param int The pilot ID for which to generate a signature for * @return bool Success */ public static function generateSignature($pilotid) { $pilot = self::getPilotData($pilotid); $pilotcode = self::getPilotCode($pilot->code, $pilot->pilotid); if (Config::Get('TRANSFER_HOURS_IN_RANKS') === true) { $totalhours = $pilot->totalhours + $pilot->transferhours; } else { $totalhours = $pilot->totalhours; } # Configure what we want to show on each line $output = array(); $output[] = $pilotcode . ' ' . $pilot->firstname . ' ' . $pilot->lastname; $output[] = $pilot->rank . ', ' . $pilot->hub; $output[] = 'Total Flights: ' . $pilot->totalflights; $output[] = 'Total Hours: ' . $totalhours; if (Config::Get('SIGNATURE_SHOW_EARNINGS') == true) { $output[] = 'Total Earnings: ' . (floatval($pilot->totalpay) + floatval($pilot->payadjust)); } # Load up our image # Get the background image the pilot selected if (empty($pilot->bgimage)) { $bgimage = SITE_ROOT . '/lib/signatures/background/background.png'; } else { $bgimage = SITE_ROOT . '/lib/signatures/background/' . $pilot->bgimage; } if (!file_exists($bgimage)) { # Doesn't exist so use the default $bgimage = SITE_ROOT . '/lib/signatures/background/background.png'; if (!file_exists($bgimage)) { return false; } } $img = @imagecreatefrompng($bgimage); if (!$img) { $img = imagecreatetruecolor(300, 50); } $height = imagesy($img); $width = imagesx($img); $txtcolor = str_replace('#', '', Config::Get('SIGNATURE_TEXT_COLOR')); $color = sscanf($txtcolor, '%2x%2x%2x'); $textcolor = imagecolorallocate($img, $color[0], $color[1], $color[2]); $font = 3; // Set the font-size $xoffset = Config::Get('SIGNATURE_X_OFFSET'); # How many pixels, from left, to start $yoffset = Config::Get('SIGNATURE_Y_OFFSET'); # How many pixels, from top, to start $font = Config::Get('SIGNATURE_FONT_PATH'); $font_size = Config::Get('SIGNATURE_FONT_SIZE'); if (function_exists('imageantialias')) { imageantialias($img, true); } /* Font stuff */ if (!function_exists('imagettftext')) { Config::Set('SIGNATURE_USE_CUSTOM_FONT', false); } # The line height of each item to fit nicely, dynamic if (Config::Get('SIGNATURE_USE_CUSTOM_FONT') == false) { $stepsize = imagefontheight($font); $fontwidth = imagefontwidth($font); } else { // get the font width and step size $bb = imagettfbbox($font_size, 0, $font, 'A'); $stepsize = $bb[3] - $bb[5] + Config::Get('SIGNATURE_FONT_PADDING'); $fontwidth = $bb[2] - $bb[0]; } $currline = $yoffset; $total = count($output); for ($i = 0; $i < $total; $i++) { if (Config::Get('SIGNATURE_USE_CUSTOM_FONT') == false) { imagestring($img, (int) $font, $xoffset, $currline, $output[$i], $textcolor); } else { // Use TTF $tmp = imagettftext($img, $font_size, 0, $xoffset, $currline, $textcolor, $font, $output[$i]); // Flag is placed at the end of of the first line, so have that bounding box there if ($i == 0) { $flag_bb = $tmp; } } $currline += $stepsize; } # Add the country flag, line it up with the first line, which is the # pilot code/name $country = strtolower($pilot->location); if (file_exists(SITE_ROOT . '/lib/images/countries/' . $country . '.png')) { $flagimg = imagecreatefrompng(SITE_ROOT . '/lib/images/countries/' . $country . '.png'); if (Config::Get('SIGNATURE_USE_CUSTOM_FONT') == false) { $ret = imagecopy($img, $flagimg, strlen($output[0]) * $fontwidth, $yoffset + $stepsize / 2 - 5.5, 0, 0, 16, 11); } else { # figure out where it would go $ret = imagecopy($img, $flagimg, $flag_bb[4] + 5, $flag_bb[5] + 2, 0, 0, 16, 11); } } # Add the Rank image if (Config::Get('SIGNATURE_SHOW_RANK_IMAGE') == true && $pilot->rankimage != '') { $cws = new CodonWebService(); $rankimg = @$cws->get($pilot->rankimage); $rankimg = imagecreatefromstring($rankimg); if (!$rankimg) { echo ''; } else { $r_width = imagesx($rankimg); $r_height = imagesy($rankimg); imagecopy($img, $rankimg, $width - $r_width - $xoffset, $yoffset, 0, 0, $r_width, $r_height); } } if (Config::Get('SIGNATURE_SHOW_COPYRIGHT') == true) { # # DO NOT remove this, as per the phpVMS license $font = 1; $text = 'powered by phpvms, ' . SITE_NAME . ' '; imagestring($img, $font, $width - strlen($text) * imagefontwidth($font), $height - imagefontheight($font), $text, $textcolor); } imagepng($img, SITE_ROOT . SIGNATURE_PATH . '/' . $pilotcode . '.png', 1); imagedestroy($img); }
<?php /** * Для того, чтобы начать публиковать записи в группу нужно * 1. Создать группу (Вид сообщества: Публиная страница) * 2. Создать приложение на странице https://vk.com/editapp?act=create (Тип: Standalone-приложение) * */ $config = array(); /** * Настройки для публикации в группе VK * */ $config['vk']['app_id'] = 5161909; // Айди приложения. Берется на странице настроек приложения $config['vk']['group_id'] = 105592235; // Айди группы в которую будет постинг. Берется из адреса вида http://vk.com/public70092613 $config['vk']['app_scope'] = 'offline,wall,photos'; // Права, которые будет запрашивать приложение $config['vk']['access_token'] = 'cb7783c502dadd385baad529c63c1c3bcd07133b4d667416f2bea832db09678095f59e079e1443fcdabbb'; // Аксесс тоукен. Ключ доступа для публикаций на стене группы $config['vk']['published_default'] = 1; // Чекбокс по умолчанию включен если 1 /** * Роутинг страницы настроек плагина * http://vk.com/feofannet * /postingingroups/admin/ - получения аксесс тоукена */ Config::Set('router.page.postingingroups', 'PluginPostingingroups_ActionAdmin'); return $config;
<?php $config = array('google_api_key' => 'AIzaSyAkUXI2Oo7bGD7wQFt5vkMw2_7_1mQHXos', 'page' => array('map' => array('elementId' => 'gmap-map-page', 'elementInputId' => 'gmap-input', 'autocomplete' => true, 'autocompleteZoom' => 8, 'defaultZoom' => 4, 'defaultCenter' => array('lat' => 47.754, 'lng' => 19.4238), 'mapTypeIds' => array('ROADMAP', 'OSM', 'SATELLITE'), 'mapTypeId' => 'ROADMAP', 'streetViewControl' => false, 'panControl' => false, 'scrollwheel' => false), 'topicAdd' => array('elementId' => 'gmap-map-topic', 'elementInputId' => 'gmap-input', 'autocomplete' => true, 'autocompleteZoom' => 8, 'defaultZoom' => 3, 'defaultCenter' => array('lat' => 47.754, 'lng' => 19.4238), 'mapTypeIds' => array('ROADMAP', 'OSM', 'SATELLITE'), 'mapTypeId' => 'ROADMAP', 'streetViewControl' => false, 'panControl' => false, 'scrollwheel' => true)), 'tile_layers' => array('OSM' => array('name' => 'Mapnik', 'link' => 'http://tile.openstreetmap.org/{z}/{x}/{y}.png'), 'BAW' => array('name' => 'Black and white', 'link' => 'http://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png'), 'OCM' => array('name' => 'OpenCycleMap', 'link' => 'http://tile.thunderforest.com/cycle/{z}/{x}/{y}.png'))); Config::Set('router.page.map', 'PluginGmappost_ActionMap'); return $config;
/** * Initialization of skin * */ protected function _initSkin() { $this->sViewSkin = $this->GetConfigSkin(); // Load skin's config $aConfig = array(); if (F::File_Exists($sFile = Config::Get('path.smarty.template') . '/settings/config/config.php')) { $aConfig = F::IncludeFile($sFile, FALSE, TRUE); } if (F::File_Exists($sFile = Config::Get('path.smarty.template') . '/settings/config/menu.php')) { $aConfig = F::Array_MergeCombo($aConfig, F::IncludeFile($sFile, false, true)); } // $aConfigLoad = F::Str2Array(Config::Get('config_load')); // if ($aConfigLoad) { // foreach ($aConfigLoad as $sConfigName) { // if (F::File_Exists($sFile = Config::Get('path.smarty.template') . "/settings/config/$sConfigName.php")) { // $aConfig = array_merge($aConfig, F::IncludeFile($sFile, false, true)); // } // } // } // Checks skin's config in app dir $sFile = Config::Get('path.dir.app') . F::File_LocalPath($sFile, Config::Get('path.dir.common')); if (F::File_Exists($sFile)) { $aConfig = F::Array_MergeCombo($aConfig, F::IncludeFile($sFile, false, true)); } // Checks skin's config from users settings $aUserConfig = Config::Get('skin.' . $this->sViewSkin . '.config'); if ($aUserConfig) { if (!$aConfig) { $aConfig = $aUserConfig; } else { $aConfig = F::Array_MergeCombo($aConfig, $aUserConfig); } } Config::ResetLevel(Config::LEVEL_SKIN); if ($aConfig) { Config::Load($aConfig, false, null, null, 'skin'); } // Check skin theme and set one in config if it was changed if ($this->GetConfigTheme() != Config::Get('view.theme')) { Config::Set('view.theme', $this->GetConfigTheme()); } // Load lang files for skin E::ModuleLang()->LoadLangFileTemplate(E::ModuleLang()->GetLang()); // Skip skin widgets for local viewer if (!$this->bLocal) { // * Load skin widgets if (F::File_Exists($sFile = Config::Get('path.smarty.template') . '/settings/config/widgets.php')) { $aSkinWidgets = F::IncludeFile($sFile, false, true); if (isset($aSkinWidgets['widgets']) && is_array($aSkinWidgets['widgets']) && count($aSkinWidgets['widgets'])) { $aWidgets = array_merge(Config::Get('widgets'), $aSkinWidgets['widgets']); Config::Set('widgets', $aWidgets); } } } // Load template variables from config if (($aVars = Config::Get('view.assign')) && is_array($aVars)) { $this->Assign($aVars); } }
/** * Initialization of skin * */ protected function _initSkin() { $this->sViewSkin = $this->GetConfigSkin(); // Load skin's config $aConfig = array(); Config::ResetLevel(Config::LEVEL_SKIN); $aSkinConfigPaths['sSkinConfigCommonPath'] = Config::Get('path.smarty.template') . '/settings/config/'; $aSkinConfigPaths['sSkinConfigAppPath'] = Config::Get('path.dir.app') . F::File_LocalPath($aSkinConfigPaths['sSkinConfigCommonPath'], Config::Get('path.dir.common')); // Может загружаться основной конфиг скина, так и внешние секции конфига, // которые задаются ключом 'config_load' // (обычно это 'classes', 'assets', 'jevix', 'widgets', 'menu') $aConfigNames = array('config') + F::Str2Array(Config::Get('config_load')); // Config section that are loaded for the current skin $aSkinConfigNames = array(); // ** Old skin version compatibility $oSkin = E::ModuleSkin()->GetSkin($this->sViewSkin); if (!$oSkin || !$oSkin->GetCompatible() || $oSkin->SkinCompatible('1.1', '<')) { // 'head.default' may be used in skin config C::Set('head.default', C::Get('assets.default')); } // Load configs from paths foreach ($aConfigNames as $sConfigName) { foreach ($aSkinConfigPaths as $sPath) { $sFile = $sPath . $sConfigName . '.php'; if (F::File_Exists($sFile)) { $aSubConfig = F::IncludeFile($sFile, false, true); if ($sConfigName != 'config' && !isset($aSubConfig[$sConfigName])) { $aSubConfig = array($sConfigName => $aSubConfig); } elseif ($sConfigName == 'config' && isset($aSubConfig['head'])) { // ** Old skin version compatibility $aSubConfig['assets'] = $aSubConfig['head']; unset($aSubConfig['head']); } // загружаем конфиг, что позволяет сразу использовать значения // в остальных конфигах скина (assets и кастомном config.php) через Config::Get() Config::Load($aSubConfig, false, null, null, $sFile); if ($sConfigName != 'config' && !isset($aSkinConfigNames[$sConfigName])) { $aSkinConfigNames[$sConfigName] = $sFile; } } } } if (!$oSkin || !$oSkin->GetCompatible() || $oSkin->SkinCompatible('1.1', '<')) { // 'head.default' may be used in skin config C::Set('head.default', false); } Config::ResetLevel(Config::LEVEL_SKIN_CUSTOM); $aStorageConfig = Config::ReadStorageConfig(null, true); // Reload sections changed by user if ($aSkinConfigNames) { foreach (array_keys($aSkinConfigNames) as $sConfigName) { if (isset($aStorageConfig[$sConfigName])) { if (empty($aConfig)) { $aConfig[$sConfigName] = $aStorageConfig[$sConfigName]; } else { $aConfig = F::Array_MergeCombo($aConfig, array($sConfigName => $aStorageConfig[$sConfigName])); } } } } // Checks skin's config from users settings $sUserConfigKey = 'skin.' . $this->sViewSkin . '.config'; $aUserConfig = Config::Get($sUserConfigKey); if ($aUserConfig) { if (!$aConfig) { $aConfig = $aUserConfig; } else { $aConfig = F::Array_MergeCombo($aConfig, $aUserConfig); } } if ($aConfig) { Config::Load($aConfig, false, null, null, $sUserConfigKey); } // Check skin theme and set one in config if it was changed if ($this->GetConfigTheme() != Config::Get('view.theme')) { Config::Set('view.theme', $this->GetConfigTheme()); } // Load lang files for skin E::ModuleLang()->LoadLangFileTemplate(E::ModuleLang()->GetLang()); // Load template variables from config if (($aVars = Config::Get('view.assign')) && is_array($aVars)) { $this->Assign($aVars); } }
/** * Загрузить настройки плагина в конфигурацию сайта * @param int $id * @param bool $force * @return */ public function LoadSettings($id = 1, $force = false) { if ($this->_settingsLoaded == true && $force == false) { return; } $aConfig = $this->GetSettings($id); Config::Set('plugin.facebook.application.id', $aConfig['appId']); Config::Set('plugin.facebook.application.api', $aConfig['appKey']); Config::Set('plugin.facebook.application.secret', $aConfig['appSecret']); Config::Set('plugin.facebook.page.id', $aConfig['pageId']); Config::Set('plugin.facebook.page.url', $aConfig['pageUrl']); $this->_settingsLoaded = true; return; }
<?php /** * All Tags * a LiveStreet plugin * by Em (http://emg-dev.com) * * Анекдоты: * xxx: кстати, с тех пор как мы живем вместе, я совершенно разучился готовить на одного, поэтому я пожарил картошки на двоих И СОЖРАЛ ВСЕ САМ МУХАХАХАХАХА!!! * */ $config = array(); Config::Set('router.page.alltags', 'PluginAlltags_ActionAlltags'); $config['maxtags'] = 1000; $config['pagetags'] = 'alltags'; return $config;
public function schedulegrid() { $page = $this->get->page; // get the requested page $limit = $this->get->rows; // get how many rows we want to have into the grid $sidx = $this->get->sidx; // get index row - i.e. user click to sort $sord = $this->get->sord; // get the direction if (!$sidx) { $sidx = 1; } # http://dev.phpvms.net/admin/action.php/operations/ # ?_search=true&nd=1270940867171&rows=20&page=1&sidx=flightnum&sord=asc&searchField=code&searchString=TAY&searchOper=eq /* Do the search using jqGrid */ $where = array(); if ($this->get->_search == 'true') { $searchstr = jqgrid::strip($this->get->filters); $where_string = jqgrid::constructWhere($searchstr); # Append to our search, add 1=1 since it comes with AND # from above $where[] = "1=1 {$where_string}"; } Config::Set('SCHEDULES_ORDER_BY', "{$sidx} {$sord}"); # Do a search without the limits so we can find how many records $count = SchedulesData::countSchedules($where); if ($count > 0) { $total_pages = ceil($count / $limit); } else { $total_pages = 0; } if ($page > $total_pages) { $page = $total_pages; } $start = $limit * $page - $limit; // do not put $limit*($page - 1) if ($start < 0) { $start = 0; } # And finally do a search with the limits $schedules = SchedulesData::findSchedules($where, $limit, $start); if (!$schedules) { $schedules = array(); } # Form the json header $json = array('page' => $page, 'total' => $total_pages, 'records' => $count, 'rows' => array()); # Add each row to the above array foreach ($schedules as $row) { if ($row->route != '') { $route = '<a href="#" onclick="showroute(\'' . $row->id . '\'); return false;">View</a>'; } else { $route = '-'; } $edit = '<a href="' . adminurl('/operations/editschedule?id=' . $row->id) . '">Edit</a>'; $delete = '<a href="#" onclick="deleteschedule(' . $row->id . '); return false;">Delete</a>'; $tmp = array('id' => $row->id, 'cell' => array($row->code, $row->flightnum, $row->depicao, $row->arricao, $row->aircraft, $row->registration, $route, Util::GetDaysCompact($row->daysofweek), $row->distance, $row->timesflown, $edit, $delete)); $json['rows'][] = $tmp; } header("Content-type: text/x-json"); echo json_encode($json); }