diff --git a/CHANGELOG.md b/CHANGELOG.md index df08cd2..0e3e583 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,44 @@ +# In beta testing: FlatPress 1.2 "Legato" +[Release info and download](https://github.com/flatpressblog/flatpress/releases/tag/1.2.beta1) +## General +- FlatPress now runs smoothly with PHP 7.4 and PHP 8 +- Performance: Lazy loading for images +- GDPR compatibility: Data of commenters are not stored in cookies any more +- SEO: Added XML sitemap for search engines ([details](https://forum.flatpress.org/viewtopic.php?f=4&t=126)) +- Leggero v2 is default theme (see [#57](https://github.com/flatpressblog/flatpress/issues/57)) +- Leggero v1 is now responsive +- Updated Smarty to release 2.6.31 +- Added [CONTRIBUTORS.md](https://github.com/flatpressblog/flatpress/blob/master/CONTRIBUTORS.md) +## Plugins +- BBCode plugin: + - Added image attribute "loading", default is "lazy" + - Enhanced \[video\] element accepts video URLs for YouTube, Vimeo and Facebook + - Added "mail" tag (replaces the Protected Mail Links plugin) + - Selectboxes of attachments and images in the editor toolbar are sorted by name +- jQuery plugin: Updated jQuery and jQuery UI to their current versions +- CommentCenter plugin is part of the FP standard distribution +- PrettyUrls and Comment Center are activated by default, LastComments and LastCommentsAdmin are not +- Protected Mail Links plugin removed +## Security +- Overhauled v0.812.2 fix for local file inclusion vulnerability ([more details](http://www.guanting.com/security/exploit/information/27269.html)) +- Comments are sanitized properly (see [#62](https://github.com/flatpressblog/flatpress/issues/62)) +- Uploader checks for forbidden files more carefully +- User password isn't hashed with MD5 any more (see [#59](https://github.com/flatpressblog/flatpress/issues/59)) +## Bugfixes +- Mail adresses are accepted in a broader range (see [#48](https://github.com/flatpressblog/flatpress/issues/48)) +- HTTPS URLs in the contact form are now handled correctly (see [#55](https://github.com/flatpressblog/flatpress/issues/55)) +- Fixed redirects after login +- Fixed "syntax error, unexpected '\['" bug, reported [here](https://forum.flatpress.org/viewtopic.php?f=2&t=131) +- Setup sets date and FP version for the freshly created static pages +- Annoying translation error in German language pack fixed +## Translations +- Added French language pack by Marc Thibeault and Dimitri Soufflet, reworked by Gee +- Added Japanese Language Pack by [NORTH HILL WORK STUDIO](https://nhws.localinfo.jp/) +- Added Brazilian Portuguese language pack by randy +- Added Italian language pack by Giacomo Margarito +- Added Spansh language pack by karelv +- Reworked German language pack by Detlef + # 2019-02-22: [FlatPress 1.1 "Da capo"](https://github.com/flatpressblog/flatpress/releases/tag/1.1) ## General - Languages added: Greek, German, Czech (feel free to send in *your* language packs!) @@ -11,7 +52,7 @@ - Footnotes plugin: Usage how-to added - Lightbox plugin: Slimbox version updated, broken overlay fixed ## Security -- Security fix: Possible CSFR attack prevented (see [details](https://www.exploit-db.com/exploits/39870 "exploit-db.com/exploits/39870")) +- Security fix: Possible CSRF attack prevented (see [details](https://www.exploit-db.com/exploits/39870 "exploit-db.com/exploits/39870")) ## Bugfixes - Correct handling of special characters in URLs (see [PR11](https://github.com/flatpressblog/flatpress/pull/11 "Pull request #11")) - HTTPS allowed in comment URLs diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 7e67932..5c50fde 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -4,18 +4,34 @@ FlatPress wouldn't be the great blogging system it is without the help of many v If you think someone's missing here, please let us know. ## The team -FlatPress was initially developed by [Edoardo Vacchi (NoWhereMan)](http://www.nowhereland.it "nowhereland.it"). Edoardo was supported by [Hydra](http://hydra.clans.it/ "hydra.clans.it"), [drudo](https://drudotec.wordpress.com/ "drudotec.wordpress.com"), giulio, [alcor](http://alcor.altervista.org/ "alcor.altervista.org"), and [Tychondriax](http://tychondriax.altervista.org/blog/ "tychondriax.altervista.org").
+FlatPress was initially developed by [Edoardo Vacchi (NoWhereMan)](https://github.com/evacchi "github.com/evacchi"). Edoardo was supported by [Hydra](http://hydra.clans.it/ "hydra.clans.it"), [drudo](https://drudotec.wordpress.com/ "drudotec.wordpress.com"), giulio, [alcor](http://alcor.altervista.org/ "alcor.altervista.org"), and [Tychondriax](http://tychondriax.altervista.org/blog/ "tychondriax.altervista.org").

Since 2018, FlatPress is taken care of by [Arvid Zimmermann](https://arvidzimmermann.de "arvidzimmermann.de"). ## Coding -- [Julian Rademacher](https://moortaube.de/) filed some useful pull requests (and donated his Twitter account [@FlatPress](https://twitter.com/FlatPress)). -- [Matthias Mauch](http://www.aadmm.org/)'s [FP-Patch](http://www.aadmm.org/fp-patch/) initially brought FlatPress to PHP 7. +- Piero VDFN introduced the plugins Comment Center, jQuery, and LightBox2. +- [Fabrix.xm](https://kirgroup.com/) contributed the Media Manager and Last Comments Admin. +- The SEO Meta Tag Info plugin was built by Don Prince. +- [Matthias Mauch](http://www.aadmm.org/)'s [FP-Patch](http://www.aadmm.org/fp-patch/) initially brought FlatPress to PHP 7. Also, he regularly tests FlatPress against new PHP versions. +- The XML sitemap for search engines was [initially introduced](https://www.igorkromin.net/index.php/2013/02/18/adding-a-google-compatible-sitemap-to-flatpress/) by [Igor Kromin](https://www.igorkromin.net/). ## Translation - Brazilian Portuguese: randy - Czech: [Lubomír Ludvík](http://flatpress.cz/) -- French: [Marc Thibeault](https://github.com/MarcThibeault) and Dimitri Soufflet, fixed by Gee -- German: [Matthias Mauch (laborix)](http://www.aadmm.org/) +- French: [Marc Thibeault](https://github.com/MarcThibeault) and Dimitri Soufflet, reworked by Gee +- German: [Matthias Mauch (laborix)](http://www.aadmm.org/), reworked by Detlef - Greek: An unknown, since deleted GitHub user :( +- Italian: Giacomo Margarito - Japanese: [NORTH HILL WORK STUDIO](https://nhws.localinfo.jp/) +- Spanish: karelv + +## Libraries +FlatPress utilizes the following free frameworks and libraries. Thanks to their authors! +- [jQuery](https://jquery.com/) +- [jQuery UI](https://jqueryui.com/) +- [Smarty Template Engine](https://www.smarty.net/) by Monte Ohrt and Uwe Tews +- [BBCode Parser](http://christian-seiler.de/projekte/php/bbcode/) by Christian Seiler +- [SlimBox2](https://www.digitalia.be/software/slimbox2/) by Christophe Beyls + +## Other contributions +- [Julian Rademacher](https://moortaube.de/) generously donated his Twitter account [@FlatPress](https://twitter.com/FlatPress). Also thanks for your useful pull requests! diff --git a/README.md b/README.md index b610bc1..8493620 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ FlatPress is a lightweight, easy-to-set-up blogging engine. Plain and simple, just PHP. No database needed! ## Getting started -Installing and running FlatPress is really easy! +Installing and running FlatPress is really easy: - [Download FlatPress](https://www.flatpress.org/download), unzip, upload - Browse to your web server, run FlatPress installer - Enjoy blogging with FlatPress! diff --git a/admin/main.tpl b/admin/main.tpl old mode 100755 new mode 100644 index bee7da6..729de80 --- a/admin/main.tpl +++ b/admin/main.tpl @@ -1,5 +1,8 @@
- {include file=$admin_resource|default:"admin:$panel/$action"} - + {if isset($action)} + {include file=$admin_resource|default:"admin:$panel/$action"} + {else} + {include file=$admin_resource|default:"admin:$panel"} + {/if}
diff --git a/admin/panels/config/admin.config.tpl b/admin/panels/config/admin.config.tpl old mode 100755 new mode 100644 diff --git a/admin/panels/entry/admin.entry.cats.tpl b/admin/panels/entry/admin.entry.cats.tpl old mode 100755 new mode 100644 diff --git a/admin/panels/entry/admin.entry.list.tpl b/admin/panels/entry/admin.entry.list.tpl old mode 100755 new mode 100644 diff --git a/admin/panels/entry/admin.entry.write.tpl b/admin/panels/entry/admin.entry.write.tpl old mode 100755 new mode 100644 diff --git a/admin/panels/maintain/admin.maintain.tpl b/admin/panels/maintain/admin.maintain.tpl index a2f88eb..7cc79c5 100644 --- a/admin/panels/maintain/admin.maintain.tpl +++ b/admin/panels/maintain/admin.maintain.tpl @@ -50,4 +50,4 @@ - \ No newline at end of file + diff --git a/admin/panels/static/admin.static.write.tpl b/admin/panels/static/admin.static.write.tpl old mode 100755 new mode 100644 diff --git a/admin/panels/uploader/admin.uploader.php b/admin/panels/uploader/admin.uploader.php index 30ec9c9..0d16c3a 100755 --- a/admin/panels/uploader/admin.uploader.php +++ b/admin/panels/uploader/admin.uploader.php @@ -19,7 +19,7 @@ class admin_uploader extends AdminPanel { var $actions = array( 'default' => true ); - + } class admin_uploader_default extends AdminPanelAction { @@ -35,73 +35,208 @@ class admin_uploader_default extends AdminPanelAction { function onupload() { $success = false; - + + /* + * first check if user is logged in + * to prevent remote admin.uploader.php script execution + * + * By testing the admin/main.php made the redirect job + * By direct URL call PHP throw a visible error -> AdminPanel class not found! + * + * 2019-11-23 - laborix + */ + if (!user_loggedin()) { + utils_redirect("login.php"); + die(); + } + if (!file_exists(IMAGES_DIR)) fs_mkdir(IMAGES_DIR); - + if (!file_exists(ATTACHS_DIR)) fs_mkdir(ATTACHS_DIR); - + /* + * Blacklist entries from OWASP and + * https://stackoverflow.com/questions/4166762/php-image-upload-security-check-list + * + * 2019-11-23 - laborix + */ + $blacklist_extensions = array( + 'htaccess', + 'phtml', + 'php', + 'php3', + 'php4', + 'php5', + 'php6', + 'php7', + 'phps', + 'cgi', + 'exe', + 'pl', + 'asp', + 'aspx', + 'shtml', + 'shtm', + 'fcgi', + 'fpl', + 'jsp', + 'htm', + 'html', + 'wml' + ); + $imgs = array( '.jpg', '.gif', '.png', '.jpeg' ); - $forbidden = array( - '.php', - '.php3', - '.php4', - '.php5', - '.php7', - '.phtml' - ); - + // intentionally // I've not put BMPs - + $uploaded_files = array(); - + foreach ($_FILES ["upload"] ["error"] as $key => $error) { - + if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES ["upload"] ["tmp_name"] [$key]; $name = $_FILES ["upload"] ["name"] [$key]; - + $dir = ATTACHS_DIR; - - $ext = strtolower(strrchr($name, '.')); - - if (in_array($ext, $forbidden)) { - $success = false; - continue; + + /* + * second check extension list + * https://stackoverflow.com/questions/4166762/php-image-upload-security-check-list + * + * 2019-11-24 - laborix + */ + + $uploadfilename = strtolower($tmp_name); + + $isForbidden = false; + $deeptest = array(); + $extcount = 0; + $deeptest = explode('.', $uploadfilename); + $extcount = count($deeptest); + + if ($extcount == 1) { + /* + * none extension like .jpg or something else + * + * possible filename = simple-file-without-extension - linux like ok + */ + $isForbidden = false; + } elseif ($extcount == 2) { + /* + * Only one possible extension + * + * possible filename = 1.jpg + * possible filename = admin.uploader.php + * possible filename = .htaccess + * and so on... + */ + $check_ext1 = ""; + $check_ext1 = trim($deeptest [1], "\x00..\x1F"); + if (in_array($check_ext1, $blacklist_extensions)) { + $isForbidden = true; + } else { + $isForbidden = false; + } + } elseif ($extcount > 2) { + /* + * Chekc only the last two possible extensions + * + * Hint: OWASP - Unrestricted File Upload + * + * In Apache, a php file might be executed using the + * double extension technique such as "file.php.jpg" + * when ".jpg" is allowed. + * + * possible filename = 1.PhP.jpg + * possible filename = admin.uploader.php.JPg + * and so on... + */ + $check_ext1 = ""; + $check_ext2 = ""; + $check_ext1 = trim($deeptest [$extcount - 1], "\x00..\x1F"); + if (in_array($check_ext1, $blacklist_extensions)) { + $isForbidden = true; + } else { + $isForbidden = false; + } + /* Test only if first extension check are not in the blacklist */ + if (!$isForbidden) { + $check_ext2 = trim($deeptest [$extcount - 2], "\x00..\x1F"); + if (in_array($check_ext2, $blacklist_extensions)) { + $isForbidden = true; + } else { + $isForbidden = false; + } + } } + /* + * If one blacklisted extension found then + * return with -1 = An error occurred while trying to upload. + */ + if ($isForbidden) { + $this->smarty->assign('success', $success ? 1 : -1); + sess_add('admin_uploader_files', $uploaded_files); + return -1; + } + + /* + * third check extension + * if someone upload a .php file as .gif, .jpg or .txt + * if someone upload a .html file as .gif, .jpg or .txt + * + * 2019-11-24 - laborix + */ + + if (version_compare(PHP_VERSION, '5.3.0') < 0) + return -1; + if (!function_exists('finfo_open')) + return -1; + + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $mime = finfo_file($finfo, $tmp_name); + finfo_close($finfo); + + if (($mime == "text/x-php") || ($mime == "text/html")) { + $this->smarty->assign('success', $success ? 1 : -1); + sess_add('admin_uploader_files', $uploaded_files); + return -1; + } + + $ext = strtolower(strrchr($name, '.')); + if (in_array($ext, $imgs)) { $dir = IMAGES_DIR; } - + $name = sanitize_title(substr($name, 0, -strlen($ext))) . $ext; - + $target = "$dir/$name"; @umask(022); $success = move_uploaded_file($tmp_name, $target); @chmod($target, 0766); - + $uploaded_files [] = $name; - + // one failure will make $success == false :) $success &= $success; } } - + if ($uploaded_files) { $this->smarty->assign('success', $success ? 1 : -1); sess_add('admin_uploader_files', $uploaded_files); } - + return 1; } - + } ?> diff --git a/admin/panels/uploader/admin.uploader.tpl b/admin/panels/uploader/admin.uploader.tpl old mode 100755 new mode 100644 diff --git a/admin/panels/widgets/admin.widgets.default.tpl b/admin/panels/widgets/admin.widgets.default.tpl old mode 100755 new mode 100644 diff --git a/comments.php b/comments.php index ae7dcd8..ec49d39 100644 --- a/comments.php +++ b/comments.php @@ -143,18 +143,11 @@ function comment_validate() { $arr ['version'] = system_ver(); $arr ['name'] = $name; - if (!$loggedin) - setcookie('comment_author_' . COOKIEHASH, $arr ['name'], time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); - if ($email) { ($arr ['email'] = $email); - if (!$loggedin) - setcookie('comment_author_email_' . COOKIEHASH, $arr ['email'], time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); } if ($url) { ($arr ['url'] = ($url)); - if (!$loggedin) - setcookie('comment_author_url_' . COOKIEHASH, $arr ['url'], time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); } $arr ['content'] = $content; @@ -241,13 +234,6 @@ function commentform() { $smarty->assign('values', $_POST); } } - - // Cookies - $smarty->assign('cookie', array( - 'name' => @$_COOKIE ['comment_author_' . COOKIEHASH], - 'email' => @$_COOKIE ['comment_author_email_' . COOKIEHASH], - 'url' => @$_COOKIE ['comment_author_url_' . COOKIEHASH] - )); } ?> diff --git a/defaults.php b/defaults.php index 6d0fff4..290918d 100755 --- a/defaults.php +++ b/defaults.php @@ -1,168 +1,159 @@ parse_string($params); - } elseif (is_array($params)) { - $this->validate_array($params); - } else { - trigger_error("FPDB_QueryParams: parameters were not in a valid form", - E_USER_ERROR); - } - - } - - function pad_date($date) { - - if (is_numeric($date) && strlen($date)<=2){ - return str_pad($date,2,'0', STR_PAD_LEFT); - } - - return null; - - } - - function validate_array($params) { - - global $fp_config; - - if (isset($params['id'])) { - - if (entry_exists($params['id'])) { - $this->id = $params['id']; - } else { - // let it fail - $this->count = 0; - return; - } - - } +class FPDB_QueryParams { - if (isset($params['fullparse'])) { + var $id = null; - $this->fullparse = - is_string($params['fullparse'])? - ($params['fullparse'] != 'false') - : - $params['fullparse']; + var $d = null; - if ($this->fullparse) - $this->comments = true; + var $m = null; - } - - - if (isset($params['y'])) { - $this->y = $this->pad_date($params['y']); - - if ($this->y && isset($params['m'])) { - $this->m = $this->pad_date($params['m']); - - if ($this->m && isset($params['d'])) { - $this->d = $this->pad_date($params['d']); - } - - } - - } - - if (isset($params['random']) && !$this->id) { - $this->random = intval($params['random']); - $this->count = $this->random; - } + var $y = null; - if (isset($params['page'])) { - $this->page = $params['page']; - } else { - $this->page = 1; - } - - if ($this->page<1) { - $this->page=1; - } - - if (isset($params['count'])) { - $this->count = intval($params['count']); - } else { - $this->count = intval($fp_config['general']['maxentries']); - } - - - $this->start = ($this->page - 1) * $this->count; - - - if (isset($params['start'])) { - $this->start = intval($params['start']); - } - - - if (isset($params['category'])) { - $this->category = intval($params['category']); - } + var $start = 0; - if (isset($params['comments'])) { - $this->comments = true; - } - - if (isset($params['exclude'])) { - $this->exclude = intval($params['exclude']); - } - - } - - function parse_string($str) { - $params = utils_kexplode(strtolower($str), ',:', false); + var $count = -1; + + var $random = 0; + + var $category = 0; + + var $exclude = null; + + var $page = 1; + + var $fullparse = false; + + var $comments = false; + + function __construct($params) { + if (is_string($params)) { + $this->parse_string($params); + } elseif (is_array($params)) { $this->validate_array($params); + } else { + trigger_error("FPDB_QueryParams: parameters were not in a valid form", E_USER_ERROR); } - } - class FPDB_Query { - - var $counter = -1; - var $params = null; - var $single = false; - var $pointer = 0; /* pointer points always to NEXT element */ - var $processed = false; - var $ID = 0; /* query id */ - - - var $lastentry = array(null, array()); - var $localcache = array(); - var $nextid = ''; - var $previd = ''; - var $currentid = ''; - var $main_idx = null; - var $secondary_idx = null; - var $walker = null; - - function __construct($params, $ID) { - - global $current_query; - - - $this->params = new FPDB_QueryParams($params); - $this->ID = $ID; - - if ($this->params->id || $this->params->random) { - $this->single = true; - } - - $GLOBALS['current_query'] =& $this; - + function pad_date($date) { + if (is_numeric($date) && strlen($date) <= 2) { + return str_pad($date, 2, '0', STR_PAD_LEFT); } - - function prepare() { - - global $fpdb; - - - $fpdb->init(); - - $this->main_idx =& $fpdb->get_index($this->params->category); - $entry_index =& $this->main_idx; - $this->counter++; + return null; + } - if (!$entry_index) { - $this->params->start = 0; - $this->params->count = 0; - $this->pointer = 0; - return; - } - - if ($this->single || $this->params->random) { - if ($this->params->random>0) { - $this->_get_random_id($entry_index); - } - $this->_prepare_single($entry_index); + function validate_array($params) { + global $fp_config; + + if (isset($params ['id'])) { + + if (entry_exists($params ['id'])) { + $this->id = $params ['id']; } else { - $this->_prepare_list($entry_index); - - if ($this->params->exclude) { - $o =& $fpdb->get_index($this->params->exclude); - if ($o !== false) - $this->secondary_idx =& $o; - } - } - - // force first entry to be loaded: updates count, pointer - $this->peekEntry(); - - - - } - - function _prepare_single(&$entry_index) { - - /* - * this should never happen - */ - if (!$this->params->id) - trigger_error("FPDB: no ID found for query {$this->ID}", E_USER_ERROR); - - $qp =& $this->params; - - $time = entry_idtotime($qp->id); - - // let's get a preceding key in the order relation. - // please notice this is hardcoded to $time+1, since - // order of the indices is not configurable by the user - $prevkey = entry_timetokey($time+1); - - $key = entry_idtokey($qp->id); - #print_r($key); - - #$key = entry_idtokey($qp->id); - if (!($entry_index->has_key($key))){ - #trigger_error("FPDB: no entry found for {$qp->id}", E_USER_WARNING); - $qp->count = 0; + // let it fail + $this->count = 0; return; } + } - // if $includelower = 2 (second parameter) then assumes 'loose' inclusion - // i.e. includes the first key $newkey such as $newkey <= $prevkey - // also, if $prevkey != $newkey then $prevkey := $newkey - - - $this->walker =& $entry_index->walker($prevkey, 2, null, null); - - // since we're searching for $prevkey, i.e. a key preceding the target $id - // in the sequence, if $prevkey becomes equal to $key then it means - // $key is the first post (the last in time) + if (isset($params ['fullparse'])) { - $qp->start = 0; - $qp->count = 1; + $this->fullparse = is_string($params ['fullparse']) ? ($params ['fullparse'] != 'false') : $params ['fullparse']; + + if ($this->fullparse) + $this->comments = true; + } + + if (isset($params ['y'])) { + $this->y = $this->pad_date($params ['y']); + + if ($this->y && isset($params ['m'])) { + $this->m = $this->pad_date($params ['m']); + + if ($this->m && isset($params ['d'])) { + $this->d = $this->pad_date($params ['d']); + } + } + } + + if (isset($params ['random']) && !$this->id) { + $this->random = intval($params ['random']); + $this->count = $this->random; + } + + if (isset($params ['page'])) { + $this->page = $params ['page']; + } else { + $this->page = 1; + } + + if ($this->page < 1) { + $this->page = 1; + } + + if (isset($params ['count'])) { + $this->count = intval($params ['count']); + } else { + $this->count = intval($fp_config ['general'] ['maxentries']); + } + + $this->start = ($this->page - 1) * $this->count; + + if (isset($params ['start'])) { + $this->start = intval($params ['start']); + } + + if (isset($params ['category'])) { + $this->category = intval($params ['category']); + } + + if (isset($params ['comments'])) { + $this->comments = true; + } + + if (isset($params ['exclude'])) { + $this->exclude = intval($params ['exclude']); + } + } + + function parse_string($str) { + $params = utils_kexplode(strtolower($str), ',:', false); + $this->validate_array($params); + } + +} + +class FPDB_Query { + + var $counter = -1; + + var $params = null; + + var $single = false; + + var $pointer = 0; + + /* pointer points always to NEXT element */ + var $processed = false; + + var $ID = 0; + + /* query id */ + var $lastentry = array( + null, + array() + ); + + var $localcache = array(); + + var $nextid = ''; + + var $previd = ''; + + var $currentid = ''; + + var $main_idx = null; + + var $secondary_idx = null; + + var $walker = null; + + function __construct($params, $ID) { + global $current_query; + + $this->params = new FPDB_QueryParams($params); + $this->ID = $ID; + + if ($this->params->id || $this->params->random) { + $this->single = true; + } + + $GLOBALS ['current_query'] = & $this; + } + + function prepare() { + global $fpdb; + + $fpdb->init(); + + $this->main_idx = & $fpdb->get_index($this->params->category); + $entry_index = & $this->main_idx; + + $this->counter++; + + if (!$entry_index) { + $this->params->start = 0; + $this->params->count = 0; $this->pointer = 0; - - if ($prevkey == $key) { - $this->prevkey = null; - if ($this->walker->valid) { - $this->walker->next(); - $this->nextkey = $this->walker->valid? $this->walker->current_key() : null; - } - } else { - $this->prevkey = $prevkey; + return; + } + + if ($this->single || $this->params->random) { + if ($this->params->random > 0) { + $this->_get_random_id($entry_index); + } + $this->_prepare_single($entry_index); + } else { + $this->_prepare_list($entry_index); + + if ($this->params->exclude) { + $o = & $fpdb->get_index($this->params->exclude); + if ($o !== false) + $this->secondary_idx = & $o; + } + } + + // force first entry to be loaded: updates count, pointer + $this->peekEntry(); + } + + function _prepare_single(&$entry_index) { + + /* + * this should never happen + */ + if (!$this->params->id) + trigger_error("FPDB: no ID found for query {$this->ID}", E_USER_ERROR); + + $qp = & $this->params; + + $time = entry_idtotime($qp->id); + + // let's get a preceding key in the order relation. + // please notice this is hardcoded to $time+1, since + // order of the indices is not configurable by the user + $prevkey = entry_timetokey($time + 1); + + $key = entry_idtokey($qp->id); + // print_r($key); + + // $key = entry_idtokey($qp->id); + if (!($entry_index->has_key($key))) { + // trigger_error("FPDB: no entry found for {$qp->id}", E_USER_WARNING); + $qp->count = 0; + return; + } + + // if $includelower = 2 (second parameter) then assumes 'loose' inclusion + // i.e. includes the first key $newkey such as $newkey <= $prevkey + // also, if $prevkey != $newkey then $prevkey := $newkey + + $this->walker = & $entry_index->walker($prevkey, 2, null, null); + + // since we're searching for $prevkey, i.e. a key preceding the target $id + // in the sequence, if $prevkey becomes equal to $key then it means + // $key is the first post (the last in time) + + $qp->start = 0; + $qp->count = 1; + $this->pointer = 0; + + if ($prevkey == $key) { + $this->prevkey = null; + if ($this->walker->valid) { + $this->walker->next(); + $this->nextkey = $this->walker->valid ? $this->walker->current_key() : null; + } + } else { + $this->prevkey = $prevkey; + if ($this->walker->valid) { + $this->walker->next(); if ($this->walker->valid) { $this->walker->next(); - if ($this->walker->valid) { - $this->walker->next(); - $this->nextkey = $this->walker->valid? $this->walker->current_key() : null; - } + $this->nextkey = $this->walker->valid ? $this->walker->current_key() : null; } } - - - } - - function _prepare_list(&$entry_index) { + } + function _prepare_list(&$entry_index) { + $qp = & $this->params; - $qp =& $this->params; - - $entry_num = 0; - + $entry_num = 0; - if (!$qp->y){ - // searches the whole index - - #$this->local_list = array_keys($entry_index); - $firstid=null; + if (!$qp->y) { + // searches the whole index - $index_count = $entry_index->length(); - $this->walker =& $entry_index->walker($firstid); + // $this->local_list = array_keys($entry_index); + $firstid = null; + $index_count = $entry_index->length(); + $this->walker = & $entry_index->walker($firstid); + } else { + // notice this won't work with cats (for now) + + $obj = new entry_archives($qp->y, $qp->m, $qp->d); + + $filteredkeys = $obj->getList(); + $index_count = $obj->getCount(); + + if ($filteredkeys) { + $error302var1 = entry_idtokey($filteredkeys [0]); + + $this->walker = $entry_index->walker($error302var1, true, entry_idtokey($filteredkeys [$index_count - 1]), true); + } + } + + if ($qp->count < 0) { + + // count<0 means 'all' + $qp->count = $index_count; + } elseif (($qp->start + $qp->count) > $index_count) { + + if ($index_count >= $qp->start) + $qp->count = $index_count - $qp->start; + else + $index_count = $qp->start = $qp->count = 0; + } + } + + // not so great implementation... doesn't work well + function _get_random_id(&$entry_index) { + $qp = & $this->params; + $now = time(); + + $first = '999999999999'; + $last = '000000000000'; + $entry_index->getitem($first, true); + $entry_index->getitem($last, true); + + $t1 = entry_keytotime($first); + $t2 = entry_keytotime($last); + + $t = mt_rand($t2, $t1); + + $random_key = entry_timetokey($t); + $entry_index->getitem($random_key, true); + + $qp->id = entry_keytoid($random_key); + } + + /* reading functions */ + function hasMore() { + $GLOBALS ['current_query'] = & $this; + + // if system init has not been done (filling pointer variable etc.) + // call prepare() + if ($this->counter < 0) { + $this->prepare(); + } + + // hasMore() returns false either if pointer exceeded the count + // or peekEntry returns false + return ((bool) $this->peekEntry() && $this->pointer < $this->params->start + $this->params->count); + } + + function &peekEntry() { + global $post; + + $qp = & $this->params; + $return = array( + false, + false + ); + + if ($this->counter < 0) + $this->prepare(); + + if ($this->pointer == $this->params->start + $this->params->count) + return $return; + + if ($qp->id) { + $idx = $this->main_idx; + $key = entry_idtokey($qp->id); + + $v = $idx->getitem($key); + if ($qp->fullparse) { + $entry = isset($this->localcache [$qp->id]) ? $this->localcache [$qp->id] : entry_parse($qp->id); + if ($entry && $qp->comments) { + $this->comments = new FPDB_CommentList($qp->id, comment_getlist($qp->id)); + $entry ['comments'] = $this->comments->getCount(); + } + + $post = $entry; + + if (!$entry) + return $return; } else { - // notice this won't work with cats (for now) - - $obj = new entry_archives($qp->y, $qp->m, $qp->d); - - $filteredkeys = $obj->getList(); - $index_count = $obj->getCount(); - - if ($filteredkeys) { - $error302var1 = entry_idtokey($filteredkeys[0]); - - $this->walker = $entry_index->walker( - $error302var1, true, - entry_idtokey($filteredkeys[$index_count-1]), true); - } - } - - if ($qp->count < 0) { - - // count<0 means 'all' - $qp->count = $index_count; - - } elseif (($qp->start + $qp->count) > $index_count) { - - if ($index_count >= $qp->start) - $qp->count = $index_count - $qp->start; - else - $index_count = $qp->start = $qp->count = 0; - } - - } - - // not so great implementation... doesn't work well - function _get_random_id(&$entry_index) { - $qp =& $this->params; - $now = time(); - - $first = '999999999999'; - $last = '000000000000'; - $entry_index->getitem($first, true); - $entry_index->getitem($last, true); - - $t1 = entry_keytotime($first); - $t2 = entry_keytotime($last); - - $t = mt_rand($t2, $t1); - - $random_key = entry_timetokey($t); - $entry_index->getitem($random_key, true); - - $qp->id = entry_keytoid($random_key); - } - - /* reading functions */ - - function hasMore() { - - $GLOBALS['current_query'] =& $this; - - // if system init has not been done (filling pointer variable etc.) - // call prepare() - if ($this->counter < 0) { - $this->prepare(); - } - - // hasMore() returns false either if pointer exceeded the count - // or peekEntry returns false - return ((bool) $this->peekEntry() - && $this->pointer < $this->params->start + $this->params->count ); - } - - function &peekEntry() { - - global $post; - - $qp =& $this->params; - $return = array(false, false); - - if ($this->counter < 0) - $this->prepare(); - - if ($this->pointer == $this->params->start + $this->params->count) return $return; - - if ($qp->id) { - $idx = $this->main_idx; - $key = entry_idtokey($qp->id); - - $v = $idx->getitem($key); - if ($qp->fullparse) { - $entry = isset($this->localcache[ $qp->id ]) ? $this->localcache[ $qp->id ] : entry_parse($qp->id); - if ($entry && $qp->comments) { - $this->comments = new FPDB_CommentList($qp->id, comment_getlist($qp->id)); - $entry['comments'] = $this->comments->getCount(); - } - - $post = $entry; - - if (!$entry) return $return; - } else { - $entry = array('subject' => $v); - $post = $entry; - } - - $return = array($this->params->id, $entry); - return $return; - } - - - if (!$this->walker) { - $false = array(false, false); - return $false; - } - - - // search first eligible post - while ($this->walker->valid && $this->pointer<$qp->start) { - - - $this->previd = $this->currentid; - $key = $this->walker->current_key(); - $id = $this->currentid = entry_keytoid($key); - - if ($this->single) - $this->preventry = array('subject' => $this->walker->current_value()); - - - $this->walker->next(); - $this->pointer++; - } - - // if there is a secondary (not) idx - if ($this->secondary_idx) { - - // skips posts until we find one which is not in the secondary idx - while ( $this->walker->valid - && ($key = $this->walker->current_key()) - && $this->secondary_idx->has_key($key)) { - $this->walker->next(); - //$qp->count--; - - } - } - - if (!$this->walker->valid) { - $cont = false; return $cont; - } - - - // pointer == start - - $prevcurr = $this->currentid; - $id = $this->currentid = entry_keytoid($this->walker->current_key()); - if ($id != $prevcurr) $this->previd = $prevcurr; - - - - if ($qp->fullparse && $this->counter <= 0) { - - // full parse: reads the whole array from file - $cont = array(); - - $cont = isset($this->localcache[ $id ]) ? $this->localcache[ $id ] : entry_parse($id); - - - } else { - - // only title - $cont = array( - 'subject' => $this->walker->current_value(), - 'date' => entry_idtotime($id) + $entry = array( + 'subject' => $v ); - + $post = $entry; } - if (!$cont) { - $cont = false; - return $cont; - } - - if ($qp->comments) { - $this->comments = new FPDB_CommentList($id, comment_getlist($id)); - $cont['comments'] = $this->comments->getCount(); - } - - $post = $cont; - $post['id'] = $id; - - $var = array(&$id, &$cont); - return $var; - + $return = array( + $this->params->id, + $entry + ); + return $return; } - - function &getEntry() { - - if (!$this->hasMore()) - return false; - - $var =& $this->peekEntry(); - $this->lastentry = $var; - + + if (!$this->walker) { + $false = array( + false, + false + ); + return $false; + } + + // search first eligible post + while ($this->walker->valid && $this->pointer < $qp->start) { + + $this->previd = $this->currentid; + $key = $this->walker->current_key(); + $id = $this->currentid = entry_keytoid($key); + + if ($this->single) + $this->preventry = array( + 'subject' => $this->walker->current_value() + ); + $this->walker->next(); $this->pointer++; - - return $var; - } - - function getLastEntry() { - return $this->lastentry; - } - - function hasComments() { - return $this->comments->getCount(); - } - - - - function _getOffsetId($offset, $assume_pointer=null) { - if (is_int($assume_pointer)) - $i = $assume_pointer + $offset; - else - $i = $this->pointer + $offset; - return isset($this->local_list [ $i ])? $this->local_list [ $i ] : false; - } - - function _fillCurrentId() { - return $this->currentid = $this->_getOffsetId(0); } - - function _fillNextId() { - return $this->nextid = $this->_getOffsetId(1); - } - - - function _fillPrevId() { - return $this->previd = $this->_getOffsetId(-1); - } - - function getCurrentId() { - return $this->currentid; - } - - function getNextId() { - return $this->nextid; - } - - function getPrevId() { - return $this->previd; - } - - function getNextPage() { - - if ($this->single){ - $key = $this->nextkey; - if (!$key) - return array(null, null); - else { - $val = $this->main_idx->getitem($key); - return array($val, entry_keytoid($key)); - } - - - + // if there is a secondary (not) idx + if ($this->secondary_idx) { + + // skips posts until we find one which is not in the secondary idx + while ($this->walker->valid && ($key = $this->walker->current_key()) && $this->secondary_idx->has_key($key)) { + $this->walker->next(); + // $qp->count--; } - - if ($this->params->page) { - #if ($this->_getOffsetId(0, ($this->params->start + $this->params->count))) - if ($this->walker->valid) - return array($GLOBALS['lang']['main']['nextpage'], $this->params->page + 1); - - } - - } - - function getPrevPage() { - - if ($this->single){ - $key = $this->prevkey; - if (!$key) - return array(null, null); - else { - $val = $this->main_idx->getitem($key); - return array($val, entry_keytoid($key)); - } - - } - - if ($this->params->page > 1) { - return array($GLOBALS['lang']['main']['prevpage'], $this->params->page - 1); - } - + + if (!$this->walker->valid) { + $cont = false; + return $cont; } - - + + // pointer == start + + $prevcurr = $this->currentid; + $id = $this->currentid = entry_keytoid($this->walker->current_key()); + if ($id != $prevcurr) + $this->previd = $prevcurr; + + if ($qp->fullparse && $this->counter <= 0) { + + // full parse: reads the whole array from file + $cont = array(); + + $cont = isset($this->localcache [$id]) ? $this->localcache [$id] : entry_parse($id); + } else { + + // only title + $cont = array( + 'subject' => $this->walker->current_value(), + 'date' => entry_idtotime($id) + ); + } + + if (!$cont) { + $cont = false; + return $cont; + } + + if ($qp->comments) { + $this->comments = new FPDB_CommentList($id, comment_getlist($id)); + $cont ['comments'] = $this->comments->getCount(); + } + + $post = $cont; + $post ['id'] = $id; + + $var = array( + &$id, + &$cont + ); + return $var; } - - - - class FPDB_CommentList { - - var $count = 0; - var $list = array(); - var $current = ''; - var $entryid = ''; - - function __construct($ID, $array) { - - if (is_array($array)) { - $this->list = $array; - $this->count = count($array); - $this->entryid = $ID; - } - - } - - function getCount() { - return $this->count; - } - - function hasMore() { - - if ($this->count) { - return current($this->list) !== false; - } - + + function &getEntry() { + if (!$this->hasMore()) return false; - } - - function &getComment() { - - if (!$this->hasMore()) - return false; - - $id = array_shift($this->list); - - $comment = comment_parse($this->entryid, $id); - $couplet = array(&$id, &$comment); - return $couplet; - - } - + $var = & $this->peekEntry(); + $this->lastentry = $var; + + $this->walker->next(); + $this->pointer++; + + return $var; } - class FPDB { - - var $_indexer = array(); - var $_categories = array(); - var $queries = array(); - - - function __construct() { - // constructor - } - - function init() { - #if (!$this->_indexer) { - #$this->_indexer = new entry_indexer(); - $this->_categories = entry_categories_get(); - #$obj =& $this->_indexer; - #$this->entry_index = $obj->getList(); - - - #} + function getLastEntry() { + return $this->lastentry; + } + + function hasComments() { + return $this->comments->getCount(); + } + + function _getOffsetId($offset, $assume_pointer = null) { + if (is_int($assume_pointer)) + $i = $assume_pointer + $offset; + else + $i = $this->pointer + $offset; + return isset($this->local_list [$i]) ? $this->local_list [$i] : false; + } + + function _fillCurrentId() { + return $this->currentid = $this->_getOffsetId(0); + } + + function _fillNextId() { + return $this->nextid = $this->_getOffsetId(1); + } + + function _fillPrevId() { + return $this->previd = $this->_getOffsetId(-1); + } + + function getCurrentId() { + return $this->currentid; + } + + function getNextId() { + return $this->nextid; + } + + function getPrevId() { + return $this->previd; + } + + function getNextPage() { + if ($this->single) { + $key = $this->nextkey; + if (!$key) + return array( + null, + null + ); + else { + $val = $this->main_idx->getitem($key); + return array( + $val, + entry_keytoid($key) + ); + } } - function &get_index($cat_id = 0) { - if (!isset($this->_indexer[$cat_id])) { - $this->_indexer[$cat_id] =& entry_cached_index($cat_id); - } - return $this->_indexer[$cat_id]; - } - - function reset($queryId=null) { - - switch ($queryId) { - case null: $this->_query = array(); break; - default: unset($this->_query[$queryId]); - } - - - } - - /** - * function query - * @param mixed params - * $params may be an associative array or a query string with the following syntax: - * 'key:val,key:val,key:val'; - * example: $params = 'start:0,count:5';
- * is a convenient way to express - * $params = array('start'=>0,'count'=>5);
- * - * Valid parameters: - * - * start (int) first entry to show (counting from 0 - * to the total number of entries). - * Defaults to 0. - * - * count (int) offset from start (e.g. for the first 5 entries, - * you'll have start=0 and count=5). - * Defaults to $blog_config['MAXENTRIES'] - * - * page (int) page number (counting from 1 to - * n=ceil(num_entries/maxentries_setting)) - * This is a shortcut for setting both start and count - * and overrides them, if they're set too - * - * id (string) entry or static page id - * - * get (string) 'entry' or 'static' defaults to 'entry'. <-- not anymore - * - * y (string) two digit year (06 means 2006) - * m (string) two digit month (06 means June); 'y' must be set - * d (string) two digit for day; 'y' and 'm' must be set - * - * exclude (int) experimental: excludes category ID given as argument from listing - * - * - * fullparse (bool) non-full-parsed entries get their values - * right from the indexed list (or cache). - * These values are 'subject', 'content' and 'categories'. - * If you need any of the other values, you'll need to - * set fullparse=true; defaults to false. - * - */ - - function query($params=array()) { - - static $queryId=-1; - $queryId++; - - $this->queries[$queryId] = new FPDB_Query($params, $queryId); - - - $this->init(); - - return $queryId; - - - } - - function doquery($queryId=0) { - - if (isset($this->queries[$queryId])) { - $q =& $this->queries[$queryId]; - } else { - return false; - trigger_error("FPDB: no such query ID ($queryId)", E_USER_WARNING); - } - - if (!$q) - return false; - - //$this->init(); - - /** - @todo return true/false - */ - return $q->prepare($this->entry_index); - } - - // "get" functions. todo: move out? - - function &getQuery($queryId=0) { - $o = null; - if (isset($this->queries[$queryId])) - $o =& $this->queries[$queryId]; - return $o; + if ($this->params->page) { + // if ($this->_getOffsetId(0, ($this->params->start + $this->params->count))) + if ($this->walker->valid) + return array( + $GLOBALS ['lang'] ['main'] ['nextpage'], + $this->params->page + 1 + ); } } + function getPrevPage() { + if ($this->single) { + $key = $this->prevkey; + if (!$key) + return array( + null, + null + ); + else { + $val = $this->main_idx->getitem($key); + return array( + $val, + entry_keytoid($key) + ); + } + } - class FPDB_transaction { - - var $_index = null; - var $_offset = 0; - var $_nodesize = 30; - var $_keysize = 12; - - function __construct($id_cat=0) { - $this->_index = INDEX_DIR.'index-'.$id_cat; - - $this->_tree = caching_SBPT( - fopen($this->_cachefile.'.dat', 'r'), - fopen($this->_cachefile.'.strings.dat', 'r'), - $this->_offset, - $this->_chunksize, - $this->_keysize + if ($this->params->page > 1) { + return array( + $GLOBALS ['lang'] ['main'] ['prevpage'], + $this->params->page - 1 ); - + } + } + +} + +class FPDB_CommentList { + + var $count = 0; + + var $list = array(); + + var $current = ''; + + var $entryid = ''; + + function __construct($ID, $array) { + if (is_array($array)) { + $this->list = $array; + $this->count = count($array); + $this->entryid = $ID; + } + } + + function getCount() { + return $this->count; + } + + function hasMore() { + if ($this->count) { + return current($this->list) !== false; } + return false; } - - // SMARTY FUNCTIONS ---------------------------------------------------- - - - function smarty_block_entries($params, $content, &$smarty, &$repeat) { - global $fpdb; - - return $content; - - $show = false; - - $smarty->assign('prev_entry_day', ''); - - if ($repeat) { - - if (isset($params['alwaysshow']) && $params['alwaysshow']) { - //$fpdb->doquery(); - $repeat = false; - return $content; - } - - //$show = @$fpdb->doquery(); - + + function &getComment() { + if (!$this->hasMore()) + return false; + + $id = array_shift($this->list); + + $comment = comment_parse($this->entryid, $id); + $couplet = array( + &$id, + &$comment + ); + return $couplet; + } + +} + +class FPDB { + + var $_indexer = array(); + + var $_categories = array(); + + var $queries = array(); + + function __construct() { + // constructor + } + + function init() { + // if (!$this->_indexer) { + // $this->_indexer = new entry_indexer(); + $this->_categories = entry_categories_get(); + // $obj =& $this->_indexer; + // $this->entry_index = $obj->getList(); + + // } + } + + function &get_index($cat_id = 0) { + if (!isset($this->_indexer [$cat_id])) { + $this->_indexer [$cat_id] = & entry_cached_index($cat_id); + } + return $this->_indexer [$cat_id]; + } + + function reset($queryId = null) { + switch ($queryId) { + case null: + $this->_query = array(); + break; + default: + unset($this->_query [$queryId]); + } + } + + /** + * function query + * + * @param + * mixed params + * $params may be an associative array or a query string with the following syntax: + * 'key:val,key:val,key:val'; + * example: $params = 'start:0,count:5';
+ * is a convenient way to express + * $params = array('start'=>0,'count'=>5);
+ * + * Valid parameters: + * + * start (int) first entry to show (counting from 0 + * to the total number of entries). + * Defaults to 0. + * + * count (int) offset from start (e.g. for the first 5 entries, + * you'll have start=0 and count=5). + * Defaults to $blog_config['MAXENTRIES'] + * + * page (int) page number (counting from 1 to + * n=ceil(num_entries/maxentries_setting)) + * This is a shortcut for setting both start and count + * and overrides them, if they're set too + * + * id (string) entry or static page id + * + * get (string) 'entry' or 'static' defaults to 'entry'. <-- not anymore + * + * y (string) two digit year (06 means 2006) + * m (string) two digit month (06 means June); 'y' must be set + * d (string) two digit for day; 'y' and 'm' must be set + * + * exclude (int) experimental: excludes category ID given as argument from listing + * + * + * fullparse (bool) non-full-parsed entries get their values + * right from the indexed list (or cache). + * These values are 'subject', 'content' and 'categories'. + * If you need any of the other values, you'll need to + * set fullparse=true; defaults to false. + * + */ + function query($params = array()) { + static $queryId = -1; + $queryId++; + + $this->queries [$queryId] = new FPDB_Query($params, $queryId); + + $this->init(); + + return $queryId; + } + + function doquery($queryId = 0) { + if (isset($this->queries [$queryId])) { + $q = & $this->queries [$queryId]; } else { - - if (!isset($fpdb->queries[0]->comments) || !$fpdb->queries[0]->comments) - $fpdb->reset(0); - $show = true; - + return false; + trigger_error("FPDB: no such query ID ($queryId)", E_USER_WARNING); } - + + if (!$q) + return false; + + // $this->init(); + + /** + * + * @todo return true/false + */ + return $q->prepare($this->entry_index); + } + + // "get" functions. todo: move out? + function &getQuery($queryId = 0) { + $o = null; + if (isset($this->queries [$queryId])) + $o = & $this->queries [$queryId]; + return $o; + } + +} + +class FPDB_transaction { + + var $_index = null; + + var $_offset = 0; + + var $_nodesize = 30; + + var $_keysize = 12; + + function __construct($id_cat = 0) { + $this->_index = INDEX_DIR . 'index-' . $id_cat; + + $this->_tree = caching_SBPT(fopen($this->_cachefile . '.dat', 'r'), fopen($this->_cachefile . '.strings.dat', 'r'), $this->_offset, $this->_chunksize, $this->_keysize); + } + +} + +// SMARTY FUNCTIONS ---------------------------------------------------- +function smarty_block_entries($params, $content, &$smarty, &$repeat) { + global $fpdb; + + return $content; + + $show = false; + + $smarty->assign('prev_entry_day', ''); + + if ($repeat) { + + if (isset($params ['alwaysshow']) && $params ['alwaysshow']) { + // $fpdb->doquery(); + $repeat = false; + return $content; + } + + // $show = @$fpdb->doquery(); + } else { + + if (!isset($fpdb->queries [0]->comments) || !$fpdb->queries [0]->comments) + $fpdb->reset(0); $show = true; - - - - - if ($show) - return $content; - } - - - function smarty_block_entry($params, $content, &$smarty, &$repeat) { - global $fpdb; - - // clean old variables - - $smarty->assign(array( 'subject'=>'', - 'content'=>'', - 'categories' =>array(), - 'filed_under'=>'', - 'date'=>'', - 'author'=>'', - 'version'=>'', - 'ip-address'=>'' - ) - ); - - - if (isset($params['content']) && is_array($params['content']) && $params['content']) { - //foreach ($params['entry'] as $k => $val) - $smarty->assign($params['content']); - return $content; - } - - if (isset($params['alwaysshow']) && $params['alwaysshow']) { - return $content; - } - - $q =& $fpdb->getQuery(); - - if($repeat=$q->hasMore()) { - - - $couplet =& $q->getEntry() ; - - $id =& $couplet[0]; - $entry =& $couplet[1]; + $show = true; - if (THEME_LEGACY_MODE) { - $entry = theme_entry_filters($entry, $id); - } - - - foreach($entry as $k=>$v) - $smarty->assign_by_ref($k, $entry[$k]); - - $smarty->assign_by_ref('id', $id); + if ($show) + return $content; +} - $smarty->assign('entry_commslock', @in_array('commslock',$entry['categories'])); - - do_action('entry_block', $id); - +function smarty_block_entry($params, $content, &$smarty, &$repeat) { + global $fpdb; + + // clean old variables + + $smarty->assign(array( + 'subject' => '', + 'content' => '', + 'categories' => array(), + 'filed_under' => '', + 'date' => '', + 'author' => '', + 'version' => '', + 'ip-address' => '' + )); + + if (isset($params ['content']) && is_array($params ['content']) && $params ['content']) { + // foreach ($params['entry'] as $k => $val) + $smarty->assign($params ['content']); + return $content; + } + + if (isset($params ['alwaysshow']) && $params ['alwaysshow']) { + return $content; + } + + $q = & $fpdb->getQuery(); + + if ($repeat = $q->hasMore()) { + + $couplet = & $q->getEntry(); + + $id = & $couplet [0]; + $entry = & $couplet [1]; + + if (THEME_LEGACY_MODE) { + $entry = theme_entry_filters($entry, $id); } - + + foreach ($entry as $k => $v) + $smarty->assign_by_ref($k, $entry [$k]); + + $smarty->assign_by_ref('id', $id); + + if (array_key_exists('categories', $entry)) { + $smarty->assign('entry_commslock', in_array('commslock', $entry ['categories'])); + } + + do_action('entry_block', $id); + } + + return $content; +} + +function smarty_block_comment($params, $content, &$smarty, &$repeat) { + global $fpdb; + + // clean old variables + + $smarty->assign(array( + 'subject' => '', + 'content' => '', + 'date' => '', + 'name' => '', + 'url' => '', + 'email' => '', + 'version' => '', + 'ip-address' => '', + 'loggedin' => '' + )); + + $q = & $fpdb->getQuery(); + + if ($repeat = $q->comments->hasMore()) { + + $couplet = & $q->comments->getComment(); + + $id = & $couplet [0]; + $comment = & $couplet [1]; + + foreach ($comment as $k => $v) { + $kk = str_replace('-', '_', $k); + $smarty->assign_by_ref($kk, $comment [$k]); + } + + if (THEME_LEGACY_MODE) { + $comment = theme_comments_filters($comment, $id); + } + + $smarty->assign('id', $id); + } + + return $content; +} + +function smarty_block_comments($params, $content, &$smarty, &$repeat) { + global $fpdb; + + $q = & $fpdb->getQuery(); + $show = $q->comments->getCount(); + $smarty->assign('entryid', $q->comments->entryid); + + if ($show) { return $content; - - } - - - function smarty_block_comment($params, $content, &$smarty, &$repeat) { - global $fpdb; - - // clean old variables - - $smarty->assign(array( - 'subject'=>'', - 'content'=>'', - 'date'=>'', - 'name'=>'', - 'url'=>'', - 'email'=>'', - 'version'=>'', - 'ip-address'=>'', - 'loggedin'=>'', - ) - ); - - $q =& $fpdb->getQuery(); - - if($repeat=$q->comments->hasMore()) { - - $couplet =& $q->comments->getComment(); - - $id =& $couplet[0]; - $comment =& $couplet[1]; + } else { - - foreach($comment as $k=>$v) { - $kk = str_replace('-', '_', $k); - $smarty->assign_by_ref($kk, $comment[$k]); - } - - if (THEME_LEGACY_MODE) { - $comment = theme_comments_filters($comment, $id); - } - - $smarty->assign('id', $id); - - - - } - - - return $content; - - - + $repeat = false; } - - function smarty_block_comments($params, $content, &$smarty, &$repeat) { - global $fpdb; - - $q =& $fpdb->getQuery(); - $show = $q->comments->getCount(); - $smarty->assign('entryid', $q->comments->entryid); - - - if ($show) { - - return $content; - } else { - - $repeat = false; - } +} +function smarty_function_nextpage($params) { + $nextPageLink = get_nextpage_link(); + if (empty($nextPageLink)) { + return; } - - - function smarty_function_nextpage($params) { - - list ($caption, $link) = get_nextpage_link(); - - if (!$link) - return; - - if (isset($params['admin'])) { - $qstr=strstr($link, '?'); - $link = BLOG_BASEURL . 'admin.php' . $qstr; - } - - - return "
$caption
"; - + list ($caption, $link) = $nextPageLink; + + if (!$link) + return; + + if (isset($params ['admin'])) { + $qstr = strstr($link, '?'); + $link = BLOG_BASEURL . 'admin.php' . $qstr; } - function smarty_function_prevpage($params) { + return "
$caption
"; +} - list($caption, $link) = get_prevpage_link(); - - if (!$link) - return; - - if (isset($params['admin'])) { - $qstr=strstr($link, '?'); - $link = BLOG_BASEURL .'admin.php' . $qstr; - } - - - return "
$caption
"; +function smarty_function_prevpage($params) { + $prevPageLink = get_prevpage_link(); + if (empty($prevPageLink)) { + return; + } + list ($caption, $link) = $prevPageLink; + if (!$link) + return; + if (isset($params ['admin'])) { + $qstr = strstr($link, '?'); + $link = BLOG_BASEURL . 'admin.php' . $qstr; } - $_FP_SMARTY->register_block('comment','smarty_block_comment'); - $_FP_SMARTY->register_block('comments','smarty_block_comments'); - $_FP_SMARTY->register_block('comment_block','smarty_block_comments'); - - $_FP_SMARTY->register_block('entries','smarty_block_entries'); - $_FP_SMARTY->register_block('entry_block','smarty_block_entries'); - - $_FP_SMARTY->register_block('entry','smarty_block_entry'); - - $_FP_SMARTY->register_function('nextpage','smarty_function_nextpage'); - $_FP_SMARTY->register_function('prevpage','smarty_function_prevpage'); + return "
$caption
"; +} + +$_FP_SMARTY->register_block('comment', 'smarty_block_comment'); +$_FP_SMARTY->register_block('comments', 'smarty_block_comments'); +$_FP_SMARTY->register_block('comment_block', 'smarty_block_comments'); + +$_FP_SMARTY->register_block('entries', 'smarty_block_entries'); +$_FP_SMARTY->register_block('entry_block', 'smarty_block_entries'); + +$_FP_SMARTY->register_block('entry', 'smarty_block_entry'); + +$_FP_SMARTY->register_function('nextpage', 'smarty_function_nextpage'); +$_FP_SMARTY->register_function('prevpage', 'smarty_function_prevpage'); ?> diff --git a/fp-includes/core/core.plugins.php b/fp-includes/core/core.plugins.php index 29e452c..af67741 100644 --- a/fp-includes/core/core.plugins.php +++ b/fp-includes/core/core.plugins.php @@ -243,8 +243,7 @@ 'title' => $plugin, 'description' => $description, 'author' => $author, - 'version' => $version, - 'template' => $template[1] + 'version' => $version ) ); diff --git a/fp-includes/core/core.system.php b/fp-includes/core/core.system.php index 9bbfc65..34c6883 100755 --- a/fp-includes/core/core.system.php +++ b/fp-includes/core/core.system.php @@ -68,7 +68,7 @@ function system_hashsalt_save($force = false) { return true; } -define('SYSTEM_VER', '1.2.dev'); +define('SYSTEM_VER', '1.2.beta1'); function system_ver() { return 'fp-' . SYSTEM_VER; @@ -216,8 +216,10 @@ function system_geterr($module = '') { /* delayed print */ function system_dpr($action, $content) { $p = print_r($content, 1); - $f = create_function('', "echo '
$p
';"); - add_action($action, $f); + + add_action($action, function () use ($p) { + echo "
$p
"; + }); } ?> diff --git a/fp-includes/core/core.theme.php b/fp-includes/core/core.theme.php index 0592811..a835e27 100644 --- a/fp-includes/core/core.theme.php +++ b/fp-includes/core/core.theme.php @@ -383,7 +383,10 @@ function theme_def_feed_comments_link($str, $feed, $id) { return BLOG_BASEURL . "?x=entry:$id;comments:1;feed:{$feed}"; } -function theme_comments_feed_link($feed = 'rss2', $id) { +function theme_comments_feed_link($feed, $id) { + if (empty($feed)) { + $feed = 'rss2'; + } return apply_filters('post_comments_feed_link', '', $feed, $id); } diff --git a/fp-includes/core/core.users.php b/fp-includes/core/core.users.php index 04a9e70..f8f0580 100755 --- a/fp-includes/core/core.users.php +++ b/fp-includes/core/core.users.php @@ -31,24 +31,39 @@ function user_list() { } function user_pwd($userid, $pwd) { - return wp_hash($userid . $pwd); + return password_hash($userid . $pwd, PASSWORD_DEFAULT); } function user_login($userid, $pwd, $params = null) { global $loggedin; - $loggedin = false; + // get user data $user = user_get($userid); + // user not found? get outta here + if (!isset($user) || !isset($user ['password'])) { + return $loggedin; + } - if (user_pwd($userid, $pwd) == $user ['password']) { - + // check the password + if (password_verify($userid . $pwd, $user ['password'])) { + $loggedin = true; + } // + // for FP instances updated from 1.1 to 1.2: check password the old-fashioned way (with wp_hash() which uses md5) + elseif (wp_hash($userid . $pwd) == $user ['password']) { $loggedin = true; + // re-hash password with current algorithm, ... + $user ['password'] = $pwd; + // ... save in user file ... + user_add($user); + // ... and update user data from re-read user file + $user = user_get($userid); + } + + if ($loggedin) { // session_regenerate_id(); - $expire = time() + 31536000; - setcookie(USER_COOKIE, $userid, $expire, COOKIEPATH, COOKIE_DOMAIN); setcookie(PASS_COOKIE, $user ['password'], $expire, COOKIEPATH, COOKIE_DOMAIN); } @@ -116,5 +131,3 @@ function user_add($user) { return system_save(USERS_DIR . $user ['userid'] . ".php", compact('user')); } - -?> diff --git a/fp-includes/core/core.widgets.php b/fp-includes/core/core.widgets.php index 2363c97..7f3f005 100755 --- a/fp-includes/core/core.widgets.php +++ b/fp-includes/core/core.widgets.php @@ -1,174 +1,142 @@ -_enabledlist = CONFIG_DIR . 'widgets.conf.php'; - $this->getEnableds(); - } - - function getEnableds() { - - if (!file_exists($this->_enabledlist)) - return; - - include($this->_enabledlist); - - $this->_list = ${$this->_varname}; - - } - - function hasMore($hor) { - - return is_array($this->_list[$hor]) && (current($this->_list[$hor]) !== false); - } - - - - function get($hor) { - - global $fp_registered_widgets; - - do { - $content = array(); - - $id = array_shift($this->_list[$hor]); - - $newid=$id;# @list($newid, $params) = explode(":", $id); - if (@$params) $params = explode(',', $params); else $params = array(); - // $var = 'plugin_' . $newid . '_widget'; - $var = $fp_registered_widgets[ $newid ]['func']; - if (is_callable($var)) { - $content = call_user_func_array($var, $params); - if (!isset($content['id'])) { - $content['id'] = "widget-$newid"; - } - } /* - else $content = array( - 'subject' => "Sidebar::Error", - 'content' => "", - ); - */ - - } while(!$content && $id); - - return array_change_key_case($content, CASE_LOWER); - - - - - } - + $this->_enabledlist = CONFIG_DIR . 'widgets.conf.php'; + $this->getEnableds(); } - - - function register_widgetset($widgetset) { - global $fp_registered_widgetsets; - if (!$fp_registered_widgetsets) { - $fp_registered_widgetsets = array(); - } - - if (!in_array($widgetset, $fp_registered_widgetsets)) - $fp_registered_widgetsets[] = $widgetset; - + + function getEnableds() { + if (!file_exists($this->_enabledlist)) + return; + + include ($this->_enabledlist); + + $this->_list = ${$this->_varname}; } - - - - function get_registered_widgetsets($widgetset) { - global $fp_registered_widgetsets; - if (!$fp_registered_widgetsets) { - $fp_registered_widgetsets = array(); - } - - return $fp_registered_widgetsets; + + function hasMore($hor) { + return array_key_exists($hor, $this->_list) && is_array($this->_list [$hor]) && (current($this->_list [$hor]) !== false); } - - - - function register_widget( - $widgetid, // widget id - $widgetname, // name to show - $widget_func, // function/method to call - $num_params = 0, // number of eventually needed parameters - // -1 means optional, - // 0 means no parameters - // each N>0 means *at least* N parameters - - $limit_params_to=array()// indexed array of arrays, containing - // allowed parameters (not impl.) - ) { - + + function get($hor) { global $fp_registered_widgets; - if (!$fp_registered_widgets) - $fp_registered_widgets = array(); - - /* we won't mind about collisions, for now */ - - $fp_registered_widgets[$widgetid] = array( - 'name' => $widgetname, - 'func' => $widget_func, - 'nparams'=> $num_params, - //'needed'=> $params_needed, - 'params'=> $limit_params_to - ); - - } - - - - function get_registered_widgets($widget=null) { - global $fp_registered_widgets; - - if (!$fp_registered_widgets) - $fp_registered_widgets = array(); - - - ksort($fp_registered_widgets); - - if ($widget) - return isset($fp_registered_widgets[$widget])? - $fp_registered_widgets[$widget] - : - false; - - return $fp_registered_widgets; - + + do { + $content = array(); + + $id = array_shift($this->_list [$hor]); + + $newid = $id; // @list($newid, $params) = explode(":", $id); + if (@$params) + $params = explode(',', $params); + else + $params = array(); + // $var = 'plugin_' . $newid . '_widget'; + $var = $fp_registered_widgets [$newid] ['func']; + if (is_callable($var)) { + $content = call_user_func_array($var, $params); + if (!isset($content ['id'])) { + $content ['id'] = "widget-$newid"; + } + } /* + * else $content = array( + * 'subject' => "Sidebar::Error", + * 'content' => "", + * ); + */ + } while (!$content && $id); + + return array_change_key_case($content, CASE_LOWER); } +} +function register_widgetset($widgetset) { + global $fp_registered_widgetsets; + if (!$fp_registered_widgetsets) { + $fp_registered_widgetsets = array(); + } - function smarty_block_widgets($params, $content, &$smarty, &$repeat) { - global $fp_widgets; - - if($repeat = $fp_widgets->hasMore(($params['pos']))) { - - $entry = $fp_widgets->get(($params['pos'])); - $smarty->assign($entry); - } + if (!in_array($widgetset, $fp_registered_widgetsets)) + $fp_registered_widgetsets [] = $widgetset; +} - return $content; - - } - - - $smarty->register_block('widgets','smarty_block_widgets'); - - +function get_registered_widgetsets($widgetset) { + global $fp_registered_widgetsets; + if (!$fp_registered_widgetsets) { + $fp_registered_widgetsets = array(); + } + + return $fp_registered_widgetsets; +} + +function register_widget($widgetid, // widget id +$widgetname, // name to show +$widget_func, // function/method to call +$num_params = 0, // number of eventually needed parameters + // -1 means optional, + // 0 means no parameters + // each N>0 means *at least* N parameters + + $limit_params_to = array()) // indexed array of arrays, containing + // allowed parameters (not impl.) +{ + global $fp_registered_widgets; + if (!$fp_registered_widgets) + $fp_registered_widgets = array(); + + /* we won't mind about collisions, for now */ + + $fp_registered_widgets [$widgetid] = array( + 'name' => $widgetname, + 'func' => $widget_func, + 'nparams' => $num_params, + // 'needed'=> $params_needed, + 'params' => $limit_params_to + ); +} + +function get_registered_widgets($widget = null) { + global $fp_registered_widgets; + + if (!$fp_registered_widgets) + $fp_registered_widgets = array(); + + ksort($fp_registered_widgets); + + if ($widget) + return isset($fp_registered_widgets [$widget]) ? $fp_registered_widgets [$widget] : false; + + return $fp_registered_widgets; +} + +function smarty_block_widgets($params, $content, &$smarty, &$repeat) { + global $fp_widgets; + + if ($repeat = $fp_widgets->hasMore(($params ['pos']))) { + + $entry = $fp_widgets->get(($params ['pos'])); + $smarty->assign($entry); + } + + return $content; +} + +$smarty->register_block('widgets', 'smarty_block_widgets'); ?> diff --git a/fp-includes/core/core.wp-pluggable-funcs.php b/fp-includes/core/core.wp-pluggable-funcs.php index 2997fc6..bd9fd7e 100755 --- a/fp-includes/core/core.wp-pluggable-funcs.php +++ b/fp-includes/core/core.wp-pluggable-funcs.php @@ -1,488 +1,500 @@ getQuery(); - - list($caption, $id) = call_user_func(array(&$q, 'get'.$nextprev)); - - if (!$id) - return null; - - if ($q->single) { - $link = "?entry={$id}"; - } else { - if ($_SERVER['QUERY_STRING']){ - - if ( strpos($_SERVER['QUERY_STRING'], 'paged')!==false ){ - $link = '?'.preg_replace( - '{paged=[0-9]+}', - "paged={$id}", - $_SERVER['QUERY_STRING'] - ); - } else { - $link = '?' . $_SERVER['QUERY_STRING'] . "&paged={$id}"; - } - $link = str_replace('&', '&', $link); - - } else { - $link = "?paged={$id}"; - } - } - - return array($caption, BLOG_BASEURL . $link); - - } - - if (!function_exists('get_nextpage_link')) : - function get_nextpage_link() { - - global $fpdb; - $q =& $fpdb->getQuery(); - - $a = _get_nextprev_link('NextPage'); - - - if ($q->single) { - $a[0] .= ' » '; - } - - return $a; - - } - endif; - - if (!function_exists('get_prevpage_link')) : - function get_prevpage_link() { - - global $fpdb; - $q =& $fpdb->getQuery(); - - $a = _get_nextprev_link('PrevPage'); - - if ($q->single) { - $a[0] = ' « ' . $a[0]; - } - - return $a; - } - endif; - - - - - function wp_filter_kses($str) { - return $str; - } - - //---------------------------------------------------------------------------- - // WordPress pluggable functions - //---------------------------------------------------------------------------- - - - /* - get_currentuserinfo() - Grabs the information of the current logged in user, if there is one. Essentially a - wrapper for get_userdata(), but it also stores information in global variables. - get_userdata($userid) - Pulls user information for the specified user from the database. - get_userdatabylogin($user_login) - Pulls user information for the specified user from the database. - wp_mail($to, $subject, $message, $headers = '') - A convenient wrapper for PHP's mail function. - wp_login($username, $password, $already_md5 = false) - Returns true if the specified username and password correspond to a registered - user. - auth_redirect() - If a user is not logged in, he or she will be redirected to WordPress' login page before - being allowed to access content on the page from which this function was called. - Upon sucessfully logging in, the user is sent back to the page in question. - wp_redirect($location) - Redirects a browser to the absolute URI specified by the $location parameter. - wp_setcookie($username, $password, $already_md5 = false, $home = - '', $siteurl = '') - Sets the WordPress cookies for a logged in user. See WordPress Cookies. - wp_clearcookie() - Clears the cookies for a logged in user. See WordPress Cookies. - wp_notify_postauthor($comment_id, $comment_type='') - Emails the author of the comment's post the content of the comment specified. - wp_notify_moderator($comment_id) - Informs the administrative email account that the comment specified needs to be - moderated. See General Options SubPanel. - */ - - - -if ( !function_exists('get_currentuserinfo') ) : -function get_currentuserinfo() { -/* global $user_login, $userdata, $user_level, $user_ID, $user_nickname, $user_email, $user_url, $user_pass_md5, $user_identity; - // *** retrieving user's data from cookies and db - no spoofing - - if (isset($_COOKIE['wordpressuser_' . COOKIEHASH])) - $user_login = $_COOKIE['wordpressuser_' . COOKIEHASH]; - $userdata = get_userdatabylogin($user_login); - $user_level = $userdata->user_level; - $user_ID = $userdata->ID; - $user_nickname = $userdata->user_nickname; - $user_email = $userdata->user_email; - $user_url = $userdata->user_url; - $user_pass_md5 = md5($userdata->user_pass); - - $idmode = $userdata->user_idmode; - if ($idmode == 'nickname') $user_identity = $userdata->user_nickname; - if ($idmode == 'login') $user_identity = $userdata->user_login; - if ($idmode == 'firstname') $user_identity = $userdata->user_firstname; - if ($idmode == 'lastname') $user_identity = $userdata->user_lastname; - if ($idmode == 'namefl') $user_identity = $userdata->user_firstname.' '.$userdata->user_lastname; - if ($idmode == 'namelf') $user_identity = $userdata->user_lastname.' '.$userdata->user_firstname; - if (!$idmode) $user_identity = $userdata->user_nickname; -*/ -} -endif; - - - -if ( !function_exists('get_userdata') ) : -function get_userdata($userid) { -/* global $wpdb, $cache_userdata; - $userid = (int) $userid; - if ( empty($cache_userdata[$userid]) && $userid != 0) { - $cache_userdata[$userid] = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID = $userid"); - $cache_userdata[$cache_userdata[$userid]->user_login] =& $cache_userdata[$userid]; - } - - return $cache_userdata[$userid]; -*/ -} -endif; - - - -if ( !function_exists('get_userdatabylogin') ) : -function get_userdatabylogin($user_login) { -/* global $cache_userdata, $wpdb; - if ( !empty($user_login) && empty($cache_userdata[$user_login]) ) { - $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$user_login'"); // todo: get rid of this intermediate var - $cache_userdata[$user->ID] = $user; - $cache_userdata[$user_login] =& $cache_userdata[$user->ID]; - } else { - $user = $cache_userdata[$user_login]; - } - return $user; -*/ -} -endif; - - - -if ( !function_exists('wp_mail') ) : -function wp_mail($to, $subject, $message, $headers = '') { - if( $headers == '' ) { - $headers = "MIME-Version: 1.0\n" . - "From: " . get_settings('admin_email') . "\n" . - "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; - } - - return @mail($to, $subject, $message, $headers); -} -endif; - - - -if ( !function_exists('wp_login') ) : -function wp_login($username, $password, $already_md5 = false) { -/* global $wpdb, $error; - - if ( !$username ) - return false; - - if ( !$password ) { - $error = __('Error: The password field is empty.'); - return false; - } - - $login = $wpdb->get_row("SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'"); - - if (!$login) { - $error = __('Error: Wrong username.'); - return false; - } else { - // If the password is already_md5, it has been double hashed. - // Otherwise, it is plain text. - if ( ($already_md5 && $login->user_login == $username && md5($login->user_pass) == $password) || ($login->user_login == $username && $login->user_pass == md5($password)) ) { - return true; - } else { - $error = __('Error: Incorrect password.'); - $pwd = ''; - return false; - } - } -*/ -} -endif; - -if ( !function_exists('auth_redirect') ) : -function auth_redirect() { - // Checks if a user is logged in, if not redirects them to the login page -/* if ( (!empty($_COOKIE['wordpressuser_' . COOKIEHASH]) && - !wp_login($_COOKIE['wordpressuser_' . COOKIEHASH], $_COOKIE['wordpresspass_' . COOKIEHASH], true)) || - (empty($_COOKIE['wordpressuser_' . COOKIEHASH])) ) { - header('Expires: Wed, 11 Jan 1984 05:00:00 GMT'); - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); - header('Cache-Control: no-cache, must-revalidate, max-age=0'); - header('Pragma: no-cache'); - - header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])); - exit(); - } -*/ -} -endif; - -// Cookie safe redirect. Works around IIS Set-Cookie bug. -// http://support.microsoft.com/kb/q176113/ -if ( !function_exists('wp_redirect') ) : -function wp_redirect($location, $status = 302) { - global $is_IIS; - - $location = apply_filters('wp_redirect', $location, $status); - - if ( !$location ) // allows the wp_redirect filter to cancel a redirect - return false; - - $location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location); - # $location = wp_kses_no_null($location); - - $location = preg_replace('/\0+/', '', $location); - $location = preg_replace('/(\\\\0)+/', '', $location); - - - $strip = array('%0d', '%0a'); - $location = str_replace($strip, '', $location); - - if ( $is_IIS ) { - header("Refresh: 0;url=$location"); - } else { - if ( php_sapi_name() != 'cgi-fcgi' ) - utils_status_header($status); // This causes problems on IIS and some FastCGI setups - header("Location: $location"); - } -} -endif; - - -if ( !function_exists('wp_setcookie') ) : -function wp_setcookie($username, $password, $already_md5 = false, $home = '', $siteurl = '') { - if ( !$already_md5 ) - $password = md5( md5($password) ); // Double hash the password in the cookie. - - if ( empty($home) ) - $cookiepath = COOKIEPATH; - else - $cookiepath = preg_replace('|https?://[^/]+|i', '', $home . '/' ); - - if ( empty($siteurl) ) { - $sitecookiepath = SITECOOKIEPATH; - $cookiehash = COOKIEHASH; - } else { - $sitecookiepath = preg_replace('|https?://[^/]+|i', '', $siteurl . '/' ); - $cookiehash = md5($siteurl); - } - - setcookie('wordpressuser_'. $cookiehash, $username, time() + 31536000, $cookiepath); - setcookie('wordpresspass_'. $cookiehash, $password, time() + 31536000, $cookiepath); - - if ( $cookiepath != $sitecookiepath ) { - setcookie('wordpressuser_'. $cookiehash, $username, time() + 31536000, $sitecookiepath); - setcookie('wordpresspass_'. $cookiehash, $password, time() + 31536000, $sitecookiepath); - } -} -endif; - -if ( !function_exists('wp_clearcookie') ) : -function wp_clearcookie() { - setcookie('wordpressuser_' . COOKIEHASH, ' ', time() - 31536000, COOKIEPATH); - setcookie('wordpresspass_' . COOKIEHASH, ' ', time() - 31536000, COOKIEPATH); - setcookie('wordpressuser_' . COOKIEHASH, ' ', time() - 31536000, SITECOOKIEPATH); - setcookie('wordpresspass_' . COOKIEHASH, ' ', time() - 31536000, SITECOOKIEPATH); -} -endif; - - - -if ( !function_exists('check_admin_referer') ) : -function check_admin_referer($action = -1) { - $adminurl = BLOG_BASEURL . 'admin.php'; - $referer = strtolower(wp_get_referer()); - if ( !wp_verify_nonce(@$_REQUEST['_wpnonce'], $action) && - !(-1 == $action && strstr($referer, $adminurl)) ) { - wp_nonce_ays($action); - die(); - } - do_action('check_admin_referer', $action); -} -endif; - - -if ( !function_exists('wp_verify_nonce') ) : -function wp_verify_nonce($nonce, $action = -1) { - - $user = user_get(); - $uid = $user['userid']; - - $i = ceil(time() / 43200); - - //Allow for expanding range, but only do one check if we can - if( substr(wp_hash($i . $action . $uid), -12, 10) == $nonce || substr(wp_hash(($i - 1) . $action . $uid), -12, 10) == $nonce ) - return true; - return false; -} -endif; - -if ( !function_exists('wp_create_nonce') ) : -function wp_create_nonce($action = -1) { - $user = user_get(); - $uid = $user['userid']; - - $i = ceil(time() / 43200); - - return substr(wp_hash($i . $action . $uid), -12, 10); -} -endif; - -if ( !function_exists('wp_salt') ) : -function wp_salt() { - global $fp_config; - static $salt = null; - if (!$salt) { - @include(HASHSALT_FILE); - if (!$fp_hashsalt) - trigger_error('Cannot load hash salt: reinstall FlatPress', E_USER_ERROR); - - $salt = $fp_hashsalt; - } - return $salt; -} -endif; - -if ( !function_exists('wp_hash') ) : -function wp_hash($data) { - $salt = wp_salt(); - return md5($data . $salt); -} -endif; - - -if ( ! function_exists('wp_notify_postauthor') ) : -function wp_notify_postauthor($comment_id, $comment_type='') { -/* global $wpdb; - - $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); - $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1"); - $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1"); - - if ('' == $user->user_email) return false; // If there's no email to send the comment to - - $comment_author_domain = gethostbyaddr($comment->comment_author_IP); - - $blogname = get_settings('blogname'); - - if ( empty( $comment_type ) ) $comment_type = 'comment'; - - if ('comment' == $comment_type) { - $notify_message = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; - $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; - $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n"; - $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; - $notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n"; - $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; - $notify_message .= __('You can see all comments on this post here: ') . "\r\n"; - $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title ); - } elseif ('trackback' == $comment_type) { - $notify_message = sprintf( __('New trackback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; - $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; - $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; - $notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; - $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n"; - $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title ); - } elseif ('pingback' == $comment_type) { - $notify_message = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; - $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; - $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; - $notify_message .= __('Excerpt: ') . "\r\n" . sprintf( __('[...] %s [...]'), $comment->comment_content ) . "\r\n\r\n"; - $notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n"; - $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title ); - } - $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; - $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; - - if ('' == $comment->comment_author_email || '' == $comment->comment_author) { - $from = "From: \"$blogname\" '; - } else { - $from = 'From: "' . $comment->comment_author . "\" <$comment->comment_author_email>"; - } - - $notify_message = apply_filters('comment_notification_text', $notify_message); - $subject = apply_filters('comment_notification_subject', $subject); - $message_headers = apply_filters('comment_notification_headers', $message_headers); - - $message_headers = "MIME-Version: 1.0\n" - . "$from\n" - . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; - - @wp_mail($user->user_email, $subject, $notify_message, $message_headers); - - return true; -*/ -} -endif; - -/* wp_notify_moderator - notifies the moderator of the blog (usually the admin) - about a new comment that waits for approval - always returns true +/* + * These functions can be replaced via plugins. They are loaded after + * plugins are loaded. */ -if ( !function_exists('wp_notify_moderator') ) : -function wp_notify_moderator($comment_id) { -/* global $wpdb; +function _get_nextprev_link($nextprev) { + global $fpdb; + $q = & $fpdb->getQuery(); - if( get_settings( "moderation_notify" ) == 0 ) - return true; - - $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); - $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1"); + list ($caption, $id) = call_user_func(array( + &$q, + 'get' . $nextprev + )); - $comment_author_domain = gethostbyaddr($comment->comment_author_IP); - $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'"); + if (!$id) + return null; - $notify_message = sprintf( __('A new comment on the post #%1$s "%2$s" is waiting for your approval'), $post->ID, $post->post_title ) . "\r\n"; - $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n"; - $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; - $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n"; - $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; - $notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n"; - $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; - $notify_message .= sprintf( __('To approve this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; - $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; - $notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n"; - $notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n"; + if ($q->single) { + $link = "?entry={$id}"; + } else { + if ($_SERVER ['QUERY_STRING']) { - $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_settings('blogname'), $post->post_title ); - $admin_email = get_settings("admin_email"); + if (strpos($_SERVER ['QUERY_STRING'], 'paged') !== false) { + $link = '?' . preg_replace('{paged=[0-9]+}', "paged={$id}", $_SERVER ['QUERY_STRING']); + } else { + $link = '?' . $_SERVER ['QUERY_STRING'] . "&paged={$id}"; + } + $link = str_replace('&', '&', $link); + } else { + $link = "?paged={$id}"; + } + } - $notify_message = apply_filters('comment_moderation_text', $notify_message); - $subject = apply_filters('comment_moderation_subject', $subject); - - @wp_mail($admin_email, $subject, $notify_message); - - return true; -*/ + return array( + $caption, + BLOG_BASEURL . $link + ); } + +if (!function_exists('get_nextpage_link')) : + + function get_nextpage_link() { + global $fpdb; + $q = & $fpdb->getQuery(); + + $a = _get_nextprev_link('NextPage'); + + if ($q->single) { + $a [0] .= ' » '; + } + + return $a; + } + endif; + +if (!function_exists('get_prevpage_link')) : + + function get_prevpage_link() { + global $fpdb; + $q = & $fpdb->getQuery(); + + $a = _get_nextprev_link('PrevPage'); + + if ($q->single) { + $a [0] = ' « ' . $a [0]; + } + + return $a; + } + endif; + + +function wp_filter_kses($str) { + return $str; +} + +// ---------------------------------------------------------------------------- +// WordPress pluggable functions +// ---------------------------------------------------------------------------- + +/* + * get_currentuserinfo() + * Grabs the information of the current logged in user, if there is one. Essentially a + * wrapper for get_userdata(), but it also stores information in global variables. + * get_userdata($userid) + * Pulls user information for the specified user from the database. + * get_userdatabylogin($user_login) + * Pulls user information for the specified user from the database. + * wp_mail($to, $subject, $message, $headers = '') + * A convenient wrapper for PHP's mail function. + * wp_login($username, $password, $already_md5 = false) + * Returns true if the specified username and password correspond to a registered + * user. + * auth_redirect() + * If a user is not logged in, he or she will be redirected to WordPress' login page before + * being allowed to access content on the page from which this function was called. + * Upon sucessfully logging in, the user is sent back to the page in question. + * wp_redirect($location) + * Redirects a browser to the absolute URI specified by the $location parameter. + * wp_setcookie($username, $password, $already_md5 = false, $home = + * '', $siteurl = '') + * Sets the WordPress cookies for a logged in user. See WordPress Cookies. + * wp_clearcookie() + * Clears the cookies for a logged in user. See WordPress Cookies. + * wp_notify_postauthor($comment_id, $comment_type='') + * Emails the author of the comment's post the content of the comment specified. + * wp_notify_moderator($comment_id) + * Informs the administrative email account that the comment specified needs to be + * moderated. See General Options SubPanel. + */ + +if (!function_exists('get_currentuserinfo')) : + + function get_currentuserinfo() { + /* + * global $user_login, $userdata, $user_level, $user_ID, $user_nickname, $user_email, $user_url, $user_pass_md5, $user_identity; + * // *** retrieving user's data from cookies and db - no spoofing + * + * if (isset($_COOKIE['wordpressuser_' . COOKIEHASH])) + * $user_login = $_COOKIE['wordpressuser_' . COOKIEHASH]; + * $userdata = get_userdatabylogin($user_login); + * $user_level = $userdata->user_level; + * $user_ID = $userdata->ID; + * $user_nickname = $userdata->user_nickname; + * $user_email = $userdata->user_email; + * $user_url = $userdata->user_url; + * $user_pass_md5 = md5($userdata->user_pass); + * + * $idmode = $userdata->user_idmode; + * if ($idmode == 'nickname') $user_identity = $userdata->user_nickname; + * if ($idmode == 'login') $user_identity = $userdata->user_login; + * if ($idmode == 'firstname') $user_identity = $userdata->user_firstname; + * if ($idmode == 'lastname') $user_identity = $userdata->user_lastname; + * if ($idmode == 'namefl') $user_identity = $userdata->user_firstname.' '.$userdata->user_lastname; + * if ($idmode == 'namelf') $user_identity = $userdata->user_lastname.' '.$userdata->user_firstname; + * if (!$idmode) $user_identity = $userdata->user_nickname; + */ + } +endif; + +if (!function_exists('get_userdata')) : + + function get_userdata($userid) { + /* + * global $wpdb, $cache_userdata; + * $userid = (int) $userid; + * if ( empty($cache_userdata[$userid]) && $userid != 0) { + * $cache_userdata[$userid] = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID = $userid"); + * $cache_userdata[$cache_userdata[$userid]->user_login] =& $cache_userdata[$userid]; + * } + * + * return $cache_userdata[$userid]; + */ + } +endif; + +if (!function_exists('get_userdatabylogin')) : + + function get_userdatabylogin($user_login) { + /* + * global $cache_userdata, $wpdb; + * if ( !empty($user_login) && empty($cache_userdata[$user_login]) ) { + * $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$user_login'"); // todo: get rid of this intermediate var + * $cache_userdata[$user->ID] = $user; + * $cache_userdata[$user_login] =& $cache_userdata[$user->ID]; + * } else { + * $user = $cache_userdata[$user_login]; + * } + * return $user; + */ + } +endif; + +if (!function_exists('wp_mail')) : + + function wp_mail($to, $subject, $message, $headers = '') { + if ($headers == '') { + $headers = "MIME-Version: 1.0\n" . "From: " . get_settings('admin_email') . "\n" . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; + } + + return @mail($to, $subject, $message, $headers); + } +endif; + +if (!function_exists('wp_login')) : + + function wp_login($username, $password, $already_md5 = false) { + /* + * global $wpdb, $error; + * + * if ( !$username ) + * return false; + * + * if ( !$password ) { + * $error = __('Error: The password field is empty.'); + * return false; + * } + * + * $login = $wpdb->get_row("SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'"); + * + * if (!$login) { + * $error = __('Error: Wrong username.'); + * return false; + * } else { + * // If the password is already_md5, it has been double hashed. + * // Otherwise, it is plain text. + * if ( ($already_md5 && $login->user_login == $username && md5($login->user_pass) == $password) || ($login->user_login == $username && $login->user_pass == md5($password)) ) { + * return true; + * } else { + * $error = __('Error: Incorrect password.'); + * $pwd = ''; + * return false; + * } + * } + */ + } +endif; + +if (!function_exists('auth_redirect')) : + + function auth_redirect() { + // Checks if a user is logged in, if not redirects them to the login page + /* + * if ( (!empty($_COOKIE['wordpressuser_' . COOKIEHASH]) && + * !wp_login($_COOKIE['wordpressuser_' . COOKIEHASH], $_COOKIE['wordpresspass_' . COOKIEHASH], true)) || + * (empty($_COOKIE['wordpressuser_' . COOKIEHASH])) ) { + * header('Expires: Wed, 11 Jan 1984 05:00:00 GMT'); + * header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + * header('Cache-Control: no-cache, must-revalidate, max-age=0'); + * header('Pragma: no-cache'); + * + * header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])); + * exit(); + * } + */ + } +endif; + + // Cookie safe redirect. Works around IIS Set-Cookie bug. + // http://support.microsoft.com/kb/q176113/ +if (!function_exists('wp_redirect')) : + + function wp_redirect($location, $status = 302) { + global $is_IIS; + + $location = apply_filters('wp_redirect', $location, $status); + + if (!$location) // allows the wp_redirect filter to cancel a redirect + return false; + + $location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location); + // $location = wp_kses_no_null($location); + + $location = preg_replace('/\0+/', '', $location); + $location = preg_replace('/(\\\\0)+/', '', $location); + + $strip = array( + '%0d', + '%0a' + ); + $location = str_replace($strip, '', $location); + + if ($is_IIS) { + header("Refresh: 0;url=$location"); + } else { + if (php_sapi_name() != 'cgi-fcgi') + utils_status_header($status); // This causes problems on IIS and some FastCGI setups + header("Location: $location"); + } + } +endif; + +if (!function_exists('wp_setcookie')) : + + function wp_setcookie($username, $password, $already_md5 = false, $home = '', $siteurl = '') { + if (!$already_md5) + $password = md5(md5($password)); // Double hash the password in the cookie. + + if (empty($home)) + $cookiepath = COOKIEPATH; + else + $cookiepath = preg_replace('|https?://[^/]+|i', '', $home . '/'); + + if (empty($siteurl)) { + $sitecookiepath = SITECOOKIEPATH; + $cookiehash = COOKIEHASH; + } else { + $sitecookiepath = preg_replace('|https?://[^/]+|i', '', $siteurl . '/'); + $cookiehash = md5($siteurl); + } + + setcookie('wordpressuser_' . $cookiehash, $username, time() + 31536000, $cookiepath); + setcookie('wordpresspass_' . $cookiehash, $password, time() + 31536000, $cookiepath); + + if ($cookiepath != $sitecookiepath) { + setcookie('wordpressuser_' . $cookiehash, $username, time() + 31536000, $sitecookiepath); + setcookie('wordpresspass_' . $cookiehash, $password, time() + 31536000, $sitecookiepath); + } + } +endif; + +if (!function_exists('wp_clearcookie')) : + + function wp_clearcookie() { + setcookie('wordpressuser_' . COOKIEHASH, ' ', time() - 31536000, COOKIEPATH); + setcookie('wordpresspass_' . COOKIEHASH, ' ', time() - 31536000, COOKIEPATH); + setcookie('wordpressuser_' . COOKIEHASH, ' ', time() - 31536000, SITECOOKIEPATH); + setcookie('wordpresspass_' . COOKIEHASH, ' ', time() - 31536000, SITECOOKIEPATH); + } +endif; + +if (!function_exists('check_admin_referer')) : + + function check_admin_referer($action = -1) { + $adminurl = BLOG_BASEURL . 'admin.php'; + $referer = strtolower(wp_get_referer()); + if (!wp_verify_nonce(@$_REQUEST ['_wpnonce'], $action) && !(-1 == $action && strstr($referer, $adminurl))) { + wp_nonce_ays($action); + die(); + } + do_action('check_admin_referer', $action); + } +endif; + +if (!function_exists('wp_verify_nonce')) : + + function wp_verify_nonce($nonce, $action = -1) { + $user = user_get(); + $uid = $user ['userid']; + + $i = ceil(time() / 43200); + + // Allow for expanding range, but only do one check if we can + if (substr(wp_hash($i . $action . $uid), -12, 10) == $nonce || substr(wp_hash(($i - 1) . $action . $uid), -12, 10) == $nonce) + return true; + return false; + } +endif; + +if (!function_exists('wp_create_nonce')) : + + function wp_create_nonce($action = -1) { + $user = user_get(); + $uid = $user ['userid']; + + $i = ceil(time() / 43200); + + return substr(wp_hash($i . $action . $uid), -12, 10); + } +endif; + +if (!function_exists('wp_salt')) : + + /** + * + * @return NULL|unknown + * @deprecated as of FlatPress 1.2 - still here only to be able to update pre-1.2 credentials + */ + function wp_salt() { + global $fp_config; + static $salt = null; + if (!$salt) { + @include (HASHSALT_FILE); + if (!$fp_hashsalt) + trigger_error('Cannot load hash salt: reinstall FlatPress', E_USER_ERROR); + + $salt = $fp_hashsalt; + } + return $salt; + } +endif; + +if (!function_exists('wp_hash')) : + + /** + * + * @param unknown $data + * @return string + * @deprecated as of FlatPress 1.2 - still here only to be able to update pre-1.2 credentials + */ + function wp_hash($data) { + $salt = wp_salt(); + return md5($data . $salt); + } +endif; + +if (!function_exists('wp_notify_postauthor')) : + + function wp_notify_postauthor($comment_id, $comment_type = '') { + /* + * global $wpdb; + * + * $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); + * $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1"); + * $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1"); + * + * if ('' == $user->user_email) return false; // If there's no email to send the comment to + * + * $comment_author_domain = gethostbyaddr($comment->comment_author_IP); + * + * $blogname = get_settings('blogname'); + * + * if ( empty( $comment_type ) ) $comment_type = 'comment'; + * + * if ('comment' == $comment_type) { + * $notify_message = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; + * $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + * $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n"; + * $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; + * $notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n"; + * $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; + * $notify_message .= __('You can see all comments on this post here: ') . "\r\n"; + * $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title ); + * } elseif ('trackback' == $comment_type) { + * $notify_message = sprintf( __('New trackback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; + * $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + * $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; + * $notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; + * $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n"; + * $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title ); + * } elseif ('pingback' == $comment_type) { + * $notify_message = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; + * $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + * $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; + * $notify_message .= __('Excerpt: ') . "\r\n" . sprintf( __('[...] %s [...]'), $comment->comment_content ) . "\r\n\r\n"; + * $notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n"; + * $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title ); + * } + * $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; + * $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; + * + * if ('' == $comment->comment_author_email || '' == $comment->comment_author) { + * $from = "From: \"$blogname\" '; + * } else { + * $from = 'From: "' . $comment->comment_author . "\" <$comment->comment_author_email>"; + * } + * + * $notify_message = apply_filters('comment_notification_text', $notify_message); + * $subject = apply_filters('comment_notification_subject', $subject); + * $message_headers = apply_filters('comment_notification_headers', $message_headers); + * + * $message_headers = "MIME-Version: 1.0\n" + * . "$from\n" + * . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; + * + * @wp_mail($user->user_email, $subject, $notify_message, $message_headers); + * + * return true; + */ + } +endif; + + /* + * wp_notify_moderator + * notifies the moderator of the blog (usually the admin) + * about a new comment that waits for approval + * always returns true + */ +if (!function_exists('wp_notify_moderator')) : + + function wp_notify_moderator($comment_id) { + /* + * global $wpdb; + * + * if( get_settings( "moderation_notify" ) == 0 ) + * return true; + * + * $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); + * $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1"); + * + * $comment_author_domain = gethostbyaddr($comment->comment_author_IP); + * $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'"); + * + * $notify_message = sprintf( __('A new comment on the post #%1$s "%2$s" is waiting for your approval'), $post->ID, $post->post_title ) . "\r\n"; + * $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n"; + * $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + * $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n"; + * $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; + * $notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n"; + * $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; + * $notify_message .= sprintf( __('To approve this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; + * $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; + * $notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n"; + * $notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n"; + * + * $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_settings('blogname'), $post->post_title ); + * $admin_email = get_settings("admin_email"); + * + * $notify_message = apply_filters('comment_moderation_text', $notify_message); + * $subject = apply_filters('comment_moderation_subject', $subject); + * + * @wp_mail($admin_email, $subject, $notify_message); + * + * return true; + */ + } endif; ?> diff --git a/fp-includes/smarty/plugins/function.list_categories.php b/fp-includes/smarty/plugins/function.list_categories.php index 2353e13..58f5a00 100755 --- a/fp-includes/smarty/plugins/function.list_categories.php +++ b/fp-includes/smarty/plugins/function.list_categories.php @@ -1,157 +1,155 @@ '
  • ','ird'=>"
  • \n", - 'old'=>"\n", - 'name' => isset($params['name'])? $params['name'] : '', - 'selected' => array() - ); - + 'ild' => '
  • ', + 'ird' => "
  • \n", + 'old' => "\n", + 'name' => isset($params ['name']) ? $params ['name'] : '', + 'selected' => array() + ); + $cat_params = array_merge($cat_params, $params); // makese 'selected' an arr - $cat_params['selected'] = (array)$params['selected']; + $cat_params ['selected'] = array_key_exists('selected', $params) ? (array) $params ['selected'] : array(); + + // echo "
    " . print_r(entry_categories_get()) . "
    "; - //echo "
    " . print_r(entry_categories_get()) . "
    "; - if (file_exists(CONTENT_DIR . 'categories.txt')) { $cats = trim(io_load_file(CONTENT_DIR . 'categories.txt')); - $stack=array(0); - $arr=array(); + $stack = array( + 0 + ); + $arr = array(); - $line36error = explode("\n", $cats); - $line35error = ''; + $line36error = explode("\n", $cats); + $line35error = ''; - return $line35error; + return $line35error; } else { global $lang; - - $content = 'Unfiled'; - if (isset($lang['admin']['entry']['publish']['nocategories'])) - $content = $lang['admin']['entry']['publish']['nocategories']; - return '' ; + + $content = 'Unfiled'; + if (isset($lang ['admin'] ['entry'] ['publish'] ['nocategories'])) + $content = $lang ['admin'] ['entry'] ['publish'] ['nocategories']; + return ''; } - - //
    - + + //
    } - - - - function do_print_categories_list(&$lines, &$indentstack, &$result, $params) { - global $smarty, $fpdb; - + extract($params); - - if (empty($lines)) { - $l = count($indentstack)-1; + + if (empty($lines)) { + $l = count($indentstack) - 1; if ($l > 0) - $arr = array_fill(0, $l, $ord.$ird); + $arr = array_fill(0, $l, $ord . $ird); else $arr = array(); - + $result = array_merge($result, $arr); return ''; } - - $str = ''; - $v = reset($lines); - $vt = ltrim($v); + $str = ''; + $v = reset($lines); + $vt = ltrim($v); - $indent = utils_countdashes($vt, $text); - $indent_old = end($indentstack); + $indent = utils_countdashes($vt, $text); + $indent_old = end($indentstack); $val = explode(':', $text); - $vt = $val[0]; - $vid = trim($val[1]); - - $catname = $params['name']; - - if ($indent > $indent_old) { - array_push($indentstack, $indent); - - array_pop($result); - array_push($result, $old); - //array_push($result, $ild); - do_print_categories_list($lines, $indentstack, $result, $params); - }elseif($indent < $indent_old) { - array_pop($indentstack); - - array_push($result, $ord); + $vt = $val [0]; + $vid = trim($val [1]); + + $catname = $params ['name']; + + if ($indent > $indent_old) { + array_push($indentstack, $indent); + + array_pop($result); + array_push($result, $old); + // array_push($result, $ild); + do_print_categories_list($lines, $indentstack, $result, $params); + } elseif ($indent < $indent_old) { + array_pop($indentstack); + + array_push($result, $ord); array_push($result, $ird); - - do_print_categories_list($lines, $indentstack, $result, $params); - }else{ - array_push($result, $ild); - - - $cat_entry = $params['selected']; - - if (isset($params['type']) && ($params['type']=='form' || $params['type']=='check')) { - $string = ''; $after = $string; - }elseif(isset($params['type']) && $params['type']=='linked'){ - $after=''; - if (isset($params['count']) && $params['count']) { - $index =& $fpdb->get_index($vid); - $count = ($index)? $index->length() : 0; - $after = " ($count) ". $after; + } elseif (isset($params ['type']) && $params ['type'] == 'linked') { + $after = ''; + if (isset($params ['count']) && $params ['count']) { + $index = & $fpdb->get_index($vid); + $count = ($index) ? $index->length() : 0; + $after = " ($count) " . $after; } } - + array_push($result, $after); - - array_push($result, $ird); - array_shift($lines); - do_print_categories_list($lines, $indentstack, $result, $params); - } - return implode($result); + array_push($result, $ird); + array_shift($lines); + do_print_categories_list($lines, $indentstack, $result, $params); + } + return implode($result); } diff --git a/fp-interface/lang/de-de/lang.admin.entry.php b/fp-interface/lang/de-de/lang.admin.entry.php index 0b6b33e..696dfe0 100644 --- a/fp-interface/lang/de-de/lang.admin.entry.php +++ b/fp-interface/lang/de-de/lang.admin.entry.php @@ -60,7 +60,7 @@ 1 => 'Beitrag wurde erfolgreich gespeichert', -1 => 'Ein Fehler ist beim Speichern des Beitrags aufgetreten', 2 => 'Beitrag wurde erfolgreich gelöscht', - -2 => 'Ein Fehler ist beim löschen des Beitrags aufgetreten', + -2 => 'Ein Fehler ist beim löschen des Beitrags aufgetreten', ); @@ -75,7 +75,7 @@ -2 => 'Ein Fehler ist aufgetreten: Der Beitrag wurde nicht gespeichert; eventuell ist der Index beschädigt', -3 => 'Ein Fehler ist aufgetreten: Der Beitrag wurde zur Sicherheit als Entwurf abgelegt', -4 => 'Ein Fehler ist aufgetreten: Der Beitrag wurde zur Sicherheit als Entwurf abgelegt; möglicherweise ist der Index beschädigt worden', - 'draft'=> 'Du bearbeitest gerade einen Beitrag im Entwurfs Modus' + 'draft'=> 'Du bearbeitest gerade einen Beitrag im Entwurfs-Modus' ); /* comments */ @@ -83,7 +83,7 @@ $lang['admin']['entry']['commentlist'] = array( 'head' => "Kommentare für den Beitrag: ", - 'descr' => 'Bitte Kommentar auswählen, das gelöscht werden soll', + 'descr' => 'Bitte Kommentar auswählen, der gelöscht werden soll', 'sel' => 'Sel', 'content' => 'Inhalt', 'date' => 'Datum', @@ -93,7 +93,7 @@ 'actions' => 'Aktion', 'act_edit' => 'Bearbeiten', 'act_del' => 'Löschen', - 'act_del_confirm' => 'Willst du dieses Kommentar wirklich löschen?', + 'act_del_confirm' => 'Willst du diesen Kommentar wirklich löschen?', 'nocomments' => 'Dieser Beitrag enthält zur Zeit keine Kommentare.', @@ -108,7 +108,7 @@ $lang['admin']['entry']['commedit'] = array( - 'head' => "Bearbeite das Kommentar für Beitrag", + 'head' => "Bearbeite den Kommentar für Beitrag", 'content' => 'Kommentarinhalt', 'date' => 'Datum', 'author' => 'Autor', @@ -123,7 +123,7 @@ $lang['admin']['entry']['commedit']['msgs'] = array( - 1 => 'Das Kommentar wurde geändert', + 1 => 'Der Kommentar wurde geändert', -1 => 'Ein Fehler ist beim Ändern des Kommentars aufgetreten', ); @@ -147,7 +147,7 @@ $lang['admin']['entry']['cats'] = array( 'head' => 'Kategorien verwalten', - 'descr' => '

    Jede Kategorie sollte im Schema "Kategorie Name: id_nummer" angelegt werden. Die "id_nummer" ist eindeutig den Beiträgen zugeordnet, darf nicht mehr verändert werden und muss größer 0 sein. Der Kategorie Name hingegen kann auch später noch umbenannt werden.

    Ein späteres Umstellen der Kategorienreihenfolge ist zu jeder Zeit möglich. Mit Bindestriche kann man Unterkategorien anlegen.

    + 'descr' => '

    Jede Kategorie sollte im Schema "Kategorie Name :id_nummer" angelegt werden. Die "id_nummer" ist eindeutig den Beiträgen zugeordnet, darf nicht mehr verändert werden und muss größer 0 sein. Der Kategoriename hingegen kann auch später noch geändert werden.

    Ein späteres Umstellen der Kategorienreihenfolge ist zu jeder Zeit möglich. Mit Bindestrichen kann man Unterkategorien anlegen.

    Beispiel:

    diff --git a/fp-interface/lang/de-de/lang.admin.plugin.php b/fp-interface/lang/de-de/lang.admin.plugin.php
    index d076f75..3dab68c 100644
    --- a/fp-interface/lang/de-de/lang.admin.plugin.php
    +++ b/fp-interface/lang/de-de/lang.admin.plugin.php
    @@ -13,7 +13,7 @@
     		'disable'	=> 'Deaktivieren',
     		'descr'		=> 'Diese Verwaltung ermöglicht es Plugins zu aktivieren oder deaktivieren, die die Funktionalität von Flatpress sehr flexibel gestalten.

    '. '

    Um ein neues Plugin in Flatpress zu integrieren, muss dieses Plugin in das Verzeichnis fp-plugins/ '. - 'hochgeladen werden. Ist ein Name und eine Beschreibung im neuen Plugin an entsprechender Stelle vorhanden, dann werden diese Texte hier mit angezeigt.', + 'geladen werden. Ist ein Name und eine Beschreibung im neuen Plugin an entsprechender Stelle vorhanden, dann werden diese Texte hier mit angezeigt.', 'name' => 'Name', 'description'=>'Beschreibung', 'author' => 'Autor', @@ -23,7 +23,7 @@ $lang['admin']['plugin']['default']['msgs'] = array( 1 => 'Konfiguration gespeichert', - -1 => 'Ein Fehler ist beim speichern aufgetreten. Eventuell stimmt die Syntax des Plugins nicht.', + -1 => 'Ein Fehler ist beim Speichern aufgetreten. Eventuell stimmt die Syntax des Plugins nicht.', ); /* system errors */ diff --git a/fp-interface/lang/de-de/lang.admin.static.php b/fp-interface/lang/de-de/lang.admin.static.php index 553875a..b7e29c4 100644 --- a/fp-interface/lang/de-de/lang.admin.static.php +++ b/fp-interface/lang/de-de/lang.admin.static.php @@ -27,9 +27,9 @@ $lang['admin']['static']['list']['msgs'] = array( 1 => 'Statische Seite erfolgreich gespeichert', - -1 => 'Ein Fehler ist beim speichern der Seite aufgetreten', + -1 => 'Ein Fehler ist beim Speichern der Seite aufgetreten', 2 => 'Seite wurde erfolgreich gelöscht', - -2 => 'Ein Fehler ist beim löschen der Seite aufgetreten', + -2 => 'Ein Fehler ist beim Löschen der Seite aufgetreten', ); /* write panel */ @@ -37,7 +37,7 @@ $lang['admin']['static']['write'] = array( 'head' => 'Statische Seite erstellen', - 'descr' => 'Bearbeiten der Parameter um diese Seite zu erstellen', + 'descr' => 'Bearbeiten der Parameter, um diese Seite zu erstellen', 'fieldset1' => 'Bearbeiten', 'subject' => 'Titel (*):', 'content' => 'Inhalt (*):', diff --git a/fp-interface/lang/de-de/lang.admin.uploader.php b/fp-interface/lang/de-de/lang.admin.uploader.php index d0cc97e..01eb186 100644 --- a/fp-interface/lang/de-de/lang.admin.uploader.php +++ b/fp-interface/lang/de-de/lang.admin.uploader.php @@ -19,7 +19,7 @@ $lang['admin']['uploader']['browse'] = array( 'head' => 'Durchsuchen', - 'descr' => 'Datei(en) auswählen zum hochladen.', + 'descr' => 'Datei(en) auswählen zum Hochladen.', 'fset1' => 'Durchsuchen', 'submit' => 'Hochladen', diff --git a/fp-interface/lang/de-de/lang.admin.widgets.php b/fp-interface/lang/de-de/lang.admin.widgets.php index 14cd9ff..4aefbe2 100644 --- a/fp-interface/lang/de-de/lang.admin.widgets.php +++ b/fp-interface/lang/de-de/lang.admin.widgets.php @@ -6,9 +6,9 @@ /* default action */ $lang['admin']['widgets']['default'] = array( - 'head' => 'Verwaltung Widgets (experimentell)', + 'head' => 'Widget-Verwaltung', - 'descr' => 'Flatpress hat verschiedene Widgets mit an Bord, wie zum Beispiel die Login- oder die Suchefunktion. Ein 'Flatpress hat verschiedene Widgets mit an Bord, wie zum Beispiel die Login- oder die Suchfunktion. Ein '. 'Widget ist ein dynamisches Steuerelement eines '. @@ -25,14 +25,14 @@ 'themewdgsdescr' => 'In diesem Theme stehen folgende Widgets zur Verfügung', 'oldwdgs' => 'Andere Widget Sets', 'oldwdgsdescr' =>'Das folgende Widget Set scheint zu keinem der oben gelisteten '. - 'Widget Sets zu gehören. Eventuell ist war es ein Teil eines anderen Themes.', + 'Widget Sets zu gehören. Eventuell ist es Teil eines anderen Themes.', 'submit' => 'Änderungen speichern', ); $lang['admin']['widgets']['default']['stdsets'] = array( - 'top' => 'Top Leiste', + 'top' => 'Kopfleiste', 'bottom' => 'Fussleiste', 'left' => 'Linke Leiste', 'right' => 'Rechte Leiste', diff --git a/fp-interface/lang/de-de/lang.comments.php b/fp-interface/lang/de-de/lang.comments.php index 88e22e5..e5559b6 100644 --- a/fp-interface/lang/de-de/lang.comments.php +++ b/fp-interface/lang/de-de/lang.comments.php @@ -3,7 +3,7 @@ $lang['comments']['mail'] = << 'In Kategorien suchen', 'catdescr' => 'Es muss mindestens eine Kategorie angegeben werden.', - 'fset4' => 'Suche starten', + 'fset4' => 'Suche starten', 'submit' => 'Suche starten', 'headres' => 'Suchergebnisse', @@ -64,7 +64,7 @@ $lang['entry']['flags'] = array(); $lang['entry']['flags']['long'] = array( - 'draft' => 'Beitrag als Entwurf speichern: wird erst sichtbar nachdem er veröffentlicht wurde.', + 'draft' => 'Beitrag als Entwurf speichern: wird erst sichtbar, wenn er veröffentlicht wird.', //'static' => 'Static entry: normally hidden, to reach the entry put ?page=title-of-the-entry in url (experimental)', 'commslock' => 'Kommentare sperren: Keine Kommentare für diesen Beitrag zulassen.' ); @@ -116,7 +116,7 @@ 'email' => 'E-Mail Adresse (wird nicht veröffentlicht):', 'www' => 'Website (optional):', 'cookie' => 'Daten für das nächste Mal merken', - 'fieldset2' => 'Ein Kommentar schreiben', + 'fieldset2' => 'Einen Kommentar schreiben', 'comment' => 'Kommentar:', 'fieldset3' => 'Senden', 'submit' => 'Abschicken', @@ -130,7 +130,7 @@ 'name' => 'Bitte einen Namen eingeben', 'email' => 'Bitte eine gültige E-Mail Adresse eingeben', 'www' => 'Bitte eine gültige URL eingeben', - 'comment' => 'Bitte ein Kommentar schreiben', + 'comment' => 'Bitte einen Kommentar schreiben', ); $lang['date']['month'] = array( diff --git a/fp-interface/lang/en-us/lang.admin.widgets.php b/fp-interface/lang/en-us/lang.admin.widgets.php index 057b51c..71960af 100644 --- a/fp-interface/lang/en-us/lang.admin.widgets.php +++ b/fp-interface/lang/en-us/lang.admin.widgets.php @@ -6,7 +6,7 @@ /* default action */ $lang['admin']['widgets']['default'] = array( - 'head' => 'Manage Widgets (experimental)', + 'head' => 'Manage Widgets', 'descr' => 'A '. diff --git a/fp-interface/lang/es-es/lang.admin.config.php b/fp-interface/lang/es-es/lang.admin.config.php new file mode 100644 index 0000000..5ca4466 --- /dev/null +++ b/fp-interface/lang/es-es/lang.admin.config.php @@ -0,0 +1,72 @@ + 'Opciones', + 'descr' => 'Personalice y configure su instalación de + FlatPress.', + 'submit' => 'Guardar Cambios', + + 'sysfset' => 'Información general del sistema', + 'syswarning' => '¡Advertencia! Estas informaciones son críticas y deben ser correctas, + o FlatPress (probablemente) se negará a funcionar correctamente.', + 'blog_root' => 'Path absoluto a flatpress. Nota: + generalmente no tendrá que editar esto, de todos modos tenga cuidado, porque no podemos + verificar si es correcto o no.', + 'www' =>'Blog root. URL hacia su blog, completo con +subdirectorios.
    + e.g.: http://www.mydomain.com/flatpress/ (trailing slash needed)', + + // ------ + + 'gensetts' => 'Configuración general', + 'blogtitle' => 'Título del Blog', + 'blogsubtitle' => 'Subtítulo del Blog', + 'blogfooter' => 'Pie de página del Blog', + 'blogauthor' => 'Autor del Blog', + 'startpage' => 'La página de inicio de este sitio web es', + 'stdstartpage' => 'Mi blog (predeterminado)', + 'blogurl' => 'URL del Blog', + 'blogemail' => 'Email del Blog', + 'notifications' => 'Notificaciones', + 'mailnotify' => 'Habilitar notificación por correo electrónico de los comentarios', + 'blogmaxentries' => 'Número de publicaciones por página', + 'langchoice' => 'Idioma', + + 'intsetts' => 'Configuración internacional', + 'utctime' => 'UTC la hora es', + 'timeoffset' => 'La diferencia de hora es', + 'hours' => 'hours', + 'timeformat' => 'Formato inicial para la hora', + 'dateformat' => 'Formato inicial para la fecha', + 'dateformatshort' => 'Formato inicial para la fecha (corto)', + 'output' => 'Resulta', + 'charset' => 'Conjunto de caracteres', + 'charsettip' => 'Conjunto de caracteres en el que usted escribe su blog (UTF-8 is '. + '
    recomendado)' + ); + + $lang['admin']['config']['default']['msgs'] = + array( + 1 => 'La configuración se ha guardado correctamente.', + -1 => 'Se produjo un error al intentar guardar la configuración.', + + ); + + $lang['admin']['config']['default']['error'] = + array( + 'www' => 'El root del blog debe ser un URL válido', + 'title' => 'Debe especificar un título', + 'email' => 'El correo electrónico debe tener un formato válido', + 'maxentries' => 'No ingreso un número válido de entradas', + 'timeoffset' => '¡No ingresó una corrección de tiempo válida! '. + 'Puedes usar punto flotante (ej. 2h30" => 2.5)', + 'timeformat' => 'Debe insertar el formato para la hora', + 'dateformat' => 'Debe insertar el formato para la fecha', + 'dateformatshort'=> 'Debe insertar el formato para la fecha (corto)', + 'charset' => 'Debe insertar un ID de set de caracteres', + 'lang' => 'El idioma que eligió no está disponible' + ); + + +?> diff --git a/fp-interface/lang/es-es/lang.admin.entry.php b/fp-interface/lang/es-es/lang.admin.entry.php new file mode 100644 index 0000000..97e94d6 --- /dev/null +++ b/fp-interface/lang/es-es/lang.admin.entry.php @@ -0,0 +1,184 @@ + 'Administrar entradas', + 'write' => 'Escribir entrada', + 'cats' => 'Administrar Categorías' + ); + + + /* default action */ + + $lang['admin']['entry']['list'] = + array( + 'head' => 'Administrar entradas', + 'descr' => 'Seleccione una entrada para editar o Añadir nueva'. + '
    Editar las categorías', + 'filter' => 'Filtrar: ', + 'nofilter' => 'Mostrar todo', + 'filterbtn' => 'Aplicar filtro', + 'sel' => 'Sel', // checkbox + 'date' => 'Fecha', + 'title' => 'Título', + 'author' => 'Autor', + 'comms' => '#Comms', // comments + 'action' => 'Action', + 'act_del' => 'Eliminar', + 'act_view' => 'Ver', + 'act_edit' => 'Editar' + ); + + /* write action */ + $lang['admin']['entry']['write'] = + array( + 'head' => 'Escribir entrada', + 'descr' => 'Edite el formulario para escribir la entrada', + 'uploader' => 'Subir', + 'fieldset1' => 'Editar', + 'subject' => 'Asunto (*):', + 'content' => 'Contenido (*):', + 'fieldset2' => 'Enviar', + 'submit' => 'Publicar', + 'preview' => 'vista previa', + 'savecontinue' => 'Guardar&Continuar', + 'categories' => 'Categorias', + 'nocategories' => 'categorías no establecidas. Cree sus propias'. + 'categorias desde el panel de entrada principal. '. + 'Guarde primero su entrada.', + 'saveopts' => 'Guardar opciones', + 'success' => 'Su entrada fue publicada correctamente', + 'otheropts' => 'Otras opciones', + 'commmsg' => 'Administrar comentarios para esta entrada', + 'delmsg' => 'Eliminar esta entrada', + //'back' => 'Volver descartando cambios', + ); + + + $lang['admin']['entry']['list']['msgs'] = array( + 1 => 'La entrada se ha guardado correctamente', + -1 => 'Se produjo un error al intentar guardar + la entrada', + 2 => 'La entrada se eliminó correctamente', + -2 => 'Se produjo un error al intentar eliminar + la entrada', + ); + + + $lang['admin']['entry']['write']['error'] = array( + 'subject' => 'No puedes enviar un asunto en blanco', + 'content' => 'No puedes publicar una entrada en blanco', + ); + + $lang['admin']['entry']['write']['msgs'] = array( + 1 => 'La entrada se ha guardado correctamente', + -1 => 'Se produjo un error: su entrada no se pudo guardar correctamente', + -2 => 'Se produjo un error: su entrada no se ha guardado; el índice puede estar corrupto', + -3 => 'Se produjo un error: su entrada se ha guardado como borrador', + -4 => 'Se produjo un error: su entrada se ha guardado como borrador; el índice puede estar corrupto', + 'draft'=> 'Está editando un borrador de entrada' + ); + + + /* comments */ + + $lang['admin']['entry']['commentlist'] = + array( + 'head' => "Comentarios para la entrada ", + 'descr' => 'Seleccione un comentario para eliminar', + 'sel' => 'Sel', + 'content' => 'Contenido', + 'date' => 'Fecha', + 'author' => 'Autor', + 'email' => 'Email', + 'ip' => 'IP', + 'actions' => 'Acciones', + 'act_edit' => 'Editar', + 'act_del' => 'Eliminar', + 'act_del_confirm' => '¿Realmente quiere eliminar este comentario?', + 'nocomments' => 'Esta entrada aún no ha sido comentada.', + + + ); + + $lang['admin']['entry']['commentlist']['msgs'] = + array( + 1 => 'El comentario se ha eliminado correctamente', + -1 => 'Ocurrió un error al intentar eliminar + el comentario', + + ); + + $lang['admin']['entry']['commedit'] = + array( + 'head' => "Editar comentario para entrada", + 'content' => 'Contenido', + 'date' => 'Fecha', + 'author' => 'Autor', + 'www' => 'Sitio web', + 'email' => 'Email', + 'ip' => 'IP', + 'loggedin' => 'Usuario registrado', + 'submit' => 'Guardar' + + + ); + + $lang['admin']['entry']['commedit']['msgs'] = + array( + 1 => 'Comment has been edited', + -1 => 'An error occurred while trying to edit the comment', + ); + + /* delete action */ + + $lang['admin']['entry']['delete'] = + array( + 'head' => 'Eliminar entrada', + 'descr' => 'Estás a punto de eliminar la siguiente entrada:', + 'preview' => 'Vista previa', + 'confirm' => '¿Esta seguro que desea continuar?', + 'fset' => 'Eliminar', + 'ok' => 'Si, eliminar esta entrada', + 'cancel' => 'No, volver al panel', + 'err' => 'La entrada especificada no existe', + + ); + + /* category mgmt */ + + $lang['admin']['entry']['cats'] = + array( + 'head' => 'Editar categorias', + 'descr' => '

    Utilice el formulario a continuación para agregar y editar sus categorías.

    Cada elemento de categoría debe tener este formato "nombre de categoría: id_number". Indentar los elementos con guiones para crear jerarquías.

    + +

    Ejemplo:

    +
    +General :1
    +News :2
    +--Announcements :3
    +--Events :4
    +----Misc :5
    +Technology :6
    +	
    ', + 'clear' => 'Eliminar todos los datos de las categorías', + + 'fset1' => 'Editor', + 'fset2' => 'Aplicar cambios', + 'submit' => 'Guardar' + ); + + $lang['admin']['entry']['cats']['msgs'] = array( + + 1 => 'Categorías guardadas', + -1 => 'Se produjo un error al intentar guardar categorías', + 2 => 'Categorías vacías', + -2 => 'Se produjo un error al intentar vaciar categorías', + -3 => 'Los ID de categoría deben ser estrictamente positivos (0 is not allowed)' + + ); + + + +?> diff --git a/fp-interface/lang/es-es/lang.admin.main.php b/fp-interface/lang/es-es/lang.admin.main.php new file mode 100644 index 0000000..dea199b --- /dev/null +++ b/fp-interface/lang/es-es/lang.admin.main.php @@ -0,0 +1,23 @@ + '¡Bienvenido al panel de control!', + 'descr' => 'Seleccione una acción', + + 'op1' => 'Nueva entrada', + 'op1d' => 'Agregar una nueva entrada', + 'op2' => 'Entradas', + 'op2d' => 'Mostrar y administrar todas las entradas', + 'op3' => 'Widgets', + 'op3d' => 'Administrar la barra lateral, barra de abajo y de arriba de los widgets', + 'op4' => 'Plugins', + 'op4d' => 'Instalar, habilitar, deshabilitar plugins', + 'op5' => 'Configuración', + 'op5d' => 'Personalice su flatpress', + 'op6' => 'Mantención', + 'op6d' => 'Limpiar y restablecer flatpress', + + ); +?> diff --git a/fp-interface/lang/es-es/lang.admin.maintain.php b/fp-interface/lang/es-es/lang.admin.maintain.php new file mode 100644 index 0000000..f73e7cc --- /dev/null +++ b/fp-interface/lang/es-es/lang.admin.maintain.php @@ -0,0 +1,46 @@ + 'Mantención', + 'descr' => 'Consulta esta sección cuando creas que algo se ha estropeado '. + 'y quizás encuentres aquí una solución. + Sin embargo, esto podría no funcionar.', + 'opt0' => '« Regresar al menú principal', + 'opt1' => 'Reconstruir índice', + 'opt2' => 'Vaciar el caché de plantillas y temas', + 'opt3' => 'Restaurar permisos de archivos', + 'opt4' => 'Mostrar información sobre PHP', + 'opt5' => 'Buscar actualizaciones', + + 'chmod_info' => "Los siguientes permisos de archivo no pudieron + ser reiniciados a 0777; probablemente el propietario del archivo no sea el mismo que el + del servidor web. Por lo general, puede ignorar este aviso.", + + ); + + $lang['admin']['maintain']['default']['msgs'] = array( + 1 => 'Operación completada' + ); + + $lang['admin']['maintain']['updates'] = array( + 'head' => 'Actualizaciones', + 'list' => '
      +
    • Usted tiene la versión FlatPress %s
    • +
    • La última versión estable de FlatPress es %s
    • +
    • La última versión inestable de FlatPress es %s
    • +
    ', + 'notice'=>'Aviso:' + + ); + + + + $lang['admin']['maintain']['updates']['msgs'] = array( + 1 => '¡Hay actualizaciones disponibles!', + 2 => 'Su sistema ya está actualizado', + -1 => 'No se encontraron actualizaciones' + ); + +?> diff --git a/fp-interface/lang/es-es/lang.admin.php b/fp-interface/lang/es-es/lang.admin.php new file mode 100644 index 0000000..831547d --- /dev/null +++ b/fp-interface/lang/es-es/lang.admin.php @@ -0,0 +1,34 @@ + 'Principal', + 'config' => 'Opciones', + //'users' => 'Usuarios', + 'entry' => 'Entradas', + 'static' => 'Estáticas', + 'uploader' => 'Subir Archivos', + 'widgets' => 'Widgets', + //'add' => 'Add', + //'edit' => 'Editar/Eliminar', + 'maintain' => 'Mantención', + 'plugin' => 'Plugins', + 'themes' => 'Temas', + //'updates' => 'Actualizaciones', + ); + + + $lang['admin']['general'] = array( + 'id' => 'Id', # for entry ids + 'name' => 'Nombre', # for file names + 'title' => 'Titulo', # for entry/posts/static titles + 'comments' => '#Comms', + 'author' => 'Autor', + 'actdel' => 'Eliminar', + 'actedit' => 'Editar', + 'actenable' => 'Habilitar', + 'actdisable' => 'Inhabilitar' + ); + +?> diff --git a/fp-interface/lang/es-es/lang.admin.plugin.php b/fp-interface/lang/es-es/lang.admin.plugin.php new file mode 100644 index 0000000..2c6c561 --- /dev/null +++ b/fp-interface/lang/es-es/lang.admin.plugin.php @@ -0,0 +1,40 @@ + 'Administrar Plugins' + ); + + /* main plugin panel */ + + $lang['admin']['plugin']['default'] = array( + + 'head' => 'Administrar Plugins', + 'enable' => 'Habilitar', + 'disable' => 'Inhabilitar', + 'descr' => 'A '. + 'Plugin es un componente que puede ampliar las capacidades de FlatPress.

    '. + '

    Puede instalar plugins subiendolos a su fp-plugins/ '. + 'directorio.

    '. + '

    Este panel le permite habilitar y deshabilitar Plugins', + 'name' => 'Nombre', + 'description' => 'Descripción', + 'author' => 'Autor', + 'version' => 'Versión', + 'action' => 'Acción', + ); + + $lang['admin']['plugin']['default']['msgs'] = array( + 1 => 'Config guardada', + -1 => 'Se produjo un error al intentar guardar. Esto puede suceder por varias razones: tal vez su archivo contenga errores de sintaxis.', + ); + + /* system errors */ + + $lang['admin']['plugin']['errors'] = array( + 'head' => 'Se encontraron los siguientes errores al cargar Plugin:', + 'notfound' => 'No se encontró el Plugin. Omitido.', + 'generic' => 'Numero de error %d', + ); + +?> diff --git a/fp-interface/lang/es-es/lang.admin.static.php b/fp-interface/lang/es-es/lang.admin.static.php new file mode 100644 index 0000000..efd86de --- /dev/null +++ b/fp-interface/lang/es-es/lang.admin.static.php @@ -0,0 +1,80 @@ + 'Administrar Staticas', + 'write' => 'Escribir Statica' + ); + + + /* main panel */ + + $lang['admin']['static']['list'] = array( + + 'head' => 'Páginas estáticas', + 'descr' => 'Seleccione una página para editar o Añadir nueva.', + + 'sel' => 'Sel', // checkbox + 'date' => 'Fecha', + 'name' => 'Pagina', + 'title' => 'Titulo', + 'author' => 'Autor', + + 'action' => 'Accion', + 'act_view' => 'Ver', + 'act_del' => 'Eliminar', + 'act_edit' => 'Editar' + ); + + $lang['admin']['static']['list']['msgs'] = array( + 1 => 'Página archivada correctamente', + -1 => 'Se produjo un error al intentar archivar + la página', + 2 => 'Página eliminada correctamente', + -2 => 'Error al intentar eliminar + la página', + ); + + /* write panel */ + + $lang['admin']['static']['write'] = + array( + 'head' => 'Publicar la página estatica', + 'descr' => 'Editar el formulario para publicar la página', + 'fieldset1' => 'Editar', + 'subject' => 'Asunto (*):', + 'content' => 'Contenido (*):', + 'fieldset2' => 'Enviar', + 'pagename' => 'Nombre de la página (*):', + 'submit' => 'Publicar', + 'preview' => 'Vista Previa', + + 'delfset' => 'Eliminar', + 'deletemsg' => 'Eliminar esta pagina', + 'del' => 'Eliminar', + 'success' => 'Tu página se publicó con éxito', + 'otheropts' => 'Otras opciones', + ); + + $lang['admin']['static']['write']['error'] = array( + 'subject' => 'No puedes enviar un asunto en blanco', + 'content' => 'No puedes publicar una entrada en blanco', + 'id' => 'Debes enviar una identificación válida' + ); + + + /* delete action */ + $lang['admin']['static']['delete'] = array( + 'head' => "Eliminar Página", + 'descr' => 'Estás a punto de eliminar la siguiente página:', + 'preview' => 'Vista Previa', + 'confirm' => '¿Estas seguro que deseas continuar?', + 'fset' => 'Eliminar', + 'ok' => 'Si, elimine esta página', + 'cancel' => 'No, llévame de vuelta al panel', + 'err' => 'La página especificada no existe', + + ); + + + +?> diff --git a/fp-interface/lang/es-es/lang.admin.themes.php b/fp-interface/lang/es-es/lang.admin.themes.php new file mode 100644 index 0000000..ddb0653 --- /dev/null +++ b/fp-interface/lang/es-es/lang.admin.themes.php @@ -0,0 +1,48 @@ + 'Temas', + 'style' => 'Estilos', + ); + + /* default panel action (change theme) */ + + $lang['admin']['themes']['default'] = array( + 'head1' => 'Tema actual', + + 'head2' => 'Temas disponibles', + 'descr' => 'Seleccione el tema que desee utilizar', + + 'nodescr' => 'Falta descripción', + 'noauthor' => 'Autor desconocido', + + ); + + $lang['admin']['themes']['default']['msgs'] = array( + 1 => 'El tema ha cambiado.', + -1 => 'Error al intentar cambiar el tema.', + -2 => 'El tema eligido no existe.' + ); + + + /* select style */ + + $lang['admin']['themes']['style'] = array( + 'head1' => 'Estilo actual', + + 'head2' => 'Estilos disponibles', + 'descr' => 'Seleccione el estilo que desea usar con este tema', + + 'nodescr' => 'Falta descripción', + 'noauthor' => 'Autor desconocido', + ); + + $lang['admin']['themes']['style']['msgs'] = array( + 1 => 'Se ha cambiado el estilo.', + -1 => 'Error al intentar cambiar el estilo.', + -2 => 'El estilo eligido no existe.' + ); + + +?> diff --git a/fp-interface/lang/es-es/lang.admin.uploader.php b/fp-interface/lang/es-es/lang.admin.uploader.php new file mode 100644 index 0000000..6c7dbeb --- /dev/null +++ b/fp-interface/lang/es-es/lang.admin.uploader.php @@ -0,0 +1,29 @@ + 'Subir Archivos', + 'descr' => 'Elija uno o más archivos para subir.', + 'fset1' => 'Selector de archivos', + 'fset2' => 'Subir', + 'submit' => 'Subir', + + ); + + $lang['admin']['uploader']['default']['msgs'] = array( + 1 => 'Archivo(s) subido(s)', + -1 => 'Se produjo un error al intentar subir archivo(s).', + ); + + + + $lang['admin']['uploader']['browse'] = array( + 'head' => 'Navegar', + 'descr' => 'Elija uno o más archivos para subir.', + 'fset1' => 'Selector de archivos', + 'submit' => 'Subir', + + ); + + +?> diff --git a/fp-interface/lang/es-es/lang.admin.widgets.php b/fp-interface/lang/es-es/lang.admin.widgets.php new file mode 100644 index 0000000..17fa8fe --- /dev/null +++ b/fp-interface/lang/es-es/lang.admin.widgets.php @@ -0,0 +1,88 @@ + 'Administrar widgets (experimental)', + + 'descr' => 'A '. + 'Widget es un componente dinámico que puede mostrar datos e interactuar con el usuario. + Mientras Temas están destinados a cambiar el aspecto de tu blog, Widgets + Amplían apariencia y funcionalidades.

    + +

    Widgets pueden ser puestos en areas especiales de su tema llamado el + WidgetSets. El número y el nombre de los WidgetSets pueden variar según el + tema que elija.

    + +

    FlatPress viene con varios widgets: hay widgets para ayudar con el inicio de sesión, para + mostrar un cuadro de búsqueda, etc.

    + +

    Cada Widget está definido por un plugin.', + + 'availwdgs' => 'Widgets Disponibles', + 'trashcan' => 'Mover aquí para borrar', + + 'themewdgs' => 'Widgetsets para este tema', + 'themewdgsdescr' => 'El tema que ha seleccionado le permite tener los siguientes conjuntos de widgets', + 'oldwdgs' => 'Otros widgetsets', + 'oldwdgsdescr' =>'Los siguientes set de widgets parecen no pertenecer a ninguno de los '. + 'widgetsets listados arriba. Pueden ser restantes de otro tema.', + + 'submit' => 'Guardar Cambios', + + ); + + $lang['admin']['widgets']['default']['stdsets'] = array( + 'top' => 'Barra superior', + 'bottom' => 'Barra inferior', + 'left' => 'Barra izquierda', + 'right' => 'Barra derecha', + ); + + $lang['admin']['widgets']['default']['msgs'] = array( + 1 => 'Configuración guardada', + -1 => 'Se produjo un error al intentar guardar. Vuelve a intentarlo.', + ); + + + + /* "raw" panel */ + + $lang['admin']['widgets']['raw'] = array( + 'head' => 'Administrar widgets (editor raw)', + 'descr' => 'A '. + 'Widget is a visual element of a '. + 'Plugin que puede poner en algunas áreas especiales (los widgetsets) en las páginas de su blog.

    '. + '

    Este es el editor raw ; algunos usuarios avanzados o personas que '. + 'no deseen JavaScript tal vez lo prefieran', + + 'fset1' => 'Editor', + 'fset2' => 'Aplicar cambios', + 'submit' => 'Aplicar', + + ); + + + $lang['admin']['widgets']['raw']['msgs'] = array( + 1 => 'Configuración guardada', + -1 => 'Se produjo un error al intentar guardar. Esto puede suceder por varias razones: tal vez su archivo contenga errores de sintaxis.', + ); + + + + /* system errors */ + + $lang['admin']['widgets']['errors'] = array( + 'generic' => 'El widget llamado %s no está registrado y sera omitido. '. + 'Está el plugin habilitado en el panel de plugin?' + + ); + +?> diff --git a/fp-interface/lang/es-es/lang.comments.php b/fp-interface/lang/es-es/lang.comments.php new file mode 100644 index 0000000..bf38309 --- /dev/null +++ b/fp-interface/lang/es-es/lang.comments.php @@ -0,0 +1,21 @@ + diff --git a/fp-interface/lang/es-es/lang.conf.php b/fp-interface/lang/es-es/lang.conf.php new file mode 100644 index 0000000..14185ca --- /dev/null +++ b/fp-interface/lang/es-es/lang.conf.php @@ -0,0 +1,9 @@ + diff --git a/fp-interface/lang/es-es/lang.contact.php b/fp-interface/lang/es-es/lang.contact.php new file mode 100644 index 0000000..ac53187 --- /dev/null +++ b/fp-interface/lang/es-es/lang.contact.php @@ -0,0 +1,31 @@ + 'Contáctanos', + 'descr' => 'Complete el siguiente formulario para enviarnos sus comentarios. Agregue su correo electrónico si desea ser respondido.', + 'fieldset1' => 'Datos del usuario', + 'name' => 'Nombre (*)', + 'email' => 'Email:', + 'www' => 'Web:', + 'cookie' => 'Recuérdame', + 'fieldset2' => 'Tu mensaje', + 'comment' => 'Mensaje (*):', + 'fieldset3' => 'Enviar', + 'submit' => 'Enviar', + 'reset' => 'Reiniciar', + + ); + + $lang['contact']['error'] = array( + 'name' => 'Debes ingresar un nombre', + 'email' => 'Debes ingresar un correo electrónico válido', + 'www' => 'Debes ingresar una URL válida', + 'content' => 'Debes ingresar un mensaje', + ); + + $lang['contact']['msgs'] = array( + 1 => 'El mensaje se envió con éxito', + -1 => 'No se pudo enviar el mensaje', + ); + +?> \ No newline at end of file diff --git a/fp-interface/lang/es-es/lang.default.php b/fp-interface/lang/es-es/lang.default.php new file mode 100644 index 0000000..0a8b986 --- /dev/null +++ b/fp-interface/lang/es-es/lang.default.php @@ -0,0 +1,201 @@ + 'Página Siguiente »', + 'prevpage' => '« Página anterior', + 'entry' => 'Entrada', + 'static' => 'Pagina Estatica', + 'comment' => 'Comentario', + 'preview' => 'Editar/Vista previa', + + 'filed_under' => 'Archivado bajo ', + + 'add_entry' => 'Agregar Entrada', + 'add_comment' => 'Agregar Comentario', + 'add_static' => 'Agregar Pagina Estatica', + + 'btn_edit' => 'Editar', + 'btn_delete' => 'Borrar', + + 'nocomments' => 'Agregar un Comentario', + 'comment' => '1 comentario', + 'comments' => 'comentarios', + + ); + + $lang['search'] = array( + + 'head' => 'Buscar', + 'fset1' => 'Insertar criterios de búsqueda', + 'keywords' => 'Frase', + 'onlytitles' => 'Solo Títulos', + 'fulltext' => 'Text Completo', + + 'fset2' => 'Date', + 'datedescr' => 'Puede vincular su búsqueda a una fecha específica. Puede seleccionar un año, un año y un mes o una fecha completa. '. + 'Déjelo en blanco para buscar en toda la base de datos.', + + 'fset3' => 'Buscar en categorías', + 'catdescr' => 'No seleccione ninguno para buscar todos', + + 'fset4' => 'Empezar a buscar', + 'submit' => 'Buscar', + + 'headres' => 'Resultados de la búsqueda', + 'descrres' => 'Searching for %s returned the following results:', + 'descrnores' => 'Buscando %s no devolvió ningún resultado.', + + 'moreopts' => 'Más Opciones', + + + 'searchag' => 'Busca de nuevo', + + ); + + $lang['search']['error'] = array( + + 'keywords' => 'Debe especificar al menos una palabra clave' + + ); + + + + + + $lang['entry'] = array(); + $lang['entry']['flags'] = array(); + + $lang['entry']['flags']['long'] = array( + 'draft' => 'Entrada de borrador: oculto, esperando publicación', + //'static' => 'Entrada estática: normalmente oculto, para llegar a la entrada poner ?page=title-of-the-entry en url (experimental)', + 'commslock' => 'Comentarios bloqueados: comentarios no permitidos para esta entrada' + ); + + $lang['entry']['flags']['short'] = array( + 'draft' => 'Borrador', + //'static' => 'Estático', + 'commslock' => 'Comentarios bloqueados' + ); + + $lang['404error'] = array( + 'subject' => 'No encontrado', + 'content' => '

    Lo sentimos, no pudimos encontrar la página solicitada

    ' + ); + + // Login + $lang['login'] = array( + + 'head' => 'Iniciar sesión', + 'fieldset1' => 'Inserte su nombre de usuario y contraseña', + 'user' => 'Usuario:', + 'pass' => 'Contraseña:', + 'fieldset2' => 'Inicie sesión', + 'submit' => 'Iniciar sesión', + 'forgot' => 'Contraseña perdida' + ); + + $lang['login']['success'] = array( + 'success' => 'Ahora está conectado.', + 'logout' => 'Ahora está desconectado.', + 'redirect' => 'Serás redirigido en 5 segundos.', + 'opt1' => 'Volver al índice', + 'opt2' => 'Ir al panel de control', + 'opt3' => 'Agregar nueva entrada' + ); + + $lang['login']['error'] = array( + 'user' => 'Debes ingresar un nombre de usuario.', + 'pass' => 'Debes ingresar una contraseña.', + 'match' => 'Contraseña incorrecta.' + ); + + + $lang['comments'] = array( + 'head' => 'Agregar comentario', + 'descr' => 'Complete el siguiente formulario para agregar sus propios comentarios', + 'fieldset1' => 'Datos del usuario', + 'name' => 'Nombre (*)', + 'email' => 'Email:', + 'www' => 'Web:', + 'cookie' => 'Recuérdame', + 'fieldset2' => 'Añade tu comentario', + 'comment' => 'Comentario (*):', + 'fieldset3' => 'Enviar', + 'submit' => 'Agregar', + 'reset' => 'Reiniciar', + 'success' => 'Tu comentario fue agregado exitosamente', + 'nocomments' => 'Esta entrada aún no ha sido comentada', + 'commslock' => 'Los comentarios han sido desactivados para esta entrada.', + ); + + $lang['comments']['error'] = array( + 'name' => 'Debes ingresar un nombre', + 'email' => 'Debes ingresar un correo electrónico válido', + 'www' => 'Debes ingresar una URL válida', + 'comment' => 'Debes ingresar un comentario', + ); + + $lang['date']['month'] = array( + + 'Enero', + 'Febrero', + 'Marzo', + 'Abril', + 'Mayo', + 'Junio', + 'Julio', + 'Agosto', + 'Septiembre', + 'Octubre', + 'Noviembre', + 'Deciembre' + + ); + + $lang['date']['month_abbr'] = array( + + 'Ene', + 'Feb', + 'Mar', + 'Abr', + 'May', + 'Jun', + 'Jul', + 'Ago', + 'Sep', + 'Oct', + 'Nov', + 'Dec' + + ); + + $lang['date']['weekday'] = array( + + 'Domingo', + 'Lunes', + 'Martes', + 'Miércoles', + 'Jueves', + 'Viernes', + 'Sabado', + + ); + + $lang['date']['weekday_abbr'] = array( + + 'Dom', + 'Lun', + 'Mar', + 'Mie', + 'Jue', + 'Vie', + 'Sab', + + ); + + + +?> diff --git a/fp-interface/lang/fr-fr/lang.admin.widgets.php b/fp-interface/lang/fr-fr/lang.admin.widgets.php index 81c1b0a..df230f6 100644 --- a/fp-interface/lang/fr-fr/lang.admin.widgets.php +++ b/fp-interface/lang/fr-fr/lang.admin.widgets.php @@ -6,7 +6,7 @@ /* default action */ $lang['admin']['widgets']['default'] = array( - 'head' => 'Gérer les Widgets (expérimental)', + 'head' => 'Gérer les Widgets', 'descr' => 'Un '. diff --git a/fp-interface/lang/it-it/lang.admin.entry.php b/fp-interface/lang/it-it/lang.admin.entry.php index 74127e6..b4f7259 100644 --- a/fp-interface/lang/it-it/lang.admin.entry.php +++ b/fp-interface/lang/it-it/lang.admin.entry.php @@ -45,7 +45,7 @@ 'savecontinue' => 'Salva e continua', 'categories' => 'Categorie', 'nocategories' => 'Nessuna categoria impostata. Creane una '. - 'categories dal pannelo principale degli articoli. '. + 'categories dal pannello principale degli articoli. '. 'Salva prima l\'articolo.', 'saveopts' => 'Opzioni di salvataggio', 'success' => 'L\'articolo è stato pubblicato con successo', @@ -162,7 +162,7 @@ Notizie :2 ----Varie :5 Tecnologia :6
    ', - 'clear' => 'Elimina tutti i dati dele categorie', + 'clear' => 'Elimina tutti i dati delle categorie', 'fset1' => 'Editor', 'fset2' => 'Applica le modifiche', diff --git a/fp-interface/lang/it-it/lang.admin.php b/fp-interface/lang/it-it/lang.admin.php index 4a22113..972b8b0 100644 --- a/fp-interface/lang/it-it/lang.admin.php +++ b/fp-interface/lang/it-it/lang.admin.php @@ -1,6 +1,6 @@ 'Principale', diff --git a/fp-interface/lang/it-it/lang.admin.uploader.php b/fp-interface/lang/it-it/lang.admin.uploader.php index b4db71d..09c3368 100644 --- a/fp-interface/lang/it-it/lang.admin.uploader.php +++ b/fp-interface/lang/it-it/lang.admin.uploader.php @@ -12,7 +12,7 @@ $lang['admin']['uploader']['default']['msgs'] = array( 1 => 'File caricato(i)', - -1 => 'S è verificato un errore durante il caricamento.', + -1 => 'Si è verificato un errore durante il caricamento.', ); diff --git a/fp-interface/lang/it-it/lang.admin.widgets.php b/fp-interface/lang/it-it/lang.admin.widgets.php index 71a6698..d315ed5 100644 --- a/fp-interface/lang/it-it/lang.admin.widgets.php +++ b/fp-interface/lang/it-it/lang.admin.widgets.php @@ -6,19 +6,19 @@ /* default action */ $lang['admin']['widgets']['default'] = array( - 'head' => 'Gestione Widget (experimental)', + 'head' => 'Gestione Widget', 'descr' => 'Un '. 'Widget è un componente dinamico che può visualizzare dati e interagire con l\'utente. - Mentre i Temi sono fatti per cambiare l\'aspetto del blog, Widgets - extend cambiano l\'aspetto e le funzionalità.

    + Mentre i Temi sono fatti per cambiare l\'aspetto del blog, i Widgets + ne estendono, cambiano l\'aspetto e le funzionalità.

    I Widget possono essere trascinati in aree specifiche del tuo tema chiamate WidgetSets. Il numero e il nome dei WidgetSets possono variare a seconda - de tema che hai scelto.

    + del tema che hai scelto.

    -

    FlatPress viene fornito con parecchi widget: ci sono widget cheaiutano con la connessione, per +

    FlatPress viene fornito con parecchi widget: ci sono widget che aiutano con la connessione, per visualizzare una casella di ricerca, ecc.

    Ogni Widget è definito da un 'Widgetset per questo tema', 'themewdgsdescr' => 'Il tema che hai attualmente selezionato ti consente di avere i seguenti widgetset', 'oldwdgs' => 'Altri widgetset', - 'oldwdgsdescr' =>'I seguenti widgetset sembrano non appartenere ad alcunoo dei '. + 'oldwdgsdescr' =>'I seguenti widgetset sembrano non appartenere ad alcuno dei '. 'widgetset elencati qui sopra. Potrebbero essere dei rimasugli di un altro tema.', 'submit' => 'Salva le modifiche', diff --git a/fp-interface/lang/it-it/lang.default.php b/fp-interface/lang/it-it/lang.default.php index 09cfb1a..3bf9c3e 100644 --- a/fp-interface/lang/it-it/lang.default.php +++ b/fp-interface/lang/it-it/lang.default.php @@ -35,7 +35,7 @@ 'fulltext' => 'Testo completo', 'fset2' => 'Data', - 'datedescr' => 'Puoi collegare la tua ricerca ad una data specifica. Puoi selezionare un anno, un annno e un mese o una data completa. '. + 'datedescr' => 'Puoi collegare la tua ricerca ad una data specifica. Puoi selezionare un anno, un anno e un mese o una data completa. '. 'Lascia in bianco se vuoi cercare nell\'intero database.', 'fset3' => 'Cerca nelle categorie', @@ -89,7 +89,7 @@ $lang['login'] = array( 'head' => 'Login', - 'fieldset1' => 'Inserisci nome tuetnte e password', + 'fieldset1' => 'Inserisci nome utente e password', 'user' => 'Nome utente:', 'pass' => 'Password:', 'fieldset2' => 'Connettiti', diff --git a/fp-interface/lang/pt-br/lang.admin.widgets.php b/fp-interface/lang/pt-br/lang.admin.widgets.php index 60045e3..8105f41 100644 --- a/fp-interface/lang/pt-br/lang.admin.widgets.php +++ b/fp-interface/lang/pt-br/lang.admin.widgets.php @@ -7,7 +7,7 @@ /* default action */ $lang['admin']['widgets']['default'] = array( - 'head' => 'Administre Widgets (experimental)', + 'head' => 'Administre Widgets', 'descr' => 'Um '. diff --git a/fp-interface/sharedtpls/atom.tpl b/fp-interface/sharedtpls/atom.tpl index 1a9d97e..2a685d1 100644 --- a/fp-interface/sharedtpls/atom.tpl +++ b/fp-interface/sharedtpls/atom.tpl @@ -5,10 +5,10 @@ {$flatpress.subtitle} - + FlatPress - {$flatpress.author} {$smarty.now|date_format:'%Y'} + {$flatpress.author} {'Y'|date} {$smarty.now|date_rfc3339} {$flatpress.author} @@ -31,14 +31,16 @@ - {foreach from=$enclosure item=encl} - - {/foreach} - + {if isset($enclosure)} + {foreach from=$enclosure item=encl} + + {/foreach} + {/if} + {/entry} {/entry_block} diff --git a/fp-interface/sharedtpls/comment-form.tpl b/fp-interface/sharedtpls/comment-form.tpl index 7fd352e..2585148 100644 --- a/fp-interface/sharedtpls/comment-form.tpl +++ b/fp-interface/sharedtpls/comment-form.tpl @@ -13,23 +13,51 @@ {if not $flatpress.loggedin} - - {*

    *}

    - + {if isset($error) && isset($error.name) && !empty($error.name)} + {assign var=class value="field-error"} + {else} + {assign var=class value=""} + {/if} + {if isset($values) && isset($values.name) && !empty($values.name)} + {assign var=namevalue value=$values.name} + {else} + {assign var=namevalue value=""} + {/if} +

    - + {if isset($error) && isset($error.email) && !empty($error.email)} + {assign var=class value="field-error"} + {else} + {assign var=class value=""} + {/if} + {if isset($values) && isset($values.email) && !empty($values.email)} + {assign var=emailvalue value=$values.email} + {else} + {assign var=emailvalue value=""} + {/if} +

    - + {if isset($error) && isset($error.url) && !empty($error.url)} + {assign var=class value="field-error"} + {else} + {assign var=class value=""} + {/if} + {if isset($values) && isset($values.url) && !empty($values.url)} + {assign var=urlvalue value=$values.url} + {else} + {assign var=urlvalue value=""} + {/if} +

    @@ -42,8 +70,18 @@
    -

    + {if isset($error) && isset($error.content) && !empty($error.content)} + {assign var=class value="field-error"} + {else} + {assign var=class value=""} + {/if} + {if isset($values) && isset($values.content) && !empty($values.content)} + {assign var=contentvalue value=$values.content} + {else} + {assign var=contentvalue value=""} + {/if} +

    {*here will go a plugin hook*}
    diff --git a/fp-interface/sharedtpls/contact.tpl b/fp-interface/sharedtpls/contact.tpl index febed51..c894976 100755 --- a/fp-interface/sharedtpls/contact.tpl +++ b/fp-interface/sharedtpls/contact.tpl @@ -13,16 +13,46 @@
    {$lang.contact.fieldset1}


    -

    + {if isset($error) && isset($error.name) && !empty($error.name)} + {assign var=class value="field-error"} + {else} + {assign var=class value=""} + {/if} + {if isset($values) && isset($values.name) && !empty($values.name)} + {assign var=namevalue value=$values.name} + {else} + {assign var=namevalue value=""} + {/if} +


    -

    + {if isset($error) && isset($error.email) && !empty($error.email)} + {assign var=class value="field-error"} + {else} + {assign var=class value=""} + {/if} + {if isset($values) && isset($values.email) && !empty($values.email)} + {assign var=emailvalue value=$values.email} + {else} + {assign var=emailvalue value=""} + {/if} +


    -

    + {if isset($error) && isset($error.url) && !empty($error.url)} + {assign var=class value="field-error"} + {else} + {assign var=class value=""} + {/if} + {if isset($values) && isset($values.url) && !empty($values.url)} + {assign var=urlvalue value=$values.url} + {else} + {assign var=urlvalue value=""} + {/if} +

    {comment_form} @@ -30,8 +60,18 @@
    {$lang.contact.fieldset2}


    -

    + {if isset($error) && isset($error.content) && !empty($error.content)} + {assign var=class value="field-error"} + {else} + {assign var=class value=""} + {/if} + {if isset($values) && isset($values.content) && !empty($values.content)} + {assign var=contentvalue value=$values.content} + {else} + {assign var=contentvalue value=""} + {/if} +

    diff --git a/fp-interface/sharedtpls/errorlist.tpl b/fp-interface/sharedtpls/errorlist.tpl index 3829ce7..941b49e 100644 --- a/fp-interface/sharedtpls/errorlist.tpl +++ b/fp-interface/sharedtpls/errorlist.tpl @@ -1,5 +1,5 @@
    - {if $error} + {if isset($error)}
      {foreach from=$error key=field item=msg}
    • @@ -13,7 +13,7 @@
    {/if} - {if $warnings} + {if isset($warnings)}
      {foreach from=$warnings key=field item=msg}
    • @@ -27,7 +27,7 @@
    {/if} - {if $notifications} + {if isset($notifications)}
    {$lang.search.fset3} + {if !isset($categories)} {assign var=categories value=""} {/if} {list_categories type="radio" selected=$categories}

    {$lang.search.catdescr}

    diff --git a/fp-interface/sharedtpls/search_results.tpl b/fp-interface/sharedtpls/search_results.tpl index e5cb0d1..1c34e8c 100755 --- a/fp-interface/sharedtpls/search_results.tpl +++ b/fp-interface/sharedtpls/search_results.tpl @@ -1,4 +1,4 @@ -{if $noresults} +{if isset($noresults)}

    {$smarty.request.q|string_format:$lang.search.descrnores}

    {else}

    {$smarty.request.q|string_format:$lang.search.descrres}

    diff --git a/fp-interface/themes/leggero/cpheader.tpl b/fp-interface/themes/leggero/cpheader.tpl index 83ea68e..01d74b1 100644 --- a/fp-interface/themes/leggero/cpheader.tpl +++ b/fp-interface/themes/leggero/cpheader.tpl @@ -7,6 +7,8 @@ {action hook=admin_head} +{if !isset($panel)} {assign var=panel value=""} {/if} +{if !isset($action)} {assign var=action value=""} {/if}
    diff --git a/fp-interface/themes/leggero/default.tpl b/fp-interface/themes/leggero/default.tpl index 2b7b0fc..9d597b1 100755 --- a/fp-interface/themes/leggero/default.tpl +++ b/fp-interface/themes/leggero/default.tpl @@ -7,7 +7,7 @@

    {$subject}

    - {if $rawcontent} {$content} + {if isset($rawcontent) and $rawcontent} {$content} {else} {include file=$content}{/if}
    diff --git a/fp-interface/themes/leggero/header.tpl b/fp-interface/themes/leggero/header.tpl index 2975d1a..b5b1a58 100755 --- a/fp-interface/themes/leggero/header.tpl +++ b/fp-interface/themes/leggero/header.tpl @@ -1,10 +1,10 @@ - - + + {$flatpress.title|tag:wp_title:'«'} - - + + {action hook=wp_head} diff --git a/fp-interface/themes/leggero/leggero-v2/imgs/backshade.png b/fp-interface/themes/leggero/leggero-v2/imgs/backshade.png new file mode 100644 index 0000000..9be237f Binary files /dev/null and b/fp-interface/themes/leggero/leggero-v2/imgs/backshade.png differ diff --git a/fp-interface/themes/leggero/leggero/res/column.css b/fp-interface/themes/leggero/leggero/res/column.css index e82334a..55be5e3 100644 --- a/fp-interface/themes/leggero/leggero/res/column.css +++ b/fp-interface/themes/leggero/leggero/res/column.css @@ -7,8 +7,11 @@ Ispired by: http://pluxml.org theme default Name: Leggero Author: NoWhereMan & drudo -Version: 0.1 +Version: 0.2 Module: style.css + +last change: 2020-08-08 + */ @@ -16,14 +19,17 @@ Module: style.css /* ===== COLUMN ===== */ #column { float: right; - width: 195px !important; - width: 180px; + /* width: 195px !important; + width: 180px; */ + width: 28%; font-size: 80% !important; font-size: 75%; height:1%; - margin-bottom: 5px; - padding: 10px; - border-left: solid 1px #ccc + margin: 1em; + padding: 0.7em; + /* margin-bottom: 5px; + padding: 10px; */ + /* border-left: solid 1px #ccc */ } #column h4 { diff --git a/fp-interface/themes/leggero/leggero/res/common.css b/fp-interface/themes/leggero/leggero/res/common.css index ce956c3..de77c71 100644 --- a/fp-interface/themes/leggero/leggero/res/common.css +++ b/fp-interface/themes/leggero/leggero/res/common.css @@ -7,8 +7,11 @@ Ispired by: http://pluxml.org theme default Name: Leggero Author: NoWhereMan & drudo -Version: 0.1 +Version: 0.2 Module: common.css + +last change: 2020-08-08 + */ @@ -24,9 +27,10 @@ html { body { font-size: 100%; padding: 0; - text-align:center; + /* text-align: center; */ background: white url(../imgs/backshade.png) repeat-x; color: black; + width: 100% } hr { display: none } @@ -35,6 +39,12 @@ p { margin: .5em 0 } img { border: none } +/* Responsive Design img */ +img { + max-width: 100%; + height: auto; +} + blockquote { width: 90%; color: #666; @@ -122,7 +132,7 @@ h1 { /* Title of the blog */ font-size: 2em; letter-spacing: 2px; - margin: 2em 0 0 0 + margin: 2em 0 0 0.5em } h2 { } /* see h2.date */ @@ -133,7 +143,8 @@ h3 { font-style: italic; font-size: 1.5em; color: #333333; - margin: 0 + margin: 0; + padding: 1em 0 1em 0; } h4 { font-size: 1.2em; } @@ -143,10 +154,13 @@ h4 { font-size: 1.2em; } /* ===== DIV CONTAINER ALL ELEMENTS BLOCK ===== */ #body-container { text-align: left; - width: 760px !important; + /*width: 760px !important; width: 748px; /* fix for I.E. */ - margin: 0 auto 0 auto; - padding: 5px; + width: 85%; + margin: 0 auto; + max-width: 68em; + /* padding: 5px; */ + padding: 0.3em; border: solid 1px #ccc; background-color: white } @@ -155,31 +169,40 @@ h4 { font-size: 1.2em; } /* ===== HEAD ===== */ #head { + clear: both; font-family: 'book antiqua', georgia, garamond, times, 'times new roman', serif; - padding: 95px 10px 5px 5px; + /* padding: 95px 10px 5px 5px; margin: 10px; background: #c37676 url('../imgs/shade.png') repeat-x; - border: #bbb 1px solid + border: #bbb 1px solid */ + margin: 1em; + padding: 7em 0.6em 0.5em 0.5em; + border-radius: 1em; + border: 0; + background-image: linear-gradient( #aa4142, #c37576); + /* background: #aa4142 */ } #head a { color: white; text-decoration: none } +#head a:hover { color: white; text-decoration: underline } - .subtitle { - font-size: 100%; - font-style: oblique; - color: #F1F1F1; - margin: .5em 0 0 0 - } +.subtitle { + font-size: 100%; + font-style: oblique; + color: #F1F1F1; + margin: .5em 0 1em 1.2em +} /* ===== DIV CONTAINER "MAIN" ===== */ #outer-container { - position: relative; + /* position: relative; height: 1%; margin: 0px; padding: 0px; border-top: 1px solid white; /* problem with I.E. */ + width: 100%; background-color: white } @@ -189,17 +212,20 @@ h4 { font-size: 1.2em; } #main h4 { margin: 2em 0 0 0} #main { - float:left; - position: relative; + float: left; + /* position: relative; width: 508px !important; - width: 478px; + width: 478px; */ + width: 62%; font-size: 100%; - margin: 12px; + margin: 1em; } #main p { line-height: 1.5em; margin-top: 1.2em; } -#main img { margin: .5em } +#main img { margin: 0.5em } + +#main img.emoticon { margin: 0; padding: 0 } /* === List === */ #main ul { @@ -224,7 +250,7 @@ h4 { font-size: 1.2em; } /* === Class of main block === */ h2.date { - font-size: 0.5em; + font-size: 80%; color: #aaa; } @@ -232,7 +258,7 @@ h4 { font-size: 1.2em; } font-size: 80%; font-style: oblique; color: gray; - margin: .2em 0 .8em 0 + margin: .2em 0 0 0 } /* .entry class */ @@ -284,6 +310,9 @@ h4 { font-size: 1.2em; } clear: both; font-size: 80%; color: #555; - padding: 5px; + background-color: #dcdcdc; + padding: 1em; + margin: 0 1em 1em 1em; + text-align: center; border-top: #bbb 1px solid } diff --git a/fp-interface/themes/leggero/leggero/res/style.css b/fp-interface/themes/leggero/leggero/res/style.css index e4a70e8..d9f8b98 100644 --- a/fp-interface/themes/leggero/leggero/res/style.css +++ b/fp-interface/themes/leggero/leggero/res/style.css @@ -7,8 +7,11 @@ Ispired by: http://pluxml.org theme default Name: Leggero Author: NoWhereMan & drudo -Version: 0.1 +Version: 0.2 Module: style.css + +last change: 2020-08-08 + */ @@ -30,5 +33,67 @@ body { margin: 80px 0 0 0 } #comments li.comment-admin strong.comment-name { font-size:140% } #widget-searchbox form { - text-align: center; + /* text-align: center; */ } + +/* 800er Bildschirme zum Beispiel iPad Hochformat */ +@media only screen and (max-width: 768px) { + +#outer-container { + margin: 0; + padding: 0; + width: 100%; +} + +#main { + width: 100%; + padding: 0.5em; + /* border: 1px solid yellow; */ +} + +#column { + width: 100%; + font-size: 80%; + margin-bottom: 2em; + padding: 0.5em; + /* border: 1px solid red; */ + overflow: auto; /* shit, bei 84% Bildbreite wird es eng! */ +} + +} + +/* Kleinbildschirme */ +@media only screen and (max-width: 480px) { + +#body-container { + margin: 0; + padding: 0; + width: 98%; +} + +#head { + margin: 0; + padding: 0; + width: 100%; +} + +#outer-container { + margin: 0; + padding: 0; + width: 100%; +} + +#main { + margin: 0; + padding: 0; + width: 100%; +} + +#column { + margin: 0; + padding: 0; + width: 100%; +} + + +} \ No newline at end of file diff --git a/fp-plugins/accessibleantispam/lang/lang.es-es.php b/fp-plugins/accessibleantispam/lang/lang.es-es.php new file mode 100644 index 0000000..701fcb8 --- /dev/null +++ b/fp-plugins/accessibleantispam/lang/lang.es-es.php @@ -0,0 +1,15 @@ + 'Para ayudar a eliminar los ataques de spam automatizados '. + 'debemos pedirle que demuestre que es humano. Que es ', + + 'sum' => '%s más %s ?', + 'sub' => '%2$s extraído de %1$s ?', + 'prod' => '%s veces %s ?', + + 'error' => 'Lo siento, diste una respuesta incorrecta. Inténtalo de nuevo.' + + ); + diff --git a/fp-plugins/accessibleantispam/plugin.accessibleantispam.php b/fp-plugins/accessibleantispam/plugin.accessibleantispam.php index 1fe73c7..86fc524 100755 --- a/fp-plugins/accessibleantispam/plugin.accessibleantispam.php +++ b/fp-plugins/accessibleantispam/plugin.accessibleantispam.php @@ -1,22 +1,20 @@ append('error', $lang['plugin']['accessibleantispam']['error']); + + $smarty->append('error', $lang ['plugin'] ['accessibleantispam'] ['error']); } - - if ( AASPAM_DEBUG && $f=@fopen(AASPAM_LOG, 'a') ) { - $arr['aaspam-q'] = $_POST['aaspam']; - $arr['aaspam-a'] = $v; - $arr['SUCCESS'] = $ret; - - $s = date('r'). "|" . session_id().'|'.utils_kimplode($arr)."\r\n"; - @fwrite($f, $s); - @fclose($f); - } - - + + if (AASPAM_DEBUG && $f = @fopen(AASPAM_LOG, 'a')) { + $arr ['aaspam-q'] = $_POST ['aaspam']; + $arr ['aaspam-a'] = $v; + $arr ['SUCCESS'] = $ret; + + $s = date('r') . "|" . session_id() . '|' . utils_kimplode($arr) . "\r\n"; + @fwrite($f, $s); + @fclose($f); + } + return $ret; } function plugin_aaspam_comment_form() { - + // we get a random arithmetic operation // between sum, subtraction and multiplication; - + // we intentionally left out division because // it can lead to situations like division by zero // or floating point numbers + $myop = array_rand($ops = array( + '+', + '-', + '*' + )); + $op = $ops [$myop]; - $myop = array_rand($ops=array('+','-','*')); - $op=$ops[$myop]; - // we get two random integers between 1 and 10 $v1 = mt_rand(1, 10); - // we rand $v2 until it differs from $v1 - // (otherwise result for subtractions is zero) - while (($v2 = mt_rand(1, 10))==$v1); - + // we rand $v2 until it differs from $v1 + // (otherwise result for subtractions is zero) + while (($v2 = mt_rand(1, 10)) == $v1) + ; + // if operation is subtraction // the higher number must always come first // or you'll get a negative integer - if ($v2>$v1 && $op=='-') { + if ($v2 > $v1 && $op == '-') { $tmp = $v1; $v1 = $v2; $v2 = $tmp; - } // execute the operation - switch($op) { - case '+' : - $v = $v1+$v2; + switch ($op) { + case '+': + $v = $v1 + $v2; break; - case '-' : - $v = $v1-$v2; + case '-': + $v = $v1 - $v2; break; - case '*' : - $v = $v1*$v2; + case '*': + $v = $v1 * $v2; break; - } - + } - sess_add('aaspam', $v); - + // load plugin strings // they're located under plugin.PLUGINNAME/lang/LANGID/ $lang = lang_load('plugin:accessibleantispam'); - - $langstrings =& $lang['plugin']['accessibleantispam']; - + + $langstrings = & $lang ['plugin'] ['accessibleantispam']; + // get the correct question depending on the operation - switch($op) { - case '+' : - $question = $langstrings['sum']; + switch ($op) { + case '+': + $question = $langstrings ['sum']; break; - case '-' : - $question = $langstrings['sub']; + case '-': + $question = $langstrings ['sub']; break; - case '*' : - $question = $langstrings['prod']; + case '*': + $question = $langstrings ['prod']; break; - } - + } + // format the question with numbers at the proper positions $question = sprintf($question, $v1, $v2); - - if ( AASPAM_DEBUG && $f=@fopen(AASPAM_LOG, 'a') ) { - $arr['aaspam-q'] = $v; - @fwrite($f, date('r'). '|'.session_id() .'|'. utils_kimplode($arr)."\r\n"); + + if (AASPAM_DEBUG && $f = @fopen(AASPAM_LOG, 'a')) { + $arr ['aaspam-q'] = $v; + @fwrite($f, date('r') . '|' . session_id() . '|' . utils_kimplode($arr) . "\r\n"); @fclose($f); } - + // echoes the question and the form part echo <<
    -

    -STR; - +


    +

    + STR; } - ?> diff --git a/fp-plugins/adminarea/lang/lang.es-es.php b/fp-plugins/adminarea/lang/lang.es-es.php new file mode 100644 index 0000000..a948aba --- /dev/null +++ b/fp-plugins/adminarea/lang/lang.es-es.php @@ -0,0 +1,14 @@ + 'Área de administración', + 'welcome' => 'Bienvenido ', + 'admin_panel' => 'Panel de administrador', + 'add_entry' => 'Añadir entrada', + 'add_static' => 'Añadir estática', + 'logout' => 'Cerrar sesión' + + ); + +?> \ No newline at end of file diff --git a/fp-plugins/adminarea/plugin.adminarea.php b/fp-plugins/adminarea/plugin.adminarea.php index 5d8d10c..f446f9e 100644 --- a/fp-plugins/adminarea/plugin.adminarea.php +++ b/fp-plugins/adminarea/plugin.adminarea.php @@ -2,11 +2,11 @@ /* * Plugin Name: AdminArea - * Plugin URI: http://www.nowhereland.it/ - * Description: AdminArea plugin. Part of the standard distribution ;) - * Author: NoWhereMan + * Plugin URI: https://www.flatpress.org + * Author: FlatPress + * Author URI: https://www.flatpress.org + * Description: AdminArea plugin. Part of the standard distribution. * Version: 1.0 - * Author URI: http://www.nowhereland.it/ */ function plugin_adminarea_widget() { diff --git a/fp-plugins/akismet/lang/lang.es-es.php b/fp-plugins/akismet/lang/lang.es-es.php new file mode 100644 index 0000000..09e31be --- /dev/null +++ b/fp-plugins/akismet/lang/lang.es-es.php @@ -0,0 +1,23 @@ + 'No se estableció la clave de API. Abra el Plugin para configurar su clave de API. Registrarse en Wordpress.com para conseguir uno' + ); + + $lang['admin']['plugin']['submenu']['akismet'] = 'Configuración de Akismet'; + + $lang['admin']['plugin']['akismet'] = array( + 'head' => 'Configuración de Akismet', + 'description'=>'Para muchas personas, Akismet reducirá en gran medida ' + .'o incluso eliminar por completo el spam de comentarios y trackback que recibe en su sitio. ' + .'Si aún no tiene una cuenta de WordPress.com, puede obtener una en '. + 'WordPress.com.', + 'apikey' => 'WordPress.com API Key', + 'whatis' => '(¿Que es esto?)', + 'submit' => 'Guardar clave de API' + ); + $lang['admin']['plugin']['akismet']['msgs'] = array( + 1 => 'Clave de API guardada', + -1 => 'La clave de API no es válida' + ); + +?> \ No newline at end of file diff --git a/fp-plugins/akismet/plugin.akismet.php b/fp-plugins/akismet/plugin.akismet.php index 20d4401..890bb51 100644 --- a/fp-plugins/akismet/plugin.akismet.php +++ b/fp-plugins/akismet/plugin.akismet.php @@ -1,14 +1,12 @@ setAuthor($contents['name']); - $akismet->setAuthorEmail(isset($contents['email'])? $contents['email'] : ''); - $akismet->setAuthorURL(isset($contents['url'])? $contents['url'] : ''); - $akismet->setContent($contents['content']); - - if ($v= $akismet->isSpam()){ - global $smarty; - $smarty->assign('error', array('ERROR: Comment is invalid')); + if (!$bool) return false; - } + + global $fp_config; + + $akismet = new Akismet($fp_config ['general'] ['www'], plugin_getoptions('akismet', 'apikey')); + $akismet->setAuthor($contents ['name']); + $akismet->setAuthorEmail(isset($contents ['email']) ? $contents ['email'] : ''); + $akismet->setAuthorURL(isset($contents ['url']) ? $contents ['url'] : ''); + $akismet->setContent($contents ['content']); + + if ($v = $akismet->isSpam()) { + global $smarty; + $smarty->assign('error', array( + 'ERROR: Comment is invalid' + )); + return false; + } return true; } -if (class_exists('AdminPanelAction')){ +if (class_exists('AdminPanelAction')) { + + class admin_plugin_akismet extends AdminPanelAction { - class admin_plugin_akismet extends AdminPanelAction { - var $langres = 'plugin:akismet'; - + function setup() { $this->smarty->assign('admin_resource', "plugin:akismet/admin.plugin.akismet"); } - + function main() { $akismetconf = plugin_getoptions('akismet'); $this->smarty->assign('akismetconf', $akismetconf); } - + function onsubmit() { global $fp_config; - - if ($_POST['wp-apikey']){ - - plugin_addoption('akismet', 'apikey', $_POST['wp-apikey']); + + if ($_POST ['wp-apikey']) { + + plugin_addoption('akismet', 'apikey', $_POST ['wp-apikey']); plugin_saveoptions('akismet'); - + $this->smarty->assign('success', 1); } else { - $this->smarty->assign('success', -1); + $this->smarty->assign('success', -1); } - + return 2; } - + } admin_addpanelaction('plugin', 'akismet', true); - } diff --git a/fp-plugins/archives/lang/lang.es-es.php b/fp-plugins/archives/lang/lang.es-es.php new file mode 100644 index 0000000..a308a91 --- /dev/null +++ b/fp-plugins/archives/lang/lang.es-es.php @@ -0,0 +1,9 @@ + 'Archivos', + 'no_posts' => 'No hay publicaciones', + + ); + +?> diff --git a/fp-plugins/archives/plugin.archives.php b/fp-plugins/archives/plugin.archives.php index d00061d..760fd37 100644 --- a/fp-plugins/archives/plugin.archives.php +++ b/fp-plugins/archives/plugin.archives.php @@ -1,86 +1,84 @@ _directory === $directory) { - // add year to the list (do not closes li, because - // we may have nested elements) - $this->_year = $file; - $lnk = get_year_link($file); - $this->_htmllist[$this->_year] = "
  • 20$file"; - return 1; - } elseif (is_dir($f)) { - $this->_months[] = $file; - return 0; - } + + var $_directory = CONTENT_DIR; + + var $_list = array(); + + var $_htmllist = array(); + + var $_months = array(); + + var $_year = ''; + + function _checkFile($directory, $file) { + $f = "$directory/$file"; + + if (ctype_digit($file)) { + if ($this->_directory === $directory) { + // add year to the list (do not closes li, because + // we may have nested elements) + $this->_year = $file; + $lnk = get_year_link($file); + $this->_htmllist [$this->_year] = "
  • 20$file"; + return 1; + } elseif (is_dir($f)) { + $this->_months [] = $file; + return 0; } } - - function _exitingDir($directory = null, $file=null) { - - $y = $this->_year; - - if ($mos =& $this->_months) { - sort($mos); - $list = ''; - $linearlist = array(); - foreach($mos as $mth) { - $lnk = get_month_link($y, $mth); - $the_month = theme_date_format( mktime(0, 0, 0, $mth, 1, 0 ), '%B'); - $list = "
  • ". - $the_month - .'
  • ' . $list; - $linearlist["$the_month 20{$this->_year}"] = $lnk; - } - $list = '
      ' . $list . '
    '; + } + + function _exitingDir($directory = null, $file = null) { + $y = $this->_year; + + if ($mos = & $this->_months) { + sort($mos); + $list = ''; + $linearlist = array(); + foreach ($mos as $mth) { + $lnk = get_month_link($y, $mth); + $the_month = theme_date_format(mktime(0, 0, 0, $mth, 1, 0), '%B'); + $list = "
  • " . $the_month . '
  • ' . $list; + $linearlist ["$the_month 20{$this->_year}"] = $lnk; } - - $mos = array(); - - // we close year's li - $this->_list[$y] = $linearlist; - $this->_htmllist[$y] .= $list . ''; + $list = '
      ' . $list . '
    '; } - function getList() { - krsort($this->_list); - return $this->_list; - } - - function getHtmlList() { - krsort($this->_htmllist); - return implode($this->_htmllist); - } - - + $mos = array(); + + // we close year's li + $this->_list [$y] = $linearlist; + $this->_htmllist [$y] .= $list . ''; + } + + function getList() { + krsort($this->_list); + return $this->_list; + } + + function getHtmlList() { + krsort($this->_htmllist); + return implode($this->_htmllist); + } + } - function plugin_archives_head() { - global $PLUGIN_ARCHIVES_MONTHLIST; - $PLUGIN_ARCHIVES_MONTHLIST = new plugin_archives_monthlist; + $PLUGIN_ARCHIVES_MONTHLIST = new plugin_archives_monthlist(); echo "\n\n"; - foreach($PLUGIN_ARCHIVES_MONTHLIST->getList() as $y => $months) { + foreach ($PLUGIN_ARCHIVES_MONTHLIST->getList() as $y => $months) { foreach ($months as $ttl => $link) echo "\n"; } @@ -90,19 +88,14 @@ function plugin_archives_head() { add_filter('wp_head', 'plugin_archives_head'); function plugin_archives_widget() { - lang_load('plugin:archives'); global $lang, $PLUGIN_ARCHIVES_MONTHLIST; - - + return array( - 'subject' => $lang['plugin']['archives']['subject'], - - 'content' => ($list = $PLUGIN_ARCHIVES_MONTHLIST->getHtmlList()) ? - '
      ' . $list . '
    ' - : - "

    {$lang['plugin']['archives']['no_posts']}

    " - ); + 'subject' => $lang ['plugin'] ['archives'] ['subject'], + + 'content' => ($list = $PLUGIN_ARCHIVES_MONTHLIST->getHtmlList()) ? '
      ' . $list . '
    ' : "

    {$lang['plugin']['archives']['no_posts']}

    " + ); } register_widget('archives', 'Archives', 'plugin_archives_widget'); diff --git a/fp-plugins/bbcode/inc/stringparser.class.php b/fp-plugins/bbcode/inc/stringparser.class.php index 476b872..1f1fd98 100755 --- a/fp-plugins/bbcode/inc/stringparser.class.php +++ b/fp-plugins/bbcode/inc/stringparser.class.php @@ -5,56 +5,60 @@ * These classes provide the means to parse any kind of string into a tree-like * memory structure. It would e.g. be possible to create an HTML parser based * upon this class. - * + * * Version: 0.3.3 * * @author Christian Seiler * @copyright Christian Seiler 2004-2008 * @package stringparser - * - * The MIT License - * - * Copyright (c) 2004-2009 Christian Seiler - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * + * The MIT License + * + * Copyright (c) 2004-2009 Christian Seiler + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ /** * String parser mode: Search for the next character + * * @see StringParser::_parserMode */ -define ('STRINGPARSER_MODE_SEARCH', 1); +define('STRINGPARSER_MODE_SEARCH', 1); /** * String parser mode: Look at each character of the string + * * @see StringParser::_parserMode */ -define ('STRINGPARSER_MODE_LOOP', 2); +define('STRINGPARSER_MODE_LOOP', 2); /** * Filter type: Prefilter + * * @see StringParser::addFilter, StringParser::_prefilters */ -define ('STRINGPARSER_FILTER_PRE', 1); +define('STRINGPARSER_FILTER_PRE', 1); /** * Filter type: Postfilter + * * @see StringParser::addFilter, StringParser::_postfilters */ -define ('STRINGPARSER_FILTER_POST', 2); +define('STRINGPARSER_FILTER_POST', 2); /** * Generic string parser class @@ -64,6 +68,7 @@ define ('STRINGPARSER_FILTER_POST', 2); * @package stringparser */ class StringParser { + /** * String parser mode * @@ -84,42 +89,47 @@ class StringParser { * @see STRINGPARSER_MODE_SEARCH, STRINGPARSER_MODE_LOOP */ var $_parserMode = STRINGPARSER_MODE_SEARCH; - + /** * Raw text + * * @access protected * @var string */ var $_text = ''; - + /** * Parse stack + * * @access protected * @var array */ - var $_stack = array (); - + var $_stack = array(); + /** * Current position in raw text + * * @access protected * @var integer */ var $_cpos = -1; - + /** * Root node + * * @access protected * @var mixed */ var $_root = null; - + /** * Length of the text + * * @access protected * @var integer */ var $_length = -1; - + /** * Flag if this object is already parsing a text * @@ -130,7 +140,7 @@ class StringParser { * @var boolean */ var $_parsing = false; - + /** * Strict mode * @@ -140,14 +150,15 @@ class StringParser { * @var boolean */ var $strict = false; - + /** * Characters or strings to look for + * * @access protected * @var array */ - var $_charactersSearch = array (); - + var $_charactersSearch = array(); + /** * Characters currently allowed * @@ -164,36 +175,40 @@ class StringParser { * @access protected * @var array */ - var $_charactersAllowed = array (); - + var $_charactersAllowed = array(); + /** * Current parser status + * * @access protected * @var int */ var $_status = 0; - + /** * Prefilters + * * @access protected * @var array */ - var $_prefilters = array (); - + var $_prefilters = array(); + /** * Postfilters + * * @access protected * @var array */ - var $_postfilters = array (); - + var $_postfilters = array(); + /** * Recently reparsed? + * * @access protected * @var bool */ var $_recentlyReparsed = false; - + /** * Constructor * @@ -201,108 +216,112 @@ class StringParser { */ function __construct() { } - - function StringParser () { + + function StringParser() { } - + /** * Add a filter * * @access public - * @param int $type The type of the filter - * @param mixed $callback The callback to call + * @param int $type + * The type of the filter + * @param mixed $callback + * The callback to call * @return bool * @see STRINGPARSER_FILTER_PRE, STRINGPARSER_FILTER_POST */ - function addFilter ($type, $callback) { + function addFilter($type, $callback) { // make sure the function is callable - if (!is_callable ($callback)) { + if (!is_callable($callback)) { return false; } - + switch ($type) { case STRINGPARSER_FILTER_PRE: - $this->_prefilters[] = $callback; + $this->_prefilters [] = $callback; break; case STRINGPARSER_FILTER_POST: - $this->_postfilters[] = $callback; + $this->_postfilters [] = $callback; break; default: return false; } - + return true; } - + /** * Remove all filters * * @access public - * @param int $type The type of the filter or 0 for all + * @param int $type + * The type of the filter or 0 for all * @return bool * @see STRINGPARSER_FILTER_PRE, STRINGPARSER_FILTER_POST */ - function clearFilters ($type = 0) { + function clearFilters($type = 0) { switch ($type) { case 0: - $this->_prefilters = array (); - $this->_postfilters = array (); + $this->_prefilters = array(); + $this->_postfilters = array(); break; case STRINGPARSER_FILTER_PRE: - $this->_prefilters = array (); + $this->_prefilters = array(); break; case STRINGPARSER_FILTER_POST: - $this->_postfilters = array (); + $this->_postfilters = array(); break; default: return false; } return true; } - + /** * This function parses the text * * @access public - * @param string $text The text to parse + * @param string $text + * The text to parse * @return mixed Either the root object of the tree if no output method - * is defined, the tree reoutput to e.g. a string or false - * if an internal error occured, such as a parse error if - * in strict mode or the object is already parsing a text. + * is defined, the tree reoutput to e.g. a string or false + * if an internal error occured, such as a parse error if + * in strict mode or the object is already parsing a text. */ - function parse ($text) { + function parse($text) { if ($this->_parsing) { return false; } $this->_parsing = true; - $this->_text = $this->_applyPrefilters ($text); + $this->_text = $this->_applyPrefilters($text); $this->_output = null; - $this->_length = strlen ($this->_text); + $this->_length = strlen($this->_text); $this->_cpos = 0; - unset ($this->_stack); - $this->_stack = array (); - if (is_object ($this->_root)) { - StringParser_Node::destroyNode ($this->_root); + unset($this->_stack); + $this->_stack = array(); + if (is_object($this->_root)) { + StringParser_Node::destroyNode($this->_root); } - unset ($this->_root); - $this->_root = new StringParser_Node_Root (); - $this->_stack[0] = $this->_root; - - $this->_parserInit (); - + unset($this->_root); + $this->_root = new StringParser_Node_Root(); + $this->_stack [0] = $this->_root; + + $this->_parserInit(); + $finished = false; - + while (!$finished) { switch ($this->_parserMode) { case STRINGPARSER_MODE_SEARCH: - $res = $this->_searchLoop (); + $res = $this->_searchLoop(); if (!$res) { $this->_parsing = false; return false; } break; case STRINGPARSER_MODE_LOOP: - $res = $this->_loop (); + $res = $this->_loop(); if (!$res) { $this->_parsing = false; return false; @@ -312,14 +331,14 @@ class StringParser { $this->_parsing = false; return false; } - - $res = $this->_closeRemainingBlocks (); + + $res = $this->_closeRemainingBlocks(); if (!$res) { if ($this->strict) { $this->_parsing = false; return false; } else { - $res = $this->_reparseAfterCurrentBlock (); + $res = $this->_reparseAfterCurrentBlock(); if (!$res) { $this->_parsing = false; return false; @@ -329,104 +348,106 @@ class StringParser { } $finished = true; } - - $res = $this->_modifyTree (); - + + $res = $this->_modifyTree(); + if (!$res) { $this->_parsing = false; return false; } - - $res = $this->_outputTree (); - + + $res = $this->_outputTree(); + if (!$res) { $this->_parsing = false; return false; } - - if (is_null ($this->_output)) { + + if (is_null($this->_output)) { $root = $this->_root; - unset ($this->_root); + unset($this->_root); $this->_root = null; - while (count ($this->_stack)) { - unset ($this->_stack[count($this->_stack)-1]); + while (count($this->_stack)) { + unset($this->_stack [count($this->_stack) - 1]); } - $this->_stack = array (); + $this->_stack = array(); $this->_parsing = false; return $root; } - - $res = StringParser_Node::destroyNode ($this->_root); + + $res = StringParser_Node::destroyNode($this->_root); if (!$res) { $this->_parsing = false; return false; } - unset ($this->_root); + unset($this->_root); $this->_root = null; - while (count ($this->_stack)) { - unset ($this->_stack[count($this->_stack)-1]); + while (count($this->_stack)) { + unset($this->_stack [count($this->_stack) - 1]); } - $this->_stack = array (); - + $this->_stack = array(); + $this->_parsing = false; return $this->_output; } - + /** * Apply prefilters * * It is possible to specify prefilters for the parser to do some * manipulating of the string beforehand. */ - function _applyPrefilters ($text) { + function _applyPrefilters($text) { foreach ($this->_prefilters as $filter) { - if (is_callable ($filter)) { - $ntext = call_user_func ($filter, $text); - if (is_string ($ntext)) { + if (is_callable($filter)) { + $ntext = call_user_func($filter, $text); + if (is_string($ntext)) { $text = $ntext; } } } return $text; } - + /** * Apply postfilters * * It is possible to specify postfilters for the parser to do some * manipulating of the string afterwards. */ - function _applyPostfilters ($text) { + function _applyPostfilters($text) { foreach ($this->_postfilters as $filter) { - if (is_callable ($filter)) { - $ntext = call_user_func ($filter, $text); - if (is_string ($ntext)) { + if (is_callable($filter)) { + $ntext = call_user_func($filter, $text); + if (is_string($ntext)) { $text = $ntext; } } } return $text; } - + /** * Abstract method: Manipulate the tree + * * @access protected * @return bool */ - function _modifyTree () { + function _modifyTree() { return true; } - + /** * Abstract method: Output tree + * * @access protected * @return bool */ - function _outputTree () { + function _outputTree() { // this could e.g. call _applyPostfilters return true; } - + /** * Restart parsing after current block * @@ -436,24 +457,24 @@ class StringParser { * @access protected * @return bool */ - function _reparseAfterCurrentBlock () { + function _reparseAfterCurrentBlock() { // this should definitely not happen! - if (($stack_count = count ($this->_stack)) < 2) { + if (($stack_count = count($this->_stack)) < 2) { return false; } - $topelem = $this->_stack[$stack_count-1]; - + $topelem = $this->_stack [$stack_count - 1]; + $node_parent = $topelem->_parent; // remove the child from the tree - $res = $node_parent->removeChild ($topelem, false); + $res = $node_parent->removeChild($topelem, false); if (!$res) { return false; } - $res = $this->_popNode (); + $res = $this->_popNode(); if (!$res) { return false; } - + // now try to get the position of the object if ($topelem->occurredAt < 0) { return false; @@ -461,87 +482,94 @@ class StringParser { // HACK: could it be necessary to set a different status // if yes, how should this be achieved? Another member of // StringParser_Node? - $this->_setStatus (0); - $res = $this->_appendText ($this->_text{$topelem->occurredAt}); + $this->_setStatus(0); + $res = $this->_appendText($this->_text [$topelem->occurredAt]); if (!$res) { return false; } - + $this->_cpos = $topelem->occurredAt + 1; $this->_recentlyReparsed = true; - + return true; } - + /** * Abstract method: Close remaining blocks + * * @access protected */ - function _closeRemainingBlocks () { + function _closeRemainingBlocks() { // everything closed - if (count ($this->_stack) == 1) { + if (count($this->_stack) == 1) { return true; } // not everything closed if ($this->strict) { return false; } - while (count ($this->_stack) > 1) { - $res = $this->_popNode (); + while (count($this->_stack) > 1) { + $res = $this->_popNode(); if (!$res) { return false; } } return true; } - + /** * Abstract method: Initialize the parser + * * @access protected */ - function _parserInit () { - $this->_setStatus (0); + function _parserInit() { + $this->_setStatus(0); } - + /** * Abstract method: Set a specific status + * * @access protected */ - function _setStatus ($status) { + function _setStatus($status) { if ($status != 0) { return false; } - $this->_charactersSearch = array (); - $this->_charactersAllowed = array (); + $this->_charactersSearch = array(); + $this->_charactersAllowed = array(); $this->_status = $status; return true; } - + /** * Abstract method: Handle status + * * @access protected - * @param int $status The current status - * @param string $needle The needle that was found + * @param int $status + * The current status + * @param string $needle + * The needle that was found * @return bool */ - function _handleStatus ($status, $needle) { - $this->_appendText ($needle); - $this->_cpos += strlen ($needle); + function _handleStatus($status, $needle) { + $this->_appendText($needle); + $this->_cpos += strlen($needle); return true; } - + /** * Search mode loop + * * @access protected * @return bool */ - function _searchLoop () { + function _searchLoop() { $i = 0; while (1) { // make sure this is false! $this->_recentlyReparsed = false; - - list ($needle, $offset) = $this->_strpos ($this->_charactersSearch, $this->_cpos); + + list ($needle, $offset) = $this->_strpos($this->_charactersSearch, $this->_cpos); // parser ends here if ($needle === false) { // original status 0 => no problem @@ -553,25 +581,25 @@ class StringParser { return false; } // break up parsing operation of current node - $res = $this->_reparseAfterCurrentBlock (); + $res = $this->_reparseAfterCurrentBlock(); if (!$res) { return false; } continue; } // get subtext - $subtext = substr ($this->_text, $this->_cpos, $offset - $this->_cpos); - $res = $this->_appendText ($subtext); + $subtext = substr($this->_text, $this->_cpos, $offset - $this->_cpos); + $res = $this->_appendText($subtext); if (!$res) { return false; } $this->_cpos = $offset; - $res = $this->_handleStatus ($this->_status, $needle); + $res = $this->_handleStatus($this->_status, $needle); if (!$res && $this->strict) { return false; } if (!$res) { - $res = $this->_appendText ($this->_text{$this->_cpos}); + $res = $this->_appendText($this->_text [$this->_cpos]); if (!$res) { return false; } @@ -582,114 +610,118 @@ class StringParser { $this->_recentlyReparsed = false; continue; } - $this->_cpos += strlen ($needle); + $this->_cpos += strlen($needle); } - + // get subtext - if ($this->_cpos < strlen ($this->_text)) { - $subtext = substr ($this->_text, $this->_cpos); - $res = $this->_appendText ($subtext); + if ($this->_cpos < strlen($this->_text)) { + $subtext = substr($this->_text, $this->_cpos); + $res = $this->_appendText($subtext); if (!$res) { return false; } } - + return true; } - + /** * Loop mode loop * * @access protected * @return bool */ - function _loop () { + function _loop() { // HACK: This method ist not yet implemented correctly, the code below // DOES NOT WORK! Do not use! - return false; /* - while ($this->_cpos < $this->_length) { - $needle = $this->_strDetect ($this->_charactersSearch, $this->_cpos); - - if ($needle === false) { - // not found => see if character is allowed - if (!in_array ($this->_text{$this->_cpos}, $this->_charactersAllowed)) { - if ($strict) { - return false; - } - // ignore - continue; - } - // lot's of FIXMES - $res = $this->_appendText ($this->_text{$this->_cpos}); - if (!$res) { - return false; - } - } - - // get subtext - $subtext = substr ($this->_text, $offset, $offset - $this->_cpos); - $res = $this->_appendText ($subtext); - if (!$res) { - return false; - } - $this->_cpos = $subtext; - $res = $this->_handleStatus ($this->_status, $needle); - if (!$res && $strict) { - return false; - } - } - // original status 0 => no problem - if (!$this->_status) { - return true; - } - // not in original status? strict mode? - if ($this->strict) { - return false; - } - // break up parsing operation of current node - $res = $this->_reparseAfterCurrentBlock (); - if (!$res) { - return false; - } - // this will not cause an infinite loop because - // _reparseAfterCurrentBlock will increase _cpos by one! - return $this->_loop (); - */ + * while ($this->_cpos < $this->_length) { + * $needle = $this->_strDetect ($this->_charactersSearch, $this->_cpos); + * + * if ($needle === false) { + * // not found => see if character is allowed + * if (!in_array ($this->_text{$this->_cpos}, $this->_charactersAllowed)) { + * if ($strict) { + * return false; + * } + * // ignore + * continue; + * } + * // lot's of FIXMES + * $res = $this->_appendText ($this->_text{$this->_cpos}); + * if (!$res) { + * return false; + * } + * } + * + * // get subtext + * $subtext = substr ($this->_text, $offset, $offset - $this->_cpos); + * $res = $this->_appendText ($subtext); + * if (!$res) { + * return false; + * } + * $this->_cpos = $subtext; + * $res = $this->_handleStatus ($this->_status, $needle); + * if (!$res && $strict) { + * return false; + * } + * } + * // original status 0 => no problem + * if (!$this->_status) { + * return true; + * } + * // not in original status? strict mode? + * if ($this->strict) { + * return false; + * } + * // break up parsing operation of current node + * $res = $this->_reparseAfterCurrentBlock (); + * if (!$res) { + * return false; + * } + * // this will not cause an infinite loop because + * // _reparseAfterCurrentBlock will increase _cpos by one! + * return $this->_loop (); + */ } - + /** * Abstract method Append text depending on current status + * * @access protected - * @param string $text The text to append + * @param string $text + * The text to append * @return bool On success, the function returns true, else false */ - function _appendText ($text) { - if (!strlen ($text)) { + function _appendText($text) { + if (!strlen($text)) { return true; } // default: call _appendToLastTextChild - return $this->_appendToLastTextChild ($text); + return $this->_appendToLastTextChild($text); } - + /** * Append text to last text child of current top parser stack node + * * @access protected - * @param string $text The text to append + * @param string $text + * The text to append * @return bool On success, the function returns true, else false */ - function _appendToLastTextChild ($text) { - $scount = count ($this->_stack); + function _appendToLastTextChild($text) { + $scount = count($this->_stack); if ($scount == 0) { return false; } - return $this->_stack[$scount-1]->appendToLastTextChild ($text); + return $this->_stack [$scount - 1]->appendToLastTextChild($text); } - + /** * Searches {@link StringParser::_text _text} for every needle that is - * specified by using the {@link PHP_MANUAL#strpos strpos} function. It + * specified by using the {@link PHP_MANUAL#strpos strpos} function. + * It * returns an associative array with the key 'needle' * pointing at the string that was found first and the key * 'offset' pointing at the offset at which the string was @@ -703,60 +735,67 @@ class StringParser { * @return array * @see StringParser::_text */ - function _strpos ($needles, $offset) { + function _strpos($needles, $offset) { $cur_needle = false; $cur_offset = -1; - - if ($offset < strlen ($this->_text)) { + + if ($offset < strlen($this->_text)) { foreach ($needles as $needle) { - $n_offset = strpos ($this->_text, $needle, $offset); + $n_offset = strpos($this->_text, $needle, $offset); if ($n_offset !== false && ($n_offset < $cur_offset || $cur_offset < 0)) { $cur_needle = $needle; $cur_offset = $n_offset; } } } - - return array ($cur_needle, $cur_offset, 'needle' => $cur_needle, 'offset' => $cur_offset); + + return array( + $cur_needle, + $cur_offset, + 'needle' => $cur_needle, + 'offset' => $cur_offset + ); } - + /** * Detects a string at the current position * * @access protected - * @param array $needles The strings that are to be detected - * @param int $offset The current offset + * @param array $needles + * The strings that are to be detected + * @param int $offset + * The current offset * @return mixed The string that was detected or the needle */ - function _strDetect ($needles, $offset) { + function _strDetect($needles, $offset) { foreach ($needles as $needle) { - $l = strlen ($needle); - if (substr ($this->_text, $offset, $l) == $needle) { + $l = strlen($needle); + if (substr($this->_text, $offset, $l) == $needle) { return $needle; } } return false; } - - + /** * Adds a node to the current parse stack * * @access protected - * @param object $node The node that is to be added + * @param object $node + * The node that is to be added * @return bool True on success, else false. * @see StringParser_Node, StringParser::_stack */ - function _pushNode (&$node) { - $stack_count = count ($this->_stack); - $max_node = $this->_stack[$stack_count-1]; - if (!$max_node->appendChild ($node)) { + function _pushNode(&$node) { + $stack_count = count($this->_stack); + $max_node = $this->_stack [$stack_count - 1]; + if (!$max_node->appendChild($node)) { return false; } - $this->_stack[$stack_count] = $node; + $this->_stack [$stack_count] = $node; return true; } - + /** * Removes a node from the current parse stack * @@ -764,68 +803,77 @@ class StringParser { * @return bool True on success, else false. * @see StringParser_Node, StringParser::_stack */ - function _popNode () { - $stack_count = count ($this->_stack); - unset ($this->_stack[$stack_count-1]); + function _popNode() { + $stack_count = count($this->_stack); + unset($this->_stack [$stack_count - 1]); return true; } - + /** * Execute a method on the top element * * @access protected * @return mixed */ - function _topNode () { - $args = func_get_args (); - if (!count ($args)) { + function _topNode() { + $args = func_get_args(); + if (!count($args)) { return; // oops? } - $method = array_shift ($args); - $stack_count = count ($this->_stack); - $method = array (&$this->_stack[$stack_count-1], $method); - if (!is_callable ($method)) { + $method = array_shift($args); + $stack_count = count($this->_stack); + $method = array( + &$this->_stack [$stack_count - 1], + $method + ); + if (!is_callable($method)) { return; // oops? } - return call_user_func_array ($method, $args); + return call_user_func_array($method, $args); } - + /** * Get a variable of the top element * * @access protected * @return mixed */ - function _topNodeVar ($var) { - $stack_count = count ($this->_stack); - return $this->_stack[$stack_count-1]->$var; + function _topNodeVar($var) { + $stack_count = count($this->_stack); + return $this->_stack [$stack_count - 1]->$var; } + } /** * Node type: Unknown node + * * @see StringParser_Node::_type */ -define ('STRINGPARSER_NODE_UNKNOWN', 0); +define('STRINGPARSER_NODE_UNKNOWN', 0); /** * Node type: Root node + * * @see StringParser_Node::_type */ -define ('STRINGPARSER_NODE_ROOT', 1); +define('STRINGPARSER_NODE_ROOT', 1); /** * Node type: Text node + * * @see StringParser_Node::_type */ -define ('STRINGPARSER_NODE_TEXT', 2); +define('STRINGPARSER_NODE_TEXT', 2); /** - * Global value that is a counter of string parser node ids. Compare it to a + * Global value that is a counter of string parser node ids. + * Compare it to a * sequence in databases. + * * @var int */ -$GLOBALS['__STRINGPARSER_NODE_ID'] = 0; +$GLOBALS ['__STRINGPARSER_NODE_ID'] = 0; /** * Generic string parser node class @@ -839,9 +887,10 @@ $GLOBALS['__STRINGPARSER_NODE_ID'] = 0; * @package stringparser */ class StringParser_Node { + /** * The type of this node. - * + * * There are three standard node types: root node, text node and unknown * node. All node types are integer constants. Any node type of a * subclass must be at least 32 to allow future developements. @@ -852,7 +901,7 @@ class StringParser_Node { * @see STRINGPARSER_NODE_UNKNOWN */ var $_type = STRINGPARSER_NODE_UNKNOWN; - + /** * The node ID * @@ -867,7 +916,7 @@ class StringParser_Node { * @see StringParser_Node::_children */ var $_id = -1; - + /** * The parent of this node. * @@ -878,7 +927,7 @@ class StringParser_Node { * @see StringParser_Node::_children */ var $_parent = null; - + /** * The children of this node. * @@ -889,8 +938,8 @@ class StringParser_Node { * @var array * @see StringParser_Node::_parent */ - var $_children = array (); - + var $_children = array(); + /** * Occured at * @@ -901,7 +950,7 @@ class StringParser_Node { * @var int */ var $occurredAt = -1; - + /** * Constructor * @@ -909,15 +958,16 @@ class StringParser_Node { * assigns it. * * @access public - * @param int $occurredAt The position in the text where this node - * occurred at. If not determinable, it is -1. + * @param int $occurredAt + * The position in the text where this node + * occurred at. If not determinable, it is -1. * @global __STRINGPARSER_NODE_ID */ - function __construct ($occurredAt = -1) { - $this->_id = $GLOBALS['__STRINGPARSER_NODE_ID']++; + function __construct($occurredAt = -1) { + $this->_id = $GLOBALS ['__STRINGPARSER_NODE_ID']++; $this->occurredAt = $occurredAt; } - + /** * Type of the node * @@ -926,70 +976,73 @@ class StringParser_Node { * @access public * @return int */ - function type () { + function type() { return $this->_type; } - + /** * Prepend a node * * @access public - * @param object $node The node to be prepended. + * @param object $node + * The node to be prepended. * @return bool On success, the function returns true, else false. */ - function prependChild (&$node) { - if (!is_object ($node)) { + function prependChild(&$node) { + if (!is_object($node)) { return false; } - + // root nodes may not be children of other nodes! if ($node->_type == STRINGPARSER_NODE_ROOT) { return false; } - + // if node already has a parent if ($node->_parent !== false) { // remove node from there $parent = $node->_parent; - if (!$parent->removeChild ($node, false)) { + if (!$parent->removeChild($node, false)) { return false; } - unset ($parent); + unset($parent); } - - $index = count ($this->_children) - 1; + + $index = count($this->_children) - 1; // move all nodes to a new index while ($index >= 0) { // save object - $object = $this->_children[$index]; + $object = $this->_children [$index]; // we have to unset it because else it will be // overridden in in the loop - unset ($this->_children[$index]); + unset($this->_children [$index]); // put object to new position - $this->_children[$index+1] = $object; + $this->_children [$index + 1] = $object; $index--; } - $this->_children[0] = $node; + $this->_children [0] = $node; return true; } - + /** * Append text to last text child + * * @access public - * @param string $text The text to append + * @param string $text + * The text to append * @return bool On success, the function returns true, else false */ - function appendToLastTextChild ($text) { - $ccount = count ($this->_children); - if ($ccount == 0 || $this->_children[$ccount-1]->_type != STRINGPARSER_NODE_TEXT) { - $ntextnode = new StringParser_Node_Text ($text); - return $this->appendChild ($ntextnode); + function appendToLastTextChild($text) { + $ccount = count($this->_children); + if ($ccount == 0 || $this->_children [$ccount - 1]->_type != STRINGPARSER_NODE_TEXT) { + $ntextnode = new StringParser_Node_Text($text); + return $this->appendChild($ntextnode); } else { - $this->_children[$ccount-1]->appendText ($text); + $this->_children [$ccount - 1]->appendText($text); return true; } } - + /** * Append a node to the children * @@ -998,140 +1051,145 @@ class StringParser_Node { * property of the node that is to be appended. * * @access public - * @param object $node The node that is to be appended. + * @param object $node + * The node that is to be appended. * @return bool On success, the function returns true, else false. */ - function appendChild (&$node) { - if (!is_object ($node)) { + function appendChild(&$node) { + if (!is_object($node)) { return false; } - + // root nodes may not be children of other nodes! if ($node->_type == STRINGPARSER_NODE_ROOT) { return false; } - + // if node already has a parent if ($node->_parent !== null) { // remove node from there $parent = $node->_parent; - if (!$parent->removeChild ($node, false)) { + if (!$parent->removeChild($node, false)) { return false; } - unset ($parent); + unset($parent); } - + // append it to current node - $new_index = count ($this->_children); - $this->_children[$new_index] = $node; + $new_index = count($this->_children); + $this->_children [$new_index] = $node; $node->_parent = $this; return true; } - + /** * Insert a node before another node * * @access public - * @param object $node The node to be inserted. - * @param object $reference The reference node where the new node is - * to be inserted before. + * @param object $node + * The node to be inserted. + * @param object $reference + * The reference node where the new node is + * to be inserted before. * @return bool On success, the function returns true, else false. */ - function insertChildBefore (&$node, &$reference) { - if (!is_object ($node)) { + function insertChildBefore(&$node, &$reference) { + if (!is_object($node)) { return false; } - + // root nodes may not be children of other nodes! if ($node->_type == STRINGPARSER_NODE_ROOT) { return false; } - + // is the reference node a child? - $child = $this->_findChild ($reference); - + $child = $this->_findChild($reference); + if ($child === false) { return false; } - + // if node already has a parent if ($node->_parent !== null) { // remove node from there $parent = $node->_parent; - if (!$parent->removeChild ($node, false)) { + if (!$parent->removeChild($node, false)) { return false; } - unset ($parent); + unset($parent); } - - $index = count ($this->_children) - 1; + + $index = count($this->_children) - 1; // move all nodes to a new index while ($index >= $child) { // save object - $object = $this->_children[$index]; + $object = $this->_children [$index]; // we have to unset it because else it will be // overridden in in the loop - unset ($this->_children[$index]); + unset($this->_children [$index]); // put object to new position - $this->_children[$index+1] = $object; + $this->_children [$index + 1] = $object; $index--; } - $this->_children[$child] = $node; + $this->_children [$child] = $node; return true; } - + /** * Insert a node after another node * * @access public - * @param object $node The node to be inserted. - * @param object $reference The reference node where the new node is - * to be inserted after. + * @param object $node + * The node to be inserted. + * @param object $reference + * The reference node where the new node is + * to be inserted after. * @return bool On success, the function returns true, else false. */ - function insertChildAfter (&$node, &$reference) { - if (!is_object ($node)) { + function insertChildAfter(&$node, &$reference) { + if (!is_object($node)) { return false; } - + // root nodes may not be children of other nodes! if ($node->_type == STRINGPARSER_NODE_ROOT) { return false; } - + // is the reference node a child? - $child = $this->_findChild ($reference); - + $child = $this->_findChild($reference); + if ($child === false) { return false; } - + // if node already has a parent if ($node->_parent !== false) { // remove node from there $parent = $node->_parent; - if (!$parent->removeChild ($node, false)) { + if (!$parent->removeChild($node, false)) { return false; } - unset ($parent); + unset($parent); } - - $index = count ($this->_children) - 1; + + $index = count($this->_children) - 1; // move all nodes to a new index while ($index >= $child + 1) { // save object - $object = $this->_children[$index]; + $object = $this->_children [$index]; // we have to unset it because else it will be // overridden in in the loop - unset ($this->_children[$index]); + unset($this->_children [$index]); // put object to new position - $this->_children[$index+1] = $object; + $this->_children [$index + 1] = $object; $index--; } - $this->_children[$child + 1] = $node; + $this->_children [$child + 1] = $node; return true; } - + /** * Remove a child node * @@ -1141,18 +1199,20 @@ class StringParser_Node { * return false. * * @access public - * @param mixed $child The child to destroy; either an integer - * specifying the index of the child or a reference - * to the child itself. - * @param bool $destroy Destroy the child afterwards. + * @param mixed $child + * The child to destroy; either an integer + * specifying the index of the child or a reference + * to the child itself. + * @param bool $destroy + * Destroy the child afterwards. * @return bool On success, the function returns true, else false. */ - function removeChild (&$child, $destroy = false) { - if (is_object ($child)) { + function removeChild(&$child, $destroy = false) { + if (is_object($child)) { // if object: get index $object = $child; - unset ($child); - $child = $this->_findChild ($object); + unset($child); + $child = $this->_findChild($object); if ($child === false) { return false; } @@ -1161,97 +1221,98 @@ class StringParser_Node { $save = $child; unset($child); $child = $save; - + // else: get object - if (!isset($this->_children[$child])) { + if (!isset($this->_children [$child])) { return false; } - $object = $this->_children[$child]; + $object = $this->_children [$child]; } - + // store count for later use - $ccount = count ($this->_children); - + $ccount = count($this->_children); + // index out of bounds - if (!is_int ($child) || $child < 0 || $child >= $ccount) { + if (!is_int($child) || $child < 0 || $child >= $ccount) { return false; } - + // inkonsistency - if ($this->_children[$child]->_parent === null || - $this->_children[$child]->_parent->_id != $this->_id) { + if ($this->_children [$child]->_parent === null || $this->_children [$child]->_parent->_id != $this->_id) { return false; } - + // $object->_parent = null would equal to $this = null // as $object->_parent is a reference to $this! // because of this, we have to unset the variable to remove // the reference and then redeclare the variable - unset ($object->_parent); $object->_parent = null; - + unset($object->_parent); + $object->_parent = null; + // we have to unset it because else it will be overridden in // in the loop - unset ($this->_children[$child]); - + unset($this->_children [$child]); + // move all remaining objects one index higher while ($child < $ccount - 1) { // save object - $obj = $this->_children[$child+1]; + $obj = $this->_children [$child + 1]; // we have to unset it because else it will be // overridden in in the loop - unset ($this->_children[$child+1]); + unset($this->_children [$child + 1]); // put object to new position - $this->_children[$child] = $obj; + $this->_children [$child] = $obj; // UNSET THE OBJECT! - unset ($obj); + unset($obj); $child++; } - + if ($destroy) { - return StringParser_Node::destroyNode ($object); - unset ($object); + return StringParser_Node::destroyNode($object); + unset($object); } return true; } - + /** * Get the first child of this node * * @access public * @return mixed */ - function &firstChild () { + function &firstChild() { $ret = null; - if (!count ($this->_children)) { + if (!count($this->_children)) { return $ret; } - return $this->_children[0]; + return $this->_children [0]; } - + /** * Get the last child of this node * * @access public * @return mixed */ - function &lastChild () { + function &lastChild() { $ret = null; - $c = count ($this->_children); + $c = count($this->_children); if (!$c) { return $ret; } - return $this->_children[$c-1]; + return $this->_children [$c - 1]; } - + /** * Destroy a node * * @access public * @static - * @param object $node The node to destroy + * @param object $node + * The node to destroy * @return bool True on success, else false. */ - static function destroyNode (&$node) { + static function destroyNode(&$node) { if ($node === null) { return false; } @@ -1260,31 +1321,31 @@ class StringParser_Node { $parent = $node->_parent; // directly return that result because the removeChild // method will call destroyNode again - return $parent->removeChild ($node, true); + return $parent->removeChild($node, true); } - + // node has children - while (count ($node->_children)) { + while (count($node->_children)) { $child = 0; // remove first child until no more children remain - if (!$node->removeChild ($child, true)) { + if (!$node->removeChild($child, true)) { return false; } unset($child); } - + // now call the nodes destructor - if (!$node->_destroy ()) { + if (!$node->_destroy()) { return false; } - + // now just unset it and prey that there are no more references // to this node - unset ($node); - + unset($node); + return true; } - + /** * Destroy this node * @@ -1292,11 +1353,11 @@ class StringParser_Node { * @access protected * @return bool True on success, else false. */ - function _destroy () { + function _destroy() { return true; } - - /** + + /** * Find a child node * * This function searches for a node in the own children and returns @@ -1304,130 +1365,142 @@ class StringParser_Node { * node. * * @access protected - * @param mixed $child The node to look for. + * @param mixed $child + * The node to look for. * @return mixed The index of the child node on success, else false. */ - function _findChild (&$child) { - if (!is_object ($child)) { + function _findChild(&$child) { + if (!is_object($child)) { return false; } - - $ccount = count ($this->_children); - for ($i = 0; $i < $ccount; $i++) { - if ($this->_children[$i]->_id == $child->_id) { + + $ccount = count($this->_children); + for($i = 0; $i < $ccount; $i++) { + if ($this->_children [$i]->_id == $child->_id) { return $i; } } - + return false; } - - /** + + /** * Checks equality of this node and another node * * @access public - * @param mixed $node The node to be compared with + * @param mixed $node + * The node to be compared with * @return bool True if the other node equals to this node, else false. */ - function equals (&$node) { + function equals(&$node) { return ($this->_id == $node->_id); } - + /** * Determines whether a criterium matches this node * * @access public - * @param string $criterium The criterium that is to be checked - * @param mixed $value The value that is to be compared + * @param string $criterium + * The criterium that is to be checked + * @param mixed $value + * The value that is to be compared * @return bool True if this node matches that criterium */ - function matchesCriterium ($criterium, $value) { + function matchesCriterium($criterium, $value) { return false; } - + /** * Search for nodes with a certain criterium * * This may be used to implement getElementsByTagName etc. * * @access public - * @param string $criterium The criterium that is to be checked - * @param mixed $value The value that is to be compared + * @param string $criterium + * The criterium that is to be checked + * @param mixed $value + * The value that is to be compared * @return array All subnodes that match this criterium */ - function &getNodesByCriterium ($criterium, $value) { - $nodes = array (); + function &getNodesByCriterium($criterium, $value) { + $nodes = array(); $node_ctr = 0; - for ($i = 0; $i < count ($this->_children); $i++) { - if ($this->_children[$i]->matchesCriterium ($criterium, $value)) { - $nodes[$node_ctr++] = $this->_children[$i]; + for($i = 0; $i < count($this->_children); $i++) { + if ($this->_children [$i]->matchesCriterium($criterium, $value)) { + $nodes [$node_ctr++] = $this->_children [$i]; } - $subnodes = $this->_children[$i]->getNodesByCriterium ($criterium, $value); - if (count ($subnodes)) { - $subnodes_count = count ($subnodes); - for ($j = 0; $j < $subnodes_count; $j++) { - $nodes[$node_ctr++] = $subnodes[$j]; - unset ($subnodes[$j]); + $subnodes = $this->_children [$i]->getNodesByCriterium($criterium, $value); + if (count($subnodes)) { + $subnodes_count = count($subnodes); + for($j = 0; $j < $subnodes_count; $j++) { + $nodes [$node_ctr++] = $subnodes [$j]; + unset($subnodes [$j]); } } - unset ($subnodes); + unset($subnodes); } return $nodes; } - + /** * Search for nodes with a certain criterium and return the count * * Similar to getNodesByCriterium * * @access public - * @param string $criterium The criterium that is to be checked - * @param mixed $value The value that is to be compared + * @param string $criterium + * The criterium that is to be checked + * @param mixed $value + * The value that is to be compared * @return int The number of subnodes that match this criterium */ - function getNodeCountByCriterium ($criterium, $value) { + function getNodeCountByCriterium($criterium, $value) { $node_ctr = 0; - for ($i = 0; $i < count ($this->_children); $i++) { - if ($this->_children[$i]->matchesCriterium ($criterium, $value)) { + for($i = 0; $i < count($this->_children); $i++) { + if ($this->_children [$i]->matchesCriterium($criterium, $value)) { $node_ctr++; } - $subnodes = $this->_children[$i]->getNodeCountByCriterium ($criterium, $value); + $subnodes = $this->_children [$i]->getNodeCountByCriterium($criterium, $value); $node_ctr += $subnodes; } return $node_ctr; } - + /** * Dump nodes * * This dumps a tree of nodes * * @access public - * @param string $prefix The prefix that is to be used for indentation - * @param string $linesep The line separator - * @param int $level The initial level of indentation + * @param string $prefix + * The prefix that is to be used for indentation + * @param string $linesep + * The line separator + * @param int $level + * The initial level of indentation * @return string */ - function dump ($prefix = " ", $linesep = "\n", $level = 0) { - $str = str_repeat ($prefix, $level) . $this->_id . ": " . $this->_dumpToString () . $linesep; - for ($i = 0; $i < count ($this->_children); $i++) { - $str .= $this->_children[$i]->dump ($prefix, $linesep, $level + 1); + function dump($prefix = " ", $linesep = "\n", $level = 0) { + $str = str_repeat($prefix, $level) . $this->_id . ": " . $this->_dumpToString() . $linesep; + for($i = 0; $i < count($this->_children); $i++) { + $str .= $this->_children [$i]->dump($prefix, $linesep, $level + 1); } return $str; } - + /** * Dump this node to a string * * @access protected * @return string */ - function _dumpToString () { + function _dumpToString() { if ($this->_type == STRINGPARSER_NODE_ROOT) { return "root"; } - return (string)$this->_type; + return (string) $this->_type; } + } /** @@ -1436,9 +1509,10 @@ class StringParser_Node { * @package stringparser */ class StringParser_Node_Root extends StringParser_Node { + /** * The type of this node. - * + * * This node is a root node. * * @access protected @@ -1446,6 +1520,7 @@ class StringParser_Node_Root extends StringParser_Node { * @see STRINGPARSER_NODE_ROOT */ var $_type = STRINGPARSER_NODE_ROOT; + } /** @@ -1454,9 +1529,10 @@ class StringParser_Node_Root extends StringParser_Node { * @package stringparser */ class StringParser_Node_Text extends StringParser_Node { + /** * The type of this node. - * + * * This node is a text node. * * @access protected @@ -1464,84 +1540,94 @@ class StringParser_Node_Text extends StringParser_Node { * @see STRINGPARSER_NODE_TEXT */ var $_type = STRINGPARSER_NODE_TEXT; - + /** * Node flags - * + * * @access protected * @var array */ - var $_flags = array (); - + var $_flags = array(); + /** * The content of this node + * * @access public * @var string */ var $content = ''; - + /** * Constructor * * @access public - * @param string $content The initial content of this element - * @param int $occurredAt The position in the text where this node - * occurred at. If not determinable, it is -1. + * @param string $content + * The initial content of this element + * @param int $occurredAt + * The position in the text where this node + * occurred at. If not determinable, it is -1. * @see StringParser_Node_Text::content */ - function __construct ($content, $occurredAt = -1) { - parent::__construct ($occurredAt); + function __construct($content, $occurredAt = -1) { + parent::__construct($occurredAt); $this->content = $content; } - + /** * Append text to content * * @access public - * @param string $text The text to append + * @param string $text + * The text to append * @see StringParser_Node_Text::content */ - function appendText ($text) { + function appendText($text) { $this->content .= $text; } - + /** * Set a flag * * @access public - * @param string $name The name of the flag - * @param mixed $value The value of the flag + * @param string $name + * The name of the flag + * @param mixed $value + * The value of the flag */ - function setFlag ($name, $value) { - $this->_flags[$name] = $value; + function setFlag($name, $value) { + $this->_flags [$name] = $value; return true; } - + /** * Get Flag * * @access public - * @param string $flag The requested flag - * @param string $type The requested type of the return value - * @param mixed $default The default return value + * @param string $flag + * The requested flag + * @param string $type + * The requested type of the return value + * @param mixed $default + * The default return value */ - function getFlag ($flag, $type = 'mixed', $default = null) { - if (!isset ($this->_flags[$flag])) { + function getFlag($flag, $type = 'mixed', $default = null) { + if (!isset($this->_flags [$flag])) { return $default; } - $return = $this->_flags[$flag]; + $return = $this->_flags [$flag]; if ($type != 'mixed') { - settype ($return, $type); + settype($return, $type); } return $return; } - + /** * Dump this node to a string */ - function _dumpToString () { - return "text \"".substr (preg_replace ('/\s+/', ' ', $this->content), 0, 40)."\" [f:".preg_replace ('/\s+/', ' ', join(':', array_keys ($this->_flags)))."]"; + function _dumpToString() { + return "text \"" . substr(preg_replace('/\s+/', ' ', $this->content), 0, 40) . "\" [f:" . preg_replace('/\s+/', ' ', join(':', array_keys($this->_flags))) . "]"; } + } ?> diff --git a/fp-plugins/bbcode/lang/lang.es-es.php b/fp-plugins/bbcode/lang/lang.es-es.php new file mode 100644 index 0000000..7894823 --- /dev/null +++ b/fp-plugins/bbcode/lang/lang.es-es.php @@ -0,0 +1,56 @@ + 'Configuración de BBCode', + 'desc1' => 'Este Plugin permite usar BBCode markup y proporciona '. + 'integración automática con lightbox (cuando también está habilitado).', + + 'options' => 'Opciones', + + 'editing' => 'Edición', + 'allow_html' => 'HTML en línea', + 'allow_html_long' => 'Habilite el uso de HTML junto con BBCode', + 'toolbar' => 'Barra de herramientas', + 'toolbar_long' => 'Habilite la barra de herramientas del editor.', + + 'other' => 'Otras opciones', + 'comments' => 'Comments', + 'comments_long' => 'Permitir BBCode en los comentarios', + 'urlmaxlen' => 'Largo máximo del URL', + 'urlmaxlen_long_pre' => 'Acorte los URL más largos de ', + 'urlmaxlen_long_post' =>' caracteres.', + 'submit' => 'Save configuration', + 'msgs' => array( + 1 => 'BBCode configuration successful saved.', + -1 => 'Configuración de BBCode no guardada.' + ), + + 'editor' => array( + 'formatting' => 'Formateo', + 'textarea' => 'Área de texto: ', + 'expand' => 'Ampliar', + 'expandtitle' => 'Ampliar la altura del área de texto', + 'reduce' => 'Reducir', + 'reducetitle' => 'Reducir la altura del área de texto', + // note: accesskeys are not internationalized... + // btw. why not :-D + 'bold' => 'B', + 'boldtitle' => 'Negrita', + 'italic' => 'I', + 'italictitle' => 'Itálica', + 'underline' => 'U', + 'underlinetitle' => 'Subrayada', + 'quote' => 'Quote', + 'quotetitle' => 'Citar', + 'code' => 'Code', + 'codetitle' => 'Código', + 'help' => 'Ayuda de BBCode', + // currently not used + 'status' => 'Barra de estado', + 'statusbar' => 'Modo normal. presiona <Esc> para cambiar el modo de edición.' + ) +); + +?> diff --git a/fp-plugins/bbcode/lang/lang.it-it.php b/fp-plugins/bbcode/lang/lang.it-it.php index 4e6d85a..034c220 100644 --- a/fp-plugins/bbcode/lang/lang.it-it.php +++ b/fp-plugins/bbcode/lang/lang.it-it.php @@ -43,7 +43,7 @@ $lang['admin']['plugin']['bbcode'] = array( 'underline' => 'S', 'underlinetitle' => 'Sottolineato', 'quote' => 'Cita', - 'quotetitle' => 'Cita', + 'quotetitle' => 'Citazione', 'code' => 'Codice', 'codetitle' => 'Codice', 'help' => 'Guida di BBCode', diff --git a/fp-plugins/bbcode/plugin.bbcode.php b/fp-plugins/bbcode/plugin.bbcode.php index 86d7502..5b556ce 100644 --- a/fp-plugins/bbcode/plugin.bbcode.php +++ b/fp-plugins/bbcode/plugin.bbcode.php @@ -1,11 +1,11 @@ BBCode markup; provides automatic integration with lightbox. - * Author: Hydra, NoWhereMan - * Author URI: http://flatpress.sf.net + * Version: 1.6 + * Plugin URI: https://www.flatpress.org + * Author: FlatPress + * Author URI: https://www.flatpress.org + * Description: Allows using BBCode markup; provides automatic integration with lightbox. Part of the standard distribution. */ require (plugin_getdir('bbcode') . '/inc/stringparser_bbcode.class.php'); require (plugin_getdir('bbcode') . '/panels/admin.plugin.panel.bbcode.php'); @@ -191,9 +191,11 @@ function do_bbcode_img($action, $attributes, $content, $params, $node_object) { // tiffs won't be supported if (is_array($img_info)) { - $iptc = iptcparse($img_info ["APP13"]); - $title = @$iptc ["2#005"] [0] ? wp_specialchars($iptc ["2#005"] [0]) : $title; - $alt = isset($iptc ["2#120"] [0]) ? wp_specialchars($iptc ["2#120"] [0], 1) : $title; + if (isset($img_info ["APP13"])) { + $iptc = iptcparse($img_info ["APP13"]); + $title = @$iptc ["2#005"] [0] ? wp_specialchars($iptc ["2#005"] [0]) : $title; + $alt = isset($iptc ["2#120"] [0]) ? wp_specialchars($iptc ["2#120"] [0], 1) : $title; + } } } } @@ -244,6 +246,17 @@ function do_bbcode_img($action, $attributes, $content, $params, $node_object) { )); } + // Calculating the "loading" attribute of the image. + // For details, see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading + // -> "lazy" is default (see https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading) + $loadingValue = 'lazy'; + // Use img attribute value if explicitly set + if (isset($attributes ['loading'])) { + $loadingValue = $attributes ['loading']; + } + $loading = ' loading="' . $loadingValue . '"'; + + // JS for popup if (isset($attributes ['popup']) && ($attributes ['popup'])) { $pop_width = $orig_w ? $orig_w : 800; $pop_height = $orig_h ? $orig_h : 600; @@ -251,8 +264,7 @@ function do_bbcode_img($action, $attributes, $content, $params, $node_object) { // Plugin hook, here lightbox attachs $popup = apply_filters('bbcode_img_popup', $popup, $absolutepath); - $popup_start = $attributes ['popup'] == 'true' ? '' : ''; + $popup_start = $attributes ['popup'] == 'true' ? '' : ''; $popup_end = $attributes ['popup'] == 'true' ? '' : ''; } $img_width = $width ? ' width="' . $width . '"' : ''; @@ -260,9 +272,11 @@ function do_bbcode_img($action, $attributes, $content, $params, $node_object) { if (isset($attributes ['float'])) { $float = ($attributes ['float'] == 'left' || $attributes ['float'] == 'right') ? ' class="float' . $attributes ['float'] . '"' : ' class="center"'; } - $src = $thumbpath ? (BLOG_BASEURL . $thumbpath) : $absolutepath; // $attributes['default']) + $src = $thumbpath ? (BLOG_BASEURL . $thumbpath) : $absolutepath; $pop = $popup_start ? '' : ' title="' . $title . '" '; - return $popup_start . '' . $alt . '' . $popup_end; + + // Finally: Put together the whole img tag with all its attributes and return it + return $popup_start . '' . $alt . '' . $popup_end; } /** diff --git a/fp-plugins/bbcode/tpls/admin.plugin.bbcode.tpl b/fp-plugins/bbcode/tpls/admin.plugin.bbcode.tpl index a11bef3..f669152 100644 --- a/fp-plugins/bbcode/tpls/admin.plugin.bbcode.tpl +++ b/fp-plugins/bbcode/tpls/admin.plugin.bbcode.tpl @@ -66,4 +66,4 @@
    - \ No newline at end of file + diff --git a/fp-plugins/blockparser/lang/lang.es-es.php b/fp-plugins/blockparser/lang/lang.es-es.php new file mode 100644 index 0000000..7e08b14 --- /dev/null +++ b/fp-plugins/blockparser/lang/lang.es-es.php @@ -0,0 +1,26 @@ + 'Widgets de BlockParser', + 'description' => 'BlockParser plugin le permite crear un widget desde una página estática.

    + Seleccione una o más páginas estáticas de la lista para que el widget correspondiente esté disponible.

    + Cada nueva página estática que cree aparecerá aquí.', + + 'id' => 'Página estática', + 'title' => 'Titulo', + 'action' => 'Action', + 'enable' => 'Habilitar', + 'disable' => 'Inhabilitar', + 'edit' => 'Editar', + + ); + $lang['admin']['widgets']['blockparser']['msgs'] = array( + 1 => 'Tu nuevo widget está disponible. Agréguelo a su blog desde el panel principal', + -1 => 'No se puede crear el widget solicitado', + 2 => 'Ha desactivado un widget: no olvide eliminar las referencias del panel principal!', + -2 => 'No se puede desactivar el widget' + ); + +?> diff --git a/fp-plugins/blockparser/plugin.blockparser.php b/fp-plugins/blockparser/plugin.blockparser.php index 3947524..ccc463b 100644 --- a/fp-plugins/blockparser/plugin.blockparser.php +++ b/fp-plugins/blockparser/plugin.blockparser.php @@ -2,12 +2,12 @@ /* * Plugin Name: BlockParser - * Plugin URI: http://www.nowhereland.it/ * Type: Block - * Description: BlockParser plugin. Part of the standard distribution ;) This allow you to use simple non-plugin custom blocks :) - * Author: NoWhereMan real_nowhereman at user dot sf dot net * Version: 1.0 - * Author URI: http://www.nowhereland.it/ + * Plugin URI: https://www.flatpress.org + * Author: FlatPress + * Author URI: https://www.flatpress.org + * Description: Allows you to use simple non-plugin custom blocks. Part of the standard distribution. */ // define('BLOCKS_DIR', CONTENT_DIR . 'blocks/'); diff --git a/fp-plugins/calendar/lang/lang.es-es.php b/fp-plugins/calendar/lang/lang.es-es.php new file mode 100644 index 0000000..51d0ffe --- /dev/null +++ b/fp-plugins/calendar/lang/lang.es-es.php @@ -0,0 +1,9 @@ + 'Calendario' + + ); + +?> \ No newline at end of file diff --git a/fp-plugins/calendar/plugin.calendar.php b/fp-plugins/calendar/plugin.calendar.php index 86a3cc0..9f38d2d 100755 --- a/fp-plugins/calendar/plugin.calendar.php +++ b/fp-plugins/calendar/plugin.calendar.php @@ -3,11 +3,11 @@ /* * Plugin Name: Calendar * Version: 1.1 - * Plugin URI: http://flatpress.sf.net * Type: Block - * Description: Adds a Calendar block level element - * Author: NoWhereMan - * Author URI: http://flatpress.sf.net + * Plugin URI: https://www.flatpress.org + * Author: FlatPress + * Author URI: https://www.flatpress.org + * Description: Adds a calendar widget. Part of the standard distribution. */ // PHP Calendar (version 2.3), written by Keith Devens @@ -19,17 +19,17 @@ function generate_calendar($year, $month, $days = array(), $day_name_length = 3, // remember that mktime will automatically correct if invalid dates are entered // for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998 // this provides a built in "rounding" feature to generate_calendar() - + $day_names = array(); // generate all the day names according to the current locale for($n = 0, $t = (3 + $first_day) * 86400; $n < 7; $n++, $t += 86400) // January 4, 1970 was a Sunday $day_names [$n] = ucfirst(date_strformat('%A', $t)); // %A means full textual day name - + list ($month, $year, $month_name, $weekday) = explode(',', date_strformat('%m,%Y,%B,%w', $first_of_month)); $weekday = ($weekday + 7 - $first_day) % 7; // adjust for $first_day $title = htmlentities(ucfirst($month_name)) . ' ' . $year; // note that some locales don't capitalize month and day names - + // Begin calendar. Uses a real . See http://diveintomark.org/archives/2002/07/03 - + // PHP7 compatibility: Since $pn is never passed, we do not need to create "previous" and "next" elements. $p = ''; $n = ''; @@ -37,16 +37,16 @@ function generate_calendar($year, $month, $days = array(), $day_name_length = 3, // @list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable // if($p) $p = ''.($pl ? ''.$p.'' : $p).' '; // if($n) $n = ' '.($nl ? ''.$n.'' : $n).''; - + $calendar = '' . "\n" . '\n"; - + if ($day_name_length) { // if the day names should be shown ($day_name_length > 0) // if day_name_length is >3, the full name of the day will be printed foreach ($day_names as $d) $calendar .= ''; $calendar .= "\n"; } - + if ($weekday > 0) $calendar .= ''; // initial 'empty' days for($day = 1, $days_in_month = gmdate('t', $first_of_month); $day <= $days_in_month; $day++, $weekday++) { @@ -64,49 +64,47 @@ function generate_calendar($year, $month, $days = array(), $day_name_length = 3, } if ($weekday != 7) $calendar .= ''; // remaining "empty" days - + return $calendar . "\n
    ' . $p . ($month_href ? '' . $title . '' : $title) . $n . "
    ' . htmlentities($day_name_length < 4 ? substr($d, 0, $day_name_length) : $d) . '
      
    \n"; } function plugin_calendar_widget() { global $fp_params; - + $y = isset($fp_params ['y']) ? $fp_params ['y'] : date('y'); $m = isset($fp_params ['m']) ? $fp_params ['m'] : date('m'); - + global $fpdb; - + $q = new FPDB_Query(array( 'fullparse' => false, 'y' => $y, 'm' => $m, 'count' => -1 ), null); - + $days = array(); - - while ($q->hasmore($queryId)) { - - list ($id, $entry) = $q->getEntry($queryId); + + while ($q->hasmore()) { + + list ($id, $entry) = $q->getEntry(); $date = date_from_id($id); $d = (int) $date ['d']; - + $days [$d] = array( get_day_link($y, $m, str_pad($d, 2, '0', STR_PAD_LEFT)), 'linked-day' ); - - $count++; } - + // load plugin strings // they're located under plugin.PLUGINNAME/lang/LANGID/ $lang = lang_load('plugin:calendar'); - + $widget = array(); $widget ['subject'] = $lang ['plugin'] ['calendar'] ['subject']; $widget ['content'] = '

    • ' . generate_calendar($y, $m, $days) . '
    '; - + return $widget; } diff --git a/fp-plugins/categories/lang/lang.es-es.php b/fp-plugins/categories/lang/lang.es-es.php new file mode 100644 index 0000000..1674ad6 --- /dev/null +++ b/fp-plugins/categories/lang/lang.es-es.php @@ -0,0 +1,9 @@ + 'Categorías' + + ); + +?> \ No newline at end of file diff --git a/fp-plugins/categories/plugin.categories.php b/fp-plugins/categories/plugin.categories.php index 4425057..25b4446 100755 --- a/fp-plugins/categories/plugin.categories.php +++ b/fp-plugins/categories/plugin.categories.php @@ -1,34 +1,32 @@ assign('categories_showcount', false); - + // load plugin strings // they're located under plugin.PLUGINNAME/lang/LANGID/ $lang = lang_load('plugin:categories'); - - $entry['subject'] = $lang['plugin']['categories']['subject']; - $entry['content'] = $smarty->fetch('plugin:categories/widget'); + + $entry ['subject'] = $lang ['plugin'] ['categories'] ['subject']; + $entry ['content'] = $smarty->fetch('plugin:categories/widget'); return $entry; } diff --git a/fp-plugins/commentcenter/inc/admin.php b/fp-plugins/commentcenter/inc/admin.php index 19a56e0..bd039d7 100644 --- a/fp-plugins/commentcenter/inc/admin.php +++ b/fp-plugins/commentcenter/inc/admin.php @@ -122,7 +122,7 @@ class admin_entry_commentcenter extends AdminPanelAction { $smarty->assign('pl_conf', $conf); $conf=$plugin->getConf(); - if($conf['akismet_check']) { + if(isset($conf) && array_key_exists('akismet_check', $conf) && $conf['akismet_check']) { $akismet=$plugin->akismetLoad(); if(is_numeric($akismet)) { $error=$lang['admin']['entry']['commentcenter']['akismet_errors'][$akismet]; diff --git a/fp-plugins/commentcenter/lang/lang.it-it.php b/fp-plugins/commentcenter/lang/lang.it-it.php index 57881fc..0014a62 100644 --- a/fp-plugins/commentcenter/lang/lang.it-it.php +++ b/fp-plugins/commentcenter/lang/lang.it-it.php @@ -1,9 +1,9 @@ 'Comment Center', + 'title'=>'Centro commenti', 'desc1'=>'Questo pannello ti consente di gestire i commenti del tuo blog.', 'desc2'=>'Qui puoi fare numerose cose:', @@ -20,8 +20,8 @@ $lang['admin']['entry']['commentcenter']=array( 'criteria'=>'Criteri', 'behavoir'=>'Comportamento', 'options'=>'Opzioni', - 'entry'=>'Post', - 'entries'=>'Post', + 'entry'=>'Articolo', + 'entries'=>'Articoli', 'categories'=>'Categorie', 'nopolicies'=>'Non c\'è nessuna regola.', 'all_entries'=>'Tutti i post', diff --git a/fp-plugins/commentcenter/plugin.commentcenter.php b/fp-plugins/commentcenter/plugin.commentcenter.php index 33f6b68..626d0a4 100644 --- a/fp-plugins/commentcenter/plugin.commentcenter.php +++ b/fp-plugins/commentcenter/plugin.commentcenter.php @@ -4,9 +4,9 @@ * Plugin Name: Comment Center * Version: 1.1.2 * Plugin URI: https://www.flatpress.org - * Description: Manage your blog's comments: Set policies, publish or reject comments. - * Author: FlatPress (credits to Piero VDFN) + * Author: FlatPress * Author URI: https://www.flatpress.org + * Description: Manage your blog's comments: Set policies, publish or reject comments. Part of the standard distribution. */ /** @@ -62,8 +62,8 @@ class plugin_commentcenter { function lock() { global $fp_params, $post, $smarty; $this->loadPolicies(); - $cats = is_array($post ['categories']) ? $post ['categories'] : array(); - $behavoir = $this->behavoirFromPolicies($fp_params ['entry'], $cats); + $cats = array_key_exists('categories', $post) && is_array($post ['categories']) ? $post ['categories'] : array(); + $behavoir = array_key_exists('entry', $fp_params) ? $this->behavoirFromPolicies($fp_params ['entry'], $cats) : 1; if ($behavoir == -1 && !user_loggedin()) { $smarty->assign('entry_commslock', true); } diff --git a/fp-plugins/commentcenter/tpls/configure.tpl b/fp-plugins/commentcenter/tpls/configure.tpl index e36d851..b3c9454 100644 --- a/fp-plugins/commentcenter/tpls/configure.tpl +++ b/fp-plugins/commentcenter/tpls/configure.tpl @@ -2,6 +2,9 @@ {html_form}

    {$plang.configure}

    {$plang.desc_conf}

    +{if !isset($pl_conf)} + {assign var=pl_conf value=""} +{/if}
    diff --git a/fp-plugins/commentcenter/tpls/listcomments.tpl b/fp-plugins/commentcenter/tpls/listcomments.tpl index 0af3394..fd76bbb 100644 --- a/fp-plugins/commentcenter/tpls/listcomments.tpl +++ b/fp-plugins/commentcenter/tpls/listcomments.tpl @@ -1,17 +1,17 @@ -{if !$delete}{/if} +{if !isset($delete)}{/if} -{if !$delete}{/if} +{if !isset($delete)}{/if} {assign var="i" value=0} {foreach from=$entries key=entryid item=entry} -{if count($entry.$fetch)>0 && !$is_managing} +{if count($entry.$fetch)>0 && !$is_managing} {/if} {foreach from=$entry.$fetch item=comm key=comm_id} {assign var="i" value=$i+1} @@ -20,15 +20,17 @@ - + - -{if !$delete} +{if !isset($delete)}{/if} +{/if}
    {$plang.app_date} {$plang.app_content} {$plang.app_author} {$plang.app_email} {$plang.app_ip}{$plang.app_actions}{$plang.app_actions}
    {$entryid|idToSubject} ({$entryid})
    {$entryid|idToSubject} ({$entryid})
    {$comm.date|date_format:"%D, %T"} {$comm.content|strip_tags} -{if $delete} +{if isset($delete)} {/if} {if $comm.url}{$comm.name|wp_specialchars}{else}{$comm.name|wp_specialchars}{/if}{if isset($comm.url)}{$comm.name|wp_specialchars}{else}{$comm.name|wp_specialchars}{/if} {$comm.email|wp_specialchars}{$comm.ip-address} -{if $is_managing && $use_akismet} +{* a bit hackish: {$comm.ip-adress} would lead to $this->_tpl_vars['comm']['ip']-$this->_tpl_vars['ddress']; *} +{assign var=ipadress value="ip-address"} +{$comm.$ipadress} +{if isset($is_managing) && isset($use_akismet)} {$plang.man_spam} {elseif !$is_managing} {$plang.app_publish} @@ -48,10 +50,10 @@ {/foreach} {/foreach} {if $i==0} -
    {$plang.app_nocomms}
    {$plang.app_nocomms}
    -{if !$delete} +{if !isset($delete)}