/** * Will modify an already set _SESSION variable. You need to first set the key to have this method work, else it will not modify * the _SESSION variable. This is contrary to how the _SESSION superglobal works, but provides a method to be more precise when * working with the _SESSION superglobal when actually adding/modifying variables inside it; * * @param S $theKey The key to be set in the _SESSION * @param M $theValue The value, any kind that can be serialized to be stored in _SESSION * @return B Will return true if the key/var pair are set * @author Catalin Z. Alexandru <*****@*****.**> * @copyright Under the terms of the GNU General Public License v3 * @version $Id: 06_SES.php 313 2009-10-09 13:27:52Z catalin.zamfir $ * @since Version 1.0 * @access protected * @static * @final */ protected static final function modSessionVar(S $theKey, O $theValue) { if (isset($_SESSION[PROJECT_NAME . _U . $theKey->toString()])) { $_SESSION[PROJECT_NAME . _U . $theKey->toString()] = $theValue->toMix(); return new B(TRUE); } else { return new B(FALSE); } }
/** * Will return a MySQL Resource, containing the result of the passed SQL. This method will query the database and return the * MySQL resource which will get processed and transformed into a specifc RA array (A) that you can then access for information * you actually need; * * @param S $queryString The query string to be queried * @param S $queryField The field name (unique) to index by * @return A The returned query resource * @author Catalin Z. Alexandru <*****@*****.**> * @copyright Under the terms of the GNU General Public License v3 * @version $Id: 11_SQL.php 313 2009-10-09 13:27:52Z catalin.zamfir $ * @since Version 1.0 * @access public * @static */ public static function getQuery(S $queryString, S $queryFieldId = NULL) { // Get the MySQL result, or go an echo an error screen if it failed ... $queryResource = new O(mysql_query($queryString->doToken(SQL_PREFIX, self::$objSQLR))); // Do another checking for FALSE, and return what's needed ... if ($queryResource->checkIs('res')->toBoolean()) { $queryResourceSet = new R($queryResource->toMix()); $arrayResourceSet = new A(); if ($queryFieldId == NULL) { // Set the indexer to minus 1, so we can ++i; $i = -1; // Do the looping ... while ($r = self::getQueryResultRow($queryResourceSet)) { // MySQL: Numeric ... $arrayResourceSet[++$i] = $r; } // Just do it; return $arrayResourceSet; } else { // Do the looping ... while ($r = self::getQueryResultRow($queryResourceSet)) { // MySQL: Associative ... $arrayResourceSet[$r[$queryFieldId->toString()]] = $r; } // Just return, we know what it is; return $arrayResourceSet; } } else { if ($queryResource->checkIs('bln')->toBoolean()) { if ($queryResource->toMix() == TRUE) { // Return TRUE, is not a resource ... return new B(TRUE); } else { // Return FALSE, output error screen; self::renderSQLScreenOfDeath(); } } } }