public static function Autoload($strClassName) { if (!parent::Autoload($strClassName)) { if (file_exists($strFilePath = sprintf('%s/narro/%s.class.php', __NARRO_INCLUDES__, $strClassName))) { require_once $strFilePath; } elseif (file_exists($strFilePath = sprintf('%s/database/%s.class.php', __QCUBED_CORE__, $strClassName))) { require_once $strFilePath; } elseif (file_exists($strFilePath = sprintf('%s/narro/importer/%s.class.php', __NARRO_INCLUDES__, $strClassName))) { require_once $strFilePath; } elseif (file_exists($strFilePath = sprintf('%s/narro/panel/%s.class.php', __NARRO_INCLUDES__, $strClassName))) { require_once $strFilePath; } elseif (file_exists($strFilePath = sprintf('%s/narro/sources/%s.class.php', __NARRO_INCLUDES__, $strClassName))) { require_once $strFilePath; } elseif (file_exists($strFilePath = sprintf('%s/narro/search/%s.class.php', __NARRO_INCLUDES__, $strClassName))) { require_once $strFilePath; } elseif (file_exists($strFilePath = sprintf('%s/model/%s.class.php', __NARRO_INCLUDES__, $strClassName))) { require_once $strFilePath; } elseif (file_exists($strFilePath = sprintf('%s/qcubed_custom_controls/%s.class.php', __NARRO_INCLUDES__, $strClassName))) { require_once $strFilePath; } elseif (file_exists($strFilePath = sprintf('%s/%s.php', __NARRO_INCLUDES__, str_replace('_', '/', $strClassName)))) { require_once $strFilePath; } elseif (file_exists($strFilePath = sprintf('%s/%s/includes/QFirebug/includes/%s.class.php', __DOCROOT__, __SUBDIRECTORY__, $strClassName))) { require_once $strFilePath; } else { throw new Exception(sprintf('Cannot find the file that contains the class "%s"', $strClassName)); } } }
/** * This is called by the PHP5 Autoloader. This method overrides the * one in ApplicationBase. * * @return void */ public static function Autoload($strClassName) { // First use the Qcodo Autoloader if (!parent::Autoload($strClassName)) { // TODO: Run any custom autoloading functionality (if any) here... } }
/** * This is called by the PHP5 Autoloader. This method overrides the * one in ApplicationBase. * * @return void */ public static function Autoload($strClassName) { // First use the Qcodo Autoloader if (!parent::Autoload($strClassName)) { // NOTE: Run any custom autoloading functionality (if any) here... if (file_exists($strFilePath = sprintf('%s/%s.class.php', __DATA_CLASSES__, $strClassName))) { require $strFilePath; return true; } } return false; }
/** * This is called by the PHP5 Autoloader. This method overrides the * one in ApplicationBase. * * @return void */ public static function Autoload($strClassName) { // First use the Qcodo Autoloader if (!parent::Autoload($strClassName)) { // NOTE: Run any custom autoloading functionality (if any) here... if (file_exists($strFilePath = sprintf('%s/%s.class.php', __DATA_CLASSES__, $strClassName))) { require $strFilePath; return true; } else { if (substr($strClassName, 0, 4) == 'Zend') { if (file_exists($strFilePath = sprintf('%s/%s.php', __INCLUDES__, str_replace('\\', '/', $strClassName)))) { require $strFilePath; return true; } } } } return false; }
/** * Same as mkdir but correctly implements directory recursion. * At its core, it will use the php MKDIR function. * * This method does no special error handling. If you want to use special error handlers, * be sure to set that up BEFORE calling MakeDirectory. * * @param string $strPath actual path of the directoy you want created * @param integer $intMode optional mode * @return boolean the return flag from mkdir */ public static function MakeDirectory($strPath, $intMode = null) { if (is_dir($strPath)) { // Directory Already Exists return true; } // Check to make sure the parent(s) exist, or create if not if (!QApplicationBase::MakeDirectory(dirname($strPath), $intMode)) { return false; } // Create the current node/directory, and return its result $blnReturn = mkdir($strPath); if ($blnReturn && !is_null($intMode)) { // Manually CHMOD to $intMode (if applicable) // mkdir doesn't do it for mac, and this will error on windows // Therefore, ignore any errors that creep up QApplication::SetErrorHandler(null); chmod($strPath, $intMode); QApplication::RestoreErrorHandler(); } return $blnReturn; }
/** * Initializes the QForm rendering process * @param bool $blnDisplayOutput Whether the output is to be printed (true) or simply returned (false) * * @return null|string * @throws QCallerException */ public function RenderBegin($blnDisplayOutput = true) { // Ensure that RenderBegin() has not yet been called switch ($this->intFormStatus) { case QFormBase::FormStatusUnrendered: break; case QFormBase::FormStatusRenderBegun: case QFormBase::FormStatusRenderEnded: throw new QCallerException('$this->RenderBegin() has already been called'); break; default: throw new QCallerException('FormStatus is in an unknown status'); } // Update FormStatus and Clear Included JS/CSS list $this->intFormStatus = QFormBase::FormStatusRenderBegun; // Prepare for rendering QApplicationBase::$ProcessOutput = false; $strOutputtedText = trim(ob_get_contents()); if (strpos(strtolower($strOutputtedText), '<body') === false) { $strToReturn = '<body>'; $this->blnRenderedBodyTag = true; } else { $strToReturn = ''; } QApplicationBase::$ProcessOutput = true; // Iterate through the form's ControlArray to Define FormAttributes and additional JavaScriptIncludes $this->strFormAttributeArray = array(); foreach ($this->GetAllControls() as $objControl) { // Form Attributes? if ($objControl->FormAttributes) { $this->strFormAttributeArray = array_merge($this->strFormAttributeArray, $objControl->FormAttributes); } } if (is_array($this->strCustomAttributeArray)) { $this->strFormAttributeArray = array_merge($this->strFormAttributeArray, $this->strCustomAttributeArray); } // Create $strFormAttributes $strFormAttributes = ''; foreach ($this->strFormAttributeArray as $strKey => $strValue) { $strFormAttributes .= sprintf(' %s="%s"', $strKey, $strValue); } if ($this->strCssClass) { $strFormAttributes .= ' class="' . $this->strCssClass . '"'; } // Setup Rendered HTML $strToReturn .= sprintf('<form method="post" id="%s" action="%s"%s>', $this->strFormId, htmlentities(QApplication::$RequestUri), $strFormAttributes); $strToReturn .= "\r\n"; if (!self::$blnStylesRendered) { $strToReturn .= $this->RenderStyles(false, false); } // Perhaps a strFormModifiers as an array to // allow controls to update other parts of the form, like enctype, onsubmit, etc. // Return or Display if ($blnDisplayOutput) { if (!QApplication::$CliMode) { print $strToReturn; } return null; } else { if (!QApplication::$CliMode) { return $strToReturn; } else { return ''; } } }
/** * Initializes the QForm rendering process * @param bool $blnDisplayOutput Whether the output is to be printed (true) or simply returned (false) * * @return null|string * @throws QCallerException */ public function RenderBegin($blnDisplayOutput = true) { // Ensure that RenderBegin() has not yet been called switch ($this->intFormStatus) { case QFormBase::FormStatusUnrendered: break; case QFormBase::FormStatusRenderBegun: case QFormBase::FormStatusRenderEnded: throw new QCallerException('$this->RenderBegin() has already been called'); break; default: throw new QCallerException('FormStatus is in an unknown status'); } // Update FormStatus and Clear Included JS/CSS list $this->intFormStatus = QFormBase::FormStatusRenderBegun; $this->strIncludedStyleSheetFileArray = array(); // Figure out initial list of StyleSheet includes $strStyleSheetArray = array(); // Iterate through the form's ControlArray to Define FormAttributes and additional JavaScriptIncludes $this->strFormAttributeArray = array(); foreach ($this->GetAllControls() as $objControl) { // Include any StyleSheets? The control would have a // comma-delimited list of stylesheet files to include (if applicable) if ($strScriptArray = $this->ProcessStyleSheetList($objControl->StyleSheets)) { $strStyleSheetArray = array_merge($strStyleSheetArray, $strScriptArray); } // Form Attributes? if ($objControl->FormAttributes) { $this->strFormAttributeArray = array_merge($this->strFormAttributeArray, $objControl->FormAttributes); } } if (is_array($this->strCustomAttributeArray)) { $this->strFormAttributeArray = array_merge($this->strFormAttributeArray, $this->strCustomAttributeArray); } // Create $strFormAttributes $strFormAttributes = ''; foreach ($this->strFormAttributeArray as $strKey => $strValue) { $strFormAttributes .= sprintf(' %s="%s"', $strKey, $strValue); } QApplicationBase::$ProcessOutput = false; $strOutputtedText = strtolower(trim(ob_get_contents())); if (strpos($strOutputtedText, '<body') === false) { $strToReturn = '<body>'; $this->blnRenderedBodyTag = true; } else { $strToReturn = ''; } QApplicationBase::$ProcessOutput = true; if ($this->strCssClass) { $strFormAttributes .= ' class="' . $this->strCssClass . '"'; } // Setup Rendered HTML $strToReturn .= sprintf('<form method="post" id="%s" action="%s"%s>', $this->strFormId, htmlentities(QApplication::$RequestUri), $strFormAttributes); $strToReturn .= "\r\n"; // In order to make ui-themes workable, move the jquery.css to the end of list. // It should override any rules that it can override. foreach ($strStyleSheetArray as $strScript) { if (__JQUERY_CSS__ == $strScript) { unset($strStyleSheetArray[$strScript]); $strStyleSheetArray[$strScript] = $strScript; break; } } // Include styles that need to be included foreach ($strStyleSheetArray as $strScript) { $strToReturn .= sprintf('<style type="text/css" media="all">@import "%s";</style>', $this->GetCssFileUri($strScript)); $strToReturn .= "\r\n"; } // Perhaps a strFormModifiers as an array to // allow controls to update other parts of the form, like enctype, onsubmit, etc. // Return or Display if ($blnDisplayOutput) { if (!QApplication::$CliMode) { print $strToReturn; } return null; } else { if (!QApplication::$CliMode) { return $strToReturn; } else { return ''; } } }
public static function OutputPage($strBuffer) { // If the ProcessOutput flag is set to false, simply return the buffer // without processing anything. if (!QApplication::$ProcessOutput) { return $strBuffer; } if (QApplication::$ErrorFlag) { return $strBuffer; } else { if (QApplication::$RequestMode == QRequestMode::Ajax) { return trim($strBuffer); } else { // Update Cache-Control setting header('Cache-Control: ' . QApplication::$CacheControl); $strScript = QApplicationBase::RenderJavaScript(false); if ($strScript) { return sprintf('%s<script type="text/javascript">%s</script>', $strBuffer, $strScript); } return $strBuffer; } } }
function QcodoHandleError($__exc_errno, $__exc_errstr, $__exc_errfile, $__exc_errline, $__exc_errcontext) { // If a command is called with "@", then we should return if (error_reporting() == 0) { return; } if (class_exists('QApplicationBase')) { QApplicationBase::$ErrorFlag = true; } global $__exc_strType; if (isset($__exc_strType)) { return; } $__exc_strType = "Error"; $__exc_strMessage = $__exc_errstr; switch ($__exc_errno) { case E_ERROR: $__exc_strObjectType = "E_ERROR"; break; case E_WARNING: $__exc_strObjectType = "E_WARNING"; break; case E_PARSE: $__exc_strObjectType = "E_PARSE"; break; case E_NOTICE: $__exc_strObjectType = "E_NOTICE"; break; case E_STRICT: $__exc_strObjectType = "E_STRICT"; break; case E_CORE_ERROR: $__exc_strObjectType = "E_CORE_ERROR"; break; case E_CORE_WARNING: $__exc_strObjectType = "E_CORE_WARNING"; break; case E_COMPILE_ERROR: $__exc_strObjectType = "E_COMPILE_ERROR"; break; case E_COMPILE_WARNING: $__exc_strObjectType = "E_COMPILE_WARNING"; break; case E_USER_ERROR: $__exc_strObjectType = "E_USER_ERROR"; break; case E_USER_WARNING: $__exc_strObjectType = "E_USER_WARNING"; break; case E_USER_NOTICE: $__exc_strObjectType = "E_USER_NOTICE"; break; case E_DEPRECATED: $__exc_strObjectType = 'E_DEPRECATED'; break; case E_USER_DEPRECATED: $__exc_strObjectType = 'E_USER_DEPRECATED'; break; case E_RECOVERABLE_ERROR: $__exc_strObjectType = 'E_RECOVERABLE_ERROR'; break; default: $__exc_strObjectType = "Unknown"; break; } $__exc_strFilename = $__exc_errfile; $__exc_intLineNumber = $__exc_errline; $__exc_strStackTrace = ""; $__exc_objBacktrace = debug_backtrace(); for ($__exc_intIndex = 0; $__exc_intIndex < count($__exc_objBacktrace); $__exc_intIndex++) { $__exc_objItem = $__exc_objBacktrace[$__exc_intIndex]; $__exc_strKeyFile = array_key_exists("file", $__exc_objItem) ? $__exc_objItem["file"] : ""; $__exc_strKeyLine = array_key_exists("line", $__exc_objItem) ? $__exc_objItem["line"] : ""; $__exc_strKeyClass = array_key_exists("class", $__exc_objItem) ? $__exc_objItem["class"] : ""; $__exc_strKeyType = array_key_exists("type", $__exc_objItem) ? $__exc_objItem["type"] : ""; $__exc_strKeyFunction = array_key_exists("function", $__exc_objItem) ? $__exc_objItem["function"] : ""; $__exc_strStackTrace .= sprintf("#%s %s(%s): %s%s%s()\n", $__exc_intIndex, $__exc_strKeyFile, $__exc_strKeyLine, $__exc_strKeyClass, $__exc_strKeyType, $__exc_strKeyFunction); } if (ob_get_length()) { $__exc_strRenderedPage = ob_get_contents(); ob_clean(); } // Call to display the Error Page (as defined in configuration.inc.php) if (defined('ERROR_PAGE_PATH')) { require __DOCROOT__ . ERROR_PAGE_PATH; } else { // Error in installer or similar - ERROR_PAGE_PATH constant is not defined yet. echo "error: errno: " . $__exc_errno . "<br/>" . $__exc_errstr . "<br/>" . $__exc_errfile . ":" . $__exc_errline . "<br/>" . $__exc_errcontext; } exit; }
/** * Gets the value of the PathInfo item at index $intIndex. Will return NULL if it doesn't exist. * If no $intIndex is given will return an array with PathInfo contents. * * The way PathInfo index is determined is, for example, given a URL '/folder/page.php/id/15/blue', * QApplication::PathInfo(0) will return 'id' * QApplication::PathInfo(1) will return '15' * QApplication::PathInfo(2) will return 'blue' * * @return mixed */ public static function PathInfo($intIndex = null) { // Lookup PathInfoArray from cache, or create it into cache if it doesn't yet exist if (!isset(self::$arrPathInfo)) { $strPathInfo = QApplication::$PathInfo; self::$arrPathInfo = array(); if ($strPathInfo != '') { if ($strPathInfo == '/') { self::$arrPathInfo[0] = ''; } else { // Remove Trailing '/' if (QString::FirstCharacter($strPathInfo) == '/') { $strPathInfo = substr($strPathInfo, 1); } self::$arrPathInfo = explode('/', $strPathInfo); } } } if ($intIndex === null) { return self::$arrPathInfo; } elseif (array_key_exists($intIndex, self::$arrPathInfo)) { return self::$arrPathInfo[$intIndex]; } else { return null; } }
protected function lnkAddContact_Click() { QApplicationBase::Redirect('peopledetails_list.php'); }
function QcubedHandleError($__exc_errno, $__exc_errstr, $__exc_errfile, $__exc_errline, $__exc_errcontext) { // If a command is called with "@", then we should return if (error_reporting() == 0) { return true; } if (class_exists('QApplicationBase')) { QApplicationBase::$ErrorFlag = true; } global $__exc_strType; if (isset($__exc_strType)) { return true; } // Already handled elsewhere, avoi looping $__exc_strType = "Error"; $__exc_strMessage = $__exc_errstr; switch ($__exc_errno) { case E_ERROR: $__exc_strObjectType = "E_ERROR"; break; case E_WARNING: $__exc_strObjectType = "E_WARNING"; break; case E_PARSE: $__exc_strObjectType = "E_PARSE"; break; case E_NOTICE: $__exc_strObjectType = "E_NOTICE"; break; case E_STRICT: $__exc_strObjectType = "E_STRICT"; break; case E_CORE_ERROR: $__exc_strObjectType = "E_CORE_ERROR"; break; case E_CORE_WARNING: $__exc_strObjectType = "E_CORE_WARNING"; break; case E_COMPILE_ERROR: $__exc_strObjectType = "E_COMPILE_ERROR"; break; case E_COMPILE_WARNING: $__exc_strObjectType = "E_COMPILE_WARNING"; break; case E_USER_ERROR: $__exc_strObjectType = "E_USER_ERROR"; break; case E_USER_WARNING: $__exc_strObjectType = "E_USER_WARNING"; break; case E_USER_NOTICE: $__exc_strObjectType = "E_USER_NOTICE"; break; case E_DEPRECATED: $__exc_strObjectType = 'E_DEPRECATED'; break; case E_USER_DEPRECATED: $__exc_strObjectType = 'E_USER_DEPRECATED'; break; case E_RECOVERABLE_ERROR: $__exc_strObjectType = 'E_RECOVERABLE_ERROR'; break; default: $__exc_strObjectType = "Unknown"; break; } $__exc_strFilename = $__exc_errfile; $__exc_intLineNumber = $__exc_errline; $__exc_strStackTrace = QcubedGetBacktrace(); if (ob_get_length()) { $__exc_strRenderedPage = ob_get_contents(); ob_clean(); } // Call to display the Error Page (as defined in configuration.inc.php) if (defined('ERROR_PAGE_PATH')) { require __DOCROOT__ . ERROR_PAGE_PATH; } else { // Error in installer or similar - ERROR_PAGE_PATH constant is not defined yet. echo "error: errno: " . $__exc_errno . "<br/>" . $__exc_errstr . "<br/>" . $__exc_errfile . ":" . $__exc_errline . "<br/>" . implode(', ', $__exc_errcontext); } exit; }
function QcodoHandleError($__exc_errno, $__exc_errstr, $__exc_errfile, $__exc_errline, $__exc_errcontext) { $__exc_intErrorReport = error_reporting(); // If a command is called with "@", then we should return if ($__exc_intErrorReport == 0) { return false; } // If error_reporting is turned off for this error, return $error_all = $__exc_intErrorReport == E_ALL && $__exc_errno != E_STRICT; if (!$error_all || $__exc_intErrorReport % $__exc_errno == 0) { return false; } if (class_exists('QApplicationBase')) { QApplicationBase::$ErrorFlag = true; } global $__exc_strType; if (isset($__exc_strType)) { return false; } $__exc_strType = "Error"; $__exc_strMessage = $__exc_errstr; switch ($__exc_errno) { case E_ERROR: $__exc_strObjectType = "E_ERROR"; break; case E_WARNING: $__exc_strObjectType = "E_WARNING"; break; case E_PARSE: $__exc_strObjectType = "E_PARSE"; break; case E_NOTICE: //return; $__exc_strObjectType = "E_NOTICE"; break; case E_STRICT: $__exc_strObjectType = "E_STRICT"; break; case E_CORE_ERROR: $__exc_strObjectType = "E_CORE_ERROR"; break; case E_CORE_WARNING: $__exc_strObjectType = "E_CORE_WARNING"; break; case E_COMPILE_ERROR: $__exc_strObjectType = "E_COMPILE_ERROR"; break; case E_COMPILE_WARNING: $__exc_strObjectType = "E_COMPILE_WARNING"; break; case E_USER_ERROR: $__exc_strObjectType = "E_USER_ERROR"; break; case E_USER_WARNING: $__exc_strObjectType = "E_USER_WARNING"; break; case E_USER_NOTICE: $__exc_strObjectType = "E_USER_NOTICE"; break; default: $__exc_strObjectType = "Unknown"; break; } $__exc_strFilename = $__exc_errfile; $__exc_intLineNumber = $__exc_errline; $__exc_strStackTrace = ""; $__exc_objBacktrace = debug_backtrace(); for ($__exc_intIndex = 0; $__exc_intIndex < count($__exc_objBacktrace); $__exc_intIndex++) { $__exc_objItem = $__exc_objBacktrace[$__exc_intIndex]; $__exc_strKeyFile = array_key_exists("file", $__exc_objItem) ? $__exc_objItem["file"] : ""; $__exc_strKeyLine = array_key_exists("line", $__exc_objItem) ? $__exc_objItem["line"] : ""; $__exc_strKeyClass = array_key_exists("class", $__exc_objItem) ? $__exc_objItem["class"] : ""; $__exc_strKeyType = array_key_exists("type", $__exc_objItem) ? $__exc_objItem["type"] : ""; $__exc_strKeyFunction = array_key_exists("function", $__exc_objItem) ? $__exc_objItem["function"] : ""; $__exc_strStackTrace .= sprintf("#%s %s(%s): %s%s%s()\n", $__exc_intIndex, $__exc_strKeyFile, $__exc_strKeyLine, $__exc_strKeyClass, $__exc_strKeyType, $__exc_strKeyFunction); } if (ob_get_length()) { $__exc_strRenderedPage = ob_get_contents(); ob_clean(); } // Call to display the Error Page (as defined in configuration.inc.php) require __DOCROOT__ . ERROR_PAGE_PATH; //exit(); }
private function GetAssetsData($productgroup) { $objClauses = array(); array_push($objClauses, QQ::OrderBy(QQN::Myassets()->Title)); if ($objClause = $this->dtrMyLibrary->LimitClause) { array_push($objClauses, $this->dtrMyLibrary->LimitClause); } if ($this->txtSearchTerm->Text == "") { $condition = QQ::AndCondition(QQ::Equal(QQN::Myassets()->ProductGroup, $productgroup), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User'])); $arrResult = Myassets::QueryArray($condition, $objClauses); $this->dtrMyLibrary->TotalItemCount = Myassets::QueryCount($condition); $this->dtrMyLibrary->DataSource = $arrResult; } else { $objCondition = QQ::AndCondition(QQ::OrCondition(QQ::Like(QQN::Myassets()->Title, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Author, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Artist, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Actor, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Director, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Publisher, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Label, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Isbn, '%' . $this->txtSearchTerm->Text . '%')), QQ::Equal(QQN::Myassets()->ProductGroup, $productgroup), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User'])); $objDbResult = Myassets::QueryArray($objCondition, $objClauses); $myassets = $objDbResult; $this->dtrMyLibrary->TotalItemCount = Myassets::QueryCount($objCondition); if ($this->dtrMyLibrary->TotalItemCount > 0) { $this->dtrMyLibrary->DataSource = $myassets; } else { QApplicationBase::DisplayAlert('No ' . $productgroup . 's exists for the searched term'); } } }
// Versioning Information define('QCUBED_VERSION_NUMBER_ONLY', '3.0.0'); define('QCUBED_VERSION', QCUBED_VERSION_NUMBER_ONLY . ' Beta Release (QCubed ' . QCUBED_VERSION_NUMBER_ONLY . ')'); define('__JQUERY_CORE_VERSION__', '1.9.1'); define('__JQUERY_UI_VERSION__', '1.9.2'); // Preload Required Framework Classes require __QCUBED_CORE__ . '/base_controls/_enumerations.inc.php'; require __QCUBED_CORE__ . '/base_controls/_utilities.inc.php'; require __QCUBED_CORE__ . '/framework/QBaseClass.class.php'; require __QCUBED_CORE__ . '/framework/QExceptions.class.php'; require __QCUBED_CORE__ . '/framework/QType.class.php'; require __QCUBED_CORE__ . '/framework/QApplicationBase.class.php'; // Setup the Error Handler require __QCUBED_CORE__ . '/error.inc.php'; // Start Output Buffering (only if not on commandline) QApplicationBase::StartOutputBuffering(); // Preload Other Framework Classes require __QCUBED_CORE__ . '/framework/QDatabaseBase.class.php'; require __QCUBED_CORE__ . '/database/QPdoDatabase.class.php'; if (version_compare(PHP_VERSION, '5.2.0', '<')) { // Use the Legacy (Pre-5.2.0) QDateTime class require __QCUBED_CORE__ . '/framework/QDateTime.legacy.class.php'; } else { // Use the New QDateTime class (which extends PHP DateTime) require __QCUBED_CORE__ . '/framework/QDateTime.class.php'; } // Define Classes to be Preloaded on QApplication::Initialize() QApplicationBase::$PreloadedClassFile['qhtmlattributemanagerbase'] = __QCUBED_CORE__ . '/base_controls/QHtmlAttributeManagerBase.class.php'; QApplicationBase::$PreloadedClassFile['qhtmlattributemanager'] = __QCUBED__ . '/controls/QHtmlAttributeManager.class.php'; QApplicationBase::$PreloadedClassFile['qcontrolbase'] = __QCUBED_CORE__ . '/base_controls/QControlBase.class.php'; QApplicationBase::$PreloadedClassFile['qcontrol'] = __QCUBED__ . '/controls/QControl.class.php';
public static function HandleError($intErrorNumber, $strErrorString, $strErrorFile, $intErrorLine) { // If a command is called with "@", then we should return if (error_reporting() == 0) { return; } // If we still have access to QApplicationBase, set the error flag on the Application if (class_exists('QApplicationBase')) { QApplicationBase::$ErrorFlag = true; } // If we are currently dealing with reporting an error, don't go on if (QErrorHandler::$Type) { return; } // Setup the QErrorHandler Object QErrorHandler::$Type = 'Exception'; QErrorHandler::$Message = $strErrorString; QErrorHandler::$Filename = $strErrorFile; QErrorHandler::$LineNumber = $intErrorLine; switch ($intErrorNumber) { case E_ERROR: QErrorHandler::$ObjectType = 'E_ERROR'; break; case E_WARNING: QErrorHandler::$ObjectType = 'E_WARNING'; break; case E_PARSE: QErrorHandler::$ObjectType = 'E_PARSE'; break; case E_NOTICE: QErrorHandler::$ObjectType = 'E_NOTICE'; break; case E_STRICT: QErrorHandler::$ObjectType = 'E_STRICT'; break; case E_CORE_ERROR: QErrorHandler::$ObjectType = 'E_CORE_ERROR'; break; case E_CORE_WARNING: QErrorHandler::$ObjectType = 'E_CORE_WARNING'; break; case E_COMPILE_ERROR: QErrorHandler::$ObjectType = 'E_COMPILE_ERROR'; break; case E_COMPILE_WARNING: QErrorHandler::$ObjectType = 'E_COMPILE_WARNING'; break; case E_USER_ERROR: QErrorHandler::$ObjectType = 'E_USER_ERROR'; break; case E_USER_WARNING: QErrorHandler::$ObjectType = 'E_USER_WARNING'; break; case E_USER_NOTICE: QErrorHandler::$ObjectType = 'E_USER_NOTICE'; break; default: QErrorHandler::$ObjectType = 'Unknown'; break; } // Setup the Stack Trace QErrorHandler::$StackTrace = ""; $objBackTrace = debug_backtrace(); for ($intIndex = 0; $intIndex < count($objBackTrace); $intIndex++) { $objItem = $objBackTrace[$intIndex]; $strKeyFile = array_key_exists('file', $objItem) ? $objItem['file'] : ''; $strKeyLine = array_key_exists('line', $objItem) ? $objItem['line'] : ''; $strKeyClass = array_key_exists('class', $objItem) ? $objItem['class'] : ''; $strKeyType = array_key_exists('type', $objItem) ? $objItem['type'] : ''; $strKeyFunction = array_key_exists('function', $objItem) ? $objItem['function'] : ''; QErrorHandler::$StackTrace .= sprintf("#%s %s(%s): %s%s%s()\n", $intIndex, $strKeyFile, $strKeyLine, $strKeyClass, $strKeyType, $strKeyFunction); } QErrorHandler::Run(); }
protected function Register_Click($strFormId, $strControlId, $strParameter) { $encrypt = new encrypt(); $this->txtPassword->Text = $encrypt->encrypt_sha1($this->txtPassword->Text); $this->objMember = new Memberdetails(); $this->objMember->FullName = $this->txtFullName->Text; $this->objMember->MemberId = $this->txtMemberId->Text; $this->objMember->Password = $this->txtPassword->Text; $this->objMember->Active = false; $this->objMember->Save(); QApplicationBase::Redirect('index.php'); }
protected function Form_Run() { QApplicationBase::CheckRemoteAdmin(); QApplication::$LoadedPage = 'Lend my things'; }
/** * Outputs the current page with the buffer data * @param string $strBuffer Buffer data * * @return string */ public static function OutputPage($strBuffer) { // If the ProcessOutput flag is set to false, simply return the buffer // without processing anything. if (!QApplication::$ProcessOutput) { return $strBuffer; } if (QApplication::$ErrorFlag) { return $strBuffer; } else { if (QApplication::$RequestMode == QRequestMode::Ajax) { return trim($strBuffer); } else { // Update Cache-Control setting header('Cache-Control: ' . QApplication::$CacheControl); // make sure the server does not override the character encoding value by explicitly sending it out as a header. // some servers will use an internal default if not specified in the header, and that will override the "encoding" value sent in the text. header(sprintf('Content-Type: %s; charset=%s', strtolower(QApplication::$ContentType), strtolower(QApplication::$EncodingType))); /* * Normally, FormBase->RenderEnd will render the javascripts. In the unusual case * of not rendering with a QForm object, this will still output embedded javascript commands. */ $strScript = QApplicationBase::RenderJavascript(); if ($strScript) { return $strBuffer . '<script type="text/javascript">' . $strScript . '</script>'; } return $strBuffer; } } }
protected function RenderBegin($blnDisplayOutput = true) { // Ensure that RenderBegin() has not yet been called switch ($this->intFormStatus) { case QFormBase::FormStatusUnrendered: break; case QFormBase::FormStatusRenderBegun: case QFormBase::FormStatusRenderEnded: throw new QCallerException('$this->RenderBegin() has already been called'); break; default: throw new QCallerException('FormStatus is in an unknown status'); } // Update FormStatus and Clear Included JS/CSS list $this->intFormStatus = QFormBase::FormStatusRenderBegun; $this->strIncludedJavaScriptFileArray = array(); $this->strIncludedStyleSheetFileArray = array(); // Figure out initial list of JavaScriptIncludes $strJavaScriptArray = $this->ProcessJavaScriptList('_core/qcodo.js, _core/logger.js, _core/event.js, _core/post.js, _core/control.js'); if (!$strJavaScriptArray) { $strJavaScriptArray = array(); } // Figure out initial list of StyleSheet includes $strStyleSheetArray = array(); // Iterate through the form's ControlArray to Define FormAttributes and additional JavaScriptIncludes $this->strFormAttributeArray = array(); foreach ($this->GetAllControls() as $objControl) { // Include any JavaScripts? The control would have a // comma-delimited list of javascript files to include (if applicable) if ($strScriptArray = $this->ProcessJavaScriptList($objControl->JavaScripts)) { $strJavaScriptArray = array_merge($strJavaScriptArray, $strScriptArray); } // Include any StyleSheets? The control would have a // comma-delimited list of stylesheet files to include (if applicable) if ($strScriptArray = $this->ProcessStyleSheetList($objControl->StyleSheets)) { $strStyleSheetArray = array_merge($strStyleSheetArray, $strScriptArray); } // Form Attributes? if ($objControl->FormAttributes) { $this->strFormAttributeArray = array_merge($this->strFormAttributeArray, $objControl->FormAttributes); } } // Create $strFormAttributes $strFormAttributes = ''; foreach ($this->strFormAttributeArray as $strKey => $strValue) { $strFormAttributes .= sprintf(' %s="%s"', $strKey, $strValue); } QApplicationBase::$ProcessOutput = false; $strOutputtedText = strtolower(trim(ob_get_contents())); if (strpos($strOutputtedText, '<body') === false) { $strToReturn = '<body>'; $this->blnRenderedBodyTag = true; } else { $strToReturn = ''; } QApplicationBase::$ProcessOutput = true; if ($this->strCssClass) { $strFormAttributes .= ' class="' . $this->strCssClass . '"'; } // Setup Rendered HTML $strToReturn .= sprintf('<form method="post" id="%s" action="%s"%s>', $this->strFormId, QApplication::$RequestUri, $strFormAttributes); $strToReturn .= "\r\n"; // Include javascripts that need to be included foreach ($strJavaScriptArray as $strScript) { $strToReturn .= sprintf('<script type="text/javascript" src="%s/%s"></script>', __VIRTUAL_DIRECTORY__ . __JS_ASSETS__, $strScript); $strToReturn .= "\r\n"; } // Include styles that need to be included foreach ($strStyleSheetArray as $strScript) { $strToReturn .= sprintf('<style type="text/css" media="all">@import "%s/%s";</style>', __VIRTUAL_DIRECTORY__ . __CSS_ASSETS__, $strScript); $strToReturn .= "\r\n"; } // Perhaps a strFormModifiers as an array to // allow controls to update other parts of the form, like enctype, onsubmit, etc. // Return or Display if ($blnDisplayOutput) { print $strToReturn; return null; } else { return $strToReturn; } }
protected function Home_Click() { QApplicationBase::Redirect('index.php'); }