Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ pub/img
views/home/about.php
views/home/contact.php

.data/*
43 changes: 42 additions & 1 deletion .idea/Romano.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

265 changes: 0 additions & 265 deletions .idea/workspace.xml

This file was deleted.

1 change: 1 addition & 0 deletions .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C:30:"PHPUnit\Runner\TestResultCache":1866:{a:2:{s:7:"defects";a:8:{s:76:"Tests\Romano\Framework\Utils\MatroskaTest::test_it_should_unflatten_an_array";i:3;s:74:"Tests\Romano\Framework\Utils\MatroskaTest::it_should_get_the_correct_value";i:3;s:67:"Tests\Romano\Framework\Utils\MatroskaTest::it_should_remove_a_value";i:3;s:71:"Tests\Romano\Framework\Utils\MatroskaTest::it_should_unflatten_an_array";i:3;s:88:"Tests\Romano\Framework\Utils\MatroskaTest::it_should_start_from_a_multidimensional_array";i:3;s:65:"Tests\Romano\Framework\Utils\MatroskaTest::it_should_check_values";i:3;s:74:"Tests\Romano\Framework\Utils\ApplicationTest::it_should_unflatten_an_array";i:5;s:76:"Tests\Romano\Framework\Utils\ApplicationTest::it_should_build_the_path_array";i:3;}s:5:"times";a:13:{s:76:"Tests\Romano\Framework\Utils\MatroskaTest::test_it_should_unflatten_an_array";d:0.002;s:71:"Tests\Romano\Framework\Utils\MatroskaTest::it_should_unflatten_an_array";d:0;s:74:"Tests\Romano\Framework\Utils\MatroskaTest::it_should_get_the_correct_value";d:0;s:67:"Tests\Romano\Framework\Utils\MatroskaTest::it_should_remove_a_value";d:0;s:65:"Tests\Romano\Framework\Utils\MatroskaTest::it_should_have_a_value";d:0;s:65:"Tests\Romano\Framework\Utils\MatroskaTest::it_should_check_values";d:0;s:88:"Tests\Romano\Framework\Utils\MatroskaTest::it_should_start_from_a_multidimensional_array";d:0;s:74:"Tests\Romano\Framework\Utils\ApplicationTest::it_should_unflatten_an_array";d:0.002;s:77:"Tests\Romano\Framework\Utils\ApplicationTest::it_should_get_the_correct_value";d:0.001;s:70:"Tests\Romano\Framework\Utils\ApplicationTest::it_should_remove_a_value";d:0;s:68:"Tests\Romano\Framework\Utils\ApplicationTest::it_should_check_values";d:0;s:91:"Tests\Romano\Framework\Utils\ApplicationTest::it_should_start_from_a_multidimensional_array";d:0;s:76:"Tests\Romano\Framework\Utils\ApplicationTest::it_should_build_the_path_array";d:0.003;}}}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ it still needs a lot more global functionality before it would serve any useful

Experimental version
--------------------
The framework is not ment to be ready for public use as of today,
The framework is not meant to be ready for public use as of today,
but serves more as a minor display of the Romano framework, a proof of concept.
The site blog example

Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 9 additions & 3 deletions src/Romano/Container.php → _old/ContaineroLD.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
<?php

namespace Framework;


class Container
class Container implements ContainerInterface
{
private static $container = array();
private static $container = [];

public static function getAll($name)
{
return self::$container[$name];
}

public static function create(array $values): self
{
return new self($values);
}

public static function get(array $name)
{
return (isset(self::$container[$name[0]][$name[1]])) ? self::$container[$name[0]][$name[1]] : '';
Expand All @@ -25,6 +30,7 @@ public static function set($key, array $values)
{
if (!isset(self::$container[$key])) {
self::$container[$key] = $values;

return;
}
self::$container[$key] = array_merge(self::$container[$key], $values);
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion pub/index.php → _old/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php

use Romano\Infrastructure\DB;

define('TIME', microtime(true));
session_start();
require ('../config.php');
require('../config.php');
/*
* My basic global functions
*/
Expand Down
2 changes: 2 additions & 0 deletions src/Romano/Auth.php → _old/src/_todo/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/


use Framework\Infrastructure\Query;
use Romano\Infrastructure\DB;

class Auth
{
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/Romano/Crypt.php → _old/src/_todo/Crypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ static function dynSalt($string = null, $salt = null)

static function token()
{
return Session::put(App::getInstance()->get('config', array('session', 'token'), self::unique()));
return Session::put(App::getInstance()->get('ConfigurationManager', array('session', 'token'), self::unique()));
}

static function check($token)
{
$token_name = App::getInstance()->get('config', array('session', 'token'));
$token_name = App::getInstance()->get('ConfigurationManager', array('session', 'token'));

if (Session::get($token_name) && $token === Session::get($token_name)) {
Session::delete($token_name);
Expand Down
File renamed without changes.
8 changes: 0 additions & 8 deletions src/Romano/Filter.php → _old/src/_todo/Filter.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?php

/**
* Filter library
* -------------
* creator/source : Thijs De Paepe
*/



Class Filter
{

Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions src/Romano/Send.php → _old/src/_todo/Send.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ static function mail($email, $subject, $body)
$mail->do_debug = 0; // disable error msg
$mail->SMTPDebug = 0;

$mail->Host = Config::$array['EMAIL']['HOST'];
$mail->Host = ConfigurationManager::$array['EMAIL']['HOST'];
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Username = Config::$array['EMAIL']['USER'];
$mail->Password = Config::$array['EMAIL']['PASS'];
$mail->Username = ConfigurationManager::$array['EMAIL']['USER'];
$mail->Password = ConfigurationManager::$array['EMAIL']['PASS'];
$mail->Port = 465;
$mail->AddAddress($email);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->From = Config::$array['EMAIL']['FWRD'];
$mail->FromName=Config::$array['EMAIL']['FWRD'];
$mail->AddReplyTo(Config::$array['EMAIL']['FWRD'], title);
$mail->SetFrom(Config::$array['EMAIL']['FWRD'], title);
$mail->From = ConfigurationManager::$array['EMAIL']['FWRD'];
$mail->FromName=ConfigurationManager::$array['EMAIL']['FWRD'];
$mail->AddReplyTo(ConfigurationManager::$array['EMAIL']['FWRD'], title);
$mail->SetFrom(ConfigurationManager::$array['EMAIL']['FWRD'], title);
//$mail->IsHTML(true);
if($attachment) {
$mail->AddAttachment($attachment);
Expand Down
2 changes: 1 addition & 1 deletion src/Romano/SimpleDB.php → _old/src/_todo/SimpleDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SSDBException extends Exception
class SimpleDB extends SSDB
{
function __construct($DB = null, $timeout_ms=2000){
if ($DB === null) $DB = App::getInstance()->get(array('config', 'SSDB'));
if ($DB === null) $DB = App::getInstance()->get(array('ConfigurationManager', 'SSDB'));
parent::__construct($DB['HOST'], $DB['PORT'], $timeout_ms);
$this->easy();
}
Expand Down
42 changes: 42 additions & 0 deletions _old/src/_todo/Singleton.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Romano\Framework;

class Singleton
{
private static $uniqueInstance = [];

/**
* @param object $object
* @param string|null $reference
*/
public static function setInstance(object $object, string $reference = null): void
{
$objectName = $reference ?: \get_class($object);
static::$uniqueInstance[$objectName] = $object;
}

/**
* @param string $objectName
*
* @return object $object
*
* @throws Exception\UnknownObjectException
*/
public static function getInstance(string $objectName)
{
if (!isset(static::$uniqueInstance[$objectName])) {
throw new Exception\UnknownObjectException($objectName);
}

return static::$uniqueInstance[$objectName];
}

public static function clearInstance(string $objectName): void
{
unset(static::$uniqueInstance[$objectName]);
}

private function __construct(){}
private function __clone(){}
}
File renamed without changes.
File renamed without changes.
135 changes: 135 additions & 0 deletions _old/src/_todo/libs/DB.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?php

class DB //extends PDO
{
private static $_instance = null;
private $_pdo;
private $_stmt;
private $_error;

public function __construct($dsn = null, $username = null, $password = null, $options = [])
{
try {
$options = $options + [
PDO::ATTR_EMULATE_PREPARES, false,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
];
//$this->_pdo = new PDO($dsn,$username,$password,$options);
//parent::__construct($dsn,$username,$password,$options);
} catch (PDOException $e) {
throw $e;
} catch (Exception $e) {
throw $e;
}
}

public static function getInstance()
{
if (!isset(\Romano\Infrastructure\self::$_instance)) {
\Romano\Infrastructure\self::$_instance = new PDO(
$dsn = ConfigurationManager::$array['DB']['DSN'],
$username = ConfigurationManager::$array['DB']['USER'],
$password = ConfigurationManager::$array['DB']['PASS']
);

return \Romano\Infrastructure\self::$_instance;
}
}

public function exec($sql, $params)
{
$this->stmt = null;
if ($this->_stmt = $this->prepare($sql)) {
if ($params) {
foreach ($params as $key => $param) {
$this->_stmt->bindvalue(':'.$key, $param);
}
}
$this->_stmt->execute();
}
}

public function get($table, $where, $arg = [])
{
$action = $this->action($table, $where, $arg = $this->arguments($arg + ['split' => ' AND ']));
$sql = "SELECT {$arg['field']} FROM {$table} WHERE {$action['Framework\Infrastructure\Query']}";
if (!$this->exec($sql, $action['values'])) {
return $this;
}
}

public function delete($table, $where, $arg = [])
{
$action = $this->action($table, $where, $arg = $this->arguments($arg + ['split' => ' AND ']));
$sql = "DELETE {$arg['field']} FROM {$table} WHERE {$action['Framework\Infrastructure\Query']}";
if (!$this->exec($sql, $action['values'])) {
return $this;
}
}

public function insert($table, $fields, $arg = [])
{
$action = $this->action($table, $fields, $arg = $this->arguments($arg));
$sql = "INSERT INTO {$table} (`".implode('`, `', array_keys($action['values'])).'`) VALUES (:'.implode('`, `:', array_keys($action['values'])).')';
if ($this->exec($sql, $action['values'])) {
return true;
}
}

public function update($table, $fields, $id, $arg = [])
{
$action = $this->action($table, $fields, $arg = $this->arguments($arg + ['split' => '`, `']));
$sql = "UPDATE {$table} SET {$action['Framework\Infrastructure\Query']} WHERE `uid` = {$id}";
if ($this->exec($sql, $action['values'])) {
return true;
}
}

public function save($table, $fields, $id, $arg = [])
{
if (!$this->update($table, $fields, $id, $arg)) {
$this->insert($table, $fields, $arg);
}
}

public function fetch()
{
return $this->_stmt->fetch(PDO::FETCH_ASSOC);
}

public function fetchAll()
{
return $this->_stmt->fetchAll(PDO::FETCH_ASSOC);
}

private function arguments($arg)
{
return array_merge([
'field' => '*',
'operator' => '=',
'order' => '1',
'limit' => 50,
], $arg);
}

private function action($table, $array, $arg)
{
if ($i = count($array)) {
$query = null;
$values = [];
$x = 1;
foreach ($array as $key => $value) {
$query .= "`{$key}` {$arg['operator']} :{$key}";
if ($x < $i) {
$query .= $arg['split'];
++$x;
}
$values[$key] = $value;
}

return ['Framework\Infrastructure\Query' => $query, 'values' => $values];
}

return false;
}
}
6 changes: 4 additions & 2 deletions app/libs/Validate.php → _old/src/_todo/libs/Validate.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
/*

/**
* Validation library 11/2013
* --------------------------
* creator/source : Alex Garrett
Expand All @@ -9,7 +10,8 @@
* dependencies : needs DB layer/wrapper for "unique check"
*/

class Validate {
class Validate
{
private $_passed = false,
$_errors = array(),
$_db = null;
Expand Down
File renamed without changes.
Binary file removed app/controllers/.DS_Store
Binary file not shown.
Binary file removed app/libs/.DS_Store
Binary file not shown.
Loading