Permalink
Browse files

Push dev 3.7.0 to master (#242)

Push 3.7.0-dev from the dev branch to the master branch 

* [PHP] - Security issue on admin panel (could connect with any username if the password was good)

* [CSS] - minnor fix

* [PHP] - fix for issue 52

* [CSS] - Small change in preferences page (+ light html reformating)

* [PHP][CSS] - Wiki/BBCode parsing made more powerfull

Added some stuff for comments and links inherited from articles

Implemented @BoboTiG 's idea in issue #50 for [code=language] parsing.

* [CSS] - Small change in graphs pages.

* [PHP] - removed personnal email.

* [PHP] - unified the wiki_*() functions for comms and links into new function markup().

Also minor changes + translated some comments to english (the rest remains to do progressively)

* Fix BBCode color

* Simplify RegExp

* [PHP] - Fix for issue #57

* [PHP] - Fix for issue #59

Plus another issue in parse_text_paragraphs() regarding the tbody element.

* Ignore non official themes and addons

* Addons: select the good files

* [SQL] - Added a “bookmark item” function in RSS reader, as per issue #48

WARNING: Do not update from previous version without reading changelog. Databse structure has changed and versions are not compatible.

Use attached file for converting database. (see github.com/timovn/blogotext/)

* [WIP] Remove use of DATE_PREMIER_MESSAGE_BLOG

* [WIP] Calendar uses dynamic dates to determine previous/next months

* Use the proper column

* Add full support for addons

* [addons] PSR-2 compliant + explanations

* Add optional and required keywords

* Restore {style}

* [addon] Check existence of the callback

* [PHP][JS][CSS] - reformated Add-ons code

Created CSS file for addons page; uniformized data-handling (not finished); added Ajax button to one-clic-toggle an addon on or off; added some “fixme“ tags in code.

* [PHP][JS] Few fixes and adjustements on addons

* [PHP] - Ajax: removed some token issues. Tokens are reloaded at page and session, not at each request

The unique-token is secure, but caused some issues if network is slow or requests are fast: tokens could not be reloaded fast enough.

* [PHP] - Partial fix for issue #69 concerning modules

* [PHP][CSS] Print all addon informations

* [PHP] Add addon translation mecanism

* addon tag

relatif à
#70 (comment)

à chaque tag d'un addon trouvé, la fonction en callback est lancée

* [PHP] - Fix for crashing on previsualising a comment

also forgot to remove some JS in admin

Added JS in public theme to scroll to form if some form errors occured (like captcha errors).

* related to commit #72

related to commit #72, but this commit is for /testing.

* [PHP] - On image integration codes, removed “style” attribute (not Blogotexts job to add that)

* Fix Erreur 5867 : SQLSTATE[HY000]: General error: 1 9 values for 8 columns

* [JS] - Small fix for comments activation.

* related to #79

Problème avec la pagination

* Update html.php

* Update html.php

* Update util.php

* Update util.php

* Update html.php

* Update html.php

* Update html.php

* Update html.php

* [SQL] - Pagination bug fix (see pull #80 and issue #79)

* Revert "[SQL] - Pagination bug fix (see pull #80 and issue #79)"

This reverts commit 8899e43.

* [SQL] - Reverting.

* [SQL] - On RSS reader: when deleting old entries, do not delete favs.

* [HTML] - Added HTML integration codes for video and audio files.

* Add Travis CI configuration file

* [PHP] PSR-2 compliant

* Remove hhvm from Travis tests

* Add a failing test for Travis

* Add a failing test for Travis, the return

* Fix Travis script

* Fix Travis test error

* [PHP] Send mail to author at new comment

* [PHP] revert 'more smileys' included from last patch

* Add contributors file

* [PHP] add space before ':'

* [PHP] Remove use of tabulations mixed with spaces

* Fix 'Send mail to author at new comment' was not working beacause not saved

* [PHP] fix several PSR-2 errors on generated PHP files

* [PHP] Proper use of error reporting

* [PHP] Prefer the use of is_file to file_exists

* [PHP] Prefs: display an error when prefs files are not writable (WIP #85)

* [PHP] rename creer_dossier() to create_folder()

* [PHP] Fix #85: new password not taken into account

* [PHP] Code cleanup into fich.php

* Add contributors explanations

* Use the good remote name when updating contributor's repo

* Remove addons folder for future submodule

* Use sumodule for addons

* [PHP] Fix #84

* fix #97 for file upload generated URI (#101)

* Libravatar2 (#102)

* [PHP] Libravatar support. back to gravatar if fail. Fix #98

* [PHP] Forgot new avatar dir

* [PHP] Avastars: use is_file rather than file_exists

* [PHP] Use single quote when double are not needed

* Remove trailing lines (fixes #52)

* Ignore PHAR and avatars files

* Tests: check CSS and JS files too

* [PHP] Remove multiple spaces from langs files

* [PHP] Fix #103: possibility to share a private post

* [PHP] langs: rename lien_article to post_link

* [PHP] langs: rename lien_blog to blog_link (#103)

* Update addons

* [PHP] Homogenize use of header()

* [PHP] Remove debug()

* [PHP] Remove the use of '@', bad practice

* [PHP] Remove useless type="text/javascript"

* [PHP] Replace multiple spaces by only one

* [PHP] Cleanup inc/conv.php

* [PHP] Few optimizations into inc/conv.php

* [PHP] Change few advanced options

* [PHP] Cleanup inc/fich.php

* [PHP] Use integers when needed for GLOBALS options (instead of strings)

* [PHP] Cleanup inc/form.php

* [PHP] Cleanup again

* [PHP] Fix prefenrecnes handling

* [PHP] Huge cleanup

* [CSS] Fix bad comment style

* [PHP] Update version check process

* [PHP] Fix for #79?

* Use official name: BlogoText

* Several fixes

- [PHP] Fix #104 et #105
- [PHP] Fix auth, and improvement
- [PHP] Fix #79: pagination

* [PHP] Fix comment activation

* [PHP] bug fix for #123

* [PHP] Add addons parameters

[PHP] bug fixes: #107, #112, #111

* [PHP] Fix #116: display post list when there is only one too

* [PHP] Fix #118

* [PHP] Fix #121: refactor install process

* [PHP] Fix addon settings

* [PHP] Fix xauthlog generation

* [PHP] Update example comment/link/post (#113)

* [PHP] Update BT version

* [PHP] Addons: add hooks system  (for #120)

* Next version

* Readd addons

* [PHP] Fix #131: addons are disabled by default

* [PHP] Addons params: use integers when we can

* [PHP] Addons params: fix value when integers used

* Update addons

* Update addons

* Update addons

* Add tests and PSR-2 helper in the doc

* Remove CONTRIBUTING.md (moved to the Wiki)

* [PHP] Addon improvements + some refactor (#133, #134)

* [PHP] Fix addon var cache

* [PHP] [WIP] Use BT_ROOT for absoluthe paths

* New contributor: Remrem, thanks!

* BT_ROOT, debug and refactor

- [PHP] RSS feed insanely slow (#145)

* Fix #146: one place for avatars and favicons

* [PHP] Replace includes for requires

* Update license

* [PHP] Better security for all folders

* [PHP] Install: cleanup check processes and allow installation into subfolder

* [PHP] Fix #143: more secure settings files

* [PHP] Unify use of database like files (+ PSR-2 compliant)

* [PHP] [WIP] Smarter addons

* Update addons

* Big changes

* Update addons

* [PHP] Fixes + updates (for #160)

* [PHP] admin: add feeds navigation (fix #145)

* [PHP] Use LOCK_EX for all file_put_contents

* [PHP] Tweak error logging

* [PHP] Enhanced error logging system (fix #164)

* [PHP] Imrpovement + debug

* [PHP] Fix admin graphics when there is no data available

* [PHP] Admin files: fix one integration code and remove duplicate stroke in URL

* [PHP] Admin files: better URL handling (relative and absolute)

* [JS|CSS] Admin graphics: fix hover line (fix #167)

* [PHP] logrotate errors logs (fix #164)

* [HTML] Admin: use versionning when delivering CSS files (partly fix #168)

* #170 #149 #169 #130 ...

* Update addons

* [PHP] Bug fix and improvement

* Fix #165 and #174

* [PHP] Fix wrong EXPIRE_PNG

Nobody is perfect ;)

* [PHP] Fix #172

* Add more filetypes and fix 'logical folders' behavior

* [Freeze #178] admin: index.php

* [Freeze #178] admin: articles.php

* [Freeze #178] admin: ecrire.php

* [CSS] Fix picture scale into post preview

* [Freeze #178] admin: commentaires.php

* [JS] Fix Travis errors

* [Freeze #178] admin: fix Travis error on index.php

* [JS] admin: fix file deletion when there is no pictures

* [Freeze #178] admin: fichiers.php, _dragndrop.ajax.php, _rmfichier.ajax.php

* [Freeze #178] admin: remove template.php

* [Freeze #178] admin: fix post creation

* [Freeze #178] admin: links

* [Freeze #178] admin: authentication process
- password hashing changes (robustness and limitless char count)
- needed to partially check install.php
- fix #132

* Admin: autofocus on inputs (auth, install)

* Admin: remove use of $GLOBALS['files_ext']

* [Freeze #178] admin: install.php

* [Freeze #178] admin: feeds

* [Freeze #178] public: some cleaning and improvements

* Admin: fix month shift when updating one post

* [Freeze #178] admin: preferences

* [Freeze #178] admin: maintenance

* Admin: feeds: fix refresh all process

* [Freeze #178] admin: addons

* [Freeze #178] admin: comments

* Bug fiix for feeds "mark all as read"

* [Freeze #178] admin: bug fixes

* Fix "mark as read" for "all feeds"
* Fix for addons action buttons
* Fix args function in auth

* [Freeze #178] delete unused functions

* [PHP] Fix /var/log creation

Erreur lors de la création de /var/log

* Install: better place to recreate the advanced settings files

petite modification pour recréer le fichier settings-advanced à un moment plus opportun...

* Update addons

* [PHP] One fix into admin/fichiers.php and secure existant folders

* [PHP] Fix installation process

* [PHP] admin, files: fix unsetted picture attrs

* Admin: auth_write_access() creates PSR-2 compliant file

* Addons: create PSR-2 compliant DTB like files

* Addons: invalid behavior with text option (fix #185)

* Admin: change lines writen to the auth log file

* Test for Travis CI

* Revert "Test for Travis CI"

This reverts commit 5c76a8f.

Explanation:

- errors returned by phpcs are not errors;
- the latest phpcs version is broken (2.7.1 for now);
- with the version 2.6.2, it is all right;
- an issue has been opened: squizlabs/PHP_CodeSniffer#1251

* [Freeze #178] add installer

* Admin: display less months on graphics (fix #189)

* Fix Travis checks by using old PHPCS version (2.6.2)

* admin nav:  fix shadow (#196)

* Fix issue #193

* Fix bug on type casting (int) with 32b system (fix #202)

* Add changelog (#178)

* Set and use real admin path (#210)

* Fix chapo escape (#178)

* Remove useless semilicon

* Remove gravatar duplicate class

* Fix graphics display on small devices (#189)

* Light update for README

* Typo in translation

* Fix default theme comment form

* Remove "À propos" link from default them

* Rewords

- catégorie > tag
- précision des mots clés (META)

* Fix #227 Patch cron & boot (#228)

* [WIP] Feed reader arrows are invisble on small screen

* Prevent client stop proccess (fix #227)

* Add test on addon load

* [PHP] Add requirements: intl

* Use CSS for navigation arrows (fix #224)

* CSS improvement for addon page (fix #232)

* fix #232 proposal

* css improvement for addon page

* Fix for CSS arrow

* preparation de la release 3.7

* Links fix (#240)

* Fix #239

Fix #239

* Revert "Fix #239"

This reverts commit 4002c8c.

* Fix for delete links

Fix for delete links

* version number (#241)

préparation du numéro de la version en vue du merge pour master

* remove submodule addons

* add simple addons folder
  • Loading branch information...
remrem committed Apr 15, 2017
1 parent a8f4bea commit f5cc5afea100ea090cde40dc2ce468dd2a722f2b
Showing with 18,849 additions and 14,022 deletions.
  1. +5 −7 .gitignore
  2. 0 .gitmodules
  3. +13 −0 .travis.yml
  4. +45 −0 CHANGELOG.txt
  5. +26 −0 CONTRIBUTORS
  6. +7 −6 LICENSE.txt
  7. +10 −11 README.md
  8. +1 −0 VERSION
  9. +14 −0 addons/README.md
  10. +0 −127 addons/calendrier.php
  11. +0 −76 addons/readmore.php
  12. +33 −63 admin/_dragndrop.ajax.php
  13. +18 −30 admin/_rmfichier.ajax.php
  14. +448 −148 admin/_rss.ajax.php
  15. +145 −0 admin/addon-settings.php
  16. +96 −0 admin/addons.php
  17. +113 −102 admin/articles.php
  18. +64 −79 admin/auth.php
  19. +0 −101 admin/cache/get.php
  20. +218 −201 admin/commentaires.php
  21. +494 −69 admin/ecrire.php
  22. +432 −133 admin/feed.php
  23. +521 −139 admin/fichiers.php
  24. +559 −0 admin/inc/addons.php
  25. +182 −0 admin/inc/auth.php
  26. +32 −0 admin/inc/boot.php
  27. +603 −0 admin/inc/filesystem.php
  28. +295 −0 admin/inc/form.php
  29. +2 −0 admin/inc/index.php
  30. +500 −0 admin/inc/lang/en_en.php
  31. +501 −0 admin/inc/lang/fr_fr.php
  32. +2 −0 admin/inc/lang/index.php
  33. +313 −0 admin/inc/links.php
  34. +87 −0 admin/inc/sqli.php
  35. +198 −0 admin/inc/tpl.php
  36. +180 −188 admin/index.php
  37. +457 −352 admin/install.php
  38. +164 −167 admin/links.php
  39. +5 −10 admin/logout.php
  40. +871 −740 admin/maintenance.php
  41. +533 −28 admin/preferences.php
  42. BIN admin/style/filetypes/ebook.png
  43. +2 −0 admin/style/filetypes/index.php
  44. BIN admin/style/icon.woff
  45. +2 −0 admin/style/index.php
  46. +1,857 −1,418 admin/style/javascript.js
  47. +107 −0 admin/style/style-addons.css
  48. +37 −38 admin/style/style-articles.css
  49. +58 −59 admin/style/style-auth.css
  50. +163 −171 admin/style/style-commentaires.css
  51. +203 −161 admin/style/style-ecrire.css
  52. +93 −81 admin/style/style-graphs.css
  53. +113 −115 admin/style/style-liens.css
  54. +327 −329 admin/style/style-miniatures-files.css
  55. +21 −24 admin/style/style-mobile-lt1100px.css
  56. +168 −175 admin/style/style-mobile-lt700px.css
  57. +311 −313 admin/style/style-mobile-lt850px.css
  58. +41 −33 admin/style/style-preferences.css
  59. +294 −243 admin/style/style-rss.css
  60. +735 −451 admin/style/style-style.css
  61. +10 −8 admin/style/style.css.php
  62. +2 −0 admin/update/index.php
  63. +497 −0 admin/update/update-to-3.7.php
  64. +5 −214 atom.php
  65. +155 −0 favatar.php
  66. +396 −0 feed.php
  67. +648 −0 inc/addons.php
  68. +364 −0 inc/boot.php
  69. +0 −182 inc/comm.php
  70. +0 −108 inc/conf.php
  71. +319 −446 inc/conv.php
  72. +0 −529 inc/fich.php
  73. +99 −0 inc/filesystem.php
  74. +150 −1,025 inc/form.php
  75. +162 −0 inc/hook.php
  76. +195 −334 inc/html.php
  77. +0 −691 inc/imgs.php
  78. +0 −27 inc/inc.php
  79. +1 −14 inc/index.php
  80. +0 −27 inc/lang.php
  81. +0 −474 inc/lang/en_EN.php
  82. +201 −0 inc/lang/en_en.php
  83. +0 −474 inc/lang/fr_FR.php
  84. +201 −0 inc/lang/fr_fr.php
  85. +2 −0 inc/lang/index.php
  86. +482 −867 inc/sqli.php
  87. +397 −294 inc/them.php
  88. +586 −221 inc/util.php
  89. +0 −207 inc/veri.php
  90. +340 −287 index.php
  91. BIN preview.png
  92. +5 −212 rss.php
  93. +2 −0 themes/.gitignore
  94. +0 −67 themes/default/gravatars/get.php
  95. +12 −3 themes/default/list.html
  96. +896 −918 themes/default/style.css
  97. +1 −1 themes/default/template/article.html
  98. +1 −2 themes/default/template/commentaire.html
  99. +1 −2 themes/default/template/post.html
View
@@ -1,14 +1,12 @@
bt_backup/
cache/
.cache/
config/
databases/
files/
img/
error.log
.htaccess
TODO
MAJ.log
DEMO.sqlite
themes/default/gravatars/*.png
themes/default/avatars/*.png
admin/cache/favicons/*.png
admin/cache/gravatar/*.png
admin/cache/avatars/*.png
*.phar
var/
View
No changes.
View
@@ -0,0 +1,13 @@
language: php
php:
- 5.5
- 5.6
- 7.0
- nightly
install:
#- curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
- curl -OL https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.6.2/phpcs.phar
script:
- php phpcs.phar --standard=PSR2 -np --tab-width=4 --encoding=utf-8 .
View
@@ -0,0 +1,45 @@
# Changelog for BlogoText
#
# note : each changes will be start with status :
# - upd, for update or modification
# - add, for addition
# - del, for deletion
# - fix, like an upd but just for fixing an error
# note : each note will be start with "note :"
# note : 1 note by subject
[3.7]
note : This changelog file will not be complete due to the consequent number of changes and the
late implementation of this changelog
note : The 3.7 is the first release after the change of maintainer
note : GitHub moved to https://github.com/BoboTiG/blogotext/
note : GitHub moved to https://github.com/BlogoText/blogotext/
note : you will notice some performance improvement due to the partial rewrite/reorder of the core
note : custom templates don't need any update to stay fonctional, but if you want to use addons, you
must add some addons tags
- add public template tag {tpl_class} wich return content type and informations
- add addon system
- add public template tag {includes.css} and {includes.js} for addons support
- add first release for a log error system
- add favatar.php, will manage external favicon and gravatar
- add valias support
- add vhost partial support
- add some 404 headers, public side
- add updater for an easy transition from 3.4.7 to 3.7
- add new notification system, partially implemented (JS)(admin side)
- add new loader animation, partially implemented (JS)(admin side)
- add new boot system
- add hook system (public side)
- add Send mail to author at new comment
- upd cache folder moved to var/{domain.tld}/cache
- upd cache folder for favicon and gravatar moved to var/cache
- upd rewrite and reorder a lot of file, function (...) in the core (PSR-2 and "english" compliancy)
- upd database scheme, add some fields in database
- upd some security improvement (ini file > php file ...)
- upd auth password hash improvement
- upd for pubilc feeds, rss.php and atom.php merged into feed.php
- upd langs file have been splitted public/admin
- upd add custom user agent for BlogoText
- upd improve performance and fonctionnality for admin feed reader
- upd default template
View
@@ -0,0 +1,26 @@
# Many thanks to all those who helped :)
# (chronologically sorted)
# Nickname, fullname or both <email>
# GitHub or equivalent
# personnal website
Mickaël 'Tiger-222' Schoentgen <contact@tiger-222.fr>
https://github.com/BoboTiG
http://www.tiger-222.fr
Kris <kris@xoofoo.org>
https://github.com/krisxoofoo
https://xoofoo.org
Christophe 'Sbgodin' Henry
https://github.com/Sbgodin
http://sbgodin.fr
Thuban <thuban@yeuxdelibad.net>
https://github.com/B4rb3rouss
http://yeuxdelibad.net/Blog
RemRem
https://github.com/remrem
View
@@ -1,15 +1,16 @@
+-=======================================================================-+
| B L O G O T E X T |
+-=======================================================================-+
| Blogotext is a lightweight PHP-only Blog engine. |
| BlogoText is a lightweight PHP-only Blog engine. |
| |
| (c) 2006 Frederic Nassar. |
| (c) 2010-* Timo van Neerden, AKA Le Hollandais Volant |
| (c) 2010-2016 Timo van Neerden, AKA Le Hollandais Volant |
| (c) 2016-.... Mickaël 'Tiger-222' Schoentgen and the community |
| |
| Blogotext is redistributed under the terms of the X11 / MIT Licence |
| BlogoText is redistributed under the terms of the X11 / MIT Licence |
| http://opensource.org/licenses/MIT |
| |
| Blogotext is based upon others ressources, that are listed below. |
| BlogoText is based upon others ressources, that are listed below. |
| |
+-------------------------------------------------------------------------+
| LINX |
@@ -43,7 +44,7 @@
| (c) 2014 Google Inc |
| |
| These fonts are licensed under a Apache License and included in |
| Blogotext accordingly. |
| BlogoText accordingly. |
| |
+-------------------------------------------------------------------------+
|   FAENZA ICONS |
@@ -56,7 +57,7 @@
| |
| These icons are licensed under a Creative Commons |
| Attribution 3.0 License. |
| http://creativecommons.org/licenses/by/3.0/ |
| http://creativecommons.org/licenses/by/3.0/ |
| |
+-------------------------------------------------------------------------+
| ~ |
View
@@ -1,39 +1,38 @@
# BLOGOTEXT
# BlogoText
---
This is [Blogotext](http://lehollandaisvolant.net/blogotext/), the lightweight SQLite Blog-Engine.
[![Build status](https://travis-ci.org/BlogoText/blogotext.svg?branch=dev)](https://travis-ci.org/BlogoText/blogotext)
(by Timo van Neerden, since 2010)
This is BlogoText, the lightweight SQLite Blog-Engine.
---
## Features
* Blog with comments and RSS feeds
* Links sharing
* RSS Reader
* Images/Files uploading and sharing
* JSON/ZIP/HTML import-export; Wordpress import
* JSON/ZIP/HTML import-export; WordPress import
* Support [Addons](https://github.com/BlogoText/blogotext-addons)
![alt tag](http://lehollandaisvolant.net/blogotext/blogotext-screen.png?3)
![BlogoText screenshot](https://raw.githubusercontent.com/BlogoText/blogotext/dev/preview.png)
---
## Requirements
* PHP >5.5
* SQLite with PDO support (or MySQL with PDO Support)
* A CSS3 / HTML5 compatible Browser (Firefox, Chrome…)
* min 1 Mo disk space (more data = more space needed)
* min 2 Mo disk space (more data = more space needed)
## Recommended PHP-libraries
## Recommended PHP libraries
* GD (for comments icons / favicons);
* cURL (for RSS reader, links sharing, comments icons)
* LibXML (for RSS reader)
* GZip (for zip exporting function)
* Intl
## Installation
* Unzip the downloaded archive file
* Upload folder to your site (eg: to `http://example.com/blog`)
* Upload folder to your site (eg: to `https://example.com/blog`)
* Use your browser to go to your site
* Follow the few steps
View
@@ -0,0 +1 @@
3.7.0
View
@@ -0,0 +1,14 @@
# BlogoText/addons/
Your addons must be placed in this folder.
### Where to find the addons?
Take a look at :
* https://github.com/BlogoText/blogotext-addons
### And ?
* Download the addons that suits you
* Place them in the addons folder of your BlogoText
* Go to the admin interface of your BlogoText ;)
http://-your blog URL-/admin/addons.php
View
@@ -1,127 +0,0 @@
<?php
# *** LICENSE ***
# This file is a addon for BlogoText.
# http://lehollandaisvolant.net/blogotext/
#
# 2016 Timo Van Neerden <timo@neerden.eu>
#
# You can redistribute it under the terms of the MIT / X11 Licence.
#
# *** LICENSE ***
# This plugin replaces the {calendrier} tag in the public template with
# a navigable HTML calendar.
// include this addon
$GLOBALS['addons'][] = array('tag' => '{calendrier}', 'callback_function' => 'addon_calendrier');
// returns HTML <table> calender
function addon_calendrier() {
// article
if ( isset($_GET['d']) and preg_match('#^\d{4}(/\d{2}){5}#', $_GET['d'])) {
$id = substr(str_replace('/', '', $_GET['d']), 0, 14);
$date = substr(get_entry($GLOBALS['db_handle'], 'articles', 'bt_date', $id, 'return'), 0, 8);
$date = ($date <= date('Ymd')) ? $date : date('Ym');
} elseif ( isset($_GET['d']) and preg_match('#^\d{4}/\d{2}(/\d{2})?#', $_GET['d']) ) {
$date = str_replace('/', '', $_GET['d']);
$date = (preg_match('#^\d{6}\d{2}#', $date)) ? substr($date, 0, 8) : substr($date, 0, 6); // avec jour ?
} elseif (isset($_GET['id']) and preg_match('#^\d{14}#', $_GET['id']) ) {
$date = substr($_GET['id'], 0, 8);
} else {
$date = date('Ym');
}
$annee = substr($date, 0, 4);
$ce_mois = substr($date, 4, 2);
$ce_jour = (strlen(substr($date, 6, 2)) == 2) ? substr($date, 6, 2) : '';
$qstring = (isset($_GET['mode']) and !empty($_GET['mode'])) ? 'mode='.htmlspecialchars($_GET['mode']).'&amp;' : '';
$jours_semaine = array(
$GLOBALS['lang']['lu'],
$GLOBALS['lang']['ma'],
$GLOBALS['lang']['me'],
$GLOBALS['lang']['je'],
$GLOBALS['lang']['ve'],
$GLOBALS['lang']['sa'],
$GLOBALS['lang']['di']
);
$premier_jour = mktime('0', '0', '0', $ce_mois, '1', $annee);
$jours_dans_mois = date('t', $premier_jour);
$decalage_jour = date('w', $premier_jour-'1');
$prev_mois = '?'.$qstring.'d='.$annee.'/'.str2($ce_mois-1);
if ($prev_mois == '?'.$qstring.'d='.$annee.'/'.'00') {
$prev_mois = '?'.$qstring.'d='.($annee-'1').'/'.'12';
}
$next_mois = '?'.$qstring.'d='.$annee.'/'.str2($ce_mois+1);
if ($next_mois == '?'.$qstring.'d='.$annee.'/'.'13') {
$next_mois = '?'.$qstring.'d='.($annee+'1').'/'.'01';
}
// On verifie si il y a un ou des articles/liens/commentaire du jour dans le mois courant
$tableau = array();
$mode = ( !empty($_GET['mode']) ) ? $_GET['mode'] : 'blog';
switch($mode) {
case 'comments':
$where = 'commentaires'; break;
case 'links':
$where = 'links'; break;
case 'blog':
default:
$where = 'articles'; break;
}
$tableau = table_list_date($annee.$ce_mois, 1, $where);
$html = '<table id="calendrier">'."\n";
$html .= '<caption>';
if ( $annee.$ce_mois > DATE_PREMIER_MESSAGE_BLOG) {
$html .= '<a href="'.$prev_mois.'">&#171;</a>&nbsp;';
}
// Si on affiche un jour on ajoute le lien sur le mois
$html .= '<a href="?'.$qstring.'d='.$annee.'/'.$ce_mois.'">'.mois_en_lettres($ce_mois).' '.$annee.'</a>';
// On ne peut pas aller dans le futur
if ( ($ce_mois != date('m')) || ($annee != date('Y')) ) {
$html .= '&nbsp;<a href="'.$next_mois.'">&#187;</a>';
}
$html .= '</caption>'."\n".'<tr>'."\n";
if ($decalage_jour > 0) {
for ($i = 0; $i < $decalage_jour; $i++) {
$html .= '<td></td>';
}
}
// Indique le jour consulte
for ($jour = 1; $jour <= $jours_dans_mois; $jour++) {
if ($jour == $ce_jour) {
$class = ' class="active"';
} else {
$class = '';
}
if ( in_array($jour, $tableau) ) {
$lien = '<a href="?'.$qstring.'d='.$annee.'/'.$ce_mois.'/'.str2($jour).'">'.$jour.'</a>';
} else {
$lien = $jour;
}
$html .= '<td'.$class.'>';
$html .= $lien;
$html .= '</td>';
$decalage_jour++;
if ($decalage_jour == 7) {
$decalage_jour = 0;
$html .= '</tr>';
if ($jour < $jours_dans_mois) {
$html .= '<tr>';
}
}
}
if ($decalage_jour > 0) {
for ($i = $decalage_jour; $i < 7; $i++) {
$html .= '<td> </td>';
}
$html .= '</tr>'."\n";
}
$html .= '</table>'."\n";
return $html;
}
Oops, something went wrong.

0 comments on commit f5cc5af

Please sign in to comment.