Test sur la création des modules par une commande console -> OK!
Test sur une api rest -> OK! Test sur le deplacement d'une autre page de compte -> OK! TODO: créé les pages de blog (sommaire,news) permettant d'afficher les fichiers md TODO: finir créer les commandes pour l'ajout de modules
This commit is contained in:
parent
56926af2d9
commit
2b6ac77922
|
@ -2,6 +2,8 @@
|
|||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/application/modules/phplist" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/application/modules/prestashop" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/application/modules/wordpress" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -15,6 +15,7 @@ class Application
|
|||
public function __construct(){
|
||||
$this->http = new HttpMethod();
|
||||
$this->browser = new Browser();
|
||||
|
||||
$this->url = new Url($this->http->method, $this->browser->isAppRequest());
|
||||
|
||||
$dispacher = new Dispacher();
|
||||
|
|
|
@ -14,6 +14,7 @@ class Browser
|
|||
{
|
||||
$this->userAgent = $_SERVER['HTTP_USER_AGENT'];
|
||||
$this->user = $this->get_browser_name();
|
||||
//Logger::addLog('http.browser',$this->user);
|
||||
}
|
||||
|
||||
protected function get_browser_name()
|
||||
|
|
|
@ -16,11 +16,10 @@ class Controlleur{
|
|||
case 'POST':
|
||||
case 'GET':
|
||||
if ($application->browser->isAppRequest()) {
|
||||
require CONTROLLER_PATH . DIRECTORY_SEPARATOR . $application->url->page['name'] . 'HttpReponse.php';
|
||||
require $application->url->pageFile;
|
||||
$this->callHttpResponse($application);
|
||||
break;
|
||||
die();
|
||||
}
|
||||
|
||||
default:
|
||||
if ($application->route != NULL) {
|
||||
$conduit = explode('::', $application->route['controller']);
|
||||
|
@ -57,6 +56,8 @@ class Controlleur{
|
|||
$reponse->instanciate($application->url, $application->http->getData());
|
||||
$method = strtolower($application->http->method);
|
||||
|
||||
Logger::addLog('http11'," $reponseHttp app {$application->http->method} request! ( ".get_class($reponse)."->$method() )");
|
||||
|
||||
$this->vue = new VueVide();
|
||||
$this->vue->ecran = $reponse->$method();
|
||||
return;
|
||||
|
|
|
@ -13,6 +13,7 @@ class HttpMethod
|
|||
public function __construct()
|
||||
{
|
||||
$this->method = $_SERVER['REQUEST_METHOD'];
|
||||
Logger::addLog('http.method',$this->method);
|
||||
$this->acceptResponse();
|
||||
}
|
||||
|
||||
|
|
|
@ -132,19 +132,30 @@ class HttpMethodRequete
|
|||
// return true;
|
||||
// }
|
||||
|
||||
$curl_cmd = "curl -i -X $this->method -H 'Content-Type: application/json' -d '$this->content' $this->url";
|
||||
|
||||
|
||||
$curl_cmd = "curl -i -k -X $this->method -H 'Content-Type: application/json' -d '$this->content' $this->url";
|
||||
|
||||
/** Pour utiliser ce code il faut utiliser la variable curl.cainfo dans php.ini */
|
||||
Logger::addLog('curl', $curl_cmd);
|
||||
|
||||
$curl = curl_init($this->url);
|
||||
/*$curl = curl_init($this->url);
|
||||
//curl_setopt($curl, CURLOPT_HEADER, false);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl,CURLOPT_SSL_ENABLE_NPN,false);
|
||||
curl_setopt($curl,CURLOPT_SSL_ENABLE_ALPN,false);
|
||||
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false);
|
||||
curl_setopt($curl,CURLOPT_SSL_VERIFYSTATUS,false);
|
||||
curl_setopt($curl,CURLOPT_PROXY_SSL_VERIFYPEER,false);
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $this->method);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($this->data));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
curl_close($curl);*/
|
||||
|
||||
$response = exec($curl_cmd);
|
||||
|
||||
Logger::addLog('curl.response', $response);
|
||||
|
||||
if (!$response) {
|
||||
return false;
|
||||
|
|
|
@ -15,6 +15,7 @@ class Logger
|
|||
$browser = new Browser();
|
||||
$date = date("F j, Y, g:i a");
|
||||
$what = PHP_EOL . '[' . $date . ' by ' . $browser->user . ']' . PHP_EOL . $browser->userAgent . PHP_EOL . $what;
|
||||
//$what = PHP_EOL . '[' . $date . ' by ]' . PHP_EOL . $what;
|
||||
if (is_file($file)) {
|
||||
file_put_contents($file, PHP_EOL . $what, FILE_APPEND | LOCK_EX);
|
||||
} else {
|
||||
|
|
|
@ -51,7 +51,18 @@ class Modular{
|
|||
default:
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case "phplist":
|
||||
if(isset($options[0])) {
|
||||
switch ($options[0]) {
|
||||
case 'admin':
|
||||
$this->subapp_dir = DIRECTORY_SEPARATOR . 'public_html' . DIRECTORY_SEPARATOR . 'lists'. DIRECTORY_SEPARATOR . $options[0] ;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}else{
|
||||
$this->subapp_dir = DIRECTORY_SEPARATOR . 'public_html' . DIRECTORY_SEPARATOR . 'lists';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -71,6 +82,9 @@ class Modular{
|
|||
case "prestashop":
|
||||
require MODULES_PATH . DIRECTORY_SEPARATOR . $this->getAppName() . $this->subapp_dir . DIRECTORY_SEPARATOR . "index.php";
|
||||
break;
|
||||
case "phplist":
|
||||
require MODULES_PATH . DIRECTORY_SEPARATOR . $this->getAppName() . $this->subapp_dir . DIRECTORY_SEPARATOR . "index.php";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,6 +12,11 @@ class Session
|
|||
session_start();
|
||||
return;
|
||||
}
|
||||
static public function destroy()
|
||||
{
|
||||
session_destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
static public function setUserProfile($userProfile)
|
||||
{
|
||||
|
@ -48,7 +53,16 @@ class Session
|
|||
static public function isRegistered()
|
||||
{
|
||||
if (isset($_SESSION['userProfile'])) {
|
||||
return;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static public function redirectIfNotRegistered()
|
||||
{
|
||||
if (isset($_SESSION['userProfile'])) {
|
||||
return ;
|
||||
} else {
|
||||
header("location : " . Url::link_rewrite(false, 'error', []));
|
||||
die('Ooops, something was wrong...');
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace MVC\Classe;
|
|||
class Url
|
||||
{
|
||||
public $page;
|
||||
public $pageFile;
|
||||
public $registre;
|
||||
|
||||
|
||||
|
@ -38,6 +39,12 @@ class Url
|
|||
$page['name'] = 'accueil';
|
||||
}
|
||||
|
||||
//il se peut que l'on ait des variable avec ? dans l'url
|
||||
$urlQuery = explode('?' , $page['name'] );
|
||||
$page['name'] = $urlQuery[0];
|
||||
|
||||
$page['name'] = strtolower($page['name']);
|
||||
|
||||
if($page['name'] == 'control'){
|
||||
$page['control'] = true;
|
||||
($urlParts[1] == 'index' || $urlParts[1] == '' ) ? $page['name']='accueil' : $page['name']=$urlParts[1];
|
||||
|
@ -91,6 +98,8 @@ class Url
|
|||
}
|
||||
}
|
||||
}
|
||||
$page['name'] = lcfirst($page['name']);
|
||||
$pageFile = CONTROLLERS_PATH . DIRECTORY_SEPARATOR . $page['name'] . '.php';
|
||||
//verification de l'existence de la page dans les controlleurs
|
||||
if($page['control']){
|
||||
$pageFile = TRAITEMENT_PATH . DIRECTORY_SEPARATOR . $page['name'] . '.php';
|
||||
|
@ -124,6 +133,7 @@ class Url
|
|||
}
|
||||
}
|
||||
$this->page = $page;
|
||||
$this->pageFile = $pageFile;
|
||||
|
||||
}
|
||||
|
||||
|
@ -136,6 +146,15 @@ class Url
|
|||
}
|
||||
}
|
||||
|
||||
static public function module_link_rewrite($page, $params = array())
|
||||
{
|
||||
$stringParams = '';
|
||||
foreach ($params as $values) {
|
||||
$stringParams .= "/" . $values;
|
||||
}
|
||||
return '/' . $page . $stringParams;
|
||||
}
|
||||
|
||||
static private function link_rewrite_slashParam($page, $params = array())
|
||||
{
|
||||
$stringParams = '';
|
||||
|
|
|
@ -10,10 +10,10 @@ class Vue{
|
|||
public $ecran;
|
||||
public $block_body;
|
||||
|
||||
public function __construct($baseControlleur){
|
||||
public function __construct($application){
|
||||
|
||||
$templateData = array();
|
||||
extract( $baseControlleur->modele->page );
|
||||
extract( $application->modele->page );
|
||||
|
||||
ob_start();
|
||||
if(file_exists(VIEW_PATH.DIRECTORY_SEPARATOR."view".DIRECTORY_SEPARATOR.$name.".blade.php")) {
|
||||
|
@ -30,7 +30,7 @@ class Vue{
|
|||
$renderer = new \Windwalker\Renderer\BladeRenderer($paths, array('cache_path' => VIEW_PATH . DIRECTORY_SEPARATOR . "cache"));
|
||||
|
||||
//de base on ajoute les parametres du .model et ceux provenant de l'url
|
||||
foreach ($baseControlleur->modele->page as $key => $value) {
|
||||
foreach ($application->modele->page as $key => $value) {
|
||||
$templateData[$key] = $value;
|
||||
}
|
||||
echo $renderer->render($name, $templateData);
|
||||
|
|
|
@ -9,4 +9,6 @@ define("ACTION_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIREC
|
|||
define("MODELS_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "modeles");
|
||||
define("VIEW_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "vues");
|
||||
define("CONTROLLER_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "controlleurs");
|
||||
define("TRAITEMENT_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "traitements");
|
||||
define("TRAITEMENT_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "traitements");
|
||||
define("PUBLIC_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "public");
|
||||
define("CONSOLE_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "console");
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use MVC\Classe\Dumper;
|
||||
use MVC\Classe\HttpMethodRequete;
|
||||
use MVC\Classe\Implement\Action;
|
||||
use MVC\Classe\Url;
|
||||
|
@ -57,11 +58,12 @@ class DefaultAction extends Action
|
|||
{
|
||||
|
||||
$data = array('myval' => 25);
|
||||
|
||||
//Dumper::dump($data);
|
||||
\MVC\Classe\Logger::addLog('action','http11 make request');
|
||||
$request = new HttpMethodRequete();
|
||||
//$request->setUrl(Url::absolute_link_rewrite(false,'accueil',['var10'=>'val10']))->get($data);
|
||||
//$request->setUrl(Url::absolute_link_rewrite(false,'accueil',['var10'=>'val10']))->post($data);
|
||||
$request->setUrl(Url::absolute_link_rewrite(false,'accueil',['var10'=>'val10']))->get($data);
|
||||
$request->setUrl(Url::absolute_link_rewrite(false,'accueil',['var10'=>'val10']))->post($data);
|
||||
$request->setUrl(Url::absolute_link_rewrite(false, 'accueil', ['var10' => 'val10']))->put($data);
|
||||
//$request->setUrl(Url::absolute_link_rewrite(false,'accueil',['var10'=>'val10']))->delete($data);
|
||||
$request->setUrl(Url::absolute_link_rewrite(false,'accueil',['var10'=>'val10']))->delete($data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class AccueilHttpReponse extends RestReponse
|
|||
Dumper::dump($this->params);
|
||||
Dumper::dump($this->data);
|
||||
$text = ob_get_clean();
|
||||
Logger::addLog('put', '____Hello Put____' . PHP_EOL . $text);
|
||||
Logger::addLog('http11.put', '____Hello Put____' . PHP_EOL . $text);
|
||||
}
|
||||
public function delete()
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ class AccueilHttpReponse extends RestReponse
|
|||
Dumper::dump($this->params);
|
||||
Dumper::dump($this->data);
|
||||
$text = ob_get_clean();
|
||||
Logger::addLog('delete', '____Hello Delete:____' . PHP_EOL . $text);
|
||||
Logger::addLog('http11.delete', '____Hello Delete:____' . PHP_EOL . $text);
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class AccueilHttpReponse extends RestReponse
|
|||
Dumper::dump($this->params);
|
||||
Dumper::dump($this->data);
|
||||
$text = ob_get_clean();
|
||||
Logger::addLog('get', '____Hello GET____' . PHP_EOL . $text);
|
||||
Logger::addLog('http11.get', '____Hello GET____' . PHP_EOL . $text);
|
||||
}
|
||||
|
||||
public function post()
|
||||
|
@ -40,6 +40,6 @@ class AccueilHttpReponse extends RestReponse
|
|||
Dumper::dump($this->params);
|
||||
Dumper::dump($this->data);
|
||||
$text = ob_get_clean();
|
||||
Logger::addLog('post', '____Hello POST____' . PHP_EOL . $text);
|
||||
Logger::addLog('http11.post', '____Hello POST____' . PHP_EOL . $text);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,12 @@
|
|||
<?php
|
||||
|
||||
|
||||
use MVC\Classe\Dumper;
|
||||
use MVC\Classe\Logger;
|
||||
|
||||
//Dumper::dump($_SESSION);
|
||||
|
||||
\MVC\Classe\ControlleurAction::inserer('default.makeHttp11',[]);
|
||||
|
||||
$templateData = array("templating_a"=>'blade',"templating_b"=>'twig',"templating_c"=>'edge');
|
||||
Logger::addLog('ok', 'Hello world');
|
|
@ -21,6 +21,7 @@ try {
|
|||
// Store the provider for the callback event
|
||||
$storage->set('provider', $url_params['provider']);
|
||||
\MVC\Classe\Session::setStorage($storage);
|
||||
\MVC\Classe\Session::setUserProfile(array());
|
||||
} else {
|
||||
$error = $url_params['provider'];
|
||||
}
|
||||
|
@ -39,51 +40,13 @@ try {
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Handle invalid provider errors
|
||||
//
|
||||
if ($error !== false) {
|
||||
error_log('HybridAuth Error: Provider ' . json_encode($error) . ' not found or not enabled in $config');
|
||||
// Close the pop-up window
|
||||
echo "
|
||||
<script>
|
||||
window.opener.location.reload();
|
||||
window.close();
|
||||
</script>";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Event 3: Provider returns via CALLBACK
|
||||
//
|
||||
if ($url_params['provider'] = $storage->get('provider')) {
|
||||
|
||||
|
||||
\MVC\Classe\Session::setHybridAuth($hybridauth);
|
||||
$hybridauth->authenticate($url_params['provider']);
|
||||
//Suite à l'authentification il ne permet plus de modifier la page il redirige directement sur le callback
|
||||
|
||||
/*
|
||||
// Retrieve the provider record
|
||||
$adapter = $hybridauth->getAdapter($url_params['provider']);
|
||||
|
||||
\MVC\Classe\Session::setUserProfile($adapter->getUserProfile());
|
||||
\MVC\Classe\Session::setToken($adapter->getAccessToken());
|
||||
|
||||
$compte = $config['callback'];
|
||||
// Close pop-up window
|
||||
echo <<<EOD
|
||||
|
||||
<script>
|
||||
window.opener.location.href = '$compte';
|
||||
window.close();
|
||||
</script>
|
||||
EOD;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
echo <<<EOD
|
||||
$cgu = <<<EOD
|
||||
Conditions Générale de l'application:
|
||||
|
||||
1. Cette application est en phase de test et n'est qu'un test.
|
||||
|
@ -10,3 +10,5 @@ Conditions Générale de l'application:
|
|||
|
||||
EOD;
|
||||
|
||||
|
||||
$templateData['cgu'] = $cgu;
|
|
@ -1,26 +1,21 @@
|
|||
<?php
|
||||
|
||||
use MVC\Classe\Dumper;
|
||||
|
||||
\MVC\Classe\Session::start();
|
||||
//\MVC\Classe\Session::isregistered();
|
||||
\MVC\Classe\Session::redirectIfNotRegistered();
|
||||
|
||||
require CONFIG_PATH . DIRECTORY_SEPARATOR . "authentification-config-example.php";
|
||||
|
||||
$hybridauth = new Hybridauth\Hybridauth($config);
|
||||
$hybridauth->authenticate(\MVC\Classe\Session::getStorage()->get('provider'));
|
||||
$adapters = $hybridauth->getConnectedAdapters();
|
||||
foreach ($adapters as $adapter){
|
||||
$userProfile[] = $adapter->getUserProfile();
|
||||
|
||||
/*$adapter = $hybridauth->getAdapter(\MVC\Classe\Session::getStorage()->get('provider'));
|
||||
}
|
||||
\MVC\Classe\Session::setUserProfile($userProfile);
|
||||
|
||||
\MVC\Classe\Dumper::dump($adapter);
|
||||
//Dumper::dump($_SESSION);
|
||||
|
||||
$isConnected = $adapter->isConnected();
|
||||
//Retrieve the user's profile
|
||||
$userProfile = $adapter->getUserProfile();
|
||||
|
||||
//Inspect profile's public attributes
|
||||
\MVC\Classe\Dumper::dump($isConnected);
|
||||
\MVC\Classe\Dumper::dump($userProfile);
|
||||
|
||||
$templateData['adapters'] = [\MVC\Classe\Session::getStorage()->get('provider')=>$adapter];
|
||||
*/
|
||||
$templateData['adapters'] = $adapters;
|
|
@ -20,27 +20,13 @@ try {
|
|||
// Disconnect the adapter
|
||||
$adapter = $hybridauth->getAdapter($url_params['logout']);
|
||||
$adapter->disconnect();
|
||||
\MVC\Classe\Session::destroy();
|
||||
header("location: ".MVC\Classe\Url::link_rewrite(false,'accueil'));
|
||||
} else {
|
||||
$error = $url_params['logout'];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Handle invalid provider errors
|
||||
//
|
||||
if ($error !== false) {
|
||||
error_log('HybridAuth Error: Provider ' . json_encode($error) . ' not found or not enabled in $config');
|
||||
// Close the pop-up window
|
||||
echo "
|
||||
<script>
|
||||
window.opener.location.reload();
|
||||
window.close();
|
||||
</script>";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log($e->getMessage());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
echo <<<EOD
|
||||
$policy = <<<EOD
|
||||
Politique Générale de Sécurité
|
||||
|
||||
1. Ce FrameWork est le fruit d'un travail personnel.
|
||||
|
@ -10,3 +10,4 @@ Politique Générale de Sécurité
|
|||
Si cela ne vous plait pas veuillez envoyer un courriel à emmanuel.roy@infoartsmedia.fr et nous en parlerons le plus calmement possible.
|
||||
EOD;
|
||||
|
||||
$templateData['policy'] = $policy;
|
|
@ -1,13 +1,3 @@
|
|||
<?php
|
||||
$app = new MVC\Classe\Modular($name,'prestashop',$url_params);
|
||||
//echo "Dawn Prestashop Error!";
|
||||
/*
|
||||
* Avoid Warning on my version ....
|
||||
*
|
||||
on application/modules/prestashop/config/config.inc.php:125
|
||||
|
||||
define('__PS_BASE_URI__', '/prestashop'.$context->shop->getBaseURI());
|
||||
|
||||
*/
|
||||
//echo $app->load('prestashop');die();
|
||||
$templateData = array('app' => $app);
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
\MVC\Classe\Session::start();
|
||||
$app = new MVC\Classe\Modular($name,'wordpress',$url_params);
|
||||
//echo "Dawn Wordpress Error!";
|
||||
/*
|
||||
* Avoid Warning on my version ....
|
||||
*
|
||||
on application/modules/wordpress/wp-admin/menu-header.php:74
|
||||
if(!is_array($menu)){$menu = array();}
|
||||
|
||||
on application/modules/wordpress/wp-admin/includes/plugin.php:2047
|
||||
|
||||
if(isset($_wp_menu_nopriv)) {
|
||||
foreach (array_keys($_wp_submenu_nopriv) as $key) {
|
||||
if (isset($_wp_submenu_nopriv[$key][$pagenow])) {
|
||||
return false;
|
||||
}
|
||||
if (isset($plugin_page) && isset($_wp_submenu_nopriv[$key][$plugin_page])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//echo $app->load('wordpress'); die();
|
||||
$templateData = array('app' => $app);
|
|
@ -1,4 +1,4 @@
|
|||
name : CGU
|
||||
name : cgu
|
||||
page_title: Conditions Générale d'Utilisation de l'application
|
||||
description : abracadabla
|
||||
params : params
|
|
@ -1,4 +1,4 @@
|
|||
name : Policy
|
||||
name : policy
|
||||
page_title: Politique de Confidentialité de l'application
|
||||
description : abracadabla
|
||||
params : params
|
|
@ -1,5 +1,5 @@
|
|||
name : prestashop
|
||||
page_title : Accueil de l'application modulaire
|
||||
description : zatou stra bracadabla
|
||||
params : params
|
||||
page_title : module_title
|
||||
description : module_description
|
||||
params : module_params
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
name : wordpress
|
||||
page_title : Accueil de l'application modulaire
|
||||
description : zatou stra bracadabla
|
||||
params : params
|
|
@ -5,10 +5,20 @@
|
|||
@section('sidebar')
|
||||
This is the master sidebar.
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'accueil', []) }}">Homepage</a>
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'prestashop', []) }}">Prestashop</a>
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'wordpress', []) }}">Wordpress</a>
|
||||
@if (\MVC\Classe\Session::isRegistered())
|
||||
<a href="{{ \MVC\Classe\Url::module_link_rewrite( 'prestashop', ['admin-dev']) }}">E-commerce</a>
|
||||
<a href="{{ \MVC\Classe\Url::module_link_rewrite( 'wordpress', ['wp-admin']) }}">Blog</a>
|
||||
<a href="{{ \MVC\Classe\Url::module_link_rewrite( 'phplist', ['admin']) }}">Newsletter</a>
|
||||
@else
|
||||
<a href="{{ \MVC\Classe\Url::module_link_rewrite( 'prestashop', ['']) }}">E-commerce</a>
|
||||
<a href="{{ \MVC\Classe\Url::module_link_rewrite( 'wordpress', ['']) }}">Blog</a>
|
||||
<a href="{{ \MVC\Classe\Url::module_link_rewrite( 'phplist', ['']) }}">Newsletter</a>
|
||||
@endif
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'syf43', []) }}">Symfony 4.3</a>
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'syf51', []) }}">Symfony 5.0.99</a>
|
||||
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'Policy', []) }}">Policy</a>
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'CGU', []) }}">CGU</a>
|
||||
@show
|
||||
|
||||
<div class="container">
|
||||
|
|
|
@ -17,7 +17,5 @@
|
|||
{{\MVC\Classe\ControlleurAction::inserer('default.default',[4,5,6])}}
|
||||
{{\MVC\Classe\ControlleurAction::inserer('default.variableSlug',['var1','var2','var3'])}}
|
||||
|
||||
{{--\MVC\Classe\ControlleurAction::inserer('default.makeHttp11',[])--}}
|
||||
|
||||
@endsection
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
@foreach ($hybridauth->getProviders() as $name)
|
||||
@if (!isset($adapters[$name]))
|
||||
<li>
|
||||
<!--<a href="#" onclick="javascript:auth_popup('{{ $name }}');">-->
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite(false, 'authentificate', ['provider' => $name]) }}">
|
||||
Sign in with {{ $name }}
|
||||
</a>
|
||||
|
@ -24,12 +23,5 @@
|
|||
@endsection
|
||||
|
||||
@section('top-javascript')
|
||||
<script>
|
||||
function auth_popup(provider) {
|
||||
// replace 'path/to/hybridauth' with the real path to this script
|
||||
var authWindow = window.open('{{ \MVC\Classe\Url::link_rewrite(true, 'authentification-callback-example', []) }}/provider/' + provider, 'authWindow', 'width=600,height=400,scrollbars=yes');
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
|
|
13
application/include/vues/view/cgu.blade.php
Normal file
13
application/include/vues/view/cgu.blade.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
@extends('body')
|
||||
|
||||
@section('sidebar')
|
||||
@parent
|
||||
|
||||
<p>This is appended to the master sidebar.</p>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
{{$cgu}}
|
||||
</div>
|
||||
@endsection
|
13
application/include/vues/view/policy.blade.php
Normal file
13
application/include/vues/view/policy.blade.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
@extends('body')
|
||||
|
||||
@section('sidebar')
|
||||
@parent
|
||||
|
||||
<p>This is appended to the master sidebar.</p>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
{{$policy}}
|
||||
</div>
|
||||
@endsection
|
|
@ -1 +0,0 @@
|
|||
{{$app->load('wordpress')}}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,5 @@
|
|||
syf43 : Application permettant de tester l'intégration d'un module avec symfony4.3
|
||||
syf51 : Application permettant de tester l'intégration d'un module avec symfony5.0.99
|
||||
wordpress : Application permettant de générer un blog wordpress
|
||||
prestashop : Application permettant de générer une site e-commerce prestashop
|
||||
prestashop : Application permettant de générer une site e-commerce prestashop
|
||||
phplist : Application permettant de générer une newsletter phplist
|
|
@ -1,97 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* A simple example that shows how to use multiple providers, opening provider authentication in a pop-up.
|
||||
*/
|
||||
|
||||
use MVC\Classe\Dumper;
|
||||
|
||||
require CONFIG_PATH . DIRECTORY_SEPARATOR . "authentification-config-example.php";
|
||||
|
||||
try {
|
||||
|
||||
\MVC\Classe\Session::start();
|
||||
|
||||
$hybridauth = new Hybridauth\Hybridauth($config);
|
||||
$storage = new Hybridauth\Storage\Session();
|
||||
$error = false;
|
||||
|
||||
//
|
||||
// Event 1: User clicked SIGN-IN link
|
||||
//
|
||||
if (isset($url_params['provider'])) {
|
||||
// Validate provider exists in the $config
|
||||
if (in_array($url_params['provider'], $hybridauth->getProviders())) {
|
||||
// Store the provider for the callback event
|
||||
$storage->set('provider', $url_params['provider']);
|
||||
\MVC\Classe\Session::setStorage($storage);
|
||||
} else {
|
||||
$error = $url_params['provider'];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Event 2: User clicked LOGOUT link
|
||||
//
|
||||
if (isset($url_params['logout'])) {
|
||||
if (in_array($url_params['logout'], $hybridauth->getProviders())) {
|
||||
// Disconnect the adapter
|
||||
$adapter = $hybridauth->getAdapter($url_params['logout']);
|
||||
$adapter->disconnect();
|
||||
} else {
|
||||
$error = $url_params['logout'];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Handle invalid provider errors
|
||||
//
|
||||
if ($error !== false) {
|
||||
error_log('HybridAuth Error: Provider ' . json_encode($error) . ' not found or not enabled in $config');
|
||||
// Close the pop-up window
|
||||
echo "
|
||||
<script>
|
||||
window.opener.location.reload();
|
||||
window.close();
|
||||
</script>";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Event 3: Provider returns via CALLBACK
|
||||
//
|
||||
if ($url_params['provider'] = $storage->get('provider')) {
|
||||
|
||||
|
||||
|
||||
$hybridauth->authenticate($url_params['provider']);
|
||||
//Suite à l'authentification il ne permet plus de modifier la page il redirige directement sur le callback
|
||||
|
||||
/*
|
||||
// Retrieve the provider record
|
||||
$adapter = $hybridauth->getAdapter($url_params['provider']);
|
||||
|
||||
\MVC\Classe\Session::setUserProfile($adapter->getUserProfile());
|
||||
\MVC\Classe\Session::setToken($adapter->getAccessToken());
|
||||
|
||||
$compte = $config['callback'];
|
||||
// Close pop-up window
|
||||
echo <<<EOD
|
||||
|
||||
<script>
|
||||
window.opener.location.href = '$compte';
|
||||
window.close();
|
||||
</script>
|
||||
EOD;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log($e->getMessage());
|
||||
echo $e->getMessage();
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
require CONFIG_PATH . DIRECTORY_SEPARATOR . "authentification-config-example.php";
|
||||
|
||||
try {
|
||||
//Feed configuration array to Hybridauth
|
||||
$hybridauth = new \Hybridauth\Hybridauth($config);
|
||||
|
||||
//Then we can proceed and sign in with Twitter as an example. If you want to use a diffirent provider,
|
||||
//simply replace 'Twitter' with 'Google' or 'Facebook'.
|
||||
|
||||
//Attempt to authenticate users with a Twitter provider
|
||||
$adapter = $hybridauth->authenticate('Twitter');
|
||||
//Returns a boolean of whether the user is connected with Twitter
|
||||
$isConnected = $adapter->isConnected();
|
||||
|
||||
if ($isConnected == false) {
|
||||
//Attempt to authenticate users with a Google provider
|
||||
$adapter = $hybridauth->authenticate('Google');
|
||||
$isConnected = $adapter->isConnected();
|
||||
}
|
||||
if ($isConnected == false) {
|
||||
//Attempt to authenticate users with a Facebook provider
|
||||
$adapter = $hybridauth->authenticate('Facebook');
|
||||
$isConnected = $adapter->isConnected();
|
||||
}
|
||||
if ($isConnected == false) {
|
||||
//Attempt to authenticate users with a Github provider
|
||||
$adapter = $hybridauth->authenticate('Github');
|
||||
$isConnected = $adapter->isConnected();
|
||||
}
|
||||
|
||||
|
||||
if ($isConnected) {
|
||||
session_start();
|
||||
//Retrieve the user's token
|
||||
$token = $adapter->getAccessToken();
|
||||
$_SESSION['accessToken'] = $token;
|
||||
|
||||
//Retrieve the user's profile
|
||||
$userProfile = $adapter->getUserProfile();
|
||||
$_SESSION['userProfile'] = $userProfile;
|
||||
|
||||
//Disconnect the adapter
|
||||
$adapter->disconnect();
|
||||
|
||||
header("location:" . Url::link_rewrite(false, 'compte', []));
|
||||
|
||||
} else {
|
||||
|
||||
header("location:" . Url::link_rewrite(false, 'error', []));
|
||||
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
echo 'Oops, we ran into an issue! ' . $e->getMessage();
|
||||
}
|
|
@ -2,6 +2,10 @@
|
|||
<?php
|
||||
//var_dump($argv);
|
||||
|
||||
define("VENDOR_PATH", dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR."vendor");
|
||||
require VENDOR_PATH.DIRECTORY_SEPARATOR."autoload.php";
|
||||
|
||||
|
||||
if(isset($argv[1])) {
|
||||
$option = explode(':', $argv[1]);
|
||||
$command_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "command" . DIRECTORY_SEPARATOR . $option[0] . ".class.php";
|
||||
|
|
|
@ -27,36 +27,142 @@ class module
|
|||
*/
|
||||
}
|
||||
|
||||
static private function addWorpress(){
|
||||
/*
|
||||
* git clone https://github.com/WordPress/WordPress.git wordpress
|
||||
* git checkout -b actualdev origin:5.3-branch
|
||||
*
|
||||
* create database if not
|
||||
*
|
||||
* create wp-config.php
|
||||
* add symbolic links
|
||||
* add controlleur method
|
||||
* add model file
|
||||
* add blade view
|
||||
*/
|
||||
static public function addWordpress(){
|
||||
|
||||
$git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/WordPress/WordPress.git wordpress');
|
||||
echo $git_clone;
|
||||
$git_fetch = shell_exec('cd '.MODULES_PATH.'/wordpress && git fetch --all --tags');
|
||||
echo $git_fetch;
|
||||
$git_checkout = shell_exec('cd '.MODULES_PATH.'/wordpress && git checkout tags/5.4 -b actual-branch');
|
||||
echo $git_checkout;
|
||||
$git_chmod = shell_exec('sudo chmod 775 '.MODULES_PATH.'/wordpress');
|
||||
echo $git_chmod;
|
||||
$git_chown = shell_exec('sudo chown acksop:www-data '.MODULES_PATH.'/wordpress -R');
|
||||
echo $git_chown;
|
||||
$git_ln_1 = shell_exec('cd '.PUBLIC_PATH.' && ln -s ../application/modules/wordpress/ wordpress');
|
||||
echo $git_ln_1;
|
||||
$git_controlleur = shell_exec('cp '.CONSOLE_PATH.'/skel/module.php '.CONTROLLERS_PATH.'/wordpress.php');
|
||||
$controlleur = file_get_contents(CONTROLLERS_PATH.'/wordpress.php');
|
||||
$controlleur = preg_replace('%MODULE%','wordpress',$controlleur);
|
||||
file_put_contents(CONTROLLERS_PATH.'/wordpress.php', $controlleur);
|
||||
echo $git_controlleur;
|
||||
$git_modele = shell_exec('cp '.CONSOLE_PATH.'/skel/module.model '.MODELS_PATH.'/wordpress.model');
|
||||
$controlleur = file_get_contents(MODELS_PATH.'/wordpress.model');
|
||||
$controlleur = preg_replace('%MODULE%','wordpress',$controlleur);
|
||||
file_put_contents(MODELS_PATH.'/wordpress.model', $controlleur);
|
||||
echo $git_modele;
|
||||
$git_view = shell_exec('cp '.CONSOLE_PATH.'/skel/module.blade.php '.VIEW_PATH.'/view/wordpress.blade.php');
|
||||
$controlleur = file_get_contents(VIEW_PATH.'/view/wordpress.blade.php');
|
||||
$controlleur = preg_replace('%MODULE%','wordpress',$controlleur);
|
||||
file_put_contents(VIEW_PATH.'/view/wordpress.blade.php', $controlleur);
|
||||
echo $git_view;
|
||||
|
||||
}
|
||||
static public function removeWordpress(){
|
||||
|
||||
$git_clone = system('rm -Rf '.MODULES_PATH.'/wordpress', $git_clone_retval);
|
||||
echo $git_clone_retval;
|
||||
$git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/wordpress', $git_ln_1_retval);
|
||||
echo $git_ln_1_retval;
|
||||
$git_controlleur = system('rm -f '.CONTROLLERS_PATH.'/wordpress.php', $git_controlleur_retval);
|
||||
echo $git_controlleur_retval;
|
||||
$git_modele = system('rm -f '.MODELS_PATH.'/wordpress.model', $git_modele_retval);
|
||||
echo $git_modele_retval;
|
||||
$git_view = system('rm -f '.VIEW_PATH.'/view/wordpress.blade.php', $git_view_retval);
|
||||
echo $git_view_retval;
|
||||
}
|
||||
|
||||
static private function addPrestashop(){
|
||||
/*
|
||||
* git clone https://github.com/PrestaShop/PrestaShop.git prestashop
|
||||
* git checkout -b actualdev tags:1.7.6.2
|
||||
*
|
||||
* create database if not
|
||||
*
|
||||
* modify the /config/config.inc.php
|
||||
* add symbolic links
|
||||
* add controlleur method
|
||||
* add model file
|
||||
* add blade view
|
||||
*
|
||||
*/
|
||||
static public function addPrestashop(){
|
||||
|
||||
$git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/PrestaShop/PrestaShop.git prestashop');
|
||||
echo $git_clone;
|
||||
$git_fetch = shell_exec('cd '.MODULES_PATH.'/prestashop && git fetch --all --tags');
|
||||
echo $git_fetch;
|
||||
$git_checkout = shell_exec('cd '.MODULES_PATH.'/prestashop && git checkout tags/1.7.5.0 -b actual-branch ');
|
||||
echo $git_checkout;
|
||||
$composer_update = shell_exec('cd '.MODULES_PATH.'/prestashop && composer update');
|
||||
echo $composer_update;
|
||||
$git_ln_1 = shell_exec('cd '.PUBLIC_PATH.' && ln -s ../application/modules/prestashop/ prestashop');
|
||||
echo $git_ln_1;
|
||||
$git_chmod = shell_exec('sudo chmod 775 '.MODULES_PATH.'/prestashop -R');
|
||||
echo $git_chmod;
|
||||
$git_chown = shell_exec('sudo chown acksop:www-data '.MODULES_PATH.'/prestashop -R');
|
||||
echo $git_chown;
|
||||
$git_ln_2 = shell_exec('cd '.MODULES_PATH.'/prestashop && ln -s ../prestashop/ prestashop');
|
||||
echo $git_ln_2;
|
||||
$git_controlleur = shell_exec('cp '.CONSOLE_PATH.'/skel/module.php '.CONTROLLERS_PATH.'/prestashop.php');
|
||||
$controlleur = file_get_contents(CONTROLLERS_PATH.'/prestashop.php');
|
||||
$controlleur = preg_replace('%MODULE%','prestashop',$controlleur);
|
||||
file_put_contents(CONTROLLERS_PATH.'/prestashop.php', $controlleur);
|
||||
echo $git_controlleur;
|
||||
$git_modele = shell_exec('cp '.CONSOLE_PATH.'/skel/module.model '.MODELS_PATH.'/prestashop.model');
|
||||
$controlleur = file_get_contents(MODELS_PATH.'/prestashop.model');
|
||||
$controlleur = preg_replace('%MODULE%','prestashop',$controlleur);
|
||||
file_put_contents(MODELS_PATH.'/prestashop.model', $controlleur);
|
||||
echo $git_modele;
|
||||
$git_view = shell_exec('cp '.CONSOLE_PATH.'/skel/module.blade.php '.VIEW_PATH.'/view/prestashop.blade.php');
|
||||
$controlleur = file_get_contents(VIEW_PATH.'/view/prestashop.blade.php');
|
||||
$controlleur = preg_replace('%MODULE%','prestashop',$controlleur);
|
||||
file_put_contents(VIEW_PATH.'/view/prestashop.blade.php', $controlleur);
|
||||
echo $git_view;
|
||||
}
|
||||
static public function removePrestashop(){
|
||||
|
||||
$git_clone = system('rm -Rf '.MODULES_PATH.'/prestashop', $git_clone_retval);
|
||||
echo $git_clone_retval;
|
||||
$git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/prestashop', $git_ln_1_retval);
|
||||
echo $git_ln_1_retval;
|
||||
$git_controlleur = system('rm -f '.CONTROLLERS_PATH.'/prestashop.php', $git_controlleur_retval);
|
||||
echo $git_controlleur_retval;
|
||||
$git_modele = system('rm -f '.MODELS_PATH.'/prestashop.model', $git_modele_retval);
|
||||
echo $git_modele_retval;
|
||||
$git_view = system('rm -f '.VIEW_PATH.'/view/prestashop.blade.php', $git_view_retval);
|
||||
echo $git_view_retval;
|
||||
}
|
||||
|
||||
static public function addPhplist(){
|
||||
|
||||
$git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/phpList/phplist3.git phplist');
|
||||
echo $git_clone;
|
||||
$git_fetch = shell_exec('cd '.MODULES_PATH.'/phplist && git fetch --all --tags');
|
||||
echo $git_fetch;
|
||||
$git_checkout = shell_exec('cd '.MODULES_PATH.'/phplist && git checkout tags/3.4.2 -b actual-branch ');
|
||||
echo $git_checkout;
|
||||
$composer_update = shell_exec('cd '.MODULES_PATH.'/phplist && composer update');
|
||||
echo $composer_update;
|
||||
$git_ln_1 = shell_exec('cd '.PUBLIC_PATH.' && ln -s ../application/modules/phplist/public_html/lists phplist');
|
||||
echo $git_ln_1;
|
||||
$git_chmod = shell_exec('sudo chmod 777 '.MODULES_PATH.'/phplist -R');
|
||||
echo $git_chmod;
|
||||
$git_chown = shell_exec('sudo chown acksop:www-data '.MODULES_PATH.'/phplist -R');
|
||||
echo $git_chown;
|
||||
$git_controlleur = shell_exec('cp '.CONSOLE_PATH.'/skel/module.php '.CONTROLLERS_PATH.'/phplist.php');
|
||||
$controlleur = file_get_contents(CONTROLLERS_PATH.'/phplist.php');
|
||||
$controlleur = preg_replace('%MODULE%','phplist',$controlleur);
|
||||
file_put_contents(CONTROLLERS_PATH.'/phplist.php', $controlleur);
|
||||
echo $git_controlleur;
|
||||
$git_modele = shell_exec('cp '.CONSOLE_PATH.'/skel/module.model '.MODELS_PATH.'/phplist.model');
|
||||
$controlleur = file_get_contents(MODELS_PATH.'/phplist.model');
|
||||
$controlleur = preg_replace('%MODULE%','phplist',$controlleur);
|
||||
file_put_contents(MODELS_PATH.'/phplist.model', $controlleur);
|
||||
echo $git_modele;
|
||||
$git_view = shell_exec('cp '.CONSOLE_PATH.'/skel/module.blade.php '.VIEW_PATH.'/view/phplist.blade.php');
|
||||
$controlleur = file_get_contents(VIEW_PATH.'/view/phplist.blade.php');
|
||||
$controlleur = preg_replace('%MODULE%','phplist',$controlleur);
|
||||
file_put_contents(VIEW_PATH.'/view/phplist.blade.php', $controlleur);
|
||||
echo $git_view;
|
||||
}
|
||||
static public function removePhplist(){
|
||||
|
||||
$git_clone = system('rm -Rf '.MODULES_PATH.'/phplist', $git_clone_retval);
|
||||
echo $git_clone_retval;
|
||||
$git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/phplist', $git_ln_1_retval);
|
||||
echo $git_ln_1_retval;
|
||||
$git_controlleur = system('rm -f '.CONTROLLERS_PATH.'/phplist.php', $git_controlleur_retval);
|
||||
echo $git_controlleur_retval;
|
||||
$git_modele = system('rm -f '.MODELS_PATH.'/phplist.model', $git_modele_retval);
|
||||
echo $git_modele_retval;
|
||||
$git_view = system('rm -f '.VIEW_PATH.'/view/phplist.blade.php', $git_view_retval);
|
||||
echo $git_view_retval;
|
||||
}
|
||||
}
|
46
console/command/page.class.php
Normal file
46
console/command/page.class.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
|
||||
class page
|
||||
{
|
||||
|
||||
static public function help(){
|
||||
print "explaination of the command\n\n";
|
||||
}
|
||||
|
||||
static public function add(){
|
||||
print "adding page...\n\n";
|
||||
echo "Quel est le nom de la page a ajouter? ";
|
||||
$page = trim(fgets(STDIN));
|
||||
|
||||
$git_controlleur = shell_exec('cp '.CONSOLE_PATH.'/skel/page.php '.CONTROLLERS_PATH.'/'.$page.'.php');
|
||||
$controlleur = file_get_contents(CONTROLLERS_PATH.'/'.$page.'.php');
|
||||
$controlleur = preg_replace('%PAGE%',$page,$controlleur);
|
||||
file_put_contents(CONTROLLERS_PATH.'/'.$page.'.php', $controlleur);
|
||||
echo $git_controlleur;
|
||||
$git_modele = shell_exec('cp '.CONSOLE_PATH.'/skel/page.model '.MODELS_PATH.'/'.$page.'.model');
|
||||
$controlleur = file_get_contents(MODELS_PATH.'/'.$page.'.model');
|
||||
$controlleur = preg_replace('%PAGE%',$page,$controlleur);
|
||||
file_put_contents(MODELS_PATH.'/'.$page.'.model', $controlleur);
|
||||
echo $git_modele;
|
||||
$git_view = shell_exec('cp '.CONSOLE_PATH.'/skel/page.blade.php '.VIEW_PATH.'/view/'.$page.'.blade.php');
|
||||
$controlleur = file_get_contents(VIEW_PATH.'/view/'.$page.'.blade.php');
|
||||
$controlleur = preg_replace('%PAGE%',$page,$controlleur);
|
||||
file_put_contents(VIEW_PATH.'/view/'.$page.'.blade.php', $controlleur);
|
||||
echo $git_view;
|
||||
}
|
||||
|
||||
static public function remove(){
|
||||
print "removing page...\n\n";
|
||||
echo "Quel est le nom de la page a supprimer? ";
|
||||
$handle = fopen ("php://stdin","r");
|
||||
$page = fgets($handle);
|
||||
$git_controlleur = system('rm -f '.CONTROLLERS_PATH.'/'.$page.'.php', $git_controlleur_retval);
|
||||
echo $git_controlleur_retval;
|
||||
$git_modele = system('rm -f '.MODELS_PATH.'/'.$page.'.model', $git_modele_retval);
|
||||
echo $git_modele_retval;
|
||||
$git_view = system('rm -f '.VIEW_PATH.'/view/'.$page.'.blade.php', $git_view_retval);
|
||||
echo $git_view_retval;
|
||||
}
|
||||
|
||||
}
|
|
@ -1 +1 @@
|
|||
{{$app->load();}}
|
||||
{{$app->load('MODULE')}}
|
|
@ -1,4 +1,4 @@
|
|||
name : module
|
||||
name : MODULE
|
||||
page_title : module_title
|
||||
description : module_description
|
||||
params : module_params
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<?php
|
||||
\MVC\Classe\Session::start();
|
||||
$app = new MVC\Classe\Modular($name);
|
||||
$app = new MVC\Classe\Modular($name,'MODULE',$url_params);
|
||||
$templateData = array('app' => $app);
|
16
console/skel/page.blade.php
Normal file
16
console/skel/page.blade.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
@extends('body')
|
||||
|
||||
@section('sidebar')
|
||||
@parent
|
||||
|
||||
<p>This is appended to the master sidebar.</p>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
Foo Controlleur
|
||||
@if (isset($id))
|
||||
{{$id}}
|
||||
@else
|
||||
id not exist
|
||||
@endif
|
||||
@endsection
|
5
console/skel/page.model
Normal file
5
console/skel/page.model
Normal file
|
@ -0,0 +1,5 @@
|
|||
name : PAGE
|
||||
page_title : module_title
|
||||
description : module_description
|
||||
params : module_params
|
||||
|
7
console/skel/page.php
Normal file
7
console/skel/page.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
use MVC\Classe\Logger;
|
||||
|
||||
$templateData = array("templating_a"=>'blade',"templating_b"=>'twig',"templating_c"=>'edge');
|
||||
Logger::addLog('ok', 'Hello world');
|
Loading…
Reference in a new issue