diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..ba1221f
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1 @@
+php 1
\ No newline at end of file
diff --git a/CURL.php b/CURL.php
new file mode 100644
index 0000000..59b7cc7
--- /dev/null
+++ b/CURL.php
@@ -0,0 +1,251 @@
+sessions[] = curl_init( $url );
+ if( $opts != false )
+ {
+ $key = count( $this->sessions ) - 1;
+ $this->setOpts( $opts, $key );
+ }
+ }
+
+ /**
+ * Sets an option to a cURL session
+ * @param $option constant, cURL option
+ * @param $value mixed, value of option
+ * @param $key int, session key to set option for
+ */
+ public function setOpt( $option, $value, $key = 0 )
+ {
+ curl_setopt( $this->sessions[$key], $option, $value );
+ }
+
+ /**
+ * Sets an array of options to a cURL session
+ * @param $options array, array of cURL options and values
+ * @param $key int, session key to set option for
+ */
+ public function setOpts( $options, $key = 0 )
+ {
+ curl_setopt_array( $this->sessions[$key], $options );
+ }
+
+ /**
+ * Executes as cURL session
+ * @param $key int, optional argument if you only want to execute one session
+ */
+ public function exec( $key = false )
+ {
+ $no = count( $this->sessions );
+
+ if( $no == 1 )
+ $res = $this->execSingle();
+ elseif( $no > 1 ) {
+ if( $key === false )
+ $res = $this->execMulti();
+ else
+ $res = $this->execSingle( $key );
+ }
+
+ if( $res )
+ return $res;
+ }
+
+ /**
+ * Executes a single cURL session
+ * @param $key int, id of session to execute
+ * @return array of content if CURLOPT_RETURNTRANSFER is set
+ */
+ public function execSingle( $key = 0 )
+ {
+ if( $this->retry > 0 )
+ {
+ $retry = $this->retry;
+ $code = 0;
+ while( $retry >= 0 && ( $code[0] == 0 || $code[0] >= 400 ) )
+ {
+ $res = curl_exec( $this->sessions[$key] );
+ $code = $this->info( $key, CURLINFO_HTTP_CODE );
+
+ $retry--;
+ }
+ }
+ else
+ $res = curl_exec( $this->sessions[$key] );
+
+ return $res;
+ }
+
+ /**
+ * Executes a stack of sessions
+ * @return array of content if CURLOPT_RETURNTRANSFER is set
+ */
+ public function execMulti()
+ {
+ $mh = curl_multi_init();
+
+ #Add all sessions to multi handle
+ foreach ( $this->sessions as $i => $url )
+ curl_multi_add_handle( $mh, $this->sessions[$i] );
+
+ do
+ $mrc = curl_multi_exec( $mh, $active );
+ while ( $mrc == CURLM_CALL_MULTI_PERFORM );
+
+ while ( $active && $mrc == CURLM_OK )
+ {
+ if ( curl_multi_select( $mh ) != -1 )
+ {
+ do
+ $mrc = curl_multi_exec( $mh, $active );
+ while ( $mrc == CURLM_CALL_MULTI_PERFORM );
+ }
+ }
+
+ if ( $mrc != CURLM_OK )
+ echo "Curl multi read error $mrc\n";
+
+ #Get content foreach session, retry if applied
+ foreach ( $this->sessions as $i => $url )
+ {
+ $code = $this->info( $i, CURLINFO_HTTP_CODE );
+ if( $code[0] > 0 && $code[0] < 400 )
+ $res[] = curl_multi_getcontent( $this->sessions[$i] );
+ else
+ {
+ if( $this->retry > 0 )
+ {
+ $retry = $this->retry;
+ $this->retry -= 1;
+ $eRes = $this->execSingle( $i );
+
+ if( $eRes )
+ $res[] = $eRes;
+ else
+ $res[] = false;
+
+ $this->retry = $retry;
+ echo '1';
+ }
+ else
+ $res[] = false;
+ }
+
+ curl_multi_remove_handle( $mh, $this->sessions[$i] );
+ }
+
+ curl_multi_close( $mh );
+
+ return $res;
+ }
+
+ /**
+ * Closes cURL sessions
+ * @param $key int, optional session to close
+ */
+ public function close( $key = false )
+ {
+ if( $key === false )
+ {
+ foreach( $this->sessions as $session )
+ curl_close( $session );
+ }
+ else
+ curl_close( $this->sessions[$key] );
+ }
+
+ /**
+ * Remove all cURL sessions
+ */
+ public function clear()
+ {
+ foreach( $this->sessions as $session )
+ curl_close( $session );
+ unset( $this->sessions );
+ }
+
+ /**
+ * Returns an array of session information
+ * @param $key int, optional session key to return info on
+ * @param $opt constant, optional option to return
+ */
+ public function info( $key = false, $opt = false )
+ {
+ if( $key === false )
+ {
+ foreach( $this->sessions as $key => $session )
+ {
+ if( $opt )
+ $info[] = curl_getinfo( $this->sessions[$key], $opt );
+ else
+ $info[] = curl_getinfo( $this->sessions[$key] );
+ }
+ }
+ else
+ {
+ if( $opt )
+ $info[] = curl_getinfo( $this->sessions[$key], $opt );
+ else
+ $info[] = curl_getinfo( $this->sessions[$key] );
+ }
+
+ return $info;
+ }
+
+ /**
+ * Returns an array of errors
+ * @param $key int, optional session key to retun error on
+ * @return array of error messages
+ */
+ public function error( $key = false )
+ {
+ if( $key === false )
+ {
+ foreach( $this->sessions as $session )
+ $errors[] = curl_error( $session );
+ }
+ else
+ $errors[] = curl_error( $this->sessions[$key] );
+
+ return $errors;
+ }
+
+ /**
+ * Returns an array of session error numbers
+ * @param $key int, optional session key to retun error on
+ * @return array of error codes
+ */
+ public function errorNo( $key = false )
+ {
+ if( $key === false )
+ {
+ foreach( $this->sessions as $session )
+ $errors[] = curl_errno( $session );
+ }
+ else
+ $errors[] = curl_errno( $this->sessions[$key] );
+
+ return $errors;
+ }
+
+}
+
+?>
diff --git a/addSite.php b/addSite.php
new file mode 100644
index 0000000..6eb26fe
--- /dev/null
+++ b/addSite.php
@@ -0,0 +1,41 @@
+
+$url = $_POST['newLink'];
+if($url == '' || !isset($_POST['newLink']))
+header('Location: index.php');
+?>
+
+
+
+
+
+
+
+
+
+ Ma Page d'accueil
+
+
+
+
+
+
+echo 'URL : '.$url.'
';
+require('blogs_last_post.php');
+$opts = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 10);
+$blogs = new Blogs_last_post();
+$blogs->addSession($url, $opts);
+$result = $blogs->exec();
+echo $blogs->getAllImagesToChoose($result);
+$blogs->clear();
diff --git a/add_note.html b/add_note.html
new file mode 100644
index 0000000..4f0716c
--- /dev/null
+++ b/add_note.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+
diff --git a/ajax/addSiteXML.php b/ajax/addSiteXML.php
new file mode 100644
index 0000000..7bd61f9
--- /dev/null
+++ b/ajax/addSiteXML.php
@@ -0,0 +1,25 @@
+
+$number = $_POST['number'];
+$url = $_POST['url'];
+$name = $_POST['name'];
+
+$nb = 1;
+
+$xmla = simplexml_load_file('../db/blog_links.xml');
+
+$test = $xmla->note;
+
+$field_count = count($test);
+
+for($i=0;$i<$field_count;$i++){
+ if($nb <= $test[$i]['id']) $nb = $test[$i]['id']+1;
+}
+
+$newnote = $xmla->addChild('link');
+$newnote->addChild('name', $name);
+$newnote->addChild('number', $number);
+$newnote->addChild('url', $url);
+$xmla->asXML('../db/blog_links.xml');
+
+echo $nb;
+?>
diff --git a/ajax/delete-notes.php b/ajax/delete-notes.php
new file mode 100644
index 0000000..ddf236e
--- /dev/null
+++ b/ajax/delete-notes.php
@@ -0,0 +1,25 @@
+// Escaping the input data:
+
+$rid = $_POST['id'];
+$explodeid = explode("-",$rid);
+$id = intval($explodeid[1]);
+
+
+$xmla = simplexml_load_file('../db/notes.xml');
+
+$target = false;
+$i = 0;
+
+foreach ($xmla->note as $s) {
+ if ($s['id']==$id) { $target = $i; break; }
+ $i++;
+}
+if ($target !== false) {
+ unset($xmla->note[$target]);
+}
+
+$xmla->asXML('../db/notes.xml');
+
+$target++;
+echo $target;
+?>
diff --git a/ajax/post-config.php b/ajax/post-config.php
new file mode 100644
index 0000000..0c6096d
--- /dev/null
+++ b/ajax/post-config.php
@@ -0,0 +1,21 @@
+// Escaping the input data:
+
+$clock = $_POST['clock'];
+$meteo = $_POST['meteo'];
+$notes = $_POST['notes'];
+$search = $_POST['search'];
+$links = $_POST['links'];
+$blogs = $_POST['blogs'];
+
+$xmla = simplexml_load_file('../db/config.xml');
+$config_xml = $xmla->item;
+$config_xml[0]->visibility = $clock;
+$config_xml[1]->visibility = $meteo;
+$config_xml[2]->visibility = $notes;
+$config_xml[3]->visibility = $search;
+$config_xml[4]->visibility = $links;
+$config_xml[5]->visibility = $blogs;
+$xmla->asXML('../db/config.xml');
+
+echo "1";
+?>
diff --git a/ajax/post-notes.php b/ajax/post-notes.php
new file mode 100644
index 0000000..46b2661
--- /dev/null
+++ b/ajax/post-notes.php
@@ -0,0 +1,29 @@
+// Escaping the input data:
+
+$body = $_POST['body'];
+$color = $_POST['color'];
+$zindex = $_POST['zindex'];
+$nb = 1;
+
+$xmla = simplexml_load_file('../db/notes.xml');
+$field_count = count($xmla->note);
+/*foreach($xmla->note as $test){
+ if($nb < $test['id']){$nb=$test['id'];}
+}*/
+
+$test = $xmla->note;
+for($i=0;$i<$field_count;$i++){
+ if($nb <= $test[$i]['id']) $nb = $test[$i]['id']+1;
+}
+
+$newnote = $xmla->addChild('note');
+$newnote->addAttribute("id", $nb);
+$newnote->addChild('text', $body);
+$newnote->addChild('color', $color);
+$newnote->addChild('zindex', $zindex);
+$newnote->addChild('top', '0');
+$newnote->addChild('left', '0');
+$xmla->asXML('../db/notes.xml');
+
+echo $nb;
+?>
diff --git a/ajax/saveTodoist.php b/ajax/saveTodoist.php
new file mode 100644
index 0000000..e881b4c
--- /dev/null
+++ b/ajax/saveTodoist.php
@@ -0,0 +1,21 @@
+
+$xmla = simplexml_load_file('../db/todoist.xml');
+if(isset($_GET['token'])){
+$token = trim($_GET['token']);
+
+$xmla->addChild("token", $token);
+
+$xmla->asXML('../db/todoist.xml');
+
+echo $token;
+}else if(isset($_GET['name']) && isset($_GET['id'])){
+ $name = trim($_GET['name']);
+ $id = trim($_GET['id']);
+
+ $xmla->addChild("name", $name);
+ $xmla->addChild("id", $id);
+
+ $xmla->asXML('../db/todoist.xml');
+
+echo $id;
+}
\ No newline at end of file
diff --git a/ajax/update_position.php b/ajax/update_position.php
new file mode 100644
index 0000000..60e80d2
--- /dev/null
+++ b/ajax/update_position.php
@@ -0,0 +1,22 @@
+note as $s) {
+ if ($s['id']==$id) { $target = $i; break; }
+ $i++;
+}
+
+$xmla->note[$target]->top = $y;
+$xmla->note[$target]->left = $x;
+$xmla->note[$target]->zindex = $z;
+
+
+$xmla->asXML('../db/notes.xml');
+
+echo $target;
?>
diff --git a/ajax/update_position_config.php b/ajax/update_position_config.php
new file mode 100644
index 0000000..4c1ef6d
--- /dev/null
+++ b/ajax/update_position_config.php
@@ -0,0 +1,27 @@
+item[1]->y = $y;
+ $xmla->item[1]->x = $x;
+ $target = 1;
+ echo $id;
+}*/
+$target = -1;
+$i = 0;
+
+foreach ($xmla->item as $s) {
+ if ($s['id']==$id) { $target = $i; break; }
+ $i++;
+}
+
+$xmla->item[$target]->y = $y;
+$xmla->item[$target]->x = $x;
+
+
+$xmla->asXML('../db/config.xml');
+
+echo $target;
?>
diff --git a/blogs.php b/blogs.php
new file mode 100644
index 0000000..694c236
--- /dev/null
+++ b/blogs.php
@@ -0,0 +1,11 @@
+
+require('blogs_last_post.php');
+$opts = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 10);
+$blogs = new Blogs_last_post();
+foreach($blogs->getLinks() as $link)
+{
+ $blogs->addSession($link['url'], $opts);
+}
+echo $blogs->getEverything();
+$blogs->clear();
+
diff --git a/blogs_last_post.php b/blogs_last_post.php
new file mode 100644
index 0000000..952afc4
--- /dev/null
+++ b/blogs_last_post.php
@@ -0,0 +1,177 @@
+
+require('CURL.php');
+class Blogs_last_post extends CURL{
+
+private $_result;
+
+/*private $listeImages = array(
+ 0 => 0, // penelope
+ 1 => 12, //explosm
+ 2 => 0, // margaux
+);
+
+private $nomImages = array(
+ 0 => 'PenelopeBagieu',
+ 1 => 'CyanideAndHapiness',
+ 2 => 'MargauxMotin',
+);
+
+public $link = array(
+ 0 => 'http://www.penelope-jolicoeur.com/',
+ 1 => 'http://www.explosm.net/comics/',
+ 2 => 'http://margauxmotin.typepad.fr/',
+);*/
+private $link = array();
+
+
+function getResult()
+{
+ return $this->_result;
+}
+
+public function getLinks(){
+ if($linksXML = simplexml_load_file('db/blog_links.xml')){
+ foreach($linksXML->link as $individualLink){
+ $this->link[] = array('name'=>$individualLink->name, 'url'=>$individualLink->url, 'number'=>$individualLink->number);
+ }
+ return $this->link;
+ }
+ else
+ return;
+}
+
+function getTitles()
+{
+ $xhtml = "";
+ try{
+ foreach($this->exec() as $result)
+ {
+ $xhtml .= $this->getTitle($result);
+ $xhtml .= '
';
+ }
+ }catch(Exception $e)
+ {
+ $xhtml .= $this->error();
+ }
+ return $xhtml;
+
+}
+
+function getTitle($result = null, $url = null)
+{
+ if(isset($result))
+ {
+ preg_match( "/