Skip to content

Commit

Permalink
Framework Fİx
Browse files Browse the repository at this point in the history
  • Loading branch information
hasirciogli committed Jul 29, 2023
1 parent 1d3a0ec commit 1893e28
Show file tree
Hide file tree
Showing 22 changed files with 959 additions and 959 deletions.
84 changes: 42 additions & 42 deletions app/Configs/Config.php → app/configs/config.php
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
<?php

define("configs_site_rootfolder", $_SERVER["DOCUMENT_ROOT"]);



define("configs_framework_version", "2.6"); // I forget to commit between V1 and V2 with sub verisons
define("configs_site_version", "xxxxx"); // Like 1.0 or 1.1 or 1.2 or .... 9.16.8


define("configs_db_host", "db_host");
define("configs_db_username", "db_user");
define("configs_db_name", "db_name");
define("configs_db_password", "db_pass");

define("configs_mail_host", "mail..com");
define("configs_mail_username", "admin@.com");
define("configs_mail_from", "admin@.com");
define("configs_mail_sender", ".com");
define("configs_mail_port", 587);
define("configs_mail_password", "");


define("configs_host_domain", $_SERVER["HTTP_HOST"] ?? "fframework");
define("configs_host_ssl", $_SERVER["REQUEST_SCHEME"] ?? "http");

define("configs_site_favicon", '<link rel="icon" href="'. configs_host_ssl . '://' . configs_host_domain . '/storage/favicon.ico" type="image/x-icon">');

define("configs_host_full", configs_host_ssl . "://" . configs_host_domain);


define("configs_api_prefix", "api");



define("framework_is_debug_mode", true);


define("configs_site_jquery", '<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.0/dist/jquery.min.js"></script>');
define("configs_site_tailwind", '<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp"></script>');
define("configs_site_ionicicons", '<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script> <script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>');

<?php

define("configs_site_rootfolder", $_SERVER["DOCUMENT_ROOT"]);



define("configs_framework_version", "2.6"); // I forget to commit between V1 and V2 with sub verisons
define("configs_site_version", "xxxxx"); // Like 1.0 or 1.1 or 1.2 or .... 9.16.8


define("configs_db_host", "db_host");
define("configs_db_username", "db_user");
define("configs_db_name", "db_name");
define("configs_db_password", "db_pass");

define("configs_mail_host", "mail..com");
define("configs_mail_username", "admin@.com");
define("configs_mail_from", "admin@.com");
define("configs_mail_sender", ".com");
define("configs_mail_port", 587);
define("configs_mail_password", "");


define("configs_host_domain", $_SERVER["HTTP_HOST"] ?? "fframework");
define("configs_host_ssl", $_SERVER["REQUEST_SCHEME"] ?? "http");

define("configs_site_favicon", '<link rel="icon" href="'. configs_host_ssl . '://' . configs_host_domain . '/storage/favicon.ico" type="image/x-icon">');

define("configs_host_full", configs_host_ssl . "://" . configs_host_domain);


define("configs_api_prefix", "api");



define("framework_is_debug_mode", true);


define("configs_site_jquery", '<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.0/dist/jquery.min.js"></script>');
define("configs_site_tailwind", '<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp"></script>');
define("configs_site_ionicicons", '<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script> <script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>');

?>
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<?php

namespace app\controllers;


class SessionController
{
public function Get($key){
return isset($_SESSION[$key]) ? $_SESSION[$key] : null;
//return $this->dget($key);
}

public function Set($key, $val){
$_SESSION[$key] = $val;
//return $this->dset($key, $val);
}

public function ResetSessionData() : void{
session_destroy();
//$this->RESETSESSION();
}

public static function CreateInstance(){
return new SessionController();
}
<?php

namespace app\controllers;


class SessionController
{
public function Get($key){
return isset($_SESSION[$key]) ? $_SESSION[$key] : null;
//return $this->dget($key);
}

public function Set($key, $val){
$_SESSION[$key] = $val;
//return $this->dset($key, $val);
}

public function ResetSessionData() : void{
session_destroy();
//$this->RESETSESSION();
}

public static function CreateInstance(){
return new SessionController();
}
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<?php

namespace app\controllers;

use app\database\DB;
use app\models\UserModel;

class UserController extends UserModel
{

public function createUser($name, $surname, $username, $email, $password): bool {
return DB::cfun()->insert("users", [
"user_id",
"name",
"surname",
"username",
"email",
"password"
])
->bindParam("user_id", hash("sha256", time() .pack("H*", time() .sha1(time() . $name. time() .$surname. time() .$username. time() .$email. time() .$password. time() .$password))))
->bindParam("name", $name)
->bindParam("surname", $surname)
->bindParam("username", $username)
->bindParam("email", $email)
->bindParam("password", $password)
->run() != false;
}

public static function cfun(){
return new UserController();
}
<?php

namespace app\controllers;

use app\database\DB;
use app\models\UserModel;

class UserController extends UserModel
{

public function createUser($name, $surname, $username, $email, $password): bool {
return DB::cfun()->insert("users", [
"user_id",
"name",
"surname",
"username",
"email",
"password"
])
->bindParam("user_id", hash("sha256", time() .pack("H*", time() .sha1(time() . $name. time() .$surname. time() .$username. time() .$email. time() .$password. time() .$password))))
->bindParam("name", $name)
->bindParam("surname", $surname)
->bindParam("username", $username)
->bindParam("email", $email)
->bindParam("password", $password)
->run() != false;
}

public static function cfun(){
return new UserController();
}
}
66 changes: 33 additions & 33 deletions app/FFunctions/DataLogger.php → app/ffunctions/DataLogger.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<?php

namespace app\ffunctions;

use app\database\FFDatabase;
use app\assignments\datalogger\DATALOGGER_LOG_TYPE;



class DataLogger
{
public function logData($logtype, $header, $body) : DataLogger {
switch ($logtype){
case DATALOGGER_LOG_TYPE::PAYMENT_GATES_LOG:
$logtype = 1;
break;
case DATALOGGER_LOG_TYPE::PAYMENT_REQUESTS_CREATE_LOG:
$logtype = 2;
break;
case DATALOGGER_LOG_TYPE::PAYMENT_REQUEST_PAY_LOG:
$logtype = 3;
break;
default:
$logtype = 0;
break;
}
FFDatabase::cfun()->insert("data_log",[["header", $header], ["body", $body], ["log_type", $logtype]])->run();
return $this;
}

public static function cfun(){
return new DataLogger();
}
<?php

namespace app\ffunctions;

use app\database\FFDatabase;
use app\assignments\datalogger\DATALOGGER_LOG_TYPE;



class DataLogger
{
public function logData($logtype, $header, $body) : DataLogger {
switch ($logtype){
case DATALOGGER_LOG_TYPE::PAYMENT_GATES_LOG:
$logtype = 1;
break;
case DATALOGGER_LOG_TYPE::PAYMENT_REQUESTS_CREATE_LOG:
$logtype = 2;
break;
case DATALOGGER_LOG_TYPE::PAYMENT_REQUEST_PAY_LOG:
$logtype = 3;
break;
default:
$logtype = 0;
break;
}
FFDatabase::cfun()->insert("data_log",[["header", $header], ["body", $body], ["log_type", $logtype]])->run();
return $this;
}

public static function cfun(){
return new DataLogger();
}
}
68 changes: 34 additions & 34 deletions app/FFunctions/ErrorHandler.php → app/ffunctions/ErrorHandler.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
<?php

namespace app\ffunctions;


//$BaseErrorHandler = new ErrorHandler(); // error handled disabled bcs have an error in this page;
//$BaseErrorHandler->initHandler();

class ErrorHandler
{
public static function handleErrors($errorNumber, $errorMessage, $errorFile, $errorLine)
{
// Loglama veya Slack gibi bir hizmete hata bilgilerini gönderme işlemleri burada yapılır.
// Örneğin, error_log() işlevini kullanarak hataları loglama yapabilirsiniz.

$logMessage = "Hata: $errorMessage at $errorFile line $errorLine";
error_log($logMessage);

die($logMessage);

// Slack gibi bir hizmete hata bildirimi göndermek için gerekli kodları buraya ekleyebilirsiniz.
}

public static function handleExceptions($exception)
{
// Loglama veya Slack gibi bir hizmete istisna bilgilerini gönderme işlemleri burada yapılır.
// Örneğin, error_log() işlevini kullanarak istisnaları loglama yapabilirsiniz.

$logMessage = "İstisna: " . $exception->getMessage() . " at " . $exception->getFile() . " line " . $exception->getLine();
error_log($logMessage);
die($logMessage);

// Slack gibi bir hizmete istisna bildirimi göndermek için gerekli kodları buraya ekleyebilirsiniz.
}
<?php

namespace app\ffunctions;


//$BaseErrorHandler = new ErrorHandler(); // error handled disabled bcs have an error in this page;
//$BaseErrorHandler->initHandler();

class ErrorHandler
{
public static function handleErrors($errorNumber, $errorMessage, $errorFile, $errorLine)
{
// Loglama veya Slack gibi bir hizmete hata bilgilerini gönderme işlemleri burada yapılır.
// Örneğin, error_log() işlevini kullanarak hataları loglama yapabilirsiniz.

$logMessage = "Hata: $errorMessage at $errorFile line $errorLine";
error_log($logMessage);

die($logMessage);

// Slack gibi bir hizmete hata bildirimi göndermek için gerekli kodları buraya ekleyebilirsiniz.
}

public static function handleExceptions($exception)
{
// Loglama veya Slack gibi bir hizmete istisna bilgilerini gönderme işlemleri burada yapılır.
// Örneğin, error_log() işlevini kullanarak istisnaları loglama yapabilirsiniz.

$logMessage = "İstisna: " . $exception->getMessage() . " at " . $exception->getFile() . " line " . $exception->getLine();
error_log($logMessage);
die($logMessage);

// Slack gibi bir hizmete istisna bildirimi göndermek için gerekli kodları buraya ekleyebilirsiniz.
}
}
46 changes: 23 additions & 23 deletions app/FFunctions/FCrypter.php → app/ffunctions/FCrypter.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php

namespace app\ffunctions;


class FCrypter
{
private $cipher = "";
private $passSalt = "";

public function getEncrypt($data){

return @openssl_encrypt($data, $this->cipher, $this->passSalt, $options=0, 123);
}

public function getDecrypt($data){

return @openssl_decrypt($data, $this->cipher, $this->passSalt, $options=0, 123);
}

public static function get() {
return new FCrypter();
}
<?php

namespace app\ffunctions;


class FCrypter
{
private $cipher = "";
private $passSalt = "";

public function getEncrypt($data){

return @openssl_encrypt($data, $this->cipher, $this->passSalt, $options=0, 123);
}

public function getDecrypt($data){

return @openssl_decrypt($data, $this->cipher, $this->passSalt, $options=0, 123);
}

public static function get() {
return new FCrypter();
}
}
Loading

0 comments on commit 1893e28

Please sign in to comment.