private function _logicThenDisplay() { if (isset($this->user->userInfo['isGuest']) === true && $this->user->userInfo['isGuest'] === true or $this->user->userInfo['id'] === 0) { $this->_showLogin(); exit; } $page = isset($_GET['page']) ? TextMan::cleanFileName($_GET['page']) : $this->kernel->getSetting('default_page'); $this->_templateClass->assign('userinfo', $this->user->userInfo); $this->_templateClass->assign('MSG_FILE', TEMPLATE_PATH . '/' . $this->_templateDir . '/msg.tpl'); $this->kernel->logtime('Before page include'); //ob_start(); $db = $this->db; $template = $this->_templateClass; $user = $this->user; include SOURCE_PATH . '/navigation.php'; include SOURCE_PATH . '/' . $page . '.php'; //ob_clean(); $this->kernel->logtime('After page include'); if (!file_exists(SOURCE_PATH . '/' . $page . '.php')) { echo '<span style="font-size: 40px; font-weight: bold;">This means the file isn\'t there and I haven\'t even begun to work on it yet.</span> '; } $this->_templateClass->assign('NAVIGATION', $this->_templateClass->fetch(TEMPLATE_PATH . '/' . $this->_templateDir . '/navigation.tpl')); $this->_templateClass->assign('CSS', $this->_templateCss); $this->_templateClass->assign('PAGE_CONTENT', $this->_templateClass->fetch(TEMPLATE_PATH . '/' . $this->_templateDir . '/' . $page . '.tpl')); $this->_templateClass->assign('PAGE_LOAD', round(microtime(true) - START_TIMER, 5)); $this->_templateClass->display(TEMPLATE_PATH . '/' . $this->_templateDir . '/skeleton.tpl'); }
public function getSetting($settingName) { $settingName = TextMan::cleanSqlField($settingName); if (array_key_exists($settingName, $this->_settings) === true) { return $this->_settings[$settingName]; } $query = $this->_loadedClasses['dbEngine']->runSelect('settings', 'value', '`name` = \'' . $settingName . '\''); if ($this->_loadedClasses['dbEngine']->runCountRows() !== 1) { $this->_settings[$settingName] = ''; return ''; } $fetch = $this->_loadedClasses['dbEngine']->runSingleFetch(); $this->_settings[$settingName] = $fetch['value']; return $fetch['value']; }
public function loadClass($className, $classPath, $classFile = null, $loadAs = null) { // Clean variables are good variables, make sure to give your variables a wash at least once every time uncertain content is fed to it. $className = TextMan::cleanAlNum($className); $classPath = TextMan::cleanFilePath($classPath); $classFile = $classFile === null ? $className . '.php' : TextMan::cleanFilePath($classFile) . '.php'; // Does the file exist? If not, return false if (file_exists(KERNEL_PATH . '/' . $classPath . '/' . $classFile) === false) { return false; } // Grab the file! include KERNEL_PATH . '/' . $classPath . '/' . $classFile; // Does the class exist? If not, return false if (class_exists($className) === false) { return false; } $loadAs = $loadAs === null ? $className : $loadAs; // Load the class and run it then get out of here $this->_loadedClasses[$loadAs] = new $className($this); return true; }
public function runUpdate($table, $fields, $where) { $fieldsarr = ''; $table = TextMan::cleanSqlField($table); if (is_array($fields) === true) { foreach ($fields as $key => $value) { $fieldsarr .= '`' . TextMan::cleanSqlField($key) . '` = \'' . $value . '\', '; } $fieldsarr = substr($fieldsarr, 0, strlen($fieldsarr) - 2); } else { $fieldsarr = TextMan::cleanSqlField($fields); } $query = 'UPDATE `' . $table . '` SET ' . $fieldsarr . ($where === null ? '' : ' WHERE ' . $where); $this->_currentQuery = $query; //echo $query . '<br /><br />'; $this->queryResult = mysql_query($query); // or exit(mysql_error() . '<br />' . $query); return true; }
private function _buildUserInfo() { $userid = TextMan::cleanAlNum(get_cookie_sane('userid')); $password = TextMan::cleanAlNum(get_cookie_sane('password')); if (empty($userid) === true or ctype_digit($userid) === false or empty($password) === true) { exit('Illegal function removal, this code should never be reached ever in the history of ever. Ever. <!-- ' . __LINE__ . ', ' . __FILE__ . ' -->'); } // Right o, no bad function removal, everything is clean, time to move on! $this->db->runSelect('users', '*', '`id` = \'' . $userid . '\' AND `password` = \'' . $password . '\''); $this->userInfo = $this->db->runSingleFetch(); unset($this->userInfo['hash']); //print_r($this->userInfo); }
static function cleanFileName($incoming) { return TextMan::cleanFilePath($incoming); }