diff --git a/ajax/addSiteXML.php b/ajax/addSiteXML.php index 7bd61f9..501b173 100644 --- a/ajax/addSiteXML.php +++ b/ajax/addSiteXML.php @@ -1,4 +1,4 @@ -addChild('url', $url); $xmla->asXML('../db/blog_links.xml'); echo $nb; -?> diff --git a/ajax/post-config.php b/ajax/post-config.php index ad11eaf..4c98904 100644 --- a/ajax/post-config.php +++ b/ajax/post-config.php @@ -1,4 +1,4 @@ - $valeur){ } //AccueilModules::updateModule($module, array('visibility'=>$valeur)); } -echo "1" -?> +echo "1"; diff --git a/ajax/update.php b/ajax/update.php index 03607cb..a50e653 100644 --- a/ajax/update.php +++ b/ajax/update.php @@ -1,4 +1,4 @@ -item; - foreach($config_xml as $item){ - $this->modules["$item[id]"] = $item; - } - }else{ - echo 'Impossible de trouver le fichier de configuration.'; - } - } - - /** - * - * Initialise les modules activés uniquement - */ - function getModules(){ - foreach($this->modules as $module=>$moduleConf){ - if(file_exists('modules/'.$module.'/'.ucfirst($module).'.php') && $moduleConf->visibility == "true"){ - $params = array(); - foreach($moduleConf as $confParam){ - $params[$confParam->getName()] = "$confParam"; - } - $module = new $module($params); - if(is_subclass_of($module,'Module')) - $module->build(); - // require 'modules/'.$module.'/'.ucfirst($module).'.php'; - // call_user_func(array($module, "start"), $module, $params); - } - } - } - - /** - * - * @return le module donné avec ses paramètres actuellement présent en conf - */ - public static function getModule($module){ - if($config = simplexml_load_file('../'.self::CONFIG_FILE)){ - $config_xml = $config->item; - foreach($config_xml as $item){ - if($item["id"] == $module){ - $params = array(); - foreach($item as $confParam){ - $params[$confParam->getName()] = "$confParam"; - } - //require '../modules/'.$module.'/'.ucfirst($module).'.php'; - return new $module($params); - } - } - echo "object not found"; - return; - }else{ - echo "bad persistance"; - return; - } - - } + const CONFIG_FILE = 'db/config.xml'; + private $modules = array(); - /** - * - * Construit et insère le menu de changement de config - */ - function buildConfigMenu(){ - echo ' + /** + * Constructeur + * Initialise le XML de conf générale + */ + function __construct() + { + if ($config = simplexml_load_file(self::CONFIG_FILE)) { + $config_xml = $config->item; + foreach ($config_xml as $item) { + $this->modules["$item[id]"] = $item; + } + } else { + echo 'Impossible de trouver le fichier de configuration.'; + } + } + + /** + * + * Initialise les modules activés uniquement + */ + function getModules() + { + foreach ($this->modules as $module => $moduleConf) { + if (file_exists('modules/' . $module . '/' . ucfirst($module) . '.php') && $moduleConf->visibility == "true") { + $params = array(); + foreach ($moduleConf as $confParam) { + $params[$confParam->getName()] = "$confParam"; + } + $module = new $module($params); + if (is_subclass_of($module, 'Module')) { + $module->build(); + } + // require 'modules/'.$module.'/'.ucfirst($module).'.php'; + // call_user_func(array($module, "start"), $module, $params); + } + } + } + + /** + * + * @return le module donné avec ses paramètres actuellement présent en conf + */ + public static function getModule($module) + { + if ($config = simplexml_load_file('../' . self::CONFIG_FILE)) { + $config_xml = $config->item; + foreach ($config_xml as $item) { + if ($item["id"] == $module) { + $params = array(); + foreach ($item as $confParam) { + $params[$confParam->getName()] = "$confParam"; + } + //require '../modules/'.$module.'/'.ucfirst($module).'.php'; + return new $module($params); + } + } + echo "object not found"; + return; + } else { + echo "bad persistance"; + return; + } + + } + + /** + * + * Construit et insère le menu de changement de config + */ + function buildConfigMenu() + { + echo '

Modules configuration


'; - foreach($this->modules as $module=>$moduleConf){ - echo $module.' module : visibility == "true") echo " checked"; - echo '/>activé  visibility == "false") echo " checked"; - echo '/>desactivé

'; - } - echo 'Enregistrer + foreach ($this->modules as $module => $moduleConf) { + echo $module . ' module : visibility == "true") echo " checked"; + echo '/>activé  visibility == "false") echo " checked"; + echo '/>desactivé

'; + } + echo 'Enregistrer


Ajout d\'un module

@@ -102,16 +109,16 @@ class AccueilModules {
'; - echo ''; - } - - public static function retrieveModuleParams($module){ - $temp = new $module; - return $temp->getParamsList(); - } - - /** - * - * Fonction d'ajout de module dans le fichier de config - */ - public static function addModule($file, $name) - { - if($config = simplexml_load_file('../'.self::CONFIG_FILE)){ - foreach($config->item as $item){ - if($item['id'] == $name) - exit ('module déjà présent !'); - } - } - if(class_exists('ZipArchive')){ - $zip = new ZipArchive; - $res = $zip->open($file); - if ($res === TRUE) { - $zip->extractTo('../modules/'); - $zip->close(); - if(!file_exists('../modules/'.$name.'/'.ucfirst($name).'.php')) - exit ('L\'extraction n\'a pas fonctionné...'); - else{ - unlink ($file); - require '../modules/'.$name.'/'.ucfirst($name).'.php'; - if($config = simplexml_load_file('../'.self::CONFIG_FILE)){ - $newItem = $config->addChild('item'); - $newItem->addAttribute('id', $name); - //$params = call_user_func(array($name, 'getParamList')); - $params = self::retrieveModuleParams($name); - foreach($params as $param){ - if($param == 'visibility') - $newItem->AddChild($param, 'true'); - else - $newItem->AddChild($param, '0'); - } - $config->asXML('../'.self::CONFIG_FILE); - echo 'Module enregistré. Vous pouvez revenir à la page d\'accueil'; - }else{ - exit ('L\'enregistrement dans le menu a échoué...'); - } - } - } else { - exit ('failed, code:' . $res); - } - }else{ - exit ('Votre serveur ne peut installer les modules automatiquement. Merci de passer par votre client FTP habituel ou d\'ajouter la classe ZipArchive à votre serveur PHP'); - } - } + } + + public static function retrieveModuleParams($module) + { + $temp = new $module; + return $temp->getParamsList(); + } + + /** + * + * Fonction d'ajout de module dans le fichier de config + */ + public static function addModule($file, $name) + { + if ($config = simplexml_load_file('../' . self::CONFIG_FILE)) { + foreach ($config->item as $item) { + if ($item['id'] == $name) + exit ('module déjà présent !'); + } + } + if (class_exists('ZipArchive')) { + $zip = new ZipArchive; + $res = $zip->open($file); + if ($res === TRUE) { + $zip->extractTo('../modules/'); + $zip->close(); + if (!file_exists('../modules/' . $name . '/' . ucfirst($name) . '.php')) + exit ('L\'extraction n\'a pas fonctionné...'); + else { + unlink($file); + require '../modules/' . $name . '/' . ucfirst($name) . '.php'; + if ($config = simplexml_load_file('../' . self::CONFIG_FILE)) { + $newItem = $config->addChild('item'); + $newItem->addAttribute('id', $name); + //$params = call_user_func(array($name, 'getParamList')); + $params = self::retrieveModuleParams($name); + foreach ($params as $param) { + if ($param == 'visibility') + $newItem->AddChild($param, 'true'); + else + $newItem->AddChild($param, '0'); + } + $config->asXML('../' . self::CONFIG_FILE); + echo 'Module enregistré. Vous pouvez revenir à la page d\'accueil'; + } else { + exit ('L\'enregistrement dans le menu a échoué...'); + } + } + } else { + exit ('failed, code:' . $res); + } + } else { + exit ('Votre serveur ne peut installer les modules automatiquement. Merci de passer par votre client FTP habituel ou d\'ajouter la classe ZipArchive à votre serveur PHP'); + } + } } \ No newline at end of file diff --git a/index.php b/index.php index ceee37f..df66478 100644 --- a/index.php +++ b/index.php @@ -11,7 +11,7 @@ Ma Page d'accueil -getModules(); diff --git a/modules/blogs/Blogs.php b/modules/blogs/Blogs.php index 23e853f..c3d1c90 100644 --- a/modules/blogs/Blogs.php +++ b/modules/blogs/Blogs.php @@ -1,5 +1,6 @@ "; + var url = ""; var name = 'test'; $.post('addSiteXML.php', {number: id, url: url, name: name}, function(data){ document.location.href="index.php" @@ -30,7 +30,7 @@ $('.choose').click(function(){ -'; require('blogs_last_post.php'); $opts = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 10); diff --git a/modules/blogs/includes/blogs.php b/modules/blogs/includes/blogs.php index 861972f..f44dc6b 100644 --- a/modules/blogs/includes/blogs.php +++ b/modules/blogs/includes/blogs.php @@ -1,4 +1,4 @@ - true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 10, CURLOPT_CONNECTTIMEOUT => 10); $blogs = new Blogs_last_post(); diff --git a/modules/blogs/includes/blogs_last_post.php b/modules/blogs/includes/blogs_last_post.php index 20fd63e..e037a8b 100644 --- a/modules/blogs/includes/blogs_last_post.php +++ b/modules/blogs/includes/blogs_last_post.php @@ -1,4 +1,4 @@ -link as $individualLink){ $this->link[] = array('name'=>$individualLink->name, 'url'=>$individualLink->url, 'number'=>$individualLink->number); } return $this->link; } else - return; + return []; } function getTitles() @@ -70,7 +70,7 @@ function getTitle($result = null, $url = null) if(isset($title[1])) return $title[1]; else - return 'Erreur : pas de titre de blog trouvé.'; + return 'Erreur : pas de titre de blog trouv�.'; } } diff --git a/modules/clockAdvanced/ClockAdvanced.php b/modules/clockAdvanced/ClockAdvanced.php index 3ab1582..7dce046 100644 --- a/modules/clockAdvanced/ClockAdvanced.php +++ b/modules/clockAdvanced/ClockAdvanced.php @@ -1,5 +1,6 @@ pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />'; echo '
'; $options = ''; - foreach (self::$paramsList as $paramName){ + foreach ($this->paramsList as $paramName){ if($this->getParam($paramName) != null) $options .= $paramName.' : "'.$this->getParam($paramName).'",'; } diff --git a/modules/links/ajax/listToReserve.php b/modules/links/ajax/listToReserve.php index ecee938..2ac683c 100644 --- a/modules/links/ajax/listToReserve.php +++ b/modules/links/ajax/listToReserve.php @@ -1,4 +1,4 @@ -reserve; foreach($links as $label){ diff --git a/modules/links/ajax/reserveToList.php b/modules/links/ajax/reserveToList.php index 53e9773..3b526ca 100644 --- a/modules/links/ajax/reserveToList.php +++ b/modules/links/ajax/reserveToList.php @@ -1,4 +1,4 @@ -pathToModule.'js/'.$this->moduleName.'.js"> - '; - echo ' + +class news extends Module +{ + protected $moduleTitle = 'Google News'; + protected $paramsList = array( + 'visibility', + 'x', + 'y' + ); + + public function __construct($params) + { + parent::__construct(__CLASS__, $params); + } + + public function build() + { + echo ' + '; + echo '
'; - } + } } \ No newline at end of file diff --git a/modules/notes/ajax/delete-notes.php b/modules/notes/ajax/delete-notes.php index ddf236e..f91b51c 100644 --- a/modules/notes/ajax/delete-notes.php +++ b/modules/notes/ajax/delete-notes.php @@ -1,4 +1,4 @@ -asXML('../db/notes.xml'); $target++; echo $target; -?> diff --git a/modules/notes/ajax/post-notes.php b/modules/notes/ajax/post-notes.php index 46b2661..e080d7c 100644 --- a/modules/notes/ajax/post-notes.php +++ b/modules/notes/ajax/post-notes.php @@ -1,4 +1,5 @@ -addChild('left', '0'); $xmla->asXML('../db/notes.xml'); echo $nb; -?> diff --git a/modules/notes/db/notes.xml b/modules/notes/db/notes.xml index 3791b45..6437d1a 100644 --- a/modules/notes/db/notes.xml +++ b/modules/notes/db/notes.xml @@ -1,6 +1,6 @@ - - - - - -Test de post-it.green115353/!\ C'est bien fait ? :)yellow1851038Des améliorations ?yellow12641038 + + + + + +Test de post-it.green115353/!\ C'est bien fait ? :)yellow168252Des améliorations ?yellow2264247 diff --git a/modules/notes/includes/notes_extract.php b/modules/notes/includes/notes_extract.php index 81c78ed..1702c04 100644 --- a/modules/notes/includes/notes_extract.php +++ b/modules/notes/includes/notes_extract.php @@ -1,8 +1,6 @@  -
note[$i]->text;?>
note[$i]['id'];?>
- - - +for($i=0; $i<$nb; $i++){ ?> +
note[$i]->text;?>
note[$i]['id'];?>
+addChild("token", $token); - -$xmla->asXML('../db/todoist.xml'); - -echo "ok"; -}else if(isset($_POST['name']) && isset($_POST['id'])){ - $name = trim($_POST['name']); - $id = trim($_POST['id']); - - $xmla->addChild("name", $name); - $xmla->addChild("id", $id); - - $xmla->asXML('../db/todoist.xml'); - -echo "ok"; -} \ No newline at end of file +addChild("token", $token); $xmla->asXML('../db/todoist.xml'); echo "ok"; } else if (isset($_POST['name']) && isset($_POST['id'])) { $name = trim($_POST['name']); $id = trim($_POST['id']); $xmla->addChild("name", $name); $xmla->addChild("id", $id); $xmla->asXML('../db/todoist.xml'); echo "ok"; } \ No newline at end of file diff --git a/modules/todo/includes/getProjectsList.php b/modules/todo/includes/getProjectsList.php index c83ad06..d875fd6 100644 --- a/modules/todo/includes/getProjectsList.php +++ b/modules/todo/includes/getProjectsList.php @@ -1,3 +1 @@ -token== '' || $xmla->token == null) header('Location: install-todoist.php'); if($xmla->name == '' || $xmla->name == null):?> - Todoist : getProjects - token== '' || $xmla->token == null) header('Location: install-todoist.php'); if($xmla->name == '' || $xmla->name == null):?> Todoist : getProjects token== '' || $xmla->token == null) - header('Location: install-todoist.php'); -if($xmla->id != '' || $xmla->id != null): -$token = $xmla->token; -$id = $xmla->id;?> - - - token== '' || $xmla->token == null) header('Location: install-todoist.php'); if($xmla->id != '' || $xmla->id != null): $token = $xmla->token; $id = $xmla->id;?> token == '' || $xmla->token == null):?> @@ -18,7 +18,7 @@ if($xmla->token == '' || $xmla->token == null):?> - -function cbfunc(o){ $('body').append('

Select your project

'); $('#results').append('