public function __construct() { $this->db = loadModel('session_model'); $this->lifetime = loadConfig('config', 'session_ttl'); session_set_save_handler(array(&$this, 'open'), array(&$this, 'close'), array(&$this, 'read'), array(&$this, 'write'), array(&$this, 'destroy'), array(&$this, 'gc')); session_start(); }
public function __construct() { $this->db_config = loadConfig('dbconfig'); $this->db_setting = 'default'; $this->table_name = 'session'; parent::__construct(); }
function prepare_items() { $iterator = new DirectoryIterator($this->skinsDir); $skins = array(); foreach ($iterator as $item) { if (!$item->isDot() and $item->isDir()) { $skin = $item->getBasename(); $neon = $item->getPathname() . "/{$skin}.neon"; if (file_exists($neon)) { $config = loadConfig($neon); $skins[$skin]['name'] = $config['name']; $skins[$skin]['url'] = "{$this->skinsUrl}/{$skin}"; $skins[$skin]['author'] = $config['author']; $skins[$skin]['desc'] = $config['desc']; $skins[$skin]['theme'] = isset($config['theme']) ? $config['theme'] : ''; if (file_exists("{$this->skinsDir}/{$skin}/{$skin}-screenshot.png")) { $skins[$skin]['screenshot'] = "{$this->skinsUrl}/{$skin}/{$skin}-screenshot.png"; } else { $skins[$skin]['screenshot'] = ''; } } } } uksort($skins, "strnatcasecmp"); $per_page = 15; $page = $this->get_pagenum(); $start = ($page - 1) * $per_page; $this->items = array_slice($skins, $start, $per_page); $this->set_pagination_args(array('total_items' => count($skins), 'per_page' => $per_page)); }
/** * @desc constructor for mysql class * @param string $sEnvType */ private function __construct($sEnvType = 'release') { if ($sEnvType == 'test') { $this->_dbconfig = loadConfig('DBTest'); } elseif ($sEnvType == 'release') { $this->_dbconfig = loadConfig('DB'); } else { if (isTestEnv()) { $this->_dbconfig = loadConfig('DBTest'); } else { $this->_dbconfig = loadConfig('DB'); } } $sHost = $this->_dbconfig['host']; $sPort = $this->_dbconfig['port']; $sUser = $this->_dbconfig['user']; $sPassword = $this->_dbconfig['password']; $this->_link = mysql_connect("{$sHost}:{$sPort}", $sUser, $sPassword); if (!$this->_link) { recordSysLog('Unable to connect to Mysql'); } $sDatabase = $this->_dbconfig['database']; $this->setDatabase($sDatabase); $sCharset = $this->_dbconfig['charset']; $this->setCharset($sCharset); }
function createSitemap($type, $showMessage = 1) { $sitemapConfig = loadConfig('sitemap'); $articleCount = $sitemapConfig['articleCount'] ? $sitemapConfig['articleCount'] : 500; $ucarCount = $sitemapConfig['ucarCount'] ? $sitemapConfig['ucarCount'] : 500; $datas = array(); switch ($type) { default: case 'news': $article_db = bpBase::loadModel('article_model'); $articles = $article_db->select(array('ex' => 0), 'link,time,title,keywords', '0,' . $articleCount, 'time DESC'); if ($articles) { foreach ($articles as $a) { if (!strExists($a['link'], 'http://')) { $a['link'] = MAIN_URL_ROOT . $a['link']; } if ($a['keywords'] == ',') { $a['keywords'] = ''; } array_push($datas, array('url' => $a['link'], 'time' => $a['time'], 'keywords' => $a['keywords'])); } } break; } $this->_createSitemap($type, $datas, $showMessage); }
function config(string $key, $default = null) { static $config; if (!$config) { $config = loadConfig(); } return $config[$key] ?? $default; }
function __construct() { $this->watermarkConfig = loadConfig('watermark'); $this->watermarkConfig['leftTopWaterMarkText'] = $this->watermarkConfig['leftTopWaterMarkText'] ? $this->watermarkConfig['leftTopWaterMarkText'] : $this->watermarkConfig['waterMarkText']; $this->watermarkConfig['leftDistance'] = isset($this->watermarkConfig['leftDistance']) ? intval($this->watermarkConfig['leftDistance']) : 9; $this->watermarkConfig['topDistance'] = isset($this->watermarkConfig['topDistance']) ? intval($this->watermarkConfig['topDistance']) : 16; $this->watermarkConfig['rightDistance'] = isset($this->watermarkConfig['rightDistance']) ? intval($this->watermarkConfig['rightDistance']) : 5; $this->watermarkConfig['bottomDistance'] = isset($this->watermarkConfig['bottomDistance']) ? intval($this->watermarkConfig['bottomDistance']) : 10; }
protected function dbInit() { $config = loadConfig('confDb', 'config'); $this->_dbname = $config['dbname']; $this->_host = $config['host']; $this->_user = $config['user']; $this->_password = $config['password']; $dsn = 'mysql:dbname=' . $this->_dbname . ';host=' . $this->_host . ''; $this->db = new Database($dsn, $this->_user, $this->_password); }
public function __construct() { parent::__construct(); /***********uid*******************/ $uid = isset($_GET['uid']) && intval($_GET['uid']) > 0 ? intval($_GET['uid']) : 0; //设置uid为request的数值 $uid = $uid > 0 ? $uid : $this->uid; $this->assign('uid', $uid); if (!$uid) { header('Location:/'); exit; } $thisUser = $this->user; $this->assign('user', $thisUser); /**********************************************************/ if ($this->uid == $uid) { $sub = '我'; $my = 1; } else { $sub = '他(她)'; $my = 0; } $this->uid = $uid; $this->assign('sub', $sub); $this->assign('my', $my); /*********************判断是不是各种经销商***************************/ $storeUserIndependent = 0; //经销商用户是否单独建表存储 if (intval(loadConfig('store', 'storeUserIndependent'))) { $storeUserIndependent = 1; //经销商用户是否单独建表存储 } if ($uid == $this->uid) { $this->assign('canManage', 1); } if ($uid == $this->uid && !$storeUserIndependent) { $store_db = bpBase::loadModel('store_model'); $is4sStore = 0; if ($store_db->select(array('storetype' => 1, 'uid' => $this->uid))) { $is4sStore = 1; } $this->assign('is4sStore', $is4sStore); //carRental $isRentalStore = 0; if ($store_db->select(array('storetype' => 3, 'uid' => $this->uid))) { $isRentalStore = 1; } $this->assign('isRentalStore', $isRentalStore); //ucar $ucar_store_db = bpBase::loadModel('usedcar_store_model'); $thisUcarStore = $ucar_store_db->select(array('uid' => $this->uid)); $this->assign('isUcarStore', $thisUcarStore ? 1 : 0); } }
public function init() { // Initialize logger and translate actions $this->_logger = Zend_Registry::get("logger"); $this->_translate = Zend_Registry::get("translate"); // set the redirector to ignore the baseurl for redirections $this->_helper->redirector->setPrependBase(false); $this->_eventdispatcher = initializeSFEventDispatcher(); // load the application configuration loadConfig(); $this->view->referer = $this->getRequest()->getHeader('referer'); $this->view->viewurl = $_SERVER['REQUEST_URI']; // debugMessage($this->view->viewurl); // debugMessage($this->getRequest()); $isvalid = false; $host = giveHost($this->view->serverUrl()); // debugMessage($host); $this->view->domain = str_replace('http://', '', strtolower($host)); $subdomain = getSubdomain($this->view->serverUrl()); $this->view->subdomain = strtolower($subdomain); if ($subdomain == "www") { $this->_helper->redirector->gotoUrl('http://' . $host); exit; } // debugMessage('subdomain '.$subdomain); if (!isEmptyString($subdomain) && strtolower($host) == "hrmagic.ug") { $session = SessionWrapper::getInstance(); $session->setVar('companyid', ''); $company = new Company(); if ($company->isRenderable($subdomain)) { $isvalid = true; // debugMessage('valid'); } else { // debugMessage('invalid'); } if ($isvalid) { // if valid subdomain, set id to session $companyid = $company->findByUsername($subdomain); $session->setVar('cid', $companyid); } else { // subdomain not found. redirect to 404 page. $domain = str_replace($subdomain . '.', '', $this->view->serverUrl()); // debugMessage('d is '.$domain); $this->_helper->redirector->gotoUrl(stripUrl($domain) . '/index/error'); } } $url = array('http://www.domain.com', 'http://domain.com', 'https://domain.com', 'www.domain.com', 'domain.com', 'www.domain.com/some/path', 'http://sub.domain.com/domain.com', 'http://sub-domain.domain.net/domain.net', 'sub-domain.third-Level_DomaIN.domain.uk.co/domain.net'); /* foreach ($url as $u) { debugMessage(getSubdomain($u)); } */ // exit(); # set default timezone based on company in session # date_default_timezone_set(getTimeZine()); }
function verifyUserPass($username, $password, $redirect) { $config = getConfig(); if (checkUsername($username, $config->username) && checkPassword($password, $config->password)) { if (loadConfig($config)) { $_SESSION["loggedIn"] = true; } header("Location: " . $redirect); } else { return false; } }
public static function getInstance($config = '') { if (!isset(self::$_instance)) { self::$_instance = new self(); } if ($config == '') { $config = loadConfig('dbconfig'); } if ($config != '' && $config != self::$_instance->_config) { self::$_instance->_config = array_merge($config, self::$_instance->_config); } return self::$_instance; }
function _errorLog($errno, $errstr, $errfile, $errline) { if ($errno == 8) { return ''; } $errfile = str_replace(ROOT_PATH, '', $errfile); if (loadConfig('config', 'errorlog')) { error_log('<?php exit;?>' . date('Y-m-d H:i:s', SYS_TIME) . ' | ' . $errno . ' | ' . str_pad($errstr, 30) . ' | ' . $errfile . ' | ' . $errline . "\r\n", 3, CACHE_PATH . 'errorlog.php'); } else { $str = '<div style="border:1px solid #ccc;color:#666">errorno:' . $errno . ',str:' . $errstr . ',file:<span style="color:#f00">' . $errfile . '</span>,line:' . $errline . '</div>'; echo $str; } }
function main() { $pp = new Prefork(array('max_workers' => 5, 'trap_signals' => array(SIGHUP => SIGTERM, SIGTERM => SIGTERM))); while ($pp->signalReceived() !== SIGTERM) { loadConfig(); if ($pp->start()) { continue; } workChildren(); $pp->finish(); } $pp->waitAllChildren(); }
public function __construct() { if (!get_magic_quotes_gpc()) { $_GET = new_addslashes($_GET); $_POST = new_addslashes($_POST); $_REQUEST = new_addslashes($_REQUEST); $_COOKIE = new_addslashes($_COOKIE); } $this->route = loadConfig('route', 'default'); if (isset($_GET['page'])) { $_GET['page'] = max(intval($_GET['page']), 1); $_GET['page'] = min($_GET['page'], 1000000); } }
function resolveImports($doc, $prefix, $i, $configFolder) { $xpath = new DOMXPath($doc); $xquery = "//import"; $nodelist = $xpath->query($xquery); if ($nodelist->length == 0) { return; } /** * Import all linked documents */ echo str_repeat(" ", $i * 2); echo "<import>\n"; foreach ($nodelist as $node) { $toImport = $filename = $node->nodeValue; $parent = $node->parentNode; if (strpos($toImport, "/") !== 0) { $toImport = $configFolder . $toImport; } // Prefixed file $prefixedFile = str_replace($filename, $prefix . "." . $filename, $toImport); // If prefixed file exists, use it if (file_exists($prefixedFile)) { $toImport = $prefixedFile; } elseif ($prefix == 'test' and !file_exists($toImport)) { $toImport = str_replace($filename, 'prod.' . $filename, $toImport); } echo str_repeat(" ", $i * 2 + 2) . $toImport . "\n"; // Read in import file $import = loadConfig($toImport); resolveImports($import, $prefix, $i + 1, $configFolder); // Add provides-prefix if import-tag provides-prefix attribute is set $providesPrefix = $node->getAttribute('prefix-provides'); if ($providesPrefix) { $modules = $import->documentElement->getElementsByTagName('module'); foreach ($modules as $m) { $provides = $m->getAttribute('provides'); if ($provides) { $m->setAttribute('provides', $providesPrefix . ucfirst($provides)); } } } foreach ($import->documentElement->childNodes as $child) { $import = $doc->importNode($child, true); $parent->insertBefore($import, $node); } $node->parentNode->removeChild($node); } }
/** * 构造函数 */ public function __construct() { $route = bpBase::loadSysClass('route'); if (!defined('ROUTE_MODEL')) { define('ROUTE_MODEL', $route->routeModel()); define('ROUTE_CONTROL', $route->routeControl()); define('ROUTE_ACTION', $route->routeAction()); } $this->init(); //执行计划任务 if (loadConfig('system', 'cron')) { //$classRunObj=bpBase::loadAppClass('cronRun','cron',1); //$classRunObj->init(); } }
/** * 构造函数 * */ public function __construct($dbObj = null) { if (!$dbObj) { $this->db = bpBase::loadModel('session_model'); } else { //autoDB; $this->db = $dbObj; $this->oldSys = 1; $this->table = TABLE_PREFIX . 'session'; } $this->lifetime = loadConfig('site', 'session_ttl'); $this->lifetime = $this->lifetime == '' ? 3600 : $this->lifetime; session_set_save_handler(array(&$this, 'open'), array(&$this, 'close'), array(&$this, 'read'), array(&$this, 'write'), array(&$this, 'destroy'), array(&$this, 'gc')); session_start(); }
function MCache_connect($name) { // use link for adding connection into global $Config $settings =& loadConfig('memcache')['memcache'][$name]; // get connect if it already exists if (!is_null($settings['connect'])) { return $settings['connect']; } $mcConnect = memcache_pconnect($settings['hostname'], $settings['port']); if (!$mcConnect) { exit("Memcache connect error."); } // remember connection $settings['connect'] = $mcConnect; return $mcConnect; }
/** * Create database connect. * Settings gets from config/db.php, from array with key = $name * Function creates connect only first time and remembers it. * In next time function returns connection which already created. */ function Database_connect($name) { // use link for adding connection into global $Config $settings =& loadConfig('db')['db'][$name]; // get connect if it already exists if (!is_null($settings['connect'])) { return $settings['connect']; } $dbConnect = mysqli_connect($settings['hostname'], $settings['username'], $settings['password'], $settings['database']); if (!$dbConnect) { exit("Database connect error: " . mysqli_connect_error()); } Database_setCharset($dbConnect, $settings['encoding']); // remember connection $settings['connect'] = $dbConnect; return $dbConnect; }
public function system() { $this->exitWithoutAccess('system', 'manage'); if (isset($_POST['doSubmit'])) { // $_POST['info']['emailSsl'] = 'ssl'; $_POST['info']['statisticCode'] = base64_encode(stripslashes($_POST['info']['statisticCode'])); $systemConfig = loadConfig('system'); $_POST['info']['mobileStatisticCode'] = $systemConfig['mobileStatisticCode']; $arr = var_export($_POST['info'], 1); $str = "<?php\r\n" . "return " . $arr . ";" . "\r\n?>"; //save as /constant/config.inc.php delCache('site1'); file_put_contents(ABS_PATH . 'config' . DIRECTORY_SEPARATOR . 'system.config.php', $str); showMessage('设置成功', '?m=' . ROUTE_MODEL . '&c=' . ROUTE_CONTROL . '&a=' . ROUTE_ACTION); } else { include $this->showManageTpl('system'); } }
function citySiteLink() { $geoObj = bpBase::loadAppClass('geoObj', 'geo', 1); if (isset($_COOKIE['cookie_cityid'])) { //按照cookie保存的来 $geo_db = bpBase::loadModel('geo_model'); $ipGeo = $geo_db->getGeoByID(intval($_COOKIE['cookie_cityid'])); } else { $ipGeo = $geoObj->getGeoByIP(ip()); if (!$ipGeo) { $geo_db = bpBase::loadModel('geo_model'); $defaultChildLocation = $geo_db->getDefaultChildLocation(); $ipGeo = $defaultChildLocation; } } $childSiteConfig = loadConfig('childSite'); $cityUrlFormat = $childSiteConfig['childSiteUrlFormat'] ? $childSiteConfig['childSiteUrlFormat'] : MAIN_URL_ROOT . '/city/index.php?index={geoIndex}'; $link = str_replace('{geoIndex}', $ipGeo->geoindex, $cityUrlFormat); echo '<a href="' . $link . '" target="_blank" class="currentCitySiteLink">' . $ipGeo->name . '</a>'; }
/** * 写入缓存 * @param string $name 缓存名称 * @param mixed $data 缓存数据 * @param array $setting 缓存配置 * @param string $type 缓存类型 * @param string $module 所属模型 * @return mixed 缓存路径/false */ public function set($name, $data, $setting = '', $type = 'data', $module = ROUTE_MODEL) { $this->get_setting($setting); if (empty($type)) { $type = 'data'; } if (empty($module)) { $module = ROUTE_MODEL; } $filepath = CACHE_PATH . 'caches_' . $module . '/caches_' . $type . '/'; $filename = $name . $this->_setting['suf']; if (!is_dir($filepath)) { mkdir($filepath, 0777, true); } if ($this->_setting['type'] == 'array') { $data = "<?php\nreturn " . var_export($data, true) . ";\n?>"; } elseif ($this->_setting['type'] == 'serialize') { $data = serialize($data); } if ($module == 'commons' || $module == 'commons' && substr($name, 0, 16) != 'category_content') { $db = bpBase::loadModel('cache_file_model'); $datas = new_addslashes($data); if ($db->get_one(array('filename' => $filename, 'path' => 'caches_' . $module . '/caches_' . $type . '/'), '`filename`')) { $db->update(array('data' => $datas), array('filename' => $filename, 'path' => 'caches_' . $module . '/caches_' . $type . '/')); } else { $db->insert(array('filename' => $filename, 'path' => 'caches_' . $module . '/caches_' . $type . '/', 'data' => $datas)); } } //是否开启互斥锁 if (loadConfig('system', 'lock_ex')) { $file_size = file_put_contents($filepath . $filename, $data, bpBase::loadConfig('system', 'lock_ex')); } else { $file_size = file_put_contents($filepath . $filename, $data); } return $file_size ? $file_size : 'false'; }
<?php include $this->showManageTpl('header', 'manage'); $config = loadConfig('sitemap'); $articleCount = $config['articleCount'] ? $config['articleCount'] : 500; $ucarCount = $config['ucarCount'] ? $config['ucarCount'] : 500; ?> <script type="text/javascript" src="js/formCheck/lang/cn.js"> </script> <script type="text/javascript" src="js/formCheck/formcheck.js"> </script> <link rel="stylesheet" href="js/formCheck/theme/grey/formcheck.css" type="text/css" media="screen" /> <script type="text/javascript"> window.addEvent('domready', function(){ new FormCheck('myform'); }); </script> <div class="columntitle">sitemap配置信息</div> <form method="post" action="?m=ucar&c=m_ucar&a=config" id="myform"> <table class="addTable"> <tr style="line-height:38px"><td class="STYLE2" style="text-align: right;">前多少条新闻 </td><td><input type="text" value="<?php echo $articleCount; ?> " class="validate['required','digit'] colorblur" onfocus="this.className=\'colorfocus\'" onblur="this.className=\'colorblur\'" name="info[articleCount]" tyle="width:260px;height:20px;font-size:14px;" /> <span class="tdtip">sitemap中包含最新的多少条新闻</span></td></tr> <tr style="line-height:38px"><td class="STYLE2" style="text-align: right;">前多少条二手车 </td><td><input type="text" value="<?php echo $ucarCount; ?> " class="validate['required','digit'] colorblur" onfocus="this.className=\'colorfocus\'" onblur="this.className=\'colorblur\'" name="info[ucarCount]" style="width:260px;height:20px;font-size:14px;" /> <span class="tdtip">sitemap中包含最新的多少条二手车</span></td></tr> <tr> <td class="addName"></td> <td><input type="submit" name="doSubmit" value="提交" class="button"/></td> </tr>
function getConfig() { global $CONFIG; loadConfig(); $skeys = array("gl_db_host", "gl_db_user", "gl_db_pass", "gl_db_name"); $xml = "<gl_c h=\"" . base64_encode(substr(md5file(FILE_CONFIG), 0, 5)) . "\">\r\n"; foreach ($CONFIG as $key => $val) { if (is_array($val)) { $xml .= "<conf key=\"" . base64_encode($key) . "\">\r\n"; foreach ($val as $skey => $sval) { $xml .= "<sub key=\"" . base64_encode($skey) . "\">" . base64_encode($sval) . "</sub>\r\n"; } $xml .= "</conf>\r\n"; } else { if (!in_array($key, $skeys) || SERVERSETUP) { $xml .= "<conf value=\"" . base64_encode($val) . "\" key=\"" . base64_encode($key) . "\" />\r\n"; } else { $xml .= "<conf value=\"" . base64_encode("") . "\" key=\"" . base64_encode($key) . "\" />\r\n"; } } } if (SERVERSETUP) { $xml .= "<translations>\r\n"; $files = getDirectory("./_language", "index", true); foreach ($files as $translation) { $lang = str_replace(".php", "", str_replace("lang", "", $translation)); $xml .= "<language key=\"" . base64_encode($lang) . "\" />\r\n"; } $xml .= "</translations>\r\n"; if (@file_exists(FILE_CARRIERLOGO)) { $xml .= "<carrier_logo content=\"" . fileToBase64(FILE_CARRIERLOGO) . "\" />\r\n"; } if (@file_exists(FILE_CARRIERHEADER)) { $xml .= "<carrier_header content=\"" . fileToBase64(FILE_CARRIERHEADER) . "\" />\r\n"; } if (@file_exists(FILE_INVITATIONLOGO)) { $xml .= "<invitation_logo content=\"" . fileToBase64(FILE_INVITATIONLOGO) . "\" />\r\n"; } } $xml .= "<php_cfg_vars post_max_size=\"" . base64_encode(cfgFileSizeToBytes(!isnull(@get_cfg_var("post_max_size")) ? get_cfg_var("post_max_size") : MAX_POST_SIZE_SAFE_MODE)) . "\" upload_max_filesize=\"" . base64_encode(cfgFileSizeToBytes(!isnull(@get_cfg_var("upload_max_filesize")) ? get_cfg_var("upload_max_filesize") : MAX_UPLOAD_SIZE_SAFE_MODE)) . "\" />\r\n"; $xml .= "</gl_c>\r\n"; return $xml; }
/** * RabidCore Bootstrapper * * Contains a few utility functions (which will probably be moved before final * release), and is in charge of loading the configuration and sending each * request to the Router. * * To make RabidCore work, simply route all requests to this file and keep all * source files within the same directory as this file or within child * directories of this file. * * Copyright 2008 Michelle Steigerwalt <msteigerwalt.com>. * Part of RabidCore. * For licensing and information, visit <http://rabidcore.com>. */ loadConfig(); /** * The request router looks at the URI path, tries to load it from /assets, * then tries to route the request through the Router if it's a model. * If it's not a model, the PageEngine tries to render the template file. */ function routeRequest() { $path = getPath(); if (!$path) { return PageEngine::renderPage('index'); } if (File::find("assets/{$path}")) { File::render("assets/{$path}"); } try {
function setupBoard($array) { global $board, $config; $board = array('uri' => $array['uri'], 'title' => $array['title'], 'subtitle' => isset($array['subtitle']) ? $array['subtitle'] : "", 'indexed' => isset($array['indexed']) ? $array['indexed'] : true, 'public_logs' => isset($array['public_logs']) ? $array['public_logs'] : true); // older versions $board['name'] =& $board['title']; $board['dir'] = sprintf($config['board_path'], $board['uri']); $board['url'] = sprintf($config['board_abbreviation'], $board['uri']); loadConfig(); if (!file_exists($board['dir'])) { @mkdir($board['dir'], 0777) or error("Couldn't create " . $board['dir'] . ". Check permissions.", true); } if (!file_exists($config['dir']['img_root'] . $board['dir'] . $config['dir']['img'])) { @mkdir($config['dir']['img_root'] . $board['dir'] . $config['dir']['img'], 0777) or error("Couldn't create " . $config['dir']['img_root'] . $board['dir'] . $config['dir']['img'] . ". Check permissions.", true); } if (!file_exists($config['dir']['img_root'] . $board['dir'] . $config['dir']['thumb'])) { @mkdir($config['dir']['img_root'] . $board['dir'] . $config['dir']['thumb'], 0777) or error("Couldn't create " . $config['dir']['img_root'] . $board['dir'] . $config['dir']['img'] . ". Check permissions.", true); } if (!file_exists($board['dir'] . $config['dir']['res'])) { @mkdir($board['dir'] . $config['dir']['res'], 0777) or error("Couldn't create " . $board['dir'] . $config['dir']['img'] . ". Check permissions.", true); } }
<?php /** * Created by PhpStorm. * User: singingleaf * Date: 1/16/16 * Time: 10:16 PM */ // Initiate $cfg = array('DB_HOST', 'DB_USER', 'DB_PASS', 'DB_NAME'); loadConfig($cfg); if ($_SERVER['REQUEST_METHOD'] === 'POST') { echo "post: "; //Ok we got a POST, read from $_POST. $v = $_POST['content']; $threshold = $_POST['threshold']; if (!is_numeric($threshold)) { $threshold = 600.0; // default } if (is_numeric($v)) { if ((double) $v > $threshold) { insertToDB("Hello"); } elseif ((double) $v <= $threshold) { insertToDB("World"); } } } // Very simple loader function loadConfig($vars = array()) {
case "tools": break; case "logging": case "network": case "mail": case "upload": $restartWarning = true; break; case "highband": case "medband": case "lowband": case "phoneband": break; } } loadConfig(false); } elseif ($action == "user") { if (!empty($_REQUEST['uid'])) { $dbUser = dbFetchOne("SELECT * FROM Users WHERE Id=?", NULL, array($_REQUEST['uid'])); } else { $dbUser = array(); } $types = array(); $changes = getFormChanges($dbUser, $_REQUEST['newUser'], $types); if ($_REQUEST['newUser']['Password']) { $changes['Password'] = "******" . dbEscape($_REQUEST['newUser']['Password']) . ")"; } else { unset($changes['Password']); } if (count($changes)) { if (!empty($_REQUEST['uid'])) {
public function assignConstant() { $systemConfig = loadConfig('system'); $smarty = front::$smarty; }