/** * Initialize plugins data * create GSPLUGINSFILE if not exist * else load in plugins and register the inactive ones * * @since 3.4 */ function loadPluginData() { global $live_plugins, $plugin_info, $live_plugins; $live_plugins = array(); $plugin_info = array(); // Check if data\other\plugins.xml exists if (!file_exists(GSDATAOTHERPATH . getDef('GSPLUGINSFILE'))) { create_pluginsxml(); registerInactivePlugins(get_filename_id() == 'plugins'); return true; } read_pluginsxml(); // get the live plugins into $live_plugins array if (!is_frontend()) { create_pluginsxml(get_filename_id() == 'plugins'); } // only on backend check that plugin files have not changed, and regen registerInactivePlugins(); if (getDef('GSPLUGINORDER', true)) { $reorderplugins = explode(',', getDef('GSPLUGINORDER')); debugLog("reorder plugins" . print_r($reorderplugins, true)); $reorderplugins = array_reverse($reorderplugins); foreach ($reorderplugins as $reorderplugin) { $live_plugins = array($reorderplugin => $live_plugins[$reorderplugin]) + $live_plugins; } } return true; }
public function testIsFrontend() { // arrange $env = 'frontend-local'; // act $result = is_frontend($env); // assert $this->assertEquals(true, $result); }
/** * Include any plugins, depending on where the referring * file that calls it we need to set the correct paths. * * @since 3.4.0 * @uses $live_plugins */ function loadPluginData() { if (file_exists(GSPLUGINPATH)) { $pluginfiles = getFiles(GSPLUGINPATH); } // Check if data\other\plugins.xml exists if (!file_exists(GSDATAOTHERPATH . "plugins.xml")) { create_pluginsxml(); registerInactivePlugins(get_filename_id() == 'plugins'); return true; } read_pluginsxml(); // get the live plugins into $live_plugins array if (!is_frontend()) { create_pluginsxml(get_filename_id() == 'plugins'); } // only on backend check that plugin files have not changed, and regen registerInactivePlugins(); return true; }
<input disabled='disabled' value='<?php echo htmlentities(str_replace('\'', '"', $alt_prepopulate)); ?> ' type='text' class='form-control altFormat' required /> <input value='<?php echo htmlentities(str_replace('\'', '"', $prepopulate)); ?> ' type='text' id='date' name='date' class='datepicker form-control' required style='position: absolute; top:0; left: 0; z-index: -1' /> </div> </div> </div> <div class='hr-line-dashed'></div> <?php // include jquery-ui library if not if (is_frontend()) { $already_included_at_frontend = Asset::checkAssetAdded('jquery-ui', 'js', 'frontend') || Asset::checkAssetAdded('jquery_ui', 'js', 'frontend'); if (!$already_included_at_frontend) { echo "\n" . '<script type="text/javascript" src="' . uri('modules/core/assets/jquery-ui-1.11.4.custom/jquery-ui.min.js') . '"></script>' . "\n"; echo "\n" . '<script type="text/javascript">loadCSS("' . uri('modules/core/assets/jquery-ui-1.11.4.custom/jquery-ui.min.css') . '")</script>' . "\n"; Asset::addDynamicAsset('jquery_ui', 'js', 'frontend', '<script type="text/javascript" src="' . uri('modules/core/assets/jquery-ui-1.11.4.custom/jquery-ui.min.js') . '"></script>'); } } else { if (is_backend()) { $already_included_at_backend = Asset::checkAssetAdded('jquery-ui', 'js', 'backend') || Asset::checkAssetAdded('jquery_ui', 'js', 'backend'); if (!$already_included_at_backend) { echo "\n" . '<script type="text/javascript" src="' . uri('modules/core/assets/jquery-ui-1.11.4.custom/jquery-ui.min.js') . '"></script>' . "\n"; echo "\n" . '<script type="text/javascript">loadCSS("' . uri('modules/core/assets/jquery-ui-1.11.4.custom/jquery-ui.min.css') . '")</script>' . "\n"; Asset::addDynamicAsset('jquery_ui', 'js', 'backend', '<script type="text/javascript" src="' . uri('modules/core/assets/jquery-ui-1.11.4.custom/jquery-ui.min.js') . '"></script>'); } }
/** * service is unavailable * performs a service unavailable if front end */ function serviceUnavailable() { if (is_frontend()) { header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); header('Retry-After: 7200'); // in seconds i18n('SERVICE_UNAVAILABLE'); die; } }
function nm_update_extend_cache() { if (!is_frontend() && get_filename_id() == 'plugins') { include GSADMININCPATH . 'configuration.php'; $url = $site_link_back_url . 'api/extend/?id=541'; $tempfile = GSCACHEPATH . md5($url) . '.txt'; $cachefile = GSCACHEPATH . md5($site_link_back_url . 'api/extend/?file=news_manager.php') . '.txt'; get_api_details('custom', $url); if (file_exists($cachefile)) { unlink($cachefile); } @copy($tempfile, $cachefile); } }
* Bad stuff protection */ include_once 'security_functions.php'; if (version_compare(PHP_VERSION, "5") >= 0) { foreach ($_GET as &$xss) { $xss = antixss($xss); } } /** * Basic file inclusions */ include 'basic.php'; include 'template_functions.php'; include 'logging.class.php'; define('GSROOTPATH', get_root_path()); if (!is_frontend()) { if (file_exists(GSROOTPATH . 'gsconfig.php')) { require_once GSROOTPATH . 'gsconfig.php'; } if (defined('GSADMIN')) { $GSADMIN = GSADMIN; } else { $GSADMIN = 'admin'; } } if (getDef('GSNOFRAME', true) !== false) { // Adds X-Frame-Options to HTTP header, so that page can only be shown in an iframe of the same site. header('X-Frame-Options: DENY'); // FF 3.6.9+ Chrome 4.1+ IE 8+ Safari 4+ Opera 10.5+ } /**
create_pluginsxml(); } read_pluginsxml(); // get the live plugins into $live_plugins array if (!is_frontend()) { create_pluginsxml(); } // check that plugins have not been removed or added to the directory // load each of the plugins foreach ($live_plugins as $file => $en) { $pluginsLoaded = true; # debugLog("plugin: $file" . " exists: " . file_exists(GSPLUGINPATH . $file) ." enabled: " . $en); if ($en == 'true' && file_exists(GSPLUGINPATH . $file)) { require_once GSPLUGINPATH . $file; } else { if (!is_frontend() and get_filename_id() == 'plugins') { $apiback = get_api_details('plugin', $file, getDef('GSNOPLUGINCHECK', true)); $response = json_decode($apiback); if ($response and $response->status == 'successful') { register_plugin(pathinfo_filename($file), $file, 'disabled', $response->owner, '', i18n_r('PLUGIN_DISABLED'), '', ''); } else { register_plugin(pathinfo_filename($file), $file, 'disabled', 'Unknown', '', i18n_r('PLUGIN_DISABLED'), '', ''); } } else { register_plugin(pathinfo_filename($file), $file, 'disabled', 'Unknown', '', i18n_r('PLUGIN_DISABLED'), '', ''); } } } /** * change_plugin *
} if (!defined('GSNOFRAME')) { define('GSNOFRAME', true); } if (!defined('GSNOFRAMEDEFAULT')) { define('GSNOFRAMEDEFAULT', 'SAMEORIGIN'); } // Add X-Frame-Options to HTTP header, so that page can only be shown in an iframe of the same site. if (getDef('GSNOFRAME') !== false) { if (getDef('GSNOFRAME') === GSBOTH) { header_xframeoptions(); } else { if ((getDef('GSNOFRAME') === true || getDef('GSNOFRAME') === GSBACK) && !is_frontend()) { header_xframeoptions(); } else { if (getDef('GSNOFRAME') === GSFRONT && is_frontend()) { header_xframeoptions(); } } } } /** * Define some constants */ define('GSADMINPATH', get_admin_path()); define('GSADMININCPATH', GSADMINPATH . 'inc/'); define('GSPLUGINPATH', GSROOTPATH . 'plugins/'); define('GSLANGPATH', GSADMINPATH . 'lang/'); define('GSDATAPATH', GSROOTPATH . 'data/'); define('GSDATAOTHERPATH', GSROOTPATH . 'data/other/'); define('GSDATAPAGESPATH', GSROOTPATH . 'data/pages/');