Browse Source

Convertit les CRLF (windows) en LF (unix)

find . -type f -print -o -path './.git' -prune -o -path './cache' \
-prune | xargs dos2unix
Christophe HENRY 7 years ago
parent
commit
5a694723ae
15 changed files with 3075 additions and 3438 deletions
  1. 313 313
      .htaccess
  2. 44 44
      404.html
  3. 94 94
      Configuration.class.php
  4. 181 181
      Event.class.php
  5. 295 295
      Feed.class.php
  6. 99 99
      Folder.class.php
  7. 359 359
      Functions.class.php
  8. 199 199
      MysqlConnector.class.php
  9. 435 435
      MysqlEntity.class.php
  10. 90 90
      User.class.php
  11. 531 531
      action.php
  12. 20 20
      humans.txt
  13. 371 371
      install.php
  14. 44 44
      templates/marigolds/404.html
  15. 0 363
      templates/marigolds/css/style.css

+ 313 - 313
.htaccess

@@ -1,313 +1,313 @@
-# ----------------------------------------------------------------------
-# Better website experience for IE users
-# ----------------------------------------------------------------------
-
-# Force the latest IE version, in various cases when it may fall back to IE7 mode
-#  github.com/rails/rails/commit/123eb25#commitcomment-118920
-# Use ChromeFrame if it's installed for a better experience for the poor IE folk
-
-<IfModule mod_headers.c>
-  Header set X-UA-Compatible "IE=Edge,chrome=1"
-  # mod_headers can't match by content-type, but we don't want to send this header on *everything*...
-  <FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
-    Header unset X-UA-Compatible
-  </FilesMatch>
-</IfModule>
-
-
-# ----------------------------------------------------------------------
-# Cross-domain AJAX requests
-# ----------------------------------------------------------------------
-
-# Serve cross-domain Ajax requests, disabled by default.
-# enable-cors.org
-# code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
-
-#  <IfModule mod_headers.c>
-#    Header set Access-Control-Allow-Origin "*"
-#  </IfModule>
-
-
-# ----------------------------------------------------------------------
-# CORS-enabled images (@crossorigin)
-# ----------------------------------------------------------------------
-
-# Send CORS headers if browsers request them; enabled by default for images.
-# developer.mozilla.org/en/CORS_Enabled_Image
-# blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
-# hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
-# wiki.mozilla.org/Security/Reviews/crossoriginAttribute
-
-<IfModule mod_setenvif.c>
-  <IfModule mod_headers.c>
-    # mod_headers, y u no match by Content-Type?!
-    <FilesMatch "\.(gif|png|jpe?g|svg|svgz|ico|webp)$">
-      SetEnvIf Origin ":" IS_CORS
-      Header set Access-Control-Allow-Origin "*" env=IS_CORS
-    </FilesMatch>
-  </IfModule>
-</IfModule>
-
-
-# ----------------------------------------------------------------------
-# Webfont access
-# ----------------------------------------------------------------------
-
-# Allow access from all domains for webfonts.
-# Alternatively you could only whitelist your
-# subdomains like "subdomain.example.com".
-
-<IfModule mod_headers.c>
-  <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
-    Header set Access-Control-Allow-Origin "*"
-  </FilesMatch>
-</IfModule>
-
-
-
-# ----------------------------------------------------------------------
-# Proper MIME type for all files
-# ----------------------------------------------------------------------
-
-
-# JavaScript
-#   Normalize to standard type (it's sniffed in IE anyways)
-#   tools.ietf.org/html/rfc4329#section-7.2
-AddType application/javascript         js
-
-# Audio
-AddType audio/ogg                      oga ogg
-AddType audio/mp4                      m4a
-
-# Video
-AddType video/ogg                      ogv
-AddType video/mp4                      mp4 m4v
-AddType video/webm                     webm
-
-# SVG
-#   Required for svg webfonts on iPad
-#   twitter.com/FontSquirrel/status/14855840545
-AddType     image/svg+xml              svg svgz
-AddEncoding gzip                       svgz
-
-# Webfonts
-AddType application/vnd.ms-fontobject  eot
-AddType application/x-font-ttf         ttf ttc
-AddType font/opentype                  otf
-AddType application/x-font-woff        woff
-
-# Assorted types
-AddType image/x-icon                        ico
-AddType image/webp                          webp
-AddType text/cache-manifest                 appcache manifest
-AddType text/x-component                    htc
-AddType application/x-chrome-extension      crx
-AddType application/x-opera-extension       oex
-AddType application/x-xpinstall             xpi
-AddType application/octet-stream            safariextz
-AddType application/x-web-app-manifest+json webapp
-AddType text/x-vcard                        vcf
-
-
-# ----------------------------------------------------------------------
-# Gzip compression
-# ----------------------------------------------------------------------
-
-<IfModule mod_deflate.c>
-
-  # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
-  <IfModule mod_setenvif.c>
-    <IfModule mod_headers.c>
-      SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
-      RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
-    </IfModule>
-  </IfModule>
-
-  # HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
-#  <IfModule filter_module>
-#    FilterDeclare   COMPRESS
-# There are two way to configure the filters, according to the Apache version.
-# Apache >= 2.4 
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/html
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/css
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/plain
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/xml
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/x-component
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/javascript
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/json
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xml
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xhtml+xml
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/rss+xml
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/atom+xml
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/vnd.ms-fontobject
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/svg+xml
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/x-icon
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/x-font-ttf
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $font/opentype
-# Apache <= 2.2
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/html
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/css
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/plain
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/xml
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/x-component
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/javascript
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/json
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xml
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xhtml+xml
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/rss+xml
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/atom+xml
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/vnd.ms-fontobject
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/svg+xml
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/x-icon
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/x-font-ttf
-#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $font/opentype
-#    FilterChain     COMPRESS
-#    FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no
-#  </IfModule>
-
-  <IfModule !mod_filter.c>
-    # Legacy versions of Apache
-    AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
-    AddOutputFilterByType DEFLATE application/javascript
-    AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
-    AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
-    AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
-  </IfModule>
-
-</IfModule>
-
-
-# ----------------------------------------------------------------------
-# Expires headers (for better cache control)
-# ----------------------------------------------------------------------
-
-# These are pretty far-future expires headers.
-# They assume you control versioning with cachebusting query params like
-#   <script src="application.js?20100608">
-# Additionally, consider that outdated proxies may miscache
-#   www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
-
-# If you don't use filenames to version, lower the CSS  and JS to something like
-#   "access plus 1 week" or so.
-
-<IfModule mod_expires.c>
-  ExpiresActive on
-
-# Perhaps better to whitelist expires rules? Perhaps.
-  ExpiresDefault                          "access plus 1 month"
-
-# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
-  ExpiresByType text/cache-manifest       "access plus 0 seconds"
-
-# Your document html
-  ExpiresByType text/html                 "access plus 0 seconds"
-
-# Data
-  ExpiresByType text/xml                  "access plus 0 seconds"
-  ExpiresByType application/xml           "access plus 0 seconds"
-  ExpiresByType application/json          "access plus 0 seconds"
-
-# Feed
-  ExpiresByType application/rss+xml       "access plus 1 hour"
-  ExpiresByType application/atom+xml      "access plus 1 hour"
-
-# Favicon (cannot be renamed)
-  ExpiresByType image/x-icon              "access plus 1 week"
-
-# Media: images, video, audio
-  ExpiresByType image/gif                 "access plus 1 month"
-  ExpiresByType image/png                 "access plus 1 month"
-  ExpiresByType image/jpg                 "access plus 1 month"
-  ExpiresByType image/jpeg                "access plus 1 month"
-  ExpiresByType video/ogg                 "access plus 1 month"
-  ExpiresByType audio/ogg                 "access plus 1 month"
-  ExpiresByType video/mp4                 "access plus 1 month"
-  ExpiresByType video/webm                "access plus 1 month"
-
-# HTC files  (css3pie)
-  ExpiresByType text/x-component          "access plus 1 month"
-
-# Webfonts
-  ExpiresByType application/x-font-ttf    "access plus 1 month"
-  ExpiresByType font/opentype             "access plus 1 month"
-  ExpiresByType application/x-font-woff   "access plus 1 month"
-  ExpiresByType image/svg+xml             "access plus 1 month"
-  ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
-
-# CSS and JavaScript
-  ExpiresByType text/css                  "access plus 1 year"
-  ExpiresByType application/javascript    "access plus 1 year"
-
-</IfModule>
-
-
-
-# ----------------------------------------------------------------------
-# ETag removal
-# ----------------------------------------------------------------------
-
-# FileETag None is not enough for every server.
-<IfModule mod_headers.c>
-  Header unset ETag
-</IfModule>
-
-# Since we're sending far-future expires, we don't need ETags for
-# static content.
-#   developer.yahoo.com/performance/rules.html#etags
-FileETag None
-
-
-
-# ----------------------------------------------------------------------
-# Stop screen flicker in IE on CSS rollovers
-# ----------------------------------------------------------------------
-
-# The following directives stop screen flicker in IE on CSS rollovers - in
-# combination with the "ExpiresByType" rules for images (see above). If
-# needed, un-comment the following rules.
-
-# BrowserMatch "MSIE" brokenvary=1
-# BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
-# BrowserMatch "Opera" !brokenvary
-# SetEnvIf brokenvary 1 force-no-vary
-
-
-
-# ----------------------------------------------------------------------
-# Cookie setting from iframes
-# ----------------------------------------------------------------------
-
-# Allow cookies to be set from iframes (for IE only)
-# If needed, uncomment and specify a path or regex in the Location directive
-
-# <IfModule mod_headers.c>
-#   <Location />
-#     Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
-#   </Location>
-# </IfModule>
-
-
-
-
-
-# ----------------------------------------------------------------------
-# Custom 404 page
-# ----------------------------------------------------------------------
-
-# You can add custom pages to handle 500 or 403 pretty easily, if you like.
-ErrorDocument 404 /404.html
-
-
-
-# ----------------------------------------------------------------------
-# UTF-8 encoding
-# ----------------------------------------------------------------------
-
-# Use UTF-8 encoding for anything served text/plain or text/html
-AddDefaultCharset utf-8
-
-# Force UTF-8 for a number of file formats
-AddCharset utf-8 .css .js .xml .json .rss .atom
-
-
-
+# ----------------------------------------------------------------------
+# Better website experience for IE users
+# ----------------------------------------------------------------------
+
+# Force the latest IE version, in various cases when it may fall back to IE7 mode
+#  github.com/rails/rails/commit/123eb25#commitcomment-118920
+# Use ChromeFrame if it's installed for a better experience for the poor IE folk
+
+<IfModule mod_headers.c>
+  Header set X-UA-Compatible "IE=Edge,chrome=1"
+  # mod_headers can't match by content-type, but we don't want to send this header on *everything*...
+  <FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
+    Header unset X-UA-Compatible
+  </FilesMatch>
+</IfModule>
+
+
+# ----------------------------------------------------------------------
+# Cross-domain AJAX requests
+# ----------------------------------------------------------------------
+
+# Serve cross-domain Ajax requests, disabled by default.
+# enable-cors.org
+# code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
+
+#  <IfModule mod_headers.c>
+#    Header set Access-Control-Allow-Origin "*"
+#  </IfModule>
+
+
+# ----------------------------------------------------------------------
+# CORS-enabled images (@crossorigin)
+# ----------------------------------------------------------------------
+
+# Send CORS headers if browsers request them; enabled by default for images.
+# developer.mozilla.org/en/CORS_Enabled_Image
+# blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
+# hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
+# wiki.mozilla.org/Security/Reviews/crossoriginAttribute
+
+<IfModule mod_setenvif.c>
+  <IfModule mod_headers.c>
+    # mod_headers, y u no match by Content-Type?!
+    <FilesMatch "\.(gif|png|jpe?g|svg|svgz|ico|webp)$">
+      SetEnvIf Origin ":" IS_CORS
+      Header set Access-Control-Allow-Origin "*" env=IS_CORS
+    </FilesMatch>
+  </IfModule>
+</IfModule>
+
+
+# ----------------------------------------------------------------------
+# Webfont access
+# ----------------------------------------------------------------------
+
+# Allow access from all domains for webfonts.
+# Alternatively you could only whitelist your
+# subdomains like "subdomain.example.com".
+
+<IfModule mod_headers.c>
+  <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
+    Header set Access-Control-Allow-Origin "*"
+  </FilesMatch>
+</IfModule>
+
+
+
+# ----------------------------------------------------------------------
+# Proper MIME type for all files
+# ----------------------------------------------------------------------
+
+
+# JavaScript
+#   Normalize to standard type (it's sniffed in IE anyways)
+#   tools.ietf.org/html/rfc4329#section-7.2
+AddType application/javascript         js
+
+# Audio
+AddType audio/ogg                      oga ogg
+AddType audio/mp4                      m4a
+
+# Video
+AddType video/ogg                      ogv
+AddType video/mp4                      mp4 m4v
+AddType video/webm                     webm
+
+# SVG
+#   Required for svg webfonts on iPad
+#   twitter.com/FontSquirrel/status/14855840545
+AddType     image/svg+xml              svg svgz
+AddEncoding gzip                       svgz
+
+# Webfonts
+AddType application/vnd.ms-fontobject  eot
+AddType application/x-font-ttf         ttf ttc
+AddType font/opentype                  otf
+AddType application/x-font-woff        woff
+
+# Assorted types
+AddType image/x-icon                        ico
+AddType image/webp                          webp
+AddType text/cache-manifest                 appcache manifest
+AddType text/x-component                    htc
+AddType application/x-chrome-extension      crx
+AddType application/x-opera-extension       oex
+AddType application/x-xpinstall             xpi
+AddType application/octet-stream            safariextz
+AddType application/x-web-app-manifest+json webapp
+AddType text/x-vcard                        vcf
+
+
+# ----------------------------------------------------------------------
+# Gzip compression
+# ----------------------------------------------------------------------
+
+<IfModule mod_deflate.c>
+
+  # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
+  <IfModule mod_setenvif.c>
+    <IfModule mod_headers.c>
+      SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
+      RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
+    </IfModule>
+  </IfModule>
+
+  # HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
+#  <IfModule filter_module>
+#    FilterDeclare   COMPRESS
+# There are two way to configure the filters, according to the Apache version.
+# Apache >= 2.4 
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/html
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/css
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/plain
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/xml
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/x-component
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/javascript
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/json
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xml
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xhtml+xml
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/rss+xml
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/atom+xml
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/vnd.ms-fontobject
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/svg+xml
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/x-icon
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/x-font-ttf
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $font/opentype
+# Apache <= 2.2
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/html
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/css
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/plain
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/xml
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/x-component
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/javascript
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/json
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xml
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xhtml+xml
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/rss+xml
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/atom+xml
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/vnd.ms-fontobject
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/svg+xml
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/x-icon
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/x-font-ttf
+#     FilterProvider  COMPRESS  DEFLATE resp=Content-Type $font/opentype
+#    FilterChain     COMPRESS
+#    FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no
+#  </IfModule>
+
+  <IfModule !mod_filter.c>
+    # Legacy versions of Apache
+    AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
+    AddOutputFilterByType DEFLATE application/javascript
+    AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
+    AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
+    AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
+  </IfModule>
+
+</IfModule>
+
+
+# ----------------------------------------------------------------------
+# Expires headers (for better cache control)
+# ----------------------------------------------------------------------
+
+# These are pretty far-future expires headers.
+# They assume you control versioning with cachebusting query params like
+#   <script src="application.js?20100608">
+# Additionally, consider that outdated proxies may miscache
+#   www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
+
+# If you don't use filenames to version, lower the CSS  and JS to something like
+#   "access plus 1 week" or so.
+
+<IfModule mod_expires.c>
+  ExpiresActive on
+
+# Perhaps better to whitelist expires rules? Perhaps.
+  ExpiresDefault                          "access plus 1 month"
+
+# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
+  ExpiresByType text/cache-manifest       "access plus 0 seconds"
+
+# Your document html
+  ExpiresByType text/html                 "access plus 0 seconds"
+
+# Data
+  ExpiresByType text/xml                  "access plus 0 seconds"
+  ExpiresByType application/xml           "access plus 0 seconds"
+  ExpiresByType application/json          "access plus 0 seconds"
+
+# Feed
+  ExpiresByType application/rss+xml       "access plus 1 hour"
+  ExpiresByType application/atom+xml      "access plus 1 hour"
+
+# Favicon (cannot be renamed)
+  ExpiresByType image/x-icon              "access plus 1 week"
+
+# Media: images, video, audio
+  ExpiresByType image/gif                 "access plus 1 month"
+  ExpiresByType image/png                 "access plus 1 month"
+  ExpiresByType image/jpg                 "access plus 1 month"
+  ExpiresByType image/jpeg                "access plus 1 month"
+  ExpiresByType video/ogg                 "access plus 1 month"
+  ExpiresByType audio/ogg                 "access plus 1 month"
+  ExpiresByType video/mp4                 "access plus 1 month"
+  ExpiresByType video/webm                "access plus 1 month"
+
+# HTC files  (css3pie)
+  ExpiresByType text/x-component          "access plus 1 month"
+
+# Webfonts
+  ExpiresByType application/x-font-ttf    "access plus 1 month"
+  ExpiresByType font/opentype             "access plus 1 month"
+  ExpiresByType application/x-font-woff   "access plus 1 month"
+  ExpiresByType image/svg+xml             "access plus 1 month"
+  ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
+
+# CSS and JavaScript
+  ExpiresByType text/css                  "access plus 1 year"
+  ExpiresByType application/javascript    "access plus 1 year"
+
+</IfModule>
+
+
+
+# ----------------------------------------------------------------------
+# ETag removal
+# ----------------------------------------------------------------------
+
+# FileETag None is not enough for every server.
+<IfModule mod_headers.c>
+  Header unset ETag
+</IfModule>
+
+# Since we're sending far-future expires, we don't need ETags for
+# static content.
+#   developer.yahoo.com/performance/rules.html#etags
+FileETag None
+
+
+
+# ----------------------------------------------------------------------
+# Stop screen flicker in IE on CSS rollovers
+# ----------------------------------------------------------------------
+
+# The following directives stop screen flicker in IE on CSS rollovers - in
+# combination with the "ExpiresByType" rules for images (see above). If
+# needed, un-comment the following rules.
+
+# BrowserMatch "MSIE" brokenvary=1
+# BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
+# BrowserMatch "Opera" !brokenvary
+# SetEnvIf brokenvary 1 force-no-vary
+
+
+
+# ----------------------------------------------------------------------
+# Cookie setting from iframes
+# ----------------------------------------------------------------------
+
+# Allow cookies to be set from iframes (for IE only)
+# If needed, uncomment and specify a path or regex in the Location directive
+
+# <IfModule mod_headers.c>
+#   <Location />
+#     Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
+#   </Location>
+# </IfModule>
+
+
+
+
+
+# ----------------------------------------------------------------------
+# Custom 404 page
+# ----------------------------------------------------------------------
+
+# You can add custom pages to handle 500 or 403 pretty easily, if you like.
+ErrorDocument 404 /404.html
+
+
+
+# ----------------------------------------------------------------------
+# UTF-8 encoding
+# ----------------------------------------------------------------------
+
+# Use UTF-8 encoding for anything served text/plain or text/html
+AddDefaultCharset utf-8
+
+# Force UTF-8 for a number of file formats
+AddCharset utf-8 .css .js .xml .json .rss .atom
+
+
+

+ 44 - 44
404.html

@@ -1,44 +1,44 @@
-<!doctype html>
-<html lang="en">
-<head>
-  <meta charset="utf-8">
-  <title>Page non trouvée :-(</title>
-  <style>
-    ::-moz-selection { background: #fe57a1; color: #fff; text-shadow: none; }
-    ::selection { background: #fe57a1; color: #fff; text-shadow: none; }
-    html { padding: 30px 10px; font-size: 20px; line-height: 1.4; color: #737373; background: #f0f0f0; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
-    html, input { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
-    body { max-width: 500px; _width: 500px; padding: 30px 20px 50px; border: 1px solid #b3b3b3; border-radius: 4px; margin: 0 auto; box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff; background: #fcfcfc; }
-    h1 { margin: 0 10px; font-size: 50px; text-align: center; }
-    h1 span { color: #bbb; }
-    h3 { margin: 1.5em 0 0.5em; }
-    p { margin: 1em 0; }
-    ul { padding: 0 0 0 40px; margin: 1em 0; }
-    .container { max-width: 380px; _width: 380px; margin: 0 auto; }
-    /* google search */
-    #goog-fixurl ul { list-style: none; padding: 0; margin: 0; }
-    #goog-fixurl form { margin: 0; }
-    #goog-wm-qt, #goog-wm-sb { border: 1px solid #bbb; font-size: 16px; line-height: normal; vertical-align: top; color: #444; border-radius: 2px; }
-    #goog-wm-qt { width: 220px; height: 20px; padding: 5px; margin: 5px 10px 0 0; box-shadow: inset 0 1px 1px #ccc; }
-    #goog-wm-sb { display: inline-block; height: 32px; padding: 0 10px; margin: 5px 0 0; white-space: nowrap; cursor: pointer; background-color: #f5f5f5; background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1); -webkit-appearance: none; -moz-appearance: none; appearance: none; *overflow: visible; *display: inline; *zoom: 1; }
-    #goog-wm-sb:hover, #goog-wm-sb:focus { border-color: #aaa; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); background-color: #f8f8f8; }
-    #goog-wm-qt:focus, #goog-wm-sb:focus { border-color: #105cb6; outline: 0; color: #222; }
-    input::-moz-focus-inner { padding: 0; border: 0; }
-  </style>
-</head>
-<body>
-  <div class="container">
-    <h1>Page non trouvée <span>:-(</span></h1>
-    <p>Désolé la page que vous cherchez n'existe pas.</p>
-    <p>C'est certainement :</p>
-    <ul>
-      <li>Une adresse mal tapée.</li>
-      <li>Un lien mort.</li>
-    </ul>
-    <script>
-      var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host;
-    </script>
-    <script src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
-  </div>
-</body>
-</html>
+<!doctype html>
+<html lang="en">
+<head>
+  <meta charset="utf-8">
+  <title>Page non trouvée :-(</title>
+  <style>
+    ::-moz-selection { background: #fe57a1; color: #fff; text-shadow: none; }
+    ::selection { background: #fe57a1; color: #fff; text-shadow: none; }
+    html { padding: 30px 10px; font-size: 20px; line-height: 1.4; color: #737373; background: #f0f0f0; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
+    html, input { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
+    body { max-width: 500px; _width: 500px; padding: 30px 20px 50px; border: 1px solid #b3b3b3; border-radius: 4px; margin: 0 auto; box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff; background: #fcfcfc; }
+    h1 { margin: 0 10px; font-size: 50px; text-align: center; }
+    h1 span { color: #bbb; }
+    h3 { margin: 1.5em 0 0.5em; }
+    p { margin: 1em 0; }
+    ul { padding: 0 0 0 40px; margin: 1em 0; }
+    .container { max-width: 380px; _width: 380px; margin: 0 auto; }
+    /* google search */
+    #goog-fixurl ul { list-style: none; padding: 0; margin: 0; }
+    #goog-fixurl form { margin: 0; }
+    #goog-wm-qt, #goog-wm-sb { border: 1px solid #bbb; font-size: 16px; line-height: normal; vertical-align: top; color: #444; border-radius: 2px; }
+    #goog-wm-qt { width: 220px; height: 20px; padding: 5px; margin: 5px 10px 0 0; box-shadow: inset 0 1px 1px #ccc; }
+    #goog-wm-sb { display: inline-block; height: 32px; padding: 0 10px; margin: 5px 0 0; white-space: nowrap; cursor: pointer; background-color: #f5f5f5; background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1); -webkit-appearance: none; -moz-appearance: none; appearance: none; *overflow: visible; *display: inline; *zoom: 1; }
+    #goog-wm-sb:hover, #goog-wm-sb:focus { border-color: #aaa; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); background-color: #f8f8f8; }
+    #goog-wm-qt:focus, #goog-wm-sb:focus { border-color: #105cb6; outline: 0; color: #222; }
+    input::-moz-focus-inner { padding: 0; border: 0; }
+  </style>
+</head>
+<body>
+  <div class="container">
+    <h1>Page non trouvée <span>:-(</span></h1>
+    <p>Désolé la page que vous cherchez n'existe pas.</p>
+    <p>C'est certainement :</p>
+    <ul>
+      <li>Une adresse mal tapée.</li>
+      <li>Un lien mort.</li>
+    </ul>
+    <script>
+      var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host;
+    </script>
+    <script src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
+  </div>
+</body>
+</html>

+ 94 - 94
Configuration.class.php

@@ -1,95 +1,95 @@
-<?php
-
-
-/*
- @nom: Configuration
- @auteur: Idleman (idleman@idleman.fr)
- @description: Classe de gestion des préférences, fonctionne sur un simple système clé=>valeur avec un cache session pour eviter les requête inutiles
- */
-
-class Configuration extends MysqlEntity{
-
-	protected $id,$key,$value,$confTab;
-	protected $TABLE_NAME = 'configuration';
-	protected $CLASS_NAME = 'Configuration';
-	protected $object_fields = 
-	array(
-		'id'=>'key',
-		'key'=>'longstring',
-		'value'=>'longstring'
-	);
-
-	function __construct(){
-		parent::__construct();
-	}
-
-	public function getAll(){
-
-		if(!isset($_SESSION['configuration'])){
-	
-		$configurationManager = new Configuration();
-		$configs = $configurationManager->populate();
-		$confTab = array();
-
-		foreach($configs as $config){
-			$this->confTab[$config->getKey()] = $config->getValue();
-		}
-
-		$_SESSION['configuration'] = serialize($this->confTab);
-		
-		}else{
-			$this->confTab = unserialize($_SESSION['configuration']);
-		}
-	}
-
-	public function get($key){
-
-		return (isset($this->confTab[$key])?$this->confTab[$key]:'');
-	}
-
-	public function put($key,$value){
-		$configurationManager = new Configuration();
-		if (isset($this->confTab[$key])){
-			$configurationManager->change(array('value'=>$value),array('key'=>$key));
-		} else {
-			$configurationManager->add($key,$value);	
-		}
-		$this->confTab[$key] = $value;
-		unset($_SESSION['configuration']);
-	}
-
-	public function add($key,$value){
-		$config = new Configuration();
-		$config->setKey($key);
-		$config->setValue($value);
-		$config->save();
-		$this->confTab[$key] = $value;
-		unset($_SESSION['configuration']);
-	}
-	
-	function getId(){
-		return $this->id;
-	}
-
-	function getKey(){
-		return $this->key;
-	}
-
-	function setKey($key){
-		$this->key = $key;
-	}
-
-	function getValue(){
-		return $this->value;
-	}
-
-	function setValue($value){
-		$this->value = $value;
-	}
-
-
-
-
-}
-
+<?php
+
+
+/*
+ @nom: Configuration
+ @auteur: Idleman (idleman@idleman.fr)
+ @description: Classe de gestion des préférences, fonctionne sur un simple système clé=>valeur avec un cache session pour eviter les requête inutiles
+ */
+
+class Configuration extends MysqlEntity{
+
+	protected $id,$key,$value,$confTab;
+	protected $TABLE_NAME = 'configuration';
+	protected $CLASS_NAME = 'Configuration';
+	protected $object_fields = 
+	array(
+		'id'=>'key',
+		'key'=>'longstring',
+		'value'=>'longstring'
+	);
+
+	function __construct(){
+		parent::__construct();
+	}
+
+	public function getAll(){
+
+		if(!isset($_SESSION['configuration'])){
+	
+		$configurationManager = new Configuration();
+		$configs = $configurationManager->populate();
+		$confTab = array();
+
+		foreach($configs as $config){
+			$this->confTab[$config->getKey()] = $config->getValue();
+		}
+
+		$_SESSION['configuration'] = serialize($this->confTab);
+		
+		}else{
+			$this->confTab = unserialize($_SESSION['configuration']);
+		}
+	}
+
+	public function get($key){
+
+		return (isset($this->confTab[$key])?$this->confTab[$key]:'');
+	}
+
+	public function put($key,$value){
+		$configurationManager = new Configuration();
+		if (isset($this->confTab[$key])){
+			$configurationManager->change(array('value'=>$value),array('key'=>$key));
+		} else {
+			$configurationManager->add($key,$value);	
+		}
+		$this->confTab[$key] = $value;
+		unset($_SESSION['configuration']);
+	}
+
+	public function add($key,$value){
+		$config = new Configuration();
+		$config->setKey($key);
+		$config->setValue($value);
+		$config->save();
+		$this->confTab[$key] = $value;
+		unset($_SESSION['configuration']);
+	}
+	
+	function getId(){
+		return $this->id;
+	}
+
+	function getKey(){
+		return $this->key;
+	}
+
+	function setKey($key){
+		$this->key = $key;
+	}
+
+	function getValue(){
+		return $this->value;
+	}
+
+	function setValue($value){
+		$this->value = $value;
+	}
+
+
+
+
+}
+
 ?>

+ 181 - 181
Event.class.php

@@ -1,181 +1,181 @@
-<?php
-
-/*
- @nom: Event
- @auteur: Idleman (idleman@idleman.fr)
- @description: Classe de gestion des évenements/news liés a chaques flux RSS/ATOM
- */
-
-class Event extends MysqlEntity{
-
-	protected $id,$title,$guid,$content,$description,$pudate,$link,$feed,$category,$creator,$unread,$favorite;
-	protected $TABLE_NAME = 'event';
-	protected $CLASS_NAME = 'Event';
-	protected $object_fields = 
-	array(
-		'id'=>'key',
-		'guid'=>'longstring',
-		'title'=>'string',
-		'creator'=>'string',
-		'content'=>'longstring',
-		'description'=>'longstring',
-		'link'=>'longstring',
-		'unread'=>'integer',
-		'feed'=>'integer',
-		'unread'=>'integer',
-		'favorite'=>'integer',
-		'pubdate'=>'integer',
-		'syncId'=>'integer',
-	);
-
-	protected $object_fields_index = 
-	array(
-		'feed'=>'index',
-		'unread'=>'index',
-		'favorite'=>'index'
-	);
-
-	function __construct($guid=null,$title=null,$description=null,$content=null,$pubdate=null,$link=null,$category=null,$creator=null){
-		
-		$this->guid = $guid;
-		$this->title = $title;
-		$this->creator = $creator;
-		$this->content = $content;
-		$this->description = $description;
-		$this->pubdate = $pubdate;
-		$this->link = $link;
-		$this->category = $category;
-		parent::__construct();
-	}
-
-
-	function getEventCountPerFolder(){
-		$events = array();
-		$results = $this->customQuery('SELECT COUNT('.MYSQL_PREFIX.$this->TABLE_NAME.'.id),'.MYSQL_PREFIX.'feed.folder FROM '.MYSQL_PREFIX.$this->TABLE_NAME.' INNER JOIN '.MYSQL_PREFIX.'feed ON ('.MYSQL_PREFIX.'event.feed = '.MYSQL_PREFIX.'feed.id) WHERE '.MYSQL_PREFIX.$this->TABLE_NAME.'.unread=1 GROUP BY '.MYSQL_PREFIX.'feed.folder');
-		while($item = mysql_fetch_array($results)){
-			$events[$item[1]] = $item[0];
-		}
-		
-		return $events;
-	}
-
-	function setId($id){
-		$this->id = $id;
-	}
-
-	function getCreator(){
-		return $this->creator;
-	}
-
-	function setCreator($creator){
-		$this->creator = $creator;
-	}
-
-	function getCategory(){
-		return $this->category;
-	}
-
-	function setCategory($category){
-		$this->category = $category;
-	}
-
-	function getDescription(){
-		return $this->description;
-	}
-
-	function setDescription($description,$encoding = true){
-		$this->description = $description;
-	}
-
-	function getPubdate($format=false){
-		if($this->pubdate!=0){
-		return ($format!=false?date($format,$this->pubdate):$this->pubdate);
-		}else{
-			return '';
-		}
-	}
-
-	function getPubdateWithInstant($instant){
-		$alpha = $instant - $this->pubdate;
-		if ($alpha < 86400 ){
-			$hour = floor($alpha/3600);
-			$alpha = ($hour!=0?$alpha-($hour*3600):$alpha);
-			$minuts = floor($alpha/60);
-			return 'il y a '.($hour!=0?$hour.'h et':'').' '.$minuts.'min';
-		}else{
-			return 'le '.$this->getPubdate('d/m/Y à H:i:s');
-		}
-	}
-
-	function setPubdate($pubdate){
-		$this->pubdate = (is_numeric($pubdate)?$pubdate:strtotime($pubdate));
-	}
-
-	function getLink(){
-		return $this->link;
-	}
-
-	function setLink($link){
-		$this->link = $link;
-	}
-
-	function getId(){
-		return $this->id;
-	}
-
-	function getTitle(){
-		return $this->title;
-	}
-
-	function setTitle($title){
-		$this->title = $title;
-	}
-
-	function getContent(){
-		return $this->content;
-	}
-
-	function setContent($content,$encoding=true){
-		$this->content = $content;
-	}
-
-
-	function getGuid(){
-		return $this->guid;
-	}
-
-	function setGuid($guid){
-		$this->guid = $guid;
-	}
-
-	function getSyncId(){
-		return $this->syncId;
-	}
-
-	function setSyncId($syncId){
-		$this->syncId = $syncId;
-	}
-	
-	function getUnread(){
-		return $this->unread;
-	}
-
-	function setUnread($unread){
-		$this->unread = $unread;
-	}
-	function setFeed($feed){
-		$this->feed = $feed;
-	}
-	function getFeed(){
-		return $this->feed;
-	}
-	function setFavorite($favorite){
-		$this->favorite = $favorite;
-	}
-	function getFavorite(){
-		return $this->favorite;
-	}
-
-}
-
-?>
+<?php
+
+/*
+ @nom: Event
+ @auteur: Idleman (idleman@idleman.fr)
+ @description: Classe de gestion des évenements/news liés a chaques flux RSS/ATOM
+ */
+
+class Event extends MysqlEntity{
+
+	protected $id,$title,$guid,$content,$description,$pudate,$link,$feed,$category,$creator,$unread,$favorite;
+	protected $TABLE_NAME = 'event';
+	protected $CLASS_NAME = 'Event';
+	protected $object_fields = 
+	array(
+		'id'=>'key',
+		'guid'=>'longstring',
+		'title'=>'string',
+		'creator'=>'string',
+		'content'=>'longstring',
+		'description'=>'longstring',
+		'link'=>'longstring',
+		'unread'=>'integer',
+		'feed'=>'integer',
+		'unread'=>'integer',
+		'favorite'=>'integer',
+		'pubdate'=>'integer',
+		'syncId'=>'integer',
+	);
+
+	protected $object_fields_index = 
+	array(
+		'feed'=>'index',
+		'unread'=>'index',
+		'favorite'=>'index'
+	);
+
+	function __construct($guid=null,$title=null,$description=null,$content=null,$pubdate=null,$link=null,$category=null,$creator=null){
+		
+		$this->guid = $guid;
+		$this->title = $title;
+		$this->creator = $creator;
+		$this->content = $content;
+		$this->description = $description;
+		$this->pubdate = $pubdate;
+		$this->link = $link;
+		$this->category = $category;
+		parent::__construct();
+	}
+
+
+	function getEventCountPerFolder(){
+		$events = array();
+		$results = $this->customQuery('SELECT COUNT('.MYSQL_PREFIX.$this->TABLE_NAME.'.id),'.MYSQL_PREFIX.'feed.folder FROM '.MYSQL_PREFIX.$this->TABLE_NAME.' INNER JOIN '.MYSQL_PREFIX.'feed ON ('.MYSQL_PREFIX.'event.feed = '.MYSQL_PREFIX.'feed.id) WHERE '.MYSQL_PREFIX.$this->TABLE_NAME.'.unread=1 GROUP BY '.MYSQL_PREFIX.'feed.folder');
+		while($item = mysql_fetch_array($results)){
+			$events[$item[1]] = $item[0];
+		}
+		
+		return $events;
+	}
+
+	function setId($id){
+		$this->id = $id;
+	}
+
+	function getCreator(){
+		return $this->creator;
+	}
+
+	function setCreator($creator){
+		$this->creator = $creator;
+	}
+
+	function getCategory(){
+		return $this->category;
+	}
+
+	function setCategory($category){
+		$this->category = $category;
+	}
+
+	function getDescription(){
+		return $this->description;
+	}
+
+	function setDescription($description,$encoding = true){
+		$this->description = $description;
+	}
+
+	function getPubdate($format=false){
+		if($this->pubdate!=0){
+		return ($format!=false?date($format,$this->pubdate):$this->pubdate);
+		}else{
+			return '';
+		}
+	}
+
+	function getPubdateWithInstant($instant){
+		$alpha = $instant - $this->pubdate;
+		if ($alpha < 86400 ){
+			$hour = floor($alpha/3600);
+			$alpha = ($hour!=0?$alpha-($hour*3600):$alpha);
+			$minuts = floor($alpha/60);
+			return 'il y a '.($hour!=0?$hour.'h et':'').' '.$minuts.'min';
+		}else{
+			return 'le '.$this->getPubdate('d/m/Y à H:i:s');
+		}
+	}
+
+	function setPubdate($pubdate){
+		$this->pubdate = (is_numeric($pubdate)?$pubdate:strtotime($pubdate));
+	}
+
+	function getLink(){
+		return $this->link;
+	}
+
+	function setLink($link){
+		$this->link = $link;
+	}
+
+	function getId(){
+		return $this->id;
+	}
+
+	function getTitle(){
+		return $this->title;
+	}
+
+	function setTitle($title){
+		$this->title = $title;
+	}
+
+	function getContent(){
+		return $this->content;
+	}
+
+	function setContent($content,$encoding=true){
+		$this->content = $content;
+	}
+
+
+	function getGuid(){
+		return $this->guid;
+	}
+
+	function setGuid($guid){
+		$this->guid = $guid;
+	}
+
+	function getSyncId(){
+		return $this->syncId;
+	}
+
+	function setSyncId($syncId){
+		$this->syncId = $syncId;
+	}
+	
+	function getUnread(){
+		return $this->unread;
+	}
+
+	function setUnread($unread){
+		$this->unread = $unread;
+	}
+	function setFeed($feed){
+		$this->feed = $feed;
+	}
+	function getFeed(){
+		return $this->feed;
+	}
+	function setFavorite($favorite){
+		$this->favorite = $favorite;
+	}
+	function getFavorite(){
+		return $this->favorite;
+	}
+
+}
+
+?>

+ 295 - 295
Feed.class.php

@@ -1,295 +1,295 @@
-<?php
-
-/*
- @nom: Feed
- @auteur: Idleman (idleman@idleman.fr)
- @description: Classe de gestion des flux RSS/ATOM
- */
-
-class Feed extends MysqlEntity{
-
-	protected $id,$name,$url,$events=array(),$description,$website,$folder,$lastupdate;
-	protected $TABLE_NAME = 'feed';
-	protected $CLASS_NAME = 'Feed';
-	protected $object_fields = 
-	array(
-		'id'=>'key',
-		'name'=>'string',
-		'description'=>'longstring',
-		'website'=>'longstring',
-		'url'=>'longstring',
-		'lastupdate'=>'string',
-		'folder'=>'integer'
-	);
-	
-	protected $object_fields_index = 
-	array(
-		'folder'=>'index'
-	);
-
-	protected $error = '';
-	
-	function __construct($name=null,$url=null){
-		$this->name = $name;
-		$this->url = $url;
-		parent::__construct();
-	}
-
-	/** @TODO: ne faire qu'un seul chargement avec SimplePie et récupérer les
-	même informations. Mettre le chargement en cache au moins d'une méthode
-	loadLeed() qui ne chargera qu'une seule fois. Voire même en déclenchement
-	retardé, au dernier moment. */
-	function getInfos(){
-		$xml = @simplexml_load_file($this->url);
-		if($xml!=false){
-			$this->name = array_shift ($xml->xpath('channel/title'));
-			$this->description = array_shift ($xml->xpath('channel/description'));
-			$this->website = array_shift ($xml->xpath('channel/link'));
-		}
-	}
-
-	function getError() { return $this->error; }
-	
-	/*@TODO: fournir un extrait quand il 'y a pas de description. De même pour les médias.
-	@TODO: SimplePie remplace "é" par "&eacute;", il ne devrait pas le faire.
-	J'ai testé set_stupidly_fast(true) sans succès.
-	Il encadre les descriptions avec <div>, absents dans le source du flux.
-	@TODO: la vérification de doublon est sous la responsabilité de l'appelant.
-	Il serait peut-être utile de faire une méthode add() qui vérifie, plante si
-	nécessaire, et appelle parse(). Impossible de vérifier dans parse() même
-	car elle est appelée aussi pour autre chose que l'ajout.
-	*/
-	function parse($syncId,&$nbEvents =0, $enableCache=true, $forceFeed=false){
-		$nbEvents = 0;
-		assert('is_int($syncId) && $syncId>0');
-		if (empty($this->id) || 0 == $this->id) {
-			/* Le flux ne dispose pas pas d'id !. Ça arrive si on appelle
-			parse() sans avoir appelé save() pour un nouveau flux.
-			@TODO: un create() pour un nouveau flux ? */
-			$msg = 'Empty or null id for a feed! '
-				  .'See '.__FILE__.' on line '.__LINE__;
-			error_log($msg, E_USER_ERROR);
-			die($msg); // Arrêt, sinon création événements sans flux associé.
-		}
-		$feed = new SimplePie();
-		$feed->enable_cache($enableCache);
-		$feed->force_feed($forceFeed);
-		$feed->set_feed_url($this->url);
-		$feed->set_useragent('Mozilla/4.0 Leed (LightFeed Agrgegator) '.VERSION_NAME.' by idleman http://projet.idleman.fr/leed');
-		if (!$feed->init()) {
-			$this->error = $feed->error;
-			$this->lastupdate = $_SERVER['REQUEST_TIME'];
-			$this->save();
-			return false;
-		}
-
-		$feed->handle_content_type(); // UTF-8 par défaut pour SimplePie
-
-		if($this->name=='') $this->name = $feed->get_title();
-		if($this->name=='') $this->name = $this->url;
-		$this->website = $feed->get_link();
-		$this->description = $feed->get_description();
-
-		$items = $feed->get_items();
-		$eventManager = new Event();
-				
-		$events = array();
-		$iEvents = 0;
-		foreach($items as $item){
-			// Ne retient que les 100 premiers éléments de flux.
-			if ($iEvents++>=100) break;
-
-			// Si le guid existe déjà, on évite de le reparcourir.
-			$alreadyParsed = $eventManager->load(array('guid'=>$item->get_id(), 'feed'=>$this->id));
-			if (isset($alreadyParsed)&&($alreadyParsed!=false)) {
-				$events[]=$alreadyParsed->getId();
-				continue;
-			}
-
-			// Initialisation des informations de l'événement (élt. de flux)
-			$event = new Event();
-			$event->setSyncId($syncId);
-			$event->setGuid($item->get_id());
-			$event->setTitle($item->get_title());
-			$event->setPubdate($item->get_date());
-			$event->setCreator(
-				''==$item->get_author()
-					? ''
-					: $item->get_author()->name
-			);
-			$event->setLink($item->get_permalink());
-
-			$event->setFeed($this->id);
-			$event->setUnread(1); // inexistant, donc non-lu
-
-			//Gestion de la balise enclosure pour les podcasts et autre cochonneries :)
-			$enclosure = $item->get_enclosure();
-			if($enclosure!=null && $enclosure->link!=''){
-				$enclosureName = substr(
-					$enclosure->link,
-					strrpos($enclosure->link, '/')+1,
-					strlen($enclosure->link)
-				);
-				$enclosureArgs = strpos($enclosureName, '?');
-				if($enclosureArgs!==false)
-					$enclosureName = substr($enclosureName,0,$enclosureArgs);
-				$enclosureFormat = isset($enclosure->handler)
-					? $enclosure->handler
-					: substr($enclosureName, strrpos($enclosureName,'.')+1);
-
-				$enclosure ='<div class="enclosure"><h1>Fichier média :</h1><a href="'.$enclosure->link.'"> '.$enclosureName.'</a> <span>(Format '.strtoupper($enclosureFormat).', '.Functions::convertFileSize($enclosure->length).')</span></div>';
-			}else{
-				$enclosure = '';
-			}
-
-			$event->setContent($item->get_content().$enclosure);
-			$event->setDescription($item->get_description().$enclosure);
-
-			if(trim($event->getDescription())=='')
-				$event->setDescription(
-					substr($event->getContent(),0,300)
-					.'…<br><a href="'.$event->getLink()
-					.'">Lire la suite de l\'article</a>'
-				);
-			if(trim($event->getContent())=='')
-				$event->setContent($event->getDescription());
-
-			$event->setCategory($item->get_category());
-			$event->save();
-			$nbEvents++;
-		}
-
-		$listid = "";
-		foreach($events as $item){
-			$listid.=','.$item;
-		}
-		$query='UPDATE `'.MYSQL_PREFIX.'event` SET syncId='.$syncId.' WHERE id in (0'.$listid.');';
-		$myQuery = $this->customQuery($query);
-		
-		$this->lastupdate = $_SERVER['REQUEST_TIME'];
-		$this->save();
-		return true;
-	}
-
-
-	function removeOldEvents($maxEvent, $currentSyncId){
-		if ($maxEvent<=0) return;
-		$eventManager = new Event();
-		$nbLines = $eventManager->rowCount(array(
-			'feed'=>$this->id,
- 			'unread'=>0,
-			'favorite'=>0,
-		));
-		$limit = $nbLines - $maxEvent;
-		if ($limit<=0) return;
-		$tableEvent = '`'.MYSQL_PREFIX."event`";
-		$query = "
-			DELETE FROM {$tableEvent} WHERE feed={$this->id} AND favorite!=1 AND unread!=1 AND syncId!={$currentSyncId} ORDER BY pubDate ASC LIMIT {$limit}
-		";
-		///@TODO: escape the variables inside mysql
- 		$this->customExecute($query);
-	}
-	
-	function setId($id){
-		$this->id = $id;
-	}
-
-	function getDescription(){
-		return $this->description;
-	}
-
-	function setDescription($description){
-		$this->description = $description;
-	}
-	function getWebSite(){
-		return $this->website;
-	}
-
-	function setWebSite($website){
-		$this->website = $website;
-	}
-
-	function getId(){
-		return $this->id;
-	}
-
-	function getUrl(){
-		return $this->url;
-	}
-
-	function setUrl($url){
-		$this->url = $url;
-	}
-
-	function getName(){
-		return (trim($this->name)!='' ? $this->name:$this->url);
-	}
-
-	function setName($name){
-		$this->name = $name;
-	}
-
-
-	function getEvents($start=0,$limit=10000,$order,$columns='*'){
-		$eventManager = new Event();
-		$events = $eventManager->loadAllOnlyColumn($columns,array('feed'=>$this->getId()),$order,$start.','.$limit);
-		return $events;
-	}
-
-	function countUnreadEvents(){
-		$unreads = array();
-		$results = Feed::customQuery("SELECT COUNT(".MYSQL_PREFIX."event.id), ".MYSQL_PREFIX."event.feed FROM ".MYSQL_PREFIX."event WHERE ".MYSQL_PREFIX."event.unread = 1 GROUP BY ".MYSQL_PREFIX."event.feed") ;
-		if($results!=false){
-			while($item = mysql_fetch_array($results)){
-				$unreads[$item[1]] = $item[0];
-			}
-		}
-		return $unreads;
-	}
-
-	function getFeedsPerFolder(){
-		$feedsFolderMap = array();
-		$feedsIdMap = array();
-
-		$results = Feed::customQuery("SELECT ".MYSQL_PREFIX."feed.name AS name, ".MYSQL_PREFIX."feed.id   AS id, ".MYSQL_PREFIX."feed.url  AS url, ".MYSQL_PREFIX."folder.id AS folder FROM ".MYSQL_PREFIX."feed INNER JOIN ".MYSQL_PREFIX."folder ON ( ".MYSQL_PREFIX."feed.folder = ".MYSQL_PREFIX."folder.id ) ORDER BY ".MYSQL_PREFIX."feed.name ;");
-		if($results!=false){
-			while($item = mysql_fetch_array($results)){
-				$name = $item['name'];
-				$feedsIdMap[$item['id']]['name'] = $name;
-				
-
-				$feedsFolderMap[$item['folder']][$item['id']]['id'] = $item['id'];
-				$feedsFolderMap[$item['folder']][$item['id']]['name'] = $name;
-				$feedsFolderMap[$item['folder']][$item['id']]['url'] = $item['url'];
-				
-			}
-		}
-		$feeds['folderMap'] = $feedsFolderMap;
-		$feeds['idMap'] = $feedsIdMap;
-		return $feeds;
-	}
-
-	function getFolder(){
-		return $this->folder;
-	}
-
-	function setFolder($folder){
-		$this->folder = $folder;
-	}
-
-	function getLastupdate(){
-		return $this->lastUpdate;
-	}
-
-	function setLastupdate($lastupdate){
-		$this->lastupdate = $lastupdate;
-	}
-
-	/** @returns vrai si l'url n'est pas déjà connue .*/
-	function notRegistered() {
-		return $this->rowCount(array('url' => $this->url)) == 0;
-	}
-
-}
-
-?>
+<?php
+
+/*
+ @nom: Feed
+ @auteur: Idleman (idleman@idleman.fr)
+ @description: Classe de gestion des flux RSS/ATOM
+ */
+
+class Feed extends MysqlEntity{
+
+	protected $id,$name,$url,$events=array(),$description,$website,$folder,$lastupdate;
+	protected $TABLE_NAME = 'feed';
+	protected $CLASS_NAME = 'Feed';
+	protected $object_fields = 
+	array(
+		'id'=>'key',
+		'name'=>'string',
+		'description'=>'longstring',
+		'website'=>'longstring',
+		'url'=>'longstring',
+		'lastupdate'=>'string',
+		'folder'=>'integer'
+	);
+	
+	protected $object_fields_index = 
+	array(
+		'folder'=>'index'
+	);
+
+	protected $error = '';
+	
+	function __construct($name=null,$url=null){
+		$this->name = $name;
+		$this->url = $url;
+		parent::__construct();
+	}
+
+	/** @TODO: ne faire qu'un seul chargement avec SimplePie et récupérer les
+	même informations. Mettre le chargement en cache au moins d'une méthode
+	loadLeed() qui ne chargera qu'une seule fois. Voire même en déclenchement
+	retardé, au dernier moment. */
+	function getInfos(){
+		$xml = @simplexml_load_file($this->url);
+		if($xml!=false){
+			$this->name = array_shift ($xml->xpath('channel/title'));
+			$this->description = array_shift ($xml->xpath('channel/description'));
+			$this->website = array_shift ($xml->xpath('channel/link'));
+		}
+	}
+
+	function getError() { return $this->error; }
+	
+	/*@TODO: fournir un extrait quand il 'y a pas de description. De même pour les médias.
+	@TODO: SimplePie remplace "é" par "&eacute;", il ne devrait pas le faire.
+	J'ai testé set_stupidly_fast(true) sans succès.
+	Il encadre les descriptions avec <div>, absents dans le source du flux.
+	@TODO: la vérification de doublon est sous la responsabilité de l'appelant.
+	Il serait peut-être utile de faire une méthode add() qui vérifie, plante si
+	nécessaire, et appelle parse(). Impossible de vérifier dans parse() même
+	car elle est appelée aussi pour autre chose que l'ajout.
+	*/
+	function parse($syncId,&$nbEvents =0, $enableCache=true, $forceFeed=false){
+		$nbEvents = 0;
+		assert('is_int($syncId) && $syncId>0');
+		if (empty($this->id) || 0 == $this->id) {
+			/* Le flux ne dispose pas pas d'id !. Ça arrive si on appelle
+			parse() sans avoir appelé save() pour un nouveau flux.
+			@TODO: un create() pour un nouveau flux ? */
+			$msg = 'Empty or null id for a feed! '
+				  .'See '.__FILE__.' on line '.__LINE__;
+			error_log($msg, E_USER_ERROR);
+			die($msg); // Arrêt, sinon création événements sans flux associé.
+		}
+		$feed = new SimplePie();
+		$feed->enable_cache($enableCache);
+		$feed->force_feed($forceFeed);
+		$feed->set_feed_url($this->url);
+		$feed->set_useragent('Mozilla/4.0 Leed (LightFeed Agrgegator) '.VERSION_NAME.' by idleman http://projet.idleman.fr/leed');
+		if (!$feed->init()) {
+			$this->error = $feed->error;
+			$this->lastupdate = $_SERVER['REQUEST_TIME'];
+			$this->save();
+			return false;
+		}
+
+		$feed->handle_content_type(); // UTF-8 par défaut pour SimplePie
+
+		if($this->name=='') $this->name = $feed->get_title();
+		if($this->name=='') $this->name = $this->url;
+		$this->website = $feed->get_link();
+		$this->description = $feed->get_description();
+
+		$items = $feed->get_items();
+		$eventManager = new Event();
+				
+		$events = array();
+		$iEvents = 0;
+		foreach($items as $item){
+			// Ne retient que les 100 premiers éléments de flux.
+			if ($iEvents++>=100) break;
+
+			// Si le guid existe déjà, on évite de le reparcourir.
+			$alreadyParsed = $eventManager->load(array('guid'=>$item->get_id(), 'feed'=>$this->id));
+			if (isset($alreadyParsed)&&($alreadyParsed!=false)) {
+				$events[]=$alreadyParsed->getId();
+				continue;
+			}
+
+			// Initialisation des informations de l'événement (élt. de flux)
+			$event = new Event();
+			$event->setSyncId($syncId);
+			$event->setGuid($item->get_id());
+			$event->setTitle($item->get_title());
+			$event->setPubdate($item->get_date());
+			$event->setCreator(
+				''==$item->get_author()
+					? ''
+					: $item->get_author()->name
+			);
+			$event->setLink($item->get_permalink());
+
+			$event->setFeed($this->id);
+			$event->setUnread(1); // inexistant, donc non-lu
+
+			//Gestion de la balise enclosure pour les podcasts et autre cochonneries :)
+			$enclosure = $item->get_enclosure();
+			if($enclosure!=null && $enclosure->link!=''){
+				$enclosureName = substr(
+					$enclosure->link,
+					strrpos($enclosure->link, '/')+1,
+					strlen($enclosure->link)
+				);
+				$enclosureArgs = strpos($enclosureName, '?');
+				if($enclosureArgs!==false)
+					$enclosureName = substr($enclosureName,0,$enclosureArgs);
+				$enclosureFormat = isset($enclosure->handler)
+					? $enclosure->handler
+					: substr($enclosureName, strrpos($enclosureName,'.')+1);
+
+				$enclosure ='<div class="enclosure"><h1>Fichier média :</h1><a href="'.$enclosure->link.'"> '.$enclosureName.'</a> <span>(Format '.strtoupper($enclosureFormat).', '.Functions::convertFileSize($enclosure->length).')</span></div>';
+			}else{
+				$enclosure = '';
+			}
+
+			$event->setContent($item->get_content().$enclosure);
+			$event->setDescription($item->get_description().$enclosure);
+
+			if(trim($event->getDescription())=='')
+				$event->setDescription(
+					substr($event->getContent(),0,300)
+					.'…<br><a href="'.$event->getLink()
+					.'">Lire la suite de l\'article</a>'
+				);
+			if(trim($event->getContent())=='')
+				$event->setContent($event->getDescription());
+
+			$event->setCategory($item->get_category());
+			$event->save();
+			$nbEvents++;
+		}
+
+		$listid = "";
+		foreach($events as $item){
+			$listid.=','.$item;
+		}
+		$query='UPDATE `'.MYSQL_PREFIX.'event` SET syncId='.$syncId.' WHERE id in (0'.$listid.');';
+		$myQuery = $this->customQuery($query);
+		
+		$this->lastupdate = $_SERVER['REQUEST_TIME'];
+		$this->save();
+		return true;
+	}
+
+
+	function removeOldEvents($maxEvent, $currentSyncId){
+		if ($maxEvent<=0) return;
+		$eventManager = new Event();
+		$nbLines = $eventManager->rowCount(array(
+			'feed'=>$this->id,
+ 			'unread'=>0,
+			'favorite'=>0,
+		));
+		$limit = $nbLines - $maxEvent;
+		if ($limit<=0) return;
+		$tableEvent = '`'.MYSQL_PREFIX."event`";
+		$query = "
+			DELETE FROM {$tableEvent} WHERE feed={$this->id} AND favorite!=1 AND unread!=1 AND syncId!={$currentSyncId} ORDER BY pubDate ASC LIMIT {$limit}
+		";
+		///@TODO: escape the variables inside mysql
+ 		$this->customExecute($query);
+	}
+	
+	function setId($id){
+		$this->id = $id;
+	}
+
+	function getDescription(){
+		return $this->description;
+	}
+
+	function setDescription($description){
+		$this->description = $description;
+	}
+	function getWebSite(){
+		return $this->website;
+	}
+
+	function setWebSite($website){
+		$this->website = $website;
+	}
+
+	function getId(){
+		return $this->id;
+	}
+
+	function getUrl(){
+		return $this->url;
+	}
+
+	function setUrl($url){
+		$this->url = $url;
+	}
+
+	function getName(){
+		return (trim($this->name)!='' ? $this->name:$this->url);
+	}
+
+	function setName($name){
+		$this->name = $name;
+	}
+
+
+	function getEvents($start=0,$limit=10000,$order,$columns='*'){
+		$eventManager = new Event();
+		$events = $eventManager->loadAllOnlyColumn($columns,array('feed'=>$this->getId()),$order,$start.','.$limit);
+		return $events;
+	}
+
+	function countUnreadEvents(){
+		$unreads = array();
+		$results = Feed::customQuery("SELECT COUNT(".MYSQL_PREFIX."event.id), ".MYSQL_PREFIX."event.feed FROM ".MYSQL_PREFIX."event WHERE ".MYSQL_PREFIX."event.unread = 1 GROUP BY ".MYSQL_PREFIX."event.feed") ;
+		if($results!=false){
+			while($item = mysql_fetch_array($results)){
+				$unreads[$item[1]] = $item[0];
+			}
+		}
+		return $unreads;
+	}
+
+	function getFeedsPerFolder(){
+		$feedsFolderMap = array();
+		$feedsIdMap = array();
+
+		$results = Feed::customQuery("SELECT ".MYSQL_PREFIX."feed.name AS name, ".MYSQL_PREFIX."feed.id   AS id, ".MYSQL_PREFIX."feed.url  AS url, ".MYSQL_PREFIX."folder.id AS folder FROM ".MYSQL_PREFIX."feed INNER JOIN ".MYSQL_PREFIX."folder ON ( ".MYSQL_PREFIX."feed.folder = ".MYSQL_PREFIX."folder.id ) ORDER BY ".MYSQL_PREFIX."feed.name ;");
+		if($results!=false){
+			while($item = mysql_fetch_array($results)){
+				$name = $item['name'];
+				$feedsIdMap[$item['id']]['name'] = $name;
+				
+
+				$feedsFolderMap[$item['folder']][$item['id']]['id'] = $item['id'];
+				$feedsFolderMap[$item['folder']][$item['id']]['name'] = $name;
+				$feedsFolderMap[$item['folder']][$item['id']]['url'] = $item['url'];
+				
+			}
+		}
+		$feeds['folderMap'] = $feedsFolderMap;
+		$feeds['idMap'] = $feedsIdMap;
+		return $feeds;
+	}
+
+	function getFolder(){
+		return $this->folder;
+	}
+
+	function setFolder($folder){
+		$this->folder = $folder;
+	}
+
+	function getLastupdate(){
+		return $this->lastUpdate;
+	}
+
+	function setLastupdate($lastupdate){
+		$this->lastupdate = $lastupdate;
+	}
+
+	/** @returns vrai si l'url n'est pas déjà connue .*/
+	function notRegistered() {
+		return $this->rowCount(array('url' => $this->url)) == 0;
+	}
+
+}
+
+?>

+ 99 - 99
Folder.class.php

@@ -1,99 +1,99 @@
-<?php
-
-/*
- @nom: Folder
- @auteur: Idleman (idleman@idleman.fr)
- @description: Classe de gestion des dossiers/catégories contenant les flux
- */
-
-class Folder extends MysqlEntity{
-
-	protected $id,$name,$parent,$isopen;
-	protected $TABLE_NAME = 'folder';
-	protected $CLASS_NAME = 'Folder';
-	protected $object_fields = 
-	array(
-		'id'=>'key',
-		'name'=>'string',
-		'parent'=>'integer',
-		'isopen'=>'integer'
-	);
-
-	function unreadCount(){
-		$results = $this->customQuery('SELECT COUNT('.MYSQL_PREFIX.'event.id) FROM '.MYSQL_PREFIX.'event INNER JOIN '.MYSQL_PREFIX.'feed ON ('.MYSQL_PREFIX.'event.feed = '.MYSQL_PREFIX.'feed.id) WHERE '.MYSQL_PREFIX.'event.unread=1 AND '.MYSQL_PREFIX.'feed.folder = '.$this->getId());
-		$number = mysql_fetch_array($results);
-		return $number[0];
-	}
-
-
-	function getEvents($start=0,$limit=10000,$order,$columns='*'){
-		$eventManager = new Event();
-		$objects = array();
-		$results = $this->customQuery('SELECT '.$columns.' FROM '.MYSQL_PREFIX.'event INNER JOIN '.MYSQL_PREFIX.'feed ON ('.MYSQL_PREFIX.'event.feed = '.MYSQL_PREFIX.'feed.id) WHERE '.MYSQL_PREFIX.'event.unread=1 AND '.MYSQL_PREFIX.'feed.folder = '.$this->getId().' ORDER BY '.$order.' LIMIT '.$start.','.$limit);
-		if($results!=false){
-			while($item = mysql_fetch_array($results)){
-				$object = new Event();
-					foreach($object->getObject_fields() as $field=>$type){
-						$setter = 'set'.ucFirst($field);
-						if(isset($item[$field])) $object->$setter($item[$field]);
-					}
-					$objects[] = $object;
-					unset($object);
-			}
-		}
-		
-		return $objects;
-	}
-
-	function __construct(){
-		parent::__construct();
-	}
-
-	function setId($id){
-		$this->id = $id;
-	}
-
-	function getFeeds(){
-		$feedManager = new Feed();
-		return $feedManager->loadAll(array('folder'=>$this->getId()),'name');
-	}
-
-	function getFolders(){
-		$folderManager = new Folder();
-		return $folderManager->loadAll(array('parent'=>$this->getId()));
-	}
-
-
-	function getId(){
-		return $this->id;
-	}
-
-	function getName(){
-		return $this->name;
-	}
-
-	function setName($name){
-		$this->name = $name;
-	}
-
-	function getParent(){
-		return $this->parent;
-	}
-
-	function setParent($parent){
-		$this->parent = $parent;
-	}
-
-	function getIsopen(){
-		return $this->isopen;
-	}
-
-	function setIsopen($isopen){
-		$this->isopen = $isopen;
-	}
-
-
-
-}
-
-?>
+<?php
+
+/*
+ @nom: Folder
+ @auteur: Idleman (idleman@idleman.fr)
+ @description: Classe de gestion des dossiers/catégories contenant les flux
+ */
+
+class Folder extends MysqlEntity{
+
+	protected $id,$name,$parent,$isopen;
+	protected $TABLE_NAME = 'folder';
+	protected $CLASS_NAME = 'Folder';
+	protected $object_fields = 
+	array(
+		'id'=>'key',
+		'name'=>'string',
+		'parent'=>'integer',
+		'isopen'=>'integer'
+	);
+
+	function unreadCount(){
+		$results = $this->customQuery('SELECT COUNT('.MYSQL_PREFIX.'event.id) FROM '.MYSQL_PREFIX.'event INNER JOIN '.MYSQL_PREFIX.'feed ON ('.MYSQL_PREFIX.'event.feed = '.MYSQL_PREFIX.'feed.id) WHERE '.MYSQL_PREFIX.'event.unread=1 AND '.MYSQL_PREFIX.'feed.folder = '.$this->getId());
+		$number = mysql_fetch_array($results);
+		return $number[0];
+	}
+
+
+	function getEvents($start=0,$limit=10000,$order,$columns='*'){
+		$eventManager = new Event();
+		$objects = array();
+		$results = $this->customQuery('SELECT '.$columns.' FROM '.MYSQL_PREFIX.'event INNER JOIN '.MYSQL_PREFIX.'feed ON ('.MYSQL_PREFIX.'event.feed = '.MYSQL_PREFIX.'feed.id) WHERE '.MYSQL_PREFIX.'event.unread=1 AND '.MYSQL_PREFIX.'feed.folder = '.$this->getId().' ORDER BY '.$order.' LIMIT '.$start.','.$limit);
+		if($results!=false){
+			while($item = mysql_fetch_array($results)){
+				$object = new Event();
+					foreach($object->getObject_fields() as $field=>$type){
+						$setter = 'set'.ucFirst($field);
+						if(isset($item[$field])) $object->$setter($item[$field]);
+					}
+					$objects[] = $object;
+					unset($object);
+			}
+		}
+		
+		return $objects;
+	}
+
+	function __construct(){
+		parent::__construct();
+	}
+
+	function setId($id){
+		$this->id = $id;
+	}
+
+	function getFeeds(){
+		$feedManager = new Feed();
+		return $feedManager->loadAll(array('folder'=>$this->getId()),'name');
+	}
+
+	function getFolders(){
+		$folderManager = new Folder();
+		return $folderManager->loadAll(array('parent'=>$this->getId()));
+	}
+
+
+	function getId(){
+		return $this->id;
+	}
+
+	function getName(){
+		return $this->name;
+	}
+
+	function setName($name){
+		$this->name = $name;
+	}
+
+	function getParent(){
+		return $this->parent;
+	}
+
+	function setParent($parent){
+		$this->parent = $parent;
+	}
+
+	function getIsopen(){
+		return $this->isopen;
+	}
+
+	function setIsopen($isopen){
+		$this->isopen = $isopen;
+	}
+
+
+
+}
+
+?>

+ 359 - 359
Functions.class.php

@@ -1,359 +1,359 @@
-<?php
-
-/*
- @nom: constant
- @auteur: Idleman (idleman@idleman.fr)
- @description:  Classe de stockage des fonctions utiles (toutes disponibles en static)
- */
-
-class Functions
-{
-	private $id;
-	public $debug=0;
-
-	/**
-	 * Securise la variable utilisateur entrée en parametre
-	 * @author Valentin
-	 * @param<String> variable a sécuriser
-	 * @param<Integer> niveau de securisation
-	 * @return<String> variable securisée
-	 */
-
-	public static function secure($var,$level = 1){
-		$var = htmlspecialchars($var, ENT_QUOTES, "UTF-8");
-		if($level<1)$var = mysql_real_escape_string($var);
-		if($level<2)$var = addslashes($var);
-		return $var;
-	}
-
-
-	/**
-	 * Return l'environnement/serveur sur lequel on se situe, permet de changer les
-	 * connexions bdd en fonction de la dev, la préprod ou la prod
-	 */
-	public static function whereImI(){
-
-		$maps = array (
-		'LOCAL'=>array('localhost','127.0.0.1','0.0.0.1','::0.0.0.0'),
-		'LAN'=>array('192.168.10.','valentin'),
-		'PWAN'=>array('test.sys1.fr'),
-		'WAN'=>array('www.sys1.fr'),
-		);
-
-
-		$return = 'UNKNOWN';
-		foreach($maps as $map=>$values){
-
-			foreach($values as $ip){
-				$pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip);
-				if ($pos!==false){
-					$return = $map;
-				}
-			}
-		}
-		return $return;
-	}
-
-	public static function isLocal($perimeter='LOCAL'){
-		$return = false;
-
-		$localTab = array('localhost','127.0.0.1','0.0.0.1','::0.0.0.0');
-		$lanTab = array('192.168.10.','valentin');
-
-		switch($perimeter){
-			case 'LOCAL':
-				foreach($localTab as $ip){
-					$pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip);
-					if ($pos!==false){
-						$return = true;
-					}
-				}
-				break;
-			case 'LAN':
-				foreach($lanTab as $ip){
-					$pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip);
-					if ($pos!==false){
-						$return = true;
-					}
-				}
-				break;
-			case 'ALL':
-				foreach($localTab as $ip){
-					$pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip);
-					if ($pos!==false){
-						$return = true;
-					}
-				}
-				foreach($lanTab as $ip){
-					$pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip);
-					if ($pos!==false){
-						$return = true;
-					}
-				}
-				break;
-		}
-
-		return $return;
-	}
-
-
-	/**
-	 * Convertis la chaine passée en timestamp quel que soit sont format
-	 * (prend en charge les formats type dd-mm-yyy , dd/mm/yyy, yyyy/mm/ddd...)
-	 */
-	public static function toTime($string){
-		$string = str_replace('/','-',$string);
-		$string = str_replace('\\','-',$string);
-
-		$string = str_replace('Janvier','Jan',$string);
-		$string = str_replace('Fevrier','Feb',$string);
-		$string = str_replace('Mars','Mar',$string);
-		$string = str_replace('Avril','Apr',$string);
-		$string = str_replace('Mai','May',$string);
-		$string = str_replace('Juin','Jun',$string);
-		$string = str_replace('Juillet','Jul',$string);
-		$string = str_replace('Aout','Aug',$string);
-		$string = str_replace('Septembre','Sept',$string);
-		$string = str_replace('Octobre','Oct',$string);
-		$string = str_replace('Novembre','Nov',$string);
-		$string = str_replace('Decembre','Dec',$string);
-		return strtotime($string);
-	}
-
-	/**
-	 * Recupere l'ip de l'internaute courant
-	 * @author Valentin
-	 * @return<String> ip de l'utilisateur
-	 */
-
-	public static function getIP(){
-		if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
-			$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];}
-			elseif(isset($_SERVER['HTTP_CLIENT_IP'])){
-				$ip = $_SERVER['HTTP_CLIENT_IP'];}
-				else{ $ip = $_SERVER['REMOTE_ADDR'];}
-				return $ip;
-	}
-
-	/**
-	 * Retourne une version tronquée au bout de $limit caracteres de la chaine fournie
-	 * @author Valentin
-	 * @param<String> message a tronquer
-	 * @param<Integer> limite de caracteres
-	 * @return<String> chaine tronquée
-	 */
-	public static function truncate($msg,$limit){
-		if(mb_strlen($msg)>$limit){
-			$fin='…' ;
-			$nb=$limit-mb_strlen($fin) ;
-		}else{
-			$nb=mb_strlen($msg);
-			$fin='';
-		}
-		return mb_substr($msg, 0, $nb).$fin;
-	}
-
-
-	function getExtension($fileName){
-		$dot = explode('.',$fileName);
-		return $dot[sizeof($dot)-1];
-	}
-
-	/**
-	 * Definis si la chaine fournie est existante dans la reference fournie ou non
-	 * @param unknown_type $string
-	 * @param unknown_type $reference
-	 * @return false si aucune occurence du string, true dans le cas contraire
-	 */
-	public static function contain($string,$reference){
-		$return = true;
-		$pos = strpos($reference,$string);
-		if ($pos === false) {
-			$return = false;
-		}
-		return strtolower($return);
-	}
-
-	/**
-	 * Définis si la chaine passée en parametre est une url ou non
-	 */
-	public static function isUrl($url){
-		$return =false;
-		if (preg_match('/^(http|https|ftp)://([A-Z0-9][A-Z0-9_-]*(?:.[A-Z0-9][A-Z0-9_-]*)+):?(d+)?/?/i', $url)) {
-			$return =true;
-		}
-		return $return;
-	}
-
-	/**
-	 * Définis si la chaine passée en parametre est une couleur héxadécimale ou non
-	 */
-	public static function isColor($color){
-		$return =false;
-		if (preg_match('/^#(?:(?:[a-fd]{3}){1,2})$/i', $color)) {
-			$return =true;
-		}
-		return $return;
-	}
-
-	/**
-	 * Définis si la chaine passée en parametre est un mail ou non
-	 */
-	public static function isMail($mail){
-		$return =false;
-		if (filter_var($mail, FILTER_VALIDATE_EMAIL)) {
-			$return =true;
-		}
-		return $return;
-	}
-
-	/**
-	 * Définis si la chaine passée en parametre est une IP ou non
-	 */
-	public static function isIp($ip){
-		$return =false;
-		if (preg_match('^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$',$ip)) {
-			$return =true;
-		}
-		return $return;
-	}
-
-	public static function sourceName($string){
-		$name = strtolower($string);
-		$name = str_replace(' ','-',$name);
-		$name = str_replace('&#039;','-',$name);
-		$name = str_replace('\'','-',$name);
-		$name = str_replace(',','-',$name);
-		$name = str_replace(':','-',$name);
-		$name = str_replace('&agrave;','a',$name);
-		$name = trim($name);
-		$name = html_entity_decode($name,null,'UTF-8');
-		return $name;
-	}
-
-	public static function makeCookie($name, $value, $expire='') {
-		if($expire == '') {
-			setcookie($name, $value, mktime(0,0,0, date("d"),
-			date("m"), (date("Y")+1)),'/');
-		}else {
-			setcookie($name, '', mktime(0,0,0, date("d"),
-			date("m"), (date("Y")-1)),'/');
-		}
-	}
-
-	public static function destroyCookie($name){
-		Fonction::makeCookie($name,'',time()-3600);
-		unset($_COOKIE[$name]);
-	}
-
-	public static function wordwrap($str, $width = 75, $break = "\n", $cut = false)
-	{
-		$str = html_entity_decode($str);
-		$str =  htmlentities (wordwrap($str,$width,$break,$cut));
-		$str = str_replace('&lt;br/&gt;','<br/>',$str);
-		$str = str_replace('&amp;','&',$str);
-		return $str;
-	}
-
-	public static function createFile($filePath,$content){
-		$fichier = fopen($filePath,"w+");
-		$fwriteResult = fwrite($fichier,$content);
-		fclose($fichier);
-	}
-
-
-
-	public static function convertFileSize($bytes)
-	{
-		 if($bytes<1024){
-		 	return round(($bytes / 1024), 2).' o';
-		 }elseif(1024<$bytes && $bytes<1048576){
-		 	return round(($bytes / 1024), 2).' ko';
-		 }elseif(1048576<$bytes && $bytes<1073741824){
-		 	return round(($bytes / 1024)/1024, 2).' Mo';
-		 }elseif(1073741824<$bytes){
-		 	return round(($bytes / 1024)/1024/1024, 2).' Go';
-		 }
-	}
-
-
-	public static function hexaValue($str){
-		$code = dechex(crc32($str));
-		  $code = substr($code, 0, 6);
-		  return $code;
-	}
-	
-	public static function scanRecursiveDir($dir){
-		$files = scandir($dir);
-		$allFiles = array();
-		foreach($files as $file){
-			if($file!='.' && $file!='..'){
-				if(is_dir($dir.$file)){
-					$allFiles = array_merge($allFiles,Fonction::scanRecursiveDir($dir.$file));
-				}else{
-					$allFiles[]=str_replace('//','/',$dir.'/'.$file);
-				}
-			}
-		}
-		return $allFiles;
-	}
-
-	/** Permet la sortie directe de texte à l'écran, sans tampon.
-		Source : http://php.net/manual/fr/function.flush.php
-	*/
-	public static function triggerDirectOutput() {
-		// La ligne de commande n'en a pas besoin.
-		if ('cli'==php_sapi_name()) return;
-		if (function_exists('apache_setenv')) {
-			/* Selon l'hébergeur la fonction peut être désactivée. Alors Php
-			   arrête le programme avec l'erreur :
-			   "PHP Fatal error:  Call to undefined function apache_setenv()".
-			*/
-			@apache_setenv('no-gzip', 1);
-		}
-		@ini_set('zlib.output_compression', 0);
-		@ini_set('implicit_flush', 1);
-		for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
-		ob_implicit_flush(1);
-	}
-
-	public static function relativePath($from, $to, $ps = '/') {
-		$arFrom = explode($ps, rtrim($from, $ps));
-		$arTo = explode($ps, rtrim($to, $ps));
-		while(count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0])) {
-			array_shift($arFrom);
-			array_shift($arTo);
-		}
-		return str_pad("", count($arFrom) * 3, '..'.$ps).implode($ps, $arTo);
-	}
-	
-
-	// Nettoyage de l'url avant la mise en base
-	public static function clean_url( $url ) {
-		$url = str_replace('&amp;', '&', $url);
-		return $url;
-	}
-
-
-
-	/**
-	* Méthode de test de connexion.
-	* @return true si ok
-	* @param server
-	* @param login
-	* @param pass
-	* @param db facultatif, si précisé alors tente de la séléctionner
-	*/
-	public static function testDb($server, $login, $pass, $db=null) {
-		/* Méthode hors des classes dédiées aux BDD afin de supporter le moins
-		   de dépendances possibles. En particulier, pas besoin que le fichier
-		   de configuration existe. */
-		$link = mysql_connect($server, $login, $pass);
-		if (false===$link) return false;
-		if (!is_null($db) && false===mysql_select_db($db, $link)) return false;
-		mysql_close($link);
-		return true;
-	}
-		
-}
-?>
+<?php
+
+/*
+ @nom: constant
+ @auteur: Idleman (idleman@idleman.fr)
+ @description:  Classe de stockage des fonctions utiles (toutes disponibles en static)
+ */
+
+class Functions
+{
+	private $id;
+	public $debug=0;
+
+	/**
+	 * Securise la variable utilisateur entrée en parametre
+	 * @author Valentin
+	 * @param<String> variable a sécuriser
+	 * @param<Integer> niveau de securisation
+	 * @return<String> variable securisée
+	 */
+
+	public static function secure($var,$level = 1){
+		$var = htmlspecialchars($var, ENT_QUOTES, "UTF-8");
+		if($level<1)$var = mysql_real_escape_string($var);
+		if($level<2)$var = addslashes($var);
+		return $var;
+	}
+
+
+	/**
+	 * Return l'environnement/serveur sur lequel on se situe, permet de changer les
+	 * connexions bdd en fonction de la dev, la préprod ou la prod
+	 */
+	public static function whereImI(){
+
+		$maps = array (
+		'LOCAL'=>array('localhost','127.0.0.1','0.0.0.1','::0.0.0.0'),
+		'LAN'=>array('192.168.10.','valentin'),
+		'PWAN'=>array('test.sys1.fr'),
+		'WAN'=>array('www.sys1.fr'),
+		);
+
+
+		$return = 'UNKNOWN';
+		foreach($maps as $map=>$values){
+
+			foreach($values as $ip){
+				$pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip);
+				if ($pos!==false){
+					$return = $map;
+				}
+			}
+		}
+		return $return;
+	}
+
+	public static function isLocal($perimeter='LOCAL'){
+		$return = false;
+
+		$localTab = array('localhost','127.0.0.1','0.0.0.1','::0.0.0.0');
+		$lanTab = array('192.168.10.','valentin');
+
+		switch($perimeter){
+			case 'LOCAL':
+				foreach($localTab as $ip){
+					$pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip);
+					if ($pos!==false){
+						$return = true;
+					}
+				}
+				break;
+			case 'LAN':
+				foreach($lanTab as $ip){
+					$pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip);
+					if ($pos!==false){
+						$return = true;
+					}
+				}
+				break;
+			case 'ALL':
+				foreach($localTab as $ip){
+					$pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip);
+					if ($pos!==false){
+						$return = true;
+					}
+				}
+				foreach($lanTab as $ip){
+					$pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip);
+					if ($pos!==false){
+						$return = true;
+					}
+				}
+				break;
+		}
+
+		return $return;
+	}
+
+
+	/**
+	 * Convertis la chaine passée en timestamp quel que soit sont format
+	 * (prend en charge les formats type dd-mm-yyy , dd/mm/yyy, yyyy/mm/ddd...)
+	 */
+	public static function toTime($string){
+		$string = str_replace('/','-',$string);
+		$string = str_replace('\\','-',$string);
+
+		$string = str_replace('Janvier','Jan',$string);
+		$string = str_replace('Fevrier','Feb',$string);
+		$string = str_replace('Mars','Mar',$string);
+		$string = str_replace('Avril','Apr',$string);
+		$string = str_replace('Mai','May',$string);
+		$string = str_replace('Juin','Jun',$string);
+		$string = str_replace('Juillet','Jul',$string);
+		$string = str_replace('Aout','Aug',$string);
+		$string = str_replace('Septembre','Sept',$string);
+		$string = str_replace('Octobre','Oct',$string);
+		$string = str_replace('Novembre','Nov',$string);
+		$string = str_replace('Decembre','Dec',$string);
+		return strtotime($string);
+	}
+
+	/**
+	 * Recupere l'ip de l'internaute courant
+	 * @author Valentin
+	 * @return<String> ip de l'utilisateur
+	 */
+
+	public static function getIP(){
+		if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
+			$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];}
+			elseif(isset($_SERVER['HTTP_CLIENT_IP'])){
+				$ip = $_SERVER['HTTP_CLIENT_IP'];}
+				else{ $ip = $_SERVER['REMOTE_ADDR'];}
+				return $ip;
+	}
+
+	/**
+	 * Retourne une version tronquée au bout de $limit caracteres de la chaine fournie
+	 * @author Valentin
+	 * @param<String> message a tronquer
+	 * @param<Integer> limite de caracteres
+	 * @return<String> chaine tronquée
+	 */
+	public static function truncate($msg,$limit){
+		if(mb_strlen($msg)>$limit){
+			$fin='…' ;
+			$nb=$limit-mb_strlen($fin) ;
+		}else{
+			$nb=mb_strlen($msg);
+			$fin='';
+		}
+		return mb_substr($msg, 0, $nb).$fin;
+	}
+
+
+	function getExtension($fileName){
+		$dot = explode('.',$fileName);
+		return $dot[sizeof($dot)-1];
+	}
+
+	/**
+	 * Definis si la chaine fournie est existante dans la reference fournie ou non
+	 * @param unknown_type $string
+	 * @param unknown_type $reference
+	 * @return false si aucune occurence du string, true dans le cas contraire
+	 */
+	public static function contain($string,$reference){
+		$return = true;
+		$pos = strpos($reference,$string);
+		if ($pos === false) {
+			$return = false;
+		}
+		return strtolower($return);
+	}
+
+	/**
+	 * Définis si la chaine passée en parametre est une url ou non
+	 */
+	public static function isUrl($url){
+		$return =false;
+		if (preg_match('/^(http|https|ftp)://([A-Z0-9][A-Z0-9_-]*(?:.[A-Z0-9][A-Z0-9_-]*)+):?(d+)?/?/i', $url)) {
+			$return =true;
+		}
+		return $return;
+	}
+
+	/**
+	 * Définis si la chaine passée en parametre est une couleur héxadécimale ou non
+	 */
+	public static function isColor($color){
+		$return =false;
+		if (preg_match('/^#(?:(?:[a-fd]{3}){1,2})$/i', $color)) {
+			$return =true;
+		}
+		return $return;
+	}
+
+	/**
+	 * Définis si la chaine passée en parametre est un mail ou non
+	 */
+	public static function isMail($mail){
+		$return =false;
+		if (filter_var($mail, FILTER_VALIDATE_EMAIL)) {
+			$return =true;
+		}
+		return $return;
+	}
+
+	/**
+	 * Définis si la chaine passée en parametre est une IP ou non
+	 */
+	public static function isIp($ip){
+		$return =false;
+		if (preg_match('^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$',$ip)) {
+			$return =true;
+		}
+		return $return;
+	}
+
+	public static function sourceName($string){
+		$name = strtolower($string);
+		$name = str_replace(' ','-',$name);
+		$name = str_replace('&#039;','-',$name);
+		$name = str_replace('\'','-',$name);
+		$name = str_replace(',','-',$name);
+		$name = str_replace(':','-',$name);
+		$name = str_replace('&agrave;','a',$name);
+		$name = trim($name);
+		$name = html_entity_decode($name,null,'UTF-8');
+		return $name;
+	}
+
+	public static function makeCookie($name, $value, $expire='') {
+		if($expire == '') {
+			setcookie($name, $value, mktime(0,0,0, date("d"),
+			date("m"), (date("Y")+1)),'/');
+		}else {
+			setcookie($name, '', mktime(0,0,0, date("d"),
+			date("m"), (date("Y")-1)),'/');
+		}
+	}
+
+	public static function destroyCookie($name){
+		Fonction::makeCookie($name,'',time()-3600);
+		unset($_COOKIE[$name]);
+	}
+
+	public static function wordwrap($str, $width = 75, $break = "\n", $cut = false)
+	{
+		$str = html_entity_decode($str);
+		$str =  htmlentities (wordwrap($str,$width,$break,$cut));
+		$str = str_replace('&lt;br/&gt;','<br/>',$str);
+		$str = str_replace('&amp;','&',$str);
+		return $str;
+	}
+
+	public static function createFile($filePath,$content){
+		$fichier = fopen($filePath,"w+");
+		$fwriteResult = fwrite($fichier,$content);
+		fclose($fichier);
+	}
+
+
+
+	public static function convertFileSize($bytes)
+	{
+		 if($bytes<1024){
+		 	return round(($bytes / 1024), 2).' o';
+		 }elseif(1024<$bytes && $bytes<1048576){
+		 	return round(($bytes / 1024), 2).' ko';
+		 }elseif(1048576<$bytes && $bytes<1073741824){
+		 	return round(($bytes / 1024)/1024, 2).' Mo';
+		 }elseif(1073741824<$bytes){
+		 	return round(($bytes / 1024)/1024/1024, 2).' Go';
+		 }
+	}
+
+
+	public static function hexaValue($str){
+		$code = dechex(crc32($str));
+		  $code = substr($code, 0, 6);
+		  return $code;
+	}
+	
+	public static function scanRecursiveDir($dir){
+		$files = scandir($dir);
+		$allFiles = array();
+		foreach($files as $file){
+			if($file!='.' && $file!='..'){
+				if(is_dir($dir.$file)){
+					$allFiles = array_merge($allFiles,Fonction::scanRecursiveDir($dir.$file));
+				}else{
+					$allFiles[]=str_replace('//','/',$dir.'/'.$file);
+				}
+			}
+		}
+		return $allFiles;
+	}
+
+	/** Permet la sortie directe de texte à l'écran, sans tampon.
+		Source : http://php.net/manual/fr/function.flush.php
+	*/
+	public static function triggerDirectOutput() {
+		// La ligne de commande n'en a pas besoin.
+		if ('cli'==php_sapi_name()) return;
+		if (function_exists('apache_setenv')) {
+			/* Selon l'hébergeur la fonction peut être désactivée. Alors Php
+			   arrête le programme avec l'erreur :
+			   "PHP Fatal error:  Call to undefined function apache_setenv()".
+			*/
+			@apache_setenv('no-gzip', 1);
+		}
+		@ini_set('zlib.output_compression', 0);
+		@ini_set('implicit_flush', 1);
+		for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
+		ob_implicit_flush(1);
+	}
+
+	public static function relativePath($from, $to, $ps = '/') {
+		$arFrom = explode($ps, rtrim($from, $ps));
+		$arTo = explode($ps, rtrim($to, $ps));
+		while(count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0])) {
+			array_shift($arFrom);
+			array_shift($arTo);
+		}
+		return str_pad("", count($arFrom) * 3, '..'.$ps).implode($ps, $arTo);
+	}
+	
+
+	// Nettoyage de l'url avant la mise en base
+	public static function clean_url( $url ) {
+		$url = str_replace('&amp;', '&', $url);
+		return $url;
+	}
+
+
+
+	/**
+	* Méthode de test de connexion.
+	* @return true si ok
+	* @param server
+	* @param login
+	* @param pass
+	* @param db facultatif, si précisé alors tente de la séléctionner
+	*/
+	public static function testDb($server, $login, $pass, $db=null) {
+		/* Méthode hors des classes dédiées aux BDD afin de supporter le moins
+		   de dépendances possibles. En particulier, pas besoin que le fichier
+		   de configuration existe. */
+		$link = mysql_connect($server, $login, $pass);
+		if (false===$link) return false;
+		if (!is_null($db) && false===mysql_select_db($db, $link)) return false;
+		mysql_close($link);
+		return true;
+	}
+		
+}
+?>

+ 199 - 199
MysqlConnector.class.php

@@ -1,199 +1,199 @@
-<?php
-	
-/*
-	@nom: mysql
-	@auteur: Idleman (idleman@idleman.fr)
-	@date de création: 
-	@description: Classe de gestion des connexions Mysql
-*/
-
-class MysqlConnector
-{
-	private $id;
-	private $hote;
-	private $login;
-	private $mdp;
-	private $bdd;
-	private $port;
-	public $debug=0;
-	private $connection = null;
-	public static $instance = null;
-	
-	private function __construct(){
-		$this->connect();
-	}
-
-	
-
-	/**
-	* Methode de recuperation unique de l'instance
-	* @author Valentin CARRUESCO
-	* @category Singleton
-	* @param <Aucun>
-	* @return <mysql> $instance
-	*/
-	
-	public static function getInstance(){
-		
-		if (MysqlConnector::$instance === null) {
-			MysqlConnector::$instance = new self(); 
-		}
-		return MysqlConnector::$instance;
-	}
-
-
-	
-	public function connect(){
-		$this->connection = mysql_connect(MYSQL_HOST,MYSQL_LOGIN,MYSQL_MDP);