예제 #1
0
	public static function get ()
	{
		return (janitor::notNull($_SESSION['locale']) ? $_SESSION['locale'] : 'en');
	}
예제 #2
0
	/**
	 * Creates a table in the image of the property definitions supplied to it.
	 *
	 * @param string $tableName What the table will be called.
	 * @param array $propertyDefinitions The structure of the table.
	 * 
	 * @todo Need to make this use the query class.
	 */
	private static function createTable ($tableName, $propertyDefinitions)
	{
		$query .= " CREATE TABLE `" . metaclass::$db->getProperty('database') . "`.`$tableName` (\n";
		$query .= " `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n";
		foreach ($propertyDefinitions as $k => $v)
		{
			$vars = metaclass::getClassVars($v['type'], 'datatypes');
			$querylines[] .= "`$k` " . (janitor::notNull($vars['fieldtype']) ? $vars['fieldtype'] : 'VARCHAR( 255 )') .
					 " NOT NULL ";
		}
		$query .= implode(",\n", $querylines);
		$query .= ")";
		metaclass::$db->query($query);
		metaclass::$tablesLoaded[] = $tableName;
	}