Update Version 0.4.0 beta 09.07.2018
- Bugfix on the form classes, now the select option is correctly set back. - Update for the database adapter - Improvement of the form elements, added onchange on the select boxes, the form tag now can have no element if needed. - Implementation of the Postgres and MySQL Adapter with propper Namespacing. - Minor bugfixing
This commit is contained in:
@@ -44,7 +44,9 @@ class Auth extends Controller implements IAuth
|
||||
$user_password = Pdo::query("SELECT DES_DECRYPT(user_pass, '".Config::getInstance()->getConfig()["SECURITY"]["password_hash"]."') AS pass FROM user WHERE user_login = '".$login."';");
|
||||
if( $user_password["pass"] == $password )
|
||||
{
|
||||
$_SESSION['auth']['login'] = $login;
|
||||
$session_id = session_id();
|
||||
$_SESSION['auth']['id'] = $session_id;
|
||||
$_SESSION['auth']['login'] = $login;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -14,7 +14,7 @@ class Autoloader
|
||||
{
|
||||
const MY_FILE_NAME = "autoloader.php";
|
||||
const DB_MODEL_FOLDER = "dbmodel";
|
||||
const MODUL_FOLDER = "modul";
|
||||
const MODULE_FOLDER = "module";
|
||||
|
||||
private static $_filesInFoler = array();
|
||||
private static $_instance;
|
||||
@@ -56,7 +56,33 @@ class Autoloader
|
||||
*/
|
||||
private static function _setFilesInFoler( )
|
||||
{
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::DB_MODEL_FOLDER] ));
|
||||
$modelFolder = Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::DB_MODEL_FOLDER];
|
||||
if(is_array($modelFolder))
|
||||
{
|
||||
foreach ($modelFolder as $folder)
|
||||
{
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . $folder ));
|
||||
foreach ($iterator as $item)
|
||||
{
|
||||
if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..")
|
||||
{
|
||||
self::$_filesInFoler[] = $item->getPathName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . $modelFolder ));
|
||||
foreach ($iterator as $item)
|
||||
{
|
||||
if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..")
|
||||
{
|
||||
self::$_filesInFoler[] = $item->getPathName();
|
||||
}
|
||||
}
|
||||
}
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::MODULE_FOLDER] ));
|
||||
foreach ($iterator as $item)
|
||||
{
|
||||
if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..")
|
||||
|
||||
@@ -142,4 +142,11 @@ class Controller
|
||||
return $_REQUEST;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getServer()
|
||||
{
|
||||
return $_SERVER;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,9 @@ class Form extends FormAttributes implements IForm
|
||||
self::FORM_ACTION => '',
|
||||
self::FORM_TARGET => '',
|
||||
self::FORM_ATTRIBUTE_ID => '',
|
||||
self::FORM_ATTRIBUTE_CLASS => ''
|
||||
self::FORM_ATTRIBUTE_CLASS => '',
|
||||
self::FORM_ENCTYPE => '',
|
||||
self::FORM_ATTRIBUTE_ONSUBMIT => ''
|
||||
);
|
||||
|
||||
public function loadElement( $attributes )
|
||||
@@ -32,7 +34,7 @@ class Form extends FormAttributes implements IForm
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<form action="ACTION" method="METHOD" name="NAME" target="TARGET" ID CLASS>' . "\n" . 'FIELDS</form>' . "\n";
|
||||
$this->_element = '<form action="ACTION" method="METHOD" name="NAME" target="TARGET" enctype="ENCTYPE" onsubmit="ONSUBMIT" ID CLASS>' . "\n" . 'FIELDS</form>' . "\n";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,25 +8,25 @@ namespace Nibiru\Form;
|
||||
*/
|
||||
class FormAttributes
|
||||
{
|
||||
|
||||
|
||||
private $_attributes = array();
|
||||
protected $_element;
|
||||
|
||||
|
||||
use \Nibiru\Attributes\Form;
|
||||
|
||||
|
||||
public function __construct( $attributes = false )
|
||||
{
|
||||
if($attributes)
|
||||
{
|
||||
try {
|
||||
if( is_array( $attributes ) )
|
||||
{
|
||||
$this->_attributes = $attributes;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \Exception( self::errorMessage( str_replace('.php', '', basename( __FILE__ )), __LINE__ ) );
|
||||
}
|
||||
if( is_array( $attributes ) )
|
||||
{
|
||||
$this->_attributes = $attributes;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \Exception( self::errorMessage( str_replace('.php', '', basename( __FILE__ )), __LINE__ ) );
|
||||
}
|
||||
} catch (\Exception $e)
|
||||
{
|
||||
self::exceptionMessage( $e );
|
||||
@@ -41,7 +41,7 @@ class FormAttributes
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
@@ -58,6 +58,9 @@ class FormAttributes
|
||||
}
|
||||
$this->_element = str_replace(' ID', '', $this->_element);
|
||||
$this->_element = str_replace(' CLASS', '', $this->_element);
|
||||
$this->_element = str_replace(' enctype="ENCTYPE"', '', $this->_element);
|
||||
$this->_element = str_replace(' onsubmit="ONSUBMIT"', '', $this->_element);
|
||||
$this->_element = str_replace(' action="ACTION"', '', $this->_element);
|
||||
$this->_element = str_replace(' SPEECH', '', $this->_element);
|
||||
$this->_element = str_replace(' FORM', '', $this->_element);
|
||||
$this->_element = str_replace(' placeholder="PLACEHOLDER"', '', $this->_element);
|
||||
@@ -65,6 +68,9 @@ class FormAttributes
|
||||
$this->_element = str_replace(' value="VALUE"', '', $this->_element);
|
||||
$this->_element = str_replace(' ', ' ', $this->_element);
|
||||
$this->_element = str_replace(' type="TYPE"', '', $this->_element);
|
||||
$this->_element = str_replace(' onchange="ONCHANGE"', '', $this->_element);
|
||||
$this->_element = str_replace(' SELECTED', '', $this->_element);
|
||||
$this->_element = str_replace(' CONTEXT', '', $this->_element);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,12 @@ final class Pdo extends Mysql implements IPdo
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function selectDatasetByFieldAndValue($tablename = self::PLACE_TABLE_NAME, $fieldAndValue = array() )
|
||||
{
|
||||
$result = parent::getInstance()->getConn()->query("SELECT * FROM " . $tablename . " WHERE " . $fieldAndValue['name'] . " = '" . $fieldAndValue['value'] . "';");
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
||||
public static function updateColumnByFieldWhere( $tablename = self::PLACE_TABLE_NAME,
|
||||
$column_name = IMysql::PLACE_COLUMN_NAME,
|
||||
$parameter_name = IMysql::PLACE_SEARCH_TERM,
|
||||
|
||||
@@ -152,4 +152,9 @@ class Postgres extends Odbc implements IPostgres
|
||||
}
|
||||
}
|
||||
|
||||
public static function truncateTable($tablename = IOdbc::PLACE_TABLE_NAME)
|
||||
{
|
||||
\odbc_exec(parent::getInstance( self::getSettingsSection() )->getConn(), "DELETE FROM " . $tablename . ";");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -171,7 +171,7 @@ class Router extends Config
|
||||
public function currentPage()
|
||||
{
|
||||
//self::RouterDebug(self::$_cur_page);
|
||||
return self::$_cur_page;
|
||||
return self::getCurPage();
|
||||
}
|
||||
|
||||
public static function RouterDebug($value)
|
||||
|
||||
@@ -12,9 +12,11 @@ use Nibiru\Adapter;
|
||||
class TypeOption extends FormAttributes implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_VALUE => '',
|
||||
self::FORM_ATTRIBUTE_ID => '',
|
||||
self::FORM_ATTRIBUTE_CLASS => ''
|
||||
self::FORM_VALUE => '',
|
||||
self::FORM_ATTRIBUTE_ID => '',
|
||||
self::FORM_ATTRIBUTE_CLASS => '',
|
||||
self::FORM_ATTRIBUTE_SELECTED => '',
|
||||
self::FORM_ATTRIBUTE_CONTEXT => ''
|
||||
);
|
||||
|
||||
public function loadElement( $attributes )
|
||||
@@ -30,9 +32,6 @@ class TypeOption extends FormAttributes implements IForm
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<option value="VALUE" ID CLASS>VALUE</option>' . "\n";
|
||||
$this->_element = '<option value="VALUE" ID CLASS SELECTED>CONTEXT</option>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -12,9 +12,10 @@ use Nibiru\Adapter;
|
||||
class TypeSelect extends FormAttributes implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => '',
|
||||
self::FORM_ATTRIBUTE_CLASS => '',
|
||||
self::FORM_ATTRIBUTE_ID => ''
|
||||
self::FORM_NAME => '',
|
||||
self::FORM_ATTRIBUTE_CLASS => '',
|
||||
self::FORM_ATTRIBUTE_ID => '',
|
||||
self::FORM_ATTRIBUTE_ONCHANGE => ''
|
||||
);
|
||||
|
||||
public function loadElement( $attributes )
|
||||
@@ -30,9 +31,6 @@ class TypeSelect extends FormAttributes implements IForm
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<select name="NAME" ID CLASS>' . "\n" . 'OPTIONS' . "\n" . '</select>' . "\n";
|
||||
$this->_element = '<select name="NAME" onchange="ONCHANGE" ID CLASS>' . "\n" . 'OPTIONS' . "\n" . '</select>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user