diff --git a/conf/nginx.conf b/conf/nginx.conf
index 821267e..c484a37 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -1,5 +1,5 @@
-location PATHTOCHANGE {
- alias ALIASTOCHANGE ;
+location __PATH__ {
+ alias __FINALPATH__ ;
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
@@ -7,12 +7,12 @@ location PATHTOCHANGE {
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
- fastcgi_pass unix:/var/run/php5-fpm.sock;
+ fastcgi_pass unix:/var/run/php5-fpm-__NAMETOCHANGE__.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
- fastcgi_param SCRIPT_FILENAME $request_filename;
+ fastcgi_param SCRIPT_FILENAME $request_filename;
}
# Include SSOWAT user panel.
diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf
new file mode 100644
index 0000000..b516d66
--- /dev/null
+++ b/conf/php-fpm.conf
@@ -0,0 +1,392 @@
+; Start a new pool named 'www'.
+; the variable $pool can we used in any directive and will be replaced by the
+; pool name ('www' here)
+[__NAMETOCHANGE__]
+
+; Per pool prefix
+; It only applies on the following directives:
+; - 'slowlog'
+; - 'listen' (unixsocket)
+; - 'chroot'
+; - 'chdir'
+; - 'php_values'
+; - 'php_admin_values'
+; When not set, the global prefix (or /usr) applies instead.
+; Note: This directive can also be relative to the global prefix.
+; Default Value: none
+;prefix = /path/to/pools/$pool
+
+; Unix user/group of processes
+; Note: The user is mandatory. If the group is not set, the default user's group
+; will be used.
+user = www-data
+group = www-data
+
+; The address on which to accept FastCGI requests.
+; Valid syntaxes are:
+; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
+; a specific port;
+; 'port' - to listen on a TCP socket to all addresses on a
+; specific port;
+; '/path/to/unix/socket' - to listen on a unix socket.
+; Note: This value is mandatory.
+listen = /var/run/php5-fpm-__NAMETOCHANGE__.sock
+
+; Set listen(2) backlog.
+; Default Value: 128 (-1 on FreeBSD and OpenBSD)
+;listen.backlog = 128
+
+; Set permissions for unix socket, if one is used. In Linux, read/write
+; permissions must be set in order to allow connections from a web server. Many
+; BSD-derived systems allow connections regardless of permissions.
+; Default Values: user and group are set as the running user
+; mode is set to 0660
+listen.owner = www-data
+listen.group = www-data
+;listen.mode = 0660
+
+; List of ipv4 addresses of FastCGI clients which are allowed to connect.
+; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
+; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
+; must be separated by a comma. If this value is left blank, connections will be
+; accepted from any ip address.
+; Default Value: any
+;listen.allowed_clients = 127.0.0.1
+
+; Specify the nice(2) priority to apply to the pool processes (only if set)
+; The value can vary from -19 (highest priority) to 20 (lower priority)
+; Note: - It will only work if the FPM master process is launched as root
+; - The pool processes will inherit the master process priority
+; unless it specified otherwise
+; Default Value: no set
+; priority = -19
+
+; Choose how the process manager will control the number of child processes.
+; Possible Values:
+; static - a fixed number (pm.max_children) of child processes;
+; dynamic - the number of child processes are set dynamically based on the
+; following directives. With this process management, there will be
+; always at least 1 children.
+; pm.max_children - the maximum number of children that can
+; be alive at the same time.
+; pm.start_servers - the number of children created on startup.
+; pm.min_spare_servers - the minimum number of children in 'idle'
+; state (waiting to process). If the number
+; of 'idle' processes is less than this
+; number then some children will be created.
+; pm.max_spare_servers - the maximum number of children in 'idle'
+; state (waiting to process). If the number
+; of 'idle' processes is greater than this
+; number then some children will be killed.
+; ondemand - no children are created at startup. Children will be forked when
+; new requests will connect. The following parameter are used:
+; pm.max_children - the maximum number of children that
+; can be alive at the same time.
+; pm.process_idle_timeout - The number of seconds after which
+; an idle process will be killed.
+; Note: This value is mandatory.
+pm = dynamic
+
+; The number of child processes to be created when pm is set to 'static' and the
+; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
+; This value sets the limit on the number of simultaneous requests that will be
+; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
+; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
+; CGI. The below defaults are based on a server without much resources. Don't
+; forget to tweak pm.* to fit your needs.
+; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
+; Note: This value is mandatory.
+pm.max_children = 10
+
+; The number of child processes created on startup.
+; Note: Used only when pm is set to 'dynamic'
+; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
+pm.start_servers = 2
+
+; The desired minimum number of idle server processes.
+; Note: Used only when pm is set to 'dynamic'
+; Note: Mandatory when pm is set to 'dynamic'
+pm.min_spare_servers = 1
+
+; The desired maximum number of idle server processes.
+; Note: Used only when pm is set to 'dynamic'
+; Note: Mandatory when pm is set to 'dynamic'
+pm.max_spare_servers = 3
+
+; The number of seconds after which an idle process will be killed.
+; Note: Used only when pm is set to 'ondemand'
+; Default Value: 10s
+;pm.process_idle_timeout = 10s;
+
+; The number of requests each child process should execute before respawning.
+; This can be useful to work around memory leaks in 3rd party libraries. For
+; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
+; Default Value: 0
+pm.max_requests = 500
+
+; The URI to view the FPM status page. If this value is not set, no URI will be
+; recognized as a status page. It shows the following informations:
+; pool - the name of the pool;
+; process manager - static, dynamic or ondemand;
+; start time - the date and time FPM has started;
+; start since - number of seconds since FPM has started;
+; accepted conn - the number of request accepted by the pool;
+; listen queue - the number of request in the queue of pending
+; connections (see backlog in listen(2));
+; max listen queue - the maximum number of requests in the queue
+; of pending connections since FPM has started;
+; listen queue len - the size of the socket queue of pending connections;
+; idle processes - the number of idle processes;
+; active processes - the number of active processes;
+; total processes - the number of idle + active processes;
+; max active processes - the maximum number of active processes since FPM
+; has started;
+; max children reached - number of times, the process limit has been reached,
+; when pm tries to start more children (works only for
+; pm 'dynamic' and 'ondemand');
+; Value are updated in real time.
+; Example output:
+; pool: www
+; process manager: static
+; start time: 01/Jul/2011:17:53:49 +0200
+; start since: 62636
+; accepted conn: 190460
+; listen queue: 0
+; max listen queue: 1
+; listen queue len: 42
+; idle processes: 4
+; active processes: 11
+; total processes: 15
+; max active processes: 12
+; max children reached: 0
+;
+; By default the status page output is formatted as text/plain. Passing either
+; 'html', 'xml' or 'json' in the query string will return the corresponding
+; output syntax. Example:
+; http://www.foo.bar/status
+; http://www.foo.bar/status?json
+; http://www.foo.bar/status?html
+; http://www.foo.bar/status?xml
+;
+; By default the status page only outputs short status. Passing 'full' in the
+; query string will also return status for each pool process.
+; Example:
+; http://www.foo.bar/status?full
+; http://www.foo.bar/status?json&full
+; http://www.foo.bar/status?html&full
+; http://www.foo.bar/status?xml&full
+; The Full status returns for each process:
+; pid - the PID of the process;
+; state - the state of the process (Idle, Running, ...);
+; start time - the date and time the process has started;
+; start since - the number of seconds since the process has started;
+; requests - the number of requests the process has served;
+; request duration - the duration in µs of the requests;
+; request method - the request method (GET, POST, ...);
+; request URI - the request URI with the query string;
+; content length - the content length of the request (only with POST);
+; user - the user (PHP_AUTH_USER) (or '-' if not set);
+; script - the main script called (or '-' if not set);
+; last request cpu - the %cpu the last request consumed
+; it's always 0 if the process is not in Idle state
+; because CPU calculation is done when the request
+; processing has terminated;
+; last request memory - the max amount of memory the last request consumed
+; it's always 0 if the process is not in Idle state
+; because memory calculation is done when the request
+; processing has terminated;
+; If the process is in Idle state, then informations are related to the
+; last request the process has served. Otherwise informations are related to
+; the current request being served.
+; Example output:
+; ************************
+; pid: 31330
+; state: Running
+; start time: 01/Jul/2011:17:53:49 +0200
+; start since: 63087
+; requests: 12808
+; request duration: 1250261
+; request method: GET
+; request URI: /test_mem.php?N=10000
+; content length: 0
+; user: -
+; script: /home/fat/web/docs/php/test_mem.php
+; last request cpu: 0.00
+; last request memory: 0
+;
+; Note: There is a real-time FPM status monitoring sample web page available
+; It's available in: ${prefix}/share/fpm/status.html
+;
+; Note: The value must start with a leading slash (/). The value can be
+; anything, but it may not be a good idea to use the .php extension or it
+; may conflict with a real PHP file.
+; Default Value: not set
+;pm.status_path = /status
+
+; The ping URI to call the monitoring page of FPM. If this value is not set, no
+; URI will be recognized as a ping page. This could be used to test from outside
+; that FPM is alive and responding, or to
+; - create a graph of FPM availability (rrd or such);
+; - remove a server from a group if it is not responding (load balancing);
+; - trigger alerts for the operating team (24/7).
+; Note: The value must start with a leading slash (/). The value can be
+; anything, but it may not be a good idea to use the .php extension or it
+; may conflict with a real PHP file.
+; Default Value: not set
+;ping.path = /ping
+
+; This directive may be used to customize the response of a ping request. The
+; response is formatted as text/plain with a 200 response code.
+; Default Value: pong
+;ping.response = pong
+
+; The access log file
+; Default: not set
+;access.log = log/$pool.access.log
+
+; The access log format.
+; The following syntax is allowed
+; %%: the '%' character
+; %C: %CPU used by the request
+; it can accept the following format:
+; - %{user}C for user CPU only
+; - %{system}C for system CPU only
+; - %{total}C for user + system CPU (default)
+; %d: time taken to serve the request
+; it can accept the following format:
+; - %{seconds}d (default)
+; - %{miliseconds}d
+; - %{mili}d
+; - %{microseconds}d
+; - %{micro}d
+; %e: an environment variable (same as $_ENV or $_SERVER)
+; it must be associated with embraces to specify the name of the env
+; variable. Some exemples:
+; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
+; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
+; %f: script filename
+; %l: content-length of the request (for POST request only)
+; %m: request method
+; %M: peak of memory allocated by PHP
+; it can accept the following format:
+; - %{bytes}M (default)
+; - %{kilobytes}M
+; - %{kilo}M
+; - %{megabytes}M
+; - %{mega}M
+; %n: pool name
+; %o: ouput header
+; it must be associated with embraces to specify the name of the header:
+; - %{Content-Type}o
+; - %{X-Powered-By}o
+; - %{Transfert-Encoding}o
+; - ....
+; %p: PID of the child that serviced the request
+; %P: PID of the parent of the child that serviced the request
+; %q: the query string
+; %Q: the '?' character if query string exists
+; %r: the request URI (without the query string, see %q and %Q)
+; %R: remote IP address
+; %s: status (response code)
+; %t: server time the request was received
+; it can accept a strftime(3) format:
+; %d/%b/%Y:%H:%M:%S %z (default)
+; %T: time the log has been written (the request has finished)
+; it can accept a strftime(3) format:
+; %d/%b/%Y:%H:%M:%S %z (default)
+; %u: remote user
+;
+; Default: "%R - %u %t \"%m %r\" %s"
+;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
+
+; The log file for slow requests
+; Default Value: not set
+; Note: slowlog is mandatory if request_slowlog_timeout is set
+slowlog = /var/log/nginx/__NAMETOCHANGE__.slow.log
+
+; The timeout for serving a single request after which a PHP backtrace will be
+; dumped to the 'slowlog' file. A value of '0s' means 'off'.
+; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
+; Default Value: 0
+request_slowlog_timeout = 5s
+
+; The timeout for serving a single request after which the worker process will
+; be killed. This option should be used when the 'max_execution_time' ini option
+; does not stop script execution for some reason. A value of '0' means 'off'.
+; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
+; Default Value: 0
+request_terminate_timeout = 1d
+
+; Set open file descriptor rlimit.
+; Default Value: system defined value
+;rlimit_files = 1024
+
+; Set max core size rlimit.
+; Possible Values: 'unlimited' or an integer greater or equal to 0
+; Default Value: system defined value
+;rlimit_core = 0
+
+; Chroot to this directory at the start. This value must be defined as an
+; absolute path. When this value is not set, chroot is not used.
+; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
+; of its subdirectories. If the pool prefix is not set, the global prefix
+; will be used instead.
+; Note: chrooting is a great security feature and should be used whenever
+; possible. However, all PHP paths will be relative to the chroot
+; (error_log, sessions.save_path, ...).
+; Default Value: not set
+;chroot =
+
+; Chdir to this directory at the start.
+; Note: relative path can be used.
+; Default Value: current directory or / when chroot
+chdir = __FINALPATH__
+
+; Redirect worker stdout and stderr into main error log. If not set, stdout and
+; stderr will be redirected to /dev/null according to FastCGI specs.
+; Note: on highloaded environement, this can cause some delay in the page
+; process time (several ms).
+; Default Value: no
+catch_workers_output = yes
+
+; Limits the extensions of the main script FPM will allow to parse. This can
+; prevent configuration mistakes on the web server side. You should only limit
+; FPM to .php extensions to prevent malicious users to use other extensions to
+; exectute php code.
+; Note: set an empty value to allow all extensions.
+; Default Value: .php
+;security.limit_extensions = .php .php3 .php4 .php5
+
+; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
+; the current environment.
+; Default Value: clean env
+;env[HOSTNAME] = $HOSTNAME
+;env[PATH] = /usr/local/bin:/usr/bin:/bin
+;env[TMP] = /tmp
+;env[TMPDIR] = /tmp
+;env[TEMP] = /tmp
+
+; Additional php.ini defines, specific to this pool of workers. These settings
+; overwrite the values previously defined in the php.ini. The directives are the
+; same as the PHP SAPI:
+; php_value/php_flag - you can set classic ini defines which can
+; be overwritten from PHP call 'ini_set'.
+; php_admin_value/php_admin_flag - these directives won't be overwritten by
+; PHP call 'ini_set'
+; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
+
+; Defining 'extension' will load the corresponding shared extension from
+; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
+; overwrite previously defined php.ini values, but will append the new value
+; instead.
+
+; Note: path INI options can be relative and will be expanded with the prefix
+; (pool, global or /usr)
+
+; Default Value: nothing is defined by default except the values in php.ini and
+; specified at startup with the -d argument
+;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
+;php_flag[display_errors] = off
+;php_admin_value[error_log] = /var/log/fpm-php.www.log
+;php_admin_flag[log_errors] = on
+;php_admin_value[memory_limit] = 32M
diff --git a/conf/php-fpm.ini b/conf/php-fpm.ini
new file mode 100644
index 0000000..98d3099
--- /dev/null
+++ b/conf/php-fpm.ini
@@ -0,0 +1,3 @@
+; upload_max_filesize=100M
+; post_max_size=100M
+; max_execution_time=60
diff --git a/manifest.json b/manifest.json
index c1b53df..722e3a4 100644
--- a/manifest.json
+++ b/manifest.json
@@ -7,6 +7,7 @@
},
"version": "1.6",
"url": "http://leed.idleman.fr/",
+ "licence": "free",
"maintainer": {
"name": "Maniack Crudelis",
"email": "maniackc_dev@crudelis.fr"
@@ -41,6 +42,7 @@
},
{
"name": "password",
+ "type": "password",
"ask": {
"en": "Set the administrator password Leed",
"fr": "Définissez le mot de passe administrateur de Leed"
diff --git a/scripts/backup b/scripts/backup
new file mode 100644
index 0000000..ecfbb65
--- /dev/null
+++ b/scripts/backup
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Récupère les infos de l'application.
+app=leed
+final_path=$(sudo yunohost app setting $app final_path)
+domain=$(sudo yunohost app setting $app domain)
+
+
+# The parameter $1 is the backup directory location
+# which will be compressed afterward
+backup_dir=$1/apps/$app
+sudo mkdir -p "$backup_dir"
+
+# Backup sources & data
+sudo cp -a $final_path/. $backup_dir/sources
+
+# Copy Nginx and YunoHost parameters to make the script "standalone"
+sudo cp -a /etc/yunohost/apps/$app/. $backup_dir/yunohost
+sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf $backup_dir/nginx.conf
+
+# Copy dedicated php-fpm process to backup folder
+sudo cp -a /etc/php5/fpm/pool.d/$app.conf $backup_dir/php-fpm.conf
+sudo cp -a /etc/php5/fpm/conf.d/20-$app.ini $backup_dir/php-fpm.ini
diff --git a/scripts/install b/scripts/install
index 293dc5d..30c6f54 100644
--- a/scripts/install
+++ b/scripts/install
@@ -8,16 +8,17 @@ user_pwd=$4
language=$5
market=$6
is_public=$7
+app=leed
-# Check if admin exists
+# Vérifie la validité de l'user admin
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
if [[ ! $? -eq 0 ]]; then
echo "Wrong admin"
exit 1
fi
-# Check domain/path availability
-sudo yunohost app checkurl $domain$path -a leed
+# Vérifie la disponibilité du path et du domaine.
+sudo yunohost app checkurl $domain$path -a $app
if [[ ! $? -eq 0 ]]; then
exit 1
fi
@@ -28,62 +29,102 @@ if [[ -z $user_pwd ]]; then
exit 1
fi
-# Add settings to YunoHost
-sudo yunohost app setting leed admin -v $admin
-sudo yunohost app setting leed language -v $language
-sudo yunohost app setting leed domain -v $domain
+# Vérifie que le dossier de destination n'est pas déjà utilisé.
+final_path=/var/www/$app
+if [ -e "$final_path" ]
+then
+ echo "This path already contains a folder"
+ exit 1
+fi
-# Generate random password
+# Vérifie la présence du / en début de path
+if [ $(echo $path | cut -c1) != "/" ]; then
+ path="/$path"
+fi
+
+
+# Enregistre les infos dans la config YunoHost
+sudo yunohost app setting $app admin -v $admin
+sudo yunohost app setting $app language -v $language
+sudo yunohost app setting $app domain -v $domain
+
+# Génère un mot de passe aléatoire.
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
-
-# Use 'leed' as database name and user
-db_user=leed
-
-# Initialize database and store mysql password for upgrade
+# Utilise '$app' comme nom d'utilisateur et de base de donnée
+db_user=$app
+# Initialise la base de donnée et stocke le mot de passe mysql.
sudo yunohost app initdb $db_user -p $db_pwd
-sudo yunohost app setting leed mysqlpwd -v $db_pwd
+sudo yunohost app setting $app mysqlpwd -v $db_pwd
+
+
+# Crée le repertoire de destination et stocke son emplacement.
+sudo mkdir "$final_path"
+sudo yunohost app setting $app final_path -v $final_path
+
+# Décompresse la source
+tar -x -f ../sources/leed.tar.gz
+# Copie les fichiers sources
+sudo cp -a leed/. "$final_path"
+# Copie les fichiers additionnels ou modifiés.
+# sudo cp -a ../sources/ajouts/. "$final_path"
+# Et copie le fichier de config nginx
+sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
+
+
+# Modifie les variables dans le fichier de configuration nginx
+sudo sed -i "s@__PATH__@$path@g" /etc/nginx/conf.d/$domain.d/$app.conf
+sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/nginx/conf.d/$domain.d/$app.conf
+sudo sed -i "s@__NAMETOCHANGE__@$app@g" /etc/nginx/conf.d/$domain.d/$app.conf
+
+# Créer le fichier de configuration du pool php-fpm et le configure.
+sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/php-fpm.conf
+sed -i "s@__FINALPATH__@$final_path@g" ../conf/php-fpm.conf
+finalphpconf=/etc/php5/fpm/pool.d/$app.conf
+sudo cp ../conf/php-fpm.conf $finalphpconf
+sudo chown root: $finalphpconf
+finalphpini=/etc/php5/fpm/conf.d/20-$app.ini
+sudo cp ../conf/php-fpm.ini $finalphpini
+sudo chown root: $finalphpini
+sudo service php5-fpm reload
-# Copy files to right place
-final_path=/var/www/leed
-sudo mkdir -p $final_path
-sudo cp -a ../sources/* $final_path
-sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/leed.conf
# Set right permissions for curl install
sudo chown -R www-data: $final_path
-# Change variables in Leed configuration
-sudo sed -i "s@PATHTOCHANGE@$path@g" /etc/nginx/conf.d/$domain.d/leed.conf
-sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" /etc/nginx/conf.d/$domain.d/leed.conf
-
# Rend la page d'install publique pour curl
-sudo yunohost app setting leed unprotected_uris -v "/" #L'usage de unprotected_uris a la place de skipped_uris permet de passer le header d'auth http
+sudo yunohost app setting $app unprotected_uris -v "/" #L'usage de unprotected_uris a la place de skipped_uris permet de passer le header d'auth http
sudo yunohost app ssowatconf
# Reload Nginx
sudo service nginx reload
# Leed installation via curl
-echo "127.0.0.1 $domain #yunoleed" | sudo tee -a /etc/hosts
+echo "127.0.0.1 $domain #leed" | sudo tee -a /etc/hosts
sleep 1
curl -k --data "install_changeLngLeed=$language&root=$domain$path&mysqlHost=localhost&mysqlLogin=$db_user&mysqlMdp=$db_pwd&mysqlBase=$db_user&mysqlPrefix=leed_&login=$admin&password=$user_pwd" https://$domain$path/install.php?installButton > /dev/null
# Activate Leed Market if necessary
-sudo yunohost app setting leed market -v "$market"
+sudo yunohost app setting $app market -v "$market"
if [ "$market" = "Yes" ];
then
sudo rm -R $final_path/plugins
sudo git clone https://github.com/ldleman/Leed-market.git $final_path/plugins
fi
-# Files owned by root, www-data can just read
-sudo mkdir $final_path/cache
+
+# Configure les droits d'accès au fichiers
+# -rw-r--r-- sur les fichiers
sudo find $final_path -type f | xargs sudo chmod 644
+# drwxr-xr-x sur les dossiers
sudo find $final_path -type d | xargs sudo chmod 755
+# Les fichiers appartiennent à root
sudo chown -R root: $final_path
-# www-data can write on plugins and cache
+
+# www-data doit avoir les droits d'écriture dans plugins et cache
+sudo mkdir $final_path/cache
sudo chown -R www-data $final_path/cache $final_path/plugins
+
# Récupération du code de synchronisation
code_sync=$(mysql -h localhost -u $db_user -p$db_pwd -s $db_user -e 'SELECT value FROM leed_configuration WHERE `key`="synchronisationCode"' | sed -n 1p)
@@ -92,18 +133,21 @@ sed -i "s@__ADMIN__@$admin@g" ../conf/cron_leed
sed -i "s@__DOMAIN__@$domain@g" ../conf/cron_leed
sed -i "s@__PATH__@$path@g" ../conf/cron_leed
sed -i "s@__CODESYNC__@$code_sync@g" ../conf/cron_leed
-sudo cp ../conf/cron_leed /etc/cron.d/leed
+sudo cp ../conf/cron_leed /etc/cron.d/$app
# Make app private if necessary
-sudo yunohost app setting leed is_public -v "$is_public"
+sudo yunohost app setting $app is_public -v "$is_public"
if [ "$is_public" = "No" ];
then
# Retire l'autorisation d'accès de la page d'install.
- sudo yunohost app setting leed unprotected_uris -d
+ sudo yunohost app setting $app unprotected_uris -d
# Rend la page d'actualisation accessible pour le script cron.
- sudo yunohost app setting leed skipped_uris -v "/action.php"
+ sudo yunohost app setting $app skipped_uris -v "/action.php"
sudo yunohost app ssowatconf
fi
# Clean hosts
-sudo sed -i '/yunoleed/d' /etc/hosts
+sudo sed -i '/#leed/d' /etc/hosts
+
+# Recharge la configuration php5-fpm
+# sudo service php5-fpm reload
diff --git a/scripts/remove b/scripts/remove
index 1dc0a34..0a4aca3 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -1,22 +1,30 @@
#!/bin/bash
-db_user=leed
-db_name=leed
-root_pwd=$(sudo cat /etc/yunohost/mysql)
-domain=$(sudo yunohost app setting leed domain)
-admin=$(sudo yunohost app setting leed admin)
-path=$(sudo yunohost app setting leed path)
+app=leed
+
+# Récupère les infos de l'application.
+root_pwd=$(sudo cat /etc/yunohost/mysql)
+domain=$(sudo yunohost app setting $app domain)
+
+# Utilise '$app' comme nom d'utilisateur et de base de donnée
+db_user=$app
+mysql -u root -p$root_pwd -e "DROP DATABASE $db_user ; DROP USER $db_user@localhost ;"
+
+# Suppression du dossier de l'application
+sudo rm -rf /var/www/$app
-# Suppression de la base de donnée et son user
-mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
-# Suppression du dossier
-sudo rm -rf /var/www/leed
# Suppression de la configuration nginx
-sudo rm -f /etc/nginx/conf.d/$domain.d/leed.conf
+sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
# Retirer le cron
-sudo rm -f /etc/cron.d/leed
+sudo rm -f /etc/cron.d/$app
-# Reload Nginx and regenerate SSOwat conf
+# Suppression de la configuration du pool php-fpm
+sudo rm -f /etc/php5/fpm/pool.d/$app.conf
+sudo rm -f /etc/php5/fpm/conf.d/20-$app.ini
+
+# Recharge la configuration Nginx et php5-fpm
sudo service nginx reload
+# sudo service php5-fpm reload
+# Régénère la configuration de SSOwat
sudo yunohost app ssowatconf
diff --git a/scripts/restore b/scripts/restore
new file mode 100644
index 0000000..fac446c
--- /dev/null
+++ b/scripts/restore
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Récupère les infos de l'application.
+app=leed
+final_path=$(sudo yunohost app setting $app final_path)
+domain=$(sudo yunohost app setting $app domain)
+
+# The parameter $1 is the uncompressed restore directory location
+backup_dir=$1/apps/$app
+
+# Restore sources & data
+sudo cp -a $backup_dir/sources/. $final_path
+
+# Restore Nginx and YunoHost parameters
+sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app
+sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
+
+# Copy dedicated php-fpm process from backup folder to the right location
+sudo cp -a $backup_dir/php-fpm.conf /etc/php5/fpm/pool.d/$app.conf
+sudo cp -a $backup_dir/php-fpm.ini /etc/php5/fpm/conf.d/20-$app.ini
+# And restart service
+sudo service php5-fpm reload
+
+# Restart webserver
+sudo service nginx reload
diff --git a/scripts/upgrade b/scripts/upgrade
index e68f3d3..345b694 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -1,42 +1,79 @@
#!/bin/bash
-# Retrieve arguments
-domain=$(sudo yunohost app setting leed domain)
-path=$(sudo yunohost app setting leed path)
-is_public=$(sudo yunohost app setting leed is_public)
+# Récupère les infos de l'application.
+app=app_name
+domain=$(sudo yunohost app setting $app domain)
+path=$(sudo yunohost app setting $app path)
+admin=$(sudo yunohost app setting $app admin)
+is_public=$(sudo yunohost app setting $app is_public)
-# Copy files to right place
-final_path=/var/www/leed
-sudo mkdir -p $final_path
-sudo cp -a ../sources/* $final_path
-sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/leed.conf
+
+# Décompresse la source
+tar -x -f ../sources/leed.tar.gz
+# Copie les fichiers sources
+sudo cp -a leed/. "$final_path"
+# Copie les fichiers additionnels ou modifiés.
+# sudo cp -a ../sources/ajouts/. "$final_path"
+# Et copie le fichier de config nginx
+sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Set right permissions
sudo chown -R www-data: $final_path
# Change variables in Leed configuration
-sudo sed -i "s@PATHTOCHANGE@$path@g" /etc/nginx/conf.d/$domain.d/leed.conf
-sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" /etc/nginx/conf.d/$domain.d/leed.conf
+sudo sed -i "s@__PATH__@$path@g" /etc/nginx/conf.d/$domain.d/$app.conf
+sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/nginx/conf.d/$domain.d/$app.conf
+sudo sed -i "s@NAMETOCHANGE@$app@g" /etc/nginx/conf.d/$domain.d/$app.conf
-# Files owned by root, www-data can just read
+# Créer le fichier de configuration du pool php-fpm et le configure.
+sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/php-fpm.conf
+sed -i "s@__FINALPATH__@$final_path@g" ../conf/php-fpm.conf
+finalphpconf=/etc/php5/fpm/pool.d/$app.conf
+sudo cp ../conf/php-fpm.conf $finalphpconf
+sudo chown root: $finalphpconf
+finalphpini=/etc/php5/fpm/conf.d/20-$app.ini
+sudo cp ../conf/php-fpm.ini $finalphpini
+sudo chown root: $finalphpini
+sudo service php5-fpm reload
+
+# Configure les droits d'accès au fichiers
+# -rw-r--r-- sur les fichiers
sudo find $final_path -type f | xargs sudo chmod 644
+# drwxr-xr-x sur les dossiers
sudo find $final_path -type d | xargs sudo chmod 755
+# Les fichiers appartiennent à root
sudo chown -R root: $final_path
-# www-data can write on plugins and cache
+
+# www-data doit avoir les droits d'écriture dans plugins et cache
+sudo mkdir $final_path/cache
sudo chown -R www-data $final_path/cache $final_path/plugins
+
+# Récupération du code de synchronisation
+db_user=$app
+code_sync=$(mysql -h localhost -u $db_user -p$db_pwd -s $db_user -e 'SELECT value FROM leed_configuration WHERE `key`="synchronisationCode"' | sed -n 1p)
+
+# Mise en place du cron pour la synchronisation
+sed -i "s@__ADMIN__@$admin@g" ../conf/cron_leed
+sed -i "s@__DOMAIN__@$domain@g" ../conf/cron_leed
+sed -i "s@__PATH__@$path@g" ../conf/cron_leed
+sed -i "s@__CODESYNC__@$code_sync@g" ../conf/cron_leed
+sudo cp ../conf/cron_leed /etc/cron.d/$app
+
# Make app private if necessary
-sudo yunohost app setting leed is_public -v "$is_public"
+sudo yunohost app setting $app is_public -v "$is_public"
if [ "$is_public" = "No" ];
then
# Retire l'autorisation d'accès de la page d'install.
- sudo yunohost app setting leed unprotected_uris -d
+ sudo yunohost app setting $app unprotected_uris -d
# Rend la page d'actualisation accessible pour le script cron.
- sudo yunohost app setting leed skipped_uris -v "/action.php"
+ sudo yunohost app setting $app skipped_uris -v "/action.php"
else # Si l'app est publique
- sudo yunohost app setting leed unprotected_uris -v "/"
+ sudo yunohost app setting $app unprotected_uris -v "/"
fi
-# Reload Nginx and regenerate SSOwat conf
+# Recharge la configuration Nginx et php5-fpm
sudo service nginx reload
+# sudo service php5-fpm reload
+# Régénère la configuration de SSOwat
sudo yunohost app ssowatconf
diff --git a/sources/Configuration.class.php b/sources/Configuration.class.php
deleted file mode 100755
index a73903a..0000000
--- a/sources/Configuration.class.php
+++ /dev/null
@@ -1,95 +0,0 @@
-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;
- }
-
-
-
-
-}
-
-?>
\ No newline at end of file
diff --git a/sources/Event.class.php b/sources/Event.class.php
deleted file mode 100755
index 26174cb..0000000
--- a/sources/Event.class.php
+++ /dev/null
@@ -1,208 +0,0 @@
-'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 getEventCountNotVerboseFeed(){
- $results = $this->customQuery('SELECT COUNT(1) 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 AND '.MYSQL_PREFIX.'feed.isverbose=0');
- while($item = mysql_fetch_array($results)){
- $nbitem = $item[0];
- }
-
- return $nbitem;
- }
-
- function getEventsNotVerboseFeed($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.isverbose = 0 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 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;
- }
-
-}
-
-?>
diff --git a/sources/Feed.class.php b/sources/Feed.class.php
deleted file mode 100755
index cf29dae..0000000
--- a/sources/Feed.class.php
+++ /dev/null
@@ -1,304 +0,0 @@
-'key',
- 'name'=>'string',
- 'description'=>'longstring',
- 'website'=>'longstring',
- 'url'=>'longstring',
- 'lastupdate'=>'string',
- 'folder'=>'integer',
- 'isverbose'=>'boolean',
- );
-
- 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 "é", il ne devrait pas le faire.
- J'ai testé set_stupidly_fast(true) sans succès.
- Il encadre les descriptions avec
, 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 Aggregator) '.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 ='
Fichier média : '.$enclosureName.' (Format '.strtoupper($enclosureFormat).', '.Functions::convertFileSize($enclosure->length).') ';
- }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)
- .'…
Lire la suite de l\'article '
- );
- 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;
- }
-
- function getIsverbose(){
- return $this->isverbose;
- }
-
- function setIsverbose($isverbose){
- $this->isverbose = $isverbose;
- }
-
- /** @returns vrai si l'url n'est pas déjà connue .*/
- function notRegistered() {
- return $this->rowCount(array('url' => $this->url)) == 0;
- }
-
-}
-
-?>
diff --git a/sources/Folder.class.php b/sources/Folder.class.php
deleted file mode 100755
index 7960b27..0000000
--- a/sources/Folder.class.php
+++ /dev/null
@@ -1,99 +0,0 @@
-'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;
- }
-
-
-
-}
-
-?>
diff --git a/sources/Functions.class.php b/sources/Functions.class.php
deleted file mode 100755
index 2bea86f..0000000
--- a/sources/Functions.class.php
+++ /dev/null
@@ -1,371 +0,0 @@
- variable a sécuriser
- * @param
niveau de securisation
- * @return 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 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 message a tronquer
- * @param limite de caracteres
- * @return 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(''','-',$name);
- $name = str_replace('\'','-',$name);
- $name = str_replace(',','-',$name);
- $name = str_replace(':','-',$name);
- $name = str_replace('à','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('<br/>',' ',$str);
- $str = str_replace('&','&',$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('&', '&', $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;
- }
-
- /**
- * @return les langues acceptées par le navigateur
- */
- public static function getBrowserLanguages() {
- /* http://www.w3.org/International/questions/qa-lang-priorities.en.php
- * ex: da, en-gb;q=0.8,en;q=0.7 --> array('da','en');
- */
- $languages = array();
- $chunks = preg_split('/,\s*/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
- foreach($chunks as $chunk) $languages []= substr($chunk, 0, 2);
- return array_unique($languages);
- }
-}
-?>
diff --git a/sources/MysqlConnector.class.php b/sources/MysqlConnector.class.php
deleted file mode 100755
index c8775a3..0000000
--- a/sources/MysqlConnector.class.php
+++ /dev/null
@@ -1,199 +0,0 @@
-connect();
- }
-
-
-
- /**
- * Methode de recuperation unique de l'instance
- * @author Valentin CARRUESCO
- * @category Singleton
- * @param
- * @return $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);
- mysql_query('SET NAMES utf8');
- mysql_select_db(MYSQL_BDD,$this->connection);
- }
-
-
-
- public function __toString(){
- $retour = "";
- $retour .= "instance de la classe MysqlConnector : ";
- $retour .= '$hote : '.$this->hote.' ';
- $retour .= '$login : '.$this->login.' ';
- $retour .= '$mdp : '.$this->mdp.' ';
- $retour .= '$bdd : '.$this->bdd.' ';
- $retour .= '$port : '.$this->port.' ';
- return $retour;
- }
-
- private function __clone(){
- //Action lors du clonage de l'objet
- }
-
- // ACCESSEURS
-
- public function getId(){
- return $this->id;
- }
-
- public function setId($id){
- $this->id = $id;
- }
-
- /**
- * Méthode de récuperation de l'attribut hote de la classe Mysql
- * @author Valentin CARRUESCO
- * @category Accesseur
- * @param Aucun
- * @return hote
- */
-
- public function getHote(){
- return $this->hote;
- }
-
- /**
- * Méthode de définition de l'attribut hote de la classe Mysql
- * @author Valentin CARRUESCO
- * @category Accesseur
- * @param $hote
- * @return Aucun retour
- */
-
- public function setHote($hote){
- $this->hote = $hote;
- }
-
- /**
- * Méthode de récuperation de l'attribut login de la classe Mysql
- * @author Valentin CARRUESCO
- * @category Accesseur
- * @param Aucun
- * @return login
- */
-
- public function getLogin(){
- return $this->login;
- }
-
- /**
- * Méthode de définition de l'attribut login de la classe Mysql
- * @author Valentin CARRUESCO
- * @category Accesseur
- * @param $login
- * @return Aucun retour
- */
-
- public function setLogin($login){
- $this->login = $login;
- }
-
- /**
- * Méthode de récuperation de l'attribut mdp de la classe Mysql
- * @author Valentin CARRUESCO
- * @category Accesseur
- * @param Aucun
- * @return mdp
- */
-
- public function getMdp(){
- return $this->mdp;
- }
-
- /**
- * Méthode de définition de l'attribut mdp de la classe Mysql
- * @author Valentin CARRUESCO
- * @category Accesseur
- * @param $mdp
- * @return Aucun retour
- */
-
- public function setMdp($mdp){
- $this->mdp = $mdp;
- }
-
- /**
- * Méthode de récuperation de l'attribut bdd de la classe Mysql
- * @author Valentin CARRUESCO
- * @category Accesseur
- * @param Aucun
- * @return bdd
- */
-
- public function getBdd(){
- return $this->bdd;
- }
-
- /**
- * Méthode de définition de l'attribut bdd de la classe Mysql
- * @author Valentin CARRUESCO
- * @category Accesseur
- * @param $bdd
- * @return Aucun retour
- */
-
- public function setBdd($bdd){
- $this->bdd = $bdd;
- }
-
- /**
- * Méthode de récuperation de l'attribut port de la classe Mysql
- * @author Valentin CARRUESCO
- * @category Accesseur
- * @param Aucun
- * @return port
- */
-
- public function getPort(){
- return $this->port;
- }
-
- /**
- * Méthode de définition de l'attribut port de la classe Mysql
- * @author Valentin CARRUESCO
- * @category Accesseur
- * @param $port
- * @return Aucun retour
- */
-
- public function setPort($port){
- $this->port = $port;
- }
-}
-?>
diff --git a/sources/MysqlEntity.class.php b/sources/MysqlEntity.class.php
deleted file mode 100755
index 43dbf7b..0000000
--- a/sources/MysqlEntity.class.php
+++ /dev/null
@@ -1,446 +0,0 @@
-object_fields[$field]))
- $type = $this->object_fields[$field];
-
- $return = false;
- switch($type){
- case 'key':
- case 'object':
- case 'integer':
- case 'boolean':
- $return = intval($value);
- break;
- case 'string':
- case 'timestamp':
- case 'longstring':
- default;
- $return = mysql_real_escape_string((string)$value);
- break;
- }
- return $return ;
- }
-
- public function __construct(){
- MysqlConnector::getInstance();
- }
-
- public function __destruct(){
-
- }
-
- // GESTION SQL
-
- /**
- * Methode de suppression de l'entité
- * @author Valentin CARRUESCO
- * @category manipulation SQL
- * @param $debug=false active le debug mode (0 ou 1)
- * @return Aucun retour
- */
- public function destroy($debug=false)
- {
- $query = 'DROP TABLE IF EXISTS '.MYSQL_PREFIX.$this->TABLE_NAME.';';
- if($this->debug)echo ' '.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.' '.mysql_error();
- $myQuery = $this->customQuery($query);
- }
-
- /**
- * Methode de nettoyage de l'entité
- * @author Valentin CARRUESCO
- * @category manipulation SQL
- * @param $debug=false active le debug mode (0 ou 1)
- * @return Aucun retour
- */
- public function truncate($debug=false)
- {
- $query = 'TRUNCATE TABLE '.MYSQL_PREFIX.$this->TABLE_NAME.';';
- if($this->debug)echo ' '.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.' '.mysql_error();
- $myQuery = $this->customQuery($query);
- }
-
- /**
- * Methode de creation de l'entité
- * @author Valentin CARRUESCO
- * @category manipulation SQL
- * @param $debug=false active le debug mode (0 ou 1)
- * @return Aucun retour
- */
- public function create($debug=false){
- $query = 'CREATE TABLE IF NOT EXISTS `'.MYSQL_PREFIX.$this->TABLE_NAME.'` (';
-
- $i=false;
- foreach($this->object_fields as $field=>$type){
- if($i){$query .=',';}else{$i=true;}
- $query .='`'.$field.'` '. $this->sgbdType($type).' NOT NULL';
- }
- if (isset($this->object_fields_index)){
- foreach($this->object_fields_index as $field=>$type){
- $query .= ',KEY `index'.$field.'` (`'.$field.'`)';
- }
- }
- $query .= ')
- ENGINE InnoDB,
- DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
- ;';
- if($this->debug)echo ' '.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.' '.mysql_error();
- $myQuery = $this->customQuery($query);
- }
-
- public function massiveInsert($events){
- if (empty($events)) return;
- $query = 'INSERT INTO `'.MYSQL_PREFIX.$this->TABLE_NAME.'`(';
- $i=false;
- foreach($this->object_fields as $field=>$type){
- if($type!='key'){
- if($i){$query .=',';}else{$i=true;}
- $query .='`'.$field.'`';
- }
- }
- $query .=') select';
- $u = false;
-
- foreach($events as $event){
-
- if($u){$query .=' union select ';}else{$u=true;}
-
- $i=false;
- foreach($event->object_fields as $field=>$type){
- if($type!='key'){
- if($i){$query .=',';}else{$i=true;}
- $query .='"'.$this->secure($event->$field, $field).'"';
- }
- }
-
-
- }
-
- $query .=';';
- if($this->debug)echo ' '.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.' '.mysql_error();
-
- $this->customQuery($query);
- }
-
- /**
- * Methode d'insertion ou de modifications d'elements de l'entité
- * @author Valentin CARRUESCO
- * @category manipulation SQL
- * @param Aucun
- * @return Aucun retour
- */
- public function save(){
- if(isset($this->id)){
- $query = 'UPDATE `'.MYSQL_PREFIX.$this->TABLE_NAME.'`';
- $query .= ' SET ';
-
- $i=false;
- foreach($this->object_fields as $field=>$type){
- if($i){$query .=',';}else{$i=true;}
- $id = $this->$field;
- $query .= '`'.$field.'`="'.$this->secure($id, $field).'"';
- }
-
- $query .= ' WHERE `id`="'.$this->id.'";';
- }else{
- $query = 'INSERT INTO `'.MYSQL_PREFIX.$this->TABLE_NAME.'`(';
- $i=false;
- foreach($this->object_fields as $field=>$type){
- if($i){$query .=',';}else{$i=true;}
- $query .='`'.$field.'`';
- }
- $query .=')VALUES(';
- $i=false;
- foreach($this->object_fields as $field=>$type){
- if($i){$query .=',';}else{$i=true;}
- $query .='"'.$this->secure($this->$field, $field).'"';
- }
-
- $query .=');';
- }
- if($this->debug)echo ' '.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.' '.mysql_error();
- $this->customQuery($query);
- $this->id = (!isset($this->id)?mysql_insert_id():$this->id);
- }
-
- /**
- * Méthode de modification d'éléments de l'entité
- * @author Valentin CARRUESCO
- * @category manipulation SQL
- * @param $colonnes=>$valeurs
- * @param $colonnes (WHERE) =>$valeurs (WHERE)
- * @param $operation="=" definis le type d'operateur pour la requete select
- * @param $debug=false active le debug mode (0 ou 1)
- * @return Aucun retour
- */
- public function change($columns,$columns2,$operation='=',$debug=false){
- $query = 'UPDATE `'.MYSQL_PREFIX.$this->TABLE_NAME.'` SET ';
- $i=false;
- foreach ($columns as $column=>$value){
- if($i){$query .=',';}else{$i=true;}
- $query .= '`'.$column.'`="'.$this->secure($value, $column).'" ';
- }
- $query .=' WHERE ';
-
- $i = false;
- foreach ($columns2 as $column=>$value){
- if($i){$query .='AND ';}else{$i=true;}
- $query .= '`'.$column.'`'.$operation.'"'.$this->secure($value, $column).'" ';
- }
- if($this->debug)echo ' '.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.' '.mysql_error();
- $this->customQuery($query);
- }
-
- /**
- * Méthode de selection de tous les elements de l'entité
- * @author Valentin CARRUESCO
- * @category manipulation SQL
- * @param $ordre=null
- * @param $limite=null
- * @param $debug=false active le debug mode (0 ou 1)
- * @return > $Entity
- */
- public function populate($order=null,$limit=null,$debug=false){
- $results = $this->loadAll(array(),$order,$limit,'=',$debug);
- return $results;
- }
-
- /**
- * Méthode de selection multiple d'elements de l'entité
- * @author Valentin CARRUESCO
- * @category manipulation SQL
- * @param $colonnes (WHERE)
- * @param $valeurs (WHERE)
- * @param $ordre=null
- * @param $limite=null
- * @param $operation="=" definis le type d'operateur pour la requete select
- * @param $debug=false active le debug mode (0 ou 1)
- * @return > $Entity
- */
- public function loadAll($columns,$order=null,$limit=null,$operation="=",$debug=false,$selColumn='*'){
- $objects = array();
- $whereClause = '';
-
- if($columns!=null && sizeof($columns)!=0){
- $whereClause .= ' WHERE ';
- $i = false;
- foreach($columns as $column=>$value){
- if($i){$whereClause .=' AND ';}else{$i=true;}
- $whereClause .= '`'.$column.'`'.$operation.'"'.$this->secure($value, $column).'"';
- }
- }
- $query = 'SELECT '.$selColumn.' FROM `'.MYSQL_PREFIX.$this->TABLE_NAME.'` '.$whereClause.' ';
- if($order!=null) $query .='ORDER BY '.$order.' ';
- if($limit!=null) $query .='LIMIT '.$limit.' ';
- $query .=';';
-
- if($this->debug)echo ' '.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.' '.mysql_error();
- $execQuery = $this->customQuery($query);
- while($queryReturn = mysql_fetch_assoc($execQuery)){
-
- $object = new $this->CLASS_NAME();
- foreach($this->object_fields as $field=>$type){
- if(isset($queryReturn[$field])) $object->$field = $queryReturn[$field];
- }
- $objects[] = $object;
- unset($object);
- }
- return $objects;
- }
-
- public function loadAllOnlyColumn($selColumn,$columns,$order=null,$limit=null,$operation="=",$debug=false){
- $objects = $this->loadAll($columns,$order,$limit,$operation,$debug,$selColumn);
- if(count($objects)==0)$objects = array();
- return $objects;
- }
-
-
- /**
- * Méthode de selection unique d'élements de l'entité
- * @author Valentin CARRUESCO
- * @category manipulation SQL
- * @param $colonnes (WHERE)
- * @param $valeurs (WHERE)
- * @param $operation="=" definis le type d'operateur pour la requete select
- * @param $debug=false active le debug mode (0 ou 1)
- * @return $Entity ou false si aucun objet n'est trouvé en base
- */
- public function load($columns,$operation='=',$debug=false){
- $objects = $this->loadAll($columns,null,1,$operation,$debug);
- if(!isset($objects[0]))$objects[0] = false;
- return $objects[0];
- }
-
- /**
- * Méthode de selection unique d'élements de l'entité
- * @author Valentin CARRUESCO
- * @category manipulation SQL
- * @param $colonnes (WHERE)
- * @param $valeurs (WHERE)
- * @param $operation="=" definis le type d'operateur pour la requete select
- * @param $debug=false active le debug mode (0 ou 1)
- * @return $Entity ou false si aucun objet n'est trouvé en base
- */
- public function getById($id,$operation='=',$debug=false){
- return $this->load(array('id'=>$id),$operation,$debug);
- }
-
- /**
- * Methode de comptage des éléments de l'entité
- * @author Valentin CARRUESCO
- * @category manipulation SQL
- * @param $debug=false active le debug mode (0 ou 1)
- * @return nombre de ligne dans l'entité'
- */
- public function rowCount($columns=null)
- {
- $whereClause ='';
- if($columns!=null){
- $whereClause = ' WHERE ';
- $i=false;
- foreach($columns as $column=>$value){
- if($i){$whereClause .=' AND ';}else{$i=true;}
- $whereClause .= '`'.$column.'`="'.$this->secure($value, $column).'"';
- }
- }
- $query = 'SELECT COUNT(1) FROM '.MYSQL_PREFIX.$this->TABLE_NAME.$whereClause;
- if($this->debug)echo ' '.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.' '.mysql_error();
- $myQuery = $this->customQuery($query);
- $number = mysql_fetch_array($myQuery);
- return $number[0];
- }
-
- /**
- * Méthode de suppression d'éléments de l'entité
- * @author Valentin CARRUESCO
- * @category manipulation SQL
- * @param $colonnes (WHERE)
- * @param $valeurs (WHERE)
- * @param $operation="=" definis le type d'operateur pour la requete select
- * @param $debug=false active le debug mode (0 ou 1)
- * @return Aucun retour
- */
- public function delete($columns,$operation='=',$debug=false){
- $whereClause = '';
-
- $i=false;
- foreach($columns as $column=>$value){
- if($i){$whereClause .=' AND ';}else{$i=true;}
- $whereClause .= '`'.$column.'`'.$operation.'"'.$this->secure($value, $column).'"';
- }
- $query = 'DELETE FROM `'.MYSQL_PREFIX.$this->TABLE_NAME.'` WHERE '.$whereClause.' ;';
- if($this->debug)echo ' '.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.' '.mysql_error();
- $this->customQuery($query);
-
- }
-
- ///@TODO: pourquoi deux méthodes différentes qui font la même chose ?
- public function customExecute($request){
- if($this->debugAllQuery)echo ' '.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$request.' '.mysql_error();
- $result = mysql_query($request);
- if (false===$result) {
- throw new Exception(mysql_error());
- }
- return $result;
- }
- public function customQuery($request){
- if($this->debugAllQuery)echo ' '.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$request.' '.mysql_error();
- $result = mysql_query($request);
- if (false===$result) {
- throw new Exception(mysql_error());
- }
- return $result;
- }
-
-
- // ACCESSEURS
- /**
- * Méthode de récuperation de l'attribut debug de l'entité
- * @author Valentin CARRUESCO
- * @category Accesseur
- * @param Aucun
- * @return debug
- */
-
- public function getDebug(){
- return $this->debug;
- }
-
- /**
- * Méthode de définition de l'attribut debug de l'entité
- * @author Valentin CARRUESCO
- * @category Accesseur
- * @param $debug
- */
-
- public function setDebug($debug){
- $this->debug = $debug;
- }
-
- public function getObject_fields(){
- return $this->object_fields;
- }
-
- /**
- * @return VRAI si la table existe, FAUX sinon
- */
-
- public function tableExists() {
- $table = MYSQL_PREFIX.$this->TABLE_NAME;
- $result = $this->customQuery("SHOW TABLES LIKE '$table'");
- $assoc = mysql_fetch_assoc($result);
- return false===$assoc ? false : true;
- }
-}
-?>
diff --git a/sources/Opml.class.php b/sources/Opml.class.php
deleted file mode 100755
index 5741c84..0000000
--- a/sources/Opml.class.php
+++ /dev/null
@@ -1,168 +0,0 @@
-feeds = $feedManager->populate('name');
- $this->folders = $folderManager->loadAll(array('parent'=>-1),'name');
- }
-
- /**
- * Convertit les caractères qui interfèrent avec le XML
- */
- protected function escapeXml($string) {
- /** Les entités sont utiles pour deux raisons : encodage et
- échappement. L'encodage n'est pas un problème, l'application travaille
- nativement avec Unicode. L'échappement dans XML impose d'échapper les
- esperluettes (&) et les guillemets. Ces derniers sont utilisés comme
- séparateur de chaine. Les simples cotes restent intactes.
- * On retire toutes les entités de sorte à obtenir une chaîne totalement
- en UTF-8. Elle peut alors contenir des & et des ", nocifs pour XML.
- * On échappe les caractères & et " de sorte à ce que le contenu dans le
- XML soit correct. On suppose qu'à la lecture, cet échappement est
- annulé.
- * Accessoirement, on remplace les espaces non signifiants par une seule
- espace. C'est le cas des retours chariots physiques, non
- interprétables.
- */
- // Retire toutes les entités, & é etc.
- $string = html_entity_decode($string, ENT_COMPAT, 'UTF-8' );
- // Remet les entités HTML comme & mais ne touche pas aux accents.
- $string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
- // Supprime les blancs non signifiants comme les sauts de ligne.
- $string = preg_replace('/\s+/', ' ', $string);
- return $string;
- }
-
- /**
- * Exporte récursivement les flux.
- */
- protected function exportRecursive($folders, $identLevel=0) {
- $_ = ' ';
- $__ = ''; for($i=0;$i<$identLevel;$i++) $__.=$_;
- $xmlStream = '';
- foreach($folders as $folder) {
- // Pas utilisé, vu qu'il n'y a qu'un seul niveau de dossiers.
- $xmlStream .= $this->exportRecursive(
- $folder->getFolders(), $identLevel+1
- );
- $feeds = $folder->getFeeds();
- if (empty($feeds)) continue;
- $text = $this->escapeXml($folder->getName());
- $xmlStream .= "{$__}\n";
- foreach($feeds as $feed){
- $url = $this->escapeXml($feed->getUrl());
- $website = $this->escapeXml($feed->getWebsite());
- $title = $this->escapeXml($feed->getName());
- $text = $title;
- $description = $this->escapeXml($feed->getDescription());
- $xmlStream .= "{$__}{$_} \n";
- }
- $xmlStream .= "{$__} \n";
- }
- return $xmlStream;
- }
-
- /**
- * Exporte l'ensemble des flux et sort les en-têtes.
- */
- function export() {
- $this->update();
- $date = date('D, d M Y H:i:s O');
- $xmlStream = "
-
-
- Leed export
- Leed
- idleman@idleman.fr
- $date
-
- \n";
- $xmlStream .= $this->exportRecursive($this->folders, 2);
- $xmlStream .= " \n \n";
- return $xmlStream;
- }
-
- protected function importRec($folder, $folderId=1){
- $folderManager = new Folder();
- $feedManager = new Feed();
- foreach($folder as $item) {
- // Cela varie selon les implémentations d'OPML.
- $feedName = $item['text'] ? 'text' : 'title';
- if (isset($item->outline[0])) { // un dossier
- $folder = $folderManager->load(array('name'=>$item[$feedName]));
- $folder = (!$folder?new Folder():$folder);
- $folder->setName($item[$feedName]);
- $folder->setParent(($folderId==1?-1:$folderId));
- $folder->setIsopen(0);
- if($folder->getId()=='') $folder->save();
- $this->importRec($item->outline,$folder->getId());
- } else { // un flux
- $newFeed = $feedManager->load(array('url'=>$item[0]['xmlUrl']));
- $newFeed = (!$newFeed?new Feed():$newFeed);
- if($newFeed->getId()=='') {
- /* Ne télécharge pas à nouveau le même lien, même s'il est
- dans un autre dossier. */
- $newFeed->setName($item[0][$feedName]);
- $newFeed->setUrl($item[0]['xmlUrl']);
- $newFeed->setDescription($item[0]['description']);
- $newFeed->setWebsite($item[0]['htmlUrl']);
- $newFeed->setFolder($folderId);
- $newFeed->save();
- // $newFeed->parse();
- } else {
- $this->alreadyKnowns[]= (object) array(
- 'description' => $newFeed->getDescription(),
- 'feedName' => $newFeed->getName(),
- 'xmlUrl' => $newFeed->getUrl()
- );
- }
- }
- }
- }
-
- /**
- * Importe les flux.
- */
- function import() {
- require_once("SimplePie.class.php");
- $file = $_FILES['newImport']['tmp_name'];
- $internalErrors = libxml_use_internal_errors(true);
- $xml = @simplexml_load_file($file);
- $errorOutput = array();
- foreach (libxml_get_errors() as $error) {
- $errorOutput []= "{$error->message} (line {$error->line})";
- }
- libxml_clear_errors();
- libxml_use_internal_errors($internalErrors);
- if (!empty($xml) && empty($errorOutput)) {
- $this->importRec($xml->body->outline);
- }
- return $errorOutput;
- }
-
-}
-
-?>
diff --git a/sources/Plugin.class.php b/sources/Plugin.class.php
deleted file mode 100755
index b6b7f80..0000000
--- a/sources/Plugin.class.php
+++ /dev/null
@@ -1,350 +0,0 @@
-append(new Translation(dirname($pluginFile)));
- // Inclusion du coeur de plugin
- include $pluginFile;
- // Gestion des css du plugin en fonction du thème actif
- $cssTheme = glob(dirname($pluginFile).'/*/'.DEFAULT_THEME.'.css');
- $cssDefault = glob(dirname($pluginFile).'/*/default.css');
- if(isset($cssTheme[0])){
- $GLOBALS['hooks']['css_files'][] = Functions::relativePath(str_replace('\\','/',dirname(__FILE__)),str_replace('\\','/',$cssTheme[0]));
- }else if(isset($cssDefault[0])){
- $GLOBALS['hooks']['css_files'][] = Functions::relativePath(str_replace('\\','/',dirname(__FILE__)),str_replace('\\','/',$cssDefault[0]));
- }
- }
- }
- $i18n_js = $i18n->getJson();
- }
-
- private static function getStates(){
- $stateFile = dirname(__FILE__).Plugin::FOLDER.'/plugins.states.json';
- if(!file_exists($stateFile)) touch($stateFile);
- return json_decode(file_get_contents($stateFile),true);
- }
- private static function setStates($states){
- $stateFile = dirname(__FILE__).Plugin::FOLDER.'/plugins.states.json';
- file_put_contents($stateFile,json_encode($states));
- }
- public static function pruneStates() {
- $statesBefore = self::getStates();
- if(empty($statesBefore))
- $statesBefore = array();
-
- $statesAfter = array();
- $error = false;
- if (is_array($statesBefore))
- {
- foreach($statesBefore as $file=>$state) {
- if (file_exists($file))
- $statesAfter[$file] = $state;
- else
- $error = true;
- }
- }
- if ($error) self::setStates($statesAfter);
- }
-
-
- private static function getObject($pluginFile){
- $plugin = new Plugin();
- $fileLines = file_get_contents($pluginFile);
-
- if(preg_match("#@author\s(.+)\s\<#", $fileLines, $match))
- $plugin->setAuthor(trim($match[1]));
-
- if(preg_match("#@author\s(.+)\s\<([a-z\@\.A-Z\s\-]+)\>#", $fileLines, $match))
- $plugin->setMail(strtolower($match[2]));
-
- if(preg_match("#@name\s(.+)[\r\n]#", $fileLines, $match))
- $plugin->setName($match[1]);
-
- if(preg_match("#@licence\s(.+)[\r\n]#", $fileLines, $match))
- $plugin->setLicence($match[1]);
-
- if(preg_match("#@version\s(.+)[\r\n]#", $fileLines, $match))
- $plugin->setVersion($match[1]);
-
- if(preg_match("#@link\s(.+)[\r\n]#", $fileLines, $match))
- $plugin->setLink(trim($match[1]));
-
- if(preg_match("#@type\s(.+)[\r\n]#", $fileLines, $match))
- $plugin->setType(trim($match[1]));
-
- if(preg_match("#@description\s(.+)[\r\n]#", $fileLines, $match))
- $plugin->setDescription(trim($match[1]));
-
- if(Plugin::loadState($pluginFile) || $plugin->getType()=='component'){
- $plugin->setState(1);
- }else{
- $plugin->setState(0);
- }
- $plugin->setPath($pluginFile);
- return $plugin;
- }
-
- public static function getAll(){
- $pluginFiles = Plugin::getFiles();
-
- $plugins = array();
- if(is_array($pluginFiles)) {
- foreach($pluginFiles as $pluginFile) {
- $plugin = Plugin::getObject($pluginFile);
- $plugins[]=$plugin;
- }
- }
- usort($plugins, "Plugin::sortPlugin");
- return $plugins;
- }
-
-
-
- public static function addHook($hookName, $functionName) {
- $GLOBALS['hooks'][$hookName][] = $functionName;
- }
-
- public static function addCss($css) {
- $bt = debug_backtrace();
- $pathInfo = explode('/',dirname($bt[0]['file']));
- $count = count($pathInfo);
- $name = $pathInfo[$count-1];
- $path = '.'.Plugin::FOLDER.'/'.$name.$css;
-
- $GLOBALS['hooks']['css_files'][] = $path;
- }
-
- public static function callCss(){
- $return='';
- if(isset($GLOBALS['hooks']['css_files'])) {
- foreach($GLOBALS['hooks']['css_files'] as $css_file) {
- $return .=' '."\n";
- }
- }
- return $return;
- }
-
- public static function addLink($rel, $link) {
- $GLOBALS['hooks']['head_link'][] = array("rel"=>$rel, "link"=>$link);
- }
-
- public static function callLink(){
- $return='';
- if(isset($GLOBALS['hooks']['head_link'])) {
- foreach($GLOBALS['hooks']['head_link'] as $head_link) {
- $return .=' '."\n";
- }
- }
- return $return;
- }
-
- public static function path(){
- $bt = debug_backtrace();
- $pathInfo = explode('/',dirname($bt[0]['file']));
- $count = count($pathInfo);
- $name = $pathInfo[$count-1];
- return '.'.Plugin::FOLDER.'/'.$name.'/';
- }
-
- public static function addJs($js) {
- $bt = debug_backtrace();
- $pathInfo = explode('/',dirname($bt[0]['file']));
- $count = count($pathInfo);
- $name = $pathInfo[$count-1];
- $path = '.'.Plugin::FOLDER.'/'.$name.$js;
-
- $GLOBALS['hooks']['js_files'][] = $path;
- }
-
- public static function callJs(){
- $return='';
- if(isset($GLOBALS['hooks']['js_files'])) {
- foreach($GLOBALS['hooks']['js_files'] as $js_file) {
- $return .=''."\n";
- }
- }
- return $return;
- }
-
- public static function callHook($hookName, $hookArguments) {
- //echo ''.$hookName.'
';
- if(isset($GLOBALS['hooks'][$hookName])) {
- foreach($GLOBALS['hooks'][$hookName] as $functionName) {
- call_user_func_array($functionName, $hookArguments);
- }
- }
- }
-
- public static function getFiles($onlyActivated=false){
-
- $enabled = $disabled = array();
- $files = glob(dirname(__FILE__). Plugin::FOLDER .'/*/*.plugin*.php');
- if(empty($files))
- $files = array();
-
- foreach($files as $file){
- $plugin = Plugin::getObject($file);
- if($plugin->getState()){
- $enabled [] = $file;
- }else{
- $disabled [] = $file;
- }
- }
- if(!$onlyActivated)$enabled = array_merge($enabled,$disabled);
- return $enabled;
- }
-
-
- public static function loadState($plugin){
- $states = Plugin::getStates();
- return (isset($states[$plugin])?$states[$plugin]:false);
- }
-
- public static function changeState($plugin,$state){
- $states = Plugin::getStates();
- $states[$plugin] = $state;
-
- Plugin::setStates($states);
- }
-
-
- public static function enabled($pluginUid){
- $plugins = Plugin::getAll();
-
- foreach($plugins as $plugin){
- if($plugin->getUid()==$pluginUid){
- Plugin::changeState($plugin->getPath(),true);
- $install = dirname($plugin->getPath()).'/install.php';
- if(file_exists($install))require_once($install);
- }
- }
- }
- public static function disabled($pluginUid){
- $plugins = Plugin::getAll();
- foreach($plugins as $plugin){
- if($plugin->getUid()==$pluginUid){
- Plugin::changeState($plugin->getPath(),false);
- $uninstall = dirname($plugin->getPath()).'/uninstall.php';
- if(file_exists($uninstall))require_once($uninstall);
- }
- }
-
- }
-
- function getUid(){
- $pathInfo = explode('/',$this->getPath());
- $count = count($pathInfo);
- $name = $pathInfo[$count-1];
- return $pathInfo[$count -2].'-'.substr($name,0,strpos($name,'.'));
- }
-
-
- static function sortPlugin($a, $b){
- if ($a->getName() == $b->getName())
- return 0;
- return ($a->getName() < $b->getName()) ? -1 : 1;
- }
-
-
-
- function getName(){
- return $this->name;
- }
-
- function setName($name){
- $this->name = $name;
- }
-
- function setAuthor($author){
- $this->author = $author;
- }
-
- function getAuthor(){
- return $this->author;
- }
-
- function getMail(){
- return $this->mail;
- }
-
- function setMail($mail){
- $this->mail = $mail;
- }
-
- function getLicence(){
- return $this->licence;
- }
-
- function setLicence($licence){
- $this->licence = $licence;
- }
-
- function getPath(){
- return $this->path;
- }
-
- function setPath($path){
- $this->path = $path;
- }
-
- function getDescription(){
- return $this->description;
- }
-
- function setDescription($description){
- $this->description = $description;
- }
-
-
- function getLink(){
- return $this->link;
- }
-
- function setLink($link){
- $this->link = $link;
- }
-
- function getVersion(){
- return $this->version;
- }
-
- function setVersion($version){
- $this->version = $version;
- }
-
- function getState(){
- return $this->state;
- }
- function setState($state){
- $this->state = $state;
- }
-
- function getType(){
- return $this->type;
- }
-
- function setType($type){
- $this->type = $type;
- }
-
-}
-
-?>
diff --git a/sources/README.md b/sources/README.md
deleted file mode 100755
index ef13c9c..0000000
--- a/sources/README.md
+++ /dev/null
@@ -1,70 +0,0 @@
-Leed
-====
-
-Leed (contraction de Light Feed) est un agrégateur [RSS](https://fr.wikipedia.org/wiki/Rss)/[ATOM](https://fr.wikipedia.org/wiki/Atom) minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive.
-
-Cet agrégateur peut s'installer sur votre propre serveur et fonctionne avec un système de tâches [cron](https://fr.wikipedia.org/wiki/Cron) afin de traiter les informations de manière transparente et de les afficher le plus rapidement possible lorsque vous vous y connectez.
-
-- Application : Leed (Light Feed)
-- Version : Branche Stable
-- Auteur : Valentin CARRUESCO aka Idleman (idleman@idleman.fr)
-- Page du projet : http://projet.idleman.fr/leed
-- Licence : [CC by-nc-sa](http://creativecommons.org/licenses/by-nc-sa/2.0/fr/)
-
-Toutes les tâches de traitements de flux sont effectuées de manière invisible par une tâche programmée (cron), ainsi, l'utilisateur ne subit pas les lenteurs dues à la récupération et au traitement de chacuns des flux suivis.
-
-A noter que Leed est compatible toutes résolutions, sur pc, tablette et smartphone.
-
-Leed est également compatible avec le format d'import/export [OPML](https://fr.wikipedia.org/wiki/OPML) ce qui le rend compatible avec les agrégateurs respectant ce standard.
-
-Pré-requis
-====
-
-- Serveur Apache conseillé (non testé sur les autres serveurs type Nginx…)
-- PHP 5.3 minimum
-- MySQL
-- Un peu de bon sens :-)
-
-Installation
-====
-
-1. Récupérez le projet sur [idleman.fr](http://projet.idleman.fr/leed/?page=Téléchargement) ou sur la page [github](https://github.com/ldleman/Leed).
-2. Placez le projet dans votre répertoire web et appliquez si nécessaire une permission _chmod 775_ (si vous êtes sur un hebergement ovh, préférez un _0755_ ou vous aurez une erreur 500) sur le dossier et son contenu.
-3. Depuis votre navigateur, accédez à la page d'installation _install.php_ (ex : votre.domaine.fr/leed/install.php) et suivez les instructions.
-4. Une fois l'installation terminée, supprimez le fichier _install.php_ par mesure de sécurité.
-5. [Optionnel] Si vous souhaitez que les mises à jour de flux se fassent automatiquement, mettez en place un cron. Voir ci-après. Il est conseillé de ne pas mettre une fréquence trop rapide pour laisser le temps au script de s'exécuter.
-6. Le script est installé, merci d'avoir choisi Leed, l'agrégateur RSS svelte :p
-
-Tâches programmées avec cron
-====
-
-On peut éditer les tâches programmées avec _crontab -e_. Il y a deux façons de mettre à jour les flux. Les exemples qui suivent mettent à jour toutes les heures.
-
-1. En appelant directement Leed. Cette méthode a l'avantage d'être directe et de produire une sortie formatée pour la console mais requiert un accès local :
-``` crontab
-0 * * * * cd (...)/leed && php action.php >> logs/cron.log 2>&1
-```
-
-1. En appelant Leed depuis le client web _wget_. Cette méthode nécessite un accès réseau mais a l'avantage de pouvoir être déclenchée à distance. Afin de contrôler l'accès, il est nécessaire de fournir le code de synchronisation :
-```
-0 * * * * wget --no-check-certificate --quiet --output-document /var/www/leed/cron.log
-"http://127.0.0.1/leed/action.php?action=synchronize&code=votre_code_synchronisation"
-```
- Si vous n'avez pas accès a la commande _wget_ sur votre serveur, vous pouvez essayer son chemin complet _/usr/bin/wget_.
-
-Foire Aux Questions (F.A.Q.)
-====
-
-Vous pouvez retrouver la FAQ du projet ici : http://projet.idleman.fr/leed/?page=FAQ
-
-Plugins
-====
-Le dépot [Leed market](https://github.com/ldleman/Leed-market) contient tous les plugins à jour et approuvés officiellement pour le logiciel Leed.
-
-Bibliothèques utilisées
-==
-
-- Responsive / Cross browser : Initializr (http://www.initializr.com)
-- Javascript : JQuery (http://www.jquery.com)
-- Moteur template : RainTPL (http://www.raintpl.com)
-- Parseur RSS : SimplePie (http://simplepie.org)
diff --git a/sources/RainTPL.php b/sources/RainTPL.php
deleted file mode 100755
index a66a65a..0000000
--- a/sources/RainTPL.php
+++ /dev/null
@@ -1,1071 +0,0 @@
-), stylesheet ( ), script (";
- }
- }
-
- // Flash Media Player file types.
- // Preferred handler for MP3 file types.
- elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== ''))
- {
- $height += 20;
- if ($native)
- {
- $embed .= "get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"> ";
- }
- else
- {
- $embed .= "";
- }
- }
-
- // QuickTime 7 file types. Need to test with QuickTime 6.
- // Only handle MP3's if the Flash Media Player is not present.
- elseif ($handler === 'quicktime' || ($handler === 'mp3' && $mediaplayer === ''))
- {
- $height += 16;
- if ($native)
- {
- if ($placeholder !== '')
- {
- $embed .= "get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"> ";
- }
- else
- {
- $embed .= "get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"> ";
- }
- }
- else
- {
- $embed .= "";
- }
- }
-
- // Windows Media
- elseif ($handler === 'wmedia')
- {
- $height += 45;
- if ($native)
- {
- $embed .= "get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"> ";
- }
- else
- {
- $embed .= "";
- }
- }
-
- // Everything else
- else $embed .= '' . $alt . ' ';
-
- return $embed;
- }
-
- /**
- * Get the real media type
- *
- * Often, feeds lie to us, necessitating a bit of deeper inspection. This
- * converts types to their canonical representations based on the file
- * extension
- *
- * @see get_type()
- * @param bool $find_handler Internal use only, use {@see get_handler()} instead
- * @return string MIME type
- */
- public function get_real_type($find_handler = false)
- {
- // Mime-types by handler.
- $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
- $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player
- $types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime
- $types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media
- $types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
-
- if ($this->get_type() !== null)
- {
- $type = strtolower($this->type);
- }
- else
- {
- $type = null;
- }
-
- // If we encounter an unsupported mime-type, check the file extension and guess intelligently.
- if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
- {
- switch (strtolower($this->get_extension()))
- {
- // Audio mime-types
- case 'aac':
- case 'adts':
- $type = 'audio/acc';
- break;
-
- case 'aif':
- case 'aifc':
- case 'aiff':
- case 'cdda':
- $type = 'audio/aiff';
- break;
-
- case 'bwf':
- $type = 'audio/wav';
- break;
-
- case 'kar':
- case 'mid':
- case 'midi':
- case 'smf':
- $type = 'audio/midi';
- break;
-
- case 'm4a':
- $type = 'audio/x-m4a';
- break;
-
- case 'mp3':
- case 'swa':
- $type = 'audio/mp3';
- break;
-
- case 'wav':
- $type = 'audio/wav';
- break;
-
- case 'wax':
- $type = 'audio/x-ms-wax';
- break;
-
- case 'wma':
- $type = 'audio/x-ms-wma';
- break;
-
- // Video mime-types
- case '3gp':
- case '3gpp':
- $type = 'video/3gpp';
- break;
-
- case '3g2':
- case '3gp2':
- $type = 'video/3gpp2';
- break;
-
- case 'asf':
- $type = 'video/x-ms-asf';
- break;
-
- case 'flv':
- $type = 'video/x-flv';
- break;
-
- case 'm1a':
- case 'm1s':
- case 'm1v':
- case 'm15':
- case 'm75':
- case 'mp2':
- case 'mpa':
- case 'mpeg':
- case 'mpg':
- case 'mpm':
- case 'mpv':
- $type = 'video/mpeg';
- break;
-
- case 'm4v':
- $type = 'video/x-m4v';
- break;
-
- case 'mov':
- case 'qt':
- $type = 'video/quicktime';
- break;
-
- case 'mp4':
- case 'mpg4':
- $type = 'video/mp4';
- break;
-
- case 'sdv':
- $type = 'video/sd-video';
- break;
-
- case 'wm':
- $type = 'video/x-ms-wm';
- break;
-
- case 'wmv':
- $type = 'video/x-ms-wmv';
- break;
-
- case 'wvx':
- $type = 'video/x-ms-wvx';
- break;
-
- // Flash mime-types
- case 'spl':
- $type = 'application/futuresplash';
- break;
-
- case 'swf':
- $type = 'application/x-shockwave-flash';
- break;
- }
- }
-
- if ($find_handler)
- {
- if (in_array($type, $types_flash))
- {
- return 'flash';
- }
- elseif (in_array($type, $types_fmedia))
- {
- return 'fmedia';
- }
- elseif (in_array($type, $types_quicktime))
- {
- return 'quicktime';
- }
- elseif (in_array($type, $types_wmedia))
- {
- return 'wmedia';
- }
- elseif (in_array($type, $types_mp3))
- {
- return 'mp3';
- }
- else
- {
- return null;
- }
- }
- else
- {
- return $type;
- }
- }
-}
-
-/**
- * Class to validate and to work with IPv6 addresses.
- *
- * @package SimplePie
- * @subpackage HTTP
- * @copyright 2003-2005 The PHP Group
- * @license http://www.opensource.org/licenses/bsd-license.php
- * @link http://pear.php.net/package/Net_IPv6
- * @author Alexander Merz
- * @author elfrink at introweb dot nl
- * @author Josh Peck
- * @author Geoffrey Sneddon
- */
-class SimplePie_Net_IPv6
-{
- /**
- * Uncompresses an IPv6 address
- *
- * RFC 4291 allows you to compress concecutive zero pieces in an address to
- * '::'. This method expects a valid IPv6 address and expands the '::' to
- * the required number of zero pieces.
- *
- * Example: FF01::101 -> FF01:0:0:0:0:0:0:101
- * ::1 -> 0:0:0:0:0:0:0:1
- *
- * @author Alexander Merz
- * @author elfrink at introweb dot nl
- * @author Josh Peck
- * @copyright 2003-2005 The PHP Group
- * @license http://www.opensource.org/licenses/bsd-license.php
- * @param string $ip An IPv6 address
- * @return string The uncompressed IPv6 address
- */
- public static function uncompress($ip)
- {
- $c1 = -1;
- $c2 = -1;
- if (substr_count($ip, '::') === 1)
- {
- list($ip1, $ip2) = explode('::', $ip);
- if ($ip1 === '')
- {
- $c1 = -1;
- }
- else
- {
- $c1 = substr_count($ip1, ':');
- }
- if ($ip2 === '')
- {
- $c2 = -1;
- }
- else
- {
- $c2 = substr_count($ip2, ':');
- }
- if (strpos($ip2, '.') !== false)
- {
- $c2++;
- }
- // ::
- if ($c1 === -1 && $c2 === -1)
- {
- $ip = '0:0:0:0:0:0:0:0';
- }
- // ::xxx
- else if ($c1 === -1)
- {
- $fill = str_repeat('0:', 7 - $c2);
- $ip = str_replace('::', $fill, $ip);
- }
- // xxx::
- else if ($c2 === -1)
- {
- $fill = str_repeat(':0', 7 - $c1);
- $ip = str_replace('::', $fill, $ip);
- }
- // xxx::xxx
- else
- {
- $fill = ':' . str_repeat('0:', 6 - $c2 - $c1);
- $ip = str_replace('::', $fill, $ip);
- }
- }
- return $ip;
- }
-
- /**
- * Compresses an IPv6 address
- *
- * RFC 4291 allows you to compress concecutive zero pieces in an address to
- * '::'. This method expects a valid IPv6 address and compresses consecutive
- * zero pieces to '::'.
- *
- * Example: FF01:0:0:0:0:0:0:101 -> FF01::101
- * 0:0:0:0:0:0:0:1 -> ::1
- *
- * @see uncompress()
- * @param string $ip An IPv6 address
- * @return string The compressed IPv6 address
- */
- public static function compress($ip)
- {
- // Prepare the IP to be compressed
- $ip = self::uncompress($ip);
- $ip_parts = self::split_v6_v4($ip);
-
- // Replace all leading zeros
- $ip_parts[0] = preg_replace('/(^|:)0+([0-9])/', '\1\2', $ip_parts[0]);
-
- // Find bunches of zeros
- if (preg_match_all('/(?:^|:)(?:0(?::|$))+/', $ip_parts[0], $matches, PREG_OFFSET_CAPTURE))
- {
- $max = 0;
- $pos = null;
- foreach ($matches[0] as $match)
- {
- if (strlen($match[0]) > $max)
- {
- $max = strlen($match[0]);
- $pos = $match[1];
- }
- }
-
- $ip_parts[0] = substr_replace($ip_parts[0], '::', $pos, $max);
- }
-
- if ($ip_parts[1] !== '')
- {
- return implode(':', $ip_parts);
- }
- else
- {
- return $ip_parts[0];
- }
- }
-
- /**
- * Splits an IPv6 address into the IPv6 and IPv4 representation parts
- *
- * RFC 4291 allows you to represent the last two parts of an IPv6 address
- * using the standard IPv4 representation
- *
- * Example: 0:0:0:0:0:0:13.1.68.3
- * 0:0:0:0:0:FFFF:129.144.52.38
- *
- * @param string $ip An IPv6 address
- * @return array [0] contains the IPv6 represented part, and [1] the IPv4 represented part
- */
- private static function split_v6_v4($ip)
- {
- if (strpos($ip, '.') !== false)
- {
- $pos = strrpos($ip, ':');
- $ipv6_part = substr($ip, 0, $pos);
- $ipv4_part = substr($ip, $pos + 1);
- return array($ipv6_part, $ipv4_part);
- }
- else
- {
- return array($ip, '');
- }
- }
-
- /**
- * Checks an IPv6 address
- *
- * Checks if the given IP is a valid IPv6 address
- *
- * @param string $ip An IPv6 address
- * @return bool true if $ip is a valid IPv6 address
- */
- public static function check_ipv6($ip)
- {
- $ip = self::uncompress($ip);
- list($ipv6, $ipv4) = self::split_v6_v4($ip);
- $ipv6 = explode(':', $ipv6);
- $ipv4 = explode('.', $ipv4);
- if (count($ipv6) === 8 && count($ipv4) === 1 || count($ipv6) === 6 && count($ipv4) === 4)
- {
- foreach ($ipv6 as $ipv6_part)
- {
- // The section can't be empty
- if ($ipv6_part === '')
- return false;
-
- // Nor can it be over four characters
- if (strlen($ipv6_part) > 4)
- return false;
-
- // Remove leading zeros (this is safe because of the above)
- $ipv6_part = ltrim($ipv6_part, '0');
- if ($ipv6_part === '')
- $ipv6_part = '0';
-
- // Check the value is valid
- $value = hexdec($ipv6_part);
- if (dechex($value) !== strtolower($ipv6_part) || $value < 0 || $value > 0xFFFF)
- return false;
- }
- if (count($ipv4) === 4)
- {
- foreach ($ipv4 as $ipv4_part)
- {
- $value = (int) $ipv4_part;
- if ((string) $value !== $ipv4_part || $value < 0 || $value > 0xFF)
- return false;
- }
- }
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Checks if the given IP is a valid IPv6 address
- *
- * @codeCoverageIgnore
- * @deprecated Use {@see SimplePie_Net_IPv6::check_ipv6()} instead
- * @see check_ipv6
- * @param string $ip An IPv6 address
- * @return bool true if $ip is a valid IPv6 address
- */
- public static function checkIPv6($ip)
- {
- return self::check_ipv6($ip);
- }
-}
-
-/**
- * Parses XML into something sane
- *
- *
- * This class can be overloaded with {@see SimplePie::set_parser_class()}
- *
- * @package SimplePie
- * @subpackage Parsing
- */
-class SimplePie_Parser
-{
- var $error_code;
- var $error_string;
- var $current_line;
- var $current_column;
- var $current_byte;
- var $separator = ' ';
- var $namespace = array('');
- var $element = array('');
- var $xml_base = array('');
- var $xml_base_explicit = array(false);
- var $xml_lang = array('');
- var $data = array();
- var $datas = array(array());
- var $current_xhtml_construct = -1;
- var $encoding;
- protected $registry;
-
- public function set_registry(SimplePie_Registry $registry)
- {
- $this->registry = $registry;
- }
-
- public function parse(&$data, $encoding)
- {
- $xmlEncoding = ''; //Update for Leed
- if (!empty($encoding)) //Update for Leed (ajout de la condition. si vrai, on prend le standard SimplePie)
- {
- // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character
- if (strtoupper($encoding) === 'US-ASCII')
- {
- $this->encoding = 'UTF-8';
- }
- else
- {
- $this->encoding = $encoding;
- }
-
- // Strip BOM:
- // UTF-32 Big Endian BOM
- if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
- {
- $data = substr($data, 4);
- }
- // UTF-32 Little Endian BOM
- elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
- {
- $data = substr($data, 4);
- }
- // UTF-16 Big Endian BOM
- elseif (substr($data, 0, 2) === "\xFE\xFF")
- {
- $data = substr($data, 2);
- }
- // UTF-16 Little Endian BOM
- elseif (substr($data, 0, 2) === "\xFF\xFE")
- {
- $data = substr($data, 2);
- }
- // UTF-8 BOM
- elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
- {
- $data = substr($data, 3);
- }
-
- if (substr($data, 0, 5) === '')) !== false)
- {
- $declaration = $this->registry->create('XML_Declaration_Parser', array(substr($data, 5, $pos - 5)));
- if ($declaration->parse())
- {
- $xmlEncoding = strtoupper($declaration->encoding); //Update for Leed
- $data = substr($data, $pos + 2);
- $data = 'version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data;
- }
- else
- {
- $this->error_string = 'SimplePie bug! Please report this!';
- return false;
- }
- }
- }
-
- if ($xmlEncoding === '' || $xmlEncoding === 'UTF-8') // Update for Leed by FreshRSS: case of no explicit HTTP encoding, and lax UTF-8
- {
- try
- {
- $dom = new DOMDocument();
- $dom->recover = true;
- $dom->strictErrorChecking = false;
- ini_set('display_errors','0');
- $dom->loadXml($data);
- ini_set('display_errors','1');
- $this->encoding = $encoding = $dom->encoding = 'UTF-8';
- $data2 = $dom->saveXML();
- if (function_exists('mb_convert_encoding'))
- {
- $data2 = mb_convert_encoding($data2, 'UTF-8', 'UTF-8');
- }
- if (strlen($data2) > (strlen($data) / 2.0))
- {
- $data = $data2;
- }
- unset($data2);
- }
- catch (Exception $e)
- {
- }
- } // fin Update for Leed
-
- $return = true;
-
- static $xml_is_sane = null;
- if ($xml_is_sane === null)
- {
- $parser_check = xml_parser_create();
- xml_parse_into_struct($parser_check, '& ', $values);
- xml_parser_free($parser_check);
- $xml_is_sane = isset($values[0]['value']);
- }
-
- // Create the parser
- if ($xml_is_sane)
- {
- $xml = xml_parser_create_ns($this->encoding, $this->separator);
- xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
- xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
- xml_set_object($xml, $this);
- xml_set_character_data_handler($xml, 'cdata');
- xml_set_element_handler($xml, 'tag_open', 'tag_close');
-
- // Parse!
- if (!xml_parse($xml, $data, true))
- {
- $this->error_code = xml_get_error_code($xml);
- $this->error_string = xml_error_string($this->error_code);
- $return = false;
- }
- $this->current_line = xml_get_current_line_number($xml);
- $this->current_column = xml_get_current_column_number($xml);
- $this->current_byte = xml_get_current_byte_index($xml);
- xml_parser_free($xml);
- return $return;
- }
- else
- {
- libxml_clear_errors();
- $xml = new XMLReader();
- $xml->xml($data);
- while (@$xml->read())
- {
- switch ($xml->nodeType)
- {
-
- case constant('XMLReader::END_ELEMENT'):
- if ($xml->namespaceURI !== '')
- {
- $tagName = $xml->namespaceURI . $this->separator . $xml->localName;
- }
- else
- {
- $tagName = $xml->localName;
- }
- $this->tag_close(null, $tagName);
- break;
- case constant('XMLReader::ELEMENT'):
- $empty = $xml->isEmptyElement;
- if ($xml->namespaceURI !== '')
- {
- $tagName = $xml->namespaceURI . $this->separator . $xml->localName;
- }
- else
- {
- $tagName = $xml->localName;
- }
- $attributes = array();
- while ($xml->moveToNextAttribute())
- {
- if ($xml->namespaceURI !== '')
- {
- $attrName = $xml->namespaceURI . $this->separator . $xml->localName;
- }
- else
- {
- $attrName = $xml->localName;
- }
- $attributes[$attrName] = $xml->value;
- }
- $this->tag_open(null, $tagName, $attributes);
- if ($empty)
- {
- $this->tag_close(null, $tagName);
- }
- break;
- case constant('XMLReader::TEXT'):
-
- case constant('XMLReader::CDATA'):
- $this->cdata(null, $xml->value);
- break;
- }
- }
- if ($error = libxml_get_last_error())
- {
- $this->error_code = $error->code;
- $this->error_string = $error->message;
- $this->current_line = $error->line;
- $this->current_column = $error->column;
- return false;
- }
- else
- {
- return true;
- }
- }
- }
-
- public function get_error_code()
- {
- return $this->error_code;
- }
-
- public function get_error_string()
- {
- return $this->error_string;
- }
-
- public function get_current_line()
- {
- return $this->current_line;
- }
-
- public function get_current_column()
- {
- return $this->current_column;
- }
-
- public function get_current_byte()
- {
- return $this->current_byte;
- }
-
- public function get_data()
- {
- return $this->data;
- }
-
- public function tag_open($parser, $tag, $attributes)
- {
- list($this->namespace[], $this->element[]) = $this->split_ns($tag);
-
- $attribs = array();
- foreach ($attributes as $name => $value)
- {
- list($attrib_namespace, $attribute) = $this->split_ns($name);
- $attribs[$attrib_namespace][$attribute] = $value;
- }
-
- if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['base']))
- {
- $base = $this->registry->call('Misc', 'absolutize_url', array($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base)));
- if ($base !== false)
- {
- $this->xml_base[] = $base;
- $this->xml_base_explicit[] = true;
- }
- }
- else
- {
- $this->xml_base[] = end($this->xml_base);
- $this->xml_base_explicit[] = end($this->xml_base_explicit);
- }
-
- if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['lang']))
- {
- $this->xml_lang[] = $attribs[SIMPLEPIE_NAMESPACE_XML]['lang'];
- }
- else
- {
- $this->xml_lang[] = end($this->xml_lang);
- }
-
- if ($this->current_xhtml_construct >= 0)
- {
- $this->current_xhtml_construct++;
- if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML)
- {
- $this->data['data'] .= '<' . end($this->element);
- if (isset($attribs['']))
- {
- foreach ($attribs[''] as $name => $value)
- {
- $this->data['data'] .= ' ' . $name . '="' . htmlspecialchars($value, ENT_COMPAT, $this->encoding) . '"';
- }
- }
- $this->data['data'] .= '>';
- }
- }
- else
- {
- $this->datas[] =& $this->data;
- $this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
- $this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang));
- if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml')
- || (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml')
- || (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_20 && in_array(end($this->element), array('title')))
- || (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_090 && in_array(end($this->element), array('title')))
- || (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_10 && in_array(end($this->element), array('title'))))
- {
- $this->current_xhtml_construct = 0;
- }
- }
- }
-
- public function cdata($parser, $cdata)
- {
- if ($this->current_xhtml_construct >= 0)
- {
- $this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding);
- }
- else
- {
- $this->data['data'] .= $cdata;
- }
- }
-
- public function tag_close($parser, $tag)
- {
- if ($this->current_xhtml_construct >= 0)
- {
- $this->current_xhtml_construct--;
- if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param')))
- {
- $this->data['data'] .= '' . end($this->element) . '>';
- }
- }
- if ($this->current_xhtml_construct === -1)
- {
- $this->data =& $this->datas[count($this->datas) - 1];
- array_pop($this->datas);
- }
-
- array_pop($this->element);
- array_pop($this->namespace);
- array_pop($this->xml_base);
- array_pop($this->xml_base_explicit);
- array_pop($this->xml_lang);
- }
-
- public function split_ns($string)
- {
- static $cache = array();
- if (!isset($cache[$string]))
- {
- if ($pos = strpos($string, $this->separator))
- {
- static $separator_length;
- if (!$separator_length)
- {
- $separator_length = strlen($this->separator);
- }
- $namespace = substr($string, 0, $pos);
- $local_name = substr($string, $pos + $separator_length);
- if (strtolower($namespace) === SIMPLEPIE_NAMESPACE_ITUNES)
- {
- $namespace = SIMPLEPIE_NAMESPACE_ITUNES;
- }
-
- // Normalize the Media RSS namespaces
- if ($namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG ||
- $namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG2 ||
- $namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG3 ||
- $namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG4 ||
- $namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5 )
- {
- $namespace = SIMPLEPIE_NAMESPACE_MEDIARSS;
- }
- $cache[$string] = array($namespace, $local_name);
- }
- else
- {
- $cache[$string] = array('', $string);
- }
- }
- return $cache[$string];
- }
-}
-
-/**
- * IRI parser/serialiser/normaliser
- *
- * @package SimplePie
- * @subpackage HTTP
- * @author Geoffrey Sneddon
- * @author Steve Minutillo
- * @author Ryan McCue
- * @copyright 2007-2012 Geoffrey Sneddon, Steve Minutillo, Ryan McCue
- * @license http://www.opensource.org/licenses/bsd-license.php
- */
-class SimplePie_IRI
-{
- /**
- * Scheme
- *
- * @var string
- */
- protected $scheme = null;
-
- /**
- * User Information
- *
- * @var string
- */
- protected $iuserinfo = null;
-
- /**
- * ihost
- *
- * @var string
- */
- protected $ihost = null;
-
- /**
- * Port
- *
- * @var string
- */
- protected $port = null;
-
- /**
- * ipath
- *
- * @var string
- */
- protected $ipath = '';
-
- /**
- * iquery
- *
- * @var string
- */
- protected $iquery = null;
-
- /**
- * ifragment
- *
- * @var string
- */
- protected $ifragment = null;
-
- /**
- * Normalization database
- *
- * Each key is the scheme, each value is an array with each key as the IRI
- * part and value as the default value for that part.
- */
- protected $normalization = array(
- 'acap' => array(
- 'port' => 674
- ),
- 'dict' => array(
- 'port' => 2628
- ),
- 'file' => array(
- 'ihost' => 'localhost'
- ),
- 'http' => array(
- 'port' => 80,
- 'ipath' => '/'
- ),
- 'https' => array(
- 'port' => 443,
- 'ipath' => '/'
- ),
- );
-
- /**
- * Return the entire IRI when you try and read the object as a string
- *
- * @return string
- */
- public function __toString()
- {
- return $this->get_iri();
- }
-
- /**
- * Overload __set() to provide access via properties
- *
- * @param string $name Property name
- * @param mixed $value Property value
- */
- public function __set($name, $value)
- {
- if (method_exists($this, 'set_' . $name))
- {
- call_user_func(array($this, 'set_' . $name), $value);
- }
- elseif (
- $name === 'iauthority'
- || $name === 'iuserinfo'
- || $name === 'ihost'
- || $name === 'ipath'
- || $name === 'iquery'
- || $name === 'ifragment'
- )
- {
- call_user_func(array($this, 'set_' . substr($name, 1)), $value);
- }
- }
-
- /**
- * Overload __get() to provide access via properties
- *
- * @param string $name Property name
- * @return mixed
- */
- public function __get($name)
- {
- // isset() returns false for null, we don't want to do that
- // Also why we use array_key_exists below instead of isset()
- $props = get_object_vars($this);
-
- if (
- $name === 'iri' ||
- $name === 'uri' ||
- $name === 'iauthority' ||
- $name === 'authority'
- )
- {
- $return = $this->{"get_$name"}();
- }
- elseif (array_key_exists($name, $props))
- {
- $return = $this->$name;
- }
- // host -> ihost
- elseif (($prop = 'i' . $name) && array_key_exists($prop, $props))
- {
- $name = $prop;
- $return = $this->$prop;
- }
- // ischeme -> scheme
- elseif (($prop = substr($name, 1)) && array_key_exists($prop, $props))
- {
- $name = $prop;
- $return = $this->$prop;
- }
- else
- {
- trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE);
- $return = null;
- }
-
- if ($return === null && isset($this->normalization[$this->scheme][$name]))
- {
- return $this->normalization[$this->scheme][$name];
- }
- else
- {
- return $return;
- }
- }
-
- /**
- * Overload __isset() to provide access via properties
- *
- * @param string $name Property name
- * @return bool
- */
- public function __isset($name)
- {
- if (method_exists($this, 'get_' . $name) || isset($this->$name))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Overload __unset() to provide access via properties
- *
- * @param string $name Property name
- */
- public function __unset($name)
- {
- if (method_exists($this, 'set_' . $name))
- {
- call_user_func(array($this, 'set_' . $name), '');
- }
- }
-
- /**
- * Create a new IRI object, from a specified string
- *
- * @param string $iri
- */
- public function __construct($iri = null)
- {
- $this->set_iri($iri);
- }
-
- /**
- * Create a new IRI object by resolving a relative IRI
- *
- * Returns false if $base is not absolute, otherwise an IRI.
- *
- * @param IRI|string $base (Absolute) Base IRI
- * @param IRI|string $relative Relative IRI
- * @return IRI|false
- */
- public static function absolutize($base, $relative)
- {
- if (!($relative instanceof SimplePie_IRI))
- {
- $relative = new SimplePie_IRI($relative);
- }
- if (!$relative->is_valid())
- {
- return false;
- }
- elseif ($relative->scheme !== null)
- {
- return clone $relative;
- }
- else
- {
- if (!($base instanceof SimplePie_IRI))
- {
- $base = new SimplePie_IRI($base);
- }
- if ($base->scheme !== null && $base->is_valid())
- {
- if ($relative->get_iri() !== '')
- {
- if ($relative->iuserinfo !== null || $relative->ihost !== null || $relative->port !== null)
- {
- $target = clone $relative;
- $target->scheme = $base->scheme;
- }
- else
- {
- $target = new SimplePie_IRI;
- $target->scheme = $base->scheme;
- $target->iuserinfo = $base->iuserinfo;
- $target->ihost = $base->ihost;
- $target->port = $base->port;
- if ($relative->ipath !== '')
- {
- if ($relative->ipath[0] === '/')
- {
- $target->ipath = $relative->ipath;
- }
- elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '')
- {
- $target->ipath = '/' . $relative->ipath;
- }
- elseif (($last_segment = strrpos($base->ipath, '/')) !== false)
- {
- $target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
- }
- else
- {
- $target->ipath = $relative->ipath;
- }
- $target->ipath = $target->remove_dot_segments($target->ipath);
- $target->iquery = $relative->iquery;
- }
- else
- {
- $target->ipath = $base->ipath;
- if ($relative->iquery !== null)
- {
- $target->iquery = $relative->iquery;
- }
- elseif ($base->iquery !== null)
- {
- $target->iquery = $base->iquery;
- }
- }
- $target->ifragment = $relative->ifragment;
- }
- }
- else
- {
- $target = clone $base;
- $target->ifragment = null;
- }
- $target->scheme_normalization();
- return $target;
- }
- else
- {
- return false;
- }
- }
- }
-
- /**
- * Parse an IRI into scheme/authority/path/query/fragment segments
- *
- * @param string $iri
- * @return array
- */
- protected function parse_iri($iri)
- {
- $iri = trim($iri, "\x20\x09\x0A\x0C\x0D");
- if (preg_match('/^((?P[^:\/?#]+):)?(\/\/(?P[^\/?#]*))?(?P[^?#]*)(\?(?P[^#]*))?(#(?P.*))?$/', $iri, $match))
- {
- if ($match[1] === '')
- {
- $match['scheme'] = null;
- }
- if (!isset($match[3]) || $match[3] === '')
- {
- $match['authority'] = null;
- }
- if (!isset($match[5]))
- {
- $match['path'] = '';
- }
- if (!isset($match[6]) || $match[6] === '')
- {
- $match['query'] = null;
- }
- if (!isset($match[8]) || $match[8] === '')
- {
- $match['fragment'] = null;
- }
- return $match;
- }
- else
- {
- // This can occur when a paragraph is accidentally parsed as a URI
- return false;
- }
- }
-
- /**
- * Remove dot segments from a path
- *
- * @param string $input
- * @return string
- */
- protected function remove_dot_segments($input)
- {
- $output = '';
- while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
- {
- // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
- if (strpos($input, '../') === 0)
- {
- $input = substr($input, 3);
- }
- elseif (strpos($input, './') === 0)
- {
- $input = substr($input, 2);
- }
- // B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise,
- elseif (strpos($input, '/./') === 0)
- {
- $input = substr($input, 2);
- }
- elseif ($input === '/.')
- {
- $input = '/';
- }
- // C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise,
- elseif (strpos($input, '/../') === 0)
- {
- $input = substr($input, 3);
- $output = substr_replace($output, '', strrpos($output, '/'));
- }
- elseif ($input === '/..')
- {
- $input = '/';
- $output = substr_replace($output, '', strrpos($output, '/'));
- }
- // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
- elseif ($input === '.' || $input === '..')
- {
- $input = '';
- }
- // E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer
- elseif (($pos = strpos($input, '/', 1)) !== false)
- {
- $output .= substr($input, 0, $pos);
- $input = substr_replace($input, '', 0, $pos);
- }
- else
- {
- $output .= $input;
- $input = '';
- }
- }
- return $output . $input;
- }
-
- /**
- * Replace invalid character with percent encoding
- *
- * @param string $string Input string
- * @param string $extra_chars Valid characters not in iunreserved or
- * iprivate (this is ASCII-only)
- * @param bool $iprivate Allow iprivate
- * @return string
- */
- protected function replace_invalid_with_pct_encoding($string, $extra_chars, $iprivate = false)
- {
- // Normalize as many pct-encoded sections as possible
- $string = preg_replace_callback('/(?:%[A-Fa-f0-9]{2})+/', array($this, 'remove_iunreserved_percent_encoded'), $string);
-
- // Replace invalid percent characters
- $string = preg_replace('/%(?![A-Fa-f0-9]{2})/', '%25', $string);
-
- // Add unreserved and % to $extra_chars (the latter is safe because all
- // pct-encoded sections are now valid).
- $extra_chars .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~%';
-
- // Now replace any bytes that aren't allowed with their pct-encoded versions
- $position = 0;
- $strlen = strlen($string);
- while (($position += strspn($string, $extra_chars, $position)) < $strlen)
- {
- $value = ord($string[$position]);
-
- // Start position
- $start = $position;
-
- // By default we are valid
- $valid = true;
-
- // No one byte sequences are valid due to the while.
- // Two byte sequence:
- if (($value & 0xE0) === 0xC0)
- {
- $character = ($value & 0x1F) << 6;
- $length = 2;
- $remaining = 1;
- }
- // Three byte sequence:
- elseif (($value & 0xF0) === 0xE0)
- {
- $character = ($value & 0x0F) << 12;
- $length = 3;
- $remaining = 2;
- }
- // Four byte sequence:
- elseif (($value & 0xF8) === 0xF0)
- {
- $character = ($value & 0x07) << 18;
- $length = 4;
- $remaining = 3;
- }
- // Invalid byte:
- else
- {
- $valid = false;
- $length = 1;
- $remaining = 0;
- }
-
- if ($remaining)
- {
- if ($position + $length <= $strlen)
- {
- for ($position++; $remaining; $position++)
- {
- $value = ord($string[$position]);
-
- // Check that the byte is valid, then add it to the character:
- if (($value & 0xC0) === 0x80)
- {
- $character |= ($value & 0x3F) << (--$remaining * 6);
- }
- // If it is invalid, count the sequence as invalid and reprocess the current byte:
- else
- {
- $valid = false;
- $position--;
- break;
- }
- }
- }
- else
- {
- $position = $strlen - 1;
- $valid = false;
- }
- }
-
- // Percent encode anything invalid or not in ucschar
- if (
- // Invalid sequences
- !$valid
- // Non-shortest form sequences are invalid
- || $length > 1 && $character <= 0x7F
- || $length > 2 && $character <= 0x7FF
- || $length > 3 && $character <= 0xFFFF
- // Outside of range of ucschar codepoints
- // Noncharacters
- || ($character & 0xFFFE) === 0xFFFE
- || $character >= 0xFDD0 && $character <= 0xFDEF
- || (
- // Everything else not in ucschar
- $character > 0xD7FF && $character < 0xF900
- || $character < 0xA0
- || $character > 0xEFFFD
- )
- && (
- // Everything not in iprivate, if it applies
- !$iprivate
- || $character < 0xE000
- || $character > 0x10FFFD
- )
- )
- {
- // If we were a character, pretend we weren't, but rather an error.
- if ($valid)
- $position--;
-
- for ($j = $start; $j <= $position; $j++)
- {
- $string = substr_replace($string, sprintf('%%%02X', ord($string[$j])), $j, 1);
- $j += 2;
- $position += 2;
- $strlen += 2;
- }
- }
- }
-
- return $string;
- }
-
- /**
- * Callback function for preg_replace_callback.
- *
- * Removes sequences of percent encoded bytes that represent UTF-8
- * encoded characters in iunreserved
- *
- * @param array $match PCRE match
- * @return string Replacement
- */
- protected function remove_iunreserved_percent_encoded($match)
- {
- // As we just have valid percent encoded sequences we can just explode
- // and ignore the first member of the returned array (an empty string).
- $bytes = explode('%', $match[0]);
-
- // Initialize the new string (this is what will be returned) and that
- // there are no bytes remaining in the current sequence (unsurprising
- // at the first byte!).
- $string = '';
- $remaining = 0;
-
- // Loop over each and every byte, and set $value to its value
- for ($i = 1, $len = count($bytes); $i < $len; $i++)
- {
- $value = hexdec($bytes[$i]);
-
- // If we're the first byte of sequence:
- if (!$remaining)
- {
- // Start position
- $start = $i;
-
- // By default we are valid
- $valid = true;
-
- // One byte sequence:
- if ($value <= 0x7F)
- {
- $character = $value;
- $length = 1;
- }
- // Two byte sequence:
- elseif (($value & 0xE0) === 0xC0)
- {
- $character = ($value & 0x1F) << 6;
- $length = 2;
- $remaining = 1;
- }
- // Three byte sequence:
- elseif (($value & 0xF0) === 0xE0)
- {
- $character = ($value & 0x0F) << 12;
- $length = 3;
- $remaining = 2;
- }
- // Four byte sequence:
- elseif (($value & 0xF8) === 0xF0)
- {
- $character = ($value & 0x07) << 18;
- $length = 4;
- $remaining = 3;
- }
- // Invalid byte:
- else
- {
- $valid = false;
- $remaining = 0;
- }
- }
- // Continuation byte:
- else
- {
- // Check that the byte is valid, then add it to the character:
- if (($value & 0xC0) === 0x80)
- {
- $remaining--;
- $character |= ($value & 0x3F) << ($remaining * 6);
- }
- // If it is invalid, count the sequence as invalid and reprocess the current byte as the start of a sequence:
- else
- {
- $valid = false;
- $remaining = 0;
- $i--;
- }
- }
-
- // If we've reached the end of the current byte sequence, append it to Unicode::$data
- if (!$remaining)
- {
- // Percent encode anything invalid or not in iunreserved
- if (
- // Invalid sequences
- !$valid
- // Non-shortest form sequences are invalid
- || $length > 1 && $character <= 0x7F
- || $length > 2 && $character <= 0x7FF
- || $length > 3 && $character <= 0xFFFF
- // Outside of range of iunreserved codepoints
- || $character < 0x2D
- || $character > 0xEFFFD
- // Noncharacters
- || ($character & 0xFFFE) === 0xFFFE
- || $character >= 0xFDD0 && $character <= 0xFDEF
- // Everything else not in iunreserved (this is all BMP)
- || $character === 0x2F
- || $character > 0x39 && $character < 0x41
- || $character > 0x5A && $character < 0x61
- || $character > 0x7A && $character < 0x7E
- || $character > 0x7E && $character < 0xA0
- || $character > 0xD7FF && $character < 0xF900
- )
- {
- for ($j = $start; $j <= $i; $j++)
- {
- $string .= '%' . strtoupper($bytes[$j]);
- }
- }
- else
- {
- for ($j = $start; $j <= $i; $j++)
- {
- $string .= chr(hexdec($bytes[$j]));
- }
- }
- }
- }
-
- // If we have any bytes left over they are invalid (i.e., we are
- // mid-way through a multi-byte sequence)
- if ($remaining)
- {
- for ($j = $start; $j < $len; $j++)
- {
- $string .= '%' . strtoupper($bytes[$j]);
- }
- }
-
- return $string;
- }
-
- protected function scheme_normalization()
- {
- if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo'])
- {
- $this->iuserinfo = null;
- }
- if (isset($this->normalization[$this->scheme]['ihost']) && $this->ihost === $this->normalization[$this->scheme]['ihost'])
- {
- $this->ihost = null;
- }
- if (isset($this->normalization[$this->scheme]['port']) && $this->port === $this->normalization[$this->scheme]['port'])
- {
- $this->port = null;
- }
- if (isset($this->normalization[$this->scheme]['ipath']) && $this->ipath === $this->normalization[$this->scheme]['ipath'])
- {
- $this->ipath = '';
- }
- if (isset($this->normalization[$this->scheme]['iquery']) && $this->iquery === $this->normalization[$this->scheme]['iquery'])
- {
- $this->iquery = null;
- }
- if (isset($this->normalization[$this->scheme]['ifragment']) && $this->ifragment === $this->normalization[$this->scheme]['ifragment'])
- {
- $this->ifragment = null;
- }
- }
-
- /**
- * Check if the object represents a valid IRI. This needs to be done on each
- * call as some things change depending on another part of the IRI.
- *
- * @return bool
- */
- public function is_valid()
- {
- $isauthority = $this->iuserinfo !== null || $this->ihost !== null || $this->port !== null;
- if ($this->ipath !== '' &&
- (
- $isauthority && (
- $this->ipath[0] !== '/' ||
- substr($this->ipath, 0, 2) === '//'
- ) ||
- (
- $this->scheme === null &&
- !$isauthority &&
- strpos($this->ipath, ':') !== false &&
- (strpos($this->ipath, '/') === false ? true : strpos($this->ipath, ':') < strpos($this->ipath, '/'))
- )
- )
- )
- {
- return false;
- }
-
- return true;
- }
-
- /**
- * Set the entire IRI. Returns true on success, false on failure (if there
- * are any invalid characters).
- *
- * @param string $iri
- * @return bool
- */
- public function set_iri($iri)
- {
- static $cache;
- if (!$cache)
- {
- $cache = array();
- }
-
- if ($iri === null)
- {
- return true;
- }
- elseif (isset($cache[$iri]))
- {
- list($this->scheme,
- $this->iuserinfo,
- $this->ihost,
- $this->port,
- $this->ipath,
- $this->iquery,
- $this->ifragment,
- $return) = $cache[$iri];
- return $return;
- }
- else
- {
- $parsed = $this->parse_iri((string) $iri);
- if (!$parsed)
- {
- return false;
- }
-
- $return = $this->set_scheme($parsed['scheme'])
- && $this->set_authority($parsed['authority'])
- && $this->set_path($parsed['path'])
- && $this->set_query($parsed['query'])
- && $this->set_fragment($parsed['fragment']);
-
- $cache[$iri] = array($this->scheme,
- $this->iuserinfo,
- $this->ihost,
- $this->port,
- $this->ipath,
- $this->iquery,
- $this->ifragment,
- $return);
- return $return;
- }
- }
-
- /**
- * Set the scheme. Returns true on success, false on failure (if there are
- * any invalid characters).
- *
- * @param string $scheme
- * @return bool
- */
- public function set_scheme($scheme)
- {
- if ($scheme === null)
- {
- $this->scheme = null;
- }
- elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme))
- {
- $this->scheme = null;
- return false;
- }
- else
- {
- $this->scheme = strtolower($scheme);
- }
- return true;
- }
-
- /**
- * Set the authority. Returns true on success, false on failure (if there are
- * any invalid characters).
- *
- * @param string $authority
- * @return bool
- */
- public function set_authority($authority)
- {
- static $cache;
- if (!$cache)
- $cache = array();
-
- if ($authority === null)
- {
- $this->iuserinfo = null;
- $this->ihost = null;
- $this->port = null;
- return true;
- }
- elseif (isset($cache[$authority]))
- {
- list($this->iuserinfo,
- $this->ihost,
- $this->port,
- $return) = $cache[$authority];
-
- return $return;
- }
- else
- {
- $remaining = $authority;
- if (($iuserinfo_end = strrpos($remaining, '@')) !== false)
- {
- $iuserinfo = substr($remaining, 0, $iuserinfo_end);
- $remaining = substr($remaining, $iuserinfo_end + 1);
- }
- else
- {
- $iuserinfo = null;
- }
- if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false)
- {
- if (($port = substr($remaining, $port_start + 1)) === false)
- {
- $port = null;
- }
- $remaining = substr($remaining, 0, $port_start);
- }
- else
- {
- $port = null;
- }
-
- $return = $this->set_userinfo($iuserinfo) &&
- $this->set_host($remaining) &&
- $this->set_port($port);
-
- $cache[$authority] = array($this->iuserinfo,
- $this->ihost,
- $this->port,
- $return);
-
- return $return;
- }
- }
-
- /**
- * Set the iuserinfo.
- *
- * @param string $iuserinfo
- * @return bool
- */
- public function set_userinfo($iuserinfo)
- {
- if ($iuserinfo === null)
- {
- $this->iuserinfo = null;
- }
- else
- {
- $this->iuserinfo = $this->replace_invalid_with_pct_encoding($iuserinfo, '!$&\'()*+,;=:');
- $this->scheme_normalization();
- }
-
- return true;
- }
-
- /**
- * Set the ihost. Returns true on success, false on failure (if there are
- * any invalid characters).
- *
- * @param string $ihost
- * @return bool
- */
- public function set_host($ihost)
- {
- if ($ihost === null)
- {
- $this->ihost = null;
- return true;
- }
- elseif (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']')
- {
- if (SimplePie_Net_IPv6::check_ipv6(substr($ihost, 1, -1)))
- {
- $this->ihost = '[' . SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)) . ']';
- }
- else
- {
- $this->ihost = null;
- return false;
- }
- }
- else
- {
- $ihost = $this->replace_invalid_with_pct_encoding($ihost, '!$&\'()*+,;=');
-
- // Lowercase, but ignore pct-encoded sections (as they should
- // remain uppercase). This must be done after the previous step
- // as that can add unescaped characters.
- $position = 0;
- $strlen = strlen($ihost);
- while (($position += strcspn($ihost, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ%', $position)) < $strlen)
- {
- if ($ihost[$position] === '%')
- {
- $position += 3;
- }
- else
- {
- $ihost[$position] = strtolower($ihost[$position]);
- $position++;
- }
- }
-
- $this->ihost = $ihost;
- }
-
- $this->scheme_normalization();
-
- return true;
- }
-
- /**
- * Set the port. Returns true on success, false on failure (if there are
- * any invalid characters).
- *
- * @param string $port
- * @return bool
- */
- public function set_port($port)
- {
- if ($port === null)
- {
- $this->port = null;
- return true;
- }
- elseif (strspn($port, '0123456789') === strlen($port))
- {
- $this->port = (int) $port;
- $this->scheme_normalization();
- return true;
- }
- else
- {
- $this->port = null;
- return false;
- }
- }
-
- /**
- * Set the ipath.
- *
- * @param string $ipath
- * @return bool
- */
- public function set_path($ipath)
- {
- static $cache;
- if (!$cache)
- {
- $cache = array();
- }
-
- $ipath = (string) $ipath;
-
- if (isset($cache[$ipath]))
- {
- $this->ipath = $cache[$ipath][(int) ($this->scheme !== null)];
- }
- else
- {
- $valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/');
- $removed = $this->remove_dot_segments($valid);
-
- $cache[$ipath] = array($valid, $removed);
- $this->ipath = ($this->scheme !== null) ? $removed : $valid;
- }
-
- $this->scheme_normalization();
- return true;
- }
-
- /**
- * Set the iquery.
- *
- * @param string $iquery
- * @return bool
- */
- public function set_query($iquery)
- {
- if ($iquery === null)
- {
- $this->iquery = null;
- }
- else
- {
- $this->iquery = $this->replace_invalid_with_pct_encoding($iquery, '!$&\'()*+,;=:@/?', true);
- $this->scheme_normalization();
- }
- return true;
- }
-
- /**
- * Set the ifragment.
- *
- * @param string $ifragment
- * @return bool
- */
- public function set_fragment($ifragment)
- {
- if ($ifragment === null)
- {
- $this->ifragment = null;
- }
- else
- {
- $this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?');
- $this->scheme_normalization();
- }
- return true;
- }
-
- /**
- * Convert an IRI to a URI (or parts thereof)
- *
- * @return string
- */
- public function to_uri($string)
- {
- static $non_ascii;
- if (!$non_ascii)
- {
- $non_ascii = implode('', range("\x80", "\xFF"));
- }
-
- $position = 0;
- $strlen = strlen($string);
- while (($position += strcspn($string, $non_ascii, $position)) < $strlen)
- {
- $string = substr_replace($string, sprintf('%%%02X', ord($string[$position])), $position, 1);
- $position += 3;
- $strlen += 2;
- }
-
- return $string;
- }
-
- /**
- * Get the complete IRI
- *
- * @return string
- */
- public function get_iri()
- {
- if (!$this->is_valid())
- {
- return false;
- }
-
- $iri = '';
- if ($this->scheme !== null)
- {
- $iri .= $this->scheme . ':';
- }
- if (($iauthority = $this->get_iauthority()) !== null)
- {
- $iri .= '//' . $iauthority;
- }
- if ($this->ipath !== '')
- {
- $iri .= $this->ipath;
- }
- elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
- {
- $iri .= $this->normalization[$this->scheme]['ipath'];
- }
- if ($this->iquery !== null)
- {
- $iri .= '?' . $this->iquery;
- }
- if ($this->ifragment !== null)
- {
- $iri .= '#' . $this->ifragment;
- }
-
- return $iri;
- }
-
- /**
- * Get the complete URI
- *
- * @return string
- */
- public function get_uri()
- {
- return $this->to_uri($this->get_iri());
- }
-
- /**
- * Get the complete iauthority
- *
- * @return string
- */
- protected function get_iauthority()
- {
- if ($this->iuserinfo !== null || $this->ihost !== null || $this->port !== null)
- {
- $iauthority = '';
- if ($this->iuserinfo !== null)
- {
- $iauthority .= $this->iuserinfo . '@';
- }
- if ($this->ihost !== null)
- {
- $iauthority .= $this->ihost;
- }
- if ($this->port !== null)
- {
- $iauthority .= ':' . $this->port;
- }
- return $iauthority;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Get the complete authority
- *
- * @return string
- */
- protected function get_authority()
- {
- $iauthority = $this->get_iauthority();
- if (is_string($iauthority))
- return $this->to_uri($iauthority);
- else
- return $iauthority;
- }
-}
-
-/**
- * Used for data cleanup and post-processing
- *
- *
- * This class can be overloaded with {@see SimplePie::set_sanitize_class()}
- *
- * @package SimplePie
- * @todo Move to using an actual HTML parser (this will allow tags to be properly stripped, and to switch between HTML and XHTML), this will also make it easier to shorten a string while preserving HTML tags
- */
-class SimplePie_Sanitize
-{
- // Private vars
- var $base;
-
- // Options
- var $remove_div = true;
- var $image_handler = '';
- //var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
- var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'font', 'form', 'frame', 'frameset', 'html', 'input', 'marquee', 'meta', 'noscript', 'script', 'style'); // Update for Leed
- var $encode_instead_of_strip = false;
- var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
- var $strip_comments = false;
- var $output_encoding = 'UTF-8';
- var $enable_cache = true;
- var $cache_location = './cache';
- var $cache_name_function = 'md5';
- var $timeout = 10;
- var $useragent = '';
- var $force_fsockopen = false;
- var $replace_url_attributes = null;
-
- public function __construct()
- {
- // Set defaults
- $this->set_url_replacements(null);
- }
-
- public function remove_div($enable = true)
- {
- $this->remove_div = (bool) $enable;
- }
-
- public function set_image_handler($page = false)
- {
- if ($page)
- {
- $this->image_handler = (string) $page;
- }
- else
- {
- $this->image_handler = false;
- }
- }
-
- public function set_registry(SimplePie_Registry $registry)
- {
- $this->registry = $registry;
- }
-
- public function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie_Cache')
- {
- if (isset($enable_cache))
- {
- $this->enable_cache = (bool) $enable_cache;
- }
-
- if ($cache_location)
- {
- $this->cache_location = (string) $cache_location;
- }
-
- if ($cache_name_function)
- {
- $this->cache_name_function = (string) $cache_name_function;
- }
- }
-
- public function pass_file_data($file_class = 'SimplePie_File', $timeout = 10, $useragent = '', $force_fsockopen = false)
- {
- if ($timeout)
- {
- $this->timeout = (string) $timeout;
- }
-
- if ($useragent)
- {
- $this->useragent = (string) $useragent;
- }
-
- if ($force_fsockopen)
- {
- $this->force_fsockopen = (string) $force_fsockopen;
- }
- }
-
- public function strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'))
- {
- if ($tags)
- {
- if (is_array($tags))
- {
- $this->strip_htmltags = $tags;
- }
- else
- {
- $this->strip_htmltags = explode(',', $tags);
- }
- }
- else
- {
- $this->strip_htmltags = false;
- }
- }
-
- public function encode_instead_of_strip($encode = false)
- {
- $this->encode_instead_of_strip = (bool) $encode;
- }
-
- public function strip_attributes($attribs = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'))
- {
- if ($attribs)
- {
- if (is_array($attribs))
- {
- $this->strip_attributes = $attribs;
- }
- else
- {
- $this->strip_attributes = explode(',', $attribs);
- }
- }
- else
- {
- $this->strip_attributes = false;
- }
- }
-
- public function strip_comments($strip = false)
- {
- $this->strip_comments = (bool) $strip;
- }
-
- public function set_output_encoding($encoding = 'UTF-8')
- {
- $this->output_encoding = (string) $encoding;
- }
-
- /**
- * Set element/attribute key/value pairs of HTML attributes
- * containing URLs that need to be resolved relative to the feed
- *
- * Defaults to |a|@href, |area|@href, |blockquote|@cite, |del|@cite,
- * |form|@action, |img|@longdesc, |img|@src, |input|@src, |ins|@cite,
- * |q|@cite
- *
- * @since 1.0
- * @param array|null $element_attribute Element/attribute key/value pairs, null for default
- */
- public function set_url_replacements($element_attribute = null)
- {
- if ($element_attribute === null)
- {
- $element_attribute = array(
- 'a' => 'href',
- 'area' => 'href',
- 'blockquote' => 'cite',
- 'del' => 'cite',
- 'form' => 'action',
- 'img' => array(
- 'longdesc',
- 'src'
- ),
- 'input' => 'src',
- 'ins' => 'cite',
- 'q' => 'cite'
- );
- }
- $this->replace_url_attributes = (array) $element_attribute;
- }
-
- public function sanitize($data, $type, $base = '')
- {
- $data = trim($data);
- if ($data !== '' || $type & SIMPLEPIE_CONSTRUCT_IRI)
- {
- if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML)
- {
- if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data))
- {
- $type |= SIMPLEPIE_CONSTRUCT_HTML;
- }
- else
- {
- $type |= SIMPLEPIE_CONSTRUCT_TEXT;
- }
- }
-
- if ($type & SIMPLEPIE_CONSTRUCT_BASE64)
- {
- $data = base64_decode($data);
- }
-
- if ($type & (SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML))
- {
-
- if (!class_exists('DOMDocument'))
- {
- throw new SimplePie_Exception('DOMDocument not found, unable to use sanitizer');
- }
- $document = new DOMDocument();
- $document->encoding = 'UTF-8';
- $data = $this->preprocess($data, $type);
-
- set_error_handler(array('SimplePie_Misc', 'silence_errors'));
- $document->loadHTML($data);
- restore_error_handler();
-
- // Strip comments
- if ($this->strip_comments)
- {
- $xpath = new DOMXPath($document);
- $comments = $xpath->query('//comment()');
-
- foreach ($comments as $comment)
- {
- $comment->parentNode->removeChild($comment);
- }
- }
-
- // Strip out HTML tags and attributes that might cause various security problems.
- // Based on recommendations by Mark Pilgrim at:
- // http://diveintomark.org/archives/2003/06/12/how_to_consume_rss_safely
- if ($this->strip_htmltags)
- {
- foreach ($this->strip_htmltags as $tag)
- {
- $this->strip_tag($tag, $document, $type);
- }
- }
-
- if ($this->strip_attributes)
- {
- foreach ($this->strip_attributes as $attrib)
- {
- $this->strip_attr($attrib, $document);
- }
- }
-
- // Replace relative URLs
- $this->base = $base;
- foreach ($this->replace_url_attributes as $element => $attributes)
- {
- $this->replace_urls($document, $element, $attributes);
- }
-
- // If image handling (caching, etc.) is enabled, cache and rewrite all the image tags.
- if (isset($this->image_handler) && ((string) $this->image_handler) !== '' && $this->enable_cache)
- {
- $images = $document->getElementsByTagName('img');
- foreach ($images as $img)
- {
- if ($img->hasAttribute('src'))
- {
- $image_url = call_user_func($this->cache_name_function, $img->getAttribute('src'));
- $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, $image_url, 'spi'));
-
- if ($cache->load())
- {
- $img->setAttribute('src', $this->image_handler . $image_url);
- }
- else
- {
- $file = $this->registry->create('File', array($img['attribs']['src']['data'], $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen));
- $headers = $file->headers;
-
- if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
- {
- if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
- {
- $img->setAttribute('src', $this->image_handler . $image_url);
- }
- else
- {
- trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
- }
- }
- }
- }
- }
- }
-
- // Remove the DOCTYPE
- // Seems to cause segfaulting if we don't do this
- if ($document->firstChild instanceof DOMDocumentType)
- {
- $document->removeChild($document->firstChild);
- }
-
- // Move everything from the body to the root
- $real_body = $document->getElementsByTagName('body')->item(0)->childNodes->item(0);
- $document->replaceChild($real_body, $document->firstChild);
-
- // Finally, convert to a HTML string
- $data = trim($document->saveHTML());
-
- if ($this->remove_div)
- {
- $data = preg_replace('/^/', '', $data);
- $data = preg_replace('/<\/div>$/', '', $data);
- }
- else
- {
- $data = preg_replace('/^
/', '
', $data);
- }
- }
-
- if ($type & SIMPLEPIE_CONSTRUCT_IRI)
- {
- $absolute = $this->registry->call('Misc', 'absolutize_url', array($data, $base));
- if ($absolute !== false)
- {
- $data = $absolute;
- }
- }
-
- if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI))
- {
- $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
- }
-
- if ($this->output_encoding !== 'UTF-8')
- {
- $data = $this->registry->call('Misc', 'change_encoding', array($data, 'UTF-8', $this->output_encoding));
- }
- }
- return $data;
- }
-
- protected function preprocess($html, $type)
- {
- $ret = '';
- if ($type & ~SIMPLEPIE_CONSTRUCT_XHTML)
- {
- // Atom XHTML constructs are wrapped with a div by default
- // Note: No protection if $html contains a stray
!
- $html = '
' . $html . '
';
- $ret .= '';
- $content_type = 'text/html';
- }
- else
- {
- $ret .= '';
- $content_type = 'application/xhtml+xml';
- }
-
- $ret .= '';
- $ret .= '
';
- $ret .= '' . $html . '';
- return $ret;
- }
-
- public function replace_urls($document, $tag, $attributes)
- {
- if (!is_array($attributes))
- {
- $attributes = array($attributes);
- }
-
- if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags))
- {
- $elements = $document->getElementsByTagName($tag);
- foreach ($elements as $element)
- {
- foreach ($attributes as $attribute)
- {
- if ($element->hasAttribute($attribute))
- {
- $value = $this->registry->call('Misc', 'absolutize_url', array($element->getAttribute($attribute), $this->base));
- if ($value !== false)
- {
- $element->setAttribute($attribute, $value);
- }
- }
- }
- }
- }
- }
-
- public function do_strip_htmltags($match)
- {
- if ($this->encode_instead_of_strip)
- {
- if (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
- {
- $match[1] = htmlspecialchars($match[1], ENT_COMPAT, 'UTF-8');
- $match[2] = htmlspecialchars($match[2], ENT_COMPAT, 'UTF-8');
- return "<$match[1]$match[2]>$match[3]</$match[1]>";
- }
- else
- {
- return htmlspecialchars($match[0], ENT_COMPAT, 'UTF-8');
- }
- }
- elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
- {
- return $match[4];
- }
- else
- {
- return '';
- }
- }
-
- protected function strip_tag($tag, $document, $type)
- {
- $xpath = new DOMXPath($document);
- $elements = $xpath->query('body//' . $tag);
- if ($this->encode_instead_of_strip)
- {
- foreach ($elements as $element)
- {
- $fragment = $document->createDocumentFragment();
-
- // For elements which aren't script or style, include the tag itself
- if (!in_array($tag, array('script', 'style')))
- {
- $text = '<' . $tag;
- if ($element->hasAttributes())
- {
- $attrs = array();
- foreach ($element->attributes as $name => $attr)
- {
- $value = $attr->value;
-
- // In XHTML, empty values should never exist, so we repeat the value
- if (empty($value) && ($type & SIMPLEPIE_CONSTRUCT_XHTML))
- {
- $value = $name;
- }
- // For HTML, empty is fine
- elseif (empty($value) && ($type & SIMPLEPIE_CONSTRUCT_HTML))
- {
- $attrs[] = $name;
- continue;
- }
-
- // Standard attribute text
- $attrs[] = $name . '="' . $attr->value . '"';
- }
- $text .= ' ' . implode(' ', $attrs);
- }
- $text .= '>';
- $fragment->appendChild(new DOMText($text));
- }
-
- $number = $element->childNodes->length;
- for ($i = $number; $i > 0; $i--)
- {
- $child = $element->childNodes->item(0);
- $fragment->appendChild($child);
- }
-
- if (!in_array($tag, array('script', 'style')))
- {
- $fragment->appendChild(new DOMText('' . $tag . '>'));
- }
-
- $element->parentNode->replaceChild($fragment, $element);
- }
-
- return;
- }
- elseif (in_array($tag, array('script', 'style')))
- {
- foreach ($elements as $element)
- {
- $element->parentNode->removeChild($element);
- }
-
- return;
- }
- else
- {
- foreach ($elements as $element)
- {
- $fragment = $document->createDocumentFragment();
- $number = $element->childNodes->length;
- for ($i = $number; $i > 0; $i--)
- {
- $child = $element->childNodes->item(0);
- $fragment->appendChild($child);
- }
-
- $element->parentNode->replaceChild($fragment, $element);
- }
- }
- }
-
- protected function strip_attr($attrib, $document)
- {
- $xpath = new DOMXPath($document);
- $elements = $xpath->query('//*[@' . $attrib . ']');
-
- foreach ($elements as $element)
- {
- $element->removeAttribute($attrib);
- }
- }
-}
-
-/**
- * Used for fetching remote files and reading local files
- *
- * Supports HTTP 1.0 via cURL or fsockopen, with spotty HTTP 1.1 support
- *
- * This class can be overloaded with {@see SimplePie::set_file_class()}
- *
- * @package SimplePie
- * @subpackage HTTP
- * @todo Move to properly supporting RFC2616 (HTTP/1.1)
- */
-class SimplePie_File
-{
- var $url;
- var $useragent;
- var $success = true;
- var $headers = array();
- var $body;
- var $status_code;
- var $redirects = 0;
- var $error;
- var $method = SIMPLEPIE_FILE_SOURCE_NONE;
-
- public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false)
- {
- if (class_exists('idna_convert'))
- {
- $idn = new idna_convert();
- $parsed = SimplePie_Misc::parse_url($url);
- $url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
- }
- $this->url = $url;
- $this->useragent = $useragent;
- if (preg_match('/^http(s)?:\/\//i', $url))
- {
- if ($useragent === null)
- {
- $useragent = ini_get('user_agent');
- $this->useragent = $useragent;
- }
- if (!is_array($headers))
- {
- $headers = array();
- }
- if (!$force_fsockopen && function_exists('curl_exec'))
- {
- $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL;
- $fp = curl_init();
- $headers2 = array();
- foreach ($headers as $key => $value)
- {
- $headers2[] = "$key: $value";
- }
- if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>='))
- {
- curl_setopt($fp, CURLOPT_ENCODING, '');
- }
- curl_setopt($fp, CURLOPT_URL, $url);
- curl_setopt($fp, CURLOPT_HEADER, 1);
- curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($fp, CURLOPT_TIMEOUT, $timeout);
- curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout);
- curl_setopt($fp, CURLOPT_REFERER, $url);
- curl_setopt($fp, CURLOPT_USERAGENT, $useragent);
- curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
- curl_setopt($fp, CURLOPT_SSL_VERIFYPEER, false); //Update for Leed - gestion HTTPS
- if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>='))
- {
- curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
- }
-
- $this->headers = curl_exec($fp);
- if (curl_errno($fp) === 23 || curl_errno($fp) === 61)
- {
- curl_setopt($fp, CURLOPT_ENCODING, 'none');
- $this->headers = curl_exec($fp);
- }
- if (curl_errno($fp))
- {
- $this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
- $this->success = false;
- }
- else
- {
- $info = curl_getinfo($fp);
- curl_close($fp);
- $this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1);
- $this->headers = array_pop($this->headers);
- $parser = new SimplePie_HTTP_Parser($this->headers);
- if ($parser->parse())
- {
- $this->headers = $parser->headers;
- $this->body = $parser->body;
- $this->status_code = $parser->status_code;
- if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
- {
- $this->redirects++;
- $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
- return $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
- }
- }
- }
- }
- else
- {
- $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
- $url_parts = parse_url($url);
- $socket_host = $url_parts['host'];
- if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https')
- {
- $socket_host = "ssl://$url_parts[host]";
- $url_parts['port'] = 443;
- }
- if (!isset($url_parts['port']))
- {
- $url_parts['port'] = 80;
- }
- $fp = @fsockopen($socket_host, $url_parts['port'], $errno, $errstr, $timeout);
- if (!$fp)
- {
- $this->error = 'fsockopen error: ' . $errstr;
- $this->success = false;
- }
- else
- {
- stream_set_timeout($fp, $timeout);
- if (isset($url_parts['path']))
- {
- if (isset($url_parts['query']))
- {
- $get = "$url_parts[path]?$url_parts[query]";
- }
- else
- {
- $get = $url_parts['path'];
- }
- }
- else
- {
- $get = '/';
- }
- $out = "GET $get HTTP/1.1\r\n";
- $out .= "Host: $url_parts[host]\r\n";
- $out .= "User-Agent: $useragent\r\n";
- if (extension_loaded('zlib'))
- {
- $out .= "Accept-Encoding: x-gzip,gzip,deflate\r\n";
- }
-
- if (isset($url_parts['user']) && isset($url_parts['pass']))
- {
- $out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n";
- }
- foreach ($headers as $key => $value)
- {
- $out .= "$key: $value\r\n";
- }
- $out .= "Connection: Close\r\n\r\n";
- fwrite($fp, $out);
-
- $info = stream_get_meta_data($fp);
-
- $this->headers = '';
- while (!$info['eof'] && !$info['timed_out'])
- {
- $this->headers .= fread($fp, 1160);
- $info = stream_get_meta_data($fp);
- }
- if (!$info['timed_out'])
- {
- $parser = new SimplePie_HTTP_Parser($this->headers);
- if ($parser->parse())
- {
- $this->headers = $parser->headers;
- $this->body = $parser->body;
- $this->status_code = $parser->status_code;
- if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
- {
- $this->redirects++;
- $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
- return $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
- }
- if (isset($this->headers['content-encoding']))
- {
- // Hey, we act dumb elsewhere, so let's do that here too
- switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20")))
- {
- case 'gzip':
- case 'x-gzip':
- $decoder = new SimplePie_gzdecode($this->body);
- if (!$decoder->parse())
- {
- $this->error = 'Unable to decode HTTP "gzip" stream';
- $this->success = false;
- }
- else
- {
- $this->body = $decoder->data;
- }
- break;
-
- case 'deflate':
- if (($decompressed = gzinflate($this->body)) !== false)
- {
- $this->body = $decompressed;
- }
- else if (($decompressed = gzuncompress($this->body)) !== false)
- {
- $this->body = $decompressed;
- }
- else if (function_exists('gzdecode') && ($decompressed = gzdecode($this->body)) !== false)
- {
- $this->body = $decompressed;
- }
- else
- {
- $this->error = 'Unable to decode HTTP "deflate" stream';
- $this->success = false;
- }
- break;
-
- default:
- $this->error = 'Unknown content coding';
- $this->success = false;
- }
- }
- }
- }
- else
- {
- $this->error = 'fsocket timed out';
- $this->success = false;
- }
- fclose($fp);
- }
- }
- }
- else
- {
- $this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS;
- if (empty($url) || !($this->body = file_get_contents($url)))
- {
- $this->error = 'file_get_contents could not read the file';
- $this->success = false;
- }
- }
- }
-}
-
-/**
- * Handles `
` captions as defined in Media RSS.
- *
- * Used by {@see SimplePie_Enclosure::get_caption()} and {@see SimplePie_Enclosure::get_captions()}
- *
- * This class can be overloaded with {@see SimplePie::set_caption_class()}
- *
- * @package SimplePie
- * @subpackage API
- */
-class SimplePie_Caption
-{
- /**
- * Content type
- *
- * @var string
- * @see get_type()
- */
- var $type;
-
- /**
- * Language
- *
- * @var string
- * @see get_language()
- */
- var $lang;
-
- /**
- * Start time
- *
- * @var string
- * @see get_starttime()
- */
- var $startTime;
-
- /**
- * End time
- *
- * @var string
- * @see get_endtime()
- */
- var $endTime;
-
- /**
- * Caption text
- *
- * @var string
- * @see get_text()
- */
- var $text;
-
- /**
- * Constructor, used to input the data
- *
- * For documentation on all the parameters, see the corresponding
- * properties and their accessors
- */
- public function __construct($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
- {
- $this->type = $type;
- $this->lang = $lang;
- $this->startTime = $startTime;
- $this->endTime = $endTime;
- $this->text = $text;
- }
-
- /**
- * String-ified version
- *
- * @return string
- */
- public function __toString()
- {
- // There is no $this->data here
- return md5(serialize($this));
- }
-
- /**
- * Get the end time
- *
- * @return string|null Time in the format 'hh:mm:ss.SSS'
- */
- public function get_endtime()
- {
- if ($this->endTime !== null)
- {
- return $this->endTime;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Get the language
- *
- * @link http://tools.ietf.org/html/rfc3066
- * @return string|null Language code as per RFC 3066
- */
- public function get_language()
- {
- if ($this->lang !== null)
- {
- return $this->lang;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Get the start time
- *
- * @return string|null Time in the format 'hh:mm:ss.SSS'
- */
- public function get_starttime()
- {
- if ($this->startTime !== null)
- {
- return $this->startTime;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Get the text of the caption
- *
- * @return string|null
- */
- public function get_text()
- {
- if ($this->text !== null)
- {
- return $this->text;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Get the content type (not MIME type)
- *
- * @return string|null Either 'text' or 'html'
- */
- public function get_type()
- {
- if ($this->type !== null)
- {
- return $this->type;
- }
- else
- {
- return null;
- }
- }
-}
-
-/**
- * Decode 'gzip' encoded HTTP data
- *
- * @package SimplePie
- * @subpackage HTTP
- * @link http://www.gzip.org/format.txt
- */
-class SimplePie_gzdecode
-{
- /**
- * Compressed data
- *
- * @access private
- * @var string
- * @see gzdecode::$data
- */
- var $compressed_data;
-
- /**
- * Size of compressed data
- *
- * @access private
- * @var int
- */
- var $compressed_size;
-
- /**
- * Minimum size of a valid gzip string
- *
- * @access private
- * @var int
- */
- var $min_compressed_size = 18;
-
- /**
- * Current position of pointer
- *
- * @access private
- * @var int
- */
- var $position = 0;
-
- /**
- * Flags (FLG)
- *
- * @access private
- * @var int
- */
- var $flags;
-
- /**
- * Uncompressed data
- *
- * @access public
- * @see gzdecode::$compressed_data
- * @var string
- */
- var $data;
-
- /**
- * Modified time
- *
- * @access public
- * @var int
- */
- var $MTIME;
-
- /**
- * Extra Flags
- *
- * @access public
- * @var int
- */
- var $XFL;
-
- /**
- * Operating System
- *
- * @access public
- * @var int
- */
- var $OS;
-
- /**
- * Subfield ID 1
- *
- * @access public
- * @see gzdecode::$extra_field
- * @see gzdecode::$SI2
- * @var string
- */
- var $SI1;
-
- /**
- * Subfield ID 2
- *
- * @access public
- * @see gzdecode::$extra_field
- * @see gzdecode::$SI1
- * @var string
- */
- var $SI2;
-
- /**
- * Extra field content
- *
- * @access public
- * @see gzdecode::$SI1
- * @see gzdecode::$SI2
- * @var string
- */
- var $extra_field;
-
- /**
- * Original filename
- *
- * @access public
- * @var string
- */
- var $filename;
-
- /**
- * Human readable comment
- *
- * @access public
- * @var string
- */
- var $comment;
-
- /**
- * Don't allow anything to be set
- *
- * @param string $name
- * @param mixed $value
- */
- public function __set($name, $value)
- {
- trigger_error("Cannot write property $name", E_USER_ERROR);
- }
-
- /**
- * Set the compressed string and related properties
- *
- * @param string $data
- */
- public function __construct($data)
- {
- $this->compressed_data = $data;
- $this->compressed_size = strlen($data);
- }
-
- /**
- * Decode the GZIP stream
- *
- * @return bool Successfulness
- */
- public function parse()
- {
- if ($this->compressed_size >= $this->min_compressed_size)
- {
- // Check ID1, ID2, and CM
- if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08")
- {
- return false;
- }
-
- // Get the FLG (FLaGs)
- $this->flags = ord($this->compressed_data[3]);
-
- // FLG bits above (1 << 4) are reserved
- if ($this->flags > 0x1F)
- {
- return false;
- }
-
- // Advance the pointer after the above
- $this->position += 4;
-
- // MTIME
- $mtime = substr($this->compressed_data, $this->position, 4);
- // Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness
- if (current(unpack('S', "\x00\x01")) === 1)
- {
- $mtime = strrev($mtime);
- }
- $this->MTIME = current(unpack('l', $mtime));
- $this->position += 4;
-
- // Get the XFL (eXtra FLags)
- $this->XFL = ord($this->compressed_data[$this->position++]);
-
- // Get the OS (Operating System)
- $this->OS = ord($this->compressed_data[$this->position++]);
-
- // Parse the FEXTRA
- if ($this->flags & 4)
- {
- // Read subfield IDs
- $this->SI1 = $this->compressed_data[$this->position++];
- $this->SI2 = $this->compressed_data[$this->position++];
-
- // SI2 set to zero is reserved for future use
- if ($this->SI2 === "\x00")
- {
- return false;
- }
-
- // Get the length of the extra field
- $len = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
- $this->position += 2;
-
- // Check the length of the string is still valid
- $this->min_compressed_size += $len + 4;
- if ($this->compressed_size >= $this->min_compressed_size)
- {
- // Set the extra field to the given data
- $this->extra_field = substr($this->compressed_data, $this->position, $len);
- $this->position += $len;
- }
- else
- {
- return false;
- }
- }
-
- // Parse the FNAME
- if ($this->flags & 8)
- {
- // Get the length of the filename
- $len = strcspn($this->compressed_data, "\x00", $this->position);
-
- // Check the length of the string is still valid
- $this->min_compressed_size += $len + 1;
- if ($this->compressed_size >= $this->min_compressed_size)
- {
- // Set the original filename to the given string
- $this->filename = substr($this->compressed_data, $this->position, $len);
- $this->position += $len + 1;
- }
- else
- {
- return false;
- }
- }
-
- // Parse the FCOMMENT
- if ($this->flags & 16)
- {
- // Get the length of the comment
- $len = strcspn($this->compressed_data, "\x00", $this->position);
-
- // Check the length of the string is still valid
- $this->min_compressed_size += $len + 1;
- if ($this->compressed_size >= $this->min_compressed_size)
- {
- // Set the original comment to the given string
- $this->comment = substr($this->compressed_data, $this->position, $len);
- $this->position += $len + 1;
- }
- else
- {
- return false;
- }
- }
-
- // Parse the FHCRC
- if ($this->flags & 2)
- {
- // Check the length of the string is still valid
- $this->min_compressed_size += $len + 2;
- if ($this->compressed_size >= $this->min_compressed_size)
- {
- // Read the CRC
- $crc = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
-
- // Check the CRC matches
- if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
- {
- $this->position += 2;
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
-
- // Decompress the actual data
- if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false)
- {
- return false;
- }
- else
- {
- $this->position = $this->compressed_size - 8;
- }
-
- // Check CRC of data
- $crc = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
- $this->position += 4;
- /*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc))
- {
- return false;
- }*/
-
- // Check ISIZE of data
- $isize = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
- $this->position += 4;
- if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize))
- {
- return false;
- }
-
- // Wow, against all odds, we've actually got a valid gzip string
- return true;
- }
- else
- {
- return false;
- }
- }
-}
-
-/**
- * Handles `` or `` tags as defined in Media RSS and iTunes RSS respectively
- *
- * Used by {@see SimplePie_Enclosure::get_rating()} and {@see SimplePie_Enclosure::get_ratings()}
- *
- * This class can be overloaded with {@see SimplePie::set_rating_class()}
- *
- * @package SimplePie
- * @subpackage API
- */
-class SimplePie_Rating
-{
- /**
- * Rating scheme
- *
- * @var string
- * @see get_scheme()
- */
- var $scheme;
-
- /**
- * Rating value
- *
- * @var string
- * @see get_value()
- */
- var $value;
-
- /**
- * Constructor, used to input the data
- *
- * For documentation on all the parameters, see the corresponding
- * properties and their accessors
- */
- public function __construct($scheme = null, $value = null)
- {
- $this->scheme = $scheme;
- $this->value = $value;
- }
-
- /**
- * String-ified version
- *
- * @return string
- */
- public function __toString()
- {
- // There is no $this->data here
- return md5(serialize($this));
- }
-
- /**
- * Get the organizational scheme for the rating
- *
- * @return string|null
- */
- public function get_scheme()
- {
- if ($this->scheme !== null)
- {
- return $this->scheme;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Get the value of the rating
- *
- * @return string|null
- */
- public function get_value()
- {
- if ($this->value !== null)
- {
- return $this->value;
- }
- else
- {
- return null;
- }
- }
-}
-
-/**
- * Manages all author-related data
- *
- * Used by {@see SimplePie_Item::get_author()} and {@see SimplePie::get_authors()}
- *
- * This class can be overloaded with {@see SimplePie::set_author_class()}
- *
- * @package SimplePie
- * @subpackage API
- */
-class SimplePie_Author
-{
- /**
- * Author's name
- *
- * @var string
- * @see get_name()
- */
- var $name;
-
- /**
- * Author's link
- *
- * @var string
- * @see get_link()
- */
- var $link;
-
- /**
- * Author's email address
- *
- * @var string
- * @see get_email()
- */
- var $email;
-
- /**
- * Constructor, used to input the data
- *
- * @param string $name
- * @param string $link
- * @param string $email
- */
- public function __construct($name = null, $link = null, $email = null)
- {
- $this->name = $name;
- $this->link = $link;
- $this->email = $email;
- }
-
- /**
- * String-ified version
- *
- * @return string
- */
- public function __toString()
- {
- // There is no $this->data here
- return md5(serialize($this));
- }
-
- /**
- * Author's name
- *
- * @return string|null
- */
- public function get_name()
- {
- if ($this->name !== null)
- {
- return $this->name;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Author's link
- *
- * @return string|null
- */
- public function get_link()
- {
- if ($this->link !== null)
- {
- return $this->link;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Author's email address
- *
- * @return string|null
- */
- public function get_email()
- {
- if ($this->email !== null)
- {
- return $this->email;
- }
- else
- {
- return null;
- }
- }
-}
-
-/**
- * SimplePie class.
- *
- * Class for backward compatibility.
- *
- * @deprecated Use {@see SimplePie} directly
- * @package SimplePie
- * @subpackage API
- */
-class SimplePie_Core extends SimplePie
-{
-
-}
-
-/**
- * Used to create cache objects
- *
- * This class can be overloaded with {@see SimplePie::set_cache_class()},
- * although the preferred way is to create your own handler
- * via {@see register()}
- *
- * @package SimplePie
- * @subpackage Caching
- */
-class SimplePie_Cache
-{
- /**
- * Cache handler classes
- *
- * These receive 3 parameters to their constructor, as documented in
- * {@see register()}
- * @var array
- */
- protected static $handlers = array(
- 'mysql' => 'SimplePie_Cache_MySQL',
- 'memcache' => 'SimplePie_Cache_Memcache',
- );
-
- /**
- * Don't call the constructor. Please.
- */
- private function __construct() { }
-
- /**
- * Create a new SimplePie_Cache object
- *
- * @param string $location URL location (scheme is used to determine handler)
- * @param string $filename Unique identifier for cache object
- * @param string $extension 'spi' or 'spc'
- * @return SimplePie_Cache_Base Type of object depends on scheme of `$location`
- */
- public static function get_handler($location, $filename, $extension)
- {
- $type = explode(':', $location, 2);
- $type = $type[0];
- if (!empty(self::$handlers[$type]))
- {
- $class = self::$handlers[$type];
- return new $class($location, $filename, $extension);
- }
-
- return new SimplePie_Cache_File($location, $filename, $extension);
- }
-
- /**
- * Create a new SimplePie_Cache object
- *
- * @deprecated Use {@see get_handler} instead
- */
- public function create($location, $filename, $extension)
- {
- trigger_error('Cache::create() has been replaced with Cache::get_handler(). Switch to the registry system to use this.', E_USER_DEPRECATED);
- return self::get_handler($location, $filename, $extension);
- }
-
- /**
- * Register a handler
- *
- * @param string $type DSN type to register for
- * @param string $class Name of handler class. Must implement SimplePie_Cache_Base
- */
- public static function register($type, $class)
- {
- self::$handlers[$type] = $class;
- }
-
- /**
- * Parse a URL into an array
- *
- * @param string $url
- * @return array
- */
- public static function parse_URL($url)
- {
- $params = parse_url($url);
- $params['extras'] = array();
- if (isset($params['query']))
- {
- parse_str($params['query'], $params['extras']);
- }
- return $params;
- }
-}
-
-/**
- * Manages `` copyright tags as defined in Media RSS
- *
- * Used by {@see SimplePie_Enclosure::get_copyright()}
- *
- * This class can be overloaded with {@see SimplePie::set_copyright_class()}
- *
- * @package SimplePie
- * @subpackage API
- */
-class SimplePie_Copyright
-{
- /**
- * Copyright URL
- *
- * @var string
- * @see get_url()
- */
- var $url;
-
- /**
- * Attribution
- *
- * @var string
- * @see get_attribution()
- */
- var $label;
-
- /**
- * Constructor, used to input the data
- *
- * For documentation on all the parameters, see the corresponding
- * properties and their accessors
- */
- public function __construct($url = null, $label = null)
- {
- $this->url = $url;
- $this->label = $label;
- }
-
- /**
- * String-ified version
- *
- * @return string
- */
- public function __toString()
- {
- // There is no $this->data here
- return md5(serialize($this));
- }
-
- /**
- * Get the copyright URL
- *
- * @return string|null URL to copyright information
- */
- public function get_url()
- {
- if ($this->url !== null)
- {
- return $this->url;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Get the attribution text
- *
- * @return string|null
- */
- public function get_attribution()
- {
- if ($this->label !== null)
- {
- return $this->label;
- }
- else
- {
- return null;
- }
- }
-}
-
-/**
- * Handles `` as defined in Media RSS
- *
- * Used by {@see SimplePie_Enclosure::get_restriction()} and {@see SimplePie_Enclosure::get_restrictions()}
- *
- * This class can be overloaded with {@see SimplePie::set_restriction_class()}
- *
- * @package SimplePie
- * @subpackage API
- */
-class SimplePie_Restriction
-{
- /**
- * Relationship ('allow'/'deny')
- *
- * @var string
- * @see get_relationship()
- */
- var $relationship;
-
- /**
- * Type of restriction
- *
- * @var string
- * @see get_type()
- */
- var $type;
-
- /**
- * Restricted values
- *
- * @var string
- * @see get_value()
- */
- var $value;
-
- /**
- * Constructor, used to input the data
- *
- * For documentation on all the parameters, see the corresponding
- * properties and their accessors
- */
- public function __construct($relationship = null, $type = null, $value = null)
- {
- $this->relationship = $relationship;
- $this->type = $type;
- $this->value = $value;
- }
-
- /**
- * String-ified version
- *
- * @return string
- */
- public function __toString()
- {
- // There is no $this->data here
- return md5(serialize($this));
- }
-
- /**
- * Get the relationship
- *
- * @return string|null Either 'allow' or 'deny'
- */
- public function get_relationship()
- {
- if ($this->relationship !== null)
- {
- return $this->relationship;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Get the type
- *
- * @return string|null
- */
- public function get_type()
- {
- if ($this->type !== null)
- {
- return $this->type;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Get the list of restricted things
- *
- * @return string|null
- */
- public function get_value()
- {
- if ($this->value !== null)
- {
- return $this->value;
- }
- else
- {
- return null;
- }
- }
-}
-
-/**
- * Handles creating objects and calling methods
- *
- * Access this via {@see SimplePie::get_registry()}
- *
- * @package SimplePie
- */
-class SimplePie_Registry
-{
- /**
- * Default class mapping
- *
- * Overriding classes *must* subclass these.
- *
- * @var array
- */
- protected $default = array(
- 'Cache' => 'SimplePie_Cache',
- 'Locator' => 'SimplePie_Locator',
- 'Parser' => 'SimplePie_Parser',
- 'File' => 'SimplePie_File',
- 'Sanitize' => 'SimplePie_Sanitize',
- 'Item' => 'SimplePie_Item',
- 'Author' => 'SimplePie_Author',
- 'Category' => 'SimplePie_Category',
- 'Enclosure' => 'SimplePie_Enclosure',
- 'Caption' => 'SimplePie_Caption',
- 'Copyright' => 'SimplePie_Copyright',
- 'Credit' => 'SimplePie_Credit',
- 'Rating' => 'SimplePie_Rating',
- 'Restriction' => 'SimplePie_Restriction',
- 'Content_Type_Sniffer' => 'SimplePie_Content_Type_Sniffer',
- 'Source' => 'SimplePie_Source',
- 'Misc' => 'SimplePie_Misc',
- 'XML_Declaration_Parser' => 'SimplePie_XML_Declaration_Parser',
- 'Parse_Date' => 'SimplePie_Parse_Date',
- );
-
- /**
- * Class mapping
- *
- * @see register()
- * @var array
- */
- protected $classes = array();
-
- /**
- * Legacy classes
- *
- * @see register()
- * @var array
- */
- protected $legacy = array();
-
- /**
- * Constructor
- *
- * No-op
- */
- public function __construct() { }
-
- /**
- * Register a class
- *
- * @param string $type See {@see $default} for names
- * @param string $class Class name, must subclass the corresponding default
- * @param bool $legacy Whether to enable legacy support for this class
- * @return bool Successfulness
- */
- public function register($type, $class, $legacy = false)
- {
- if (!is_subclass_of($class, $this->default[$type]))
- {
- return false;
- }
-
- $this->classes[$type] = $class;
-
- if ($legacy)
- {
- $this->legacy[] = $class;
- }
-
- return true;
- }
-
- /**
- * Get the class registered for a type
- *
- * Where possible, use {@see create()} or {@see call()} instead
- *
- * @param string $type
- * @return string|null
- */
- public function get_class($type)
- {
- if (!empty($this->classes[$type]))
- {
- return $this->classes[$type];
- }
- if (!empty($this->default[$type]))
- {
- return $this->default[$type];
- }
-
- return null;
- }
-
- /**
- * Create a new instance of a given type
- *
- * @param string $type
- * @param array $parameters Parameters to pass to the constructor
- * @return object Instance of class
- */
- public function &create($type, $parameters = array())
- {
- $class = $this->get_class($type);
-
- if (in_array($class, $this->legacy))
- {
- switch ($type)
- {
- case 'locator':
- // Legacy: file, timeout, useragent, file_class, max_checked_feeds, content_type_sniffer_class
- // Specified: file, timeout, useragent, max_checked_feeds
- $replacement = array($this->get_class('file'), $parameters[3], $this->get_class('content_type_sniffer'));
- array_splice($parameters, 3, 1, $replacement);
- break;
- }
- }
-
- if (!method_exists($class, '__construct'))
- {
- $instance = new $class;
- }
- else
- {
- $reflector = new ReflectionClass($class);
- $instance = $reflector->newInstanceArgs($parameters);
- }
-
- if (method_exists($instance, 'set_registry'))
- {
- $instance->set_registry($this);
- }
- return $instance;
- }
-
- /**
- * Call a static method for a type
- *
- * @param string $type
- * @param string $method
- * @param array $parameters
- * @return mixed
- */
- public function &call($type, $method, $parameters = array())
- {
- $class = $this->get_class($type);
-
- if (in_array($class, $this->legacy))
- {
- switch ($type)
- {
- case 'Cache':
- // For backwards compatibility with old non-static
- // Cache::create() methods
- if ($method === 'get_handler')
- {
- $result = @call_user_func_array(array($class, 'create'), $parameters);
- return $result;
- }
- break;
- }
- }
-
- $result = call_user_func_array(array($class, $method), $parameters);
- return $result;
- }
-}
-
-/**
- * Date Parser
- *
- * @package SimplePie
- * @subpackage Parsing
- */
-class SimplePie_Parse_Date
-{
- /**
- * Input data
- *
- * @access protected
- * @var string
- */
- var $date;
-
- /**
- * List of days, calendar day name => ordinal day number in the week
- *
- * @access protected
- * @var array
- */
- var $day = array(
- // English
- 'mon' => 1,
- 'monday' => 1,
- 'tue' => 2,
- 'tuesday' => 2,
- 'wed' => 3,
- 'wednesday' => 3,
- 'thu' => 4,
- 'thursday' => 4,
- 'fri' => 5,
- 'friday' => 5,
- 'sat' => 6,
- 'saturday' => 6,
- 'sun' => 7,
- 'sunday' => 7,
- // Dutch
- 'maandag' => 1,
- 'dinsdag' => 2,
- 'woensdag' => 3,
- 'donderdag' => 4,
- 'vrijdag' => 5,
- 'zaterdag' => 6,
- 'zondag' => 7,
- // French
- 'lundi' => 1,
- 'mardi' => 2,
- 'mercredi' => 3,
- 'jeudi' => 4,
- 'vendredi' => 5,
- 'samedi' => 6,
- 'dimanche' => 7,
- // German
- 'montag' => 1,
- 'dienstag' => 2,
- 'mittwoch' => 3,
- 'donnerstag' => 4,
- 'freitag' => 5,
- 'samstag' => 6,
- 'sonnabend' => 6,
- 'sonntag' => 7,
- // Italian
- 'lunedì' => 1,
- 'martedì' => 2,
- 'mercoledì' => 3,
- 'giovedì' => 4,
- 'venerdì' => 5,
- 'sabato' => 6,
- 'domenica' => 7,
- // Spanish
- 'lunes' => 1,
- 'martes' => 2,
- 'miércoles' => 3,
- 'jueves' => 4,
- 'viernes' => 5,
- 'sábado' => 6,
- 'domingo' => 7,
- // Finnish
- 'maanantai' => 1,
- 'tiistai' => 2,
- 'keskiviikko' => 3,
- 'torstai' => 4,
- 'perjantai' => 5,
- 'lauantai' => 6,
- 'sunnuntai' => 7,
- // Hungarian
- 'hétfő' => 1,
- 'kedd' => 2,
- 'szerda' => 3,
- 'csütörtok' => 4,
- 'péntek' => 5,
- 'szombat' => 6,
- 'vasárnap' => 7,
- // Greek
- 'Δευ' => 1,
- 'Τρι' => 2,
- 'Τετ' => 3,
- 'Πεμ' => 4,
- 'Παρ' => 5,
- 'Σαβ' => 6,
- 'Κυρ' => 7,
- );
-
- /**
- * List of months, calendar month name => calendar month number
- *
- * @access protected
- * @var array
- */
- var $month = array(
- // English
- 'jan' => 1,
- 'january' => 1,
- 'feb' => 2,
- 'february' => 2,
- 'mar' => 3,
- 'march' => 3,
- 'apr' => 4,
- 'april' => 4,
- 'may' => 5,
- // No long form of May
- 'jun' => 6,
- 'june' => 6,
- 'jul' => 7,
- 'july' => 7,
- 'aug' => 8,
- 'august' => 8,
- 'sep' => 9,
- 'september' => 8,
- 'oct' => 10,
- 'october' => 10,
- 'nov' => 11,
- 'november' => 11,
- 'dec' => 12,
- 'december' => 12,
- // Dutch
- 'januari' => 1,
- 'februari' => 2,
- 'maart' => 3,
- 'april' => 4,
- 'mei' => 5,
- 'juni' => 6,
- 'juli' => 7,
- 'augustus' => 8,
- 'september' => 9,
- 'oktober' => 10,
- 'november' => 11,
- 'december' => 12,
- // French
- 'janvier' => 1,
- 'février' => 2,
- 'mars' => 3,
- 'avril' => 4,
- 'mai' => 5,
- 'juin' => 6,
- 'juillet' => 7,
- 'août' => 8,
- 'septembre' => 9,
- 'octobre' => 10,
- 'novembre' => 11,
- 'décembre' => 12,
- // German
- 'januar' => 1,
- 'februar' => 2,
- 'märz' => 3,
- 'april' => 4,
- 'mai' => 5,
- 'juni' => 6,
- 'juli' => 7,
- 'august' => 8,
- 'september' => 9,
- 'oktober' => 10,
- 'november' => 11,
- 'dezember' => 12,
- // Italian
- 'gennaio' => 1,
- 'febbraio' => 2,
- 'marzo' => 3,
- 'aprile' => 4,
- 'maggio' => 5,
- 'giugno' => 6,
- 'luglio' => 7,
- 'agosto' => 8,
- 'settembre' => 9,
- 'ottobre' => 10,
- 'novembre' => 11,
- 'dicembre' => 12,
- // Spanish
- 'enero' => 1,
- 'febrero' => 2,
- 'marzo' => 3,
- 'abril' => 4,
- 'mayo' => 5,
- 'junio' => 6,
- 'julio' => 7,
- 'agosto' => 8,
- 'septiembre' => 9,
- 'setiembre' => 9,
- 'octubre' => 10,
- 'noviembre' => 11,
- 'diciembre' => 12,
- // Finnish
- 'tammikuu' => 1,
- 'helmikuu' => 2,
- 'maaliskuu' => 3,
- 'huhtikuu' => 4,
- 'toukokuu' => 5,
- 'kesäkuu' => 6,
- 'heinäkuu' => 7,
- 'elokuu' => 8,
- 'suuskuu' => 9,
- 'lokakuu' => 10,
- 'marras' => 11,
- 'joulukuu' => 12,
- // Hungarian
- 'január' => 1,
- 'február' => 2,
- 'március' => 3,
- 'április' => 4,
- 'május' => 5,
- 'június' => 6,
- 'július' => 7,
- 'augusztus' => 8,
- 'szeptember' => 9,
- 'október' => 10,
- 'november' => 11,
- 'december' => 12,
- // Greek
- 'Ιαν' => 1,
- 'Φεβ' => 2,
- 'Μάώ' => 3,
- 'Μαώ' => 3,
- 'Απρ' => 4,
- 'Μάι' => 5,
- 'Μαϊ' => 5,
- 'Μαι' => 5,
- 'Ιούν' => 6,
- 'Ιον' => 6,
- 'Ιούλ' => 7,
- 'Ιολ' => 7,
- 'Αύγ' => 8,
- 'Αυγ' => 8,
- 'Σεπ' => 9,
- 'Οκτ' => 10,
- 'Νοέ' => 11,
- 'Δεκ' => 12,
- );
-
- /**
- * List of timezones, abbreviation => offset from UTC
- *
- * @access protected
- * @var array
- */
- var $timezone = array(
- 'ACDT' => 37800,
- 'ACIT' => 28800,
- 'ACST' => 34200,
- 'ACT' => -18000,
- 'ACWDT' => 35100,
- 'ACWST' => 31500,
- 'AEDT' => 39600,
- 'AEST' => 36000,
- 'AFT' => 16200,
- 'AKDT' => -28800,
- 'AKST' => -32400,
- 'AMDT' => 18000,
- 'AMT' => -14400,
- 'ANAST' => 46800,
- 'ANAT' => 43200,
- 'ART' => -10800,
- 'AZOST' => -3600,
- 'AZST' => 18000,
- 'AZT' => 14400,
- 'BIOT' => 21600,
- 'BIT' => -43200,
- 'BOT' => -14400,
- 'BRST' => -7200,
- 'BRT' => -10800,
- 'BST' => 3600,
- 'BTT' => 21600,
- 'CAST' => 18000,
- 'CAT' => 7200,
- 'CCT' => 23400,
- 'CDT' => -18000,
- 'CEDT' => 7200,
- 'CET' => 3600,
- 'CGST' => -7200,
- 'CGT' => -10800,
- 'CHADT' => 49500,
- 'CHAST' => 45900,
- 'CIST' => -28800,
- 'CKT' => -36000,
- 'CLDT' => -10800,
- 'CLST' => -14400,
- 'COT' => -18000,
- 'CST' => -21600,
- 'CVT' => -3600,
- 'CXT' => 25200,
- 'DAVT' => 25200,
- 'DTAT' => 36000,
- 'EADT' => -18000,
- 'EAST' => -21600,
- 'EAT' => 10800,
- 'ECT' => -18000,
- 'EDT' => -14400,
- 'EEST' => 10800,
- 'EET' => 7200,
- 'EGT' => -3600,
- 'EKST' => 21600,
- 'EST' => -18000,
- 'FJT' => 43200,
- 'FKDT' => -10800,
- 'FKST' => -14400,
- 'FNT' => -7200,
- 'GALT' => -21600,
- 'GEDT' => 14400,
- 'GEST' => 10800,
- 'GFT' => -10800,
- 'GILT' => 43200,
- 'GIT' => -32400,
- 'GST' => 14400,
- 'GST' => -7200,
- 'GYT' => -14400,
- 'HAA' => -10800,
- 'HAC' => -18000,
- 'HADT' => -32400,
- 'HAE' => -14400,
- 'HAP' => -25200,
- 'HAR' => -21600,
- 'HAST' => -36000,
- 'HAT' => -9000,
- 'HAY' => -28800,
- 'HKST' => 28800,
- 'HMT' => 18000,
- 'HNA' => -14400,
- 'HNC' => -21600,
- 'HNE' => -18000,
- 'HNP' => -28800,
- 'HNR' => -25200,
- 'HNT' => -12600,
- 'HNY' => -32400,
- 'IRDT' => 16200,
- 'IRKST' => 32400,
- 'IRKT' => 28800,
- 'IRST' => 12600,
- 'JFDT' => -10800,
- 'JFST' => -14400,
- 'JST' => 32400,
- 'KGST' => 21600,
- 'KGT' => 18000,
- 'KOST' => 39600,
- 'KOVST' => 28800,
- 'KOVT' => 25200,
- 'KRAST' => 28800,
- 'KRAT' => 25200,
- 'KST' => 32400,
- 'LHDT' => 39600,
- 'LHST' => 37800,
- 'LINT' => 50400,
- 'LKT' => 21600,
- 'MAGST' => 43200,
- 'MAGT' => 39600,
- 'MAWT' => 21600,
- 'MDT' => -21600,
- 'MESZ' => 7200,
- 'MEZ' => 3600,
- 'MHT' => 43200,
- 'MIT' => -34200,
- 'MNST' => 32400,
- 'MSDT' => 14400,
- 'MSST' => 10800,
- 'MST' => -25200,
- 'MUT' => 14400,
- 'MVT' => 18000,
- 'MYT' => 28800,
- 'NCT' => 39600,
- 'NDT' => -9000,
- 'NFT' => 41400,
- 'NMIT' => 36000,
- 'NOVST' => 25200,
- 'NOVT' => 21600,
- 'NPT' => 20700,
- 'NRT' => 43200,
- 'NST' => -12600,
- 'NUT' => -39600,
- 'NZDT' => 46800,
- 'NZST' => 43200,
- 'OMSST' => 25200,
- 'OMST' => 21600,
- 'PDT' => -25200,
- 'PET' => -18000,
- 'PETST' => 46800,
- 'PETT' => 43200,
- 'PGT' => 36000,
- 'PHOT' => 46800,
- 'PHT' => 28800,
- 'PKT' => 18000,
- 'PMDT' => -7200,
- 'PMST' => -10800,
- 'PONT' => 39600,
- 'PST' => -28800,
- 'PWT' => 32400,
- 'PYST' => -10800,
- 'PYT' => -14400,
- 'RET' => 14400,
- 'ROTT' => -10800,
- 'SAMST' => 18000,
- 'SAMT' => 14400,
- 'SAST' => 7200,
- 'SBT' => 39600,
- 'SCDT' => 46800,
- 'SCST' => 43200,
- 'SCT' => 14400,
- 'SEST' => 3600,
- 'SGT' => 28800,
- 'SIT' => 28800,
- 'SRT' => -10800,
- 'SST' => -39600,
- 'SYST' => 10800,
- 'SYT' => 7200,
- 'TFT' => 18000,
- 'THAT' => -36000,
- 'TJT' => 18000,
- 'TKT' => -36000,
- 'TMT' => 18000,
- 'TOT' => 46800,
- 'TPT' => 32400,
- 'TRUT' => 36000,
- 'TVT' => 43200,
- 'TWT' => 28800,
- 'UYST' => -7200,
- 'UYT' => -10800,
- 'UZT' => 18000,
- 'VET' => -14400,
- 'VLAST' => 39600,
- 'VLAT' => 36000,
- 'VOST' => 21600,
- 'VUT' => 39600,
- 'WAST' => 7200,
- 'WAT' => 3600,
- 'WDT' => 32400,
- 'WEST' => 3600,
- 'WFT' => 43200,
- 'WIB' => 25200,
- 'WIT' => 32400,
- 'WITA' => 28800,
- 'WKST' => 18000,
- 'WST' => 28800,
- 'YAKST' => 36000,
- 'YAKT' => 32400,
- 'YAPT' => 36000,
- 'YEKST' => 21600,
- 'YEKT' => 18000,
- );
-
- /**
- * Cached PCRE for SimplePie_Parse_Date::$day
- *
- * @access protected
- * @var string
- */
- var $day_pcre;
-
- /**
- * Cached PCRE for SimplePie_Parse_Date::$month
- *
- * @access protected
- * @var string
- */
- var $month_pcre;
-
- /**
- * Array of user-added callback methods
- *
- * @access private
- * @var array
- */
- var $built_in = array();
-
- /**
- * Array of user-added callback methods
- *
- * @access private
- * @var array
- */
- var $user = array();
-
- /**
- * Create new SimplePie_Parse_Date object, and set self::day_pcre,
- * self::month_pcre, and self::built_in
- *
- * @access private
- */
- public function __construct()
- {
- $this->day_pcre = '(' . implode(array_keys($this->day), '|') . ')';
- $this->month_pcre = '(' . implode(array_keys($this->month), '|') . ')';
-
- static $cache;
- if (!isset($cache[get_class($this)]))
- {
- $all_methods = get_class_methods($this);
-
- foreach ($all_methods as $method)
- {
- if (strtolower(substr($method, 0, 5)) === 'date_')
- {
- $cache[get_class($this)][] = $method;
- }
- }
- }
-
- foreach ($cache[get_class($this)] as $method)
- {
- $this->built_in[] = $method;
- }
- }
-
- /**
- * Get the object
- *
- * @access public
- */
- public static function get()
- {
- static $object;
- if (!$object)
- {
- $object = new SimplePie_Parse_Date;
- }
- return $object;
- }
-
- /**
- * Parse a date
- *
- * @final
- * @access public
- * @param string $date Date to parse
- * @return int Timestamp corresponding to date string, or false on failure
- */
- public function parse($date)
- {
- foreach ($this->user as $method)
- {
- if (($returned = call_user_func($method, $date)) !== false)
- {
- return $returned;
- }
- }
-
- foreach ($this->built_in as $method)
- {
- if (($returned = call_user_func(array($this, $method), $date)) !== false)
- {
- return $returned;
- }
- }
-
- return false;
- }
-
- /**
- * Add a callback method to parse a date
- *
- * @final
- * @access public
- * @param callback $callback
- */
- public function add_callback($callback)
- {
- if (is_callable($callback))
- {
- $this->user[] = $callback;
- }
- else
- {
- trigger_error('User-supplied function must be a valid callback', E_USER_WARNING);
- }
- }
-
- /**
- * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as
- * well as allowing any of upper or lower case "T", horizontal tabs, or
- * spaces to be used as the time seperator (including more than one))
- *
- * @access protected
- * @return int Timestamp
- */
- public function date_w3cdtf($date)
- {
- static $pcre;
- if (!$pcre)
- {
- $year = '([0-9]{4})';
- $month = $day = $hour = $minute = $second = '([0-9]{2})';
- $decimal = '([0-9]*)';
- $zone = '(?:(Z)|([+\-])([0-9]{1,2}):?([0-9]{1,2}))';
- $pcre = '/^' . $year . '(?:-?' . $month . '(?:-?' . $day . '(?:[Tt\x09\x20]+' . $hour . '(?::?' . $minute . '(?::?' . $second . '(?:.' . $decimal . ')?)?)?' . $zone . ')?)?)?$/';
- }
- if (preg_match($pcre, $date, $match))
- {
- /*
- Capturing subpatterns:
- 1: Year
- 2: Month
- 3: Day
- 4: Hour
- 5: Minute
- 6: Second
- 7: Decimal fraction of a second
- 8: Zulu
- 9: Timezone ±
- 10: Timezone hours
- 11: Timezone minutes
- */
-
- // Fill in empty matches
- for ($i = count($match); $i <= 3; $i++)
- {
- $match[$i] = '1';
- }
-
- for ($i = count($match); $i <= 7; $i++)
- {
- $match[$i] = '0';
- }
-
- // Numeric timezone
- if (isset($match[9]) && $match[9] !== '')
- {
- $timezone = $match[10] * 3600;
- $timezone += $match[11] * 60;
- if ($match[9] === '-')
- {
- $timezone = 0 - $timezone;
- }
- }
- else
- {
- $timezone = 0;
- }
-
- // Convert the number of seconds to an integer, taking decimals into account
- $second = round($match[6] + $match[7] / pow(10, strlen($match[7])));
-
- return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone;
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Remove RFC822 comments
- *
- * @access protected
- * @param string $data Data to strip comments from
- * @return string Comment stripped string
- */
- public function remove_rfc2822_comments($string)
- {
- $string = (string) $string;
- $position = 0;
- $length = strlen($string);
- $depth = 0;
-
- $output = '';
-
- while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
- {
- $output .= substr($string, $position, $pos - $position);
- $position = $pos + 1;
- if ($string[$pos - 1] !== '\\')
- {
- $depth++;
- while ($depth && $position < $length)
- {
- $position += strcspn($string, '()', $position);
- if ($string[$position - 1] === '\\')
- {
- $position++;
- continue;
- }
- elseif (isset($string[$position]))
- {
- switch ($string[$position])
- {
- case '(':
- $depth++;
- break;
-
- case ')':
- $depth--;
- break;
- }
- $position++;
- }
- else
- {
- break;
- }
- }
- }
- else
- {
- $output .= '(';
- }
- }
- $output .= substr($string, $position);
-
- return $output;
- }
-
- /**
- * Parse RFC2822's date format
- *
- * @access protected
- * @return int Timestamp
- */
- public function date_rfc2822($date)
- {
- static $pcre;
- if (!$pcre)
- {
- $wsp = '[\x09\x20]';
- $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)';
- $optional_fws = $fws . '?';
- $day_name = $this->day_pcre;
- $month = $this->month_pcre;
- $day = '([0-9]{1,2})';
- $hour = $minute = $second = '([0-9]{2})';
- $year = '([0-9]{2,4})';
- $num_zone = '([+\-])([0-9]{2})([0-9]{2})';
- $character_zone = '([A-Z]{1,5})';
- $zone = '(?:' . $num_zone . '|' . $character_zone . ')';
- $pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i';
- }
- if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match))
- {
- /*
- Capturing subpatterns:
- 1: Day name
- 2: Day
- 3: Month
- 4: Year
- 5: Hour
- 6: Minute
- 7: Second
- 8: Timezone ±
- 9: Timezone hours
- 10: Timezone minutes
- 11: Alphabetic timezone
- */
-
- // Find the month number
- $month = $this->month[strtolower($match[3])];
-
- // Numeric timezone
- if ($match[8] !== '')
- {
- $timezone = $match[9] * 3600;
- $timezone += $match[10] * 60;
- if ($match[8] === '-')
- {
- $timezone = 0 - $timezone;
- }
- }
- // Character timezone
- elseif (isset($this->timezone[strtoupper($match[11])]))
- {
- $timezone = $this->timezone[strtoupper($match[11])];
- }
- // Assume everything else to be -0000
- else
- {
- $timezone = 0;
- }
-
- // Deal with 2/3 digit years
- if ($match[4] < 50)
- {
- $match[4] += 2000;
- }
- elseif ($match[4] < 1000)
- {
- $match[4] += 1900;
- }
-
- // Second is optional, if it is empty set it to zero
- if ($match[7] !== '')
- {
- $second = $match[7];
- }
- else
- {
- $second = 0;
- }
-
- return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Parse RFC850's date format
- *
- * @access protected
- * @return int Timestamp
- */
- public function date_rfc850($date)
- {
- static $pcre;
- if (!$pcre)
- {
- $space = '[\x09\x20]+';
- $day_name = $this->day_pcre;
- $month = $this->month_pcre;
- $day = '([0-9]{1,2})';
- $year = $hour = $minute = $second = '([0-9]{2})';
- $zone = '([A-Z]{1,5})';
- $pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i';
- }
- if (preg_match($pcre, $date, $match))
- {
- /*
- Capturing subpatterns:
- 1: Day name
- 2: Day
- 3: Month
- 4: Year
- 5: Hour
- 6: Minute
- 7: Second
- 8: Timezone
- */
-
- // Month
- $month = $this->month[strtolower($match[3])];
-
- // Character timezone
- if (isset($this->timezone[strtoupper($match[8])]))
- {
- $timezone = $this->timezone[strtoupper($match[8])];
- }
- // Assume everything else to be -0000
- else
- {
- $timezone = 0;
- }
-
- // Deal with 2 digit year
- if ($match[4] < 50)
- {
- $match[4] += 2000;
- }
- else
- {
- $match[4] += 1900;
- }
-
- return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Parse C99's asctime()'s date format
- *
- * @access protected
- * @return int Timestamp
- */
- public function date_asctime($date)
- {
- static $pcre;
- if (!$pcre)
- {
- $space = '[\x09\x20]+';
- $wday_name = $this->day_pcre;
- $mon_name = $this->month_pcre;
- $day = '([0-9]{1,2})';
- $hour = $sec = $min = '([0-9]{2})';
- $year = '([0-9]{4})';
- $terminator = '\x0A?\x00?';
- $pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i';
- }
- if (preg_match($pcre, $date, $match))
- {
- /*
- Capturing subpatterns:
- 1: Day name
- 2: Month
- 3: Day
- 4: Hour
- 5: Minute
- 6: Second
- 7: Year
- */
-
- $month = $this->month[strtolower($match[2])];
- return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]);
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Parse dates using strtotime()
- *
- * @access protected
- * @return int Timestamp
- */
- public function date_strtotime($date)
- {
- $strtotime = strtotime($date);
- if ($strtotime === -1 || $strtotime === false)
- {
- return false;
- }
- else
- {
- return $strtotime;
- }
- }
-}
-
-/**
- * Content-type sniffing
- *
- * Based on the rules in http://tools.ietf.org/html/draft-abarth-mime-sniff-06
- *
- * This is used since we can't always trust Content-Type headers, and is based
- * upon the HTML5 parsing rules.
- *
- *
- * This class can be overloaded with {@see SimplePie::set_content_type_sniffer_class()}
- *
- * @package SimplePie
- * @subpackage HTTP
- */
-class SimplePie_Content_Type_Sniffer
-{
- /**
- * File object
- *
- * @var SimplePie_File
- */
- var $file;
-
- /**
- * Create an instance of the class with the input file
- *
- * @param SimplePie_Content_Type_Sniffer $file Input file
- */
- public function __construct($file)
- {
- $this->file = $file;
- }
-
- /**
- * Get the Content-Type of the specified file
- *
- * @return string Actual Content-Type
- */
- public function get_type()
- {
- if (isset($this->file->headers['content-type']))
- {
- if (!isset($this->file->headers['content-encoding'])
- && ($this->file->headers['content-type'] === 'text/plain'
- || $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1'
- || $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1'
- || $this->file->headers['content-type'] === 'text/plain; charset=UTF-8'))
- {
- return $this->text_or_binary();
- }
-
- if (($pos = strpos($this->file->headers['content-type'], ';')) !== false)
- {
- $official = substr($this->file->headers['content-type'], 0, $pos);
- }
- else
- {
- $official = $this->file->headers['content-type'];
- }
- $official = trim(strtolower($official));
-
- if ($official === 'unknown/unknown'
- || $official === 'application/unknown')
- {
- return $this->unknown();
- }
- elseif (substr($official, -4) === '+xml'
- || $official === 'text/xml'
- || $official === 'application/xml')
- {
- return $official;
- }
- elseif (substr($official, 0, 6) === 'image/')
- {
- if ($return = $this->image())
- {
- return $return;
- }
- else
- {
- return $official;
- }
- }
- elseif ($official === 'text/html')
- {
- return $this->feed_or_html();
- }
- else
- {
- return $official;
- }
- }
- else
- {
- return $this->unknown();
- }
- }
-
- /**
- * Sniff text or binary
- *
- * @return string Actual Content-Type
- */
- public function text_or_binary()
- {
- if (substr($this->file->body, 0, 2) === "\xFE\xFF"
- || substr($this->file->body, 0, 2) === "\xFF\xFE"
- || substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF"
- || substr($this->file->body, 0, 3) === "\xEF\xBB\xBF")
- {
- return 'text/plain';
- }
- elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body))
- {
- return 'application/octect-stream';
- }
- else
- {
- return 'text/plain';
- }
- }
-
- /**
- * Sniff unknown
- *
- * @return string Actual Content-Type
- */
- public function unknown()
- {
- $ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20");
- if (strtolower(substr($this->file->body, $ws, 14)) === 'file->body, $ws, 5)) === 'file->body, $ws, 7)) === ' {/if}
diff --git a/sources/templates/marigolds/css/style.css b/sources/templates/marigolds/css/style.css
deleted file mode 100755
index d1cea05..0000000
--- a/sources/templates/marigolds/css/style.css
+++ /dev/null
@@ -1,812 +0,0 @@
-/* =============================================================================
- HTML5 Boilerplate CSS: h5bp.com/css
- ========================================================================== */
-
-article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
-audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; }
-audio:not([controls]) { display: none; }
-[hidden] { display: none; }
-
-html { font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
-html, button, input, select, textarea { font-family: sans-serif; color: #222; }
-body { margin: 0; font-size: 1em; line-height: 1.4; }
-
-::-moz-selection { background: #fe57a1; color: #fff; text-shadow: none; }
-::selection { background: #fe57a1; color: #fff; text-shadow: none; }
-
-a { color: #00e; }
-a:visited { color: #551a8b; }
-a:hover { color: #06e; }
-
-
-
-
-a:focus { outline: thin dotted; }
-a:hover, a:active { outline: 0; }
-
-abbr[title] { border-bottom: 1px dotted; }
-b, strong { font-weight: bold; }
-blockquote { margin: 1em 40px; }
-dfn { font-style: italic; }
-hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
-ins { background: #ff9; color: #000; text-decoration: none; }
-mark { background: #ff0; color: #000; font-style: italic; font-weight: bold; }
-pre, code, kbd, samp { font-family: monospace, serif; _font-family: 'courier new', monospace; font-size: 1em; }
-pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; }
-q { quotes: none; }
-q:before, q:after { content: ""; content: none; }
-small { font-size: 85%; }
-
-sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }
-sup { top: -0.5em; }
-sub { bottom: -0.25em; }
-
-ul, ol { margin: 1em 0; padding: 0 0 0 40px; }
-dd { margin: 0 0 0 40px; }
-nav ul, nav ol { list-style: none; list-style-image: none; margin: 0; padding: 0; }
-
-img { border: 0; -ms-interpolation-mode: bicubic; vertical-align: middle; }
-
-svg:not(:root) { overflow: hidden; }
-
-figure { margin: 0; }
-
-form { margin: 0; }
-fieldset { border: 1px solid #CCCCCC; margin: 0; padding: 5px; }
-label { cursor: pointer; }
-legend { border: 0; *margin-left: -7px; padding: 5px; white-space: normal; }
-button, input, select, textarea { font-size: 100%; margin: 0; vertical-align: baseline; *vertical-align: middle; }
-button, input { line-height: normal; }
-button, input[type="button"], input[type="reset"], input[type="submit"] { cursor: pointer; -webkit-appearance: button; *overflow: visible; }
-button[disabled], input[disabled] { cursor: default; }
-input[type="checkbox"], input[type="radio"] { box-sizing: border-box; margin: 0 5px 0 10px; padding: 0; *width: 13px; *height: 13px; }
-input[type="search"] { -webkit-appearance: textfield; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; }
-input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
-button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; }
-textarea { overflow: auto; vertical-align: top; resize: vertical; }
-input:valid, textarea:valid { }
-input:invalid, textarea:invalid { background-color: #f0dddd; }
-
-table { border-collapse: collapse; border-spacing: 0; }
-td { vertical-align: top; }
-
-.chromeframe { margin: 0.2em 0; background: #ccc; color: black; padding: 0.2em 0; }
-
-
-/* ===== Initializr Styles =====================================================
- Author: Jonathan Verrecchia - verekia.com/initializr/responsive-template
- ========================================================================== */
-
-body{ font:16px/26px Helvetica, Helvetica Neue, Arial; }
-
-.wrapper{
- width:96%;
- margin:0 2%;
-}
-
-/* ===================
- ALL: Orange Theme
- =================== */
-
-html, body { position: relative; height: 100%; }
-.global-wrapper {
- min-height: 100%;
- position: relative;
-}
-#header-container{ border-bottom: 5px solid #e44d26; }
-#footer-container{ position: absolute; width: 100%; bottom: 0; border-top: 5px solid #e44d26; }
-#main aside { border-top: 5px solid #e44d26; }
-
-#header-container,
-#footer-container,
-#main aside{
- background:#222222;
-}
-
-#main aside{
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
- border-radius: 10px;
-}
-
-#title{ color:#ffffff; }
-
-::-moz-selection { background: #f16529; color: #fff; text-shadow: none; }
-::selection { background: #f16529; color: #fff; text-shadow: none; }
-
-/* ==============
- MOBILE: Menu
- ============== */
-
-code{
- padding:5px;
- color:#f16529;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
- display:block;
- margin:5px;
- font-size:12px;
- font-family:Courier,Verdana,Arial;
- background:#FFEBE2;
-}
-
-nav a{
- display:block;
- margin-bottom:10px;
- background:#e44d26;
- color:#ffffff;
- text-align:center;
- text-decoration:none;
- font-weight:bold;
-}
-
-nav a.synchronyzeButton{
- cursor:pointer;
- font-size:40px;
-}
-
-nav a:hover, nav a:visited{
- color:#ffffff;
-}
-
-nav a:hover, nav a:visited{
- color:#ffffff;
-}
-
-header a,header a:hover,header a:visited{
- text-decoration:none;
- color:#ffffff;
-}
-
-/* ==============
- MOBILE: Main
- ============== */
-
-#main{
- padding:15px 0 45px;
-}
-
-#main article a.goTopButton{
- background-color:#CECECE;
- border:0px;
- color:#ffffff;
- padding:10px 5px 0px 5px;
- line-height: 5px;
- float:right;
- text-decoration:none;
-}
-
-#main button, .loginBloc button,.button,.readUnreadButton{
- background-color:#f16529;
- border:0px;
- color:#ffffff;
- text-decoration:none;
- padding:3px 8px 3px 8px;
- font-size:10px;
- font-weight:bold;
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
- border-radius: 10px;
- min-width: 35px;
- text-align: center;
-}
-
-.readUnreadButton{
--moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
-
- line-height:20px;
-}
-
-#main aside a.unreadForFolder,#main aside a.readFolder{
-
- background-color:#F16529;
- border:0px;
- color:#ffffff;
- margin:3px 3px 3px 0px;
- font-size:10px;
- font-weight:bold;
- padding:0px 3px 0px 3px;
- line-height: 20px;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
- min-width:55px;
- display:block;
- text-align: center;
- float:right;
-}
-
-#main aside a.readFolder{
- background-color:#222222;
- margin-left:3px;
- min-width: 36px;
- text-align: center;
-}
-
-#main aside ul li h1.folder{
- text-align:left;
- padding-left:5px;
-}
-
-.loginBloc span{
- color:#fff;
- margin-right:5px;
- padding:0;
- display:inline;
-}
-.loginBloc span span{
- font-weight:bold;
-}
-
-#main .aside a button a{
- text-decoration:none;
-}
-
-#main article header.articleHead{
-
- padding:5px;
- background-color:#222222;
- color:#ffffff;
-}
-
-#main article div.articleContent{
-
- margin:10px 0px 0px 0px;
- text-align: justify;
- clear:both;
-}
-
-#main article header h1.articleSection{
- font-size:1em;
- color:#ffffff;
- margin:0px;
- float:left;
- margin-right:10px;
-}
-#main article section h2 a{
- text-decoration:none;
- color: #222222;
- cursor: pointer;
-}
-#main article header h1 a{
- text-decoration:none;
- color: #ffffff;
- cursor: pointer;
-}
-#main article section h2.articleTitle, .preferenceBloc h3{
- margin-bottom:5px;
- font-size:1.1em;
-}
-#main article section h3.articleDetails, .preferenceBloc h4{
- font-size:10px;
- font-weight:normal;
- color:#939393;
- margin:0px;
-}
-#main article section .articleDetails .readUnreadButton,
-#main article section .articleDetails .readUnreadButton:hover
-{
- color: #FFF;
-}
-
-#main article div.articleContent .enclosure{
- color:#F16529;
- display:block;
- font-size: 10px;
-}
-#main article div.articleContent .enclosure h1{
- color:#222222;
- margin:5px 0 0 0;
- font-weight: bold;
- font-size: 12px;
-}
-#main article div.articleContent .enclosure a{
-
- color:#F16529;
- font-size: 10px;
-}
-
-#main article div.articleContent .enclosure span{
- padding:5px 0 5px 0;
- color:#707070;
- font-size: 10px;
-}
-
-
-#main article section img{
- max-width: 100%;
- height: auto;
-}
-#main article section embed,#main article section iframe{
- max-width: 100%;
-
-}
-#main aside ul,#main aside ul li ul{
- padding:0;
- margin:0;
-}
-#main aside ul li ul li{
- list-style-type:none;
- padding:0 5px 0;
- margin:0;
-}
-
-#main aside ul li {
- list-style-type:none;
-}
-#main aside ul li h1 {
- font-size:1em;
- padding:0px;
- margin:3px;
- text-align:center;
- background-color:#666666;
- cursor: pointer;
-}
-
-.favorite:before{
- content: "✰ ";
- font-size: 15px;
- font-weight: bold;
-}
-.favorite{
- margin-right:10px;
- }
-
-.importFrame{
- border:none;
-}
-
-
-.logo{
- background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAwCAYAAAB9sggoAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAB3ZJREFUeNrEWQlMFFcYZpdly3KWq1yGgmIqUA6L1tpIUVugNtGkBmtJGhOjFm2atonYVkQSNZF6kKImLSXUKFGBllgKKFCghKMKuICwqywEEJVzF+RmOZal36MzZBxnz4K85MvOm3fMN//73/f/b5ZnampqslRleHg4eGZmZr1KpeLPzs4+GRoaeujn59eBJrWusTxDiOFBC9e2trba+h2am5v7gsfjvclum5qaymtqaooNDQ1tQlW1JMRQt8LvGKNdBEK/Az6wULtarZ7A/B7ASpC0YUw13d/f/+2qVatScK1cTGJWQDwQDGLbyIPIzcHBwUQsV19HR0elWCzumZiYmLW2thb4+vo6+fv7R1pYWHzC5/M96Em6urqi0PYnJzlCTF+MjY0R7AY6gbmBgQE57u8FPFEPbmxsfAvXtppQU1MTDuLVZCzB6Oio4vDhw25oM2c/yxBSbwB/0ZPS8PDwOIj2bbCQPYPEK6b/FR4DpJjfuXPnPZB7QI+Hdb+mxvCYz+PrsXxWQAIuG4EwdvvmzZudhULhqxs2bBgkdZlMZo8lTcPDFRinhlWl7e3t0WRxgMmQkJAquVx+Dn44QfpjqT+gpjJjzsvXQepj/DwAvgeEXH2CgoJcpqenzfEgx97eXidnZ+cj2HlKSMR9OP9TgUDg6+Dg8DPafkJ3ETB79OjRTIz5m3KlFdRUAp3EQMgbyMflTcBDG3lPT8/X5ncRj6eGz4wcOHDgRGRkZAx23M76+vrdIFlA2kUi0b6GhoaPyAtmZ2crR0ZGblFWM+XiwmcREgEnqGX7UJ+d6u7u7kIryOrVqxVZWVmTlZWVM5hnbuvWrQ9TUlIOQmTLSQcXF5dIyvICyIkYxJ7gt5NrXj6D1A5q2eIpk+tV7OzsnKhLolNzwAgFoi3DcXFxXbDUd1jWDiybG9VXCELdQC82QDF1b445rwCEvPCbBOwwJNzgbdVw6vulpaX3aItxPYCoO/xLBquJQY4WQp6jo6MI9bGLFy9mUPdmniNGPeR9+IhBvOA/5bGxsbmQiSGG6HKWgICASZBQNjc3X6FuqbEpAvr6+tKTkpLGuYjxodz96enpvxlCqqCg4OaWLVvS7t69OwhL0BaSaVluC6xMBeKjhNSrq6tFiApKHx+fW1SXiRcsjXW3JuotkUga2OLJBejUQysrq31kjKWl5T68VAaCshS7LIWIMJc4KxSKFQzxNcPSOtL1U6dOWWLc28DngJCt/OvXrl37FQLriC5ily5d+oUKQ3tbWloKWe1DgDsHOT4hkZub64j2UIjvN21tbenPnj2T0GOxrNnos4aKEAuidg9xzi41NfXqlyja1rGkpITkUybr1q2zdXNzC2c1kw1wCIijdjqRnCAS7LEDg/BA73nHFghMnJycTBDQFwaePHlSip+NFNKYatt07Ngxd4SMisDAwBBNxODE874AjarV0MWecZ3PTBaec24GKSxtW3JychtVJS8+yxTYp0BDVFTUDSh4vyZimzZtmg8hZ8+eJY7MRS6TshZf392UkZFxi1GVcYWkOuRI0vPnz/9KdIprkoiIiI0MvdoFFNAvDuzFLi+bFy+V6l19SGHTyBMSEhqpqgLo0RQrZdCWZoSVAq6JvLy8AmH2UKICIPGIJIoAD3AFrtChDX70gz7EiouLiyYnJ9VsydGUwfrb2Ni8g1ASb29vv4LdCEeewWZJx04+BDITrHjrh58fuVIkjvx/HHPEYJWmqFtX6YOKJj+QwMRSZJfJcHYVR9ZrhnTns56enuzW1tadILMS8CWHEDRf14cUKVVVVaUMUveYpydtOT8JMbuuXbsWsX379t2LfbQjLxwWFnYEIY2On9fps4OuRJGcfqr2799f1N3d3bzYxBAtahikGpmkdGawZDwcUxodHZ2KjFO5mMQuXLhQwJYIQ4iRUlteXj6QmZl5Q58HIsx0Itzc19bn8ePHEsxHJ4jtwLgxxIjzlyFS/YPYKGY2wJqjhASyjSyElHPe3t4HISfxly9fztchqMXMVeHqI9DT8uSt7Pfs2XMVSzAolUof3b59uxUa1G/oEuIE1X369GkJfeYF5P+HGCliOKxNeHj4uK6Orq6uGr9J5OXl5WvzLWOI0WZ/na2T1FsrKMhx1vyUa7BSqRxG1ltNazHwZFGIQUB7oPR/4HINTQL3Rl/YLbW1nOJYUVFRAuFWafMtYy1GyJEcv0rrpAKBkCOMTSNbLWPcatE2B99kCYqZmZk5+15dXV0F4itt3XrC9aUTg3X47KNeYmJiEeOWzkiyJMTIp83ntKa9vTE/P1/O2InKZSEmEomsmfW0tLRCXYL6UogxC8nnSeLJSN+Hlo0YlnJBLnJycor0EdSXQgwnoPmPcOPj4wPHjx8XM/L5zmUlBh2bl4uysrISrnx+2YhBHngkf4uJiSllJQLLS4zoWE1NTRkjn68l32OXnZhQKLQ4c+ZMiTFOb3Ss1KcUFhYWIeu1pKoPYK1pQ+cw+i8bbQUZSDD5XkdVs+gMRNv/T/+LmAHFgfp0mgMMGDMBbwn/FnQwlhQp/wowAPxkPsdZ4yiuAAAAAElFTkSuQmCC) 0 center no-repeat;
- padding-left:60px;
- padding-top:15px;
- height:40px;
- font-size:3em;
- margin:0;
-}
-
-.loginBloc{
- background-color: #222222;
- border-radius: 5px 5px 5px 5px;
- float: none;
- margin: 10px 0px 10px;
- padding: 5px;
- width: auto;
-}
-.loginBloc input{
- width:100px;
- border:none;
- -moz-border-radius: 2px;
- -webkit-border-radius: 2px;
- border-radius: 2px;
- margin-right:1%;
-
-}
-
-#rememberMe span{
- color:#ccc;
- font-size: 10px;
-}
-
-#rememberMe input{
- margin-left: 10px;
- width: 14px;
-}
-
-.logo i{
- font-size:0.7em;
-}
-
-#main aside ul li ul li:hover{
- background-color:#333333;
-}
-
-.feedChip{
- margin-top:9px;
- float:left;
- width:10px;
- height:10px;
- border-left:10px solid;
-}
-
-#main article section {
-
-}
-
-#main article section.eventRead .readUnreadButton {
- /*opacity:0.8;
- -moz-opacity : 0.8;
- -ms-filter: "alpha(opacity=80)";
- */
- background-color: #222222;
-}
-
-#main article section.eventRead,#main article section.eventHightLighted.eventRead{
- background-color: #EBEBEB
-}
-
-#main article section.eventHightLighted{
- background-color: #fbfbfb;
-}
-#main article section.eventSelected,
-.settings article > section{
- box-shadow: 0 0 20px 0 #C2C2C2;
- border-top: 3px solid #F16529;
-}
-#feedTable{
- width:100%;
-}
-#feedTable tr td:first{
- width:70%;
-}
-
-.addBloc{
- margin-left: 40px;
-}
-
-#main.settings aside a {
- font-size: 16px;
-}
-
-.settings article > section:not(:first-child){
- display:none;
-}
-.settings .feedsList {
- margin: 0;
- padding: 0;
- list-style: none;
-}
-.settings .feedListItem {
- clear: right;
-}
-.settings .feedTitle {
- display: inline-block;
- width:45%;
- word-wrap:break-word
-}
-.settings .feedFolder,
-.settings .feedVerbose,
-.settings .feedRename,
-.settings .feedDelete {
- vertical-align: top;
-}
-
-#main.settings .feedAction {
- width: 25%;
- float: right;
-}
-
-#main.settings .feedFolder {
- width: 72%;
-}
-
-#main.settings .feedVerbose {
- min-width: 1em;
- float:left;
-}
-
-.settings .feedButtons {
- float: right;
- width: 28%;
-}
-#main.settings .feedRename,
-#main.settings .feedDelete {
- min-width: 7em;
- width: 48%;
-}
-
-.pointer{
- cursor:pointer;
-}
-
-#main article section a,#main article a{
- color:#F16529;
-}
-
-footer a,#main aside a{
- color:#FFFFFF;
- text-decoration:none;
- font-size:12px;
-}
-
-#main aside a span{
- font-weight:bold;
- font-size:14px;
-}
-
-#main article section{
- border-bottom:1px dashed #cecece;
- padding:5px;
- overflow: hidden;
-}
-
-#main aside{
- color:#ffffff;
- padding:0px 1% 10px;
- margin-bottom: 10px;
-}
-
-#main article section a.underlink, #main article a.underlink,.underlink{
- font-size:9px;
- color:#222222;
- display:block;
- line-height: 9px;
- margin-bottom: 10px;
-}
-
-#footer-container footer p,#footer-container footer{
- color:#ffffff;
- padding:0px;
- margin:0px;
- text-align:center;
- font-size:10px;
-}
-
-#footer-container footer p a,#footer-container footer p a:visited{
- font-size:10px;
- color:#ffffff;
-}
-
-#main article section a.button {
- color:#ffffff;
- font-size:10px;
- font-weight:bold;
- text-decoration:none;
-}
-
-.pluginBloc li,.pluginBloc ul{
- list-style-type: none;
- margin: 0px;
- padding:0px;
-}
-.pluginBloc ul li{
- padding:5px 0 5px 0;
- border-bottom: 1px dotted #cecece;
- margin:0 0 5px 0;
-}
-.pluginBloc ul li ul li{
- padding: 0;
- border-bottom: none;
- margin:0;
-}
-.pluginBloc ul li ul li h4,.pluginBloc ul li ul li code{
- display:inline;
-}
-
-.errorSync{
- background-color:#C94141;
- color:#ffffff;
- padding:5px;
- border-radius:5px;
- margin:10px 0px 10px 0px;
- box-shadow: 0 0 3px 0 #810000;
-}
-
-.errorSync a{
- color:#ffffff;
-}
-
-.sync{
- padding-left:10px;
-}
-
-.sync a{
- color:#f16529;
-}
-
-/* ===============
- ALL: IE Fixes
- =============== */
-
-.ie7 #title{ padding-top:20px; }
-
-
-/* ===== Primary Styles ========================================================
- Author:
- ========================================================================== */
-
-
-
-
-
-
-
-
-
-
-
-/* =============================================================================
- Media Queries
- ========================================================================== */
-
-@media only screen and (min-width: 480px) {
-
-/* ====================
- INTERMEDIATE: Menu
- ==================== */
-
-
-
- nav a{
- float:left;
- width:20%;
- margin:0 1.7%;
- padding:15px 1%;
- margin-bottom:0;
- border-bottom: 5px solid #E44D26;
- }
-
- nav a:hover{
- border-bottom: 5px solid #F7BC79;
- }
-
- nav li:first-child a{ margin-left:0; }
- nav li:last-child a{ margin-right:0; }
-
-/* ========================
- INTERMEDIATE: IE Fixes
- ======================== */
-
- nav ul li{
- display:inline;
- }
- .oldie nav a{
- margin:0 0.7%;
- }
-}
-
-@media only screen and (min-width: 768px) {
- .loginBloc{
- float: left;
- width: 40%;
- margin: 15px 20px 0;
- }
-
-#main{
- padding:30px 0;
- }
-
-/* ====================
- WIDE: CSS3 Effects
- ==================== */
-
- #header-container,
- #main aside{
- -webkit-box-shadow:0 5px 10px #aaa;
- -moz-box-shadow:0 5px 10px #aaa;
- box-shadow:0 5px 10px #aaa;
- }
-
-/* ============
- WIDE: Menu
- ============ */
-
- #title{
- float:left;
- }
-
- nav{
- float:right;
- width:38%;
- }
-
-/* ============
- WIDE: Main
- ============ */
-
- #main article{
- float:left;
- width:67%;
- }
-
- #main #menuBar{
- float:right;
- width:32%;
- }
- #main #menuBar aside{
- padding:5px;
- }
-}
-
-@media only screen and (min-width: 1140px) {
-
-/* ===============
- Maximal Width
- =============== */
-
- .wrapper{
- width:1026px; /* 1140px - 10% for margins */
- margin:0 auto;
- }
-
- #main{
- padding:30px 0;
- }
-
-}
-
-/* =============================================================================
- Non-Semantic Helper Classes
- ========================================================================== */
-
-.ir { display: block; border: 0; text-indent: -999em; overflow: hidden; background-color: transparent; background-repeat: no-repeat; text-align: left; direction: ltr; *line-height: 0; }
-.ir br { display: none; }
-.hidden { display: none !important; visibility: hidden; }
-.visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
-.visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
-.invisible { visibility: hidden; }
-.clearfix:before, .clearfix:after { content: ""; display: table; }
-.clearfix:after { clear: both; }
-.clearfix { *zoom: 1; }
-
-/* =============================================================================
- Print Styles
- ========================================================================== */
-
-@media print {
- * { background: transparent !important; color: black !important; box-shadow:none !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; } /* Black prints faster: h5bp.com/s */
- a, a:visited { text-decoration: underline; }
- a[href]:after { content: " (" attr(href) ")"; }
- abbr[title]:after { content: " (" attr(title) ")"; }
- .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } /* Don't show links for images, or javascript/internal links */
- pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
- thead { display: table-header-group; } /* h5bp.com/t */
- tr, img { page-break-inside: avoid; }
- img { max-width: 100% !important; }
- @page { margin: 0.5cm; }
- p, h2, h3 { orphans: 3; widows: 3; }
- h2, h3 { page-break-after: avoid; }
-}
-
-/* =============================================================================
- Tools
- ========================================================================== */
-.left{
- float:left;
-}
-.right{
- float:right;
-}
-.clear{
- clear:both;
-}
-.hidden{
- display:none;
-}
-.nochip{
- list-style-type: none;
-}
-
-article #loader{
- display: none;
-}
-
-/* =============================================================================
- Help panel
- ========================================================================== */
-#helpPanel {
- background: #333;
- opacity: 0.9;
- filter:alpha(opacity=90); /* For IE8 and earlier */
- color: #fff;
- padding: 20px;
- -webkit-border-radius: 20px;
- -moz-border-radius: 20px;
- border-radius: 20px;
- position: fixed;
- left: 50%;
- top: 50%;
- width: 500px;
- height: 21em;
- margin-top: -200px; /* moitié de la hauteur */
- margin-left: -250px; /* moitié de la largeur */
- z-Index: 1;
- display: none;
-}
-#helpPanel strong {
- color: #ff0;
-}
diff --git a/sources/templates/marigolds/favicon.png b/sources/templates/marigolds/favicon.png
deleted file mode 100755
index cfa2c7a..0000000
Binary files a/sources/templates/marigolds/favicon.png and /dev/null differ
diff --git a/sources/templates/marigolds/footer.html b/sources/templates/marigolds/footer.html
deleted file mode 100755
index d0ef877..0000000
--- a/sources/templates/marigolds/footer.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-{function="Plugin::callJs()"}
-
-