Просмотр исходного кода

Change <? to <?php and add some formatting

master
Clement Desmidt 2 лет назад
Родитель
Сommit
fb71f8c112

+ 1
- 2
ajax/addSiteXML.php Просмотреть файл

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 $number 	= $_POST['number'];
3 3
 $url 		= $_POST['url'];
4 4
 $name 		=  $_POST['name'];
@@ -22,4 +22,3 @@ $newnote->addChild('url', $url);
22 22
 $xmla->asXML('../db/blog_links.xml');
23 23
 
24 24
 echo $nb;
25
-?>

+ 2
- 3
ajax/post-config.php Просмотреть файл

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 $options = array();
3 3
 $module	='';
4 4
 include '../class/AccueilModules.php';
@@ -9,5 +9,4 @@ foreach($_POST as $module => $valeur){
9 9
 	}
10 10
 	//AccueilModules::updateModule($module, array('visibility'=>$valeur));
11 11
 }
12
-echo "1"
13
-?>
12
+echo "1";

+ 1
- 1
ajax/update.php Просмотреть файл

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 
3 3
 // Error reporting
4 4
 error_reporting(E_ALL^E_NOTICE);

+ 155
- 147
class/AccueilModules.php Просмотреть файл

@@ -1,99 +1,106 @@
1
-<?php 
1
+<?php
2 2
 function __autoload($class)
3 3
 {
4
-	$BASE_DIR = $_SERVER['DOCUMENT_ROOT'].'/test/trunk3/'; // à modifier selon la configuration souhaitée
5
-	set_include_path($BASE_DIR);
6
-	$path = 'modules/'.$class;
7
-	if(file_exists($path . DIRECTORY_SEPARATOR . ucfirst($class) . '.php') || file_exists($BASE_DIR . $path . DIRECTORY_SEPARATOR . ucfirst($class) . '.php')){
8
-		require_once($path . DIRECTORY_SEPARATOR . ucfirst($class) . '.php');
9
-	}else{
10
-		require_once('class/' . $class . '.php');
11
-	}
4
+    $BASE_DIR = $_SERVER['DOCUMENT_ROOT'] . '/accueil/'; // à modifier selon la configuration souhaitée
5
+    set_include_path($BASE_DIR);
6
+    $path = 'modules/' . $class;
7
+    if (file_exists($path . DIRECTORY_SEPARATOR . ucfirst($class) . '.php') || file_exists($BASE_DIR . $path . DIRECTORY_SEPARATOR . ucfirst($class) . '.php')) {
8
+        require_once($path . DIRECTORY_SEPARATOR . ucfirst($class) . '.php');
9
+    } else {
10
+        require_once('class/' . $class . '.php');
11
+    }
12 12
 }
13
-class AccueilModules {
14 13
 
15
-	const CONFIG_FILE = 'db/config.xml';
16
-	private $modules = array();
14
+class AccueilModules
15
+{
16
+
17
+    const CONFIG_FILE = 'db/config.xml';
18
+    private $modules = array();
19
+
20
+    /**
21
+     * Constructeur
22
+     * Initialise le XML de conf générale
23
+     */
24
+    function __construct()
25
+    {
26
+        if ($config = simplexml_load_file(self::CONFIG_FILE)) {
27
+            $config_xml = $config->item;
28
+            foreach ($config_xml as $item) {
29
+                $this->modules["$item[id]"] = $item;
30
+            }
31
+        } else {
32
+            echo 'Impossible de trouver le fichier de configuration.';
33
+        }
34
+    }
35
+
36
+    /**
37
+     *
38
+     * Initialise les modules activés uniquement
39
+     */
40
+    function getModules()
41
+    {
42
+        foreach ($this->modules as $module => $moduleConf) {
43
+            if (file_exists('modules/' . $module . '/' . ucfirst($module) . '.php') && $moduleConf->visibility == "true") {
44
+                $params = array();
45
+                foreach ($moduleConf as $confParam) {
46
+                    $params[$confParam->getName()] = "$confParam";
47
+                }
48
+                $module = new $module($params);
49
+                if (is_subclass_of($module, 'Module')) {
50
+                    $module->build();
51
+                }
52
+                // require 'modules/'.$module.'/'.ucfirst($module).'.php';
53
+                // call_user_func(array($module, "start"), $module, $params);
54
+            }
55
+        }
56
+    }
17 57
 
18
-	/**
19
-	 * Constructeur
20
-	 * Initialise le XML de conf générale
21
-	 */
22
-	function __construct(){
23
-		if($config = simplexml_load_file(self::CONFIG_FILE)){
24
-			$config_xml = $config->item;
25
-			foreach($config_xml as $item){
26
-				$this->modules["$item[id]"] = $item;
27
-			}
28
-		}else{
29
-			echo 'Impossible de trouver le fichier de configuration.';
30
-		}
31
-	}
32
-	
33
-	/**
34
-	 * 
35
-	 * Initialise les modules activés uniquement
36
-	 */
37
-	function getModules(){
38
-		foreach($this->modules as $module=>$moduleConf){
39
-			if(file_exists('modules/'.$module.'/'.ucfirst($module).'.php') && $moduleConf->visibility == "true"){
40
-				$params = array();
41
-				foreach($moduleConf as $confParam){
42
-					$params[$confParam->getName()] = "$confParam";
43
-				}
44
-				$module = new $module($params);
45
-				if(is_subclass_of($module,'Module'))
46
-				$module->build();
47
-				// require 'modules/'.$module.'/'.ucfirst($module).'.php';
48
-				// call_user_func(array($module, "start"), $module, $params);
49
-			}
50
-		}
51
-	}
52
-	
53
-	/**
54
-	 *
55
-	 * @return le module donné avec ses paramètres actuellement présent en conf
56
-	 */
57
-	public static function getModule($module){
58
-		if($config = simplexml_load_file('../'.self::CONFIG_FILE)){
59
-			$config_xml = $config->item;
60
-			foreach($config_xml as $item){
61
-				if($item["id"] == $module){
62
-					$params = array();
63
-					foreach($item as $confParam){
64
-						$params[$confParam->getName()] = "$confParam";
65
-					}
66
-					//require '../modules/'.$module.'/'.ucfirst($module).'.php';
67
-					return new $module($params);
68
-				}
69
-			}
70
-			echo "object not found";
71
-			return;
72
-		}else{
73
-			echo "bad persistance";
74
-			return;
75
-		}
76
-		
77
-	}
58
+    /**
59
+     *
60
+     * @return le module donné avec ses paramètres actuellement présent en conf
61
+     */
62
+    public static function getModule($module)
63
+    {
64
+        if ($config = simplexml_load_file('../' . self::CONFIG_FILE)) {
65
+            $config_xml = $config->item;
66
+            foreach ($config_xml as $item) {
67
+                if ($item["id"] == $module) {
68
+                    $params = array();
69
+                    foreach ($item as $confParam) {
70
+                        $params[$confParam->getName()] = "$confParam";
71
+                    }
72
+                    //require '../modules/'.$module.'/'.ucfirst($module).'.php';
73
+                    return new $module($params);
74
+                }
75
+            }
76
+            echo "object not found";
77
+            return;
78
+        } else {
79
+            echo "bad persistance";
80
+            return;
81
+        }
78 82
 
79
-	/**
80
-	 * 
81
-	 * Construit et insère le menu de changement de config
82
-	 */
83
-	function buildConfigMenu(){
84
-		echo '<a href="#config" id="config-menu"><img src="images/interface/config.png" /></a>
83
+    }
84
+
85
+    /**
86
+     *
87
+     * Construit et insère le menu de changement de config
88
+     */
89
+    function buildConfigMenu()
90
+    {
91
+        echo '<a href="#config" id="config-menu"><img src="images/interface/config.png" /></a>
85 92
 				<div style="display:none;">
86 93
 				<div id="config">
87 94
 				<form id="config_form" action="" method="post">
88 95
 				<h3>Modules configuration</h3><br/>';
89
-		foreach($this->modules as $module=>$moduleConf){
90
-			echo $module.' module : <input type="radio" name="'.$module.'_group" value="true"';
91
-			if ($moduleConf->visibility == "true") echo " checked";
92
-			echo '/>activé&nbsp;&nbsp;<input type="radio" name="'.$module.'_group" value="false"';
93
-			if ($moduleConf->visibility == "false") echo " checked";
94
-			echo '/>desactivé<br/><br/>';
95
-		}
96
-		echo '<span id="config-submit" class="green-button">Enregistrer</span>
96
+        foreach ($this->modules as $module => $moduleConf) {
97
+            echo $module . ' module : <input type="radio" name="' . $module . '_group" value="true"';
98
+            if ($moduleConf->visibility == "true") echo " checked";
99
+            echo '/>activé&nbsp;&nbsp;<input type="radio" name="' . $module . '_group" value="false"';
100
+            if ($moduleConf->visibility == "false") echo " checked";
101
+            echo '/>desactivé<br/><br/>';
102
+        }
103
+        echo '<span id="config-submit" class="green-button">Enregistrer</span>
97 104
 				</form><br/><br/>
98 105
 				<h3>Ajout d\'un module</h3>
99 106
 				<form action="includes/addModule.php" method="POST" enctype="multipart/form-data">
@@ -102,16 +109,16 @@ class AccueilModules {
102 109
 				</form>
103 110
 				</div>
104 111
 				</div>';
105
-		echo '<script>$(document).ready(function(){
112
+        echo '<script>$(document).ready(function(){
106 113
 					$(\'#config-submit\').live(\'click\',function(e){
107 114
 						$(this).replaceWith(\'<img src="images/interface/ajax_load.gif" style="margin:30px auto;display:block" />\');
108 115
 						var data3 = {';
109
-		$temp = '';
110
-		foreach($this->modules as $module=>$moduleConf){
111
-			$temp .= '\''.$module.'\'	: $(\'input[type=radio][name='.$module.'_group]:checked\').attr(\'value\'),';
112
-		}
113
-		echo substr($temp, 0, -1);
114
-		echo '};
116
+        $temp = '';
117
+        foreach ($this->modules as $module => $moduleConf) {
118
+            $temp .= '\'' . $module . '\'	: $(\'input[type=radio][name=' . $module . '_group]:checked\').attr(\'value\'),';
119
+        }
120
+        echo substr($temp, 0, -1);
121
+        echo '};
115 122
 				$.post(\'ajax/post-config.php\',data3,function(msg3){
116 123
 					location.reload();		
117 124
 				});
@@ -119,58 +126,59 @@ class AccueilModules {
119 126
 				});
120 127
 			});
121 128
 			</script>';
122
-	}
123
-	
124
-	public static function retrieveModuleParams($module){
125
-		$temp = new $module;
126
-		return $temp->getParamsList();
127
-	}
128
-	
129
-	/**
130
-	*
131
-	* Fonction d'ajout de module dans le fichier de config
132
-	*/
133
-	public static function addModule($file, $name)
134
-	{
135
-		if($config = simplexml_load_file('../'.self::CONFIG_FILE)){
136
-			foreach($config->item as $item){
137
-				if($item['id'] == $name)
138
-					exit ('module déjà présent !');
139
-			}
140
-		}
141
-		if(class_exists('ZipArchive')){
142
-			$zip = new ZipArchive;
143
-			$res = $zip->open($file);
144
-			if ($res === TRUE) {
145
-				$zip->extractTo('../modules/');
146
-				$zip->close();
147
-				if(!file_exists('../modules/'.$name.'/'.ucfirst($name).'.php'))
148
-					exit ('L\'extraction n\'a pas fonctionné...');
149
-				else{
150
-					unlink ($file);
151
-					require '../modules/'.$name.'/'.ucfirst($name).'.php';
152
-					if($config = simplexml_load_file('../'.self::CONFIG_FILE)){
153
-						$newItem = $config->addChild('item');
154
-						$newItem->addAttribute('id', $name);
155
-						//$params = call_user_func(array($name, 'getParamList')); 
156
-						$params = self::retrieveModuleParams($name);
157
-						foreach($params as $param){
158
-							if($param == 'visibility')
159
-								$newItem->AddChild($param, 'true');
160
-							else
161
-								$newItem->AddChild($param, '0');
162
-						}
163
-						$config->asXML('../'.self::CONFIG_FILE);
164
-						echo 'Module enregistré. Vous pouvez revenir à la page d\'accueil';
165
-					}else{
166
-						exit ('L\'enregistrement dans le menu a échoué...');
167
-					}
168
-				}
169
-			} else {
170
-				exit ('failed, code:' . $res);
171
-			}			
172
-		}else{
173
-			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');
174
-		}
175
-	}
129
+    }
130
+
131
+    public static function retrieveModuleParams($module)
132
+    {
133
+        $temp = new $module;
134
+        return $temp->getParamsList();
135
+    }
136
+
137
+    /**
138
+     *
139
+     * Fonction d'ajout de module dans le fichier de config
140
+     */
141
+    public static function addModule($file, $name)
142
+    {
143
+        if ($config = simplexml_load_file('../' . self::CONFIG_FILE)) {
144
+            foreach ($config->item as $item) {
145
+                if ($item['id'] == $name)
146
+                    exit ('module déjà présent !');
147
+            }
148
+        }
149
+        if (class_exists('ZipArchive')) {
150
+            $zip = new ZipArchive;
151
+            $res = $zip->open($file);
152
+            if ($res === TRUE) {
153
+                $zip->extractTo('../modules/');
154
+                $zip->close();
155
+                if (!file_exists('../modules/' . $name . '/' . ucfirst($name) . '.php'))
156
+                    exit ('L\'extraction n\'a pas fonctionné...');
157
+                else {
158
+                    unlink($file);
159
+                    require '../modules/' . $name . '/' . ucfirst($name) . '.php';
160
+                    if ($config = simplexml_load_file('../' . self::CONFIG_FILE)) {
161
+                        $newItem = $config->addChild('item');
162
+                        $newItem->addAttribute('id', $name);
163
+                        //$params = call_user_func(array($name, 'getParamList'));
164
+                        $params = self::retrieveModuleParams($name);
165
+                        foreach ($params as $param) {
166
+                            if ($param == 'visibility')
167
+                                $newItem->AddChild($param, 'true');
168
+                            else
169
+                                $newItem->AddChild($param, '0');
170
+                        }
171
+                        $config->asXML('../' . self::CONFIG_FILE);
172
+                        echo 'Module enregistré. Vous pouvez revenir à la page d\'accueil';
173
+                    } else {
174
+                        exit ('L\'enregistrement dans le menu a échoué...');
175
+                    }
176
+                }
177
+            } else {
178
+                exit ('failed, code:' . $res);
179
+            }
180
+        } else {
181
+            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');
182
+        }
183
+    }
176 184
 }

+ 1
- 1
index.php Просмотреть файл

@@ -11,7 +11,7 @@
11 11
 	<title>Ma Page d'accueil</title> 
12 12
 </head> 
13 13
 <body> 
14
-<?
14
+<?php
15 15
 include "class/AccueilModules.php";
16 16
 $index = new AccueilModules();
17 17
 $index->getModules();

+ 2
- 1
modules/blogs/Blogs.php Просмотреть файл

@@ -1,5 +1,6 @@
1 1
 <?php
2
-class blogs extends Module {
2
+class blogs extends Module
3
+{
3 4
 	protected $moduleTitle = 'Blogs BD';
4 5
 	protected $paramsList = array(
5 6
 		'visibility',

+ 3
- 3
modules/blogs/includes/addSite.php Просмотреть файл

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 $url = $_POST['newLink'];
3 3
 if($url == '' || !isset($_POST['newLink']))
4 4
 header('Location: index.php');
@@ -18,7 +18,7 @@ header('Location: index.php');
18 18
 $(document).ready(function(){
19 19
 $('.choose').click(function(){
20 20
 	var id = $(this).attr('id');
21
-	var url = "<?=$url?>";
21
+	var url = "<?php echo $url; ?>";
22 22
 	var name = 'test';
23 23
 	$.post('addSiteXML.php', {number: id, url: url, name: name}, function(data){
24 24
 		document.location.href="index.php" 
@@ -30,7 +30,7 @@ $('.choose').click(function(){
30 30
 </head> 
31 31
  
32 32
 <body> 
33
-<?
33
+<?php
34 34
 echo 'URL : '.$url.'<br/>';
35 35
 require('blogs_last_post.php');
36 36
 $opts = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 10);

+ 1
- 1
modules/blogs/includes/blogs.php Просмотреть файл

@@ -1,4 +1,4 @@
1
-<? 
1
+<?php
2 2
 require('blogs_last_post.php');
3 3
 $opts = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 10, CURLOPT_CONNECTTIMEOUT => 10);
4 4
 $blogs = new Blogs_last_post();

+ 4
- 4
modules/blogs/includes/blogs_last_post.php Просмотреть файл

@@ -1,4 +1,4 @@
1
-<? 
1
+<?php
2 2
 require('CURL.php');
3 3
 class Blogs_last_post extends CURL{
4 4
 
@@ -30,14 +30,14 @@ function getResult()
30 30
 }
31 31
 
32 32
 public function getLinks(){
33
-	if($linksXML = simplexml_load_file('../db/blog_links.xml')){
33
+	if($linksXML = @simplexml_load_file('../db/blog_links.xml')){
34 34
 		foreach($linksXML->link as $individualLink){
35 35
 			$this->link[] = array('name'=>$individualLink->name, 'url'=>$individualLink->url, 'number'=>$individualLink->number);
36 36
 		}
37 37
 		return $this->link;
38 38
 	}
39 39
 	else
40
-		return;
40
+		return [];
41 41
 }
42 42
 
43 43
 function getTitles()
@@ -70,7 +70,7 @@ function getTitle($result = null, $url = null)
70 70
 			if(isset($title[1]))
71 71
 				return $title[1];
72 72
 			else
73
-			return 'Erreur : pas de titre de blog trouvé.';
73
+			return 'Erreur : pas de titre de blog trouv�.';
74 74
 		}
75 75
 		
76 76
 	}

+ 3
- 2
modules/clockAdvanced/ClockAdvanced.php Просмотреть файл

@@ -1,5 +1,6 @@
1 1
 <?php
2
-class clockAdvanced extends Module {
2
+class clockAdvanced extends Module
3
+{
3 4
 	protected $moduleTitle = 'Horloge Avancée';
4 5
 	protected $paramsList = array(
5 6
 		'visibility',
@@ -20,7 +21,7 @@ class clockAdvanced extends Module {
20 21
 				<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
21 22
 		echo '<div class="jclockAdvanced" id="clockAdvanced" style="left:'.$this->getParam('x').'; top:'.$this->getParam('y').';"></div>';
22 23
 		$options = '';
23
-		foreach (self::$paramsList as $paramName){
24
+		foreach ($this->paramsList as $paramName){
24 25
 			if($this->getParam($paramName) != null)
25 26
 				$options .= $paramName.' : "'.$this->getParam($paramName).'",';
26 27
 		}

+ 1
- 1
modules/links/ajax/listToReserve.php Просмотреть файл

@@ -1,4 +1,4 @@
1
-<? 
1
+<?php
2 2
 $reserve		= $_POST['reserve'];
3 3
 
4 4
 $doc = new DOMDocument;

+ 1
- 1
modules/links/ajax/loadReserve.php Просмотреть файл

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 if($links_xml = simplexml_load_file("../db/links.xml")){
3 3
 	$links = $links_xml->reserve;
4 4
 	foreach($links as $label){

+ 1
- 1
modules/links/ajax/reserveToList.php Просмотреть файл

@@ -1,4 +1,4 @@
1
-<? 
1
+<?php
2 2
 $reserve		= $_POST['reserve'];
3 3
 
4 4
 $doc = new DOMDocument;

+ 1
- 1
modules/links/ajax/update-links-order.php Просмотреть файл

@@ -1,4 +1,4 @@
1
-<? 
1
+<?php
2 2
 $label		= $_POST['label'];
3 3
 $order		= $_POST['order'];
4 4
 $itemMoved	= $_POST['itemMoved'];

+ 21
- 17
modules/news/News.php Просмотреть файл

@@ -1,20 +1,24 @@
1 1
 <?php
2
-class news extends Module{
3
-	protected $moduleTitle = 'Google News';
4
-	protected $paramsList = array(
5
-		'visibility',
6
-		'x',
7
-		'y'
8
-	);
9
-	
10
-	public function __construct($params){
11
-		parent::__construct(__CLASS__, $params);
12
-	}
13
-	
14
-	public function build(){
15
-		echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
16
-				<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
17
-		echo '<script type="text/javascript" src="http://www.google.com/jsapi"></script>
2
+
3
+class news extends Module
4
+{
5
+    protected $moduleTitle = 'Google News';
6
+    protected $paramsList = array(
7
+        'visibility',
8
+        'x',
9
+        'y'
10
+    );
11
+
12
+    public function __construct($params)
13
+    {
14
+        parent::__construct(__CLASS__, $params);
15
+    }
16
+
17
+    public function build()
18
+    {
19
+        echo '<script type="text/javascript" src="' . $this->pathToModule . 'js/' . $this->moduleName . '.js"></script>
20
+				<link rel="stylesheet" href="' . $this->pathToModule . 'css/' . $this->moduleName . '.css" type="text/css" />';
21
+        echo '<script type="text/javascript" src="http://www.google.com/jsapi"></script>
18 22
 				<div id="news" style="top:' . $this->getParam('y') . '; left: ' . $this->getParam('x') . ';"></div>
19 23
 					<script type="text/javascript">
20 24
 						google.load("elements", "1", {packages : ["newsshow"]});
@@ -33,5 +37,5 @@ class news extends Module{
33 37
 
34 38
 						google.setOnLoadCallback(onLoad);
35 39
 					</script>';
36
-	}
40
+    }
37 41
 }

+ 1
- 2
modules/notes/ajax/delete-notes.php Просмотреть файл

@@ -1,4 +1,4 @@
1
-<?// Escaping the input data:
1
+<?php // Escaping the input data:
2 2
 
3 3
 $rid = $_POST['id'];
4 4
 $explodeid = explode("-",$rid);
@@ -22,4 +22,3 @@ $xmla->asXML('../db/notes.xml');
22 22
 
23 23
 $target++;
24 24
 echo $target;
25
-?>

+ 2
- 2
modules/notes/ajax/post-notes.php Просмотреть файл

@@ -1,4 +1,5 @@
1
-<?// Escaping the input data:
1
+<?php
2
+// Escaping the input data:
2 3
 
3 4
 $body = $_POST['body'];
4 5
 $color = $_POST['color'];
@@ -26,4 +27,3 @@ $newnote->addChild('left', '0');
26 27
 $xmla->asXML('../db/notes.xml');
27 28
 
28 29
 echo $nb;
29
-?>

+ 6
- 6
modules/notes/db/notes.xml Просмотреть файл

@@ -1,6 +1,6 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<Notes>
3
-
4
-
5
-
6
-<note id="2"><text>Test de post-it.</text><color>green</color><zindex>1</zindex><top>153</top><left>53</left></note><note id="7"><text>/!\ C'est bien fait ? :)</text><color>yellow</color><zindex>1</zindex><top>85</top><left>1038</left></note><note id="10"><text>Des améliorations ?</text><color>yellow</color><zindex>1</zindex><top>264</top><left>1038</left></note></Notes>
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Notes>
3
+
4
+
5
+
6
+<note id="2"><text>Test de post-it.</text><color>green</color><zindex>1</zindex><top>153</top><left>53</left></note><note id="7"><text>/!\ C'est bien fait ? :)</text><color>yellow</color><zindex>1</zindex><top>68</top><left>252</left></note><note id="10"><text>Des améliorations ?</text><color>yellow</color><zindex>2</zindex><top>264</top><left>247</left></note></Notes>

+ 3
- 5
modules/notes/includes/notes_extract.php Просмотреть файл

@@ -1,8 +1,6 @@
1 1
 <?php $nb = 0;
2 2
 $notes = simplexml_load_file('modules/notes/db/notes.xml');
3 3
 foreach($notes as $test){$nb++;}
4
-for($i=0; $i<$nb; $i++){?>
5
-<div class="note <?echo $notes->note[$i]->color;?>" style="position:absolute; left:<? echo $notes->note[$i]->left;?>; top:<? echo $notes->note[$i]->top;?>;z-index:<? echo $notes->note[$i]->zindex;?>;"><div class="delete" id="r-<?echo $notes->note[$i]['id'];?>"></div><? echo $notes->note[$i]->text;?><br/><span class="data"><?echo $notes->note[$i]['id'];?></span></div>
6
-<?}?>
7
-
8
-
4
+for($i=0; $i<$nb; $i++){ ?>
5
+<div class="note <?php echo $notes->note[$i]->color;?>" style="position:absolute; left:<?php echo $notes->note[$i]->left;?>; top:<?php echo $notes->note[$i]->top;?>;z-index:<?php echo $notes->note[$i]->zindex;?>;"><div class="delete" id="r-<?php echo $notes->note[$i]['id'];?>"></div><?php echo $notes->note[$i]->text;?><br/><span class="data"><?php echo $notes->note[$i]['id'];?></span></div>
6
+<?php }

+ 1
- 21
modules/todo/ajax/saveTodoist.php Просмотреть файл

@@ -1,21 +1 @@
1
-<?

2
-$xmla 	= simplexml_load_file('../db/todoist.xml');

3
-if(isset($_POST['token'])){

4
-$token 	= trim($_POST['token']);

5
-

6
-$xmla->addChild("token", $token);

7
-

8
-$xmla->asXML('../db/todoist.xml');

9
-

10
-echo "ok";

11
-}else if(isset($_POST['name']) && isset($_POST['id'])){

12
-	$name 	= trim($_POST['name']);

13
-	$id 	= trim($_POST['id']);

14
-

15
-	$xmla->addChild("name", $name);

16
-	$xmla->addChild("id", $id);

17
-

18
-	$xmla->asXML('../db/todoist.xml');

19
-

20
-echo "ok";

21
-}
1
+<?php

$xmla = simplexml_load_file('../db/todoist.xml');

if (isset($_POST['token'])) {

    $token = trim($_POST['token']);
    $xmla->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";

}

+ 1
- 3
modules/todo/includes/getProjectsList.php
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 1
- 12
modules/todo/includes/getUncompletedTasks.php Просмотреть файл

@@ -1,12 +1 @@
1
-<?

2
-$xmla = simplexml_load_file('../db/todoist.xml');

3
-if($xmla->token== '' || $xmla->token == null)

4
-	header('Location: install-todoist.php');

5
-if($xmla->id != '' || $xmla->id != null): 

6
-$token 	= $xmla->token;

7
-$id		= $xmla->id;?>

8
-

9
-<script type="text/javascript" src="../js/getUncompletedTasks.php?token=<?=$token?>&id=<?=$id?>"></script>

10
-	<? else:

11
-		header('Location: getProjectsList.php');

12
-	endif;
1
+<?php

$xmla = simplexml_load_file('../db/todoist.xml');

if($xmla->token== '' || $xmla->token == null)

	header('Location: install-todoist.php');

if($xmla->id != '' || $xmla->id != null): 

$token 	= $xmla->token;

$id		= $xmla->id;?>



<script type="text/javascript" src="../js/getUncompletedTasks.php?token=<?php echo $token; ?>&id=<?php echo $id; ?>"></script>

	<?php else:

		header('Location: getProjectsList.php');

	endif;

+ 2
- 2
modules/todo/includes/install-todoist.php Просмотреть файл

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 $xmla = simplexml_load_file('../db/todoist.xml');
3 3
 if($xmla->token == '' || $xmla->token == null):?>
4 4
 <html>  
@@ -18,7 +18,7 @@ if($xmla->token == '' || $xmla->token == null):?>
18 18
 			</fieldset>
19 19
       </body>  
20 20
     </html>  
21
-	<?
21
+	<?php
22 22
 	else:
23 23
 		header('Location: getProjectsList.php');
24 24
 	endif;

+ 1
- 6
modules/todo/js/getProjectsList.php
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 1
- 9
modules/todo/js/getUncompletedTasks.php
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 11
- 7
modules/weather/Weather.php Просмотреть файл

@@ -1,5 +1,7 @@
1 1
 <?php
2
-class weather extends Module {
2
+
3
+class weather extends Module
4
+{
3 5
 
4 6
 	protected $moduleTitle = 'Météo';
5 7
 	
@@ -16,15 +18,17 @@ class weather extends Module {
16 18
 	
17 19
 	public function build(){
18 20
 		$ville = $this->getParam('city');
21
+        $future_weather = [];
19 22
 		include $this->pathToModule.'includes/GoogleMeteo.php';
20
-		echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
23
+        if (!empty($present_weather)) {
24
+            echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
21 25
 				<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">';
22
-		echo '<div id="weather" style="left:'.$this->getParam("x").'; top:'.$this->getParam("y").';">
23
-				'.$city.'<br/>
26
+            echo '<div id="weather" style="left:'.$this->getParam("x").'; top:'.$this->getParam("y").';">
27
+				'.$ville.'<br/>
24 28
 				<div class="weatherpic"></div>
25 29
 				<strong>'.$present_weather.'</strong><br/>
26
-				'.$future_weather1.'<br/>
27
-				'.$future_weather2.'
28
-			</div>';	
30
+				'.implode('<br/>', $future_weather).'
31
+			</div>';
32
+        }
29 33
 	}
30 34
 }

+ 42
- 35
modules/weather/includes/GoogleMeteo.php Просмотреть файл

@@ -1,38 +1,45 @@
1 1
 <?php
2
-	require('class/GoogleWeather.class.php');
3 2
 
4
-	//ça récupère un truc du style : http://www.google.com/ig/api?weather=paris&hl=fr
5
-	if($ville != '' || $ville != null){
6
-	$gweather = new GoogleWeatherAPI($ville,'fr');
7
-	
8
-	if($gweather->isFound()) {
9
-		$city		= $gweather->getCity();
10
-		$currentTemp = $gweather->getCurrent();
11
-		$forecastTemp = $gweather->getForecast();
12
-	
13
-	$present_weather = 'Actuellement : '.$currentTemp['temp_c'].'°C - '.$currentTemp['condition'];
14
-	$i=0;
15
-	foreach($forecastTemp as $temp) {
16
-		${'future_weather'.$i} = $temp['day_of_week'].' : '.$temp['low'].'°C | '.$temp['high'].'°C - '.$temp['condition'];
17
-		$i++;
18
-	}
3
+require('class/GoogleWeather.class.php');
4
+$present_weather = null;
5
+//ça récupère un truc du style : http://www.google.com/ig/api?weather=paris&hl=fr
6
+if ( !empty($ville) ) {
7
+    $google_weather = new GoogleWeatherAPI($ville, 'fr');
19 8
 
20
-	if(strpos(strtolower($present_weather),"soleil") !== false) {?>
21
-		<link rel="stylesheet" type="text/css" href="modules/weather/css/soleil.css">
22
-			<?}
23
-			if(strpos(strtolower($present_weather),"nuage") !== false) {?>
24
-				<link rel="stylesheet" type="text/css" href="modules/weather/css/nuage.css">
25
-			<?}
26
-			if(strpos(strtolower($present_weather),"peu nuageux") !== false) {?>
27
-				<link rel="stylesheet" type="text/css" href="modules/weather/css/peunuage.css">
28
-			<?}
29
-			if((strpos(strtolower($present_weather),"pluie") !== false) || (strpos(strtolower($present_weather),"averse") !== false)) {?>
30
-				<link rel="stylesheet" type="text/css" href="modules/weather/css/pluie.css">
31
-			<?}
32
-			if(strpos(strtolower($present_weather),"neige") !== false) {?>
33
-				<link rel="stylesheet" type="text/css" href="modules/weather/css/neige.css">
34
-			<?}
35
-		}else{ $present_weather = 'Ville non trouvé : '.$city; }
36
-	}else
37
-		$present_weather = 'Ville non renseignée';
38
-	
9
+    if ($google_weather->isFound()) {
10
+        $city = $google_weather->getCity();
11
+        $currentTemp = $google_weather->getCurrent();
12
+        $forecastTemp = $google_weather->getForecast();
13
+
14
+        $present_weather = 'Actuellement : ' . $currentTemp['temp_c'] . '°C - ' . $currentTemp['condition'];
15
+        $future_weather = [];
16
+        foreach ($forecastTemp as $temp) {
17
+            $future_weather[] = $temp['day_of_week'] . ' : ' . $temp['low'] . '°C | ' . $temp['high'] . '°C - ' . $temp['condition'];
18
+        }
19
+
20
+        if (strpos(strtolower($present_weather), "soleil") !== false) { ?>
21
+            <link rel="stylesheet" type="text/css" href="modules/weather/css/soleil.css">
22
+        <?php
23
+        }
24
+        if (strpos(strtolower($present_weather), "nuage") !== false) { ?>
25
+            <link rel="stylesheet" type="text/css" href="modules/weather/css/nuage.css">
26
+        <?php
27
+        }
28
+        if (strpos(strtolower($present_weather), "peu nuageux") !== false) { ?>
29
+            <link rel="stylesheet" type="text/css" href="modules/weather/css/peunuage.css">
30
+        <?php
31
+        }
32
+        if ((strpos(strtolower($present_weather), "pluie") !== false) || (strpos(strtolower($present_weather), "averse") !== false)) { ?>
33
+            <link rel="stylesheet" type="text/css" href="modules/weather/css/pluie.css">
34
+        <?php
35
+        }
36
+        if (strpos(strtolower($present_weather), "neige") !== false) { ?>
37
+            <link rel="stylesheet" type="text/css" href="modules/weather/css/neige.css">
38
+        <?php
39
+        }
40
+    } else {
41
+        $present_weather = 'Ville non trouvé : ' . $ville;
42
+    }
43
+} else {
44
+    $present_weather = 'Ville non renseignée';
45
+}

Загрузка…
Отмена
Сохранить