forked from NeptuneFW/NeptuneFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
68 changed files
with
5,509 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Options -Multiviews | ||
Options +FollowSymLinks | ||
|
||
RewriteEngine On | ||
|
||
RewriteCond %{REQUEST_FILENAME} !-d | ||
RewriteCond %{REQUEST_FILENAME} !-f | ||
|
||
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,286 @@ | ||
<?php | ||
|
||
//#!/usr/bin/php | ||
//#!/usr/bin/env php | ||
|
||
require "triton/TritonConsoleInterface.php"; | ||
require "triton/triton.php"; | ||
require "libs/connect/connect.php"; | ||
|
||
function readlineTriton($prompt = null){ | ||
if($prompt){ | ||
echo $prompt; | ||
} | ||
$fp = fopen("php://stdin","r"); | ||
$line = rtrim(fgets($fp, 1024)); | ||
return $line; | ||
} | ||
|
||
if($argv[1] == 'create:tableFile') { | ||
$database = ucfirst($argv[2]); | ||
$table = ucfirst($argv[3]); | ||
if(!file_exists('database/databases/' . $database . '/' . $table . 'Table.php')) { | ||
|
||
$tableFileContent = ' | ||
<?php | ||
/** | ||
* Created by Neptune Framework. | ||
* User: Triton | ||
*/ | ||
|
||
class '.$table.'Table | ||
{ | ||
|
||
public function table($table) { | ||
|
||
// Write your table columns... Documentation : neptunefw.org | ||
|
||
return $table; | ||
|
||
} | ||
|
||
} | ||
|
||
'; | ||
|
||
file_put_contents('database/databases/' . $database . '/' . $table . 'Table.php', $tableFileContent); | ||
|
||
if(file_exists('database/databases/' . $database . '/' . $table . 'Table.php')) { | ||
|
||
if(file_get_contents('database/databases/' . $database . '/' . $table . 'Table.php', $tableFileContent) == $tableFileContent) | ||
{ | ||
echo "\r\ndatabase/databases/" . $database . "/" . $table . "Table.php Table file created. \r\ndatabase/databases/" . $database . "/" . $table . "Table.php Tablo dosyası oluşturuldu. \r\n"; | ||
} else { | ||
echo "\r\nTable file created. However, a problem was encountered. \r\nTablo dosyası oluşturuldu. Ancak bir sorunla karşılaşıldı.\r\n"; | ||
} | ||
} else { | ||
|
||
echo "\r\nTable file could not be created. \r\nTablo dosyası oluşturulamadı.\r\n"; | ||
|
||
} | ||
} else { | ||
|
||
echo "\r\ndatabase/databases/" . $database . "/" . $table . "Table.php This table file already exists. Action canceled. \r\n"; | ||
echo "database/databases/" . $database . "/" . $table . "Table.php Bu tablo dosyası zaten var. İşlem iptal edildi. \r\n"; | ||
|
||
} | ||
|
||
|
||
} | ||
else if($argv[1] == 'create:table') { | ||
|
||
$database = ucfirst($argv[2]); | ||
$table = ucfirst($argv[3]); | ||
|
||
$connectionSettings = file_get_contents("database/databases/". $database . "/connection.ntconfig"); | ||
|
||
eval("\$connectionSettings = " .$connectionSettings); | ||
|
||
unlink("database/databases/" . $database . "/lock.nt"); | ||
|
||
Libs\Connect\Connect::Database($database, $connectionSettings["host"], $connectionSettings["user"], $connectionSettings['pass']); | ||
|
||
$tConsole = new TritonConsoleInterface($database, $connectionSettings["host"], $connectionSettings["user"], $connectionSettings['pass']); | ||
|
||
$value = __DIR__ . "/Database/Databases/" . $database ."/" . $table . "Table.php"; | ||
|
||
$tConsole->createTable($value, $database); | ||
|
||
} | ||
else if($argv[1] == 'rename:table') { | ||
$database = $argv[2]; | ||
$tableOldName = $argv[3]; | ||
$tableNewName = $argv[4]; | ||
rename("database/databases/". $database . "/" . ucfirst($tableOldName) . "Table.php","database/databases/". $database . "/" . ucfirst($tableNewName) . "Table.php"); | ||
|
||
$tableFileNewContent = preg_replace("(class ".ucfirst($tableOldName)."Table)", "class " . ucfirst($tableNewName) . "Table",file_get_contents('database/databases/'. $database . '/' . ucfirst($tableNewName) . "Table.php")); | ||
file_put_contents("database/databases/". $database . "/" . ucfirst($tableNewName) . "Table.php", $tableFileNewContent); | ||
|
||
$connectionSettings = file_get_contents("database/databases/". $database . "/connection.ntconfig"); | ||
|
||
eval("\$connectionSettings = " .$connectionSettings); | ||
|
||
try { | ||
$pdoConnection = new PDO("mysql:host=" . $connectionSettings["host"] . ";dbname=" . $database, $connectionSettings['user'], $connectionSettings['pass']); | ||
} catch (PDOException $e) { | ||
|
||
echo "Üzgünüz... Veritabanı bağlantısı sırasında hata oluştu. Lütfen bağlantı bilgilerinizin doğruluğunu kontrol ediniz <br/> \r\n"; | ||
echo "Başarılı bir veritabanı bağlantısı olmadığı için Triton devam edemiyor <br/> \r\n"; | ||
echo "Detaylı Bilgi : <br/> " . $e->getMessage() . " \r\n"; | ||
die(); | ||
|
||
} | ||
|
||
$pdoConnection->exec("RENAME TABLE ".$tableOldName." TO ".$tableNewName." "); | ||
|
||
} | ||
else if($argv[1] == 'rename:tableColumn') { | ||
|
||
$database = ucfirst($argv[2]); | ||
$table = ucfirst($argv[3]); | ||
$columnOldName = $argv[4]; | ||
$columnNewName = $argv[5]; | ||
|
||
$connectionSettings = file_get_contents("database/databases/". $database . "/connection.ntconfig"); | ||
|
||
eval("\$connectionSettings = " .$connectionSettings); | ||
|
||
try { | ||
$pdoConnection = new PDO("mysql:host=" . $connectionSettings["host"] . ";dbname=" . $database, $connectionSettings['user'], $connectionSettings['pass']); | ||
} catch (PDOException $e) { | ||
|
||
echo "Üzgünüz... Veritabanı bağlantısı sırasında hata oluştu. Lütfen bağlantı bilgilerinizin doğruluğunu kontrol ediniz <br/> \r\n"; | ||
echo "Başarılı bir veritabanı bağlantısı olmadığı için Triton devam edemiyor <br/> \r\n"; | ||
echo "Detaylı Bilgi : <br/> " . $e->getMessage() . " \r\n"; | ||
die(); | ||
|
||
} | ||
|
||
$showColumns = $pdoConnection->prepare("SHOW COLUMNS FROM " . $table); | ||
$showColumns->execute(); | ||
$columns = $showColumns->fetchAll(); | ||
foreach ($columns as $column) { | ||
if(array_search($columnOldName, $column)){ | ||
|
||
var_dump($column); | ||
|
||
$query = $pdoConnection->exec("ALTER TABLE " . $table . " CHANGE " . $columnOldName . " " . $columnNewName . " " . $column['Type'] . " " . $column['Extra']); | ||
|
||
$tConsole = new TritonConsoleInterface($database, $connectionSettings['host'], $connectionSettings['user'], $connectionSettings['pass']); | ||
|
||
$tConsole->createTableFile($table, $database); | ||
|
||
echo "\r\nCreated files.\r\nDosyalar oluşturuldu. \r\n"; | ||
echo "\r\nThe query was run.\r\nSorgu çalıştırıldı. \r\n"; | ||
|
||
|
||
} | ||
|
||
} | ||
|
||
} | ||
else if($argv[1] == 'delete:tableColumn') { | ||
|
||
$database = ucfirst($argv[2]); | ||
$table = ucfirst($argv[3]); | ||
$columnName = $argv[4]; | ||
|
||
$connectionSettings = file_get_contents("database/databases/". $database . "/connection.ntconfig"); | ||
|
||
eval("\$connectionSettings = " .$connectionSettings); | ||
|
||
try { | ||
$pdoConnection = new PDO("mysql:host=" . $connectionSettings["host"] . ";dbname=" . $database, $connectionSettings['user'], $connectionSettings['pass']); | ||
} catch (PDOException $e) { | ||
|
||
echo "Üzgünüz... Veritabanı bağlantısı sırasında hata oluştu. Lütfen bağlantı bilgilerinizin doğruluğunu kontrol ediniz <br/> \r\n"; | ||
echo "Başarılı bir veritabanı bağlantısı olmadığı için Triton devam edemiyor <br/> \r\n"; | ||
echo "Detaylı Bilgi : <br/> " . $e->getMessage() . " \r\n"; | ||
die(); | ||
|
||
} | ||
|
||
$query = $pdoConnection->exec("ALTER TABLE " . $table . " DROP COLUMN " . $columnName . " "); | ||
|
||
$tConsole = new TritonConsoleInterface($database, $connectionSettings['host'], $connectionSettings['user'], $connectionSettings['pass']); | ||
|
||
$tConsole->createTableFile($table, $database); | ||
|
||
echo "\r\nCreated files.\r\nDosyalar oluşturuldu. \r\n"; | ||
echo "\r\nThe query was run.\r\nSorgu çalıştırıldı. \r\n"; | ||
|
||
|
||
|
||
} | ||
else if($argv[1] == 'create:tables') { | ||
$database = $argv[2]; | ||
|
||
$connectionSettings = file_get_contents("database/databases/". $database . "/connection.ntconfig"); | ||
|
||
eval("\$connectionSettings = " .$connectionSettings); | ||
|
||
try { | ||
$pdoConnection = new PDO("mysql:host=" . $connectionSettings["host"] . ";dbname=" . $database, $connectionSettings['user'], $connectionSettings['pass']); | ||
} catch (PDOException $e) { | ||
|
||
echo "Üzgünüz... Veritabanı bağlantısı sırasında hata oluştu. Lütfen bağlantı bilgilerinizin doğruluğunu kontrol ediniz <br/> \r\n"; | ||
} | ||
$tConsole = new TritonConsoleInterface($database, $connectionSettings['host'], $connectionSettings['user'], $connectionSettings['pass']); | ||
$tConsole->createTableFiles($database); | ||
|
||
|
||
} | ||
else if($argv[1] == 'delete:table') { | ||
|
||
$database = ucfirst($argv[2]); | ||
$table = ucfirst($argv[3]); | ||
|
||
$line = readlineTriton("Do yo want delete table? (Y/N) \r\nTurkish : Tabloyu silmek istediğine emin misin? (Y/N): "); | ||
var_dump($line); | ||
|
||
if($line == 'Y') { | ||
|
||
unlink("database/databases/" . $database . "/" . $table . "Table.php"); | ||
|
||
$connectionSettings = file_get_contents("database/databases/". $database . "/connection.ntconfig"); | ||
|
||
eval("\$connectionSettings = " .$connectionSettings); | ||
|
||
try { | ||
$pdoConnection = new PDO("mysql:host=" . $connectionSettings["host"] . ";dbname=" . $database, $connectionSettings['user'], $connectionSettings['pass']); | ||
} catch (PDOException $e) { | ||
|
||
echo "Üzgünüz... Veritabanı bağlantısı sırasında hata oluştu. Lütfen bağlantı bilgilerinizin doğruluğunu kontrol ediniz <br/> \r\n"; | ||
echo "Başarılı bir veritabanı bağlantısı olmadığı için Triton devam edemiyor <br/> \r\n"; | ||
echo "Detaylı Bilgi : <br/> " . $e->getMessage() . " \r\n"; | ||
die(); | ||
|
||
} | ||
|
||
$pdoConnection->exec("DROP TABLE ". $table ); | ||
|
||
} | ||
else if($line == 'N') { | ||
|
||
echo "Process canceled. İşlem iptal edildi. "; | ||
} | ||
|
||
} | ||
else if($argv[1] == 'clean:table') { | ||
|
||
$database = ucfirst($argv[2]); | ||
$table = ucfirst($argv[3]); | ||
|
||
$line = readlineTriton("Are you sure you want to empty the chart? (Y/N) \r\nTabloyu boşaltmak istediğinizden emin misiniz? (Y/N): "); | ||
|
||
if($line == 'Y') { | ||
|
||
$connectionSettings = file_get_contents("database/databases/". $database . "/connection.ntconfig"); | ||
|
||
eval("\$connectionSettings = " .$connectionSettings); | ||
|
||
try { | ||
$pdoConnection = new PDO("mysql:host=" . $connectionSettings["host"] . ";dbname=" . $database, $connectionSettings['user'], $connectionSettings['pass']); | ||
} catch (PDOException $e) { | ||
|
||
echo "Üzgünüz... Veritabanı bağlantısı sırasında hata oluştu. Lütfen bağlantı bilgilerinizin doğruluğunu kontrol ediniz <br/> \r\n"; | ||
echo "Başarılı bir veritabanı bağlantısı olmadığı için Triton devam edemiyor <br/> \r\n"; | ||
echo "Detaylı Bilgi : <br/> " . $e->getMessage() . " \r\n"; | ||
die(); | ||
|
||
} | ||
|
||
$pdoConnection->exec("TRUNCATE ". $table ); | ||
echo "\r\nThe query was run.\r\nSorgu çalıştırıldı. \r\n"; | ||
|
||
} | ||
else if($line == 'N') { | ||
|
||
echo "Process canceled. İşlem iptal edildi. "; | ||
} | ||
|
||
} | ||
else | ||
{ | ||
echo '"'. $argv[1] .'" is not recognized.'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace App\development\Http\Controller; | ||
|
||
/** | ||
* Created by PhpStorm. | ||
* User: Peker | ||
* Date: 11.04.2017 | ||
* Time: 13:54 | ||
*/ | ||
class Home | ||
{ | ||
|
||
|
||
public static function index() | ||
{ | ||
echo "Welcome to Development Area"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Peker | ||
* Date: 11.04.2017 | ||
* Time: 13:54 | ||
*/ | ||
$route->get("/", "Home@index"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace App\Production\Http\Controller; | ||
|
||
use Libs\Connect\Connect; | ||
use Libs\Languages; | ||
use Tarvos\Tarvos; | ||
|
||
class Home | ||
{ | ||
use \System\Core; | ||
|
||
public function index() | ||
{ | ||
echo "Neptune Framework is being developed"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Peker | ||
* Date: 11.04.2017 | ||
* Time: 13:01 | ||
*/ | ||
|
||
|
||
$route->get("/", [ 'call' => 'Home@index', 'nickname' => 'home']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"autoload": { | ||
"psr-4": { | ||
"System\\": "system", | ||
"Libs\\": "libs", | ||
"Triton\\": "triton", | ||
"Tarvos\\": "tarvos", | ||
"Database\\" : "database" | ||
} | ||
}, | ||
"require": { | ||
"phpmailer/phpmailer": "^5.2" | ||
} | ||
} |
Oops, something went wrong.