Archived
1
0

Compare commits

...

3061 Commits

Author SHA1 Message Date
mbirth 3be30fd416 Cleanup
Signed-off-by: Markus Birth <markus@birth-online.de>
2025-06-14 18:05:25 +01:00
mbirth 1057063648 Add translation file
Signed-off-by: Markus Birth <markus@birth-online.de>
2025-06-14 18:05:01 +01:00
mbirth 4ba79c9900 Start groups as index 1
Signed-off-by: Markus Birth <markus@birth-online.de>
2025-06-14 18:04:39 +01:00
mbirth cb2c3ce5e2 Prep Config Container and Dependency Injection
Signed-off-by: Markus Birth <markus@birth-online.de>
2025-06-14 18:04:17 +01:00
mbirth 4487199f16 Increase error reporting and fix a few small warnings
Signed-off-by: Markus Birth <markus@birth-online.de>
2025-06-14 17:58:36 +01:00
mbirth 56100cfd10 Remove more crud. Set error_reporting in bootstrap as there are still lots of NOTICEs. 2022-02-25 02:16:59 +01:00
mbirth af3fb672e3 Remove errorhandler, let filp/whoops handle them. 2022-02-25 01:49:35 +01:00
mbirth 08f1e90555 Fix mismatching signature. 2022-02-25 01:49:05 +01:00
mbirth 6d3221742d Remove redundant timezone setting. (Now in bootstrap.php.) 2022-02-25 01:48:25 +01:00
mbirth d18224e34d Improve bootstrap.php. 2022-02-20 17:15:52 +01:00
mbirth 4785f07f12 Always assume UTF-8. 2022-02-20 17:14:54 +01:00
mbirth b1c43491c3 Another serendipity_mb_ucfirst() case. 2022-02-20 02:03:29 +01:00
mbirth 6603e9b835 Always set universal/UTF-8. 2022-02-20 02:00:55 +01:00
mbirth 25b8dbcb42 Implement serendipity_mb_ucfirst() as that's not available. 2022-02-20 01:58:00 +01:00
mbirth f4bd9bc07a Always use native mb_* functions. 2022-02-20 01:56:52 +01:00
mbirth 33a98547a7 Fix English language fallback. 2022-02-20 01:36:33 +01:00
mbirth 626af897bc Update version number. 2022-02-20 01:12:36 +01:00
mbirth 694309bec9 Force UTF-8, remove all non-UTF-8 translations. 2022-02-20 01:11:37 +01:00
mbirth 16e4bc7f2a Remove ancient compatibility stuff. 2022-02-20 01:10:03 +01:00
mbirth 7156dec439 More cleanup. 2022-02-19 23:55:03 +01:00
mbirth 2d127e81e1 Cleanup and rename project to 幸運な偶然 - Lucky Coinkydink. 2022-02-19 22:19:07 +01:00
mbirth 09f47fc2d0 escapeString() can get a null value. 2022-02-14 21:57:57 +01:00
mbirth ff2131f9e3 Make DbTools::bool() static. 2022-02-14 21:57:40 +01:00
mbirth 27d91781ee Fix installer crashing b/c function was not available. 2022-02-14 21:44:38 +01:00
mbirth 5bd24c2d12 Output contents of $serendipity on Exception. 2022-02-14 21:44:20 +01:00
mbirth 7e8dcb0cb6 Added ConfigContainer. Routing.php is not yet fully converted. 2022-02-14 02:49:49 +01:00
mbirth 8ebf5e6865 Spacing. 2022-02-14 02:48:15 +01:00
mbirth fc78f871ed Replace microtime_float() by microtime(true). 2022-02-13 23:02:08 +01:00
mbirth 12e9df52de Typos and a few type hints. 2022-02-13 16:16:18 +01:00
mbirth 50c89e2bad Moved caching methods out of functions.inc.php into ContentCache class. 2022-02-13 16:15:48 +01:00
mbirth bb98e38522 Made Sqlite3ooDatabase extending from Sqlite3Database and removed redundand methods. Added a few type hints. Fixed a few typos in comments. 2022-02-13 13:18:27 +01:00
mbirth 8ecebf8940 Fix typo. Also added isUtf8mb4Ready() to DbAbstract. 2022-02-13 00:10:19 +01:00
mbirth d6ebe7a46f Fix missing utf8mb4-check. 2022-02-12 23:58:17 +01:00
mbirth d811c0bc56 @onli fix for s9y/Serendipity#772 2022-02-12 23:29:38 +01:00
mbirth d5318922b9 Turn database drivers into classes. Keep db.inc.php as a Shim. 2022-02-12 23:27:14 +01:00
mbirth 5a32071cb1 Use PageGenerator in comments.php. 2022-02-12 23:26:52 +01:00
mbirth d550adcdcd Moved genpage.inc.php into PageGenerator class. 2022-02-12 15:50:22 +01:00
mbirth 3623bdd4b1 Add missing property declaration. 2022-02-12 14:20:33 +01:00
mbirth 2470c65175 Moved functions_routing.inc.php into a class. 2022-02-12 04:41:33 +01:00
mbirth 4bee231cc6 Added bootstrap.php for Autoloader and Debugger. 2022-02-12 04:41:04 +01:00
mbirth a81734cdc3 Cleanup in composer.json. Added PHP-CodeSniffer as Dev-Dependency. 2022-02-12 04:38:52 +01:00
mbirth 5aac8fb9c9 Add php_codesniffer to DEV-dependencies. Also added local Scrutinizer config. 2022-02-12 00:23:30 +01:00
mbirth 6c9ccdc65a Added .editorconfig. 2022-02-11 19:00:41 +01:00
mbirth fe7f2e16dd Fix file permission. Add .gitignore for Nova IDE. 2022-02-11 17:36:36 +01:00
Markus Birth d43412d599 Added missing bundled plugins to plugin_api.inc.php (and .gitignore). 2022-02-11 15:51:54 +01:00
Markus Birth b69c8a9cbb Added TODO.md. Updated .gitignore to hide non-bundled plugins. 2022-02-11 15:25:49 +01:00
Markus Birth 4bea3ccdd6 Added filp/whoops for nicer error displays. 2022-02-11 02:08:27 +01:00
Markus Birth 1109e09b85 Increased default PHP version to 8. 2022-02-11 02:07:01 +01:00
Markus Birth 91bfb3a8c9 Remove included Smarty in favour of Composer install. Also removed all
manual loadings of Smarty to let autoloader handle this.
2022-02-10 03:12:54 +01:00
Markus Birth 82bb67654c Use composer-foxy (FKA composer-asset-plugin) to manage JS/CSS. Removed
bundled ckeditor in favour of using foxy to install it.
2022-02-09 16:01:34 +01:00
Markus Birth e19db2b065 Prepare autoload management via Composer.
(Run `./composer.phar dumpautoload` to update autoloader.)
2022-02-09 15:01:47 +01:00
Markus Birth 2a47e9edb3 CLEANUP: Fix file permissions 2022-02-09 01:31:37 +01:00
Markus Birth 5d696b6842 CLEANUP
* Updated `composer.phar` to latest version
* Remove libs that get installed by Composer from repo
  (run `./composer.phar install` after checkout)
* Change `composer.json` to use default `vendor` dir and raise max. PHP
  to 7.99.99 since we're at 7.4 now
* Rename `README.markdown` to `README.md`
2022-02-09 01:27:08 +01:00
onli be2de1a0ed Document #778 2022-02-03 20:30:14 +01:00
mbirth 512ff8e48c Add replacing [Regional Indicator Symbols](https://en.wikipedia.org/wiki/Regional_indicator_symbol) with latin letters. Feel free to add more emoji translations. 2022-02-03 20:25:52 +01:00
mbirth 9604e0392b Fix umlaut replacement to happen before all (UTF-8-)umlauts are stripped. 2022-02-03 20:25:52 +01:00
mbirth 99366d0997 Wrap site-wide permalink generation into a SQL transaction to speed it up. 2022-02-03 20:25:52 +01:00
mbirth 68ec268bf8 Convert file to UTF-8. 2022-02-03 20:25:52 +01:00
onli d79ea27422 Reset template script cache token also when saving configuration
Makes it easier to test script changes
2021-09-13 21:11:32 +02:00
onli 31fcc6a338 Set 2.4-beta1 as beta release 2021-09-12 15:49:47 +02:00
onli ff1fd8d8fa 2.4-beta1 release documentation 2021-09-12 15:36:54 +02:00
onli 0d74b79a48 PHP 8 Fix: When iso2br was not set editor showed a warning 2021-09-12 13:52:25 +02:00
onli ad0a3ce298 Fix: Rebuilding thumbnails could fail and produced warnings (#771) 2021-07-30 17:54:33 +02:00
onli 0a5d857fd4 Update README.markdown 2021-07-27 18:56:16 +02:00
onli d7d91cd94b Update README.markdown 2021-07-27 15:50:45 +02:00
onli 443ffc5039 Remove extra %s from comment notification text (#770) 2021-07-26 16:18:13 +02:00
surrim 9a60f9a494 Php8 fixes for #766 (#769)
* init empty vars to avoid PHP8 warnings

* removed debug output for serendipity_session_destroy()

* init smarty fixed for PHP8

* removed optional parameters for PHP 8

* 2k11 template fixes, maybe updating smarty will solve everything

* init or test undefined variables for PHP 8

* remove only existing files

* make sure string is not empty before comparing the first letter

* check if SMARTY_DIR was already defined

* use mb_language('uni') for unicode

* fixed image filter bug

* Smarty debug fixed in external lib

* fixed archive bug

* fixed entries bug

* updated plugin versions

Co-authored-by: surrim <surrim@happyhydro.org>
2021-07-18 22:14:23 +02:00
onli 1b162d33a8 timeline: PHP 8 compat fixes 2021-07-04 19:35:23 +02:00
onli d2a7784073 skeleton: PHP 8 compat fixes 2021-07-04 19:00:50 +02:00
onli 07272ec3c6 next: PHP 8 compat fixes 2021-07-04 18:43:51 +02:00
onli eb38547a24 Init all required comment form fields 2021-07-04 18:43:08 +02:00
onli 01aa046fc4 PHP 8 compat fixes for bartleby 2021-07-04 15:34:44 +02:00
onli 91c8ee2d8d bootstrap4: PHP 8 compatibility fixes 2021-07-04 14:12:46 +02:00
onli fa69a788a8 Enable production mode for beta and rc versions
To enable sane testing with PHP 8
2021-07-04 12:39:04 +02:00
onli 8d8aa4ce66 Do not print errors for PHP warnings in production mode
Not even when logged in. The error output stopped the script execution. This change enables the usage of old themes, if their critical issues are fixed
2021-07-01 22:03:45 +02:00
onli 34f52d1aae Fix: The error output left a pre-tag open 2021-06-30 21:46:39 +02:00
onli 18a6904d5d Fix: Serendipity stopped when encountering a Warning
Changes this to only stopping if debug mode is enabled
2021-06-30 21:39:42 +02:00
onli 0d5a29416c Fix: Every comment subscribed to an entry 2021-06-30 19:59:47 +02:00
onli 1170363a29 Fix: Entries could not be saved if blog had no category 2021-06-27 23:10:14 +02:00
onli 6e4d16d149 PHP 8 compat fixes for clean blog 2021-06-27 22:58:03 +02:00
onli aacf8e7f2f Fix php8 warning when gravatar + shoutbox are active 2021-06-27 21:24:19 +02:00
onli 2bad6efd9c Hide PHP warnings in production mode (#765)
* Hide PHP warnings in production mode

* Silence error reporing during second language file read
2021-06-26 16:49:21 +02:00
onli b547042af4 php8 compat fix for group menu with specific group permissions 2021-06-12 17:28:12 +02:00
onli 5dd3385c48 document user deletion fix 2021-06-08 23:47:43 +02:00
onli e8bb99752f Fix: Deleting a user throw a token not found error message
Setting POST['serendipity']['user'] triggers the login routine. When that happens a new session is generated, and afterwards the token check fails.
2021-06-08 23:42:59 +02:00
onli 323860150d PHP 8 compatibility fix for installing themes 2021-06-06 21:47:34 +02:00
onli c416ea82d3 fix: templates did not set the currect custom url
PHP 8 compatibility fix
2021-06-06 21:45:26 +02:00
onli ef79ef260b PHP 8 compat fixes for the core when trackack plugin is installed 2021-06-06 18:53:48 +02:00
onli e0d87c88cf Fix: Smarty init check could fail 2021-06-06 18:23:06 +02:00
onli 137ca00367 PHP 8 compat fixes for future entries on overview page 2021-06-06 17:45:42 +02:00
onli 62380a3086 PHP 8 compat fix for showing freetag RSS feeds 2021-06-06 12:32:23 +02:00
onli 330cab353e PHP 8 compat fix for showing plugin backend menus 2021-06-06 12:31:47 +02:00
onli 325c608139 creativecommons: PHP 8 compat fixes (for showing RSS) 2021-06-06 12:30:55 +02:00
onli a96fe8040a Set loading="lazy" to ML images if width and height are known 2021-06-05 18:23:36 +02:00
onli 8852792674 Add missing NOTIFICATION_CONFIRM_SUBMAIL_FAIL lang constant
PRevents a PHP 8 compatibility error when subscribing to a comment thread failed
2021-05-30 16:02:58 +02:00
onli 91a14c3dc7 textile 1.8.4: php 8 compat fixes 2021-05-30 12:13:54 +02:00
onli 4ecf52d10f clean blog: php 8 compat fixes 2021-05-30 12:07:04 +02:00
onli 7fe104ed40 php 8 compat fixes (context: templatechooser to clean blog) 2021-05-30 12:06:14 +02:00
onli 7f1f5729c8 tempaltechooser 1.7.1: php 8 compat fix 2021-05-30 12:05:23 +02:00
onli 50ccdce46c resposniveimage: php 8 compat fix for themes without breakpoints 2021-05-30 12:04:16 +02:00
onli 20de7bd442 php 8 compat fix for saving plugin order 2021-05-30 11:47:18 +02:00
onli e293bc18f3 php 8 compat fixes for comment subscription 2021-05-29 20:27:02 +02:00
onli 1fc5076112 gravatar 1.63.1: php 8 compatibility fixes 2021-05-29 19:44:16 +02:00
onli bb483dcadc creativecommons 1.6.1: PHP 8 compat fixes (missing lang constants) 2021-05-29 18:32:34 +02:00
onli 8dbf85aacd bbcode 2.11.1: php 8 compat fix 2021-05-29 17:22:24 +02:00
onli 5ccb3cba67 fix: log_trackback called when not available (regular comments)
Removes the not strictly necessary function call
2021-05-29 17:21:08 +02:00
onli f4d5a76add php 8 compat for bbcode plugin configuration 2021-05-29 17:17:08 +02:00
onli 8b8d8bf2c5 PHP8 compat fix for sending trackbacks (when target has no params) 2021-05-28 17:59:44 +02:00
Matthias Gutjahr 8d1dd2994c php 8 compat fix
Signed-off-by: Matthias Gutjahr <mattsches@gmail.com>
2021-05-26 23:41:39 +02:00
onli c53b612421 php 8 compat fix when entry has trackback 2021-05-26 16:23:59 +02:00
onli bd6c9e79c9 more php 8 compat fixes for receiving trackacks
Also includes a code-cleanup by introducing log_trackback, a less code heavy way to log the trackback flow
2021-05-26 00:08:32 +02:00
onli 730f4c080a php 8 compat fixes for receiving trackbacks 2021-05-25 23:13:51 +02:00
onli 42f93ee27a spartacus: php 8 compat fix 2021-05-25 22:48:37 +02:00
onli 5f488e97cf Wysiwyg cleanup (#761)
* Cleanup ckeditor config
Remove force-settings, remove verbose commentary from config, limit toolbar selection

* document toolbar removal
2021-05-24 17:39:08 +02:00
onli e2044472c2 php 8 compat fix for sending trackbacks 2021-05-18 19:42:16 +02:00
onli ae4e91f095 php 8 compat fix when showing RSS feed 2021-05-18 19:39:14 +02:00
onli 56f17439a1 php 8 compat fix for upgradeable plugins list 2021-05-18 19:37:05 +02:00
onli a8e919961b php 8 compat fix for spartacus when plugin upgrades are available 2021-05-18 19:33:19 +02:00
onli d2fb86fc2f syndication 2.3.0: Drop subtome JS plugin 2021-05-18 19:32:30 +02:00
onli 0590b97c67 minor: typos in NEWS 2021-05-13 22:29:27 +02:00
onli 9090de5605 update docs/NEWS 2021-05-13 22:13:21 +02:00
onli cd96ca66c7 php8 compat fixes for personal settings 2021-05-13 21:39:32 +02:00
onli 9b758e84db fix: Show proper upload media popup when using filter after upload
Add the needed parameters to the hidden form used in the media library form so that a reload of the ML after the first upload still crenders the correct ML variant - the one for selecting an image, not the generic
2021-05-13 21:26:58 +02:00
onli e448d1c384 php 8 compat for ML item insert into article 2021-05-13 20:16:21 +02:00
onli 28c199c7aa php8 compat fixes for groups section 2021-05-13 17:57:07 +02:00
onli 9f4153dbc4 php8 compat fixes for user creation 2021-05-13 17:03:50 +02:00
onli 17786592e7 php 8 compat fixes for plugin installation 2021-05-13 15:33:27 +02:00
onli ed24403d36 php 8 compat fixes for comment section 2021-05-13 15:19:54 +02:00
onli cbca20a535 php 8 compat fixes for commenting in frontend 2021-05-13 15:03:23 +02:00
onli d28b15381c php 8 compat fixes for ML directory section 2021-05-13 14:57:19 +02:00
onli 561a86b385 php 8 compat fixes for media property page 2021-05-13 14:43:55 +02:00
onli c00ed46789 fix: media upload fails when in subdirectory with default paths
Use file['realfile'] instead of path guessing based on file['full_file'] to access image on disk, since file['full_file'] is based on the http path
2021-05-13 14:18:31 +02:00
onli 05c3fa71eb Revert "fix: uploaded image path computted wrong when in subdirectory"
This reverts commit 46e8cc96b3.
2021-05-13 14:16:21 +02:00
onli 4cab1db38d php 8 compat: Image upload 2021-05-13 14:13:58 +02:00
onli 46e8cc96b3 fix: uploaded image path computted wrong when in subdirectory
The path set as $file['full_file'] and used for the dimension calculation incorrectly used the HTTP path
2021-05-13 14:11:07 +02:00
onli fd9edae13c php 8 compat fix: Show category archive pages 2021-05-09 23:05:25 +02:00
onli 40e44fd455 php 8 compat fix: Show entry backend pages when category exists 2021-05-09 23:00:49 +02:00
onli 60f5277435 php 8 compat fixes t oallow category creation 2021-05-09 21:57:43 +02:00
onli 814c681587 php8 compat fix: Don'd die in iframe when editing an entry 2021-05-09 21:23:30 +02:00
onli 67aa8f801b fix: Re-use entry title when already set, e.g. when editing 2021-05-09 21:07:26 +02:00
onli 74713a0337 php 8 compat fix: do not die when listing entries 2021-05-09 21:01:52 +02:00
onli 25cfb97ece php8 compat fixes to save entries again 2021-05-09 17:17:54 +02:00
onli 20539b92d4 Fix: Preserve entry form title in preview 2021-05-09 17:07:06 +02:00
onli 4c246ad426 php8 compat fixes for entry preview 2021-05-09 16:54:27 +02:00
onli 24c02da747 PHP8 compat for plugin menu 2021-05-06 20:45:19 +02:00
onli 3d1c264ccd PHP8 compat fixes for themes menu 2021-05-06 20:45:19 +02:00
onli 0303eec81e PHP8 compat fixes for configuration 2021-05-06 20:45:19 +02:00
onli ef27f70b3d PHP8 compat fixes for plugin configuration (spamblock) 2021-05-06 20:45:19 +02:00
onli a6162b6e04 PHP8 compat fix for ML directory menu 2021-05-06 20:45:19 +02:00
onli a6ca0d7fe5 PHP8 compat fixes for media library 2021-05-06 20:45:19 +02:00
onli cb258fa3a8 PHP8 compat fixes for image upload menu 2021-05-06 20:45:19 +02:00
onli ab9962a1f8 PHP8 compat fixes for entry list 2021-05-06 20:45:19 +02:00
onli 7900062aa3 PHP8 compat fixes for entry form display 2021-05-06 20:45:19 +02:00
onli b2707b81ae spamblock 1.89.3: php8 compat 2021-05-06 20:45:19 +02:00
onli 4e98879295 PHP8 compat fixes for serendipity_editor.js.tpl 2021-05-06 20:45:19 +02:00
onli 5013d583f2 Apply PHP8 compat fixes for backend controllers
Taken from https://github.com/s9y/Serendipity/pull/750
2021-05-06 20:45:19 +02:00
onli 395d018908 php8 compat for login 2021-05-06 20:45:19 +02:00
onli f996065a89 spartacus 2.39.2: php8 compat 2021-05-06 20:45:19 +02:00
onli ec70938faf fix: plugin_config accessed undefined variable for separator 2021-05-02 12:58:43 +02:00
onli e2682dbd79 fix: Editor area sent backend_entry_toolbar_body with empty data 2021-05-02 11:34:51 +02:00
onli 95b0211f0b fix: Editor area sent backend_entry_toolbar_body with empty data 2021-05-02 10:20:30 +02:00
onli 38354fcad5 Remove unused mysql (instead of mysqli) database layer 2021-05-02 10:12:13 +02:00
onli 9784fda858 Add () to set ?? evaluation order in ifs 2021-05-02 09:50:58 +02:00
onli 2a5d0e3ad4 Fix: mysqli was always picked as db after installation 2021-05-02 09:50:58 +02:00
onli 90dd334327 PHP 8 compatibility fixes for the installer 2021-05-02 09:50:58 +02:00
onli 7e48e041a2 Remove unused laminas db backend (#757)
* Remove unused laminas db backend

* Remove laminas-db from composer.json

* Remove bundled-libs/laminas
2021-04-27 21:50:34 +02:00
onli 717282a58a Run 'compose update' 2021-04-27 21:30:20 +02:00
onli 05f58f90d7 Finish broken language file removal
Parts of VIEWMODE_THREADED remained
2021-04-19 17:19:44 +02:00
onli 26aecdf06e Update lang/serendipity_lang_fr.inc.php 2021-04-19 17:19:44 +02:00
onli 11526604e1 php8 compat: undefined display_dat array keys 2021-04-19 17:19:44 +02:00
onli 6909411452 entryproperties 1.41.6: PHP 8 compat fixes 2021-04-19 17:19:44 +02:00
onli 6e71da985f Remove unused $week routing part
This throws an error with PHP 8, but since $week is never defined it looks like this has been broken for a while. It can be re-added in a separate PR, if the intended functionality is known.
2021-04-19 17:19:44 +02:00
onli d1e040b7ec php 8 compat: fix undefined array access adnd $year,... construct 2021-04-19 17:19:44 +02:00
onli 1fcb77427e php8 compat fix: $lang and $cond['joins'] unset before access 2021-04-19 17:19:44 +02:00
onli df6d80f328 php 8 compat: Fix unused key and empty path, for css 2021-04-19 17:19:44 +02:00
onli a3253a0d55 syndication 2.2.4: php8 compat 2021-04-19 17:19:44 +02:00
onli 5e78cba223 php8 compat: assign smarty variable via index.php 2021-04-19 17:19:44 +02:00
onli 302960b786 php8 compat: Include missing smarty variables in genpage 2021-04-19 17:19:44 +02:00
onli b886a6a66c Enable array_key_exists for smarty templates
Used in 2k11 for PHP 8 compatibility checks
2021-04-19 17:19:44 +02:00
onli 48211e27b1 php8 compat for 2k11 frontend templates 2021-04-19 17:19:44 +02:00
onli 0a4911566c php8 compat: Prevent unused key error 2021-04-19 17:19:44 +02:00
onli 0c84f10b7c responsive 0.5.2: php8 compat 2021-04-19 17:19:44 +02:00
onli 2261e112eb nl2br 2.21.9: php8 compat 2021-04-19 17:19:44 +02:00
onli a32bb4f2ee emoticate 1.11.1: php 8 compat 2021-04-19 17:19:44 +02:00
onli 21a4448d33 s9ymarkup 1.4.1: s9ymarkup 2021-04-19 17:19:44 +02:00
onli b36ad0f14f php8 compat: fix undefined key 2021-04-19 17:19:44 +02:00
onli 5396ef3ff5 php8 compat: Fix multiple key issues and unserialized cache key 2021-04-19 17:19:44 +02:00
onli bfc7d135a4 php8 compat: fix undefined keys 2021-04-19 17:19:44 +02:00
onli f03ab03a55 php8 compat: Fix undefined keys in 2k11 config 2021-04-19 17:19:44 +02:00
onli d817c67682 php8 compat: Multiple fixes 2021-04-19 17:19:44 +02:00
onli e07d08e60d php8 compat: Fix unset timestamp and res[2] key error 2021-04-19 17:19:44 +02:00
onli 690b6def49 php8 compat: Don't redefince LANG_CHARSET 2021-04-19 17:19:44 +02:00
onli 7f3d7e4017 php8 compat: Don't redefine SQL_CHARSET_INIT 2021-04-19 17:19:44 +02:00
onli 471292ac1a php8 compat: Drop VIEWMODE_THREADED from lang files 2021-04-19 17:19:44 +02:00
onli 75352e8565 php8 compat: Pass undefined user and password error 2021-04-19 17:19:44 +02:00
onli 391a372a55 php8 compat: fix missing $args and charset error 2021-04-19 17:19:44 +02:00
onli 9ac2504f4f PHP8 compat for frontpage, plugin-api warning 2021-04-19 17:19:44 +02:00
Hanno Böck 0ef188187d Remove obsolet handling of magic_quotes_* 2021-04-19 17:17:35 +02:00
onli 0f2a6791d0 Set utf8 as default for databases (and utf8mb4 when possible) 2021-03-15 18:41:43 +01:00
onli c162094fb3 Update Smarty to 3.1.39 2021-03-15 18:24:13 +01:00
onli b6e36ec128 Document Cache-Lite 1.8.3 upgrade 2021-03-05 08:23:01 +01:00
onli f7d0e4530c Update Cache-Lite to 1.8.3
Compatibility with PHP 7.4
2021-03-05 08:21:36 +01:00
onli 54efde550e ARCHITECTURE is a markdown file 2021-02-07 12:05:32 +01:00
onli b546ea3d4c Add ARCHITECTURE documentation file 2021-02-07 12:04:33 +01:00
onli 674319b36b Set utf8 as database charset, use utf8mb4 if possible for mysql
For serendipity_config_local.inc.php, see https://github.com/s9y/Serendipity/issues/747
2021-02-03 19:45:51 +01:00
Hanno Böck 931e621549 Replace token generation with hash and uniqid with secure random numbers from random_bytes 2021-02-03 17:44:12 +01:00
onli 80be37ca8d document #748 2021-02-03 16:36:33 +01:00
surrim 11d903efdb unified parameter for backend_image_add hook 2021-02-03 16:34:07 +01:00
onli 4ef3a8f0bb fix: escape html in plugin list to not hide those after nl2br 2020-09-21 19:40:59 +02:00
Garvin Hicking 37cd0c3808 [TASK] Adds 'image_id' to event 'backend_image_add' in addData array 2020-09-16 11:21:05 +02:00
Stephan Brunker cb4530f83c functions.inc.php: fix SQL syntax error (postgreSQL), issue #743 2020-08-24 09:24:26 +02:00
Uwe Krause bd3a9ec832 check if php extension xml is available. fixes #741 2020-08-23 15:23:23 +00:00
Uwe Krause 626aac6335 check if php extension xml is available. fixes #741 2020-08-23 15:23:23 +00:00
onli 3e82e948b1 document date/time editor change 2020-08-15 07:40:05 +00:00
onli e05739dd5c Adapt datetime reset to split date and time input 2020-08-15 07:40:05 +00:00
onli e1bda89dc0 Split timestamp field for supported HTML5 input types 2020-08-15 07:40:05 +00:00
onli 26c402ec5c Add TIME language constant 2020-08-15 07:40:05 +00:00
onli db08637624 Improve performance of the media library by caching the file list 2020-08-01 20:36:23 +02:00
Stephan Brunker 712b958c21 restored accidentally deleted language constants 2020-06-18 20:18:17 +02:00
Stephan Brunker dafaae8db0 langs/langsorter: update examples fix 'all' argument 2020-06-06 14:59:30 +02:00
Stephan Brunker 3d975cd562 syntax fixes, if without brackets 2020-06-06 01:51:25 +02:00
Stephan Brunker 6b4b1bda18 removed smarty assign head_title, already in smarty_init 2020-06-06 01:51:25 +02:00
Stephan Brunker bba9792011 update NEWS 2020-06-06 01:51:25 +02:00
Stephan Brunker 65e1007ca1 media empty selection: add string for errormessage 2020-06-06 01:51:22 +02:00
Stephan Brunker b6f582774a media: fix/add media select button and preview image in plugin configuration 2020-06-06 01:51:22 +02:00
Stephan Brunker 6036d62d82 media: added option to disable multiselection (still on by default) 2020-06-04 23:51:13 +02:00
Stephan Brunker ac6c2d5269 serendipity_fetchUsers: fix SQL syntax error (WHERE statement twice) 2020-06-04 23:40:56 +02:00
Stephan Brunker e893914c7c media: fixup empty selection for upload and empty multiselection issues 2020-05-29 22:16:17 +02:00
onli 17761c6214 Show a warning in the ugprader when plugins are not current (#477) 2020-05-29 11:25:24 +02:00
onli 2be8e6ba2a Use original image for srcset when it is small (#474) 2020-05-28 17:50:39 +02:00
onli 5d67e35f24 Give plugins a way to skip the stored trackback detection (#440) 2020-05-28 16:17:16 +02:00
onli cb5e99013e Allow https as trackback url origin 2020-05-28 14:33:47 +02:00
onli 0ad7691634 Show an error message when the sqlite database is readonly (#427) 2020-05-28 14:07:36 +02:00
onli 40bae4f5b2 Remove db charset conversion buttons 2020-05-28 12:33:34 +02:00
onli 0def9e991f MySQL: Set charse tto ut8mb4, needed for some versions (#394) 2020-05-28 11:59:12 +02:00
Stephan Brunker 0409717586 media_upload: check for empty file input 2020-05-27 21:49:14 +02:00
Stephan Brunker 9f0af1f275 plugin nl2br: add newlines to improve readability of the output 2020-05-27 21:49:14 +02:00
Stephan Brunker 8e24108b88 admin/entries.inc.php: strip multilingual from iframe entry 2020-05-27 21:49:14 +02:00
Stephan Brunker 0cf227f335 Totally resorted the language files, added subscription strings 2020-05-27 21:49:11 +02:00
onli bf8f1aafa5 Disable ckeditor ACF to fix #705
And to prevent similar issues in the future
2020-05-27 14:41:15 +02:00
onli 6b6f8138f0 Update README.markdown 2020-05-27 13:49:16 +02:00
Stephan Brunker 695055f50c plugin nl2br: add missing 'u' inline element 2020-05-15 13:33:53 +02:00
onli 8b5655ce92 Update README.markdown 2020-05-08 10:43:27 +02:00
onli 1aec803a23 Update README.markdown 2020-05-08 10:43:27 +02:00
Matthias Mees 3bc302fbcf Fix broken sidebar in bootstrap4 theme 2020-05-03 19:51:43 +02:00
onli a3007dd5f9 Add PEAR/Exception.php to HTTP/Request2 to evade hoster error
See https://board.s9y.org/viewtopic.php?f=10&t=23815&p=10453266
2020-05-03 18:30:04 +02:00
onli dd455ae507 Add Gitlab as Spartacus mirror 2020-05-03 13:59:23 +02:00
onli 5ec1754434 Stop appending * to search terms (fixes #704) 2020-05-03 13:52:05 +02:00
Soatok Dreamseeker 7e98987b5a Commit changes to bundled-libs after Zend->Laminas rename 2020-05-03 11:11:13 +02:00
Soatok Dreamseeker e9f0864c8c Switch from Zend to Laminas 2020-05-03 11:11:13 +02:00
Thomas Hochstein 24debf1b9e Change locale for Dutch language file.
The "nl" language file should have the
Dutch-Netherlands locale (as "de" has
"de_DE" and not "de_AT"). We could add a
"be" language file, if need be.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-05-02 18:46:10 +02:00
Stephan Brunker 4db384f926 2k11/admin/comments: Stay on the same page after approving 2020-05-02 11:28:07 +02:00
Hanno Böck c479e1c9d2 escape filter words for regexp 2020-04-30 10:22:27 +02:00
onli e1291fb54a Update ckeditor to 4.14.0, replace code wrap button with snippet
See https://board.s9y.org/viewtopic.php?f=10&t=24808 for context
2020-04-29 17:08:01 +02:00
Stephan Brunker 2b6a1a6a3b [plugin recententries] Fix multilingual issues 2020-04-28 20:18:35 +02:00
Eike Rathke 906239faa1 Set hashtype = 2 when converting from MD5
Otherwise we'd end up with an attempt to authenticate with SHA1 against
BCRYPT that never succeeds, see
https://board.s9y.org/viewtopic.php?t=24720
2020-04-26 22:01:25 +02:00
Thomas Hochstein 4df3ca647f Change German for dashboard upgrade notification.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-25 10:12:11 +02:00
Thomas Hochstein 1032bd9725 Release 2.3.5
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-25 08:37:03 +02:00
Thomas Hochstein 7bfa899cc3 Merge pull request #703 from th-h/thh-summary-css
Restrict block display of summary to trackbacks.
2020-04-25 00:13:27 +02:00
Thomas Hochstein c1afdc5a78 Restrict block display of summary to trackbacks.
Summary elements in the entry body should get
a triangle symbol displayed (as we do in the
backend).

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-24 22:10:14 +02:00
Thomas Hochstein 7064657783 Change meaning of PLUGIN_DOCUMENTATION.
The "website" property fo the plugin bag used
to contain a link to external documentation,
but there is none left. So in future it may
point to a plugin website (or the website
of the plugin's author, if there is no
special page about the plugin).

Change language and translations accordingly.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-24 22:04:06 +02:00
Hanno Böck 507ede701a Simplify cookie option code and set security flags httponly and samesite=Lax.
Include compatibility code for pre-7.3 PHP versions.
2020-04-24 20:35:52 +02:00
Thomas Hochstein e60dd8dd2d Merge pull request #702 from th-h/thh-plugin-comments
[plugin_comments] Don't strip HTML unconditionally.
2020-04-24 15:25:40 +02:00
Thomas Hochstein a80a57b780 [plugin_comments] Don't strip HTML unconditionally.
If serendipity_event_unstrip_tags is active, we
don't want to strip HTML tags from comments; we
want to keep and encode them with entities. So
we should do that here, too.

As the frontend_display hook - that is catched by
serendipity_event_unstrip_tags - is called quite
late, we have to skip the strip_tags() call
before truncatin the entry.

(I'm not sure why we first strip _all_ tags and
later on keep _some_ tags (that have already
been removed), but that's maybe because the
frontend_display hook may have re-added some
tags? Be it as it may, we do that for 14
years, so I don't want to change that now.)

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-24 15:24:10 +02:00
Thomas Hochstein 9cff057209 CK-Editor: allow details and summary.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-23 17:56:54 +02:00
stephanbrunker 928f220c5a [event nl2br] fix concatenation and spaces between newlines 2020-04-23 00:05:22 +02:00
Thomas Hochstein c694fb0f45 Fix regexp to truncate media extensińs to 5 chars.
See 4ee1066b89
and https://gist.github.com/mmitch/5b466e6f89efc6dccd7dce2cf7d72742

Thanks to @mmitch!

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-20 08:44:30 +02:00
Thomas Hochstein b2b1de66b6 Merge pull request #695 from th-h/thh-fixentryprop
Fix accidental deletion of extended properties.
2020-04-18 22:41:26 +02:00
Thomas Hochstein f32be57fb5 Fix accidental deletion of extended properties.
Was mostly fixed by 8b51c37b98 (see #261),
but which missed 03cc73d77e and the other
older code before the foreach() loop.
Later on, 7fe8d91bc2 did the check for
'propertyform' the wrong way around.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-18 22:33:20 +02:00
Stephan Brunker a3f39396c6 [event_spamblock] Don't refresh timeout when displaying preview 2020-04-14 14:07:02 +02:00
Stephan Brunker 0d7f55e616 fix oddments in admin/users and admin/entries 2020-04-14 13:56:45 +02:00
Thomas Hochstein bb021db228 Add note to serendipity_event_spartacus.php.
See #685.

Plugin version not incremented on purpose.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-11 12:56:42 +02:00
Thomas Hochstein 9b65e717c1 Add note to serendipity_fetchEntries().
I think that will help to think about the
context of serendipity_fetchEntries() calls.

Closes #693.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-11 12:53:09 +02:00
Thomas Hochstein 93ba22c8d4 Don't fallback to last page if $totalPages < 1.
See #693 for context. That should at least
avoid SQL errors.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-11 12:47:55 +02:00
Thomas Hochstein 6522f043cf Merge pull request #694 from th-h/master
Fix SQL error in plugin_history.
2020-04-11 10:58:29 +02:00
Thomas Hochstein 4010d57d28 Fix SQL error in plugin_history.
Since merging #665 `serendipity_plugin_history`
breaks with a SQL error message on every archive
page but the first one; see #693 for reason
and context.

Unset `$serendipity['GET']['page']` before
calling `serendipity_fetchEntries(`)` (and
reset afterwards) to fix that. That's the
correct way, I think, as
`serendipity_fetchEntries()` is not called
in page context here.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-11 10:52:50 +02:00
Stephan Brunker aff7f2ed9c functions_entries: use rewriteURL function for comment submit link 2020-04-06 19:36:10 +02:00
Thomas Hochstein e288d7e43e Fix display of upgrade notification.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-04-03 09:15:33 +02:00
Thomas Hochstein 0fc509a50b Add NEWS item.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-28 15:22:58 +01:00
Thomas Hochstein c89d7f92f6 Dashboard: Merge s9y and plugin update notifications.
Display either or both in one section.

Set dashboard_widget class to aid formatting.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-28 15:22:58 +01:00
Thomas Hochstein 5ca9da9a56 [event_spartacus] Change dashboard upgrade notification to simple link.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-28 15:22:58 +01:00
onli de29be7287 Drop unused is_utf8 variable 2020-03-28 13:37:12 +01:00
onli b718cf7726 Only set mysqli_set_charset when covnersion is enabled
This restores the behaviour from before the move to utf8mb4 and should help legacy blogs not having charset issues, that went from latin1 to utf8 to now utf8mb4
2020-03-28 13:31:49 +01:00
Thomas Hochstein 261bac42f1 Bump event_spartacus version
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-28 13:26:06 +01:00
Thomas Hochstein 53694e2691 Unconditionally keep upgraded_version in plugin cache.
See #685 for more information.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-28 13:22:01 +01:00
Thomas Hochstein ded855f096 [event_spartacus] Simplify count_plugin_upgrades()
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-28 13:21:09 +01:00
Thomas Hochstein 52952ffe36 Fix comment in plugin_api.inc.php
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-28 09:24:30 +01:00
Thomas Hochstein 5adf3cda02 One adv_opts_box should be enough for everybody.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-27 20:18:46 +01:00
Thomas Hochstein bb02319553 Fix regexp in
See #655.

I don't understand the code either (I don't even see
where this code path belongs to - do we have a
facitlity to show comments "from ... to"?), but
the current regexp is obviously wrong, and the
one suggested by @hannob is obviously
(syntactically) correct, so it should be no
problem to change that.

Fixes #655.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-27 16:47:49 +01:00
Stephan Brunker 2bbf459118 admin template entrylist: entry title was double escaped 2020-03-26 11:08:33 +01:00
onli 51448ddcae Prevent header already sent error for serendipity_editor.js.tpl 2020-03-25 23:49:10 +01:00
onli d690a751d3 Up spamblock version, document #683 2020-03-25 22:33:19 +01:00
Daniel Lange 57cbaaa58b Update spamblock query to work in MySQL 5.7+ with default "strict" mode
The old query will fail with ONLY_FULL_GROUP_BY set which is default from
MySQL 5.7.5 onwards. This results in the .htaccess file not being updated.

Also adding some fencing to the foreach to prevent php error messages.
2020-03-25 22:28:25 +01:00
Thomas Hochstein 7bd1f3567e Add NEWS item.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 21:48:27 +01:00
Thomas Hochstein 4ee1066b89 Truncate extension of media items to 5 chars.
That's the max length of the extensin
database field.

Fixes #609.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 21:46:05 +01:00
Thomas Hochstein 1b6840d98e Relax active content check for renaming.
We don't need to check against the filename
without extension, because it's only the
extension that may be problematic.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 21:43:12 +01:00
Thomas Hochstein 3148e44f87 Release 2.3.4
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 16:59:24 +01:00
Thomas Hochstein 7ca42f379f Fix typo (ML renaming code).
Fixes 2ccb43a271

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 16:23:21 +01:00
Thomas Hochstein 382c785725 Merge branch 'thh-rce'
* thh-rce:
  Fix RCE vulnerability on Windows.
  Add missing active content check for renaming.
2020-03-25 16:13:39 +01:00
Thomas Hochstein fd8dcd3882 Wordwrap overly long words in comments via CSS.
Very long words may overflow the dashboard_widget
boundary on backend start page otherwise.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 15:36:08 +01:00
Thomas Hochstein e792a8d913 Fix RCE vulnerability on Windows.
Steps to reproduce:

1) Upload a PHP script to the Media Libray,
   naming it "test" (or any other name
   without extension).
2) Rename it to "exploit.php." (trailing dot!)

On Linux, the file will be renamed to
"exploit.php..", which is safe and
cannot be exploited.

On Windows though, the file will be
renemad to "exploit.php" and is then
remotely executable by calling it
from "/uploads/exploit.php".

Thanks to Junyu Zhang <rgdz.eye@gmail.com>
for spotting this!

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 15:04:31 +01:00
Thomas Hochstein 21c3b0d83f Add missing active content check for renaming.
After fixing the other ML file renaming bugs,
it was now possible to rename a file without
extension into a file that *does* have an
extension - so we need to check against
active content.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 15:04:25 +01:00
Thomas Hochstein 0b2d6bf931 Really set source of plugins.
Fixes d179f1b154

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 15:03:31 +01:00
Thomas Hochstein 90be45004b Add NEWS entry for ML rename fixes.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 13:16:41 +01:00
Thomas Hochstein 2ccb43a271 Fix for "disappearing" media files after renaming.
The renaming code added a dot '.' to the
filename on disk even if the file hat no
extension. Therefore, the file name on disk was
different from the name in the database,
triggering the database purging code on the
next ML display.

(serendipity_displayImageList() will delete
files from the database that don't exist
any longer on disk.)

This code won't add spurious dots for
empty extensions, keeping disk and
database in sync.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 13:10:46 +01:00
Thomas Hochstein fd49846aa1 Add different error messages for ML rename.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 13:06:33 +01:00
Thomas Hochstein 837c58cf6d Add missing en/UTF-8 entries to language file.
Belongs to
d179f1b154

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 11:04:06 +01:00
Thomas Hochstein ce7fa80f4b Add filename to error message (ML renaming).
Belongs to
1c95c173a2

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 11:04:00 +01:00
Thomas Hochstein 18ab57b76b ML: Really add error message when renaming fails.
Fixes 1c95c173a2
2020-03-25 11:03:34 +01:00
Thomas Hochstein 1c95c173a2 ML: Add error message when renaming fails.
Completing 1ed4b9e7ec

As we already have an (unused) language
constant for this error, we seem to have
had this kind of check before ...

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 00:54:48 +01:00
Thomas Hochstein b12c098bd0 Add author to details of installed plugins.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-24 16:12:31 +01:00
Thomas Hochstein d179f1b154 Add plugin source to list of plugins.
* plugin_api.inc.php:
  - Add static list of bundled plugins.
  - Add function to check if plugin is
    bundled.
* plugins.inc.php:
  - Set source of plugin
    (Spartacus, bundled or local).
* plugins.inc.tpl:
  - Display plugin source.
* Add language constants.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-24 15:57:48 +01:00
Thomas Hochstein f576501737 Revert "Save remote plugin source when merging remote / local data."
This reverts commit 8c702769e4.

We can do this better.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-24 15:36:49 +01:00
Thomas Hochstein fd6daca381 Display "more info" link to Spartacus even for installed plugins.
Use new capability from 8c702769e4

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-23 22:36:27 +01:00
Thomas Hochstein 8c702769e4 Save remote plugin source when merging remote / local data.
When installing / updating plugins, plugin data
is fetched from Spartacus first; those plugins
will habe "Spartacus" as "pluginlocation".

Later on, information about installed plugins
is fetched from cache / database, overwriting
the previously fetched data for all installed
plugins. After that, "pluginlocation" is
"local" even for plugins that live on
Spartacus if they have been installed.

So we save "pluginlocation" data to a new
"pluginsource" field before merging /
overwriting so we can detect plugins that
are available on Spartacus.

This data is present in plugins.inc.tpl
and can be used there.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-23 22:28:43 +01:00
Thomas Hochstein 04a3d34176 "$cachedtype" was set twice.
"$cachedtype" is saved anayway before returning;
no need to set it here.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-23 20:50:46 +01:00
Thomas Hochstein a3a48fd4f5 Escape plugin author name in pluginlist.
Don't show HTML from author name field.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-23 17:49:52 +01:00
onli 8a1ab31a66 Remove utf8mb4_ready requirement from native -> utf8 upgrade 2020-03-23 17:25:04 +01:00
onli be422b5e83 Add maintenance tasK: native -> utf8, utf8 -> utf8mb4
Note: Native to utf8 will not work if the data in the database table is actually utf8! These are helper functions for during the alpha, to make testing easier, not tasks for the beta/stable
2020-03-23 17:15:56 +01:00
onli af036ca58d Add warning to upgrade task for utf8mb4 upgrade 2020-03-23 09:57:59 +01:00
onli a6f9ec1638 fix: don't ugprade only entries, but all our databases 2020-03-23 00:03:20 +01:00
onli 945b73dc34 Use utf8mb4_unicode_ci instead of utf8mb4_general_ci in upgrade 2020-03-22 23:52:01 +01:00
onli c6800d5fc3 minor: explain serendipity_utf8mb4_ready in doccomment 2020-03-22 23:20:08 +01:00
onli 3ac81b91ca Reworked version and function requirement for utf8mb4 (#394) 2020-03-22 23:13:15 +01:00
onli fa17e0709c Upgrade task to move utf8 mysql databases to utf8mb4 (#394) 2020-03-22 22:15:23 +01:00
onli 8b27a56209 Raise mysql requirements for utf8mb4 to 5.7/10.0.2
utf8mb4 did not work on a test server with large prefix (=not 3000 byte index limit, only 1000) on Depian 9/mariadb 10.1.44, because the row format was not barracuda (by default?)
2020-03-22 20:44:11 +01:00
onli b15a453165 Use InnoDB and utf8mb4 on current mysql databases
For new installations only so far
2020-03-22 13:15:32 +01:00
Thomas Hochstein 05fe0a3526 Forgot to bump the release numbers.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-22 11:36:22 +01:00
Thomas Hochstein 3680a119c3 Release 2.3.3
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-22 09:59:17 +01:00
Thomas Hochstein d255ff0d2d NEWS: Third time's a charme.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-21 23:41:44 +01:00
Thomas Hochstein bbcab1f324 NEWS: And now without typos and missing lines.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-21 23:25:43 +01:00
Thomas Hochstein f40cd076c5 NEWS: Move backported entries from 2.4 to 2.3.3.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-21 23:18:37 +01:00
Thomas Hochstein cf30889d45 Add documentation for fix in plugin_comments.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-21 18:03:32 +01:00
Thomas Hochstein 599aeef3b6 Merge pull request #681 from th-h/thh-limit
Set empty limit to "" in serendipity_fetchEntries.
2020-03-21 18:01:57 +01:00
Thomas Hochstein b718637794 Set empty limit to "" in serendipity_fetchEntries.
If $limit is empty(), no limit is set, so we can
set the LIMIT statement to "" to achieve the same.

But an empty() $limit can be "0", so the
generated SQL statement could end with "0"
instead of the LIMIT statement. We catch this
with forcing an empty() $limit to "".

Fixes #636.
(No matter that this shouldn't even happen.)

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-21 17:59:13 +01:00
Thomas Hochstein 9254609ff4 Merge pull request #680 from th-h/thh-plugin-comments
[plugin_comments] Fix wordwrap at wound boundaries.
2020-03-21 16:10:38 +01:00
Thomas Hochstein da4985f543 [plugin_comments] Fix wordwrap at wound boundaries.
Add ChangeLog.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-21 16:08:55 +01:00
Thomas Hochstein 2a58548bd3 Merge pull request #678 from th-h/master
Escape version string in update notifier.
2020-03-20 19:08:46 +01:00
Thomas Hochstein 98944d8b14 Escape version string in update notifier.
Fixes 674.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-20 19:07:19 +01:00
Thomas Hochstein bf59bca988 Merge pull request #677 from th-h/master
Prevent renaming ML object into existing file.
2020-03-20 17:55:09 +01:00
Thomas Hochstein 1ed4b9e7ec Prevent renaming ML object into existing file.
When renaming objects in the Media Library,
s9y didn't check if a file with the same
name already exists, resulting in a file
name collision deleting both files from
the database _and_ from disk.

Add a check to avoid that.

An error message would be nice, too, but
that may be added later on.

Tested on s9y-stable test instance.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-20 17:54:29 +01:00
surrim ed778d7199 changed parameters order for implode() 2020-03-17 15:48:36 +01:00
Garvin Hicking b2cebf04ac Merge pull request #675 from surrim/fix_kill_path
fix serendipity_killPath()
2020-03-17 11:56:58 +01:00
surrim bd70590359 init 2020-03-16 23:51:17 +01:00
Stephan Brunker 9dd182b24c fix Issue #661 in plugin_recententries 2019-12-30 22:03:06 +01:00
onli f0e4b54243 Fix trackback deletion from frontend, invalid referrer error
Was missing the token. For context see https://board.s9y.org/viewtopic.php?f=10&t=24633
2019-12-16 14:49:00 +01:00
Lothar Serra Mari 137330fd5b Don't allow requesting an archive page that doesn't exist 2019-12-15 13:17:29 +01:00
Stephan Brunker 756f520d71 functions_routing.php: set action to empty when serving JS
genpage is called but no action given - the default page was generated at every call.
2019-12-15 13:16:28 +01:00
Garvin Hicking 60d2937c17 [DOCS] Document changes 2019-12-03 15:51:42 +01:00
Garvin Hicking 4d770c9cc6 [TASK] Adds ability to make plugins change the multi-media insertion gallery HTML 2019-12-03 15:50:51 +01:00
Garvin Hicking c26ece4240 [DOCS] Documents changes 2019-12-03 14:26:03 +01:00
Garvin Hicking 375d96fb36 [TASK] Updates serendipity_event_mailer: Prepend body option, force sending mails, fixed striptag label 2019-12-03 14:25:03 +01:00
Stephan Brunker a946c80ac1 nl2br: a-elements can now contain everything, content of html comments is ignored 2019-11-25 20:14:55 +01:00
onli 9c03f27e6f Make use of the video tag for videos in the ML 2019-11-03 21:30:51 +01:00
Stephan Brunker 2b82d111f0 Merge remote-tracking branch 'upstream/master' 2019-11-02 22:24:01 +01:00
Stephan Brunker 4d06475491 completed NEWS for PR #658 2019-11-02 22:22:09 +01:00
onli 8d0cd12b39 Fix links in ML not going to item when not an image 2019-11-02 21:32:24 +01:00
Thomas Hochstein 7a59338971 Add plugin fixes to main news file.
Those plugins will only be released with
s9y proper - so we could and should announce
changes with the release.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-11-02 15:08:25 +01:00
Thomas Hochstein 01c87b771a Document change of language names and multilang fixes.
Documents 5c4c11f0b4, d75e311077 and aa1f3b533d.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-11-02 15:06:31 +01:00
Thomas Hochstein 42a6649474 [nl2br] Document addition of figure/figcaption.
Document 8c399f2147 and 92653a1dec.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-11-02 15:03:11 +01:00
Thomas Hochstein c9e03912ed [spamblock] Document timeout protection.
Document f9d43d20a3 and 0193f8a314.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-11-02 15:03:11 +01:00
Thomas Hochstein 694a677553 Fix NEWS file.
Please do not add chunks of documentation on top
of file, but at the right place. Thx.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-11-02 15:03:11 +01:00
Stephan Brunker 92653a1dec nl2br increase version number 2019-11-02 14:20:18 +01:00
Stephan Brunker 8c399f2147 included figure and figcaption tags in nl2br 2019-11-02 14:20:18 +01:00
Stephan Brunker aa1f3b533d Fix category page title - strip_langs - 2019-11-02 14:20:18 +01:00
Stephan Brunker d75e311077 added event_hook multilingual_strip_langs to permalinks 2019-11-02 14:20:18 +01:00
Stephan Brunker 0193f8a314 reinserted validation of config logfile string. Was deleted unintentionally. 2019-11-02 14:20:18 +01:00
Stephan Brunker 5c4c11f0b4 fixing multilingual issues: display languages in native names and fix initialition point of plugins 2019-11-02 14:20:18 +01:00
Stephan Brunker f9d43d20a3 added timeout protection against spambots into event_spamblock 2019-11-02 14:20:18 +01:00
onli 1dcde41b53 Fix: Remember where you stored images last (fixes #652) 2019-11-01 20:18:00 +01:00
Garvin Hicking b4f0b35a5d Merge pull request #650 from stephanbrunker/master
Fix a lot of single issues and overhaul the language settings
2019-10-17 13:46:06 +02:00
Garvin Hicking 6a268e2b5f [TASK] Uses single-asset insertion when only one asset has been selected to be inserted
refs #651
2019-10-17 13:14:00 +02:00
Thomas Hochstein 27703c5482 Add changes to NEWS, bump plugin version number.
* Document #646 and #649.
* Bump event_bbcode version number.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-10-16 12:25:48 +02:00
Thomas Hochstein cbbebf01c6 Release 2.3.2
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-10-16 09:52:20 +02:00
Thomas Hochstein 348f5fbc12 Add "lower/upper roman" ordered list styles.
Fixes #647.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-10-15 22:48:28 +02:00
Stephan Brunker ea371f6a4e fixed requested changes, array processing of multilingual_stip_langs 2019-10-15 22:45:02 +02:00
Garvin Hicking 5b35569e73 [BUGFIX] Fixes missing referenced variable when $_GET['serendipity'] is not an array
refs #642
refs #653
2019-10-15 14:03:34 +02:00
Garvin Hicking f7c20f0e82 Merge pull request #646 from th-h/thh-positive-limits
Force positive values for fetchLimits.
2019-10-14 13:09:45 +02:00
Stephan Brunker 502b837dd6 Fix a lot of single issues and overhaul the language settings
see docs/NEWS and the plugin/changelog files for details
2019-10-13 22:49:03 +02:00
Thomas Hochstein b10bbcc2e1 Merge pull request #648 from hannob/fix_undefined_index
Avoid undefined index notices
2019-10-13 18:27:45 +02:00
Hanno 5765d1a779 Avoid undefined index notices, see https://github.com/s9y/Serendipity/issues/642 2019-10-13 18:21:18 +02:00
Thomas Hochstein f4d07960bb Assume uninitialized constant PLUGIN_LINK_SPARTACUS.
Fixes #638.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-10-13 17:35:58 +02:00
Thomas Hochstein 9b6a8f6c87 Force positive values for fetchLimits.
The number of entries shown onm the title
page and in the feed has to be at least "1",
as s9y can't cope with "0" or negative
values (and it shouldn't).

May be related to #636.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-10-13 17:24:17 +02:00
Thomas Hochstein 722a4ef4c4 Fix a typo in a comment.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-10-13 17:20:45 +02:00
Thomas Hochstein 00832cbca8 Add news item for "Fix mangling of mails".
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-10-13 13:39:36 +02:00
Thomas Hochstein 9867d70fac Fix mangling of auto-generated mails.
s9y will encode the body of its auto-generated
mails as quoted-printable when imap_8bit() is
available. imap_8bit() will use "\r\n" as
linebreaks as mandated for SMTP transfer.
The result will be transmitted via PHP's
mail() function, using direct SMTP on
Windows and piping it to a MTA on Unix.

Most MTAs will cope just fine with those
linebreaks, while qmail will not; it will
replace all "\n" linebreaks with "\r\n",
so we get "\r\r\n" in our case. We can't
"fix" qmail (as its maintainer, if there
even is one, does not consider this
behaviour wrong), but we can replace the
line endings we get from imap_8bit().

The fix does work with qmail and Exim and
should work with sendmail and Postfix and
other MTAs, too. It may break sending
mail on Windows (i.e. lose all linebreaks),
but I think that's acceptable, as we'll
have more qmail installation than Windows
servers out there.

A workaround could be to set
serendipity['forceBase64']=true in
serendipity_config_local.inc.php, but I'd
prefer this fix.

Fixes #644.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-10-13 13:15:27 +02:00
onli f3341f19b4 document rotating images and figcaption fix 2019-10-10 23:44:13 +02:00
onli 27fd525706 fix: rotate image did not rotate all thumbnails 2019-10-10 23:41:52 +02:00
onli b614ed5d07 Fix: Stop ckeditor from removing figures and figcaptions 2019-10-09 18:10:21 +02:00
Garvin Hicking e8b8be0342 [TASK] Prevents PHP warnings with type differences on $_REQUEST['serendipity']
refs #642
2019-10-07 17:03:33 +02:00
onli 5241f2d6ab Document #639 2019-09-28 23:07:13 +02:00
Hanno fa8e77c130 Escape category images to avoid backend XSS 2019-09-28 23:09:30 +02:00
Matthias Mees 464c1319ad Fix sidebar not displayed in BS4 theme 2019-09-20 21:53:58 +02:00
Matthias Mees 23eb937793 Fix typo 2019-09-20 19:31:58 +02:00
Garvin Hicking 7ab1cf9091 [BUGFIX] [SECURITY] Fixes only logging to .log and.txt filetype extensions 2019-09-17 10:50:28 +02:00
Garvin Hicking 5ccaa9a855 [CLEANUP] Changes release dates like before 2019-09-17 10:50:00 +02:00
Garvin Hicking febbb55371 [CLEANUP] Code formatting 2019-09-17 10:49:37 +02:00
Garvin Hicking a8344876e6 [BUGFIX] Fixes {$save_error} not showing when saving plugin API configuration 2019-09-17 10:49:22 +02:00
Garvin Hicking 6737384bbf Adds 'vagrant' to gitignore for local development 2019-09-09 11:19:31 +02:00
onli f86fd35c13 document #632 2019-09-06 10:48:22 +02:00
Eike Rathke 07a241798d With MySQL use cast(okey as unsigned) instead of cast(okey as integer)
The autologin ("Save information") functionality in 2.3.1 is broken since

    commit 52a41b37d5
    CommitDate: Fri Mar 23 18:01:32 2018 +0100

	Rework autologin to use a token approach

Although a cookie serendipity[author_autologintoken] with correct
expiration (one month) which random data content is present as value
in the serendipity_options table with name autologin_Username and
correct timestamp as okey and that is found with manually executing
the SQL statement

  SELECT name, value, okey FROM serendipity_options WHERE name = 'autologin_Username' AND okey > 1565801743 LIMIT 1

like done in include/functions_config.inc.php
serendipity_checkAutologin(), the login is forgotten after 30 minutes
or so. That was not the case with 2.1.5 where the login was valid for
weeks.

Of

    if (stristr($serendipity['dbType'], 'sqlite')) {
        $cast = "okey";
    } else {
        // Adds explicits casting for mysql, postgresql and others.
        $cast = "cast(okey as integer)";
    }

from which $cast then is used in the SQL statement instead of a plain
okey; when doing that manually with

  SELECT name, value, okey FROM serendipity_options WHERE name = 'autologin_Username' AND cast(okey as integer) > 1565801743 LIMIT 1

it produces the MySQL error

  #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'integer) > 1565801743 LIMIT 1' at line 1

This also with $serendipity['dbType'] = 'mysqli' for the above code.

Indeed, cast(okey as integer) is invalid in MySQL and should be
cast(okey as unsigned) instead which then also works manually, see
https://stackoverflow.com/a/12127022 and
https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_cast

Same in serendipity_issueAutologin().

Changing those two places accordingly resolves the autologin not
persistent problem.

Additionally, inspecting the serendipity_options table revealed loads
of old serendipity[author_authorinformation] cookie information that
was never deleted in serendipity_issueAutologin() with the

  OR (okey LIKE 'l_%' AND $cast < " . (time() - 1814400) . ")")

expression producing a MySQL error. This has to be done manually
once as also 2.3.1 will not delete it anymore.
2019-09-06 10:48:36 +02:00
Thomas Hochstein ecd3c9fa0b Revert "Fix pagination for "stable archives" in themes."
This reverts commit d9b3333556.

With this - now reverted - commit, the prev/next
arrows in pagination were swapped because they
were the wrong way around. Unfortunately, later on,
in ebb852d400, the
root cause was fixes by "unswapping" the prev/next
links in core, so now the pagination arrows were
... eh ... wrongly swapped. So this commit has to
be reverted.

Should fix #625 for good this time.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-24 08:39:13 +02:00
Thomas Hochstein dd46e39884 Release 2.3.1
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-21 07:38:04 +02:00
Thomas Hochstein 573fefc8e2 Fix recode.sh - only copy language files.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-18 12:19:38 +02:00
Thomas Hochstein b944d76ee7 Add new language constant to all language files.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-18 12:15:22 +02:00
Thomas Hochstein 9ae7ec779d Add plugin update notifier to NEWS.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-18 10:48:59 +02:00
Thomas Hochstein 2d7c9a0db2 [checklang] Don't normalize languages to lc.
"serendipity_lang_pt_PT.inc.php" is mixed
case and won't be found if languages are
normalized to lowercase.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-18 01:48:48 +02:00
Thomas Hochstein 75a6309fe3 lang DE: Remove duplicates, add missing.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-18 01:30:13 +02:00
Thomas Hochstein c32b692b1b lang EN: Remove duplicates, add missing.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-18 01:23:55 +02:00
Thomas Hochstein f85608e3ce [plugin_categories] Add description constant.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-18 01:14:20 +02:00
Thomas Hochstein 77905d991d Fix typo.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-18 01:08:32 +02:00
Thomas Hochstein f8f40d27a4 Add language file checker.
This checker will find duplicate, missing and
superfluous constants in Serendipity's language
files.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-18 01:04:05 +02:00
Thomas Hochstein 0805014761 [event_spartacus] Fix upgrade counter.
The plugin name was derived from its
install path - but bundled sidebar and
event plugins may share a path. So use
the name instead (and strip the instance
hash from it).

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 18:14:26 +02:00
Thomas Hochstein 3730e77ddf Bump version, add Changelog entry.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 13:56:43 +02:00
Thomas Hochstein 3d0410bacd plugin_lang.php: Check additional_plugins, too.
If you have the additional_plugins repo handy,
you can just change the base path to check all
that plugins, too.

We shouldn't forget to check the UTF-8
directories.

And we just have to catch all, even fatal,
errors, due to missing function dependencies.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 13:33:14 +02:00
Thomas Hochstein 4327c432a5 event_entryproperties: Add missing language constant.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 12:59:54 +02:00
Thomas Hochstein d2ad092763 plugin_lang.php: Make output more readable.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 12:59:54 +02:00
Thomas Hochstein 9c66269fce addlang.sh: Move input to backup after run.
And check for input file before starting.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 12:59:54 +02:00
Thomas Hochstein 770e0eb2fd Move new constant to end of language files.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 12:59:54 +02:00
Thomas Hochstein b2aef47e05 [event_spamblock] Add ChangeLog.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 12:59:54 +02:00
Thomas Hochstein 8941fe6563 [event_spamblock] Don't overwrite "moderate" flag.
Unconditionally setting $serendipity['csuccess']
to 'true' will override a "moderate" flag set by
another (spamblock) plugin.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 04:07:30 +02:00
Thomas Hochstein cee38e55ab Merge pull request #629 from th-h/thh-ml-multi
Fix media library (mass) delete, enhance i18n.
2019-08-17 01:46:30 +02:00
Thomas Hochstein 0b58fe42f2 Add ML changes to NEWS.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 01:43:00 +02:00
Thomas Hochstein f8110dbe86 I18n for multimove.
* Add MEDIA_DIRECTORY_MOVE.
* Change German translation of "Move" to
  "Verschieben".
2019-08-17 01:38:08 +02:00
Thomas Hochstein 12bb9c0cc0 Fix media library (mass) delete.
Fixes #619.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 01:36:51 +02:00
Thomas Hochstein 6253c03ad9 Merge pull request #628 from th-h/thh-pagination
Fix prev/next page links for stable archives.
2019-08-17 00:55:32 +02:00
Thomas Hochstein ebb852d400 Fix prev/next page links for stable archives.
We shouldn't swap prev/next links for archive
pages. With stable archives, the title page is
the last page of the archive, not the first, so
all other pages are "previos", and we should
display it like that.

That may seem counterintuitive at first, but
otherwise archive page directions and pagination
directions don't match (see bulletproof), and we
shouldn't count archive pages differently from
the URL. With the current code, page 100 of 100
archive pages would be shown in footer_info as
page 1, page 99 as page 2, and that doesn't make
sense either.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 00:52:19 +02:00
Thomas Hochstein 42d57bb1c2 Add pagination fixes to NEWS.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 00:11:16 +02:00
Thomas Hochstein 2f9b8e23b8 Merge pull request #627 from th-h/thh-pagination
Fix pagination for "stable archives" in themes.
2019-08-17 00:03:42 +02:00
Thomas Hochstein d9b3333556 Fix pagination for "stable archives" in themes.
Timeline and Bulletproof have pagination.
Both need to swap the prev/next links for
stable archives, as the sorting order has
been reversed.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 00:01:57 +02:00
Thomas Hochstein 78fc6e2bc3 Merge pull request #626 from th-h/thh-pagination
Fix core pagination for "stable archives".
2019-08-16 21:41:25 +02:00
Thomas Hochstein f4d47812a5 Fix core pagination for "stable archives".
The current page will always be the current page,
regardless of archive sorting order. Page 76 of
86 pages will remain page 76, even if the archive
sorting is changed; it won't become page 10.

Fixes #625 in core.

Themes will have to cope with the sorting order
in their pagination code if they want to display
a descending order for stable archive sorting.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-16 21:37:45 +02:00
Thomas Hochstein 221bd4a4c7 Merge pull request #620 from th-h/thh-plugin-notifier
Add plugin update notifications.
2019-08-13 22:21:28 +02:00
Thomas Hochstein c35ed7be34 Merge pull request #623 from th-h/thh-i18n
Run addlang.sh and add new translations.
2019-08-11 15:09:42 +02:00
Thomas Hochstein 648f07f97d Remove wrongly added constants from plugin_lang.php
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-11 15:07:10 +02:00
Thomas Hochstein f10dfd2521 Run addlang.sh and add new translations.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-11 15:06:37 +02:00
Thomas Hochstein 39887190da Merge pull request #622 from th-h/thh-i18n
Add i18n and German translations.
2019-08-11 14:51:07 +02:00
Thomas Hochstein 36330c7cbe Add i18n and German translations.
* "PLUGIN_ALL_UPDATED" was hardcoded.
* Add some missing German translation
  and fix some others.
* Add new constants to addlang.txt

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-11 14:42:20 +02:00
Thomas Hochstein 69241156bf Merge pull request #621 from th-h/thh-add-spartacus-links
Add Spartacus links to plugin lists.
2019-08-11 13:45:43 +02:00
Thomas Hochstein 4e88c875d8 Add Spartacus links to plugin lists.
Quite some information is missing from
the list of installed plugins; and the
list of installable plugins has some
more information, but not everything
that is present on Spartacus, i.e.
the last modification date.

So let's add a link to the plugin entry
on Spartacus (in the chosen language
version).

Fixes #471.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-11 13:44:46 +02:00
Thomas Hochstein 0bd0260fa7 Add changes to NEWS.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-11 13:42:47 +02:00
Thomas Hochstein 53f63342c6 Fix typo / unify PHP and smarty variable names.
"requirement_failures" from PHP is saved in
"requirements_failues" - "requirements" as
in plural, and with a typo. That doesn't make
sense. Let's use "requirement_failures"
everywhere.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-11 02:18:09 +02:00
Thomas Hochstein 35cd41d4ef Wording change for plugin version display.
"Version" should be at the start of a
sentence or line.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-11 01:50:28 +02:00
Thomas Hochstein 8ff2ac0ae7 Wording changes for plugin version display.
"Version" should be capitalized in German -
and anywhere at the start of a sentence or
line.

Furthermore, "UPGRADE_TO_VERSION" is not
the current version ("aktuelle version"),
but the version one could upgrade to.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-11 01:00:50 +02:00
Thomas Hochstein f3482e1bf3 ML delete file: add "?" to conformation question.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-11 00:43:18 +02:00
Thomas Hochstein f2e6fb772f Merge pull request #619 from th-h/thh-spartacus-fix-cache
[event_spartacus] Don't cache wrong plugin list.
2019-08-10 23:40:40 +02:00
Thomas Hochstein 9999a5b0e1 Add plugin update notification to dashboard.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-10 23:40:15 +02:00
Thomas Hochstein 6cee25afdc [event_spartacus] Bump version + changelog entry.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-10 23:39:45 +02:00
Thomas Hochstein 074a63b696 [event_spartacus] Add code dashboard notifications.
New 'backend_plugins_upgradecount' hook.
Add language constants.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-10 23:35:16 +02:00
Thomas Hochstein 7f14a9c78e [event_spartacus] Show number of possible upgrades.
This could use a bit of eye candy.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-10 23:33:52 +02:00
Thomas Hochstein 132f161d48 [event_spartacus] Add a plugin upgrade notifier.
New function count_plugin_upgrades() to count
upgradeable plugins, sidebar as well as event.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-10 23:32:32 +02:00
Thomas Hochstein ae3f768bb7 [event_spartacus] Don't cache wrong plugin list.
Declaring $pluginlist as static will cache the
database query results and always return the same
list of plugins - no matter which type is queried
(sidebar or event).

This cache must be busted if another type of
plugins is queried.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-10 22:18:50 +02:00
Thomas Hochstein 5abbf1c32a After release preparations.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-10 12:20:41 +02:00
Thomas Hochstein 4169484361 Release 2.3.0
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-10 12:11:27 +02:00
Thomas Hochstein aed19e6be3 Release preparations.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-10 12:08:32 +02:00
Thomas Hochstein 0d7094582f Patch HTTP_Request2 to fix PHP 7.4 issue.
Applying the patch from
https://pear.php.net/bugs/bug.php?id=23839&edit=12&patch=remove-obsolete-magic-quotes-function&revision=1564911457

Fixes #615

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-10 11:42:57 +02:00
Thomas Hochstein 32f1a958bf Add data from 2.1.6 release.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-09 22:20:07 +02:00
onli 60e975ee27 Fix: Don't show "Array" string under update notification 2019-08-03 21:11:53 +02:00
Thomas Hochstein e27e3e98c7 After release preparations.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-03 20:16:24 +02:00
Thomas Hochstein 2b3663b7f2 Release preparations.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-03 19:56:12 +02:00
Thomas Hochstein f418bcbd75 Prepare release: 2.3-rc1.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-03 19:41:11 +02:00
Thomas Hochstein b90448a71d Update news.
623b2f8879 and ba6ccb3dbb added.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-03 19:38:38 +02:00
onli 6cab32aa5a document spamblock change #614, bump version 2019-07-29 17:29:16 +02:00
Hanno a9153e1a2b Remove curly braces array syntax, avoids warning in PHP 7.4. 2019-07-29 17:29:45 +02:00
onli ba6ccb3dbb Make $entry available for templates (fix #610) 2019-07-03 17:51:36 +02:00
Matthias Mees 623b2f8879 Fix preview iframe in bulletproof, thx pixel32 2019-06-30 19:30:55 +02:00
Thomas Hochstein 5e36b3d56f Update NEWS and RELEASE (2.1.5).
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-05-01 19:49:37 +02:00
onli 983ed4e2cb prevent error in upgrader when $sqlfiles is NULL 2019-04-28 23:27:58 +02:00
Thomas Hochstein e19222597b After release preparations.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 19:44:42 +02:00
Thomas Hochstein ff2e85e14d Release preparations.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 19:13:57 +02:00
onli 5345c065f6 Update NEWS 2019-04-27 18:55:07 +02:00
onli 07bfc8e98f Update RELEASE 2019-04-27 18:38:17 +02:00
Matthias Mees 1deffbca75 Create CONTRIBUTING.md 2019-04-27 18:36:23 +02:00
Matthias Mees 0f36e361a0 Sync LICENSE versions 2019-04-27 18:33:48 +02:00
Matthias Mees 085ce82751 Merge pull request #604 from s9y/add-license-1
Create license file for GitHub
2019-04-27 18:31:44 +02:00
Matthias Mees 74bc407b7a Create license file for GitHub 2019-04-27 18:31:25 +02:00
Matthias Mees 3f25d99a3e Merge pull request #603 from s9y/add-code-of-conduct-1
Add code of conduct to core repository
2019-04-27 18:28:29 +02:00
Matthias Mees ae28f55062 Add code of conduct to core repository 2019-04-27 18:28:04 +02:00
onli 9715f28615 document stable archive default 2019-04-27 18:14:58 +02:00
onli 46c408c19b Make stablearchive default 2019-04-27 18:13:16 +02:00
Mario Hommel 76fdc3af55 Update NEWS 2019-04-27 17:14:26 +02:00
Mario Hommel c3fce509c0 Fix smarty reference in timeline theme. 2019-04-27 17:08:39 +02:00
Thomas Hochstein ac2575bd5b Add maintenance mode localization to NEWS.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 15:42:44 +02:00
Mario Hommel e9f0fb2315 Merge branch 'master' of github.com:s9y/Serendipity 2019-04-27 15:35:30 +02:00
Mario Hommel 9b688f00f9 Fix PHP 7.2 compatibility for Theme Clean-Blog 2019-04-27 15:34:26 +02:00
Thomas Hochstein 2c0c337a6d Translate maintenance mode to German.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 15:30:10 +02:00
Thomas Hochstein 14893629ba Fix maintenance mode form.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 13:44:06 +02:00
onli e82571beed Fix: invalid sizeof in XML/RPC
Third parameter is supposed to be a bool anyway
2019-04-27 13:39:57 +02:00
Matthias Mees bcbc3e41ef Document changes 2019-04-27 13:37:56 +02:00
Thomas Hochstein 5aca7bd1b4 Add missing tags.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 13:29:37 +02:00
Thomas Hochstein 18d3cfeeac Fix missing double quote.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 13:28:12 +02:00
Thomas Hochstein 96f82d9f3a Fix missing double quote and wrong bracket.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 13:26:03 +02:00
Matthias Mees 34bf25066c Merge branch 'mediadb-figure' 2019-04-27 13:12:10 +02:00
Matthias Mees c610f92b7f Use figure/figcaption for images w/ captions 2019-04-27 13:11:14 +02:00
Thomas Hochstein 8469506b0f Run addlang.sh and add new constants to language files.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 13:10:26 +02:00
Thomas Hochstein ceaee85d3b Localize maintenance mode.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 13:10:23 +02:00
onli eda8f71065 Fix XSS from image comment exif field (#598) 2019-04-27 12:57:27 +02:00
Matthias Mees 57bb0b1e9a Merge branch 'fix-dirmanage' 2019-04-27 12:32:36 +02:00
Matthias Mees 7df9051019 Fix: mispositioned button in media db directory management 2019-04-27 12:32:21 +02:00
Thomas Hochstein b9223e0555 Fix missing single quote in language files.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 12:19:21 +02:00
Thomas Hochstein 2cc1f2d3f7 Fix missing newline, enhance translation (German).
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 11:53:23 +02:00
Thomas Hochstein 59bfb5095b Run addlang.sh and add new constants to language files.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-04-27 11:33:24 +02:00
Jari Turkia 6191c740fe Suggested changes made to place the <code> tag button in editor. Removed <tt> completely. 2019-03-20 17:37:29 +01:00
Jari Turkia 9a8fb7a696 Added codeTag plugin into CKeditor 2019-03-20 17:37:29 +01:00
onli 99b8190180 fix: Escape EXIF tags in ML properties view (#598) 2019-03-18 22:40:58 +01:00
onli b6cbaee339 Disable bodyclone spamblock option by default, disable for comments
See https://www.cgarbs.de/blog/archives/1181-Trackbacks-in-Serendipity.html
2019-03-18 21:48:26 +01:00
onli 92a1106405 Set distinct cache directory for voku/simple-cache (#597) 2019-03-18 21:37:56 +01:00
DonChambers 0faf2b9899 Timeline Theme - more icons & font awesome upgrade
Added more social icons to the index footer, upgraded to Font Awesome 5.7.2.
2019-03-18 09:01:21 -05:00
DonChambers eafb79546d Timeline Theme - added images to static pages
Static pages now use the same method of image assignment as entries.
2019-03-16 13:48:54 -05:00
onli 6c699f2ce5 document #600 2019-03-10 11:33:43 +01:00
Jari Turkia 260efcc5a6 Make sure there is a $serendipity['lang'] defined by serendipity_getSessionLanguage() 2019-03-10 11:31:25 +01:00
onli d77a9ae509 document nl2br improvement 2019-03-08 23:48:42 +01:00
onli 43f5181b6a bump nl2br version to 2.21.2 2019-03-08 23:45:28 +01:00
Stephan Brunker 0d60caab07 fixed missing 'strike' tag and fixed tag recognition 2019-03-08 23:44:27 +01:00
onli acc87400eb fix nl2br: $textarray could be null on category pages 2019-03-07 21:06:18 +01:00
onli c87938cd42 Fix: smarty could be null in responsive images, causing 500 error 2019-03-07 18:47:39 +01:00
onli f5d5b73c26 Bump required PHP version to 7.0 (#596) 2019-03-06 00:48:50 +01:00
Stephan Brunker 2fb8017a72 Bump version number for event_spamblock to 1.87 2019-03-05 18:38:22 +01:00
Stephan Brunker db0f47a10a upgrader move force: array check for serendipity_db_query 2019-03-05 18:38:22 +01:00
Stephan Brunker 722c1cf7f8 plugin spamblock: if forcemoderation is set, activate the new option moderation_auto 2019-03-05 18:38:22 +01:00
Stephan Brunker c1908949fc event_spamblock: Added option for auto-moderate comments depending on age 2019-03-05 18:38:22 +01:00
Stephan Brunker 164fbfd2d5 Fixed: forced comment moderation 0 -> moderate all 2019-03-05 18:38:22 +01:00
onli e6c97f4148 document php 7.0 requirement, add some author mentions 2019-03-04 11:40:46 +01:00
onli cd0adf5550 Set templates_c as opcache destination for voku/simple-cache 2019-03-04 11:07:32 +01:00
Lars Moelleken d75ace7440 [+]: update composer.json (require min. php 7.0) + update "voku/simple-cache" 2019-03-04 10:30:07 +01:00
onli a93b232c68 Document nl2br change and bumb version 2019-02-22 16:21:31 +01:00
Stephan Brunker 04cc9d0699 event_nl2br: fixed isolation issue for pre-tags. Updated description. 2019-02-22 16:19:25 +01:00
onli f948279583 Fix autologin token, form tokens failed cause session was not set 2019-02-20 23:06:13 +01:00
onli c737565c13 Improve autologin token security by setting httpOnly and secure flag 2019-02-20 22:24:05 +01:00
onli f295a3b123 Fix self-XSS on file upload
The filename was used without escaping in the scucess message shown after upload
2019-02-20 21:38:13 +01:00
onli 153b5a37f1 Fix: Do not throw error when entry got deleted, go to 404 page 2019-02-16 14:46:46 +01:00
onli ba9c401697 Remove check of undefined constant (#556) 2019-02-16 13:36:15 +01:00
onli 4c4545428d Fix internal cache, init proper functions API 2019-02-16 13:07:53 +01:00
onli fd00877141 Add missing composer autoload dependencies 2019-02-15 16:48:20 +01:00
onli f1c796b129 Add ML id to non-images added to entries
This enables automatic updating of the link when moving or renaming the file in the ML
2019-02-14 22:44:54 +01:00
onli b9617be068 Make XML_RPC further PHP 7.2 compatible (#556) 2019-02-13 19:40:18 +01:00
onli e0f230dd15 Remove serendipity_purgeEntry
Removed pregenerated entries, but that functionality is long gone
2019-02-12 23:18:52 +01:00
onli 567e170338 document cache change, smarty update 2019-02-12 18:55:14 +01:00
onli d52f0004a4 Add voku/simplecache as alternative to Cache/Lite and use it cache
Cache/Lite is abandoned
2019-02-12 18:52:08 +01:00
onli fc02b0306b Update Smarty to 3.1.33 2019-02-12 17:50:49 +01:00
onli 839d45675c XMLRPC: Replace deprecated constructor (#532) 2019-02-11 18:43:02 +01:00
onli 88073e9816 Activate internal cache by default 2019-02-11 18:26:37 +01:00
onli 15adc798e5 Don't activate entryproperties cache by default 2019-02-11 18:23:06 +01:00
onli 98261856db Preserve manual set image link when moving/renaming image (#509) 2019-02-10 13:44:14 +01:00
onli 668dc88b96 document responsiveimages changes 2019-02-09 15:19:49 +01:00
onli f049892e39 Make serendipity_event_responsiveimages a default plugin
That means it will be activated during the s9y installation
2019-02-09 15:17:25 +01:00
onli 1b518e5b46 Rewrite srcset in feeds to absolute urls (#585) 2019-02-09 15:10:36 +01:00
Hanno 4445926033 Avoid warning about non-countable var, fix #587. 2019-01-11 16:28:08 +01:00
onli e3aaefd2e9 ML: Add mediaproperties on rename (#509) 2018-11-18 22:57:51 +01:00
onli 732f1ae851 ML: Update links, not just thumbnail, when renaming images (#509) 2018-11-18 21:47:45 +01:00
Garvin Hicking 0dc6f620c1 [BUGFIX] Fixes media library regression, references #509
Adds missing ACL renames
Missing trailing / when managing dirs
Fix typo that did not evaluate read/write properly
Add missing NEWS entries
2018-11-05 15:59:49 +01:00
Matej Gleza b8745330e4 Fixed slovak language 2018-10-31 20:40:29 +01:00
Garvin Hicking 0b259ce52f [BUGFIX] Fixes broken installer due to missing serendipity_db_probe() call. 2018-10-31 09:39:31 +01:00
onli fdb4428191 Restore backend_media_rename (#509) 2018-10-30 19:51:37 +01:00
onli 33d090e8b6 fix: don't use undefined CHARSET_NATIVE (#583) 2018-10-07 20:37:52 +02:00
onli 52838c0f7b fix: plugin page died because of non-countable object 2018-10-07 19:08:15 +02:00
onli 10585fff80 Fix: Unknown constant error RSS 2018-10-07 19:04:22 +02:00
Thomas Hochstein f5207ea5f4 Merge pull request #582 from th-h/thh-remove-akismet-code
[spamblock] Remove dead code (Akismet spam toggle).
2018-09-30 13:49:48 +02:00
Thomas Hochstein 66e6293a92 [spamblock] Remove dead code (Akismet spam toggle)
This code was used to tell Akismet that a comment
is spam or ham. It can't be triggered as there
are no UI buttons, and it shouldn't be used as
it uses GET params. I don't think it will be
missed.

The relevant issue has been open for about two
and a half years without a new implementation,
so let's drop it. We can always re-implement it
later ...

Closes #405.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2018-09-30 11:37:12 +02:00
Thomas Hochstein 159f7d98b7 Check NEWS, remove duplicate items.
Remove two items from 2.2.1-alpha1, as they've
already been part of 2.1.2.

(And remove a typo.)

Signed-off-by: Thomas Hochstein <thh@inter.net>
2018-09-24 08:38:01 +02:00
Garvin Hicking fa58d770be Merge pull request #578 from th-h/thh-forcemod-message
Change message for auto-moderation after X days.
2018-09-22 14:36:17 +02:00
Thomas Hochstein 4568bd892e Change message for auto-moderation after X days.
As "X" is looking like a placeholder that has
not been replaced, rephrase to "Auto-moderation
for old entries".

See https://board.s9y.org/viewtopic.php?f=2&t=24034#p10451071

Done for EN and DE, other languages will have
to be changed, too.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2018-09-22 13:35:04 +02:00
Garvin Hicking 23b6701174 Next release 2018-09-20 13:11:55 +02:00
Garvin Hicking 7aec3f702d Prepare release 2018-09-20 09:44:10 +02:00
onli c7bd6fafc7 update NEWS 2018-09-19 21:11:44 +02:00
Thomas Hochstein 275963c6fb Merge pull request #575 from th-h/master
[2k11] Update links in admin overview.
2018-09-16 00:02:39 +02:00
Thomas Hochstein e4567b255b [2k11] Update links in admin overview.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2018-09-15 23:58:38 +02:00
onli 166b2d4658 security: Prevent XSS via multicategory pagination 2018-09-13 16:27:28 +02:00
onli a462413025 php 7.2: Replace each with foreach (#556) 2018-09-13 15:07:57 +02:00
onli 58ed05f187 fix: missing variable orderkey was supposed to be a string 2018-09-13 14:49:15 +02:00
onli 2960938f96 PHP 7: Remove $HTTP_RAW_POST_DATA (#574) 2018-09-13 14:44:45 +02:00
onli 5544b34253 fix: Remove use of undefined constant CATEGORY_PLUGIN_SHOWALL_DESC 2018-09-13 14:43:40 +02:00
onli 835b076c99 php 7.2: Remove invalid constant check (#563) 2018-09-13 14:27:51 +02:00
onli b664435ef6 PHP 7.2 compat: session_cache, each (#564, #556) 2018-09-13 14:22:01 +02:00
Don Chambers 368dca4379 Timeline & Clean Blog: removed reference from function
https://board.s9y.org/viewtopic.php?f=3&t=24074
2018-09-06 10:24:03 -05:00
Thomas Hochstein ef557fbb6a Merge pull request #573 from th-h/thh-pluginsync
Sync plugins in core and Spartacus.
2018-09-02 18:13:33 +02:00
Thomas Hochstein 17fc123a54 Sync quicksearch in core and Spartacus.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2018-09-02 18:10:04 +02:00
Thomas Hochstein 0b967cc765 Sync authors in core and Spartacus.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2018-09-02 18:07:26 +02:00
Thomas Hochstein 65c9aa63eb Sync gravatar in core and Spartacus.
Bump version to 1.63.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2018-09-02 17:59:58 +02:00
onli 3ef108634c bootstrap: fix preview by adding missing closing if 2018-08-20 19:29:08 +02:00
onli 0a35bd4c59 Update Smarty to 3.1.32 2018-08-17 09:35:36 +02:00
Garvin Hicking 2b33e231e4 prepare release 2018-08-16 14:08:21 +02:00
Stephan Brunker 0e479083f3 fixed tiny typo for NO_ENTRIES_BLAHBLAH 2018-08-15 20:25:03 +02:00
onli 2a853f44ee spamblock: bump version 2018-08-09 19:38:47 +02:00
Aaron W. Swenson 2ecd2bdd13 Return output
When $use_gd is false, returning $output so that the captcha images that have been generated are actually embedded into the final rendering of the page.

Fixes #536.
2018-08-09 19:37:54 +02:00
Thomas Hochstein 9b8a547ca8 Merge pull request #568 from th-h/master
[event_gravatar] Fix paste error in legal info.
2018-08-04 03:09:41 +02:00
Thomas Hochstein 2f327ce463 [event_gravatar] Fix paste error in legal info.
Picked from additional plugins.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2018-08-04 03:02:52 +02:00
Hanno 2669745975 replace deprecated each() with foreach() 2018-07-31 20:58:48 +02:00
onli 47b8a13911 Make the $view variable more reliable
t could happen that $view was not set, which lead to noindex being set to all frontpage pages. See https://board.s9y.org/viewtopic.php?f=3&t=24041
2018-07-31 20:35:52 +02:00
Thomas Hochstein 5504f85373 Merge pull request #561 from th-h/thh-https
Update language constants.
2018-07-21 22:47:06 +02:00
Thomas Hochstein a42cc8da66 Fix broken link to documentation.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2018-07-21 22:45:48 +02:00
Thomas Hochstein 4387556026 Change links to HTTPS.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2018-07-21 22:45:44 +02:00
Garvin Hicking 005a86da1c Another cast for safety 2018-07-19 09:25:18 +02:00
Garvin Hicking 1afc4d929d Adjust fetchLimit to ensure integer content 2018-07-18 11:59:45 +02:00
Garvin Hicking 19513cdf14 Security fixes 2018-07-18 11:23:02 +02:00
Stephan Brunker e09b2600c6 improved nl2br to make it more intelligent
tag clean recognizes quotes in tags and escapes all non-tags
bugfixes in explode along tags
uses now simple <p>-tags normally and only in special cases margin=0
converts double newlines to paragraphs and single newlines to br-tags
but only inside text, not in tags and only where it is allowed by html standards
2018-07-03 17:04:34 +02:00
onli 280a2f1c00 ML gallery: link images (#552)
Still needs to react to hotlinked images, and if we add a configuration step here the template will be the wrong place to create the markup
2018-06-20 23:37:50 +02:00
Matthias Mees c64fd17550 Add mvp HTML/CSS for media galleries
- Use proper semantic markup for s9y_gallery
- Add a few classes just in case
- Add basic CSS for image galleries
- Backport gallery styles to default

References #552
2018-06-16 16:45:55 +02:00
onli 9d1fa83a39 Allow svgs in the media library (#529) 2018-06-14 22:14:04 +02:00
onli 23d3a73b01 init maintenance mode (#467) 2018-06-13 19:31:28 +02:00
onli 567587718b React to errors when comment could not be deleted (#527) 2018-06-12 23:49:11 +02:00
onli 4c671ead1c Make it easier to drag plugins to other column (#510) 2018-06-12 23:22:45 +02:00
onli 3ba160c52a If js is broken, fallback to open configuration options (#479) 2018-06-12 23:05:02 +02:00
onli 3ef2b78014 Make comment subscription with full text the default (#483) 2018-06-12 22:44:45 +02:00
onli c7c133ef1d Set the bcrypt hashtype as the default for user creation 2018-06-12 22:43:19 +02:00
onli 9e8eebac15 Fix user creation, also fixes installer
Because the hashtype was not set to the new default, but bcrypt already used, the user could not log in
2018-06-12 22:40:02 +02:00
onli bfce8ffb61 Improve gallery insert function (#552)
Border around selected images, button hidden till iamge is selected, init language constant
2018-06-11 23:12:12 +02:00
Garvin Hicking e23fed0a47 Merge branch 'master' of https://github.com/s9y/Serendipity 2018-04-23 11:58:54 +02:00
Garvin Hicking 775b71134c * Fixed bug in pull request #392 which overwrote user specified
input for logged in authors with an empty realname (wrong array
      key name) and deleted all existing text input
2018-04-23 11:58:32 +02:00
Matthias Mees fcb8b3e72b bootstrap4: Update to Bootstrap 4.1.0 2018-04-20 17:15:32 +02:00
Matthias Mees d0a23274b4 bootstrap4: Remove modernizr reference 2018-04-19 22:23:59 +02:00
Matthias Mees 575ec3f165 Merge branch 'master' of github.com:s9y/Serendipity 2018-04-10 08:14:36 +02:00
Matthias Mees a699623ada Skeleton: used the wrong lang constant 2018-04-10 08:14:25 +02:00
Don Chambers f5d13f3263 Timeline: add theme option to disable Google webfonts 2018-04-09 18:48:04 -05:00
Don Chambers c22653e001 Clean Blog: add theme option to disable Google webfonts 2018-04-09 18:12:47 -05:00
Matthias Mees 5ba0c006ab Oops, forgot something for Skeleton 2018-04-09 23:59:33 +02:00
Matthias Mees b6d06e16c0 Skeleton: add theme option to disable Google webfonts 2018-04-09 20:47:46 +02:00
onli 0bdae3b18c Merge branch 'master' of github.com:s9y/Serendipity 2018-04-06 17:14:13 +02:00
onli 40993037b2 init media gallery insert 2018-04-06 17:09:51 +02:00
Garvin Hicking 5f5d809b10 upport 2018-04-03 11:21:25 +02:00
Garvin Hicking c40aafcd1a Backport 2018-04-03 11:19:25 +02:00
Garvin Hicking d10aaf8ffd Add new "legal" properties for affected plugins.
Disable subtome by default.
2018-04-03 11:17:22 +02:00
Thomas Hochstein 02b70e2266 Another fix to Spartacus after dropping netmirror.
See #548.

Expands b0fb8d2d12
by adding the necessary fix at another code point.

Fixes a whitespace issue (tabs -> spaces).

Add Changelog entries.

Needs to be backported to 2.1 after tests and review.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2018-03-30 13:17:51 +02:00
mariohommel dcb693ba54 Generating token for comment moderation in a global function now. 2018-03-30 11:04:21 +02:00
onli b0fb8d2d12 Sync: Drop netmirror from spartacus 2018-03-28 21:09:53 +02:00
Garvin Hicking 270c370c2a Fixed SQL statement for creation of serendipity_groupconfig DB table (did not work in my MySQL 5.7.17) 2018-03-28 10:41:18 +02:00
Matthias Mees 1ae46203c3 Replace idea theme with bootstrap4 theme
- Add new bootstrap4 theme
- Move idea theme to spartacus
2018-03-25 10:57:21 +02:00
Thomas Hochstein 84b0cecfa3 Update RELEASE and NEWS for 2.1.2.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2018-03-25 08:45:12 +02:00
Mario Hommel 0d8cdd59fa Fix variable name in hook backend_sendcomment 2018-03-24 18:31:14 +01:00
Guillaume Zin 493ddde07a Remove old call on the onclick event of submit button 2018-03-23 20:48:32 +01:00
Guillaume Zin 7994bda7b5 Use event listener on submit for check save 2018-03-23 20:48:32 +01:00
Guillaume Zin d459d54271 Add functions for entry check 2018-03-23 18:12:21 +01:00
onli eafc4dd625 Move from SHA1 to bcrypt
SHA1 is not an ideal password hash, even when salted, because it is cheap to compute. Since version 5.5 PHP offers bcrypt built in, which is a more expensive and secure hash function specifically suited for passwords
2018-03-23 18:02:02 +01:00
onli 52a41b37d5 Rework autologin to use a token approach
The prior code stored encrypted user data in the cookie that was then checked. This new approach is cleaner, as it only stores a token, and it does not use problematic crypto functions deprecated in PHP 7.2
2018-03-23 18:01:32 +01:00
Garvin Hicking 4a43761e72 Assume uninitialized charset constant (https://board.s9y.org/viewtopic.php?f=3&t=22365) 2018-03-12 12:39:06 +01:00
Garvin Hicking b2eecb9a3d backport constant check 2018-01-10 11:21:59 +01:00
Stephan Brunker 7bc9067674 allowed nested lists, svg XML elements and fixed bugs in tag_clean 2018-01-02 14:46:45 +01:00
Stephan Brunker bac3e5fb41 added iframe to allowed singleton tags 2017-12-20 00:06:57 +01:00
onli 4d30cf3b07 resp imgs: don't insert original image if too small 2017-12-16 22:21:45 +01:00
Stephan Brunker 967935195c Fixed a small bug in isolation feature 2017-12-14 21:25:12 +01:00
Stephan Brunker 43b9f607d3 NL2P operation completely new written, works now from front to back according to tags 2017-12-14 21:25:12 +01:00
Stephan Brunker b837adde3c Changed behavior between body and extended part of article.
The body part now has never a whiteline at the bottom, the extended part has one at the top if it begins with a newline or the body ends with a newline.
2017-12-14 21:25:12 +01:00
onli 0ee37818f2 Let themes override responsive images breakpoint (#474) 2017-11-01 20:12:18 +01:00
onli d9db68ac5f minor: remove debugging output when adding image 2017-10-29 03:05:01 +01:00
Garvin Hicking cacf778480 Merge pull request #533 from erAck/master
Add xml inc svg as 'text' file extensions to serendipity_FTPChecksum()
2017-09-25 09:32:17 +02:00
Eike Rathke be3df87b97 Add xml inc svg as 'text' file extensions
To prevent situations like in
https://board.s9y.org/viewtopic.php?f=10&t=21591
where the following files were modified by FTP text transfer type but
not handled as such in serendipity_FTPChecksum()

bundled-libs/katzgrau/klogger/phpunit.xml
bundled-libs/simplepie/simplepie.inc
templates/2k11/admin/font/fontello.svg
templates/next/font/fontello.svg

All these *are* text files.

Maybe simplepie.inc should rather be renamed to simplepie.inc.php as well.
2017-09-21 18:48:10 +02:00
Eike Rathke e2a35c3694 Merge remote-tracking branch 'upstream/master' 2017-09-21 02:49:08 +02:00
onli 440b189372 Merge pull request #526 from th-h/thh-comment-messages
Fix display of messages for comment editing.
2017-08-07 23:18:04 +02:00
Thomas Hochstein 0f9bfe3fda Fix display of messages for comment editing.
All messages and errors were appended to $msg
and $errormsg, respectively, creating one long
unformatted string - mostly unreadable.

So we make $msg and $errormsg arrays instead
and iterate over those arrays in the template,
displaying each message separately.

Fixes #525.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-08-07 23:11:13 +02:00
onli d3e6a3ee3a Fix non-variable matches class (#522) 2017-07-11 14:06:32 +02:00
Garvin Hicking 30b57a1e42 wrong function call 2017-07-11 12:33:01 +02:00
Garvin Hicking 8b1ae7cee8 Once more without parse errors 2017-07-10 13:54:00 +02:00
Garvin Hicking 59f8837ab2 Add upgrader task, Issue #521 2017-07-10 13:53:33 +02:00
Garvin Hicking 07d75a6d65 Fixes Issue #521 2017-07-10 13:49:27 +02:00
onli 405fa77e3f Merge pull request #520 from th-h/thh-plugin-changelog
Display ChangeLog in plugin lists (if available).
2017-07-09 19:26:23 +02:00
Thomas Hochstein b7f479e9fc Display ChangeLog in plugin lists (if available).
Code was using wrong file path variable for checking
the presence of a ChangeLog file.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-07-09 15:07:47 +02:00
onli 93c95407aa Merge pull request #517 from igoltz/Issues_331_516
add template path as first entry to template_dirs array
2017-06-13 11:09:32 +02:00
Immo Goltz 1131a79aaf add template path as first entry to template_dirs array; fix #331 fix #516 2017-06-12 17:22:07 +02:00
onli a920a3aa67 responsive: Fix 0w images and introduce breakpoints
$breakpoints decide at which screen width an image is used, $thumbWidth how wide the thumbnail is. Stepping stone to making t configurable by themes.
2017-06-04 23:24:11 +02:00
onli bf4f484fe0 responsive: Fix srcset insertion when images are on one line (#474) 2017-06-04 20:19:37 +02:00
onli a34f6739a5 document backend_view_entry (#511) 2017-06-04 18:52:58 +02:00
Garvin Hicking efeede599b Allow multiple authorship for entries 2017-06-01 12:25:50 +02:00
Matthias Mees c1b84508ea Fix broken display of details in FF
References #515
2017-05-25 11:01:27 +02:00
onli 74f7acb69d Introduce backend_view_entry hook (#511)
Gives plugins the option to modify the central entry list in the plugin, so far to show additional information
2017-05-11 22:48:27 +02:00
onli bfeccabcdb Rework media library directory move
Initial motivation for this rework was to add support for the responsive thumbnnails (#474). But it also is a re-implementation instead of an enahncement of the existing code because the moveMediaDirectory function had grown into a mess. It was very hard to debug possible renaming bugs, like https://board.s9y.org/viewtopic.php?f=3&t=21185. This approach uses several small functions instead that can be combined and re-used.
2017-04-30 20:38:24 +02:00
onli 4046d811a7 Merge pull request #507 from th-h/thh-506
Akismet has a POST API, not a GET API. :)
2017-04-21 13:05:10 +02:00
Thomas Hochstein 6751bd8d52 Akismet has a POST API, not a GET API. :)
Closes #506.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-21 13:01:11 +02:00
onli 2debad91d0 Workaround: Add smartyvars.uriargs to cache key
The freetags plugin sets this->displaytag in the frontend_fetchentries hook, and only sets clean_page if it sees that variable in the entry_display hook. The result is that wrong entries are shown on tag pages. Adding the smartyvars allows caching the correct $entries the plugin would have returned, working around that limitation without simulatign the frontend_fetchentries hook.
2017-04-20 17:42:48 +02:00
onli 2b4ddde690 Drop outer printEntries Cache 2017-04-20 01:23:07 +02:00
onli bf213b752d Drop outer printEntries cache 2017-04-20 01:19:43 +02:00
onli e61d38a61d Cache: Add additional state variables + single entry mode
fetchEntries is heaviliy realient on glboal state variables, and that was missed initially. The last commit c8bbb35aac fixed that partially, but did not catch all global state variables. Additionally, this fixed the clean_page mode as used by staticpage by adding the logic and event hook to printEntriesCached
2017-04-20 01:07:24 +02:00
onli c8bbb35aac Fix cache by getting & setting global state variables
See https://board.s9y.org/viewtopic.php?p=10447129#p10447129. Missed in #345
2017-04-19 01:11:34 +02:00
onli b6b989440d Document rel=trackback (#438) 2017-04-17 15:18:06 +02:00
Matthias Mees e6cf472b01 Merge pull request #504 from th-h/thh-news
Add PR #493 to NEWS.
2017-04-16 15:09:10 +02:00
Thomas Hochstein 7dfed291ae Add PR #493 to NEWS.
PR #493 was
"Dashboard: Redo display of drafts/future entries."

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-16 14:55:19 +02:00
Matthias Mees c43b419939 Add German translation + UTF-8 lang files 2017-04-16 10:11:26 +02:00
onli 02b3959ac4 Merge branch 'master' of github.com:s9y/Serendipity 2017-04-16 01:17:39 +02:00
onli 88a89436ae responsive: Use default thumbnail in srcset (#474)
Also, use width to detect if the user only selected a thumbnail, and accordingly reduce the srcset selection
2017-04-16 01:15:27 +02:00
onli 284fffb750 Merge pull request #503 from th-h/thh-487
Fix comment preview for logged-in user.
2017-04-15 23:26:53 +02:00
onli c585f73f8c Init responsive images core plugin (#474) 2017-04-15 23:08:54 +02:00
onli e1733604a5 Merge pull request #493 from th-h/thh-dashboard-entries
Dashboard: redo display of drafts / future entries
2017-04-15 12:01:21 +02:00
onli 18f6429f32 Add rel=trackback header and discovery (#438) 2017-04-15 02:19:45 +02:00
Matthias Mees 565b8ef51d Fix PHP syntax errors
Introduced in 019dc37836
2017-04-13 20:25:22 +02:00
Thomas Hochstein 68a6a58780 Fix comment preview for logged-in user.
Comment form data was unconditionally overwritten
by user data. Make that conditional ...

Fixes #487

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-13 19:19:02 +02:00
Matthias Mees 02542a4527 Merge pull request #502 from th-h/thh-news
Add some NEWS items.
2017-04-13 14:42:53 +02:00
Thomas Hochstein 721c2a07d4 Add some NEWS items.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-13 14:26:07 +02:00
Matthias Mees c8d9e7c5c8 Merge pull request #501 from th-h/thh-localconfig
Add comment to serendipity_config_local.inc.php
2017-04-13 14:25:54 +02:00
Thomas Hochstein 019dc37836 Add comment to serendipity_config_local.inc.php
Refer users to the code primer on docs.s9y.org
and serendipity_config.inc.php for a list of
special variables and their defaults.

Fixes #469.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-13 14:13:14 +02:00
onli 6a6a402cc3 Merge pull request #497 from th-h/thh-netdns2
Add Net/DNS2.php 1.4.3 to core.
2017-04-13 12:50:16 +02:00
Matthias Mees 594c8177f5 Merge pull request #496 from th-h/thh-plugins-emptygroup
Suppress empty groups in plugin list.
2017-04-13 12:43:08 +02:00
Thomas Hochstein 099c06f11d Add Net/DNS2.php 1.4.3 to core.
Fixes #459

See https://pear.php.net/package/Net_DNS2/

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-13 12:39:41 +02:00
Thomas Hochstein 07261b0389 Suppress empty groups in plugin list.
As suggested by @garvinhicking in #484

Fixes #484

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-13 12:19:21 +02:00
Garvin Hicking 6be1fb1d02 Merge pull request #494 from th-h/thh-deletebutton
Reformat delete button as icon button, in front of "preview".
2017-04-13 11:02:09 +02:00
Garvin Hicking e7e030d54d Merge pull request #491 from th-h/thh-deletebutton
Add a delete button to the backend entry form.
2017-04-13 10:42:16 +02:00
Thomas Hochstein 481b821bae Dashboard: move defaults to serendipity_config
Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-13 10:11:27 +02:00
Thomas Hochstein 10caea1b92 Dashboard: redo display of drafts / future entries
See #488 for the discussion.

Merge `dashboardLimit` and `dashboardDraftLimit`
to `dashboardEntriesLimit`

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-13 10:05:19 +02:00
Thomas Hochstein b524f7561b Reformat as icon button, in front of "preview".
Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-13 09:55:12 +02:00
onli 59d17ee112 Merge pull request #492 from th-h/thh-backend-page-title
Redo backend page title order.
2017-04-13 09:24:40 +02:00
Thomas Hochstein 6b775e1cac Redo backend page title order.
Code style improvements from the reviews of

* Rename ´$serendipity['title_first'´] to
  ´$serendipity['backendBlogtitleFirst']´ and
  make it boolean

* Add default to `serendipity_config.inc.php`.

* Change the condition in ´2k11/admin/index.tpl´
  that the first branch is run by default

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-13 00:18:28 +02:00
Thomas Hochstein 309d3fc7c5 Add a delete button to the backend entry form.
Closes 472.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-12 23:56:45 +02:00
onli 82b79ef4d6 Merge pull request #489 from th-h/thh-spartacus-default
Change Spartacus default mirror to github.
2017-04-12 18:44:17 +02:00
Thomas Hochstein 5ad93297ed Change Spartacus default mirror to github.
Netmirror is not very reliable currently.

Add Changelog file.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-12 18:37:30 +02:00
onli 19b023529d Merge pull request #448 from gnuheidix/admin_username
HTTP500: crashing when username is an array
2017-04-11 15:02:50 +02:00
onli 8c509d93b2 Merge pull request #468 from th-h/thh-465
Dashboard: show as many drafts as configured.
2017-04-11 14:50:08 +02:00
onli fd412dad00 Merge pull request #480 from th-h/thh-413
Make backend page title order configurable.
2017-04-11 14:47:54 +02:00
Garvin Hicking 13750e09e5 next major release 2017-04-09 09:41:05 +02:00
Garvin Hicking 701ebe442d Rever this for the release, re-introduce later 2017-04-09 09:35:14 +02:00
Garvin Hicking 8fee805ca1 Prepare release 2.1.1 2017-04-09 09:15:55 +02:00
Mario Hommel 9365836307 Merge pull request #481 from th-h/thh-476
Fix broken compat layer.
2017-04-09 00:55:21 +02:00
Thomas Hochstein c3dfe61b57 Fix broken compat layer.
Partially revert 7a0a9e2156

serendipity_specialchars() and others were made to
return "" when fed something that is not a string.
So boolean values (1 or TRUE) will be returned as "",
i.e. FALSE, breaking the blog in interesting ways
(i.e. displaying wrong configuration values and
saving them to the database).

Closes #476.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-09 00:49:10 +02:00
Thomas Hochstein 488267a6cf Make backend page title order configurable.
The default page title of backend pages is
"section | blog title | $admin". You can
now change the order to "blog title | section
 | $admin" by setting $serendipity['title_first']
to "blogtitle" in serendipity_config_local.inc.php

Closes #413

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-09 00:47:24 +02:00
Thomas Hochstein 0b85c80ac9 Dashboard: show as much drafts as configured.
The dashboard will show up to $dashboardLimit future
entries; if the number of future entries is still
less than $dashboardDraftLimit, it will add drafts
up to $dashboardDraftLimit.

If there are _no_ future entries, $entries is no
array, but has a value of "1"; count($entries)
will then be one, too, so one draft less will
be shown.

Closes #465.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2017-04-09 00:46:51 +02:00
Garvin Hicking 2bedc9243e next version 2017-04-08 18:47:50 +02:00
Garvin Hicking a794481941 bump release 2017-04-08 18:30:49 +02:00
Garvin Hicking a385c10890 bump version 2017-04-08 18:23:46 +02:00
Garvin Hicking 7832c364d7 IteratorIteratorIteratorIterator iterated iteration fix. To understand iteration, you first need to understand recursion and iteration and iteration and iteration and iteration. 2017-04-08 17:38:47 +02:00
Garvin Hicking b8897b3250 PHP7 check 2017-04-08 17:01:31 +02:00
Garvin Hicking 86a17f9a2b Register fatal error handler 2017-04-08 15:45:21 +02:00
Garvin Hicking 3e442e73ff Merge pull request #466 from ka7/feature/spelling
spelling fixes
2017-04-07 10:48:11 +02:00
klemens 5a95db314a spelling fixes 2017-04-06 22:26:07 +02:00
Don Chambers 4d8f04d406 Add plugin_dynamicform.tpl to Timeline theme 2017-03-18 09:36:57 -05:00
Matthias Mees 3702139dcf Merge pull request #461 from webcompas/master
Fixed uninitialized Smarty value (fixes #460)
2017-03-14 14:28:04 +01:00
Pascal Uhlmann 8791e8929e Fixed uninitialized Smarty value (fixes s9y/Serendipity#460) 2017-03-14 14:02:33 +01:00
onli cdf375623d Require token to change theme (fixes #452) 2017-03-02 12:08:05 +01:00
Matthias Mees d98eaed44c Use https protocol for external assets
Basically 'backporting' e256e658 for preview_iframe.tpl
2017-02-24 09:07:53 +01:00
Matthias Mees cea0240240 Merge pull request #451 from capturehorizons/patch-1
Update index.tpl
2017-02-24 09:06:03 +01:00
Marcus Seidler e256e65846 Update index.tpl
Hello s9y,

I have change three url (lines 23, 32, 33) to "https://..." because browser warning unsaved content on https-domains.

It works on my site "www.seidler.is"

I hope i could help

Greeting marcus
2017-02-24 08:28:45 +01:00
Thomas Heidrich 3a7e04c69c improved check quality
!empty verifies that $username has been set with a significant value of any kind; is_string makes sure the type is really what is being expected in the following code.
2017-02-09 23:39:06 +01:00
Thomas Heidrich e28bbf04d2 avoid HTTP500 crashing when username is an array 2017-02-08 20:19:43 +01:00
onli 381b066344 Merge pull request #447 from gnuheidix/comment_sanitized
some PHP functions expect strings and crash otherwise
2017-02-07 22:16:10 +01:00
onli 9511b9dde5 Merge pull request #446 from gnuheidix/search_term
makes sure that only strings are being processed in searchTerm
2017-02-07 21:15:11 +01:00
Thomas Heidrich 7a0a9e2156 some PHP functions expect strings and crash otherwise 2017-02-07 21:13:51 +01:00
Thomas Heidrich dd06eeea99 makes sure that only strings are being processed in searchTerm; strip_tags crashes in case it's getting an array 2017-02-07 20:24:33 +01:00
Garvin Hicking 55ec5e4ab4 document, bump 2017-01-30 14:58:52 +01:00
Garvin Hicking c2cebad52b issue #442 2017-01-30 14:58:37 +01:00
onli d4d46855c2 Add formtoken to upgrade button 2017-01-26 14:11:54 +01:00
Garvin Hicking ba6d9ee127 prepare release 2017-01-26 11:50:15 +01:00
Garvin Hicking 2b5de12b38 Issue #437 2017-01-26 08:25:06 +01:00
Garvin Hicking 97277cfd1a issue #430 2017-01-26 08:23:17 +01:00
Garvin Hicking 5bf0cf9fea Merge branch 'master' of github.com:s9y/Serendipity 2017-01-26 08:16:22 +01:00
Garvin Hicking 69d8a34c90 document 2017-01-26 08:16:14 +01:00
onli 7e70f91686 Add form token to comment delete link 2017-01-17 11:42:37 +01:00
onli f947c66f66 Add multiple missing CSRF tokens (#439)
Deleting comments, disabling comment threads, installing plugins, toggling a spartacus update check
2017-01-16 15:32:16 +01:00
Garvin Hicking c62d667287 * [Security] Fix missing integer casting for inserting new categories
(thanks to cdxy)
2017-01-16 11:29:15 +01:00
Garvin Hicking 6285933470 * [Security] Redirection of comment.php now checks the referrer
and only allows the blog's host (thanks to Lee Sheldon Victor)
2017-01-12 12:02:27 +01:00
Garvin Hicking a48708021c * [Security] Reject %0D/%0A in exit tracking and other places
(Issue #434)
2017-01-03 09:21:25 +01:00
Garvin Hicking edfc8bcff1 disable selenium test files 2017-01-02 09:42:37 +01:00
Garvin Hicking 4e8c310156 Issue #435, fix missing escaping of HTTP referer to prevent XSS 2017-01-02 09:37:45 +01:00
Garvin Hicking 0c8416f5df Allow setting a default category.
Needs some testing, I am not sure how to solve the case now where "no category" shall be used. It will always fall back to the default category.
Probably if someone uses a default category, that's the intended behaviour?
2016-12-23 10:14:27 +01:00
Garvin Hicking 6b1348a7f1 improve hidding password from recent chrome 2016-12-23 10:13:40 +01:00
Garvin Hicking fd2f23f3e7 upport security bugfix to escape dbType parameter on first installation (issue #433) 2016-12-19 11:18:10 +01:00
onli ccfc8c31c2 Merge pull request #432 from gnuheidix/PR_rss_version_parameter
Strict feed template name checking (#431)
2016-12-15 05:31:09 +01:00
Thomas Heidrich 99e9b70c9b Strict feed template name checking (#431)
otherwise requests like /rss.php?version=1 will still crash
2016-12-14 18:19:44 +01:00
onli e9f98f80f0 Add additional check for allowed feed tpls (#431) 2016-12-14 12:43:50 +01:00
Garvin Hicking cb03731e90 release 2016-11-28 15:51:51 +01:00
Garvin Hicking e2a665e13b Sync changes 2016-11-28 15:34:10 +01:00
Garvin Hicking dc3eb1e735 Merge branch 'master' of github.com:s9y/Serendipity 2016-11-02 12:18:58 +01:00
Garvin Hicking 26de428c18 Enhanced media upload check to also check redirects for local files, thanks to Xu Yue (again!) 2016-11-02 12:18:49 +01:00
Matthias Mees f06aeb2340 Update docs files
- Added correct URL to new website to INSTALL
- Adapted body copy in README
- Reformatted both files so they would pass as Markdown if needed
2016-10-28 11:41:53 +02:00
Matthias Mees 309cf8e9a6 Catch up German core translation 2016-10-27 23:24:42 +02:00
Matthias Mees 5ed6ace0f5 Adapt README text to copy on s9y.org 2016-10-27 14:34:40 +02:00
Matthias Mees 090c212d09 Fix maintenance message spacing 2016-10-26 15:23:03 +02:00
Matthias Mees 7b354c1cf7 Fix layout error w/ maintenance messages 2016-10-26 15:21:22 +02:00
Matthias Mees 69f5515ea3 Remove stray aria-hidden attribute 2016-10-26 15:19:43 +02:00
Matthias Mees eda47a1ffc Fix misplaced aria attribute 2016-10-26 15:16:09 +02:00
Matthias Mees a81c480d5e Document my recent changes, oops 2016-10-26 11:35:31 +02:00
Matthias Mees 7410465496 Improve accessibility of iconfont icons
Iconfont icons are of no value to screenreader users; in our case,
they get alternative text. By adding 'aria-hidden="true"' to the
<span> holding the iconfont icon, we avoid the screenreader trying
to announce the iconfont icon.
2016-10-26 11:29:25 +02:00
Matthias Mees fbcd6d9c98 Revert c6089ba4 2016-10-24 15:17:54 +02:00
Matthias Mees c6089ba4fd Add styles for the revamped template editor 2016-10-24 15:11:05 +02:00
Matthias Mees 2b70ef0203 Fix layout regression in filtered installable plugins 2016-10-24 11:14:03 +02:00
Matthias Mees 8334348a13 Fix layout regression in installable plugins 2016-10-23 17:37:46 +02:00
Matthias Mees d3d205ece9 Replace JS-based equal heights with flexbox solution
- Only fire JS equal heights if flexbox is not supported
- Add flexbox styles for backend sections that used to use
  JS based equal heights
- Use Modernizr's flexbox detection to use the old styles
  as a fallback for non-flexbox browsers
- Generate new oldie stylesheet
- Do not use .clearfix with flexbox (Safari doesn't like it)
- Apply IE11 fix for flexbox, see goo.gl/pglrbm

References #333
2016-10-23 14:05:00 +02:00
onli d9b1baab76 Further improve theme ordering
Stabilizes output of the recommended themes
2016-10-10 18:43:03 +02:00
onli 31799a28c0 Merge branch 'master' of github.com:s9y/Serendipity 2016-10-10 18:41:08 +02:00
onli 42c5dc9288 Order themes by their shown name 2016-10-10 18:40:22 +02:00
onli 196c3becb2 Order themes by their shown name 2016-10-10 18:36:44 +02:00
Garvin Hicking d7980e5f94 bump 2016-09-26 10:38:01 +02:00
Garvin Hicking c5c953b2f5 add language constant 2016-09-26 10:34:49 +02:00
Garvin Hicking 929fe9ade7 bump version, prep release 2016-09-26 10:28:20 +02:00
Garvin Hicking 846dbbeb85 Merge branch 'master' of github.com:s9y/Serendipity 2016-09-26 09:45:37 +02:00
onli eedd984e0d improve cgi detection to use custom htaccess
See http://board.s9y.org/viewtopic.php?f=3&t=20788
2016-09-25 16:54:09 +02:00
Garvin Hicking 06e33c5421 Merge branch 'master' of github.com:s9y/Serendipity 2016-09-25 15:30:10 +02:00
Garvin Hicking 4aaa9845eb Add header API 2016-09-22 15:38:12 +02:00
Garvin Hicking d60a7da9c3 support http auth 2016-09-22 15:34:27 +02:00
Garvin Hicking 20ade83792 allow arrays 2016-09-22 14:33:52 +02:00
Garvin Hicking 80f3b39502 forward compatibility to serendipity_request_url 2016-09-22 14:26:59 +02:00
Garvin Hicking 1bb335dc17 Merge branch 'master' of github.com:s9y/Serendipity 2016-09-22 12:51:41 +02:00
Garvin Hicking cfd75ec877 Security patch, see docs/NEWS 2016-09-22 12:51:00 +02:00
Garvin Hicking c1e4f4c533 Add serendipity_request_url() 2016-09-22 12:35:48 +02:00
Matthias Mees 80c7f273f2 Use dynamic theme name in Next 2016-09-22 00:21:36 +02:00
Matthias Mees 8b75c064e3 Remove idea's index.tpl file
This should now work with recent chances to 2k11, so idea can be
a CSS-only theme again.
2016-09-22 00:18:42 +02:00
Matthias Mees 177044c941 Use dynamic template variable 2016-09-22 00:18:14 +02:00
Matthias Mees b38de07b94 Set proper engine themes for contest + competition 2016-09-22 00:02:15 +02:00
onli 07f8349edb restore idea theme 2016-09-21 22:52:58 +02:00
Matthias Mees 40d4dc986e Document (re)moving outdated themes
Closes #422
2016-09-21 19:12:36 +02:00
Matthias Mees d1d7097fe9 Remove blue theme
Moved to spartacus. Goodbye.

References #422
2016-09-21 19:08:31 +02:00
Matthias Mees 268b87d21d Remove carl_contest theme
Moved to spartacus. Goodbye.

References #422
2016-09-21 19:07:39 +02:00
Matthias Mees 120b3f90a0 Remove kubrick theme
Moved to spartacus. Goodbye.

References #422
2016-09-21 19:05:47 +02:00
Matthias Mees 6a19dac69d Remove wp theme
Moved to spartacus. Goodbye.

References #422
2016-09-21 19:04:28 +02:00
Matthias Mees 16c98885b7 Document adding Skeleton theme
Oops, I forgot. /o\
2016-09-21 12:54:28 +02:00
Garvin Hicking ce7af03e66 Merge branch 'master' of github.com:s9y/Serendipity 2016-09-20 10:35:49 +02:00
Garvin Hicking 6d68ec389d experimental commit to use "content_message" for emitting a default "404 not found" message when redirecting to the blog to indicate 404 view
http://board.s9y.org/viewtopic.php?f=2&t=20861
2016-09-20 10:35:11 +02:00
Matthias Mees e44f7a506e Add new theme: Skeleton 2016-09-20 10:00:17 +02:00
onli 2797bfdf02 Document preview_iframe cleanup + cache IE fix 2016-09-12 17:36:37 +02:00
Matthias Mees ce40532680 Update theme preview image for Next 2016-09-12 13:43:32 +02:00
Matthias Mees 34fc78c89d Remove backend JS assets from iframed backend preview
These are no longer required due to recent changes.
2016-09-12 10:26:52 +02:00
onli b7e2d57290 Fix: Editor cache not emptied in IE 2016-09-11 23:55:16 +02:00
onli 3aed346370 Fix image upload progress bar 2016-09-11 17:41:07 +02:00
onli 5108486af3 Remove backend js from preview_iframe in next 2016-09-11 15:38:41 +02:00
Matthias Mees 9a4c26f13f Use improved backend preview iframe height calculation method
Applied to all recommended themes in the core.

References #420
2016-09-09 16:43:15 +02:00
onli f15cb17755 Document recent changes
fallback chain changes, preview fixes, getFile function in plugin api,
frontend-param in smarty {getFile}
2016-09-09 15:12:13 +02:00
onli acef784f41 Fix: Entry preview using backend entries.tpl 2016-09-09 14:55:29 +02:00
Matthias Mees 58ed1f8ec6 Vastly simplify Next's preview
Also fix wrong height of iframed preview.
2016-09-08 19:31:15 +02:00
Matthias Mees 0490401f3a Adapt core themes to new serendipity_getFile fallback mechanism
Using frontend=true attribute to properly load frontend theme's
CSS + JS assets.

References #419
2016-09-08 18:45:07 +02:00
onli 9dfa482a96 Introduce {getFile frontend} param to get frontend files while in backend
This will be mainly needed in preview_iframe.tpl, as it is executed in
the backend but needs files from the frontend theme. See
http://board.s9y.org/viewtopic.php?p=10445987#p10445987
2016-09-08 10:18:27 +02:00
onli b73dd8bb1e Introduce getFile to the plugin api
Useful to get files (like smiley graphics) from the fallback chain
2016-08-23 00:21:35 +02:00
onli d97cdf7378 Fix smiley images (#416) 2016-08-22 23:58:44 +02:00
onli b6ac03e8a1 Fix composer when http is forbidden (#418) 2016-08-22 23:37:58 +02:00
onli 18b1ef5ab4 restore image align images in ML upload 2016-08-22 23:33:54 +02:00
onli 8641a4198e make style_fallback available in 2k11 themes (#417) 2016-08-22 23:29:16 +02:00
onli 460b416b7c Make ML work with simplified fallback chain
See 8affa1126a
2016-07-29 00:16:37 +02:00
onli b22ef8d1ce Improve tab title uniqueness in backend (#413)
Show the blogtitle after the section, and shortens plugins and template
menu title to the one used in the menu
2016-07-29 00:11:21 +02:00
onli 3179ed7d57 Make feeds work with simplified template fallback
Since default is no longer queried if not set specifically, the new
default template 2k11 needs to carry the feed template and the banner
image. See http://board.s9y.org/viewtopic.php?f=3&t=20801 and
https://github.com/s9y/Serendipity/commit/8affa1126a80f045aea61b40c5f449e05b843419
2016-07-27 10:35:03 +02:00
onli d31c8960f8 Add test for serendipity_getTemplateFile 2016-07-25 20:54:52 +02:00
onli 6419df26e0 Improve getTemplateFile performance by avoiding double lookups 2016-07-24 20:22:14 +02:00
onli 8affa1126a Massively simplify fallback chain logic
Should've been tested in the alpha, but given the problems with the preview logic (see http://board.s9y.org/viewtopic.php?f=3&t=20791) I'm convinced we need this now. This mainly reworks serendipity_getTemplateFile to follow a simple scheme on where to look for templates – either in the backend or frontend, based on where we are but overridable, then in the engine, then in the defaultTemplate as fallback.
2016-07-24 20:13:36 +02:00
onli f300de0e01 Fix next theme not showing entry save box
See http://board.s9y.org/viewtopic.php?f=3&p=10445831
2016-07-22 15:41:12 +02:00
onli b5fbccb669 Remove php_value from htaccess, collides with fcgi
See http://board.s9y.org/viewtopic.php?f=3&t=20788
2016-07-19 13:41:36 +02:00
Don Chambers 04d3c3ba96 Misc. Theme: Timeline changes 2016-07-14 23:03:56 -05:00
Matthias Mees e30266427e Update bundled jQuery to 1.12.4 2016-07-13 11:30:14 +02:00
onli d9ac1542ac Set timeline as recommended theme 2016-07-04 11:14:16 +02:00
onli 84709381af Fix: Category feed showed all entries 2016-07-03 23:01:17 +02:00
Matthias Mees 3aed0ac0f6 [next] CSS fix for non-smallscreen nav 2016-06-25 12:06:13 +02:00
Matthias Mees 1669d72046 German translation universal plugin update button 2016-06-25 11:53:37 +02:00
onli 26c462acff gravatar: remove mybloglog and be more robust to wrong input 2016-06-24 18:20:50 +02:00
onli f9482cc1aa Fix: http request for akismet missed the method (#411) 2016-06-23 13:00:21 +02:00
onli d973e99933 Workaround PHP < 5.6 bug, not verifying certs, stopping Request2
See http://board.s9y.org/viewtopic.php?f=10&t=20773 and #399
2016-06-22 19:42:07 +02:00
onli b39bf70345 Enable beta upgrades 2016-06-21 15:28:51 +02:00
Matthias Mees 130d32ae1a Optimize long titles in the backend for sidebar plugins 2016-06-21 12:46:48 +02:00
Matthias Mees 48e8dc008c Fix long plugin titles in the backend, once and for all 2016-06-20 20:00:25 +02:00
Garvin Hicking fb7896b2bd prepare release 2016-06-08 09:15:07 +02:00
Ian aecb3d5fed fix file encoding for persian comma, issued with cc60537 2016-06-01 13:12:05 +02:00
Ian e87ab8729d fix 2 issues with commit f94c85c 2016-06-01 13:11:15 +02:00
Don Chambers 4b39011d69 Theme Timeline added 2016-05-31 21:40:04 -05:00
onli e34e0db1e5 Covnert bulk mover into a single button + popup (fixes #409) 2016-05-25 22:11:17 +00:00
onli dfc41df02a ajax-uploaded now moves image into selected folder 2016-05-25 20:51:18 +00:00
Garvin Hicking 72f555d9a6 port cors 2016-05-19 14:27:16 +02:00
onli dbf21c3df5 Cache_Lite: Use __construct (#399) 2016-05-10 12:40:15 +00:00
onli 78de4c894b Update Net_DNSBL to 1.3.7 (#399) 2016-05-10 03:01:16 +00:00
onli 02a49c8735 Http/Request2 for ML image download (#399) 2016-05-10 02:52:37 +00:00
onli d4fe793820 Move importers to Http/Request2 and __construct (#399) 2016-05-10 02:47:22 +00:00
onli fd90812453 Use Http/Request2 for functions_trackback (#399) 2016-05-10 02:34:28 +00:00
onli f1d2025b39 spamblock: move to Http/Request2 (#399) 2016-05-10 02:15:51 +00:00
onli 60a06c1706 remoterss: Use __contruct() for OMPL class (#399) 2016-05-10 02:08:13 +00:00
onli 741a0c3508 Onyx: Use Http/Request2 (#399) 2016-05-10 02:04:37 +00:00
onli 2bb2b5c9de Merge pull request #407 from blackwarthog/master
Show two "comments feed" buttons when both feed formats (RSS+Atom) activated
2016-05-09 19:34:41 +02:00
Ivan Mahonin 7883b5931f Show two "comments feed" buttons when both feed formats (RSS+Atom) activated 2016-05-09 13:12:21 -04:00
Garvin Hicking 98099b6a02 Improve custom s9y error handling. Will post in issue #399 for details. 2016-05-09 14:34:34 +02:00
onli a615ddc57d Move remoterss plugin to http_request2 (#399) 2016-05-06 20:48:37 +00:00
onli f98d4304b1 Let gravatar plugin use HTTP_Request2 (#399) 2016-05-02 20:09:29 +00:00
onli e6202fcf23 Spartacus: Use Http/Request2 (#399) 2016-05-01 21:48:32 +00:00
onli 4aefefc295 Update HTTP_Request (#399) 2016-04-27 18:52:12 +00:00
onli 51d88128f4 Update pear (#399) 2016-04-27 18:50:44 +00:00
onli 73ea0c4b1e Restore session id change on logout (#399) 2016-04-27 18:12:48 +00:00
onli a8ac90c466 Init php 7 compatibility (#399)
A first approach at fixing s9y for php 7, which makes it possible to
write an entry without any error message. The specific changes are: 1.
__construct for the plugin classes 2. Update Cache Lite to a modern
version to fix its similar constructor problem 3. Remove the
session_regenerate_id call from the session destructor (should get
re-added to session creation where necessary) 4. Remove error handler to
prevent silenced warnings from becoming fatal exceptions
2016-04-26 22:39:11 +00:00
Ian d78724b4c9 remove $Id$ 2016-04-25 12:13:18 +02:00
Wesley Woo-Duk Hwang-Chung 022b68e3b3 Some further edits to Korean localization 2016-04-25 09:39:41 +09:00
Wesley Woo-Duk Hwang-Chung 6733151051 Some further edits to Korean localization 2016-04-25 09:38:53 +09:00
Wesley Woo-Duk Hwang-Chung 0d667ba503 Update Korean translation (overhaul in 11 years!)
Added translation for new features since 2005, and also corrected mistranslations / typos.
2016-04-25 00:14:04 +09:00
Wesley Woo-Duk Hwang-Chung bb9cca20ba Update Korean translation (overhaul in 11 years!)
Added translation for new features since 2005, and also corrected mistranslations / typos.
2016-04-25 00:12:40 +09:00
Wesley Woo-Duk Hwang-Chung e4c333dded Korean translation added 2016-04-23 21:55:33 +09:00
Wesley Woo-Duk Hwang-Chung 5bd9c6a3b4 Korean translation added 2016-04-23 21:54:51 +09:00
Ian a30457892d add newlines where all other lang have em to 2016-04-22 19:51:46 +02:00
onli 32d0a6bf4f Fix: Don't break backend theme box
If the current theme was not the same as the backend theme, but the
backend theme was part of a recommended theme, then that backend theme
would get accidentally removed from the list of themes and thus nto set
as the current backend theme, breaking the themes menu
2016-04-20 20:47:57 +00:00
Matthias Mees 59e569e59f Update 2k11 backend JS assets
- Update autoscroll
- Update magnificPopup
- Update magnificPopup's CSS in style.css
2016-04-20 10:20:44 +02:00
Matthias Mees db5c7089bb Update backend Modernizr to latest 2016-04-20 10:11:30 +02:00
onli 7e27920421 Spartacus: Support recommended property for themes 2016-04-18 21:33:31 +00:00
onli 128a25e6d5 Merge branch 'master' of https://github.com/s9y/Serendipity 2016-04-14 16:42:44 +02:00
onli 4619ce1e03 document modern themes section 2016-04-14 16:23:49 +00:00
onli e84bc1aa80 Fix theme info overlay
Broken in cc4e9f953e because @key does not work after the variable was moved as an argument into a function
2016-04-14 16:40:57 +02:00
onli cc4e9f953e Introduce recommended section in theme backend
Meant to highlight modern themes for guiding users not to pick the outdated xhtml themes still available via spartacus. See http://board.s9y.org/viewtopic.php?f=5&t=20713
2016-04-14 16:18:16 +02:00
Matthias Mees 58df7bcea5 Update bundled jQuery to 1.12.3 2016-04-05 22:16:35 +02:00
Ian f94b16e7ca add to plugin plug logo 2 option and example 2016-04-03 12:13:35 +02:00
onli 9d18a74440 Fix: Both plugin types not upgradeable in shared list (#383) 2016-03-29 19:49:26 +02:00
Matthias Mees 864782d48d Update bundled jQuery to 1.12.2 2016-03-26 12:13:50 +01:00
Ian b536a9dcce better descriptions 2016-03-22 19:33:02 +01:00
Ian 0d981fcb86 Revert "spartacus add lang"
This reverts commit 2f71892daf.
2016-03-20 15:10:57 +01:00
Ian 2f71892daf spartacus add lang 2016-03-20 15:07:01 +01:00
Matthias Mees 55061e4dc7 Add new lang constant for Spartacus
References #383
2016-03-20 15:04:25 +01:00
onli 668363eb1b Merge event and sidebar update page into one (#383) 2016-03-20 14:40:08 +00:00
Ian 2c7f40aa1e add CONFIG_PERMALINK_PATH_DESC 2016-03-19 17:19:00 +01:00
Ian d93674485d cleaups 2016-03-19 17:18:11 +01:00
onli aa12313ee4 Skip zebra striping for hidden config element (fixes #396) 2016-03-18 23:28:03 +00:00
Matthias Mees 62a3624f1f Fix positioning for popuplayer button
That means positioning in the source code as well as in the layout.

References #395
2016-03-12 21:06:19 +01:00
onli 6fafd4964a restore accidentaly removed contentplugin type
Was a mistake in 1fb1a6647f
2016-03-01 00:22:16 +01:00
onli 1fb1a6647f Add color picker as plugin/theme config item 2016-03-01 00:14:15 +01:00
onli 020ca7f651 Merge pull request #392 from xoxys/master
Provide authenticated userdata for frotend comment form
2016-02-12 17:32:38 +01:00
xoxys 7faa1cb195 provide userdata for frotend comment form 2016-02-12 09:12:05 +01:00
xoxys 7af3980f96 Update functions_entries.inc.php 2016-02-12 09:08:54 +01:00
xoxys 68bb6fbeb9 provide userdata for frotend comment form 2016-02-12 09:07:00 +01:00
Garvin Hicking e35898342d proper EOL 2016-02-10 12:50:00 +01:00
Garvin Hicking 74b9251c40 Revert "addlang"
This reverts commit c3db29a036.
2016-02-10 12:48:59 +01:00
Ian f9fc569c5d remove ? 2016-02-10 10:46:58 +01:00
Ian d97acf8b05 remove RQ, see commit and cooments
1c1c11f31fd31b54ae98f2921f8411208704c9e5#commitcomment-15999285
2016-02-10 10:44:58 +01:00
Garvin Hicking c3db29a036 addlang 2016-02-10 09:51:37 +01:00
onli 6003c72b5c Merge pull request #391 from xoxys/master
check session variable to detect a reply from author
2016-02-09 21:50:24 +01:00
Matthias Mees 400c662462 Use hidden class instead of inline styles 2016-02-09 14:30:25 +01:00
xoxys 7e5f63d9d2 remove backend variable 2016-02-09 10:55:12 +01:00
xoxys d4f09b7821 check session variable to detect a reply from author 2016-02-09 10:49:50 +01:00
Matthias Mees bdff9336e5 Fix typo 2016-02-09 09:46:03 +01:00
Matthias Mees 8c92422bce Use serendipity.openPopup to fix weird dashboard double click
References #387
2016-02-08 20:39:32 +01:00
Matthias Mees 4f49833fc9 Improve language (hopefully) 2016-02-08 19:38:09 +01:00
Ian 1db631bab3 add new CONFIG_PERMALINK_PATH_DESC constant
Will match all configuration permalink descriptions, added in a later commit.

@garvinhicking please trigger lang update
2016-02-08 16:05:49 +01:00
Ian 4267203a64 add missing hack defense 2016-02-08 15:28:17 +01:00
Ian fd9e77a4c8 remove $Revision$ 2016-02-08 15:27:34 +01:00
Ian a7c9193e03 some whitespaces 2016-02-08 15:16:05 +01:00
Ian dd0e242ac0 array unique auto GET vars 2016-02-08 15:15:44 +01:00
Ian 1c1c11f31f RQ some function arguments
What shall we do with them, see serendipity_fetchEntry() and getClassByInstanceID() ?
2016-02-08 15:14:49 +01:00
Ian 2cc8655ed2 fix typo 2016-02-08 15:12:10 +01:00
onli 2fb79a5961 document #390 2016-02-08 13:40:51 +01:00
onli 33dcbbe2ef Merge pull request #390 from xoxys/master
Disable email notifications for replies send from backend
2016-02-08 12:00:25 +01:00
xoxys 7116e167fe Update functions_comments.inc.php 2016-02-08 11:56:04 +01:00
xoxys b043b45a1e Update functions_comments.inc.php 2016-02-08 11:22:43 +01:00
xoxys fb1de8ac51 check if comment author equals article author 2016-02-08 11:16:32 +01:00
xoxys 55a9bc66b2 Disable email notifications for replies send from backend 2016-02-08 09:51:40 +01:00
xoxys 93322d2dce Disable email notifications for replies send from backend
Add variable $comment to control comment replies from backend
2016-02-08 09:47:58 +01:00
Matthias Mees c3df4cc0c4 Clean up fallback styles
- Use unitless values where possible
- Emit styles in a more logical order
- Updated documentation of fallback styles
2016-02-04 19:43:14 +01:00
Matthias Mees c0e626fecf Remove fallback styles for lightboxed image links
No longer necessary.

Reverts 7e9524c7bb
2016-02-04 19:30:41 +01:00
Matthias Mees 7e9524c7bb Add fallback styles for image links
This is required by the lightbox plugin. It does not harm blogs
that do not use the lightbox plugin, but makes image links easier
to click.

References #388
2016-02-04 18:05:37 +01:00
Ian eb13701244 delete by multiperm only
this removes some dev test vars for del by author, which isn't possible yet
2016-02-04 16:43:28 +01:00
Ian a47fa22ca4 do not set spamblock button if user not has 'adminComments' privilege 2016-02-04 15:41:58 +01:00
Ian 69f8eae646 some cleanups found on the way 2016-02-04 15:26:38 +01:00
Ian 8da2f97d07 fix 227d115 missing another multiperm assignment 2016-02-04 13:52:35 +01:00
Ian b0a33ec353 better not remove ignore case in c2ff0e9
though I had removed item ignore flag in functions_installer.inc.php in my local dev ... but I do not remember why :)
2016-02-04 10:18:24 +01:00
Ian 8d4a0e7e9f avoid break of equal_heights positioning when publishing entries by dashboard 2016-02-03 18:52:09 +01:00
Ian 0af650be44 better comments by author
Removes some restrictions previously added. Or else we would need a 'userComments' privilege. But that would not make too much sense, since we already work with the lowest group privilege here.
This still is not ready yet, I presume. It needs more finetuning like answer to comments, etc.
Please help testing.

References #385
2016-02-03 18:12:17 +01:00
Ian 7f7f452388 fix d4ce253 missing authorid fetch
References #385
2016-02-03 16:52:46 +01:00
Ian d4ce2533f6 edit comments by authorid
References #385

Please test.
2016-02-03 16:28:58 +01:00
Ian ed37d4ba16 remove old Smarty @ array delimiter 2016-02-03 16:07:40 +01:00
Ian c2ff0e9ffa idents to source and remove old Smarty @ array delimiter
please test if remove of $item.ignore ionline display has side-effects
2016-02-03 16:03:29 +01:00
Ian c33790674a idents to source and remove old Smarty @ array delimiter
please test if added dir="{$CONST.LANG_DIRECTION}" has side-effects
2016-02-03 16:02:15 +01:00
Ian 1a99a8dd65 idents to source and remove old Smarty @ array delimiter 2016-02-03 15:54:16 +01:00
Ian 227d115d71 Fix missing perm checks for a "standard user" in MediaLibrary
We still have the issue that we have set authorID 0 as the standard authorid in ML. This prevents us being more strict than this.
We will have to re-think this, maybe...

References #385
2016-02-03 15:47:04 +01:00
Ian 3fe8959d00 Merge branch 'master' of github.com:s9y/Serendipity 2016-02-03 15:38:57 +01:00
Ian fb0fc710a3 fix possible Smarty exception 2016-02-03 15:38:26 +01:00
Don Chambers 47b0fc5219 Clean Blog: link to demo added to readme 2016-02-02 23:02:27 -06:00
Don Chambers c0ede6cf6a Clean blog theme minor revisions
Static page templates, archive page template, staticpage backend
template, font awesome upgrade
2016-02-02 14:02:34 -06:00
Ian 197edb2730 deployment files cleanup 2016-01-26 16:42:27 +01:00
Ian c29849f06a consistent plugin usage - bbcode
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:12:43 +01:00
Ian a8218e8de3 consistent plugin usage - creativecommons (event)
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:12:27 +01:00
Ian 4c9d8817b7 consistent plugin usage - emoticate
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:11:59 +01:00
Ian 8e899414fb consistent plugin usage - entryproperties
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:11:42 +01:00
Ian adfb3bc537 consistent plugin usage - gravatar
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:11:23 +01:00
Ian 34cefef45f consistent plugin usage - mailer
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:10:35 +01:00
Ian b73214abba consistent plugin usage - nl2br
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:10:11 +01:00
Ian 5dba47f945 consistent plugin usage - s9ymarkup
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:09:54 +01:00
Ian 1bf557e307 consistent plugin usage - spamblock
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:09:35 +01:00
Ian f94c85c8e1 consistent plugin usage - spartacus
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:09:15 +01:00
Ian 3d7b8fa803 consistent plugin usage - templatechooser (event)
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:08:53 +01:00
Ian a78094a7aa consistent plugin usage - textile
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:08:24 +01:00
Ian b386099b49 consistent plugin usage - xhtmlcleanup
this and followup commits touches:
    use load_languiage API
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:07:57 +01:00
Ian cc60537436 consistent plugin usage - archives
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:04:49 +01:00
Ian 23a0a76d93 consistent plugin usage - authors
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:04:31 +01:00
Ian 3f6ac66970 consistent plugin usage - calendar
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:03:55 +01:00
Ian 004a597837 consistent plugin usage - categories
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:03:34 +01:00
Ian 926da9c59a consistent plugin usage - comments
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:03:02 +01:00
Ian 99d488d1be consistent plugin usage - creativecommons (sidebar)
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:02:41 +01:00
Ian 0bcb16cc59 consistent plugin usage - entrylinks
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:02:04 +01:00
Ian 469b783b2c consistent plugin usage - eventwrapper
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:01:43 +01:00
Ian 6be46c890e consistent plugin usage - history
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:01:19 +01:00
Ian 812219e372 consistent plugin usage - html_nugget
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:00:39 +01:00
Ian 82e6d490b4 consistent plugin usage - plug (powered by)
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 14:00:15 +01:00
Ian 2db0531fa9 consistent plugin usage - quicksearch
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 13:59:14 +01:00
Ian d53c4c1ce9 consistent plugin usage - recententries
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 13:58:54 +01:00
Ian d4bfdd3039 consistent plugin usage - remoterss
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 13:58:35 +01:00
Ian f7bfa7123b consistent plugin usage - superuser
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 13:58:12 +01:00
Ian d2cdb8f2ba consistent plugin usage - syndication
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 13:57:13 +01:00
Ian 99ea373eb7 consistent plugin usage - templatedropdown
this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
2016-01-26 13:56:25 +01:00
Ian ff4b63ed14 mini ', ' space 2016-01-26 13:42:43 +01:00
Ian 1b67de854d fix nasty bug with high PHP versions
@garvinhicking
May this be the "real" cause of http://board.s9y.org/viewtopic.php?f=10&t=20639 ff, not loading the editor.js file? He is using PHP 5.6.17.
What I do not get on this: Why does this only happen with the Standard Editor on his site? And why does this not happen testing both groups to me locally with nearly the same PHP version?
2016-01-25 13:01:07 +01:00
Ian 1196bbe826 better use pre defined constant userlevel 2016-01-25 11:34:29 +01:00
Ian 8bf485fd1d extend comments and entries in Dashboard by userLevel
References #385

This still does not help with non-working button for the 'Standard Editor' (level 0).
2016-01-23 11:24:12 +01:00
Ian d8edd18c10 Fix show Dashboard entries by authors entries
References #385
and http://board.s9y.org/viewtopic.php?f=10&t=20639

We might need to extend this with user group policies (userlevel) - it depends on what we want to have here.
@garvinhicking
2016-01-22 19:47:09 +01:00
Ian 97c43af83e Fix Dashboard comments by authors entries
Closes #385
2016-01-22 18:29:49 +01:00
Ian 797da0eae1 remove $id header 2016-01-22 18:27:11 +01:00
Ian 00f5a6f940 that should be it with langs 2016-01-22 16:57:25 +01:00
Ian e51533bc31 lang tabs removal 2016-01-21 20:38:37 +01:00
Ian a9a22cce36 lang cleanup core templatedropdown plugin 2016-01-21 19:41:57 +01:00
Ian 1dfddafcf5 lang cleanup core remoterss plugin 2016-01-21 19:21:16 +01:00
Ian 801d47eb8d lang cleanup core recententries plugin 2016-01-21 19:17:45 +01:00
Ian b5d6fc0a39 lang cleanup core history plugin 2016-01-21 19:04:22 +01:00
Ian e8818b76d4 lang cleanup core eventwrapper plugin 2016-01-21 18:55:05 +01:00
Ian b19bd737d3 lang cleanup core entrylinks plugin 2016-01-21 18:52:52 +01:00
Ian 96316701e4 remove some \t 2016-01-21 18:46:50 +01:00
Ian 427d2d61c1 lang cleanup core plugin creativecommons plugin 2016-01-21 18:40:29 +01:00
Ian 2a733ffe17 lang cleanup core comments plugin 2016-01-21 18:32:30 +01:00
Ian b2257b7640 lang cleanup core xhtmlcleanup plugin 2016-01-21 18:21:39 +01:00
Ian 5c9714fa54 lang cleanup core textile plugin 2016-01-21 18:19:00 +01:00
Ian dfb036c7f2 lang cleanup core templatechooser plugin 2016-01-21 18:16:03 +01:00
Ian 1a0672cb78 lang cleanup core spartacus plugin 2016-01-21 18:13:20 +01:00
Ian 7cd98fb1f9 lang cleanup core spamblock plugin 2016-01-21 18:05:14 +01:00
Ian 363579c370 lang cleanup core s9ymarkup plugin 2016-01-21 18:00:22 +01:00
Ian 3fb15d74a8 lang cleanup core nl2br plugin 2016-01-21 17:57:19 +01:00
Ian 155de9a352 lang cleanup core mailer plugin 2016-01-21 17:55:15 +01:00
Ian b69ebc5c67 lang cleanup core gravatar plugin 2016-01-21 17:51:35 +01:00
Ian ff7ad0f287 lang cleanup core entryproperties plugin 2016-01-21 17:38:15 +01:00
Ian c6af20c86c lang cleanup core emoticate plugin 2016-01-21 17:35:25 +01:00
Ian 62c36fb1a0 lang cleanup core creativecommons plugin 2016-01-21 17:32:00 +01:00
Ian 6184480b06 lang cleanup core bbcode plugin 2016-01-21 17:27:49 +01:00
Ian e2ccf68c03 remove some wrong files and dirs
Will add this to the 202 upgrader task lists later, since there is more.
2016-01-21 17:21:19 +01:00
Matthias Mees 112f929814 Use msg class that actually exists in the stylesheet 2016-01-19 12:00:43 +01:00
Garvin Hicking 69d157062c Execute addlang 2016-01-18 09:40:09 +01:00
Eike Rathke 20f1ee4cef Merge pull request #1 from s9y/master
Merge s9y/Serendipity
2016-01-16 18:43:21 +01:00
onli a3f7958830 Style serendipity_die (fixes #89) 2016-01-15 16:50:15 +01:00
onli c98e858886 Prevent FF filling in wrong db password (#378) 2016-01-15 16:33:30 +01:00
onli 9fe8fb960b Add cache translation (#345) 2016-01-15 15:47:39 +01:00
onli 2d7947eb93 Add cache activation to configuration (closes #345) 2016-01-15 14:40:51 +01:00
onli 148e644590 Use CDATA for content in ATOM feed (#354) 2016-01-15 13:33:30 +01:00
onli 0003150796 Ajax ML upload died on non-images (fixes #353) 2016-01-15 13:28:49 +01:00
onli d4dbbe53af Restore update all plugins functionality (fixes #279) 2016-01-15 02:51:04 +01:00
onli 30982e446d Transform contextless strict/no-strict in ML
Follow up on d1baaf4983 and 7554623cff, also moving this to the extended filterset.
2016-01-15 02:18:34 +01:00
Don Chambers 6001a9aaf4 Remove Bootstrap reference to Twitter in news 2016-01-13 19:51:35 -06:00
Don Chambers 1935ae6979 Document addition of Clean Blog theme 2016-01-12 21:12:09 -06:00
Don Chambers 6029627a5f Initial commit of Clean-Blog theme 2016-01-12 10:33:24 -06:00
onli f67ba78513 Extend $uri-fix to serveCategories
Missed in 2cec984288
2016-01-12 13:41:51 +01:00
onli 2cec984288 Re-populate $uri variable (fix #381)
Fixes several possible routing bugs
2016-01-12 12:49:26 +01:00
Garvin Hicking fe90ba6b5d execute addlang.sh 2016-01-12 12:05:19 +01:00
Garvin Hicking c635de6e85 rework some constants to be added. @ophian ok like this? 2016-01-12 11:16:53 +01:00
Ian e6077f5ac7 nl2br - try to fix commit fe6fc9eb74
which accidently disabled nl2br to run true
2016-01-08 10:56:36 +01:00
onli d5398e4691 Move to -alpha3 to signal that the last security upgrade is integrated 2016-01-04 16:03:32 +01:00
Garvin Hicking d4be55a236 update 2016-01-04 11:14:58 +01:00
Garvin Hicking c16e034f7c XSS fix 2016-01-04 10:53:52 +01:00
Ian b98117f821 fix lang typo 2015-12-21 19:20:57 +01:00
Matthias Mees 5edc71f31a Upgrade admin backend's bundles Modernizr
- Add a few tests we will likely need in the future
- Remove version string from file name for easier upgrades

References #379
2015-12-21 18:36:52 +01:00
Ian 96a929df0b remove a strange double whopper ;-) 2015-12-20 20:18:42 +01:00
Ian a2fdadfaed add new config_separator class for some upcoming plugins 2015-12-20 17:57:53 +01:00
Ian 0692dfb67e add (temporary) 'suboption' separator markup to config item builder 2015-12-20 17:56:41 +01:00
Ian 7120d50bf6 add new 'suboption' ctype for plugins configs and fix misspelled separator ctype 2015-12-20 17:34:59 +01:00
Ian 0f12a87e31 fix 'backend_save' hooked script to only apply on save condition 2015-12-20 17:31:51 +01:00
Ian d38ea97fa4 fix serendipity_plugin_api_core_event_hook conditions 2015-12-20 17:29:18 +01:00
Ian 8897bf5e4d better change note 2015-12-20 17:28:01 +01:00
Ian 2a228f68cf fix typos, brackets, whitespaces 2015-12-20 17:26:56 +01:00
Ian 3eb59e9052 fix whitespaces and tabs 2015-12-20 17:23:11 +01:00
Matthias Mees 2c7cd731d9 Update bundled jQuery to 1.11.3 2015-12-18 11:57:15 +01:00
onli e128394360 Fill $uri variable in genpage for plugin pages (fixes #375) 2015-12-11 21:58:27 +01:00
Ian e672cf5350 fix typo 2015-12-11 17:10:57 +01:00
Ian cfa8d8ff6e document 2015-12-11 17:10:26 +01:00
Ian 7fe8d91bc2 fix checkbox entryproperties re-sets
References #260 and #261 and commit 8b51c37
Closes #376
2015-12-11 17:07:48 +01:00
Ian bb0bae1cd9 ML extended filters 2015-12-01 12:16:25 +01:00
Ian 90eed2d001 typos and minors 2015-12-01 12:12:01 +01:00
Ian 7fd42fde05 fix typo
there are more.... of this
2015-12-01 11:39:13 +01:00
Ian fe6fc9eb74 fix POST properties 'disable_markups' check(s)
see guestbook sidebar plugin and plugin_nugget_multilinugual
2015-12-01 11:35:48 +01:00
Ian 751840ba10 fix issue in atom 0.3
References #362 and a comment in 7760786e7efa72c2af4e6d68be54513cabde2a72#commitcomment-14125106
2015-11-02 13:39:44 +01:00
Matthias Mees 077425689d Fix overflowing tables in statistics plugin's backend
CSS-only solution which

a. reduces the font-size
b. makes the tables horizontally scrollable if they still overflow
   their parent container (see http://goo.gl/EquJxL)

References #373
2015-11-02 11:12:06 +01:00
Matthias Mees fa1ca78ea7 Merge pull request #372 from erAck/master
additional space in TopExits/Referrers for better word-wrap
2015-11-02 10:49:32 +01:00
Eike Rathke 6aae658e7f additional space in TopExits/Referrers for better word-wrap
There was no space between total value and next host, so display,
depending on available width, was

www.example1.com (12)www.example2.com
(23)www.example3.com (34)

With an additional trailing space after total it is

www.example1.com (12)
www.example2.com (23)
www.example3.com (34)
2015-11-01 22:56:01 +01:00
Ian 04104a3e4d Fixed media item delete handler
References #371
Closes #371
2015-10-31 14:10:52 +01:00
Ian 150d748c67 document note went into wrong line with 4a565a8 2015-10-30 17:05:36 +01:00
Ian 4a565a89da try catch mediaproperties thumb changing upload path only if in need 2015-10-30 16:50:40 +01:00
Ian a06e00d4af fix ML filter labels sort by desc 2015-10-30 15:56:38 +01:00
Ian 4420267709 fallback hidden fields for media in case of upload 2015-10-30 08:59:45 +01:00
Ian cde889101b fixes set cookie for name and path
Was removed accidently ...
2015-10-30 08:47:49 +01:00
Ian 897337cb8e allow array items for SetCookie and now use a ML-Filter cookie
(We will have to decide before release, if we want to keep this, though.)
2015-10-29 12:08:33 +01:00
Ian 98acb4963d better selector for c7e6e6b 2015-10-28 19:32:41 +01:00
Ian c7e6e6be8d size media date filter input fields to show up inlined 2015-10-28 17:41:35 +01:00
Ian f0268dabb0 add date placeholders to ML filters 2015-10-28 17:34:19 +01:00
Ian 609332a03a fix media selector margin 2015-10-28 17:30:55 +01:00
Ian c3273fba0d add reset for ML filters and orders 2015-10-28 17:28:32 +01:00
Ian 0905633810 fix f2f4855 2015-10-28 14:03:36 +01:00
onli 3391f5946e Document index.php refactoring
see 4f2ea4de8a
2015-10-28 13:54:27 +01:00
onli 73e15645d6 Merge branch 'feature_indexCleanup' 2015-10-28 12:30:56 +01:00
onli 4d7b90af99 Merge branch 'master' into feature_indexCleanup
Conflicts:
	index.php
2015-10-28 12:29:44 +01:00
Ian 1965d2d419 fix media.filter and media.sortorder param 2015-10-28 11:55:46 +01:00
Ian f2f4855ed7 fix ML Filter doubled filename
References #356
Closes #369
2015-10-28 11:42:33 +01:00
Ian ee1e567503 remove default case only path restoreVar
this is now done where it is actually needed
2015-10-28 11:36:50 +01:00
Ian d1baaf4983 better listen on toggle_dir and remember 2015-10-26 11:36:57 +01:00
Ian 52730e6b0e disable unused button generation
We may decide to keep this disabled or remove it completely later on
2015-10-26 10:18:50 +01:00
Ian 26d18490d4 avoid doubled GET token and fill form_hidden only in case default 2015-10-26 10:15:57 +01:00
Ian b0e4a4e6f5 remove deprecated $HTTP_SERVER_VARS vars 2015-10-20 18:04:02 +02:00
Ian dd4371a97c do not use pre-selected for movable selection 2015-10-20 13:25:42 +02:00
Ian a7732eeb81 minors 2015-10-20 13:24:50 +02:00
Ian 715d8cafa6 Optimize scaleImage returns 2015-10-19 13:21:19 +02:00
Ian ecd3ba5a10 fix missing ampersand in media resize uri for extraParems 2015-10-19 09:49:13 +02:00
Ian bb87f4dd6b make \b word-boundary not match named "example_-_Full.jpg" urls or string parts. 2015-10-18 13:21:21 +02:00
Ian 661f383edc typo 2015-10-17 19:48:27 +02:00
Ian afb4cdc685 better constant naming and new directory info constant 2015-10-17 19:43:09 +02:00
Ian 8fcf4cd652 fix commits renaming directories in 08c09d1 and 5be90fd 2015-10-17 19:27:58 +02:00
Ian 3030b80c2b fix rename media file reload issue
References #370

and allow better umlaut conversion

This is a plain javascript event, therefore the message and reload stuff had to move into the JS caller.
2015-10-17 15:03:15 +02:00
Ian 732d6067c3 restore last set directory path on mediaproperties submit 2015-10-17 13:47:36 +02:00
Ian 657db63432 add ML item date 2015-10-16 16:52:32 +02:00
Ian e251e5e509 fix popuplayer_showUpload to better work with strict directory radio selection 2015-10-16 16:27:30 +02:00
Ian 0d7f8d474f multi delete/move - submit by name
fixes notice messages on POST
2015-10-16 11:22:25 +02:00
Ian 7801b33e35 fix 7554623 2015-10-15 19:11:45 +02:00
Ian 7554623cff Allow strict media directory selection by toggle filter 2015-10-15 18:43:01 +02:00
Ian d130dc729e bulkmove - prevent success reload to open itself,
the multidelete type again and end with MULTICHECK_NO_ITEM message.
2015-10-15 11:01:06 +02:00
Ian 92299999e7 bulkmove - return to last selected directory 2015-10-15 10:55:35 +02:00
Ian 8fb7d51106 add message to item properties done 2015-10-12 14:15:31 +02:00
Ian b3dc10cc7c allow item properties title to be long 2015-10-12 12:37:53 +02:00
Ian 471a4b15a8 do not multicheck on item properties page 2015-10-12 12:36:26 +02:00
Ian 0d75d4ff88 remove case properties 2015-10-12 11:58:45 +02:00
Ian 6777f89078 case add works with pure $showML only
on both moves and does not need a reload for any property changes, since not shown
2015-10-12 11:57:11 +02:00
Ian e987751b19 fix case add post adminSubAction properties
this redirect works
2015-10-12 11:52:05 +02:00
Ian 73c178a3ea fix directoryEdit save message event 2015-10-12 10:37:41 +02:00
Ian 08c09d1d65 do not error on directoryEdit save submit 2015-10-12 10:27:08 +02:00
Ian 5be90fd7ea another breaking printf 2015-10-12 10:24:43 +02:00
Ian 2878c154d6 document 2015-10-08 10:41:48 +02:00
Ian 2e43a9944e keep previous ML item name whitespace behaviour 2015-10-08 10:25:23 +02:00
Ian 4539ef8d9d dot is empty - fix 994161a 2015-10-07 11:35:03 +02:00
Ian 994161a0a2 better preserve directory seperators 2015-10-07 11:16:36 +02:00
Ian e2b6417bd2 extend 2b9a008 for both cases 2015-10-07 09:45:35 +02:00
Ian 2b9a008208 allow upload file real umlaut conversion and remove workaround 2015-10-07 09:37:44 +02:00
Ian 8c732e94ab some printf messages need to have the argument preprocessed
or change to echo with inner printf()

Before it broke like this:
`<span class="msg_notice"><span class="icon-info-circled"></span> <b>Größe von Vorsch.</span>
 ändern</b>` which is wrong
2015-10-06 16:23:40 +02:00
Matthias Mees e4d4b7118c Typographic "fix" for "to start"/"to end" icons
These appear larger than the left/right icons. Tweaking the font
size covers that up for the time being.
2015-10-06 13:52:57 +02:00
Matthias Mees 167cbdd17c Replace SVG icons with iconfont icons
See 2b610dc791
2015-10-06 13:40:06 +02:00
Matthias Mees e6bb6005ec New iconfont build
This adds new icons for "go to start" and "go to end".
2015-10-06 13:34:22 +02:00
Matthias Mees 40e9a5b7b3 Add Fontello config file
templates/2k11/admin/font/config.json can (and SHOULD) be imported
in fontello.com to recreate the 2k11 backend iconfont set. This is
necessary to make sure that icons can be added or removed without
losing any required icons.

I will add a GitHub wiki page later explaining how to add/remove
icons.
2015-10-06 13:08:46 +02:00
Ian b105caff07 rewrite constants first last
2b610dc791
2015-10-06 10:40:07 +02:00
Ian a9eb4be896 fix 7c21de8 re-add $ispOldFile 2015-10-06 10:27:41 +02:00
Garvin Hicking de82c49fb3 proposal of different wording, see github node to commit @2b610dc 2015-10-06 10:09:08 +02:00
Ian fdc7c089c2 umlaut conversion 2015-10-05 19:20:47 +02:00
Ian 2b610dc791 Add first and last pagination for entries and media items 2015-10-05 19:10:53 +02:00
Ian 7c21de8aa8 Allow bulk move ML items to Uploads Root too
Fixes many issues like for renaming files and subdir handling, database placements and other issues.
Structures case DIR, FILE and FILE vars for renaming, moving, select and replace.
Touches directoryEdit and mediaproperties related boundaries.
Adds better event messages, which fixes $ob_serendipity_moveMediaDirectory.
Extends and fixes media_items realname issues and changes the length of the item title to be as long as possible.
Added new constants to be executed to the lang files in near future, when some follow up commits have been added.
2015-10-05 18:19:09 +02:00
Ian d7b1e7d23d minor whitespace and code cleanup
and a small github docnote fix
and added a todo for transforming a filename into a valid  upload path
2015-09-30 11:22:37 +02:00
Ian 9e49ecc8c3 remove to API 2015-09-23 17:49:23 +02:00
Ian d9b48b8efe remove param $messages from showMediaLibrary
plus minors in prep for rename / bulkmove enhancement
2015-09-23 17:37:53 +02:00
Ian e1402db6cc remove trailing ampersand
plus minors in prep for bulkmove / rename enhancement
2015-09-23 17:21:38 +02:00
Ian 5c50484068 modernize media_items Smarty loops
We will need to check this again, since some ordermode items (mostly the bp.* ones), like bp.TITLE|COMMENTx|DATE break the flow or are not set right and need some conditional tweaks.
In special where the title is shown.

We may even add some more information bits to the item inform layer by condition.
Yeah, I know this would bite with smallscreens, but we could have this conditional too.
2015-09-23 17:11:53 +02:00
Ian 1e1e196e10 prepare for better readability in media_items
Smarty code lines need an extra line appended, when followed by html, to keep the indent in compiled source code
2015-09-23 16:43:41 +02:00
Ian 7ceb1a711e modernize media_pane Smarty loops
and add two additional div content blocks with class="popuplayer_showUpload" and class="media_library_pane"
fix some more indent
and set some code documentary to keep things clear

We will need to check this again, since some ordermode items (mostly the bp.* ones), like bp.TITLE|COMMENTx|DATE break the flow or are not set right and need some conditional tweaks.
2015-09-23 16:32:12 +02:00
Ian 3fca094dfa remove very old Smarty assignment 2015-09-23 14:06:22 +02:00
Ian 15dacd15ec prepare for better readability
Smarty code lines need an extra line appended, when followed by html, to keep the indent in compiled souce code.
Also some white space corrections
2015-09-23 13:12:38 +02:00
onli 4f2ea4de8a Revert "Remove calendar based entry overview"
This reverts commit 405847cac6.
2015-09-23 00:34:07 +02:00
onli 507dc05998 Revert "remove comments by author overview page"
This reverts commit c8b4faf93a.
2015-09-23 00:33:33 +02:00
Ian 40ea9d2dc0 better check with isset 2015-09-22 18:12:00 +02:00
Ian 03a94807eb remove $id$ 2015-09-22 18:11:28 +02:00
Ian d8a82090cb remove unvalid ending input tags 2015-09-20 15:08:32 +02:00
Ian 8ac718a606 fix wrong loop ending end
and reported a bug in upcoming smarty 3.1.28-dev https://github.com/smarty-php/smarty/issues/90

References #364
2015-09-19 10:36:00 +02:00
Ian 44d0be4604 more documentation 2015-09-16 15:56:43 +02:00
Ian 1508a0f53f document 2015-09-16 15:29:21 +02:00
Ian 61fe3e2bf9 Fix MediaLibrary objects not pass through into entryproperties CustomFields
and replaces some old "|@" Smarty 2 array "type hintings" to "|".

Also fixes the default fallback in default/admin/media_choose.tpl, which also missed the serendipity js namespace.

@yellowled Please trigger a default/admin/serendipity_editor.js run to fetch up with all latterly added changes.
2015-09-15 17:28:04 +02:00
Ian 72bfb9a515 mark var escaped 2015-09-14 18:18:51 +02:00
Ian 5a6e1868a8 fix wrong version requirement 2015-09-14 18:03:57 +02:00
Ian a10d9e4b80 Fixed preview of extended properties by 1.37 2015-09-14 18:02:02 +02:00
Ian 7760786e7e fix fatal error atom 1.0 issue
References #362
2015-09-07 10:49:39 +02:00
Ian f63d884cfe upgrader dead files and dirs
Is there more? Please add!
2015-09-05 12:43:39 +02:00
Ian 80716280a8 minors 2015-09-05 12:40:44 +02:00
Ian 44689dead7 fix moving path names and add quickblog entry support
moving ML items now supports changing path in imageselectorplus quickblog entries too
2015-08-29 19:57:18 +02:00
Ian a8d00a8080 typo 2015-08-29 19:53:50 +02:00
Ian f85f83c337 move cast 2015-08-29 19:53:38 +02:00
Ian c80fc3dff8 fix entry replacements on image MOVE
now matches thumbs too and tries to be as strict as possible and necessary fixing any move

Staticpages Dev will be fixed in v.4.51 for SP entries
2015-08-26 20:03:58 +02:00
Ian 300bdd6f5f Allow bulk image MOVE in ML
and give a path information note to the image info layer

References #357
2015-08-26 12:22:17 +02:00
Ian a3c567e864 fix more issues moving images (!)
1st - case 'filedir' moving via image properties missed $renameValues['file'] array $pick
2cd - case 'file' moving mixed up rename() of thumbs completely
3rd - added new success message for case 'filedir' image properties move
4th - fixed markup for some more messages
2015-08-26 11:57:49 +02:00
Ian 13616f49f3 fixed new path on file move 2015-08-25 19:09:02 +02:00
Ian 3da11862c2 fix missing filename on MOVE and set correct icon font name 2015-08-25 18:19:43 +02:00
Ian 4c94dcba5c Theme emoticons do not need a fallback into another theme 2015-08-19 19:51:56 +02:00
Ian df17a410b0 fix eraseEntryEditorCache
remember, this is preview_iframe.tpl updertHooks IFRAME and may not be jQuery based

References #343
2015-08-18 11:33:04 +02:00
Ian ea08cd429a isset and true 2015-08-17 17:26:13 +02:00
Ian a0527ca81b fix some undefined indexes 2015-08-17 17:19:48 +02:00
Ian a5d5e7d940 the jquery check does not want to iterate a fallback
References #343
2015-08-16 18:32:02 +02:00
Ian d5eae21a9c suggested fix for the Serendipity fallback chaining
This fixes the plugin tpl fallback for all plugins, already using the parseTemplate() method. All others, which may still follow the themes fallback (like contactform etc), would need to always be part of the user template $serendipity['template'], or be fixed later on.

This also fixes the backend chaining, which now simply follows the force with a possible engine and then uses $serendipity['template_backend'] (2k11), $serendipity['defaultTemplate'] (2k11), 'default'.

As a third, this now uses the correct preview_iframe.tpl file on save and checks for a correct set jquery_backend.js in the user theme $serendipity['template'].

Please double check this approach for cases I did not find yet. Thanks! :)


References #343
2015-08-16 18:05:59 +02:00
Ian 6b9f08a1fe minor 2015-08-16 17:34:21 +02:00
Ian ce8917d3a0 one more for d05ae52 2015-08-16 10:28:46 +02:00
Ian d05ae52575 lang corrections 2015-08-16 09:35:26 +02:00
Ian 72bcd36ef1 fix missing @ and change a german config constant 2015-08-15 16:46:08 +02:00
Ian 8b8dcfd968 minors 2015-08-15 16:44:45 +02:00
Ian d0994583ce better Smarty debug pop up 2015-08-15 16:44:27 +02:00
Ian 0047140dcc set use_autosave in backend only 2015-08-14 18:15:31 +02:00
Ian 56b26f7120 disable Smarty like CKEDITOR (procurator) protection 2015-08-14 18:11:39 +02:00
Ian 5934095301 document a9b3c01 2015-08-07 16:04:14 +02:00
Ian 86b6c8ce49 entries inc event fetch fixes
fix iframe returning 1, when true and
add a new language const change msg, instead of the wrongly used save message
2015-08-07 15:55:18 +02:00
Ian c65c9e786f cleanup 2015-08-07 15:46:36 +02:00
Ian 67bfde277a do not add newline after php closing tag 2015-08-07 15:46:17 +02:00
onli 55ae435c89 remove multi-author option, broken
Probably broken since many many s9y versions, but certainly not working in 2.0
2015-07-26 22:57:29 +02:00
onli c8b4faf93a remove comments by author overview page
Not used by known themes, not properly documented
2015-07-26 20:10:40 +02:00
onli d0dc9da015 remove archive permapath
extends 405847cac6
2015-07-26 20:08:32 +02:00
onli 405847cac6 Remove calendar based entry overview
Should be moved to a plugin
2015-07-26 19:48:16 +02:00
onli 7e03be6930 Fix archive page 2015-07-26 19:29:12 +02:00
onli 180e110f50 remove autosave url param 2015-07-26 19:23:41 +02:00
onli fd3498a1f8 collect locateHiddenVariables in one function 2015-07-26 19:17:52 +02:00
onli fcab850687 remove unused pregenerate entry function 2015-07-26 18:37:45 +02:00
onli 4bb10f5b70 Remove NO_EXIT constant
Only used in the freetag-plugin, which could just omit it and rely on the core to call smarty
2015-07-26 18:21:54 +02:00
onli 6c561a6875 fix multi_cat, remove track_referrer 2015-07-26 18:15:22 +02:00
onli 3f645612e0 remove time_used function
Let us use a proper profiler or #187 instead
2015-07-26 18:03:19 +02:00
onli 6fd7dcc3b5 Remove unused X-Blog header 2015-07-26 18:01:50 +02:00
onli 3e7f521936 remove raw_data 2015-07-26 17:55:48 +02:00
onli 9173e046e5 start indexCleanup: move code to functions_routing 2015-07-26 17:53:49 +02:00
Matthias Mees 517a3c4dfe A more bulletproof fix for the dashboard update notification
References #359
2015-07-25 14:34:26 +02:00
Matthias Mees b5a5b0a996 Fix breaking layout in dashboard if update notification exists
References #359
2015-07-25 14:30:15 +02:00
Garvin Hicking e6ae8f0920 fix date 2015-07-24 14:02:03 +02:00
Garvin Hicking 6cd46eed6b Merge branch 'master' of github.com:s9y/Serendipity
Conflicts:
	docs/NEWS
2015-07-24 13:28:13 +02:00
Garvin Hicking 00be5d7b4c Security fixes from Tim Coen (file upload, comment token escaping, 2k11 js comment name escaping) 2015-07-24 13:27:21 +02:00
Ian 0a72ce8c19 upport d8644b0 document last changes 2015-07-23 16:39:26 +02:00
Matthias Mees c4f9b721e7 Apply filter_pane label spacing for all filter_pane instances
References #356
2015-07-14 19:54:10 +02:00
Matthias Mees b9d1fa38c9 Make sure the label spacing applies to filters and sort
References #356
2015-07-14 19:48:42 +02:00
Matthias Mees b00343d24d Also fix labels for selects
References #356
2015-07-14 19:46:47 +02:00
Matthias Mees b9b55142fc Fix CSS regressions introduced by aaca8e
References #356
2015-07-14 19:45:12 +02:00
Matthias Mees aaca8eda3b Minor layout fixes for media DB media filters
References #356
2015-07-14 19:41:01 +02:00
Ian 8954e6ec7e move maintenance hook to end
since else it will size every box within "equal_heights" blocks.
Best experience with set down to end of list, keeping the thumbs block before.
2015-07-13 16:33:25 +02:00
Ian 7a6ab5fcf8 better doc 2015-07-13 16:23:00 +02:00
Ian c7d66927b2 document cke update 2015-07-13 16:14:52 +02:00
Ian 32769998df bugfix ckeditor releases
Added widget, lineutils, fakeobjects and S9y plugins cheatsheet and procurator Plugins.
Removed "samples" dir and plugin "dev" dirs in lineutils and widget
2015-07-13 16:08:13 +02:00
Ian 613119e964 typo 2015-07-13 15:31:22 +02:00
Ian 5de0eb4c80 change autoParagraph 2015-07-13 15:00:26 +02:00
Ian 43fb606b3c note 2015-07-13 14:35:19 +02:00
Ian 86ab8c62b1 uff 2015-07-13 14:34:57 +02:00
Ian e6cab58414 change SET NAMES to mysqli_set_charset and fix a bug in 2cd condition 2015-07-09 12:33:31 +02:00
Ian 2f06e28f23 use recommended mysqli_set_charset 2015-07-08 11:01:20 +02:00
Ian 9efb1665ad fix missing db object 2015-07-07 18:01:10 +02:00
Ian 755fe60075 check array to avoid errors 2015-07-07 09:36:46 +02:00
Garvin Hicking 2e63945f60 Merge pull request #352 from smoeding/stm/fix-db-query_quoting
Fix column quotes for INSERT statement
2015-07-05 09:57:25 +02:00
Stefan Möding 241f223536 Fix column quotes for INSERT statement 2015-07-04 21:07:43 +02:00
Ian 13775ba4b2 fix mysqli importer conversion param order change 2015-07-04 11:11:11 +02:00
Ian 1dcab7a7e6 document 2015-07-03 17:34:38 +02:00
Ian c6031dc1dc remove $Ids$ 2015-07-03 17:18:23 +02:00
Ian 4a0c591657 fix importers to use new mysqli API extension
References http://board.s9y.org/viewtopic.php?f=10&t=20421

Is somwone able to test this here and there?
2015-07-03 17:14:29 +02:00
Ian c94d8fa93b add windows note for dateformat to get a result 2015-06-30 14:45:58 +02:00
Ian 14d06815b7 fix german lang constant 2015-06-30 12:12:41 +02:00
Ian 0d5d67b20e fix one line per constant and remove $Id$ 2015-06-30 12:10:38 +02:00
garvinhicking 531ccfc0a0 Remove bad ":" which messes up concatenation of constants that already have punctuation 2015-06-30 11:05:26 +02:00
Garvin Hicking 64f32ef864 Fixes Issue #350
Make sure to put user.css after plugin output so that it can override it.
2015-06-26 12:59:52 +02:00
Ian 49ed5fcc42 minor adjustment 2015-06-18 13:51:01 +02:00
Ian 4ecb13a3be document 2015-06-18 13:21:46 +02:00
Ian a7d4e0111d Smarty upgrade 3.1.27 2015-06-18 13:20:50 +02:00
Matthias Mees a148f7b227 It's really hard to find out when it's 72 characters ...
References #348
2015-06-17 21:32:16 +02:00
Matthias Mees ce57ec8a38 Reformat NEWS
Everyone, it's FOUR SPACES from now on. NOT three. :)

References #348
2015-06-17 21:26:12 +02:00
Matthias Mees da635a0ebe Minor formatting
References #348
2015-06-17 21:00:06 +02:00
Matthias Mees 995917db93 Move more old news to NEWS_OLD
References #348
2015-06-17 20:32:16 +02:00
Matthias Mees 0d71cac44a Properly limit basic docs' line length (72 chars)
References #348
2015-06-17 20:26:06 +02:00
Ian 171a501cb5 correct 0a1cb87 2015-06-17 10:13:50 +02:00
onli bb2c5a63d0 Cleanup syndication fixed (#285)
cleans 97d9f5ce31
2015-06-16 21:56:04 +02:00
Garvin Hicking fbc8e55d09 new lang constant 2015-06-16 12:54:34 +02:00
Ian 0a1cb87151 prep for downgrade of Smarty update 2015-06-16 12:37:08 +02:00
Ian b19d6137fb Smarty bugfix releases, since last upgrade, to 3.1.25
Will now compile vastly better!

Please read change_log.txt and NEW_FEATURES.txt

We may want to use some of these new features in 2.1, which briefly are about:
Namespace support within templates, Security, Compiled Templates, Debugging
2015-06-16 12:28:49 +02:00
Ian 25e374848f add new syndication constant
I assume we can live with it, doing this to 2.1 only
@garvinhicking please submit
2015-06-16 11:45:03 +02:00
Ian 97d9f5ce31 upport syndication fixes 2015-06-16 11:38:58 +02:00
Matthias Mees 94f99a9ce2 Document select theme changes
References #347
2015-06-15 18:33:23 +02:00
Matthias Mees 28d00949f4 Suppress install backend button if frontend theme == backend theme
References #347
2015-06-13 09:15:51 +02:00
Matthias Mees 1c33d93a18 Add 'install backend' button to selected frontend theme
References #347
2015-06-13 09:11:17 +02:00
Ian e78648b8c7 document 3b6d12c 2015-06-03 10:40:18 +02:00
Ian 3b6d12ce2d fix user.css auto include 2015-06-02 16:53:25 +02:00
Ian 1b1a130e38 document better multiple nugget example gratia plugin
contactform will probably change, when this fixes are out.
2015-06-01 16:51:28 +02:00
Ian eaee2d1f3a remove unused select debug code
fit linebreaked and param whitespaces
2015-06-01 15:10:47 +02:00
Ian 1e6fda11e7 emit multiple nuggets for core JS-Editor
and only use Spawnnuggets if exist.

This is for multi-nugget-textareas, not using the wysiwyg* event hooks, eg contactform plugin < v.1.17
2015-06-01 14:34:18 +02:00
Ian f38d72dec5 document includeentry widget source protection 2015-06-01 12:41:08 +02:00
onli 206dc56cab document internal_cache option (#345) 2015-05-31 14:08:16 +02:00
onli 0125f1539e Use internal cache to speedup printEntries & fetchEntries (#345) 2015-05-30 01:23:57 +02:00
Garvin Hicking 5056cd6409 added ifModule checks 2015-05-22 09:40:00 +02:00
Matthias Mees 780b7166b8 Remove default style on footer i element in 2k11
To make the theme name stand out less, but still have the semantic
value of the i element.
2015-05-19 19:20:40 +02:00
Matthias Mees 9715fe4b94 Remove repository link from 2k11's footer
The 2k11 repository has been discontinued since the theme was
moved to the s9y core. It should no longer endorse the old and
outdated repository by linking to it.
2015-05-19 19:13:25 +02:00
onli 194e08b669 Add primary key to some tables (#341)
groupconfig, config, options
2015-05-10 16:56:29 +02:00
Matthias Mees ca30b24f75 Next: Improve display of meta data on static pages 2015-05-07 19:18:05 +02:00
Ian e4eb9a0d1f allow ckeditor use span element markup 2015-05-06 18:55:20 +02:00
Ian ffa6493677 textarea.cke_source patch needs to support webkit for html nugget plugins too 2015-05-05 17:02:06 +02:00
Ian a1854d4567 disable unused var 2015-05-01 14:29:09 +02:00
Ian e5f1364bda add another removed file to upgrader 2015-05-01 12:40:12 +02:00
Garvin Hicking 1712d9bb5b use ssl when called, thanks to hboeck! 2015-04-17 15:36:54 +02:00
onli 90a4b95b61 Move showMediaToolbar to 1. personal settings, add docu (#281) 2015-04-04 17:32:21 +02:00
Garvin Hicking 6fdde3a251 remove file in array 2015-04-01 12:22:57 +02:00
Garvin Hicking 2616671c6e remove uneccesary file 2015-04-01 12:09:42 +02:00
Garvin Hicking 8112c39485 fix templatechooser to not apply theme in backend
Conflicts:
	docs/NEWS
	index.php
2015-04-01 12:02:54 +02:00
Ian c786d457a7 single plugin textarea moz source styles 2015-03-31 16:58:37 +02:00
Ian 590d2d88ae better cke source moz style 2015-03-31 12:19:45 +02:00
Matthias Gutjahr 980c304629 Merge pull request #336 from th-h/patch-1
Really fix concatenation of entry body for full feed
2015-03-30 13:15:24 +02:00
Thomas Hochstein 63786a41c2 Really fix concatenation of entry body for full feed
Commit 70c4ce8e40 will need double quotes around \n ...

See #335 for context.
2015-03-29 21:50:52 +02:00
Matthias Gutjahr 70c4ce8e40 Fix concatenation of entry body for full feed
When requesting a (RSS) feed response, the extended body is added to the entry body. The separating charcter has been changed from a space to a newline because some plugins like Markdown or Textile could not parse the first line of the extended body correctly.

Fixes: #335
Related: http://board.s9y.org/viewtopic.php?f=10&t=20331
2015-03-29 21:11:18 +02:00
Garvin Hicking b55d8a26f2 Document 2015-03-27 10:33:11 +01:00
onli b73eb367f2 Prevent negative offset (#321) 2015-03-27 00:00:10 +01:00
onli 9032f24f4b Show rescale in ML-popup when toolbar is active (#281) 2015-03-26 23:55:22 +01:00
Garvin Hicking 5985577fbe Use "secure" flag on SSL connections, thanks to dayton967 2015-03-22 00:41:37 +01:00
Garvin Hicking e7d822be11 Things I noticed for s9y.github.io 2015-03-19 16:17:30 +01:00
Garvin Hicking 5f14b67e66 Things I noted during configuration 2015-03-19 16:08:39 +01:00
Ian 222cfe5c16 better moz cke source styles 2015-03-18 19:00:14 +01:00
Garvin Hicking 93e781048c * Make preview_iframe.tpl template files load the proper frontend
CSS file, including cache-busting version string when changing
     themes

References #302
2015-03-18 13:32:14 +01:00
Ian 8b863d5370 fix 2.0.2 upgrader resting dirs removal 2015-03-17 08:39:02 +01:00
Garvin Hicking 2970ac60a6 patch by @fugue88 for shared installs
references #328
2015-03-16 17:44:57 +01:00
Garvin Hicking 0fd299adf2 Merge branch 'master' of github.com:s9y/Serendipity 2015-03-16 17:42:44 +01:00
Garvin Hicking 5398e2f72a Let spartacus hook into cronjob plugin to mail plugin update notifications 2015-03-16 17:42:22 +01:00
Matthias Mees 6175559fda Change theme demo link to theme demo button
References #314
2015-03-16 17:03:11 +01:00
Matthias Mees d41d949642 Suppress emitting quicksearch plugin in sidebar
Next has a quicksearch widget in the header already.
2015-03-16 16:46:27 +01:00
garvinhicking 0cce92d4d7 Add ability to preview demo themes in spartacus. 2015-03-16 14:31:34 +01:00
Garvin Hicking 9278c9e40c * Allow templatechooser plugin to read a custom "blacklist.txt"
within its directory, that can blacklist certain themes from
     being selected.
2015-03-16 14:13:55 +01:00
Garvin Hicking 98cd0e0541 fix 2015-03-16 14:07:24 +01:00
Garvin Hicking 5f59a811e8 Allow to set custom cookie validity.
Will be needed for blog.s9y.org templatechooser, which is why I need it in 2.0.1
2015-03-16 13:58:52 +01:00
Ian 104122925b fix slash 2015-03-16 12:33:25 +01:00
Ian 31e58ff044 some more dead removals 2015-03-16 12:29:17 +01:00
Garvin Hicking 6b81f519e7 Also add a var for comments limit 2015-03-16 11:14:27 +01:00
Ian 72f316712b fix cke_source code linebreak view for Mozillas 2015-03-16 11:08:42 +01:00
Garvin Hicking 872d978d63 Added config vars to influence dashboard limit
http://board.s9y.org/posting.php?mode=quote&f=10&p=10442506
2015-03-16 10:47:56 +01:00
Garvin Hicking 863db549f7 Add a space when styling is missing to not clutter output 2015-03-16 10:46:53 +01:00
Garvin Hicking c249403c16 * Adapt .htaccess profile of "mod_rewrite for 1&1 and problematic
servers" to not include the "Options -MultiViews" option, since
     this is often blocked
2015-03-16 10:16:35 +01:00
Ian 325ea6de7b Revert "fix strange PHP parse error on subdomain usage"
This reverts commit ffe581225c.
2015-03-15 13:00:18 +01:00
Ian 2947081b41 Revert "document"
This reverts commit c705dddf8d.
2015-03-15 12:59:47 +01:00
Ian c705dddf8d document 2015-03-15 11:27:55 +01:00
Ian ffe581225c fix strange PHP parse error on subdomain usage
preventing ckeditor to load the resource and itself.

console errors like:
ckeditor.js:77 GET http://sub.domain.org/htmlarea/ckeditor/ckeditor/plugins/procurator/plugin.js?t=F0RD
ckeditor.js:226 Uncaught [CKEDITOR.resourceManager.load] Resource name "procurator" was not found at "http://sub.domain.org/htmlarea/ckeditor/ckeditor/plugins/procurator/plugin.js?t=F0RD".

server error.log like:
[Sun Mar 15 10:34:32 2015] [error] [client 1.2.3.4] PHP Parse error:  syntax error, unexpected '{' in /var/www/domain.org/html/sub/htmlarea/ckeditor/ckeditor/plugins/procurator/plugin.js on line 129, referer: http://sub.domain.org/serendipity_admin.php?serendipity[adminModule]=entries&serendipity[adminAction]=new

Why does PHP read/parse js files?
Why does it not respect // notes, nor /* notes */ in this case?

Might that be because Chrome says to all available loading js resources in Serendipity "Resource interpreted as Script but transferred with MIME type text/html" ???
2015-03-15 11:23:23 +01:00
onli 27cf643135 Show ML toolbar when inserting image (#281)
This commit has two parts: First, media_items was changed to show (parts) of the image toolbar also when being in the editor popup, if the option is enabled. Second, it modifies the rename and the delete button of that toolbar to use ajax, because they otherwise would return to the normal ML. TODO1: Ajaxify the rescale function as well, or make it redirect properly, so the button can be enabled. TODO2: See if the code in media_items can be simplified, it is a dumb translation of the existing approach
2015-03-14 22:02:49 +01:00
onli 73dc7a9225 ML: Show add-button in popup also when empty 2015-03-14 19:42:42 +01:00
Matthias Mees 9ad1dd9312 Add SEO meta elements to core templates
References #310
2015-03-14 12:41:56 +01:00
Garvin Hicking 88a4776891 Fix not initializing smarty framework in the preview iframe, which lead to templates
config.inc.php files not being loaded (to hook into a config.inc.php)
2015-03-13 15:37:10 +01:00
Garvin Hicking 8f88998c90 only show relative dir 2015-03-13 15:03:00 +01:00
Ian 7c7dc58665 fix wrong upgrade removal of dead files with 2.0.1 update 2015-03-13 12:47:20 +01:00
Garvin Hicking 1062145b49 next ver 2015-03-12 20:35:12 +01:00
Garvin Hicking 0eab8c6efa release 2015-03-12 20:28:55 +01:00
Garvin Hicking 820ccc4709 document 2015-03-12 20:17:14 +01:00
Garvin Hicking 7c51555438 Modify if-statement
References #324
2015-03-12 20:13:01 +01:00
Matthias Mees cabad4a933 Escape entry title in dashboard
References #322
2015-03-12 19:03:42 +01:00
Ian f800305abe remove files actually listed to get removed
extends a2c7761
2015-03-12 17:37:19 +01:00
Garvin Hicking 94eb2b32de We also need to escape the JS at this point 2015-03-12 12:23:52 +01:00
Ian 18bdf03623 remove references for serendipity_define.js(+.php) 2015-03-12 12:10:13 +01:00
Ian a2c77619dc extend 2.0.1 removal list
see 5ee05f1143 and 441bb6d56f (comments)
2015-03-12 12:01:43 +01:00
Garvin Hicking f5669177de Unify gravatar 2015-03-12 10:46:57 +01:00
Garvin Hicking b76e117366 Unify gravatar 2015-03-12 10:46:34 +01:00
Garvin Hicking bdd6c4fb17 Fix missing escaping (possible XSS) of category names in the Backend
Entry Admin, which would allow editors that create a forged
category name to attack other editors in the backend (privileged
access to the backend required).
Thanks a lot to Edric Teo for reporting this issue.
2015-03-12 10:16:59 +01:00
Matthias Mees d84cd93c57 Remove legacy CSS for template_preview 2015-03-11 17:50:43 +01:00
Garvin Hicking 5ee05f1143 We don't really need those files anymore. 2015-03-09 10:16:45 +01:00
onli 75397c7d47 Remove $p == 1 search wildcard requirement (#309)
The bug meant to be fixed in https://github.com/s9y/Serendipity/commit/51208e0f726cfc3a7b65360be6a58a5fcd1c3968#diff-cbbd600f627a5af39c73092fbc3fbf46 is not reproducible anymore
2015-03-07 11:55:37 +01:00
Garvin Hicking 811af79b16 should be truncated 2015-03-02 12:31:46 +01:00
Garvin Hicking 12ddca1070 Upport.
Improved detection for possible javascript errors (i.e. PHP errors, plugins that use invalid PHP 5.4+ syntax, other causes - that people seem to hit a lot)
If the serendipity.spawn function could not be found, we emit a warning (through javascript...)

See thread on forums: http://board.s9y.org/viewtopic.php?f=11&t=20286

Conflicts:
	docs/NEWS
	lang/UTF-8/plugin_lang.php
	lang/UTF-8/serendipity_lang_bg.inc.php
	lang/UTF-8/serendipity_lang_cn.inc.php
	lang/UTF-8/serendipity_lang_cs.inc.php
	lang/UTF-8/serendipity_lang_cz.inc.php
	lang/UTF-8/serendipity_lang_da.inc.php
	lang/UTF-8/serendipity_lang_de.inc.php
	lang/UTF-8/serendipity_lang_en.inc.php
	lang/UTF-8/serendipity_lang_es.inc.php
	lang/UTF-8/serendipity_lang_fa.inc.php
	lang/UTF-8/serendipity_lang_fi.inc.php
	lang/UTF-8/serendipity_lang_fr.inc.php
	lang/UTF-8/serendipity_lang_hu.inc.php
	lang/UTF-8/serendipity_lang_is.inc.php
	lang/UTF-8/serendipity_lang_it.inc.php
	lang/UTF-8/serendipity_lang_ja.inc.php
	lang/UTF-8/serendipity_lang_ko.inc.php
	lang/UTF-8/serendipity_lang_nl.inc.php
	lang/UTF-8/serendipity_lang_no.inc.php
	lang/UTF-8/serendipity_lang_pl.inc.php
	lang/UTF-8/serendipity_lang_pt.inc.php
	lang/UTF-8/serendipity_lang_pt_PT.inc.php
	lang/UTF-8/serendipity_lang_ro.inc.php
	lang/UTF-8/serendipity_lang_ru.inc.php
	lang/UTF-8/serendipity_lang_sa.inc.php
	lang/UTF-8/serendipity_lang_se.inc.php
	lang/UTF-8/serendipity_lang_sk.inc.php
	lang/UTF-8/serendipity_lang_ta.inc.php
	lang/UTF-8/serendipity_lang_tn.inc.php
	lang/UTF-8/serendipity_lang_tr.inc.php
	lang/UTF-8/serendipity_lang_tw.inc.php
	lang/UTF-8/serendipity_lang_zh.inc.php
	lang/addlang.txt
	lang/plugin_lang.php
	lang/serendipity_lang_bg.inc.php
	lang/serendipity_lang_cn.inc.php
	lang/serendipity_lang_cs.inc.php
	lang/serendipity_lang_cz.inc.php
	lang/serendipity_lang_da.inc.php
	lang/serendipity_lang_de.inc.php
	lang/serendipity_lang_en.inc.php
	lang/serendipity_lang_es.inc.php
	lang/serendipity_lang_fa.inc.php
	lang/serendipity_lang_fi.inc.php
	lang/serendipity_lang_fr.inc.php
	lang/serendipity_lang_hu.inc.php
	lang/serendipity_lang_is.inc.php
	lang/serendipity_lang_it.inc.php
	lang/serendipity_lang_ja.inc.php
	lang/serendipity_lang_ko.inc.php
	lang/serendipity_lang_nl.inc.php
	lang/serendipity_lang_no.inc.php
	lang/serendipity_lang_pl.inc.php
	lang/serendipity_lang_pt.inc.php
	lang/serendipity_lang_pt_PT.inc.php
	lang/serendipity_lang_ro.inc.php
	lang/serendipity_lang_ru.inc.php
	lang/serendipity_lang_sa.inc.php
	lang/serendipity_lang_se.inc.php
	lang/serendipity_lang_sk.inc.php
	lang/serendipity_lang_ta.inc.php
	lang/serendipity_lang_tn.inc.php
	lang/serendipity_lang_tr.inc.php
	lang/serendipity_lang_tw.inc.php
	lang/serendipity_lang_zh.inc.php
2015-03-02 11:16:55 +01:00
Matthias Mees 6954db1843 Substitute inline styles with plainList class in syndication list
References #285
2015-02-23 23:46:14 +01:00
onli e31078615b syndication: fix syntax error from ac7c8c0716 2015-02-23 23:19:22 +01:00
onli ac7c8c0716 syndication: fix rel-url bug and enable plain textlink (#285) 2015-02-23 22:04:33 +01:00
Matthias Mees b5b28450f3 Remove legacy div + styles from 2k11's preview
References #307
2015-02-22 21:13:09 +01:00
Matthias Mees 18f75f5e7c Document extra localStorage test
References #306
2015-02-18 15:27:01 +01:00
Matthias Mees e932ad78b0 Add extra test for localStorage
localStorage may be deactivated by setting a config option or using
security-related extensions at least in some browsers, which might
(at least in FF) break backend JS functionality.

So we need an extra check if localStorage is null.

References #306
2015-02-17 18:22:58 +01:00
onli e7502ef9bc manually restore from before merge
The merge in 7740886ff9 accidentally overwrote changes that were important. This commit tries to restore them while also keeping the additions from feature_updateAll.
2015-02-15 20:04:33 +01:00
onli 7740886ff9 Merge branch 'feature_updateAll'
Conflicts:
	docs/NEWS
	lang/UTF-8/plugin_lang.php
	lang/UTF-8/serendipity_lang_bg.inc.php
	lang/UTF-8/serendipity_lang_cn.inc.php
	lang/UTF-8/serendipity_lang_cs.inc.php
	lang/UTF-8/serendipity_lang_cz.inc.php
	lang/UTF-8/serendipity_lang_da.inc.php
	lang/UTF-8/serendipity_lang_de.inc.php
	lang/UTF-8/serendipity_lang_en.inc.php
	lang/UTF-8/serendipity_lang_es.inc.php
	lang/UTF-8/serendipity_lang_fa.inc.php
	lang/UTF-8/serendipity_lang_fi.inc.php
	lang/UTF-8/serendipity_lang_fr.inc.php
	lang/UTF-8/serendipity_lang_hu.inc.php
	lang/UTF-8/serendipity_lang_is.inc.php
	lang/UTF-8/serendipity_lang_it.inc.php
	lang/UTF-8/serendipity_lang_ja.inc.php
	lang/UTF-8/serendipity_lang_ko.inc.php
	lang/UTF-8/serendipity_lang_nl.inc.php
	lang/UTF-8/serendipity_lang_no.inc.php
	lang/UTF-8/serendipity_lang_pl.inc.php
	lang/UTF-8/serendipity_lang_pt.inc.php
	lang/UTF-8/serendipity_lang_pt_PT.inc.php
	lang/UTF-8/serendipity_lang_ro.inc.php
	lang/UTF-8/serendipity_lang_ru.inc.php
	lang/UTF-8/serendipity_lang_sa.inc.php
	lang/UTF-8/serendipity_lang_se.inc.php
	lang/UTF-8/serendipity_lang_sk.inc.php
	lang/UTF-8/serendipity_lang_ta.inc.php
	lang/UTF-8/serendipity_lang_tn.inc.php
	lang/UTF-8/serendipity_lang_tr.inc.php
	lang/UTF-8/serendipity_lang_tw.inc.php
	lang/UTF-8/serendipity_lang_zh.inc.php
	lang/addlang.txt
	lang/plugin_lang.php
	lang/serendipity_lang_bg.inc.php
	lang/serendipity_lang_cn.inc.php
	lang/serendipity_lang_cs.inc.php
	lang/serendipity_lang_cz.inc.php
	lang/serendipity_lang_da.inc.php
	lang/serendipity_lang_de.inc.php
	lang/serendipity_lang_en.inc.php
	lang/serendipity_lang_es.inc.php
	lang/serendipity_lang_fa.inc.php
	lang/serendipity_lang_fi.inc.php
	lang/serendipity_lang_fr.inc.php
	lang/serendipity_lang_hu.inc.php
	lang/serendipity_lang_is.inc.php
	lang/serendipity_lang_it.inc.php
	lang/serendipity_lang_ja.inc.php
	lang/serendipity_lang_ko.inc.php
	lang/serendipity_lang_nl.inc.php
	lang/serendipity_lang_no.inc.php
	lang/serendipity_lang_pl.inc.php
	lang/serendipity_lang_pt.inc.php
	lang/serendipity_lang_pt_PT.inc.php
	lang/serendipity_lang_ro.inc.php
	lang/serendipity_lang_ru.inc.php
	lang/serendipity_lang_sa.inc.php
	lang/serendipity_lang_se.inc.php
	lang/serendipity_lang_sk.inc.php
	lang/serendipity_lang_ta.inc.php
	lang/serendipity_lang_tn.inc.php
	lang/serendipity_lang_tr.inc.php
	lang/serendipity_lang_tw.inc.php
	lang/serendipity_lang_zh.inc.php
	templates/2k11/admin/style.css
2015-02-15 19:22:15 +01:00
Matthias Mees a7c2d5b868 Fix CSS regression due to markup changes in ddac2c
References #301
2015-02-13 20:05:12 +01:00
Matthias Mees ddac2c8048 Fix media chooser preview in theme options config group
Firefox-only bug if responsive img is a descendant of a fieldset.
Related to 67864f195f.

References #301
2015-02-13 19:42:09 +01:00
Matthias Mees ef068314cb Fix incomplete translation in Next theme 2015-02-12 22:15:19 +01:00
Matthias Mees 0e66dbd79a Remove user.css reference and theme options
Affected themes: bulletproof, 2k11, next

These themes will use the core method of including the user.css in
serendipity.css starting with 2.0.1. A note has been added to all
three themes' theme options to document that the possibility of a
user.css exists.

References #280
2015-02-11 16:10:58 +01:00
Garvin Hicking c079c2e8b7 use "user.css" instead 2015-02-11 15:13:48 +01:00
Garvin Hicking 0f175d9478 References Issue #280
* Issue 280: Allow every theme to utilize a "style_user.css" file
     that gets loaded on top of the frontend (or backend, if in admin/
     subdirectory) theme. This file can be used for customized CSS
     of a blog-admin which carries over to future Serendipity updates
2015-02-11 14:59:21 +01:00
Matthias Mees 9290ee29da Move/rename 2k15 to next
The name has been changed to protect the innocent. (Meaning the
users. From confusion.)
2015-02-11 14:32:24 +01:00
Garvin Hicking 3605937049 Fix Issue #299 2015-02-11 14:28:14 +01:00
Garvin Hicking 8323d9272d Expose serendipity_rewriteURL to smarty API 2015-02-11 10:34:58 +01:00
Matthias Mees e2ab5e9858 Remove template no longer needed with Smarty 3 from 2k15 2015-02-10 14:39:18 +01:00
Matthias Mees b5af1289f2 Add spacing for custom items in configuration groups
Most notably, this will affect custom theme config options.
2015-02-10 12:45:54 +01:00
Matthias Mees 79e4527163 Add new frontend theme 2k15
2k15 is basically 2k11, but up to date. Changes include:

- mobile-first CSS
- toggle-style smallscreen nav instead of select menu
- different choice of webfonts
- updated JS assets
- removed some JS cruft (plugins that are no longer necessary)
- reduced visual style (no, it's NOT 'flat design'!)
- simplified layout (number of columns depends on resolution)
- reduced theme options

Note: 2k15 is NOT compatible with the 2k11 user.css generator.
Currently, there is no 2k15 user.css generator. I don't intend
on building one at the moment.

Also note that I do NOT suggest 2k15 should replace 2k11 as the
default or standard theme in s9y.
2015-02-10 12:18:51 +01:00
Matthias Mees 430d364a88 Only expand non-overlayed cats/tags if necessary
References #290
2015-02-08 17:37:10 +01:00
Matthias Mees e5b7ef40d1 Fix typo in German lang files
References #290
2015-02-08 17:03:03 +01:00
Matthias Mees d6ad3ad3c4 Hide cat view toggle button in non-overlayed cat view
References #290
2015-02-08 16:58:53 +01:00
Matthias Mees b62516fcce Document changes
References #297
2015-02-08 16:28:25 +01:00
Matthias Mees 6249a6af5e Add generic odd/even for dashboard widgets
- Use CSS for odd/even spacing + clearing in browsers that support
  it using :nth-child and the new class .dashboard_widget (to
  seperate positioning styles from visual styles)
- 'Polyfill' said behaviour for IE 8 using JS
- Adapt hardcoded dashboard sections accordingly
- Add fix for IE 8 where mq_small is not set properly
- New build of oldie.css

References #297
2015-02-08 16:15:06 +01:00
Matthias Mees 6f6410adb4 Make sure form element do not overflow their containers
References #296
2015-02-06 20:38:46 +01:00
Ian 441bb6d56f upgrade task - remove still resting files
Please check for more to include to the rest array!
2015-02-06 14:05:30 +01:00
Ian 0670bb86c1 document emoticon plugin fix 2015-02-05 17:03:27 +01:00
Ian 1a15391b9a template is theme and click to demo file 2015-02-05 16:52:57 +01:00
Ian d0a25a8f77 fix typo 2015-02-05 15:53:20 +01:00
Ian eeb25b2b66 fix fallback for custom template emoticons
adds an example file to extend this to custom emoticons
Add description of this in plugins config.
2015-02-05 15:46:53 +01:00
Ian a1e0f7c8e9 Merge branch 'master' of github.com:s9y/Serendipity 2015-02-04 18:03:17 +01:00
Ian d584a7febb move backend_dashboard hook
may certainly as well be, to move the s9y_links block on top of all since not getting boxed, see http://board.s9y.org/viewtopic.php?f=4&t=20247
May need follow-up, if we we have a more general dashboard even/odd cycler function to avoid making each hooked-in plugin to reinvent the wheel...!
2015-02-04 18:02:35 +01:00
Matthias Mees b204d8b179 Adapt layout in theme options media preview
References #288
2015-02-04 17:44:47 +01:00
Ian 3077b4747d Use strict frontend template fallback
in case it is used as a copy template, see http://board.s9y.org/viewtopic.php?f=11&p=10441860#p10441860

Extra Note by Garvin :)
If you create a custom theme to be used with Serendipity 2.0+, use serendipity_getTemplateFile(..., 'serendipityHTTPPath', true) whenever you reference files that are relevant to the frontend output inside your config.inc.php file. The distinction of Backend and Frontend themes in Serendipity 2.0 will otherwise try to search for a file in the backend-directory of a theme, because the theme configuration screen is displayed within the backend, not the frontend
2015-02-04 15:28:30 +01:00
Ian a576ee8ec9 Revert "Use strict frontend template fallback"
This reverts commit 8788403baa.
2015-02-04 15:26:41 +01:00
Ian 8788403baa Use strict frontend template fallback
in case it is used as a copy template, see http://board.s9y.org/viewtopic.php?f=11&p=10441860#p10441860

Extra Note by Garvin :)
If you create a custom theme to be used with Serendipity 2.0+, use serendipity_getTemplateFile(..., 'serendipityHTTPPath', true) whenever you reference files that are relevant to the frontend output inside your config.inc.php file. The distinction of Backend and Frontend themes in Serendipity 2.0 will otherwise try to search for a file in the backend-directory of a theme, because the theme configuration screen is displayed within the backend, not the frontend
2015-02-04 15:23:21 +01:00
Ian 12eb66a669 Revert "Use strict frontend template fallback"
This reverts commit 4d0daa24d0.
2015-02-04 15:14:28 +01:00
Ian 4d0daa24d0 Use strict frontend template fallback
in case it is used as a copy template, see
http://board.s9y.org/viewtopic.php?f=11&p=10441860#p10441860
2015-02-04 14:40:05 +01:00
Matthias Mees 4665bb6598 Rework messages emitted by upload/delete in media db
Due to a regression in how these messages are emitted, these now
need to emit their msg markup in include/admin/images.inc.php or
include/functions_images.inc.php to avoid nested msg containers.

References #287
2015-02-03 18:46:47 +01:00
Matthias Mees 02cf5a3f29 Do not hide <br> elements in .msg_*
As much as I hate these, but this was not a good idea in hindsight.

References #287
2015-02-03 17:09:46 +01:00
Garvin Hicking a3a0ff7980 Execute addlang for branch 2015-02-03 15:50:26 +01:00
Matthias Mees 4030c2ffb0 Rewrite code for deleting media db content
Removes redundant markup from and adds msg classes to

* serendipity_deleteImage()
* serendipity_killPath()

References #287
2015-02-03 15:47:17 +01:00
Matthias Mees 3873d80ea8 The strong element is obsolete, the msg class should suffice
References #287
2015-02-03 14:19:30 +01:00
Matthias Mees 3b36be9beb Better fix for obsolete msg wrapper for deleting media db dirs
Courtesy of @ophian

References #287
2015-02-03 14:08:57 +01:00
Ian 044f1f7dd5 document fa95f33 and 71a9650 2015-02-03 13:39:41 +01:00
Ian fa95f33fb1 fix non echoed file names
References #287
2015-02-03 12:54:09 +01:00
Matthias Mees 22d3d1cf4b Remove obsolete msg wrapper for deleting media db dirs
References #287
2015-02-03 11:19:26 +01:00
Ian 44a8d8d84d Revert "fix label $entry ep_is_sticky check missing properties sub array"
This reverts commit 37fecb5ebe.
2015-02-02 18:47:34 +01:00
Ian 37fecb5ebe fix label $entry ep_is_sticky check missing properties sub array 2015-02-02 18:34:57 +01:00
Matthias Mees 8795b06c73 Fix long plugin names aligning below their toggler
References #284
2015-02-02 10:18:42 +01:00
Don Chambers 17e13b609b Restore emitting figcaption only if image 2015-01-31 12:09:28 -06:00
Matthias Mees 67864f195f Adapt markup and styles for advanced entry options
This is to make it possible to have .media_choose in advanced entry
options. Actually, it's to work around a bug in Firefox.
2015-01-31 15:05:05 +01:00
Matthias Mees 71aff1c671 Minor markup adjustments for media_choose in entryproperties 2015-01-31 14:01:07 +01:00
Matthias Mees 02e0fa7b8e Change serendipity_customfields from id to class
This is to avoid duplicate ids in the backend.
2015-01-31 12:57:24 +01:00
onli e542dcb38a Document changes and prepare language constants 2015-01-30 22:19:07 +01:00
onli f7c0fa23bc Show spartacus errors, maka ajax detection global 2015-01-30 22:07:08 +01:00
Don Chambers 80b07eb2a2 test for image format on src="" and figcaption 2015-01-30 15:01:53 -06:00
Don Chambers e11b27a2a1 Eliminate test for image format
<figure> container must always exist for js to insert or change media
preview.
2015-01-30 14:44:59 -06:00
Don Chambers 0302f7d034 Added image preview if value is image format 2015-01-30 14:24:21 -06:00
Matthias Mees 147a9ab43e Add progress polyfill CSS to backend stylesheet
This is necessary to that all browsers not supporting progress
natively get the CSS needed by the polyfill. It does not affect
browsers that natively support progress.

References #194 #279
2015-01-30 11:49:28 +01:00
Matthias Mees 11bbf39cc6 Hide CSS animations in browsers that don't support it
References #194 #279
2015-01-30 11:18:35 +01:00
Matthias Mees 006bb855f4 Add a new Modernizr build including CSS animations test
References #194 #279
2015-01-30 11:10:05 +01:00
onli 9be0364003 progress polyfill for IE 2015-01-29 19:48:43 +01:00
Garvin Hicking 71e41b3a5a Issue #238 prevent umlauts and special characters for creating/editing media dirs 2015-01-29 15:40:45 +01:00
Garvin Hicking 5f7f2e5ce0 Issue #234: Granular forcing of backend popups for specific areas
References #234
2015-01-29 15:25:38 +01:00
onli 100c344a14 Use png instead of gif, fix ajax get 2015-01-28 23:45:37 +01:00
Ian df20e85811 license s9y 2015-01-28 17:11:18 +01:00
onli c3d6d57db3 show activity indicator and update status 2015-01-28 01:54:38 +01:00
Garvin Hicking a99156a21d * Issue #248: Add $serendipity['forceBase64']=true option (can be set
in serendipity_config_local.inc.php) to make Serendipity *not*
      use 8bit Imap functions for sending mail, for MTAs that behave
      erradically otherwise.

References #248
2015-01-27 14:45:06 +01:00
Garvin Hicking 859e66d8af Instaler should verify password
References #257
2015-01-27 14:36:32 +01:00
Garvin Hicking 253428dd93 Drop $authorid as discussed
References #264
2015-01-27 14:21:53 +01:00
Garvin Hicking a96ff42d61 Get the autoupdate-plugin to offer 2.0 2015-01-27 14:16:35 +01:00
onli ca6ac5eef9 Update all plugins button, js approach (#194, #279) 2015-01-27 01:42:37 +01:00
Garvin Hicking a58cdb2902 DASHBAORD -> DASHBOARD 2015-01-26 09:18:46 +01:00
Matthias Mees 797c56e015 Document recent changes (Oops)
References #274 #275 #276
2015-01-24 16:04:49 +01:00
Garvin Hicking 463733b30b New language constants
references #274

(my first cherry-pick)

Conflicts:
	docs/NEWS
2015-01-24 14:58:19 +01:00
Matthias Mees b0a7d0a0d2 Add new lang constant for entries in dashboard
References #274
2015-01-24 14:39:38 +01:00
Matthias Mees ff5d1a3d5b Fix mispositioned 'no cats/tags' msg, fix missing 'no tags' msg
Also rewrote the JS that checks if freetags plugin is even in use.

References #275
2015-01-24 14:31:15 +01:00
Matthias Mees aa9f280240 Use new bayes_done class so this works with std spamblock
References #276
2015-01-24 14:06:18 +01:00
Matthias Mees f223db6c59 Reposition Spamblock bayes confirmation msg
References #276
2015-01-24 12:37:26 +01:00
Matthias Mees 9117b48176 Remove legacy JS for limiting media file overlay width
This is no longer necessary, but was required in an earlier stage
of the media db overlay.

References #73
2015-01-23 13:12:44 +01:00
Garvin Hicking b63c4e1466 Revert release, check for freetag
References #272
2015-01-23 12:20:26 +01:00
Ian be9d45eb73 fix failing error if no freetags installed 2015-01-23 11:09:06 +01:00
Ian 8f857aaf04 Update RELEASE 2015-01-23 10:50:08 +01:00
Garvin Hicking b92c805bc5 backport 2015-01-23 09:40:59 +01:00
Garvin Hicking 0530e3f789 prep release
master will get an updated docs/RELEASE later when we see no problems with 2.0 adoption
2015-01-23 09:26:10 +01:00
Garvin Hicking 265b3a6a08 document smarty fix 2015-01-22 20:20:20 +01:00
onli f1d7052770 Update Release to now 2015-01-22 19:59:15 +01:00
onli d6385b7754 document #269 2015-01-22 19:58:21 +01:00
onli bb986c0546 Use better search identifier to fix #269 2015-01-22 19:49:30 +01:00
Ian e483598fb3 extend last smarty bugfix patch
References 762283c and ef90f8e

see https://github.com/smarty-php/smarty/commit/8d5fa36a80ec35f8a2cde9580746eb7d5508149a
2015-01-22 10:58:30 +01:00
onli 3e7e6a03ed Fix search page order when stable archive is on (#269) 2015-01-21 18:53:46 +01:00
Ian ef90f8e157 integrate Smarty 3.1.22-dev fix to clearCompiledTemplate() to avoid purging a wrong directory fallback on dir permission issues
https://github.com/smarty-php/smarty/commit/7a1df12afa7e1c83e3529d89c38e97feea6f0bf7
2015-01-21 11:36:00 +01:00
Ian f2e7f6b2a0 document 2015-01-20 18:40:48 +01:00
Ian 4c29d1f236 remove testing 2015-01-20 17:32:16 +01:00
Ian 9ed46b892f enhance error reporting 2015-01-20 17:07:58 +01:00
Ian e80daa7670 upport 9418f80 cleanup and note once 2015-01-20 16:51:09 +01:00
Ian a5d7dbc081 upport 2efc58c cleanup nl2br 2015-01-20 16:50:36 +01:00
Garvin Hicking 2c7a00aaad Use master as development for 2.1
See board for explanation (coming up)
2015-01-20 10:05:42 +01:00
Matthias Mees dad7daf429 Slight tweak for the cats/tags elements
References #239
2015-01-19 12:24:20 +01:00
Matthias Mees ed880162cb Tweak taxononmy quick view baseline
References #239
2015-01-19 12:11:04 +01:00
Matthias Mees 24bdb147e0 Move taxonomy quick view back
References #239
2015-01-19 11:51:30 +01:00
Matthias Mees d375a00046 Move cats/tags quick view below Entry Body
References #239
2015-01-19 11:23:50 +01:00
Matthias Mees 3d2b77e1b5 Revise cats/tags quick view styles
(Apparently, I totally misread the comment by @garvinhicking.
Oops.)

References #239
2015-01-19 11:18:39 +01:00
Matthias Mees 5b640b575c Add styles to seperate taxonomy sections in entry editor
References #239
2015-01-19 10:23:47 +01:00
Matthias Mees 62d8cce314 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2015-01-19 09:40:54 +01:00
Matthias Mees 1a0e039f6f Add proper lang constants for tags quick view
– Also translated the new constants to German
- Also removed duplicate tagsList function (remnant of the merge
  conflict)

References #239
2015-01-19 09:38:51 +01:00
Garvin Hicking 2fbf1e32ff clarify constant 2015-01-19 09:35:44 +01:00
Garvin Hicking 5c5eb9101d addlang-run for @yellowled 2015-01-19 09:23:12 +01:00
onli 4b83f8dcce JS-uploader can't download, don't try 2015-01-18 21:00:11 +01:00
onli dcb044fb28 Set image-owner to all authers with js-upload (#264) 2015-01-18 20:33:41 +01:00
Ian 4e8a896f84 markup for msg notices 2015-01-18 18:21:19 +01:00
Ian 8a464c060f cleanup prepare 2015-01-18 17:42:12 +01:00
Ian 1025ec5748 fix default open ML if in image properties form - give option to jump to ML w/o submittng form
References #264 (was not really mentioned there, bur related)
2015-01-18 16:38:03 +01:00
Ian 254ecb4c6a cleanup prepare 2015-01-18 15:38:09 +01:00
Ian 3902c88916 fix Resize before Upload not respecting target_filename
References #264 (was not really mentioned there)
2015-01-18 14:17:11 +01:00
Ian f6438592c4 one more respect highlighter 2015-01-18 12:51:29 +01:00
Ian 7fe1264f00 respect githubs highlighter 2015-01-18 12:47:18 +01:00
Matthias Mees 1448313fb8 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0
Conflicts:
	templates/2k11/admin/entries.tpl
	templates/2k11/admin/serendipity_editor.js.tpl
	templates/2k11/admin/style.css
2015-01-17 18:12:15 +01:00
Ian 1480e0a88b ups how come? 2015-01-17 18:11:42 +01:00
Matthias Mees 4ecc125adb Merge branch '2.0' of github.com:s9y/Serendipity into 2.0
Conflicts:
	templates/2k11/admin/entries.tpl
	templates/2k11/admin/serendipity_editor.js.tpl
	templates/2k11/admin/style.css
2015-01-17 18:10:41 +01:00
Ian 709253498a Merge branch '2.0' of github.com:s9y/Serendipity into 2.0
Conflicts:
	include/functions_entries.inc.php
2015-01-17 18:08:19 +01:00
Matthias Mees 0dc96ec9b8 Fix showing cats/tags list overlay on clicking cats/tags list
This was broken due to my recent markup changes. Also added lang
constants for the tags list, but since we could label it better,
introduced new lang constants for it.

References #239
2015-01-17 18:05:20 +01:00
Ian ee50524242 cleanup 2015-01-17 17:53:15 +01:00
Matthias Mees 47afba18cb Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2015-01-17 17:43:38 +01:00
Matthias Mees 7c4f1f1052 Add a 'quick view' for assigned tags to the entry editor
Basically replicates the same functionality as for categories. JS
only. Also revised the markup and JS of that for consistency. Too
lazy to make a generic function for it, we can do that later.

References #239
2015-01-17 17:41:35 +01:00
onli 148c67bf9b Publish now + minor cleanup (closes #262) 2015-01-17 17:26:33 +01:00
Garvin Hicking d80deeb364 to the langs 2015-01-17 16:44:35 +01:00
Matthias Mees ba8eb7eea8 New iconfont build with new 'Publish now' icon
References #262
2015-01-17 16:42:26 +01:00
Matthias Mees 6287ce8f7e Remove text-shadow for 'Publish now' button
References #262
2015-01-17 16:35:58 +01:00
Matthias Mees d626281228 Introduce new lang constant for 'Publish now' button
Add this as title attribute and (hidden) button text for said
button

References #262
2015-01-17 16:25:24 +01:00
Matthias Mees b295e617df Change 'Publish now' button to be a 'normal' icon button
- grey, not green
- new icon, button text hidden
- includes new icon build

References #262
2015-01-17 16:21:42 +01:00
Matthias Mees 4c97a041cc Add overlay min-width for very small images in media db
References #265
2015-01-17 13:46:25 +01:00
Matthias Mees 6dac0b5798 An 'auto'. Just for @ophian. 2015-01-17 13:05:09 +01:00
Matthias Mees a87c0fa755 Fix overflowing plugin names on small resolutions 2015-01-16 12:47:28 +01:00
Matthias Mees 0f2f437c8c A better solution for media file/template info overlays
Since the JS-based solution does not work well for cases where the
overlay is larger than the (very small) image, we'll have to go
with a CSS-based solution. This sets the height of the overlay
to at least 7em, which should cover the core info of the overlay
(which is usually 4 lines of text). Also, we'll have to go with
overflow: scroll; in case the info is longer.

Not a good solution in a reponsive context, but it should work. :(

References #230
2015-01-16 12:27:22 +01:00
Matthias Mees bdea7336ee Clear headings in media file metadata
References #263
2015-01-16 12:18:56 +01:00
Matthias Mees 5fdb253448 Make sure media/template info does not overflow
References #230
2015-01-16 11:55:33 +01:00
Matthias Mees 0eaf9db416 Sync heights of info overlays
This has been an optical issue for both media files and themes,
which is why my original idea to have large preview files would
not have solved it. However, a CSS-based solution would not have
been solid, either, so I went with a few lines of jQuery to sync
the height with the outer container.

References #230
2015-01-15 19:31:55 +01:00
Ian 78d7c4984c Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2015-01-15 17:34:27 +01:00
Ian 4858687501 cv pear update 2015-01-15 17:31:48 +01:00
Garvin Hicking a8e61fe115 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2015-01-15 15:39:17 +01:00
Garvin Hicking 1b9e5de787 * Prevent entryproperties from saving/displaying a browser-side
stored password that was actually not set.
[THIS BUGGED ME FOR A SOOOOO LONG TIME!]

    * Stronger check for existing logger interface to prevent errors
      when it is not actively used.
2015-01-15 15:39:00 +01:00
Ian 9ab0e57389 fix not displaying is_sticky flagged entry in dashboard
References #260 and #261
2015-01-15 11:53:44 +01:00
Garvin Hicking b07a835629 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2015-01-15 10:17:03 +01:00
Garvin Hicking 8b51c37b98 Address issue #261
Prevent resetting entryproperties when using serendipity_updertEntry
2015-01-15 10:13:53 +01:00
Matthias Mees 4a730bfcf0 Scheduled entries display publish date in dashboard
Since space if scare in the dashboard, scheduled entries will now
display their publish date instead of the 'Scheduled' badge. The
info that this is a scheduled entry will be available in a tooltip
of the pulish date. This seems like the best compromise on all
devices/resolutions.

References #260
2015-01-14 16:50:44 +01:00
Ian 43676a0918 remove old @ for smarty internal modifiers and stringify and/or fix escape properties 2015-01-14 12:52:20 +01:00
Matthias Mees efed228527 Use rename lang constant MENU_MAINTENANCE
References #50
2015-01-14 12:16:35 +01:00
Garvin Hicking 0cce75c47c more debugging for @yellowled 2015-01-12 13:43:57 +01:00
Garvin Hicking d6ac2aacf0 document 2015-01-12 13:26:19 +01:00
Ian 05f14a9f5a fix non-admin user select and delete comments.
Thanks to berberic (forum)
2015-01-12 12:12:03 +01:00
Ian 4433f91e69 set E_STRICT fix for raiseError()
References #256
2015-01-11 17:49:19 +01:00
Ian 57304aa628 cleanup 2015-01-11 15:33:37 +01:00
Ian 1eff19d1b0 use in release versions only 2015-01-11 15:29:53 +01:00
Ian 12325943a1 silence Constant SQL_CHARSET_INIT already defined notices 2015-01-11 15:27:30 +01:00
Ian d758e6b591 fix 9fbb248
Reference #256
2015-01-10 19:56:46 +01:00
Ian 9fbb248531 update to PEAR 1.9.5 and add PEAR5 file
see #256
2015-01-10 17:51:08 +01:00
Ian 6ce61621a4 fix non-existing constant 2015-01-09 19:08:20 +01:00
Ian a2130e3d89 preview iframe fix wrong modernizr version 2015-01-09 16:14:55 +01:00
Ian d49bc18718 remove leftover authorid
@mattsches was this a debug leftover?
https://github.com/s9y/Serendipity/commit/c9e9d93f92f306d316993db1dad883d5835cd0b3
2015-01-06 18:42:38 +01:00
Matthias Mees e29009d1ba Fix mispositioned Akismet block/unblock buttons.
References #247
2015-01-05 23:35:51 +01:00
Garvin Hicking 7f6194e195 * Patch PEAR.php to use "static" isError declaration to prevent
PHP error messages
2015-01-05 12:44:58 +01:00
Garvin Hicking adfb237b4a fix wrong IF-order
We'll need to also apply that to all additional_themes
2015-01-05 11:37:29 +01:00
Garvin Hicking afa74da11c fix fulltext search for types other than mysql 2015-01-05 11:22:22 +01:00
Matthias Mees e571ca1def German translation for some untranslated lang constants.
References #50
2015-01-03 11:12:02 +01:00
Matthias Mees e3867132ea Use different icons for spam/no spam in Spamblock plugin.
(Not Bayes like mentioned in c348799a44aa7c05c0009c5fb4fbea101ef6cf84.)

References #247
2015-01-02 18:48:57 +01:00
Matthias Mees c348799a44 New iconfont build.
Includes new icons for Spamblock Bayes plugin.

References #247
2015-01-02 18:35:26 +01:00
Garvin Hicking 2944725b69 language constants 2015-01-02 09:26:43 +01:00
Matthias Mees d0affbb4e4 Update bundled jQuery sortable plugin for backend.
References #251
2015-01-01 16:23:36 +01:00
Matthias Mees 2a05ef7969 Update bundled jQuery cookie plugin.
References #251
2015-01-01 16:20:20 +01:00
Matthias Mees bf7480863b Update bundled MagnificPopup for backend.
References #251
2015-01-01 16:16:26 +01:00
Matthias Mees 2677f67a43 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2015-01-01 16:08:58 +01:00
Ian 3df6aff87a cosmetics 2015-01-01 16:04:41 +01:00
Matthias Mees 79a972e92f Update bundled modernizr for backend.
References #251
2015-01-01 16:04:10 +01:00
Matthias Mees 0e56ffeba0 Introduce new lag constant for category view mode toggle.
(Already removed the old lang constant in addlang.txt which has
already been added.)

References #254
2015-01-01 15:31:37 +01:00
Matthias Mees d0af671d2f Add better icons for compact/hierarchical category view toggle.
Includes new iconfont build.

References #254
2015-01-01 15:25:13 +01:00
Garvin Hicking ff3cd29f2a document past changes, did I miss anything? 2015-01-01 15:01:02 +01:00
Matthias Mees 6646955b09 Use localStorage to store category overlay view state.
Way better than cookies, thanks @onli!

References #254
2014-12-31 19:37:56 +01:00
Matthias Mees d91aceb41e Add style for compact category view overlay.
References #254
2014-12-31 15:37:52 +01:00
Matthias Mees 8cb627cb31 Add switch for category overlay view + JS code for it.
References #254
2014-12-31 15:18:52 +01:00
Matthias Mees b141f4a410 Revert relevant aspects of category overlay to hierarchical view.
Reference #254
2014-12-31 14:52:39 +01:00
Matthias Mees 1ac7f7141c Fix date format bug in entry editor (related to typo).
References #252
2014-12-29 15:23:18 +01:00
Ian c9ff0a414e /m uch easier - thanks! 2014-12-24 12:11:06 +01:00
Ian 4b13006687 document 2014-12-23 19:27:44 +01:00
Ian aa0b68d8c5 read update version by line
see  5723673
2014-12-23 19:18:16 +01:00
Ian 5723673ab3 fix missing new update version to form via addData 2014-12-23 17:16:53 +01:00
Matthias Mees 1bf4137aba Update bundled jQuery to 1.11.2. 2014-12-23 16:46:08 +01:00
Garvin Hicking d35b4d127d Fix wrong parameters to serendipity_entity_decode() 2014-12-23 11:33:41 +01:00
garvinhicking 36cde3030a * Fixes escaping of comments in the new backend pane to prevent
XSS. Thanks to Steffen Röemann for reporting!
2014-12-23 11:10:53 +01:00
Ian 91412bf73b set version for 0dc2651 2014-12-19 16:06:01 +01:00
Ian 0dc26512a3 stop default encoding in cke savings
else searching terms will/may not match

References #249 and #236
2014-12-19 15:51:06 +01:00
Ian f0ade5eda0 is not not, is now! ;-) 2014-12-19 11:40:01 +01:00
Garvin Hicking 2f631807fe Fix conflicts.
Merge branch '2.0' of github.com:s9y/Serendipity into 2.0

Conflicts:
	docs/NEWS
2014-12-19 09:56:10 +01:00
Garvin Hicking c8e147874b Move around searchTerm escaping, document. 2014-12-19 09:55:34 +01:00
Ian dc6d32bf68 automark nl2br disabled on wysiwyg usage
References s9y/Serendipity#243
2014-12-15 16:00:45 +01:00
garvinhicking c3d060c973 Move logger init to seperate funtion so that its PHP 5.3+ syntax does
not fatally break the serendipity_config.inc.php parsing on PHP5 5.3-.
Also create a reasonable error message when running on an old version.
2014-12-15 10:13:10 +01:00
garvinhicking b3bb1f38fc Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-12-15 10:01:04 +01:00
garvinhicking 24bb0112d9 php detection 2014-12-15 10:00:33 +01:00
Garvin Hicking 3010116e97 New lang constant for PHP version bail 2014-12-15 09:58:36 +01:00
Garvin Hicking 48c9089f77 pre release again 2014-12-11 13:26:12 +01:00
Ian aca77bd482 cleanup cosmetics 2014-12-10 14:34:54 +01:00
Ian ffe93c92fc allow php class_exists in smarty security and better 0ffd02c
Rferences #245
2014-12-10 12:01:15 +01:00
Garvin Hicking 698c6ce698 update our changelog with some recent changes 2014-12-10 10:11:16 +01:00
onli 8b233d562e Fix syndication subtome onlick handler 2014-12-07 23:15:32 +01:00
Ian 67a82a7e1d simple proposel to fix wrong preview stylesheet
References #119
2014-12-07 18:57:51 +01:00
Ian 4466096c18 better 7e46e92e1b 2014-12-07 18:28:58 +01:00
Ian 7e46e92e1b lang charset proposel for serendipity_die()
References #236
2014-12-07 18:26:01 +01:00
onli d91b86486b specialchar charset fallback on early calls (#236, #240) 2014-12-07 17:47:14 +01:00
Ian 0204a597c7 cleanup 2014-12-07 17:21:32 +01:00
Ian 0ffd02cf1c assign has_freetag in backend
Fixes commit f60df79b15
References #245
2014-12-06 15:52:31 +01:00
onli c004d90a6c Don't die in smarty_purge if file not writeable (#240) 2014-12-02 21:43:09 +01:00
Ian e64793a809 typo 2014-12-02 16:57:10 +01:00
Ian 03cc73d77e properly reset ep_disable_markup_% (L217)
References #242
2014-12-02 16:52:51 +01:00
Garvin Hicking b835364dfd remove wysiwyg note 2014-12-02 13:42:25 +01:00
Ian 2f3170ef18 modify alternate 2014-12-02 11:33:20 +01:00
onli abba5bdb15 Make smarty_purge PHP 5.3 compatible (#240) 2014-12-01 19:04:41 +01:00
onli a319d59eed fix serendipity_smarty_purge to delete all cache files (#240) 2014-11-30 21:36:04 +01:00
onli a3cd4d555a empty smarty cache before upgrade 2014-11-30 18:12:25 +01:00
Garvin Hicking 21b277bd1c Add missing i18n constants
prepare rc1
2014-11-29 11:59:47 +01:00
Garvin Hicking cc6e5ec94d Fix wrong constants being utilized, thanks @yellowled
References #148
2014-11-27 09:37:52 +01:00
Ian ecd211479f CKEditor 4.4.6 - checke 2014-11-26 13:05:27 +01:00
Ian 1fb5bcf38e cleanup cke s9y configuration file
breaks apart long paragraph group in full,
adds mediaembed to default and maximize to standard toolbar

References #148
2014-11-26 13:00:13 +01:00
Ian b51b3dfb59 simplify tb tweak in 77033ef
References #148
2014-11-26 10:52:32 +01:00
Ian 77033efcf4 move cke toolbar css tweaks to a better place
which also makes it independent from cke plugin file usage.

References #148
2014-11-26 10:14:23 +01:00
Ian 94f161359e fix note in 8eaffe4 2014-11-25 16:52:29 +01:00
Ian 8eaffe46fe better fb9414b 2014-11-25 16:40:18 +01:00
Ian fb9414b9ae ckeditor extend more for serendipity
This hides the ckeditor image widget button by CSS in all supported Serendipity toolbars, but keeps it internal functionality enabled which is needed for MediaLibrary inserts.
This forces the user to use the specialized ML button for image inserts only, but will still be supported by CKE toolbar.
An Image double click will still use the image widget like before.
Best checked place was to put this in admin/style.css.

References 148
2014-11-25 14:27:16 +01:00
Ian 85ef7dafc4 Revert "no Umlauts note for image directories"
This reverts commit cb00982db9.
2014-11-25 09:42:17 +01:00
Ian cb00982db9 no Umlauts note for image directories
References #236
2014-11-24 17:08:02 +01:00
Ian 92e56848cf fix input title categoryname 2014-11-24 14:58:51 +01:00
Ian efe2303b23 extend 8da4c647a8
in blogger a strange editor was used to write the file
2014-11-24 14:30:49 +01:00
Ian 8da4c647a8 cleanup tabs and whites 2014-11-24 14:17:38 +01:00
Ian 6d7e2f44a3 better use stripos for system32 path excludes
References 325de34183
2014-11-24 13:09:38 +01:00
Garvin Hicking 325de34183 Only remove "system32" and not paths like "imagemagicksystem32", we don't want to strip parts here that a user COULD possibly pick.
Also remove my check, because it's obsolete now.
2014-11-24 11:52:52 +01:00
Garvin Hicking affa3a3638 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-11-24 11:48:27 +01:00
Garvin Hicking 4d17c0ae02 Added SQLite3 OO layer, old one did not work for PHP 5.4+
PDO SQlite3 is preferrable though
2014-11-24 11:48:16 +01:00
Ian 9545fcbbc9 installer checks - remove unwanted empty or system32 path parts
and wrong system32/convert.exe path on WIN, which is not ImageMagick!
2014-11-24 11:43:27 +01:00
Garvin Hicking 2e1240ba22 1. Reject system32\convert.exe calls
2. Make mysqli be the selected default when installing (PHP at some point will deprected mysql, so better start now to advertise mysqli)
3. Prepare SQLite3 DB Layer
2014-11-24 11:26:44 +01:00
Garvin Hicking 73f417fe39 Check for ENT_HTML401 existance to make the patch work with PHP 5.3 2014-11-24 11:18:21 +01:00
Garvin Hicking eab43b12f5 Adjust remaining htmlspecialchars() accordingly 2014-11-24 10:13:40 +01:00
Garvin Hicking 26535ec09c Patch remaining usages of html_entity_decode
Document
2014-11-24 09:57:47 +01:00
onli 92afc37753 Introduce serendipity_specialchars-wrapper for encoding bug (#236)
PHP 5.4 sets UTF-8 as the default for htmlspecialchars, htmlentities and html_entity_decode. The first two will echo an empty string when given a string with umlauts. This commits introduces serendipity_specialchar-wrapper that are meant to be a temporary solution for the s9y-core until PHP 5.6 fixed the bug, so the native charset option of s9y continues to work.
2014-11-23 23:41:08 +01:00
Ian 6c26d1b3f6 htmlspecialchars charset for entry title, extends 8f894f5
References #236
2014-11-22 10:29:34 +01:00
Ian 8f894f50f1 fix native charset böog missing smarty entry title
Basically not a Smarty error. Just a php htmlspecialchars($entry['title']) setting this var to be empty.

References #236
2014-11-21 18:03:26 +01:00
Ian 35698284d6 installer has not yet plugin api set up
References #236 (part install issue)

@yellowled keep in mind to update /templates/default/admin/serendipity_editor.js on every change in the 2k11/admin file, please.

At all, does this have to be done in upgrader too?
2014-11-21 16:37:15 +01:00
Ian dc8fba51cc document early Oct issue with IM news izes 2014-11-21 11:09:27 +01:00
Ian d5f24aef12 Apply Serendipity lang to CKEDITOR lang
References #235
2014-11-21 10:06:03 +01:00
Garvin Hicking b41bda08bd Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-11-21 09:41:21 +01:00
Garvin Hicking 313a843836 i18n, fix dutch file, add missing recode files, adjust names/titles of the wysiwyg toolbar options
german translation
2014-11-21 09:40:42 +01:00
Matthias Mees 29fada318b Hide non-overlayed tags/categories if overlays are used.
References #222
2014-11-20 15:12:47 +01:00
Garvin Hicking 4bac189d6d Patch #233 manually applied 2014-11-20 13:18:47 +01:00
Ian d15c4c81b8 force_frontend_fallback chaining
References #148
2014-11-19 15:23:10 +01:00
Ian cf500aba28 doc notes changes for umcoming serendipity_getTemplateFile chaining patch 2014-11-19 15:14:08 +01:00
Ian 629eb18529 typos 2014-11-19 13:16:01 +01:00
Ian 59cd4916ee better docs, cleanup and moves 2014-11-19 12:59:09 +01:00
Ian 673fa12d4a remove old version 2014-11-19 12:58:18 +01:00
Ian 9b329c6c92 fix custom cke chainings 2014-11-19 12:57:55 +01:00
Matthias Mees 86318adc5c Make skip-scrolling to target href a reusable function. 2014-11-18 18:51:35 +01:00
Matthias Mees 44f5cc8467 Revert "ep floated option blocks"
This reverts commit 552d07af03.

References #232
2014-11-18 16:43:40 +01:00
Ian 552d07af03 ep floated option blocks 2014-11-18 13:49:21 +01:00
Ian 74a3d1f4ae Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-11-18 12:38:53 +01:00
Ian a9586eba1d sidebar pluginlist - clear float for vext row with more than 3 sidebars 2014-11-18 12:37:31 +01:00
Garvin Hicking 33dafbd085 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-11-18 12:33:11 +01:00
Garvin Hicking c0daacc6dc Added i18n files
(hopefully complete?)
2014-11-18 12:32:42 +01:00
Ian 7423eb63f1 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-11-18 12:29:03 +01:00
Ian 1459a3aa53 set strict default toolbar 2014-11-18 12:28:30 +01:00
Garvin Hicking ec09fa2607 document 2014-11-18 12:27:49 +01:00
Garvin Hicking a24940a095 pointer to document this 2014-11-18 12:27:14 +01:00
Matthias Mees e08c279a50 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-11-18 12:19:31 +01:00
Matthias Mees be1e9f6b2c Tiny CSS fix for media db overlay. 2014-11-18 12:19:07 +01:00
Ian 822cdb4f85 Better notes for custom copies 2014-11-18 12:06:37 +01:00
Ian c7a4cb28d5 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-11-18 11:29:01 +01:00
Ian 5e03dfb398 use $serendipity['template_backend']
References #148
2014-11-18 11:27:47 +01:00
Matthias Mees aa9f0dc1d9 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-11-18 11:19:29 +01:00
Matthias Mees 154cbab69a Fix broken s9y_links popup.
References #227
2014-11-18 11:18:50 +01:00
Ian 14c5a5b9df add missing cke plugin
References #148
2014-11-18 11:12:10 +01:00
Ian 530dff515b fix whitespaces and change a msg error string to 2.0 style 2014-11-17 19:37:17 +01:00
Ian 057c6c20e8 fix note typos 2014-11-17 19:21:46 +01:00
Ian 5f2f390cb9 whites 2014-11-17 19:21:15 +01:00
Ian bf91c8e9a2 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-11-17 18:11:50 +01:00
Ian 72a62b4772 addlang constants for cke ui commit 2014-11-17 18:11:09 +01:00
Ian 885f064b61 package CKEDITOR UI configurable Toolbar
References #148

The js and css config files are directly placed in /htmlarea directory. The old ones downunder are not reset with this commit, until we give OK to go.
The lang constant will be placed to addlang.txt in a 2cd commit, since this may change and there is already a pending constant.
I have not added another option by now to explicitly choose the s9y configs in htmlarea, if someone has custom ones in 2k11/admin and wants to switch back to the origins. Is this really a real and valid user case?
2014-11-17 18:07:54 +01:00
Garvin Hicking 50c42997cf Move default-php and default-xml to spartacus 2014-11-17 09:41:48 +01:00
Matthias Mees f3b2e9fe69 Some styling adjustments for tag overlay.
References #222
2014-11-16 13:40:45 +01:00
Matthias Mees 5f7fa8ee2a Improve layout and UI/UX for categories overlay in entry editor.
References #222
2014-11-15 12:38:29 +01:00
Matthias Mees c957ccca57 Reposition tags overlay close button as well.
Needs a new version of freetag plugin, which is not committed (yet).

References #222
2014-11-14 13:05:31 +01:00
Matthias Mees d2ed47410d Extend input field in freetag taglist.
References #222
2014-11-14 12:18:59 +01:00
Matthias Mees 06237977a1 Better behaviour for clicking cats/tags button w/o overlay.
References #222
2014-11-14 11:39:21 +01:00
Matthias Mees 55459bc112 Fix weird show/hide behaviour for tags/classes toggle buttons.
References #222
2014-11-13 21:43:39 +01:00
Matthias Mees bf3fc9ff78 Fix category filter width when not in overlay.
References #222
2014-11-13 21:18:20 +01:00
Matthias Mees cb73854822 Reposition close button in categories overlay.
References #222
2014-11-13 21:08:22 +01:00
Matthias Mees b5e976adcf Add a button to switch entry status quickly to entry editor.
- Includes new iconfont build with two new icons for entry state.
- JS to toggle entry status based on quick switch button.
- JS to toggle quick switch status based on entry status.
- JS to emit a notification that entry status has been updated.

References #222
2014-11-13 20:49:13 +01:00
onli 1c025c15da ckeditor update, removes samples (#148) 2014-11-13 19:00:15 +01:00
onli 86af52a1be Prepare INSTALL_CAT_FEEDS variable (#228) 2014-11-11 23:48:23 +01:00
onli 31543ef39a Show no update msg for event and sidebar (#226) 2014-11-11 16:47:11 +01:00
Matthias Mees aa8832d1b6 Updated build of backend's oldie stylesheet. 2014-11-11 10:40:13 +01:00
onli 08a9ffcd90 Move spartacus multi-upgrade hint to tooltip 2014-11-09 16:50:38 +01:00
Matthias Mees 912547bc26 Use Modernizr's polyfilled version of matchMedia.
matchMedia is the native version, which oldIE does not support.
Modernizr.mq is the polyfilled version included with Modernizr.
2014-11-07 10:31:15 +01:00
onli 892b82104a Move deprecated themes from core to spartacus (#225) 2014-11-03 15:14:00 +01:00
Garvin Hicking d414125098 Remove test template, obsolete 2014-11-03 10:20:56 +01:00
onli fb3fb774fa Spartacus: Remove upgrader hint message
Should be reworded if the messaged proves to be really necessary, or rather the mentioned functionality added (#194)
2014-11-02 17:26:05 +01:00
onli 2c3804d321 plugin_plug: show text instead of logo
The logo does not fit at all to 2k11. It would be nicer to replace it with a nicer one, but till someone does this, to only show the text saves the design after install.
2014-11-02 16:43:49 +01:00
onli 1965691612 updgrade list: show back link instead of search (#200) 2014-11-02 16:38:25 +01:00
Ian 2e2de24368 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-11-02 15:28:25 +01:00
Ian d4544bec17 minors 2014-11-02 15:25:05 +01:00
Garvin Hicking 35628a3e2c Merge branch '2.0' of github.com:s9y/Serendipity into 2.0
Conflicts:
	docs/NEWS
2014-11-02 15:21:23 +01:00
Garvin Hicking 9944cbb0a7 Make PAT_JS mod_rewrite pattern be recognized to .htaccess to prevent ErrorLog entries for looking up such URLs.
Bumps version to beta6 and will recreate .htaccess file
2014-11-02 15:20:21 +01:00
Ian 6631c516f8 rework some messages and do some space cleanup 2014-11-02 15:06:34 +01:00
Ian a22f0ec65e space cleanup 2014-11-02 15:05:12 +01:00
Ian dee5033c0a document e11cbbc 2014-11-02 14:30:42 +01:00
Ian e11cbbc88f remove in-memory caching, 60e15aa, since this needs to have enabled cache set
Since this is not possible with current template structure in Serendipity, this also removes the serendipity_smarty_class caching section and its notes to a text file.
2014-11-02 14:23:30 +01:00
Matthias Mees 0ce1d8991d Add equal heights for pluginmanager columns.
Moved firing the syncHeights plugin to a seperate function in the
serendipity namespace because it needs to be fire onclick for the
plugin tabs here. Probably gives us more flexibility in the future
as well. New function is serendipity.sync_heights() which takes no
args.

References #223
2014-11-02 11:39:05 +01:00
Matthias Mees 1c49f0319e Switch 2k11 frontend to new details polyfill.
The old polyfill was still using the deprecated browser function.
2014-10-29 20:25:39 +01:00
Garvin Hicking 55c321b678 Added "archives" path to release structure 2014-10-26 20:34:19 +01:00
Ian dcae514215 Smarty 3.1.21 upgrade (see changelog) 2014-10-19 16:19:01 +02:00
Ian 563e5a704c init plugin nuggets when not using default JS-Editor
The hook btw is useless here, since it is already called at https://github.com/s9y/Serendipity/blob/2.0/include/functions_plugins_admin.inc.php#L640
We should remove it here in the tpl.
2014-10-14 15:25:55 +02:00
Ian 7e0eadb254 Smarty 3.1.20 upgrade (see changelog) 2014-10-10 18:24:44 +02:00
Ian 93667e2f46 revert main fbf821c capabilities changes 2014-10-06 14:18:37 +02:00
Ian 27c5b2d589 introduce IM nobang variable
to avoid forcing image geometry exactly to given sizes on second thumbnail method run.
Used by imageselectorplus plugin.
2014-10-06 13:01:14 +02:00
Ian 148e1449d1 extends 9cbb2b0
for file renaming type='file' with a pdf also. Thumb check and the silencer were both needed, else for the last the database entry was lost.

The $renameData['thumb'] could very well be $file['thumbnail_name'] in case of not being empty.

It might be that this has dependencies with the hotlink hook or thumbSuffix renamings. Garvin, please check.

References #220
2014-10-05 19:46:49 +02:00
Ian 3cf539d90e document 9cbb2b0 2014-10-05 18:04:51 +02:00
Ian 9cbb2b0166 fix issue pdf moving rename() error
This was mainly the not checked thumbnail_name and needed to be silenced too.
I am not sure id that issue can happen with type 'file' renaming too.

References #220
2014-10-05 17:57:08 +02:00
Ian ddd3b91d28 fixing images plus
- fix isp image $newSize resizement
- fix forcing $newSize with a bang on WinOS
- convert some message errors to 2.0 style
- whitespace cleanup
2014-10-03 10:10:51 +02:00
Ian fbf821c714 make $serendipity['capabilities'][*] variables work 2014-10-02 19:11:00 +02:00
onli 6313f50433 Bundle Gravatar-plugin (not activated by default yet) 2014-10-02 18:11:13 +02:00
onli ed897f0615 Don't show group filter in update page (#200)
The group filter can't filter the updates
2014-09-28 17:21:31 +02:00
onli 91e8f3c571 Don't show customfields by default 2014-09-28 17:00:27 +02:00
onli b8503f190e category plugin default slicker
Don't show the select form on install, where there are no categories anyway, and disable the "Show All Categories" link by default, since he is on normal configurations redundant with the frontpage
2014-09-28 16:09:55 +02:00
onli 3d569bf02e upgrade-task: remove dashboard and autosave (#71) 2014-09-28 15:35:12 +02:00
onli 37b55759f2 New Plugin default selection (#71)
This is based on Garvins proposal, with some small additions. Subject to further change
2014-09-28 15:05:54 +02:00
onli f7da64165d Make ckeditor configurable via config (#148)
Before this, ckeditor was configurable by editing the wysiwyg_init.tpl in 2k11/admin. Now, the flow is like this:
 1. wysiwyg_init.tpl is responsible for initializing the editor and the plugins
 2. we provide a htmlare/ckeditor/serendipity_config.js where we specify a sane default configuration, including a small toolbar without harmful elements
 3. if the user wants to overwrite our configuration upgrade-safely, he can do this in htmlare/ckeditor/userconf.js
2014-09-19 21:15:50 +02:00
onli 9b63c41c2a Respect image url setting instantly (#207) 2014-09-19 18:53:11 +02:00
onli 5ee2f4b732 fix cache not deleting entry (#215) 2014-09-19 17:20:15 +02:00
onli b9feb9602c Spartacus: Show only one update success msg (#217) 2014-09-19 16:29:48 +02:00
Garvin Hicking feb1a8325d Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-09-12 13:49:40 +02:00
Garvin Hicking dc53c4f0dc check autosave also here 2014-09-11 13:02:01 +02:00
Ian 298152a899 remember, its a key name :) 2014-09-11 10:18:16 +02:00
Ian f26c3a2349 correct plugin selection
Inter alia removes the ALL option, which "resets" the selection.
As a Smarty only fix, this will now circumvent the ALL logic in plugins.inc.php

Reference #200
2014-09-11 10:10:01 +02:00
Matthias Mees 2c87f68022 Add a closing bracket which was accidentally removed.
Removed in 971b993a52.

References #216
2014-09-10 23:02:29 +02:00
Garvin Hicking 971b993a52 Re-add check if serendipityPath is writable in installer. Don't remember why we declared this as bogus. 2014-09-09 15:07:43 +02:00
Garvin Hicking 5c12922510 Personal preferene for autosave
References #213
2014-09-09 14:34:46 +02:00
Garvin Hicking da82fd3a16 support imagemagick thumb parameters, slightly reworked
references pull request #205
2014-09-09 13:58:09 +02:00
Garvin Hicking b606b91272 Proper SQLite PDO filenames in shared installations (Issue #214)
References #214
2014-09-09 13:17:34 +02:00
Matthias Gutjahr 2624bcadec Add checks for indexes (cp. issue #206, amends commit 8002559) 2014-09-07 22:01:54 +02:00
onli 13a9b69d6d Fix ML breaking w/o filter (#208) 2014-08-30 11:18:56 +02:00
onli 7a56b89beb Save filters when browsing ML (#208)
Was broken for the simplified filter
2014-08-30 00:22:45 +02:00
Matthias Mees bc6561eeb5 Add plugins.js to preview_iframe.tpl.
This is a – possibly temporary - fix. serendipity_editor.js depends
on this file, so it needs to be included in the preview iframe as
well.

See http://board.s9y.org/viewtopic.php?p=10440336 (German only) for
further info on the issue this is related to.
2014-08-25 18:56:15 +02:00
Matthias Gutjahr 959022fa07 Init basic Smarty when requesting CSS (Fixes #204)
In order to be able to call `serendipity_plugin_api_pre_event_hook` in a template's config.ini.php from serendipity.css.php, Smarty must be initialized first.
In case of a 'css' event, within the event hook $eventData contains the template's CSS which can now be manipulated and/or extended.
2014-08-20 17:10:44 +02:00
Matthias Gutjahr 8002559603 Fix missing entry properties passed to 'backend_publish' event hook (Fixes #206)
Some plugins make use of additional entry properties (title, body, extended, author) after being called by the 'backend_publish' hook, e.g.

 * serendipity_event_forum
 * serendipity_event_freetag
 * serendipity_event_ljupdate
 * serendipity_event_trackback
 * serendipity_event_versioning
 * serendipity_event_entryproperties
 * serendipity_event_mailer
 * serendipity_event_twitter

 Thus we need to set these properties in the serendipity_updertEntry() method to make sure the plugins get the required data. Of course, we could fetch the entry either in overview.inc.php or again in each plugin, but that would mean an additional query to the DB.
2014-08-19 10:20:19 +02:00
onli f545369922 Show configuration form after saving 2014-08-18 16:59:26 +02:00
onli 3600354ab7 readd debug-msgs to logger 2014-08-14 11:31:21 +02:00
onli 86cbd17b42 Make spartacus less chatty
Makes both the plguin update list and the template overview more readable, as important messages don't get lost in the always existing ones
2014-08-12 13:15:18 +02:00
Ian 5e6b864fdf fix xhtml for 9b89c3d
References #201
2014-08-08 16:24:39 +02:00
Garvin Hicking 9b89c3d815 Another stab at fixing Issue #201
When no categories are delivered to serendipity_updertEntry this can mean two things:
- categories need to be un-assigned
- categories where not addressed/fetched/passed to the function [see include/admin/overview.inc.php for publishing a post! Or plugins like freetag, using serendipity_updertEntry]

To address this a new serendipity[had_categories] is added to the backend template, which can be checked for.

Feedback appreciated!
2014-08-08 14:23:19 +02:00
Garvin Hicking f9bddffc3e Rework code to work with array.
References Issue #201
2014-08-08 10:59:40 +02:00
Garvin Hicking e4a44c3663 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-08-08 10:56:16 +02:00
Ian e7ff92136a fix eb5ac2d
to keep eventData array in the flow
2014-08-07 15:45:32 +02:00
Ian eb5ac2dac1 move 'backend_category_showform hook' 2014-08-07 14:20:59 +02:00
Ian 9ab56b1606 fix missing space 2014-08-07 11:48:50 +02:00
Garvin Hicking 5fdff4c671 Bugfix for not properly setting entry.cats in entry overview
References #201
2014-08-07 10:53:18 +02:00
Ian 43ceac124a fix subtome path 2014-08-05 09:45:00 +02:00
Ian 08b86b102b fix plugins no updates' message check
References #200

there is more.
2014-08-04 15:01:43 +02:00
Garvin Hicking b85e007b85 Add missing constants 2014-08-04 13:36:18 +02:00
Garvin Hicking 938d7144c5 implement patch by @fugue88
References #199
2014-08-04 12:11:07 +02:00
Garvin Hicking 2217826e56 pre next 2014-07-25 10:47:37 +02:00
Garvin Hicking c920aff4c7 Added i18n for new strings 2014-07-25 10:22:20 +02:00
Garvin Hicking da1bf30532 Prepare beta3 for tomorrow. Speak up if you see anything against this. 2014-07-24 11:06:20 +02:00
Garvin Hicking 626d984054 Fix #198 - entry pagination off by one 2014-07-23 09:25:13 +02:00
Garvin Hicking 9459c393df Use proper "generator" metatag. Do not expose version number if not configured. 2014-07-21 12:11:55 +02:00
Garvin Hicking 41388a4a7e we have a problem with a required "PEAR5.php" since this upgrade.
We need to bundle this. I'm short on time, need to remember creating
an issue for this please.
temporary hotfix: Always use PEAR and not PEAR5
2014-07-13 18:51:49 +02:00
onli 8894f82477 Basic suupport for autoupdate-plugin (#98) 2014-07-13 13:07:17 +02:00
Ian 560b5d8165 karma - fix pre 2.0 backend_header case 2014-07-12 11:34:38 +02:00
Garvin Hicking 83d19d183d stricter array check, thanks to wesley 2014-07-11 11:58:07 +02:00
Ian e823d1d3ca remove obsolet function 2014-07-08 17:23:21 +02:00
Ian 5ea97d22a7 karma - fix some markup for 2.0
I am pretty sure there is some more and I even did not check for pre 2.0 sources
2014-07-08 16:21:23 +02:00
Ian 890387e6f4 karma css placement 2014-07-08 15:51:10 +02:00
Matthias Mees da0f824da9 Move media_showitem.tpl to frontend for default as well.
References #197
2014-07-08 12:27:01 +02:00
Matthias Mees dad36dff47 Turn media_showitem.tpl into a true frontend template.
Adapted in serendipity_admin_image_selector.php. Uses frontend CSS
and JS now.

References #197
2014-07-08 11:56:44 +02:00
Ian 3f885e7040 karma better 2014-07-07 13:08:05 +02:00
Ian f2cad36147 karma add backend_css 2014-07-07 12:18:08 +02:00
onli ac24978984 Upgrader task for syndication plugin (#196) 2014-07-07 01:36:45 +02:00
onli 2439399c08 implement force-feed logic (#196) 2014-07-07 00:32:50 +02:00
onli 19bdfec0b9 Restore autoscroll functionality (#189) 2014-07-06 23:44:50 +02:00
onli ca8b96df32 autoscroll.stop does not exist anymore (#189) 2014-07-06 23:26:50 +02:00
Ian ab27481094 extend c0c6e8a to only emit backend karma css where we need it (untested)
I need to see this happen on DEV blog though
2014-07-05 14:06:40 +02:00
Ian c0c6e8aebc try to remove bigger parts of inline css (untested) 2014-07-05 11:40:00 +02:00
Ian cb220b6c94 fixes extends resource
- fixes the bugfix of 02.06.2014 broke correct handling of child templates with same name but different template folders in extends resource (issue 194 and topic 25099)

git-svn-id: http://smarty-php.googlecode.com/svn/trunk/distribution/libs@4858 9dce5a81-9a42-0410-99e4-3799d3902e7f
2014-07-05 11:38:51 +02:00
onli f802658d10 fix fullfeed option not saving yes 2014-07-03 19:11:17 +02:00
Ian 39b29ad284 fix image comment in wysiwyg mode 2014-07-03 11:02:16 +02:00
Ian 3e0bbaa2f0 Smarty 3.1.19 upgrade 2014-07-01 16:44:57 +02:00
Matthias Mees 9f6e029e59 Remove indexedDB polyfill.
References #186 #189
2014-06-29 14:12:20 +02:00
Matthias Mees 519e7221da Minor reformatting of drag 'n' drop function.
References #189
2014-06-29 13:38:57 +02:00
Matthias Mees bda8f3910b Move drag 'n' drop into "global" document ready function.
Also reformat deprecated legacy functions.

References #189
2014-06-29 13:25:25 +02:00
Matthias Mees 88028d1da2 Rebuild plugins.js.
References #189
2014-06-29 13:21:04 +02:00
Matthias Mees 3d5354dd79 Disable debug mode for tabs plugin.
References #189
2014-06-29 13:19:23 +02:00
Matthias Mees 71d711902f Remove source mapping for indexedDB polyfill.
The source map is not included in s9y. This throws warnings in the
JS console.

References #189
2014-06-29 12:54:24 +02:00
Matthias Mees c6c66bb44a Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-06-29 11:45:24 +02:00
Matthias Mees 560e19e880 Minor typo. 2014-06-29 11:45:12 +02:00
onli 719ed77457 syndication: feed options into core; option for rss + atom
The force-feed option still needs to be included into the core
2014-06-29 03:10:43 +02:00
Matthias Mees 150f3e1e64 Small CSS fix for Maintenance section. 2014-06-25 14:47:41 +02:00
Matthias Mees 639e36f0eb Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-06-25 13:52:12 +02:00
Matthias Mees 1c343badcd Re-minified jquery.tabs.js.
For some reason, the minified version supplied by the plugin's
repository threw an errow, so I reminified it with UglifyJS.

References #189
2014-06-25 13:50:51 +02:00
Matthias Mees a87944ef44 Include minified versions of JS plugins.
Included minified version from plugin repository if supllied there.
If not, used http://marijnhaverbeke.nl/uglifyjs on the unminified
source file (keeping "head" comments, which usually include license
info).

Saved ~42% of plugins.js. \o/

References #189
2014-06-25 13:43:07 +02:00
Garvin Hicking 12e9171e7d Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-06-25 13:23:15 +02:00
Garvin Hicking 63f7510ebd References #134
Fixes thumbnail regeneration, only a problem with proper execution order
2014-06-25 13:22:39 +02:00
Matthias Mees 93790772ae Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-06-25 13:08:38 +02:00
Garvin Hicking 6b1b4f2448 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-06-25 13:07:52 +02:00
Matthias Mees ba56d99e8b Remove AccessifyHTML5 and details polyfill.
These are now included in plugins.js by gruntipity.php. No need to
keep them in serendipity_editor.js.tpl.

References #189
2014-06-25 13:07:40 +02:00
Garvin Hicking c2e3b5a038 should fix the parse error at least 2014-06-25 13:07:21 +02:00
Matthias Mees 9808c57f1e Minor typos in gruntipity.php. Made docs a bit clearer.
References #189
2014-06-25 13:02:37 +02:00
Garvin Hicking 33193806ed References #189
Combine additional jquery/plugin files into one
Remove single file references
Moved dragdrop.js to serendipity_Editor.js.

Please test. Might make trouble in the installer/upgrader?
2014-06-25 12:28:59 +02:00
Matthias Mees 7d127738ca Add AccessifyHTML5 and details polyfill as external files.
Technically being third-party libraries, these should be included
in our combined plugins js file. Once that file is being generated,
we can remove these to from serendipity_editor.js.tpl.

References #189
2014-06-25 10:33:54 +02:00
onli 8386c25037 Seperator in config without border (#191)
$plugin_options now doesn't contain the html of the config_item directly, but is an array that contains it and the ctype. That way, plugin_config.tpl can react to specific config types
2014-06-25 00:46:00 +02:00
onli e02718bc76 Show no-update message in spartacus
closes #193
2014-06-24 23:43:26 +02:00
onli f356c7d287 fix doubled html-section in media choose (#150)
Also a cleanup of media_choose.tpl
2014-06-24 23:22:51 +02:00
onli 36987228f9 include indexeddb polyfill directly (#186) 2014-06-24 22:51:58 +02:00
Garvin Hicking 32b7bb9679 * Adapted database table structure change for statistics, shoutbox,
karma and spamblock plugin (for new field definition of "ip" field)
      Thanks to rohdef!
2014-06-23 09:37:52 +02:00
onli b50559accd indexeddb polyfill (#186) 2014-06-22 17:58:09 +02:00
onli 0f9c9b946f Suggestion for 2.0 syndication plugin (devtalk) 2014-06-22 16:32:27 +02:00
Matthias Mees 5f7468958f Fix grouped checkboxes blocking field info show/hide.
References #190
2014-06-20 22:16:44 +02:00
Matthias Mees 67213c247e Rewrite positioning of .field_info.
Positioning of the info text was not ideal because it could be
placed way below the associated label if the associated config
element was larger than expected.

References #190
2014-06-20 18:01:48 +02:00
Matthias Mees f79ae2f3ae Make sure that freetags autocomplete popup still shows up.
magnificPopup overlays the autocomplete popup because of z-index.

References #188
2014-06-19 21:41:39 +02:00
Ian bb48a885d4 message markup in function_images.inc 2014-06-19 20:01:17 +02:00
Ian 426e5d766b correct escape in 2k11/admin files 2014-06-19 19:43:52 +02:00
Matthias Mees 1c743429ae Remove redundant min-width for imageselectorplus plugin. 2014-06-19 09:44:38 +02:00
Matthias Mees ea3751aca8 Minimal styles for emoticonchooser.
References #185
2014-06-18 12:22:06 +02:00
Matthias Mees ead0f15e46 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-06-18 11:57:53 +02:00
Matthias Mees 2d85ced5dd Prevent freetag list from making the page "jump".
References #188
2014-06-18 11:51:16 +02:00
Matthias Mees 0ed6a0c8f3 Required style for freetag in magnificPopup.
These should at some point go into the plugin's CSS.

References #188
2014-06-18 11:39:49 +02:00
Matthias Mees be46250dff Add basic functionality to open tags selection in magnficPopup.
References #188
2014-06-18 11:11:26 +02:00
Matthias Mees f60df79b15 Add button for tag selection to entry editor.
Only displayed if freetag plugin is installed.

References #188
2014-06-18 11:04:46 +02:00
Ian b5148f0fbd reintegrate plugin hook to WYSIWYG textareas - fixes #185
@yellowled
Please have a look to extended area CSS, since the hook button/link in #tools_extended is handled differently to #tools_entry.
Test with emoticonchooser plugin.
2014-06-18 10:42:13 +02:00
Matthias Mees d065179034 New build of legacy IE stylesheet. 2014-06-18 10:00:23 +02:00
Matthias Mees 95e2cab689 New iconfont build including tag icon.
References #188
2014-06-18 09:55:57 +02:00
Garvin Hicking c0047ebf97 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-06-17 12:26:01 +02:00
Garvin Hicking 6fe42449dd support pgsql 2014-06-17 12:25:44 +02:00
Matthias Mees 6bd322e195 indexedDB feature test for autocache in editors.
References #186
2014-06-17 11:31:38 +02:00
Matthias Mees f06da2f6ac Add new Modernizr build, upgrade Modernizr to 2.8.2.
This included feature test for indexedDB and WebSQL.

References #186
2014-06-17 11:13:28 +02:00
Matthias Mees 632831a76e Remove unset variable for body id attribute in media db.
References #150
2014-06-17 11:03:01 +02:00
Garvin Hicking f5693b0b86 Added "clean" new option for using backend popups (disabled by default) as a per-user option
References #183
2014-06-17 09:50:26 +02:00
Garvin Hicking 3079caf246 The js/backend_js will not get properly executed when the staticpage plugin is used,
as this generates a 404 error header. Browsers do not execute JS when the header is 404.
Fixes bernd's problem with the freetag autocompletion.
Things always get funny. :-)
2014-06-16 13:50:18 +02:00
onli 9d4b7d27ed remove additional formats form syndication
Also changes the logic of the plugin itself
2014-06-15 21:35:09 +02:00
onli 413ec650ed Fix editor autosave in ckeditor 2014-06-15 18:47:02 +02:00
Ian 6f9484421e fix class exists for a6661af
Hopefully this will do - could not test this though!
2014-06-13 16:26:58 +02:00
Ian a6661af96a there are two memcache libraries in php
For those confuse about the memcached extension and the memcache extension, the short story is that both of them are clients of memcached server, and the memcached extension offer more features than the memcache extension.
2014-06-13 16:21:54 +02:00
Ian 60e15aaaac added apc and memcache Smarty support 2014-06-13 16:07:32 +02:00
Ian f0a2781682 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-06-12 20:19:49 +02:00
Ian d3235763dc opps sorry fix faccabe 2014-06-12 20:19:14 +02:00
Matthias Mees 41ff9b4579 Clear floats in dashboard properly
References #182
2014-06-12 19:24:07 +02:00
Ian 99602c4add fix faccabe - References #182 2014-06-12 17:20:15 +02:00
Ian faccabef47 slight changes to enable wysiwyg editor textareas 2014-06-12 16:57:08 +02:00
Matthias Mees 344c588844 User the user id variable properly so the correct user is deleted
References #184
2014-06-12 16:38:46 +02:00
Garvin Hicking 6886e38103 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-06-12 15:52:34 +02:00
Garvin Hicking cbcb4ef59a change enablePopup description to clarify, added new lang constants 2014-06-12 15:52:17 +02:00
Garvin Hicking 47b768b7d7 Merge pull request #181 from th-h/thh-htmlvalidation
Some changes for valid HTML5/HTML5.
2014-06-12 15:08:55 +02:00
Garvin Hicking 7f24732078 also block wayback 2014-06-12 15:06:12 +02:00
onli 7b21150c10 Autoincrement for sqlite3 (#180) 2014-06-09 21:56:43 +02:00
onli 48f820cc33 Don't show stackable-error on plugin upgrade (#45) 2014-06-09 21:42:17 +02:00
onli faae572342 syndication update (subtome, defaults, google)
Removed the google reader button option, new defaults for testing, new subtome-button, integrated into the bigimg-option
2014-06-09 20:10:45 +02:00
Thomas Hochstein 992dcbd0c9 'language="javascript"' is optional.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2014-06-09 18:50:28 +02:00
Thomas Hochstein 3acdd9403c Add URL encoding to CSS and .js links in <HEAD>.
Enocde & as &amp; to make validator happy.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2014-06-09 18:38:17 +02:00
Thomas Hochstein 990aab5f5d Add URL correct encoding to karma plugin.
[] have to be URL encoded as %5B and %5d,
respectively. Percent signs have to be
doubled as those strings are used as
input for sprintf().

Signed-off-by: Thomas Hochstein <thh@inter.net>
2014-06-09 18:30:44 +02:00
Ian 50344b19c0 get ready for Smarty apc caching 2014-06-08 19:27:56 +02:00
onli d0d78f3450 ML upload: Convert " " into _ in paths 2014-06-08 18:56:19 +02:00
Ian a25a662a02 fix 7e15a61 - see comments
We might need to find out why this behaved differently.
2014-06-06 16:21:56 +02:00
Ian c38eb784aa debug test missing smarty class for 7e15a61 2014-06-06 14:23:58 +02:00
Ian 7e15a61ed7 compare plugin smarty requirement check with current version 2014-06-06 11:17:32 +02:00
Matthias Gutjahr becf99ad1f Fixes bug in serendipity_serverOffsetHour (cp. http://board.s9y.org/viewtopic.php?f=3&t=19963) and adds test case 2014-06-05 16:41:56 +02:00
Matthias Mees b515c7f050 A better solution for the clickable categories list. 2014-06-04 20:29:43 +02:00
Matthias Mees 9fea866da9 Make the extra category list "a bit less clickable". 2014-06-04 16:31:23 +02:00
Garvin Hicking bbf1456fd8 also block archive.org bot 2014-06-03 14:03:42 +02:00
Garvin Hicking 20cf96e969 move "smarty preview" to actual case, should fix the "entry saved" missing message 2014-06-03 11:09:00 +02:00
Matthias Mees a611ea24b5 Small CSS fix related to Spamblock Bayes. 2014-06-02 19:48:46 +02:00
Ian d633a62bdc only use errorHandlerCreateDOM() if theme has it set
This is odd for all custom or older theme errors and for theme development though.
References #167
2014-06-02 17:26:08 +02:00
Ian 4b3b005833 revert 433da49 2014-06-02 17:06:30 +02:00
Ian 433da491d1 add frontent fallback for errorHandlerCreateDOM() js
in case theme does not have js hooked {$head_link_script}
Fixes #167
2014-06-02 15:49:06 +02:00
Matthias Mees 96174ea80e Added note for syncing wysiwyg image floats.
References #129
2014-06-02 11:43:51 +02:00
Matthias Mees 5aae04915c Move submit buttons in entry editor
References #176
2014-06-02 10:52:13 +02:00
Matthias Mees a915981b6a Move category list in entry editor.
Also trigger category selector on clicking category list.

References #176
2014-06-02 10:49:56 +02:00
Garvin Hicking 35c3541d70 Remove approve-button
Add current karma to output
2014-06-02 10:09:29 +02:00
onli 38f9eaf312 Add subtome-button to syndication plugin, init 2014-06-01 23:51:47 +02:00
onli 3f18352bdc let preview use frontend-theme templates (#172) 2014-05-30 00:14:11 +02:00
onli 2c57def881 minor: fix comment typos 2014-05-29 23:44:21 +02:00
onli 2d50bdd375 ML filter-folder save without reload via cookies (#155) 2014-05-29 23:16:41 +02:00
onli 91ffa16e17 correct spaces in image-deletion-messages 2014-05-29 22:35:55 +02:00
onli 6dd5b4aa6b Improve image deletion pages (#138)
Show correct button for multidelete-form, remove switched_output and doubled state-variables, show formerly lost delete-messages on ML after deletion instead of blank page
2014-05-29 22:26:01 +02:00
onli 1bce7ec7ec Make ML available after upload and filter-change (#138) 2014-05-29 21:54:26 +02:00
onli 39d5ceaa03 try to prevent critical error with invalid gifs 2014-05-29 21:52:52 +02:00
onli eef94a8048 Integrate autosave_local into core (#118) 2014-05-29 19:26:13 +02:00
Matthias Mees 5e5cc1e426 Autofocus user id for login form. 2014-05-28 19:50:15 +02:00
Garvin Hicking 4471b1ac32 * Improved installer to forbid using database table prefixes with
special characters
2014-05-28 14:27:00 +02:00
Garvin Hicking 93d117b45d Move serendipity_html5time definition to usual function scope for better structure 2014-05-28 12:01:26 +02:00
Garvin Hicking 1b37e41e00 Issue #165 - allow to set configuration of children to their parents config, but on their own names.
Global options (navigation) are even carried through so that they use the central part.
This falls back in place rather nicely, I hope it REALLY works. My first tests showed no issues.
2014-05-28 11:48:56 +02:00
garvinhicking 71e4a6c1a9 Issue #164 - addresses commit @917fb30 2014-05-28 11:38:59 +02:00
Garvin Hicking d1881e474f i18n 2014-05-28 10:38:04 +02:00
Garvin Hicking 0d43f5dea7 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-05-28 10:37:16 +02:00
Garvin Hicking ffb1a0769a fix typo, i81n 2014-05-28 10:37:00 +02:00
Ian e7e8f19d02 document #160 2014-05-27 17:52:47 +02:00
Ian 3660a2f116 dashboard entry publish keep timestamp - fixes and closes #160 2014-05-27 17:10:45 +02:00
Ian aa10266c05 remove modifier
since moved to core and this template/theme is "Require Serendipity: 2.0"

References c46d07c and comments
2014-05-27 16:44:29 +02:00
onli bd100c1f4f correct approach to detect installed plugins (#45) 2014-05-27 00:45:42 +02:00
onli 1fcdf783e5 Prevent api to install unstackable plugins twice (#45) 2014-05-27 00:24:28 +02:00
onli 6d6570e92c Back button for plugins 2014-05-26 23:43:27 +02:00
onli 917fb303f2 fix: restore template sidebar settings (#164) 2014-05-26 23:23:35 +02:00
onli 0e41248edd Show ML-Button after Ajax-Upload
It might be useful by not to smartify those buttons
2014-05-26 21:28:56 +02:00
onli 795575a074 Add new img button to media chooser (plugins) 2014-05-26 21:09:27 +02:00
onli ecf7ad1ad2 Merge pull request #171 from th-h/issue-157
Re-add sort by name to ML non-simple filter (#157).
2014-05-26 20:03:56 +02:00
Thomas Hochstein 66d0825a67 Re-add sort by name to ML non-simple filter.
When replacing 'sort by extension' with
'sort by name' in simple filter mode, 'sort by name'
was erroneously removed from non-simple filter
mode too (and replaced by a second incarnation of
'sort by extension').

Signed-off-by: Thomas Hochstein <thh@inter.net>
2014-05-26 18:40:33 +02:00
Garvin Hicking dab92bdca6 * Adapted serendipity_editor.js to provide more global (though
deprecated) API access methods for plugins like amazonchooser
      and linktrimmer, to perform insertion. Also fixed the
      insertion of text when the ID of the element is not prefixed

(You may need to reload your browsercache to get the new JS)
2014-05-26 12:07:29 +02:00
Matthias Mees ca530221eb Temporary fix for media library loading in a loop.
References #157
2014-05-26 10:12:07 +02:00
onli 479efe7e7d first fix for entrycheck discarding drafts (#162) 2014-05-25 23:47:01 +02:00
onli ad8606c782 Move sort by name to ML simple filter (#157) 2014-05-25 22:05:29 +02:00
onli c291c5166d Remember ML folder (#155) 2014-05-25 21:58:10 +02:00
onli a8b4f05de2 Improve status-messages of ajax uploader (#126) 2014-05-25 21:30:36 +02:00
Ian 3c21bfb9f4 be more strict - fixes 14ce11c778 2014-05-25 11:46:35 +02:00
Ian 27265c533e markup for 'image directory move done' note 2014-05-25 10:38:18 +02:00
Ian 0e431e2984 document 2014-05-24 19:48:27 +02:00
Ian 3b4410c9d9 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-05-24 19:42:31 +02:00
Ian c46d07cde5 fixes entry preview exception - fixes #119 2014-05-24 19:41:40 +02:00
Matthias Mees 1375d12a08 Consolidate event handlers.
(I don't remember why this was in a seperate event handler, but we
don't need it to be anymore.)

References #85
2014-05-24 19:15:53 +02:00
Matthias Mees 26088f8ba5 If toggler does not have an id, don't store the state.
References #144
2014-05-24 19:10:14 +02:00
Matthias Mees ab99abcbae Bug fix for serendipity.toggle_collapsible.
References #144
2014-05-24 18:27:20 +02:00
Matthias Mees 4e4972d440 Document serendipity.toggle_collapsible. 2014-05-24 17:49:31 +02:00
Matthias Mees 78b83266e3 Rewrite show/hide functionality as a reusable function
Introducing serendipity.toggle_collapsible, which

– is a reusable function available via the serendipity namespace
– has arguments to customize the show/hide icon, but also has
  sensible default fallbacks for those arguments
– creates an individual key in localStorage to store the open/
  close state in

The latter also fixes a bug(?) which made show/hide in the entry
editor save the state for entry metadata and advanced options in
the same localStorage key. This could be improved with a fallback
for toggling elements which don't have an id.

References #144
2014-05-24 17:21:37 +02:00
Ian c6f4da1c04 temporary fix missing backend_js hook
But there still are serious issues left, see Reference #167
2014-05-24 11:55:59 +02:00
Ian 62026e5ba3 fixes nasty media insert target bug
Fixes #143 and Fixes #145 and References #121
2014-05-24 11:46:58 +02:00
Garvin Hicking 4c965bd2d5 Rephrased this to make it a bit shorter, more suitable for the NEWS-file IMO.
More details could better be added to the Wiki at some place/point for proper documentation (duh).
2014-05-23 17:35:29 +02:00
Ian 14ce11c778 set entries update isdraft to string value false
to be able to publish draft entries from dashboard

References #160
2014-05-23 17:11:05 +02:00
Ian 13c9b4b74d frontend jquery.noConflict mode set deprecated
and make this configurable by $serendipity['capabilities']['jquery-noconflict'] = false;

References #166
2014-05-23 14:14:58 +02:00
Matthias Mees 4437e01af7 Minor improvement for headings in plugin configuration. 2014-05-23 10:27:02 +02:00
Matthias Mees 92641323db Move #entry_skip back to a seperate form element.
References #159
2014-05-22 20:27:20 +02:00
Ian 36a36c38cd only show backend install button if not self
References #165
2014-05-22 18:19:39 +02:00
Garvin Hicking 0e008d0885 This should make jquery.js of a theme no longer be included for the default backend.
Custom backends would now use jquery_backend.js if they really wanted to provide their own.

References #166
2014-05-22 11:59:50 +02:00
Garvin Hicking e8bae220e6 A proposal on how 2k11 could utilize pre-event hooks. Now per-event so that the function name no longer
clashes with child-themes that need to include the 2k11 config.inc.php.
2014-05-22 11:44:25 +02:00
Garvin Hicking f96f0da3f8 Added dev test templates for specific scenarios.
Please read http://board.s9y.org/viewtopic.php?f=11&t=19916

Choosing those templates will probably currently result in errors that need to be addressed.
2014-05-22 11:20:12 +02:00
Garvin Hicking e6320100e8 Provide language constant. 2014-05-22 10:49:36 +02:00
Ian 8401827afb re-introduce fallback constant note for 9388618ac5
while this also is accessed on new theme installes
References #165 3c
2014-05-22 10:32:23 +02:00
Matthias Mees ae6d69a173 Use different labels for plugin filters.
These are supposed to make the functionality of the plugin filter/
search more clear without introducing new lang constants. Also
removed the placeholder attribute altogether.

References #154
2014-05-21 22:26:44 +02:00
Ian 391823d677 add default value to missing constant, as long as not set
References #165
2014-05-21 17:41:26 +02:00
Ian 9388618ac5 fixes #165 3c
@garvinhicking please add additional constant CUSTOM_CONFIG eg = "Custom config file" to langs
2014-05-21 16:24:41 +02:00
Matthias Mees 2f1455d53b Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-05-21 15:48:57 +02:00
Matthias Mees ed6b4e4c6a Adapt CSS to changes in theme list layout.
References #165
2014-05-21 15:48:21 +02:00
Ian ac1d4a7076 revert part of 7474f78 and fix the order
to prevent wp themes engine yes to be included to array $templates
References #165 7474f78 38204c4
2014-05-21 15:46:15 +02:00
Ian 99d354224e fixes edb88c3 with title
References #165 2a and comments
2014-05-21 14:15:38 +02:00
Ian 7474f785e5 removed some jurassic park codes and add wp-theme preview image
References #165
2014-05-21 13:08:13 +02:00
Ian 4df73e1e61 backend preview file changed
I hope you don't mind @yellowled - its more slim and plain
References #165 4
2014-05-21 11:59:16 +02:00
Ian 69fc1a5b73 fixes #165 2b and 4a and 4b 2014-05-21 11:45:13 +02:00
Ian 734217e0da fix 38204c4 2014-05-21 11:25:32 +02:00
Ian b4f015e4c0 add custom config to info array - fixes #165 3a and half of 3b 2014-05-20 20:13:22 +02:00
Ian e8a2900beb reset ending empty lines to one line only
while this produces empty array line with print_r

AND WHY the hell is competition named "Coffee Cup" ? :)
2014-05-20 18:14:49 +02:00
Ian 922e77e4a6 set name truncation for cur_backend too - extends edb88c3
since could be the long named bulletproof template
Reference #165
2014-05-20 18:03:24 +02:00
Ian edb88c3f57 fixes #165 2 a 2014-05-20 17:48:21 +02:00
Ian 38204c4053 better have logic in php - fixes #165 1 b 2014-05-20 17:45:53 +02:00
Ian b8e60cd7ef fixes #165 1 a 2014-05-20 17:41:55 +02:00
Garvin Hicking 13d8f5fd7c addlang execute, reset textfile 2014-05-19 11:14:11 +02:00
Garvin Hicking 6c06651759 add languages 2014-05-19 11:13:53 +02:00
Garvin Hicking eb07593088 Change logger to only be instantiated when explicitly enabled to not cause unneccessary debugging
especially in dev-installations
References #131
2014-05-19 11:12:47 +02:00
Matthias Mees b8faaba829 Make category filtering a reusable function for live filtering
Can now be used anywhere where a "real-time" filter is desirable.
As a usage example, it's implemented for the list of installable
plugins. Should work anywhere, though – needs an input element,
a list of target elements and an element within those target
elements to contain the search term.

Also made the function for the reset button for this reusable.

References #154
2014-05-18 14:13:27 +02:00
Matthias Mees 8726770c03 Move nav items for core plugins to the proper backend nav sections
References #152
2014-05-18 11:56:38 +02:00
onli 7d267fa13d Make Log-Level configurable (#131) 2014-05-17 00:39:07 +02:00
onli d1d95aa643 Show backend preview (#151)
This code really should be revamped
2014-05-16 23:40:06 +02:00
onli 694b446e1a Move serendipiy_editor.js.tpl convertion into core
http://board.s9y.org/viewtopic.php?f=11&t=19927
2014-05-16 16:13:16 +02:00
onli 05817056e5 Copy ckeditor-files into repo (#148)
This time, I deleted ckeditor/ckeditor/.git and removed everytjing before. I hope that the line in .gitignore will prevent the linking the next time if someone forgets to delete the file
2014-05-16 15:03:25 +02:00
onli dad4e4cfc9 Set ckeditor to latest stable, not to the head of git 2014-05-15 16:38:57 +02:00
onli d85334ced7 Remove doubled ckeditor instance (#148) 2014-05-15 16:26:56 +02:00
onli d0b65f2638 Constants for Ajax-Upload-Resizer (#137) 2014-05-14 21:53:45 +02:00
Ian 8753c9c931 document and changed wrong beta state 2014-05-14 19:23:16 +02:00
Matthias Mees 77df5f6129 For visual consistency, the button text should be the same.
References #151
2014-05-14 15:13:57 +02:00
Matthias Mees 95a901d653 Added temporary backend theme screenshot.
References #151
2014-05-14 15:10:07 +02:00
Matthias Mees f1595837df Some visual polish for frontend/backend theme switching.
Also removes redundant text from backend theme info overlay.

References #151
2014-05-14 14:59:00 +02:00
Garvin Hicking 2c5c3eddbf Switch back versions to release versions (also show CVS ids), re-added patch for PEAR 2014-05-14 14:38:04 +02:00
Garvin Hicking a7fdf52eaf Fixed wrong local documentation URL in plugin configuration 2014-05-14 13:37:27 +02:00
Garvin Hicking 1100364efd Added {serendipity_hookPlugin hook="backend_dashboard" hookAll="true"} hook. 2014-05-14 13:21:50 +02:00
Garvin Hicking d4fb7207aa Port fix from wordpress to this 2014-05-14 13:02:29 +02:00
Garvin Hicking 6f0a9b7123 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-05-14 12:59:42 +02:00
Garvin Hicking dd83225447 This is my proposal on implementing the ability to switch frontend and backend templates independently.
- This introduces a new option "template_backend" that will be set to indicate the backend template, defaults to 2k11.
- The "Engine: xxx" line in info.txt still works, but only for the frontend
- The frontend fallback chain defaults to the old "default" template to ensure that themes will work that have "old-style" HTML output
- The backend fallback chain only falls back to 2k11 and then "default"
- In the future, we will remove templates/default/admin once the mechanism is proven stable

To test this in all cases you can:

- Copy 2k11/ to 2k11-custom, edit info.txt, give it a distinct name. Edit the admin/index.tpl file to add some code to ensure that you will see that template in the backend if you pick it, or adjust the style.css or whatever.
- Copy idea/ to idea-custom, edit info.txt, add a "Engine: 2k11" line. Now you can test how a template would look like that fallsback on 2k11 instead of "default"

Those permutations can be checked and come to my mind:

- Backend: 2k11, Frontend: 2k11
- Backend: 2k11-custom, Frontend: 2k11
- Backend: 2k11, Frontend: 2k11-custom

- Backend: 2k11, Frontend: idea
- Backend: 2k11, Frontend: idea-custom

- Backend: 2k11-custom, Frontend: idea
- Backend: 2k11-custom, Frontend: idea-custom

They seem to work.

Currently the display of backend and frontend theme in templates.inc.tpl takes up some larger space. Maybe it could be prettified somehow, maybe put frontend and backend template next to each other, not beneath each other? Maybe @yellowled has some suggestions.

@onli and @ophian - please have a look at this, since you both also worked on the fallback chains. Please tell me if you have issues with this. We can easily revert, if you see this approach as not workable. This is more a "proof of concept" draft.
2014-05-14 12:58:06 +02:00
Garvin Hicking a6b20ad398 UTF-8 versions 2014-05-14 12:57:57 +02:00
Garvin Hicking 02d2fff162 Language commit for frontend/backend distiction 2014-05-14 12:57:37 +02:00
onli ac8407cd19 make wysiwyg-plugin-buttons work without js-change (#147) 2014-05-14 08:39:55 +02:00
onli f1348373cb Include the full ckeditor, using composer (#148)
This shall make it easier for users to customize the editor
2014-05-12 21:40:05 +02:00
onli 1b80ba69a1 Restore wysiwyg plugin api (#147)
Partly. Plugins still need to use a different JS, fitting for the ckeditor. And plugins are bundled in the other-part of the toolbar instead of trying to follow the (xinha-)toolbar parameter
2014-05-12 21:09:58 +02:00
onli 3b3018b173 Fix: categories were uneditable (#135) 2014-05-12 20:31:31 +02:00
onli 09400814d2 Include klogger, enable for trackbacks and index 2014-05-12 20:03:34 +02:00
Garvin Hicking 3bde48937f damnit garvin, it's THEMES now for a collection of template files, no longer TEMPLATE. :D 2014-05-12 16:48:03 +02:00
Ian f4ec48675b merge bundled libs with 1.7.8
fixing idents spaces tabs and version numbers for .current_version file
2014-05-12 15:26:55 +02:00
Ian c61cf9d10a fix missing s9ymdb ID, fixes part one of #145 2014-05-12 12:50:09 +02:00
onli 7d8a9de746 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-05-11 23:58:34 +02:00
onli a815b217b8 Introduce js_backend hook
Will help when JS shall only be emitted in the frontend/backend, as with the CSS
2014-05-11 23:57:19 +02:00
Matthias Mees 0413a838d3 Remove "Published" status in entries list.
It makes it harder to spot "Draft", "Sticky" and "Scheduled", and
we don't have a good solution to distinguish those by color. Might
come in a 2.0.x, though.
2014-05-11 22:09:59 +02:00
Matthias Mees 542917efea Adapt collapsible plugin description to list of installed plugins.
References #125
2014-05-11 21:55:06 +02:00
Matthias Gutjahr 08f9580b54 Add HTTP_Request2 and dependencies as bundled libraries
Update PEAR library to version 1.9.4
2014-05-09 17:39:01 +02:00
Garvin Hicking 26673810ec document 2014-05-09 16:35:17 +02:00
onli ccbfcf2e66 Finish uplaod resize function (#137)
configurable, some fixes, polyfill for chrome
2014-05-08 22:37:44 +02:00
Garvin Hicking c49324eeff @mattsches @yellowled @ophian - Please try to remember documenting
documentworthy changes in our docs/NEWS file. This is important for me
when I write up blog entries about the new changes.

I tried to document every commit up until now.
2014-05-05 10:07:40 +02:00
Garvin Hicking 7223456b53 i18n title attributes, document some past changes 2014-05-05 10:00:59 +02:00
Matthias Mees 9ce0033c88 Add HTML button classes to extended entry textarea.
Fixes the buttons not emitting the arrow brackets for HTML tags in
the extended entry's plain editor.

References #121
2014-05-04 11:27:08 +02:00
Matthias Mees 4daffd0294 Update Modernizr to 2.8.1 (custom build) 2014-05-02 14:58:19 +02:00
Matthias Mees 7cb385c35c Update bundled jQuery to 1.11.1. 2014-05-02 14:54:57 +02:00
Matthias Mees 52fd0d331b Marked stray untranslated title attributes
References #142
2014-05-02 13:18:12 +02:00
Matthias Mees 5f7602cd79 Improved readability of upgrader messages
References #141
2014-05-02 12:05:05 +02:00
Ian 33ee2d7217 re-add media name to resize GET string - fixes #139 2014-05-01 18:11:50 +02:00
Matthias Mees bc792926ae Fix missing i18n constant. 2014-05-01 16:51:21 +02:00
Matthias Mees 34e4341ab0 A more robust solution for for plugin config sequence items
A reiteration of 744a0fc32a.
2014-05-01 16:20:35 +02:00
Ian 744a0fc32a add some additional plugin config sequence_item styles
The first will add a better width to plugin sequence_item(s), covering all screen resolutions, and sets auto margin to center on bigger screens, where sequence_container grows greater than inner 96%.
The seconds breaks sequence_item text in its own inline box on screens >= 768px.

This is well tested with plugins containing sequence_item movers eg entryproperties plugin.
2014-05-01 13:24:18 +02:00
Matthias Mees 2307e892a9 Add comment status to dashboard comments list. 2014-04-30 12:52:01 +02:00
Matthias Mees 38f01b02a6 A better message for adding an image. 2014-04-30 11:26:33 +02:00
Matthias Mees b9be5eae5e Re-added change filename/target dir for media db uploads
References #136
2014-04-30 11:15:40 +02:00
Matthias Mees 0ef5a689f9 Uncomment minify images function to get a working image upload.
References #137
2014-04-30 10:11:22 +02:00
Matthias Mees d99dc6846b Remove jQuery source mapping. Oops. 2014-04-29 13:54:12 +02:00
Matthias Mees d13cb056f0 Remove stray debug code. 2014-04-29 13:29:08 +02:00
Matthias Mees 2475f952df Standardize select image from media db/show preview process.
This used to be two seperate processes for the category icon and
images selected in plugin/theme config. It has now been simplified
to use just one process, which also uses the same markup and JS.

This adds to the consistency of the UI/UX, but it also saves some
CSS and a lot of JS, most of the latter of the expensive kind that
modifies the DOM.
2014-04-29 13:22:55 +02:00
Matthias Mees 055d6cdcd7 Generate new oldie.css.
(Needs to be done from time to time.)
2014-04-28 16:35:56 +02:00
Matthias Mees a3cb5e253c Re-use choose_media for selecting category icons.
Also, save some JS performance by generating the button in Smarty,
not in JS.

References #110 #85
2014-04-28 16:11:05 +02:00
Matthias Mees 7b5ef26e7e Use correct media db overlay for theme options.
References #110
2014-04-28 15:56:29 +02:00
Matthias Mees 9c061a77ae Use correct media db overlay for extended entry properties.
References #110
2014-04-28 15:51:14 +02:00
Garvin Hicking e4a0830ad1 this should maybe fix the error message in importer 2014-04-28 11:14:19 +02:00
onli 06880647b7 fix jquerey check
template_engine in 2k11 is set to null, which is still set
2014-04-28 10:25:05 +02:00
onli 918bd8f34e bp: engine: default (#130) 2014-04-27 20:47:14 +02:00
onli 99c1f4c87c Fix fallback chain
Engine: default in info.txt will now lead to the template to use template/default as fallback before the default-template (2k11 currently). An approach to fix #130

Also, template_engine is not automatically set to default, as this was implicitly always the case
2014-04-27 20:23:56 +02:00
onli 4efba7e295 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-04-27 19:12:27 +02:00
Matthias Mees 744d93b938 The import tpl needs some extra headings. 2014-04-26 18:48:51 +02:00
Ian 17ebe08e52 update CKEditor lib to 4.4
remove unused S9y plugins and custom_plugin.js, since not wanted to be used.
I will not care about any further.
2014-04-26 16:36:39 +02:00
onli f7b57643ef Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-04-25 20:31:06 +02:00
Matthias Gutjahr 9a4b87626a Remove single quotation marks from example PHP command to generate checksums 2014-04-25 18:04:08 +02:00
Ian cfaad3b04c enhance debug note 2014-04-25 14:01:53 +02:00
Matthias Mees 1517302940 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-04-25 11:28:33 +02:00
Matthias Mees 82d3165a19 Fix weird equal heights in list of installable plugins.
Some plugins on Spartacus have longer descriptions, making their
entires longer. Now, the description is collapsible using a details
element.

References #125
2014-04-25 11:26:48 +02:00
Matthias Gutjahr 03689cdd77 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-04-25 10:56:14 +02:00
Matthias Mees d355f82de2 Open Spartacus XML file in a seperate window/tab. 2014-04-25 10:54:15 +02:00
Matthias Gutjahr ea5295cdb3 Remove debug output 2014-04-25 10:40:36 +02:00
Matthias Gutjahr dfd0261cda Exclude git directories from path traversal 2014-04-25 10:39:47 +02:00
Garvin Hicking c73f21ce0d pubdate/pubDate 2014-04-25 10:39:14 +02:00
Garvin Hicking 5e0c4c074e include upgrader timestamp
document recent changes
i18n for upgrader
2014-04-25 09:55:41 +02:00
Garvin Hicking 919674e25a i81n for categoryfilter 2014-04-25 09:30:21 +02:00
onli 976c0018e9 Init: Ajax image upload 2014-04-25 01:58:32 +02:00
Ian 10d26f6fbf fix RecursiveDirectoryIterator() UnexpectedValueException thrown for PHP >= 5.3
@mattsches please test
References #116 and http://board.s9y.org/viewtopic.php?f=1&t=19860
2014-04-24 18:56:38 +02:00
onli 631bc150ac improve update notice: timeout, config
The updater in the dashboard needed a timeout to not kill the backend if github is not reachable
Also, this makes the check configurable
2014-04-24 18:25:56 +02:00
Matthias Mees 2ae6bcc5dd Add reset button for category filter; add some styling.
References #123
2014-04-24 17:30:40 +02:00
Ian efbfb2b320 Proof of concept for CKEDITOR WYSIWYG-Mode respecting "S9y image floats"
The stylesheet would need some love though! (YL?) :)
References #129
2014-04-24 16:06:25 +02:00
Garvin Hicking f89b34f2b0 Fix issue #128 2014-04-24 15:28:13 +02:00
Garvin Hicking 063b753892 Proof of concept idea for the "filter category" idea
http://board.s9y.org/viewtopic.php?f=11&t=19862
2014-04-24 15:21:25 +02:00
onli f704df9365 support html5 multiple upload
closes #126
2014-04-23 02:27:14 +02:00
Matthias Mees a04a2de5c5 Remove redundant comment. 2014-04-20 14:09:47 +02:00
Matthias Mees 6b8f893299 Include updated, "customized" build of MagnificPopup.
Also adds missing test to Modernizr build.

References #85
2014-04-20 14:00:44 +02:00
Matthias Mees 49ce068117 Include customized Modernizr build; update Modernizr to latest.
This build includes only the tests and shivs in Modernizr we do
actually use. If we add tests (in CSS or JS) or find some are
missing, this build needs to be renewed.

References #85
2014-04-20 13:30:28 +02:00
Matthias Mees b6b6dfe01a Make button links always contain their text.
References #99
2014-04-20 13:05:25 +02:00
Matthias Mees 9e7fbdf6bf Only fire equal heights js on screens larger than 640px.
The equal heights boxes look weird on small screens, so we're not
firing the plugin there any longer.

This introduces a new variable for breakpoints for responsive JS.
Please *only* add more breakpoints if you actually use them.

References #100
2014-04-18 16:51:33 +02:00
Matthias Mees 041994aa58 Do not truncate entry titles in entry list.
References #117
2014-04-18 16:33:24 +02:00
Matthias Mees ed1fb3c8a3 Open/close tags, support for language-based tags in non-WYSIWYG.
Some plugins might want to hook into the non-WYSIWYG editor and
create buttons which do use different "tags" for open/close or
not create HTML markup at all. This makes it possible for them
to do so.

References #122
References #114
2014-04-18 16:23:40 +02:00
Matthias Mees fa500b947c Use lower-case letters in non-WYSIWYG editor.
References #122
2014-04-18 16:15:01 +02:00
Matthias Gutjahr 7c8ac6822e Catch exceptions in upgrader if files or directories do not exist cp. http://board.s9y.org/viewtopic.php?f=1&t=19860 2014-04-16 23:45:16 +02:00
Garvin Hicking 6489cf7bf8 to the future 2014-04-15 11:01:53 +02:00
Matthias Mees a17bc9bf9d Merge pull request #113 from levito/2.0
js performance improvement: less DOM firing
2014-04-15 10:12:03 +02:00
Garvin Hicking 5660f461e0 backdate 2014-04-15 00:13:03 +02:00
Veit Lehmann 6b5017f016 js performance improvement: less DOM firing 2014-04-14 22:58:08 +02:00
Garvin Hicking a42a7a8f00 Well, this will surely come... - hopefully rather later than earlier ;) 2014-04-14 09:27:09 +02:00
Garvin Hicking e34007c1b7 so it begins 2014-04-14 09:11:41 +02:00
Garvin Hicking 2fc551ac99 Fix serious issue with plugin migration. Config values where not renamed. :( 2014-04-08 11:29:25 +02:00
Ian 6a8f3a44c0 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-04-08 10:39:46 +02:00
Ian 847ef6c6a6 Smarty 3.1.18 2014-04-08 10:22:23 +02:00
Garvin Hicking ce724611d5 Yeah, guess I cannot get used to "Themes". 2014-04-08 09:37:18 +02:00
Garvin Hicking 178371eed6 Prepare release 2014-04-08 09:22:30 +02:00
Garvin Hicking 3d92fb099f Prevent fatal error when directory does not exist 2014-04-08 09:13:47 +02:00
onli 68be4a5f65 get rename token from html
serendipity_editor.js in default is static, so it can't be given by smarty. I copied the approach into the 2k11-version as well, so it won't get as easily lost.
2014-04-04 13:34:38 +02:00
onli 931a0f0b3b nobr button was using the wrong id for tarea 2014-03-31 02:46:39 +02:00
onli fd113ae212 Use id for textarea identification
this prodcues an easier compatiblity with the staticpage-plugin, and is
altogether more developer friendly than the documents.form-selector
2014-03-31 02:29:54 +02:00
onli 07ef076472 Document php-version req
#104
2014-03-28 11:15:40 +01:00
onli a722390fbf Set needed php to >= 5.3
closes #104
2014-03-28 10:03:03 +01:00
Matthias Mees 6abc381aec A more robust solution for the off-canvas nav.
References #111
2014-03-24 20:46:02 +01:00
Ian c69932eaae rename create() js errorHandler function to errorHandlerCreateDOM() 2014-03-24 15:19:16 +01:00
Ian d2e34d3bcf upport missing errorToExceptionHandler() changes 2014-03-24 15:17:28 +01:00
onli 7bf373248b serendipity_editor.js.tpl without core
To have this in the plugin api didn't look right. the fallback to default works this time, so this should be alright.
2014-03-23 23:53:55 +01:00
onli 0d54063c5e Use old method to init ckeditor
Instead of using global JS-variables and ignoring serendipity[textarea]={$view}, this
approach actually uses the variable and therefore reinstates wysiwyg_init.tpl.

ckeditor_custom_config.js (Thx Ian!) is still respected, but the toolbar got restored to the old version. We need an easy way to remove _underline_, for example. It could be extended though.

This fixes #{107} somewhat, as serendipity_image_selector.php is useable now, but still with display errors (and without an upload widget). Probably still a good idea to copy the ML-eapproach of the normal textareas

This also works with htmlnuggets, without using spawnnugget from the core, instead wysiwyg_init.tpl gets reused in the plugin-config.

ckeditor_custom_plugin.js got emptied, the relevant code (which should only be the part that adds the plugins into the toolbar) should be integrated into wysiwyg_init.tpl).
2014-03-23 23:03:09 +01:00
Matthias Mees 31eba101f6 Rewrite toggle_extended function to work with wysiwyg editor.
References #102
2014-03-18 15:48:16 +01:00
Matthias Mees 5ef157063c A more subtle styling for links in field info text. 2014-03-18 15:23:08 +01:00
Matthias Mees 8ff7cdeddb Save a little space in no-js in media upload. 2014-03-18 15:15:18 +01:00
Matthias Mees 58e59a9193 Hide more things which don't make sense in no-js. 2014-03-18 15:14:23 +01:00
Matthias Mees 38c072c871 Don't show comment summary in no-js mode. 2014-03-18 15:04:51 +01:00
Ian c024b0fa97 exclude textarea info button in case of wysiwyg
for html nugget plugin (there is no more)
2014-03-18 09:28:08 +01:00
Ian 1a72f3a8b8 set alpha4 version
References #72 upgrade part
2014-03-18 09:02:50 +01:00
Ian 76f87c5e08 cleanup note in cb0ba6c 2014-03-17 19:36:19 +01:00
Ian cb0ba6cf7e fix non-read pre event hook for other templates
This fixes the problem of empty core backend js files
and not properly executed ckeditor inits with other templates.

References #72
closes #72
2014-03-17 14:55:37 +01:00
Ian 5fddf72bed include ckeditor.js in case of entryform, staticpages, html nuggets only
References #72
2014-03-16 16:26:21 +01:00
Ian 795410a6c9 chip another line 2014-03-16 09:44:47 +01:00
Ian 4f59ac109b fix note 2014-03-16 09:39:48 +01:00
Ian 408774cba3 move errorToException 'appendTop' javascript into 'js' hook
since this also fixes not having had this in backend_header before.
2014-03-16 09:33:20 +01:00
Ian f509d042ab purge note, since not a tpl (2) 2014-03-15 19:46:00 +01:00
Ian 15977512dd purge note, since not a tpl 2014-03-15 19:25:34 +01:00
Ian faae4b0533 fix core to read ckeditor and handle hook-ins
This supports custom ckeditor plugins and a custom ckeditor config
and reads $eventData for
- normal entry form (case1) textareas,
- staticpage (case2) textareas and
- other nugget plugins (case3) textareas.
They all are build differently, therfore we needed three cases.
Please test!

Based to following commits
 8e26bd9 prepare core ckeditor for custom config and plugins
 44ea050 fix virtual js
 40609d8 add backend_footer hook

References #72
2014-03-15 19:02:13 +01:00
Ian 8e26bd9711 prepare core ckeditor for custom config and plugins 2014-03-15 17:48:29 +01:00
Ian 4296b78333 fix some whitespaces 2014-03-15 17:38:31 +01:00
Ian 44ea050a13 fix virtual js 2014-03-15 17:35:37 +01:00
Ian 40609d803f add backend_footer hook 2014-03-14 20:06:11 +01:00
Ian 1471ac699c correct a typo I assume 2014-03-14 20:05:31 +01:00
Ian 9083aef7a0 minor - set hooks to use single quotes as everywhere 2014-03-14 10:20:53 +01:00
Ian ab1230f5e1 minor - translate internal coding notes 2014-03-14 09:48:37 +01:00
Ian 0ec4723b46 fix Smarty 3.1.17 until next release 2014-03-14 08:22:23 +01:00
Ian e7072aaf6e Smarty bugfix release 3.1.17 - read changelog 2014-03-13 17:42:20 +01:00
Ian 95cddcd6a2 prepare htmlarea with upgraded ckeditor for installer
References #72
2014-03-13 08:09:46 +01:00
Ian 6928a91060 upgrade core ckeditor
to standard CKEditor 4.3.3 (revision 7841b02)
2014-03-12 20:26:25 +01:00
Ian 9b3443dcd6 fix 390ec689c2 2014-03-12 20:25:10 +01:00
Ian 8c2ec8a565 document new function in b3b76bfc35 2014-03-12 19:24:01 +01:00
Ian b3b76bfc35 prepare upgrade for htmlarea cleanup 2014-03-12 19:15:54 +01:00
Matthias Mees ee98b0c128 Fix spelling error
References #103
2014-03-12 14:20:19 +01:00
Matthias Mees 7f58cc1f5f German translation for the new GROUP_NAME_DESC
References #106
2014-03-12 14:08:43 +01:00
Matthias Mees b1b9886f65 New explanation for GROUP_DESC_NAME
References #106
2014-03-12 14:04:46 +01:00
Matthias Mees 5bd45c66a0 Attempt to translate this to German in an understandable way
References #106
2014-03-12 13:10:29 +01:00
Matthias Mees 470b1b376c Translated some German lang constants 2014-03-12 10:39:47 +01:00
Matthias Mees d29cbccf50 Purge all @define statements from plugin_lang.php
@garvinhicking: rebuild, please :)

Reference #103
2014-03-11 21:10:25 +01:00
Matthias Mees f50a7de5a1 Replace relevant occurrences of 'Template' with 'Theme'
This is for files in the lang/ directory.

References #103
2014-03-11 21:08:17 +01:00
Matthias Mees b62a45397b Replace relevant occurrences of 'Template' with 'Theme'
This is for files in the plugins/ directory.

References #103
2014-03-11 20:49:55 +01:00
Matthias Mees 67d75d9eba Replace relevant occurrences of 'Template' with 'Theme'
This is for files in the templates/ directory.

References #103
2014-03-11 20:25:20 +01:00
Matthias Mees 8ddf285340 Fix broken German lang files in Spartacus
References #105
2014-03-11 19:45:27 +01:00
Ian 544d0bf7b4 fix wysiwyg-Spawnnugget() - fixes #92 2014-03-11 19:14:17 +01:00
Ian 390ec689c2 get right instance for CKE plugin (and nugget textareas) 2014-03-11 18:07:33 +01:00
Garvin Hicking 78c7b11c36 Change the order, serendipity_editor provides an API that plugins might want to use, so it needs to be declared first in queue. 2014-03-11 15:11:35 +01:00
Matthias Mees 5f8590054d Shorten the German text for spartacus updates. Again.
References #97

Note: I have no idea why this commit's diff is so large. Encodings
      should be correct.
2014-03-11 13:57:36 +01:00
Matthias Mees 29c8d09583 Revert "Shorten the German text for spartacus updates"
This reverts commit cdacd7ca2e.

(Something didn't seem right there.)
2014-03-11 13:53:39 +01:00
Matthias Mees cdacd7ca2e Shorten the German text for spartacus updates
References #97
2014-03-11 13:52:19 +01:00
Garvin Hicking 7bcc9e2e5a addlang execute 2014-03-11 13:32:44 +01:00
Matthias Mees a722036b8a Re-position spartacus update buttons on small screens
References #97
2014-03-11 12:21:58 +01:00
Matthias Mees 1927da75c1 Move plugin name in plugin description, add styling 2014-03-11 11:49:31 +01:00
Matthias Mees cc60b9e32b Remove and re-add VIDEO lang constant
This lang constant was only added to the English lang files. It
needs to be added to all lang files, so I removed it from the
English lang files and queued it for re-adding through addlang.
2014-03-11 11:30:39 +01:00
Matthias Mees 79135a988d Add new lang constants for the installer
Someone (@garvinhicking) please run addlang.sh for me to add these
(doesn't work on OSX command line). Thanks.
2014-03-11 11:18:08 +01:00
Matthias Mees 9ed9056ff1 Fix missing lang constant 2014-03-11 11:09:03 +01:00
Matthias Mees 52168ba071 Fix missing lang constant for headline 2014-03-11 11:07:38 +01:00
Matthias Mees 6d5c24af2f Move serendipity_editor.js reference back to <head>
The document ready shorthand function needed a little adapting as
well (which is not an issue since we abandoned noConflict mode).

References #91
2014-03-11 10:44:10 +01:00
Matthias Mees b02cb1a6bc Remove redundant version number markup. 2014-03-11 10:23:20 +01:00
Ian 98cc1649f1 add plugin class name
According top request http://board.s9y.org/viewtopic.php?f=11&t=19786
2014-03-11 09:08:17 +01:00
Matthias Mees c81d957094 The form elements need to be a wee bit smaller
References #83
2014-03-10 20:22:12 +01:00
Matthias Mees bb83c2c7a1 Realign filter form elements on small screens
References #83
2014-03-10 20:16:23 +01:00
Matthias Mees dc9c05ba8b Fix headings in content lists on small screens
References #83
2014-03-10 20:07:50 +01:00
Matthias Mees 3106a59fc4 Make filter buttons in comment data smaller
References #83
2014-03-10 20:00:01 +01:00
Matthias Mees fcefdbece2 No margin for action buttons on small screens
Reference #83
2014-03-10 19:58:21 +01:00
Matthias Mees 1ceae353bf Reposition media selector bar on small screens
References #83
2014-03-10 19:47:10 +01:00
Matthias Mees 64eeeaafc8 Make room for timestamp msg in entry editor on small screens
References #83
2014-03-10 19:43:02 +01:00
Matthias Mees 40b066a3b9 Reduce font-size for h1
This will make longer blog titles fit better on small screens.

References #83
2014-03-10 19:34:23 +01:00
Matthias Mees af9cd2135d Don't use updateOnResize in IE8 for equal heights
This seems to fix the scrolling issues in IE8 in the media db.

References #83
2014-03-10 18:16:18 +01:00
Ian 11c3758976 cleanup 750660c 2014-03-10 17:55:02 +01:00
Garvin Hicking 55f6786b2e fix #93 2014-03-10 17:41:57 +01:00
Garvin Hicking 50562d49a9 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-03-10 17:19:59 +01:00
Ian 3ce74d7c57 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-03-10 16:32:53 +01:00
Ian 750660c333 fix wrong zebra in design & options
Please tell, if this can be purged here, since it is not used in general config settings.
But I am not sure if this array is also used in configure all installation tasks.
Garvin?
2014-03-10 16:30:17 +01:00
Matthias Mees 882589d5b0 Fix closing tag for nav element
This causes IE8 to not clone the pagination properly. Also, it's of
course invalid markup.

References #83
2014-03-10 16:22:35 +01:00
Matthias Mees 93aed1b818 Fix zebra striping in IE8
Apparently, IE8 won't interpret CSS statements if it does not
support all selectors used in the statement?!

References #83
2014-03-10 15:59:13 +01:00
Matthias Mees d157084851 Better container for weblogping services
References #87
2014-03-10 15:13:20 +01:00
Matthias Mees 7e68fdd63e Reposition update plugins button on larger screens
References #87
2014-03-10 15:09:12 +01:00
Matthias Mees ceed9b79b8 Adapt serendipity_event_weblogping markup to advanced entry options
References #87
2014-03-10 12:38:05 +01:00
Matthias Mees 93d21a4c97 Adapt serendipity_event_mailer markup to advanced entry options
References #87
2014-03-10 12:20:23 +01:00
Garvin Hicking 68b93fd1bc if plugins append to this, we need linebreaks 2014-03-10 12:13:43 +01:00
Matthias Mees e903534862 Layout styles for the update plugins buttons
References #87
2014-03-10 12:09:20 +01:00
Matthias Mees 71af5ad8b1 Improve backend markup emitted by serendipity_event_spartacus
References #87
2014-03-10 11:40:19 +01:00
Matthias Mees e3c027907f New Modernizr build. 2014-03-09 20:04:16 +01:00
Matthias Mees 5d04730011 Fix iconfonts not working in the installer/upgrader. Again.
First solution affected the backend of finished installations as
well, this one does not.

References #80
2014-03-09 19:05:04 +01:00
Matthias Mees f34134b215 Add extra stylesheet for IE8
Referenced in conditional comments, needs to be recreated if the
style.css changes.

References #82
2014-03-09 18:32:17 +01:00
Matthias Mees 4c00d5f5ae This is not an error per se, change class.
References #80
2014-03-09 17:37:36 +01:00
Matthias Mees cc0a590ec6 Fix installer and updater for use with backend JS
- include Modernizr in the installer as well (needed for no-js/js)
- reference backend JS before body instead of in head
- added container markup for installer error msgs
- some styling for tables in the installer
- remove obsolete no-js/js styles for JS-less installer
- compensate for the lack of iconfonts (due to the style.css not
  being piped through serendipity.css.php in the installer) by
  using different markup which works with system fonts
2014-03-09 17:17:44 +01:00
onli 7497af7022 Use precompiled JS for default
serendipity_editor.js needs to be tested in the installer for #80
2014-03-09 16:19:11 +01:00
onli 7f4dbb3e2e Include JS in installer and upgrader
This should fix issue #80 by giving serendipity_editor.js of default to the
installer and  the normal template JS to the upgrader
2014-03-09 16:00:38 +01:00
Matthias Mees 3ef2575788 Minor adjustment for the upgrader 2014-03-09 15:27:48 +01:00
onli e01a754315 Installer markup cleanup
The template assumed the messages to be arrays, though only one of them was one,
and that actually seems to be a mixup from the smartification
2014-03-09 14:58:06 +01:00
Matthias Mees ac7b024a38 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-03-09 14:48:08 +01:00
Matthias Mees 413cb0a987 Fix pending/approve icons for spamblock plugin
References #88
2014-03-09 14:47:33 +01:00
Ian 9b56a35f26 exclude installerHTTPPath from serendipity_getFile
References #80
2014-03-09 13:19:38 +01:00
Ian 0a2e6964ca rename 8a21ac8 to installerHTTPPath
References #80
2014-03-09 12:59:22 +01:00
Ian 8a21ac8737 fix dffe13e for step 3
References #80
2014-03-09 12:19:47 +01:00
Matthias Mees a956c52e6b Update Modernizr to recent version
We still need to include a customized build of this.
2014-03-09 11:49:48 +01:00
Matthias Mees 9248aae9a9 Adapt AccessifyHTML5 to latest layout changes 2014-03-09 11:41:57 +01:00
Ian dffe13e344 fix PHP_SELF emitting slash on some OS 2014-03-09 10:20:41 +01:00
Matthias Mees a7d5d5a715 Reposition install plugins button for tabbed interface 2014-03-08 13:56:17 +01:00
Matthias Mees 7e16db1b62 Automagically remove msg timestamp 2014-03-08 13:34:02 +01:00
Matthias Mees b1fc0bf6bf Ironed out some minor layout quirks 2014-03-08 13:15:39 +01:00
Matthias Mees 013a50e87e Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-03-08 10:50:36 +01:00
Matthias Mees e41ef67f99 Add a (JS only) category list to entry editor
This will emit (and update) a list of all categories assigned to an
entry based on the selection in the category selection popup.

References #77
2014-03-08 10:47:45 +01:00
Ian 8b951cbc17 fix and prepare installer path for js includement
References #80

needs a special eg installer_editor.js file for JS events
2014-03-08 10:31:17 +01:00
Ian 179f6a19d6 fix upgraders generating content of js files
References #80
2014-03-08 09:38:59 +01:00
Ian 1e1305c24c fix debug mode leftover
References #81
2014-03-08 09:04:04 +01:00
Matthias Mees 8b08f066a5 Added details JS polyfill for Firefox and IE 2014-03-08 00:38:12 +01:00
Matthias Mees bf147efeec Minor desktop layout regression fixed 2014-03-08 00:00:43 +01:00
Matthias Mees b2f1b85900 Reorder function in dragdrop.js to fix it for Firefox
References #81
2014-03-07 23:48:51 +01:00
Matthias Mees 6fbf05175e Minor UI adjustments here and there 2014-03-07 23:25:53 +01:00
Matthias Mees f5bd331c3c Some extra styling for entry editor advanced options 2014-03-07 23:14:23 +01:00
Matthias Mees 7506932ff3 Layout fix. 2014-03-07 22:47:07 +01:00
Matthias Mees 108d595edd Added some German translations. 2014-03-07 22:43:44 +01:00
Garvin Hicking 5aa5b65662 addlang execute 2014-03-07 14:53:33 +01:00
Matthias Mees 3e281fe41a Change MFP close button to submit_state for select_category
References #77
2014-03-07 14:18:30 +01:00
Matthias Mees 3d6b5b3a4a msg_notice needs to be yellow
Some lang constants actually refer to the color used here, so we
can't switch to blue without changing everything.
2014-03-07 13:45:19 +01:00
Matthias Mees fed19d9c02 Need to introduce more new lang constants, sorry 2014-03-07 13:35:00 +01:00
Matthias Mees b70a4dd41c More i18n maintenance (stray markers, hard-coded constants) 2014-03-07 13:29:28 +01:00
Matthias Mees ec3ebca433 Introduce new lang constants, @garvinhicking please add :)
Hint: addlang.sh does not work on OSX.
2014-03-07 13:10:32 +01:00
Matthias Mees aa014cbe91 Removed i18n markers which have become obsolete
References #50
2014-03-07 12:33:16 +01:00
Matthias Mees 9c531401af Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-03-06 18:11:12 +01:00
Matthias Mees c1c71b3b64 Adapted backend markup + styles for serendipity_event_karma. 2014-03-06 18:08:42 +01:00
Garvin Hicking a5bd6563dd re-renamed addLoadEvent 2014-03-06 16:00:20 +01:00
Matthias Mees a9505b4d2f … and of course I forgot to commit UTF-8 as well. 2014-03-06 14:51:55 +01:00
Matthias Mees b3cfdb7126 Minor translation irritation
The German translation of this was misleading because it didn't
work well with the Yes/No labels for the radio buttons associated
with the field.
2014-03-06 14:49:45 +01:00
Matthias Mees 57cf532863 Added confirm msg for build cached entries in maintenance. 2014-03-06 12:30:05 +01:00
Matthias Mees 1d32fe52f5 Unified comments delete confirm msg 2014-03-06 12:12:28 +01:00
Matthias Mees caeec11624 Remove redundant div container. 2014-03-06 11:58:44 +01:00
Matthias Mees 1ca8c8fdf5 Fix broken JS selector for category selector popup.
Also style category legend differently in no popups fallback.

References #77
2014-03-05 19:01:34 +01:00
Garvin Hicking c3b4fe53e9 add language constants for maintenance 2014-03-05 16:17:24 +01:00
Ian 627e400a02 prepare menu maintenance const
and removed html to tpl
2014-03-05 15:59:46 +01:00
Garvin Hicking 38c19fc150 If updertEntry is called with an array structure, make sure it is usable 2014-03-05 15:37:22 +01:00
Garvin Hicking 8d0b1b79be Ah, the internal /admin hooks need this. Hardcoded check. Not optimal, but should work better than the old approach. 2014-03-05 15:29:31 +01:00
Garvin Hicking d208452096 Make external event plugins work properly again. Genpage should not be used? Will discuss on the forums.
Also add inactive/active placements to backend
2014-03-05 14:23:19 +01:00
Garvin Hicking 0c787fcbfe Improve karmaplugin to better tell what's going on.
Fix a i18n error.
2014-03-05 14:11:14 +01:00
Garvin Hicking 9bf64cccda example() method needs to RETURN not echo. 2014-03-05 13:28:26 +01:00
Garvin Hicking 79a565f4d9 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-03-05 13:23:24 +01:00
Garvin Hicking 94c3a75a96 New language constants, hopefully caught all i18n's. Please check. 2014-03-05 13:22:50 +01:00
Ian 7028149361 add missing bracket to 9fecaf1 2014-03-05 12:58:28 +01:00
Ian 9fecaf1372 upport missing 7cf4c12 and e5b28180a5 2014-03-05 12:41:03 +01:00
Garvin Hicking 703d9f2ce0 Re-add the serendipity_jssetcookie function, because plugin use this API and it would otherwise create a fatal PHP error. 2014-03-05 11:54:00 +01:00
Garvin Hicking 70aea65078 Make accessible tabs remember their last choice.
Bundled jquery.cookie library for that.
Every TABlist now needs to have a unique ID.
2014-03-05 11:37:38 +01:00
Matthias Mees 35e0b73ada Optimize CSS: reduce comment whitespace
Now that the backend CSS is pretty much done, we no longer need
excessive comments and whitespace or markers for readability. This
actually saves quite some space in style.css.
2014-03-04 14:04:00 +01:00
Matthias Mees 023e479beb Optimize CSS: linear gradients
Since all modern browsers by now support linear-gradient in at least
the current version, we can use it unprefixed. -webkit prefix kept
for iOS 6, though. All other browser fall back to solid color. This
alone actually saves about 6% of the backend CSS!
2014-03-04 13:40:54 +01:00
Matthias Mees 0a471f2e56 perm_name messages look weird in grey in messages. 2014-03-04 12:53:25 +01:00
Ian 6ec571a1b9 fix a8a1880 - add missing sprintf var 2014-03-04 12:03:56 +01:00
Matthias Mees 375653fc30 D'oh. Needs margin-bottom. 2014-03-03 22:13:21 +01:00
Matthias Mees 43855925da Fix info field for maintenance cleanup. 2014-03-03 22:12:26 +01:00
Matthias Mees b105285d88 Merge branch 'off-canvas-nav' into 2.0 2014-03-03 21:52:03 +01:00
Ian a3b877231f Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-03-03 19:52:28 +01:00
Ian a8a1880f0f be more verbose as kindly asked 2014-03-03 19:52:08 +01:00
Matthias Mees 0c40e05195 Bring the user menu back to the top bar on desktop. 2014-03-03 19:50:54 +01:00
Matthias Mees 601b26ebfb Restyle toggle info buttons again.
Partial revert of e6456b022f.
2014-03-03 19:33:34 +01:00
Matthias Mees 39a3da9e8f Bring back the button links, some minor CSS fixes. 2014-03-03 19:31:12 +01:00
Ian 718c4055a7 escape in link 2014-03-03 19:02:02 +01:00
Ian 4f95851a4e revert escape in script 2014-03-03 19:01:36 +01:00
Matthias Mees 1d76446890 Some stylesheet maintenance. 2014-03-03 18:07:48 +01:00
Matthias Mees cfc893cd56 Refactor smallscreen nav to off-canvas nav (basics).
– necessary layout changes
– move toggle nav button
– incorporate user menu back into main nav
– basic styles required for off-canvas nav
– adapt typography, remove some redundant styles
– adapt toggle JS
2014-03-03 17:48:13 +01:00
Ian bc43f5ecc5 added missing amp; to images.inc
this was origin for the a link, I am not sure it is a need for the script location links too.
2014-03-03 16:47:17 +01:00
Ian 230a4349d8 added new constants to addlang
needs to be executed
2014-03-03 16:32:55 +01:00
Ian 153b5b71ba add clearComiledTemplate to maintenance
define constants temporary in maintenance.inc.php, until someone executes addlang.sh

YL, I captured 'comment_status' class for #cct_info.
2014-03-03 16:32:05 +01:00
Matthias Mees e6456b022f Restyle toggle info buttons to not look like buttons.
This "tries" to address the issue mentioned by @onli and @ophian in
the latest dev talk with these buttons being too "chunky". Let me
know if you think this is sufficient, guys.
2014-03-03 15:22:31 +01:00
Matthias Mees 03e6e332c2 New iconfont build, fixes missing attention icon. 2014-03-03 14:54:21 +01:00
onli 65814d625c Renamed OUT_STACK in plugin-config 2014-03-02 22:26:16 +01:00
onli a85e25da74 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-03-02 22:05:35 +01:00
onli d79d7255aa expand first config group
important for personal settings
2014-03-02 21:19:44 +01:00
Matthias Mees b169972f72 Revert "added background to zebra-style"
This reverts commit 91621b5393.
2014-03-02 21:14:29 +01:00
onli 91621b5393 added background to zebra-style 2014-03-02 21:04:03 +01:00
Matthias Mees 6e6a5fc4e4 Fix disappearing comment headline in dashboard. 2014-03-01 19:57:40 +01:00
Matthias Mees a9b8c9dd02 Refactor the whole damn zebra striping business. 2014-03-01 19:50:53 +01:00
Matthias Mees 49319139e0 Refactor toggle buttons in entry editor according to config. 2014-03-01 18:24:49 +01:00
Matthias Mees 3b547687f9 Improved borders for zebra striped lists. 2014-03-01 17:38:41 +01:00
Matthias Mees 77b10f6c27 Add left/right borders to zebra striped lists. 2014-03-01 16:46:46 +01:00
Matthias Mees 8ee296529a Simplified nav item link texts. 2014-03-01 16:27:46 +01:00
Matthias Mees dd013f3a70 Use new show hide buttons. 2014-03-01 15:51:44 +01:00
Matthias Mees b48f49c444 New iconfont build; replaces left/right/up/down icons. 2014-03-01 15:14:59 +01:00
Matthias Mees aa171353df Remove log function. 2014-03-01 13:37:28 +01:00
Matthias Mees 98c7c0f215 UI consistency: back button in create directory. 2014-02-28 13:48:58 +01:00
Garvin Hicking 855c13cb57 fix "scalar" error message 2014-02-28 11:09:32 +01:00
Ian fd8f4d5a16 short modifier - escape default is html 2014-02-28 10:04:12 +01:00
Matthias Mees 585efd1eb2 Fixed layout for media library filters. 2014-02-27 20:58:39 +01:00
Matthias Mees 6b25fb0482 No abort buttons in the backend, please. 2014-02-27 20:43:11 +01:00
Matthias Mees 5c961dd25e Better layout for media keywords. 2014-02-27 20:38:15 +01:00
Matthias Mees 4e1a285119 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-02-27 20:25:25 +01:00
Matthias Mees bbb9a86275 Proper label for category image/preview. 2014-02-27 20:25:05 +01:00
Ian 78b83125f4 better group name note 2014-02-27 20:09:44 +01:00
Matthias Mees 6c038db4bb Better layout for image directory permissions. 2014-02-27 19:29:49 +01:00
Ian f2deb4428c Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-02-27 17:58:28 +01:00
Ian 2bc390d9e3 fixed select and selected for 'personal plugin perms for usergroups' 2014-02-27 17:57:03 +01:00
Matthias Mees ab547d8cca Updated jQuery to 1.11.0. 2014-02-27 15:19:57 +01:00
Matthias Mees 1202d6899a Add proper headline to configure plugins page. 2014-02-27 15:11:52 +01:00
Matthias Mees 74a8cb927a No margin-top for tabs in upload form. 2014-02-27 15:05:54 +01:00
Matthias Mees 5abd33d9dc Minor CSS fixes for installer + upgrader. 2014-02-27 14:57:49 +01:00
Ian 821809c994 New group example info 2014-02-27 13:25:42 +01:00
Matthias Mees 1d6466249f Make use of the new possibilies to style group permissions. 2014-02-27 12:44:38 +01:00
Ian ce56d05d5d upport 44dfccc - make group permission name split into parts
to be styleable as in 1.7, but here still unchanged by tags, since this may need to change some styles.
2014-02-27 12:04:21 +01:00
Matthias Mees ac22fec171 Layout and other minor CSS fixes for the upgrader.
Includes adapting the layout to match the installer, using a proper
element for removeFiles msgs, removing unnecessary msg_* wrappers,
fixing the upgrader buttons etc.
2014-02-25 19:32:57 +01:00
Ian 8c6b27aedb Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2014-02-25 18:54:09 +01:00
Ian e5b112504a easy fix for non smarty environment on upgrade
This will still need a little tweaking by header and messaging which take a little too much room.
Happy update!
2014-02-25 18:53:25 +01:00
Matthias Mees bbd419d69c Fix span/legend trick in entry properties plugin. 2014-02-25 18:44:41 +01:00
Ian 8628ea8030 fixing endtag 2014-02-25 18:41:17 +01:00
Matthias Mees fcfec701d0 Some minor CSS additions for the installer. 2014-02-25 18:21:31 +01:00
Matthias Mees 04bc1cd02f Change add subfolder icon for image directories. 2014-02-25 14:35:51 +01:00
Matthias Mees a01c031331 Remove list icon in category list, change add subfolder icon. 2014-02-25 14:29:40 +01:00
Matthias Mees feb671ca7c Minor fix for smartphone layout. 2014-02-21 15:03:00 +01:00
Garvin Hicking 0a9c821500 insert renamed plugin name 2014-02-14 15:05:11 +01:00
Matthias Mees 66f71b4bbb Spamblock plugin adapted to latest iconfont build. 2014-02-10 20:34:38 +01:00
Matthias Mees d7061e154a Simple inline msg for timestamp reset; JS only. 2014-02-10 20:28:01 +01:00
Matthias Mees 9af2e54f6f Updated iconfont build; exchanged a few icons. 2014-02-10 19:48:26 +01:00
Matthias Mees 00fa8ca383 Some minor no-js CSS fixes. 2014-02-10 16:45:30 +01:00
Matthias Mees 493cb0a56c Use unified selector for filter panes. 2014-02-10 16:11:36 +01:00
Matthias Mees 09bde1a85b Layout fixes for media db. 2014-02-10 16:07:59 +01:00
Matthias Mees 30b75f16b4 Minor CSS fix for the entry editor. 2014-02-10 15:57:30 +01:00
garvinhicking df92e08671 provide upgrader task for plugin upgrade 2014-02-10 15:12:56 +01:00
Ian b3eb11b9f0 upport spamblock lang changes 2014-02-08 17:37:17 +01:00
Ian e64abba601 upport last textile changes 2014-02-08 17:21:44 +01:00
Ian 2392b99817 upport last spamblock changes 2014-02-08 17:19:01 +01:00
Ian f37e0db153 upport last nl2br changes 2014-02-08 17:08:59 +01:00
Ian 4f164cdb55 upport last emoticate changes 2014-02-08 17:03:44 +01:00
onli 1f63b68908 Publish entries in the dashboard 2014-02-08 16:48:48 +01:00
onli 283c9b5922 Fix: files were not selectable
in ML editor popup
2014-02-08 15:36:45 +01:00
onli 35b4a9f498 Show titles in ML popup 2014-02-08 15:35:19 +01:00
Garvin Hicking d36fca5a1e upport 2014-02-06 12:22:20 +01:00
Garvin Hicking 3d7765f066 upport 1.7.6 security fixes 2014-02-06 09:36:31 +01:00
Matthias Mees 7fe805cd48 2k11 core nav workaround for use with template chooser plugin.
This makes 2k11 always suppress the core nav if template chooser
plugin is installed.
2014-02-04 22:18:02 +01:00
Garvin Hicking 6735dc79fb upport 2014-02-04 11:21:43 +01:00
Matthias Mees ccd0150df3 Fix broken show/hide in entry editor. 2014-01-28 22:25:42 +01:00
Matthias Mees 0289fea89a Style select category popup label. 2014-01-25 23:37:33 +01:00
Matthias Mees 3b23f6b13d Use the span/legend trick properly. Ooops. 2014-01-25 23:30:13 +01:00
Matthias Mees 03a25aab88 Also show comment author in dashboard. 2014-01-25 21:00:06 +01:00
Matthias Mees 756c47980d Additional entry status "Published" added.
Also changed the overlong label text for scheduled entries. Both
need new or changed lang constants.
2014-01-25 20:49:33 +01:00
Matthias Mees 4e923e1aeb Display category selection in a popup/modal window. 2014-01-25 15:58:47 +01:00
Matthias Mees 775aac53b5 no-js fixed for revamped entry editor. 2014-01-25 15:18:18 +01:00
Matthias Mees f932be684f Completely revamped layout for entry editor.
Please note: This is still preliminary. It needs testing (no-js
fallback, IE8) and it still needs a better solution for selecting
(especially multiple) catgeories.
2014-01-25 14:05:36 +01:00
onli fa5af4a1ec Image selector toggled by showMediaToolbar
And $media.manage in the templates
2014-01-23 23:33:23 +01:00
onli a6f0e97ed3 doc update 2014-01-23 23:20:19 +01:00
onli 3873826036 Add upload button to imageselector 2014-01-23 23:13:09 +01:00
onli 580de6574e users: entries for instead of preview 2014-01-21 21:41:51 +01:00
onli 7af68d6d9f tabbify plugin menu 2014-01-21 20:27:02 +01:00
Matthias Gutjahr 0986ba8497 Added Creative Commons Version 4.0 to options 2014-01-21 09:22:56 +01:00
onli c8eca17adc Categories: Open submenu if set 2014-01-20 21:46:10 +01:00
onli b55689ebf4 Fix plugincontrols in no-js mode 2014-01-20 21:28:20 +01:00
Matthias Mees c731c371d3 Only execute dragdrop.js if device does not support touch events.
Also hide noscript controls for plugin manager differently, but show
them on no-js and touch devices. This is supposed to compensate the
fact that the dragdrop JS does not work on touch devices. Might need
a better solution long-term here.
2014-01-20 12:32:36 +01:00
onli 98e2d2fd7c Warn user when category name in use 2014-01-19 22:30:25 +01:00
onli b6fe9892c7 Fix subcategory button 2014-01-19 21:39:47 +01:00
onli 0f36373920 Intorduce simpleFilters setting
Replaces SimpleImageFilters with a personal setting, covers image filters and the simpler entry edit overview
2014-01-19 19:31:45 +01:00
onli 428ef88fce Subcategory button for image dirs + minor 2014-01-19 19:07:02 +01:00
onli 62ba209e52 No categories with the same name 2014-01-19 18:44:44 +01:00
onli 36025ee6ba subfolder creation button for category list 2014-01-19 18:23:42 +01:00
onli 75a95382a4 ajaxify image rotate
Solving the caching issue
2014-01-19 17:59:28 +01:00
onli 82a0d1f4bb back button for image properties
not so easy, as it should not be shown after uploading
2014-01-19 17:33:52 +01:00
Matthias Mees 8723224548 Make advanced options in create category collapsible. 2014-01-19 17:10:27 +01:00
Matthias Mees 3135239602 Reorganize create category form. 2014-01-19 16:52:41 +01:00
Matthias Mees 06019c095b Back button for editing ML directory. 2014-01-19 16:22:21 +01:00
Matthias Mees 3a2f3045e5 Mention comment author in comment headline. 2014-01-19 16:14:10 +01:00
Matthias Mees 82f7bb99f8 Style the maintance section like the dashboard. 2014-01-19 16:03:24 +01:00
onli ee3ea72208 Introduce Maintenance menu
Containing all the small action menu-items that were in the main navigation menu, like verify installation
2014-01-19 13:19:30 +01:00
Matthias Mees 7b5c123071 Move id edit button for consistency. 2014-01-19 11:37:01 +01:00
onli 731443616f remove multidelete form for entries 2014-01-19 02:09:08 +01:00
onli 94f1198fe3 Add option to simplify image filters
Default on (at least for the test), needs new language constants
2014-01-19 01:48:42 +01:00
onli 7a9d867fd1 react to filter when finding no comments/trackbacks 2014-01-19 01:22:02 +01:00
onli 21107efaf5 Spamblock: Add backend link to nav 2014-01-19 01:10:50 +01:00
onli 53d967abce upload: hide ML when editing properties
forgot the real fix in commit b41b711
2014-01-19 00:28:07 +01:00
onli b41b71169f upload: hide ML when editing properties 2014-01-19 00:17:57 +01:00
onli 2d2d3822d7 enable moderate in dashboard
The token was missing, as the variable was renamed for the preview-url, where it was missing before
2014-01-18 23:27:42 +01:00
onli 2dcee8eae1 fix entry view link after edits 2014-01-18 23:19:18 +01:00
onli 1109ff8160 show commentform after commenting
The reply-button now continues to work
2014-01-18 23:11:56 +01:00
onli aaa4094cdd Add http to urlinput if missing 2014-01-18 23:08:28 +01:00
Matthias Mees 209f3ec710 2k11: Use proper scaling in landscape mode.
This used to be buggy in iOS6 (although 2k11 includes a JS fix for
it), but is fixed in iOS7. Since using initial-scale=1 makes the
blog far more readable in landscape mode, let's use it now.
2014-01-15 22:11:46 +01:00
Matthias Mees 22ba423e36 2k11: Updated bundled JS plugins to latest versions.
Also better minification for bundled JS plugins.
2014-01-08 18:22:59 +01:00
Matthias Mees ba1c0e4a7b Bump 2k11 update date. 2014-01-08 13:47:01 +01:00
Matthias Mees 0864958ac8 2k11: Upgrade Modernizr to 2.7.1. 2014-01-08 13:45:53 +01:00
Matthias Mees 5389fcb030 2k11: Remove pubdate attribute which apparently is deprecated now. 2014-01-08 13:44:39 +01:00
Matthias Mees 9011d62bf4 Cancel URL button function if URL is empty. 2014-01-04 23:30:03 +01:00
Matthias Mees f20ef8cc67 More border for multidelete indicator. 2014-01-04 20:39:39 +01:00
Matthias Mees 9aaec5e69c Remove unnecessary buttons in media lib popup. 2014-01-04 20:24:19 +01:00
Matthias Mees da11f3829a Back button for create directory. 2014-01-04 20:02:43 +01:00
Matthias Mees 0fc19d9959 Finally got working code for invertSelection. Phew. 2014-01-04 14:56:52 +01:00
Matthias Mees ab2d01ad0c Fixes checkboxes not being (un)checked in invert selection. 2014-01-03 15:58:58 +01:00
Matthias Mees 0ef32f9df4 Stray link which was not buttonized. 2014-01-02 14:55:38 +01:00
Matthias Mees 082fe28cc8 Highlight expanded filter/sort sections. 2014-01-02 14:49:08 +01:00
Ian 31e3099c7c fix Captcha bug with upper PHP versions (8d29fcc) 2013-12-25 19:45:28 +01:00
Ian 29649a7d79 ML - exclude possible thumbs.db files 2013-12-25 16:42:03 +01:00
Ian e81f3e5959 document smarty release 2013-12-20 20:03:43 +01:00
Ian 6eea1e55da Smarty 3.1.16 bugfix release - please read changelog and
the new 3.1.16_RELEASE_NOTES.txt file, since the merge of subtemplates was changed to allow some special conditions with {blocks} and {includes}

NOTE: Please test this Serendipity Beta with existing Blog templates and entries!
2013-12-20 20:01:51 +01:00
Garvin Hicking b512c16c7d Patch for APC compatibility, relative paths are bad for stat=0 config.
Thanks to absynth.
2013-12-16 23:24:56 +01:00
Matthias Mees c31bd24494 Better label text for home button. Needs i18n. 2013-12-03 14:54:48 +01:00
Matthias Mees d1f3612825 Provide a fallback if the dashboard has nothing to show.
For entries and comments. Should only happen on new installations
anyway.
2013-12-03 14:48:32 +01:00
Matthias Mees 4440a2d44a Fixes print style bug in Firefox. 2013-11-20 14:56:05 +01:00
Garvin Hicking 60556207bf document better :) 2013-11-11 17:14:54 +01:00
Garvin Hicking 28885e75a1 document DLange commit 2013-11-11 16:25:39 +01:00
Daniel Lange 9dd5b9762b Fixes and updates for serendipity_event_spamblock by DLange (2.0 branch)
[PATCH 1/4] remove serendipity_serverOffsetHour() workaround as this
 function is now in core

[PATCH 2/4] remove blogg.de anti-spamlist support as it has been
 discontinued

[PATCH 3/4] proper locking of .htaccess file to prevent race
 condition and partial file over-writes

[PATCH 4/4] allow multiple Deny From lines in .htaccess so more IPs
 can be simultaneously  blocked for busy sites
2013-11-11 14:30:37 +01:00
Ian 149e6aa9a7 fixed core plugins db tables, ip column to IPv6 length 2013-11-08 14:53:25 +01:00
Ian c7df199a2f bugfix correction of modifier capitalize fix from 3.10.2013 (issue 159) 2013-11-02 16:53:51 +01:00
Matthias Mees 8151645882 Don't emit comments, trackbacks or comment form in backend preview.
Fix by @onli. References #62
2013-10-10 15:58:55 +02:00
onli daa3afe812 Fix drag'n drop in plugin configs
As discussed in #65. Uses a simpler approach to detect the order of the items and their activation at the same time
2013-10-09 16:43:15 +02:00
onli ec864e6b71 markup-buttons of extended editor work now (#66)
data-tarea was set two times, the first being body
2013-10-09 15:00:13 +02:00
Ian d858fc8eb3 nl2br restore() better callback - see Issue #67
to match all PHP version since 5.2.6
2013-10-08 20:08:06 +02:00
Ian 0f1e93ab7d - bugfix loops using modifier capitalize did eat up memory (issue 159)
git-svn-id: http://smarty-php.googlecode.com/svn/trunk/distribution/libs@4785 9dce5a81-9a42-0410-99e4-3799d3902e7f

We need this, since using the capitalize modifier.
2013-10-05 14:01:38 +02:00
Matthias Mees 80cfa7e736 Only fire toggle_links handler in dashboard. 2013-10-05 10:56:26 +02:00
Matthias Mees 0c80e7afaf Only replace T in value if datetime-local is not supported.
According to my tests, this is what makes datetime-local fail in
browsers which already support it. Replacing the T in the value is
required to set the date/time in browsers which don't support it,
but it somehow throws off the (re)setting in browsers which do.

So using Modernizr's feature test to check if the replacement is
required should solve the issue. However, this seems strange, we
should keep an eye on it.
2013-10-05 10:46:50 +02:00
Matthias Mees 82b2f2f8fe Add missing i18n markers. 2013-10-05 08:56:54 +02:00
Matthias Mees 205bc5f65c Move extend comment button to the end of the list.
If it is 'inserted' in the middle, it breaks the consistency since
not all comments have the button, which irritates the eye.
2013-10-05 08:34:24 +02:00
Matthias Mees d82ed41f65 Fixes 'second click' issue with further links toggler.
Apparently, magnificPopup does not like the click handler if the
toggler is an a element, which we probably never noticed since all
the other togglers used in the backend are buttons.
2013-10-05 08:26:26 +02:00
onli 36b99d5651 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-10-04 23:19:46 +02:00
onli 867b92a6ea save visibility of extended & advanced 2013-10-04 23:19:28 +02:00
Matthias Mees f88617ab05 Distinguish preview/save better in entry editor. 2013-10-04 23:16:41 +02:00
Matthias Mees b936b00df7 Remove trailing whitespace. 2013-10-04 20:26:56 +02:00
Matthias Mees 31925a9c85 Small fixes to labels in templates section.
"Own admin design" sounds strange. Also, I think "Install" makes it
more clear to the user what actually happens than "Select".
2013-10-04 20:23:54 +02:00
Matthias Mees 1b7332dea4 Remove duplicate backend_header reference in the head.
References #65, related to c425f20994.
2013-10-04 20:17:23 +02:00
onli 78f0196571 shorter plugin/category title 2013-10-04 17:45:43 +02:00
onli c425f20994 Fix drag'n drop by moving jquery to top (#65)
The backend_header-event, which includes jquery, should really stay in the header. I'm surprised the other jquery-plugins continued to work.
2013-10-04 17:28:25 +02:00
onli bd6fd1d103 Use frontend-css in preview (#60)
preview_iframe.tpl used head_link_stylesheet, which contains the link to the backend-css while in the backend, like when the preview is generated. This workaround constructs the path to the frontend-css manually - which should work as long as it follows the convention fo being called serendipity.css, which is hardcoded everywhere anyway
2013-10-04 17:14:09 +02:00
onli 3ebc962a71 consistent preview/save 2013-10-04 15:51:05 +02:00
onli af21acc641 consistent template naming 2013-10-04 15:44:01 +02:00
onli 4ffa307bc5 remove long/wrong ML-upload-hint 2013-10-04 15:26:33 +02:00
onli d1d26af5ee Shorter labels and consistence
Like Delete instead of Delete selected comments on buttons, and Media Library instead of Fine Media as a title in the ML
2013-10-04 15:23:11 +02:00
onli 5ddfdf7dc3 remove dashboard view button for comments 2013-10-04 15:01:30 +02:00
Matthias Mees db8a289ff8 Different icon for further links toggler. 2013-10-02 13:06:42 +02:00
Matthias Mees d0de74737e Fixes type/href attributes for button elements.
– <button> must have an explicit type="buttons" since it falls back
  to type="submit", which can have side effects
– <button> must not have a href attribute, always use data-href
2013-10-02 11:05:27 +02:00
Matthias Mees 5f2c8eb9dd Add sticky post status to entries overview. 2013-10-02 10:36:25 +02:00
Matthias Mees 9e14904eb2 Use existing lang constant. 2013-10-02 10:34:39 +02:00
Matthias Mees c4ba5f8da8 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-10-02 10:14:52 +02:00
Matthias Mees 67eca005d9 Show/hide for advanced entry options. 2013-10-02 10:14:22 +02:00
Ian 105f96a4d7 Smarty 3.1.15 release - please read change_log.txt 2013-10-02 10:12:48 +02:00
Matthias Mees 5fa25b65f4 Minor layout fixes for s9y links in popup. 2013-10-01 21:13:01 +02:00
Matthias Mees 1b11b31a18 Dashboard: open further links in a modal popup.
(Or just show/hide them for use-popups.)

For some weird reason, this seems to fire only on the second click
on the toggler, not on the first. Need input from @onli on this.

Also, this needs a better icon. I did not want to go through a new
iconfont build just for this one icon now.
2013-10-01 21:03:39 +02:00
Matthias Mees 3146238b35 Link dashboard headers to edit comments/edit entries. 2013-10-01 20:16:07 +02:00
Ian 915c5f6531 Fix possible temporary caching errors failing $eventData[0]['properties'] 2013-10-01 19:03:12 +02:00
Ian 0b1aeddc31 Automatic upgrade removal of old Smarty2 files (2.0-alpha2) 2013-10-01 18:58:56 +02:00
Matthias Mees 609515a4d8 Remove stray styles for s9y links in the footer. 2013-10-01 17:34:52 +02:00
Matthias Mees dc98c93c02 A more robust responsive layout for grouped entry status/buttons.
Related to ebb1fb41d4.
2013-10-01 17:33:10 +02:00
onli ebb1fb41d4 group entry status and buttons 2013-10-01 16:08:27 +02:00
onli f7520a9195 entryeditor: extended before save 2013-10-01 15:31:39 +02:00
onli 5257b95dbd entryeditor: hide advanced if empty 2013-10-01 15:29:07 +02:00
onli 54f926a946 unset year when not in cal-mode
closes #18
2013-10-01 14:55:20 +02:00
onli 5894ac7f4f back-button for category-menu 2013-10-01 02:39:57 +02:00
onli 419310c4f7 s/find entries/edit entries 2013-10-01 02:30:32 +02:00
onli eadc5bc027 Add expand to dashboard-comment
temporary, to be replaced with a nice solution, same like for the normal comment view
2013-10-01 01:57:42 +02:00
onli 1e8d3a58e4 dashboard link comments entry
And show the title of the entry as a tooltip
2013-10-01 01:39:28 +02:00
onli 42ca45db68 Fix //-errors in feed
See http://board.s9y.org/viewtopic.php?f=10&t=19485 - needs testing, I only tested that on localhost with / as relative path
2013-10-01 01:15:53 +02:00
Matthias Mees 252970c2e5 Basic support for static blocks (includeentry plugin) in 2k11. 2013-09-28 18:05:07 +02:00
Matthias Mees 87459991a9 Remove stray button nested in a element. 2013-09-26 14:34:42 +02:00
Garvin Hicking ca84b8b85d backend_footer hook 2013-09-24 13:09:42 +02:00
Matthias Mees 1fb8c54efb Back to button style.
Partial manual revert of 168cb146ea.
Please note that this does *not* contain any changes to the UI as
discussed; those will follow later.

References #41
2013-09-23 11:19:31 +02:00
Ian 474953daa5 try to fix - draft preview non-object error
Draft previews threw:
Fatal error: Call to a member function assignByRef() on a non-object in /fullpath/include/functions_entries.inc.php on line 1235, which is the $serendipity['smarty']->assignByRef('entries', $dategroup); line.

Please double check if that is gone now.
2013-09-21 14:30:53 +02:00
Matthias Mees e303d7433d Switch karma plugin options to core config groups.
The karma plugin had its own solution for config option groups in
tabs which didn't work well with the refactored 2.0 backend. We
have a solution for config groups in the core; it now uses this
for better backend consistency.

References #54
2013-09-21 09:13:47 +02:00
Matthias Mees 1c7262b1d8 Introduce secondary netbook breakpoint; move some styles there.
References #58
2013-09-20 13:43:33 +02:00
Matthias Mees 76c554227c Move media library directory filter to filters toolbar.
This is the "replacement" for the tree view directory browser which
was removed to get rid of the Yahoo JS dependency.

References #30
2013-09-20 12:58:32 +02:00
Matthias Mees 4b41477379 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-09-19 16:46:16 +02:00
Matthias Mees 243321d442 Layout for backend statistics.
This should get equal heights at some point, but I'm not sure how
to reference the JS file properly here.

References #54
2013-09-19 16:45:07 +02:00
Ian 28d75a78e5 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-09-19 15:29:15 +02:00
Ian 081fff5e0a ML - exclude frontpage extensions _vti_cnf dir on windows servers 2013-09-19 15:27:43 +02:00
Matthias Mees 5a00738390 Refactor backend markup for extended statistics.
References #54
2013-09-19 15:24:02 +02:00
Matthias Mees 11a5c60ecf Adapt statistics code emitted by karma plugin to recent changes.
References #54
2013-09-19 13:00:49 +02:00
Matthias Mees 7c138b2f77 Refactor backend markup for basic statistics.
References #54
2013-09-19 12:54:29 +02:00
Matthias Mees e056d9b1a7 Adapt backend sidebar entry for serendipity_event_statistics.
References #54
2013-09-19 11:07:38 +02:00
Matthias Mees 3d53184985 Layout for karma plugin's filters/sort.
References #54
2013-09-18 20:22:50 +02:00
Matthias Mees 1e9319b239 Refactor karma plugin backend filters/sort markup.
References #54
2013-09-18 20:12:10 +02:00
Matthias Mees 8a4fbce55b Adapt karma plugin's messages.
References #54
2013-09-18 19:15:19 +02:00
Matthias Mees 14e6ae0cdf Adapt backend sidebar entry for serendipity_event_karma.
References #54
2013-09-18 19:04:20 +02:00
Matthias Mees e2102f6e1e Refactor entryproperties media db button.
Hard-coded input without inline JS, external onclick handler, hide
button on no-js.

References #54
2013-09-18 18:42:18 +02:00
Matthias Mees ca208da2fb Layout for entryproperties.
References #54
2013-09-18 17:57:10 +02:00
Matthias Mees de99ef67e6 Add msg icon to entryproperties plugin.
Also adds a styling hook to admin tpl.

References #54
2013-09-18 15:05:08 +02:00
Matthias Mees d62498a099 Merge pull request #56 from smoeding/stm/fix-css-etag-2.0
Add ETag header to style sheet for better caching.
2013-09-12 09:18:33 -07:00
Stefan Möding 4b17cf9b6f Add ETag header to style sheet for better caching. 2013-09-12 18:07:48 +02:00
Matthias Gutjahr 1dd627c9c3 Fixed wrong variable name 2013-09-06 14:29:46 +02:00
Matthias Gutjahr 5267970499 Added CLI check required for Metatron 2013-09-06 14:23:34 +02:00
Garvin Hicking bb7ca06680 document 2013-09-05 09:25:42 +02:00
Ian 157c498e79 document upport a113f09 and ff2c3b9 2013-09-01 14:15:46 +02:00
Ian 3e79c6d06b Fixed pagination when searching terms with fetchlimit < 4 2013-09-01 14:10:23 +02:00
Ian 74e699e560 Fixed deprecated /e modifier with PHP >= 5.5 in nl2br plugin restore method 2013-09-01 14:09:28 +02:00
Garvin Hicking 1f8dc86e76 document 2013-08-28 12:39:13 +02:00
Garvin Hicking df906a343f upport 2013-08-22 12:32:04 +02:00
Matthias Mees 82aa3db9ff Refactor backend markup for serendipity_event_entryproperties.
Note: This still needs work with styles/layout and inline JS.

References #54
2013-08-19 21:49:23 +02:00
Matthias Mees 19b8cd81eb Adapt backend sidebar entry for serendipity_event_entryproperties.
References #54
2013-08-19 20:19:47 +02:00
Matthias Mees 2489a45e18 Adapt backend markup for "Build cached entries".
References #54
2013-08-19 20:14:42 +02:00
Matthias Mees 0ac1a2f9ce Drop precautionary admin_link class.
References #41
2013-08-19 19:04:23 +02:00
Matthias Mees 294dc041c6 Style toggle headlines as blocks for better visual orientation. 2013-08-19 19:02:37 +02:00
Matthias Mees f811b3f6bb Fix "combined" selector (used for toggle headlines).
References #41
2013-08-19 18:56:12 +02:00
onli f8407848c1 link instead of button in directory-menu 2013-08-19 02:30:32 +02:00
onli 2384f56ec0 personal settings autocomplete fix 2013-08-19 02:25:53 +02:00
onli d0e74392fe use magnific everywhere (#52) 2013-08-19 01:38:48 +02:00
onli e51dae3b9f store multiple categories (#51)
so they don't get lost when collapsing the selector
2013-08-19 01:00:40 +02:00
onli 38e95423b8 git blue datetime cross
it destroys the date input in chrome
2013-08-18 23:41:13 +02:00
onli ae00227275 button for comment-toggle 2013-08-18 23:34:23 +02:00
onli b0c407d4c3 extension fix for resizing 2013-08-18 23:28:15 +02:00
onli e26e98dbba link fullsize image preview directly 2013-08-18 23:22:31 +02:00
onli 6772775696 thumbnail fix when w/o extension
serendipity_getThumbNailPath added an unnecessary dot, breaking thumbnail when using the fullsize image
2013-08-18 23:20:17 +02:00
onli 168cb146ea Use links instead of buttons (#41)
A bit unfamiliar, let's give it some time. The user/groups-menu are clearer now
2013-08-18 20:59:53 +02:00
onli f1343f95f1 GET menu for new groups/users 2013-08-18 20:45:38 +02:00
onli a5ca5718b4 non-error-msg for comments 2013-08-18 19:03:19 +02:00
onli 83ddeca71a bundled-libs, not _libs 2013-08-18 15:02:20 +02:00
onli 5b2f73f74b zenddb-layer (inactive) 2013-08-18 12:48:47 +02:00
onli e63be19fe5 add composer autoloader and libs 2013-08-18 12:46:45 +02:00
onli d9211d2c40 add composer 2013-08-18 12:43:31 +02:00
Matthias Mees c57a1b4da3 Proper scaling in landscape mode.
There used to be a bug in older iOS version which is now fixed in
iOS6, so we can use a proper landscape mode without zoom.
2013-08-17 18:28:24 +02:00
Matthias Mees edfe606cc3 More minor smallscreen layout improvements. 2013-08-17 18:25:26 +02:00
Matthias Mees 1afd639b6a Minor smallscreen layout improvements. 2013-08-17 15:35:53 +02:00
Matthias Mees e1126e464e Replace plugin grablet icon with button.
References #41
2013-08-17 14:08:04 +02:00
Matthias Mees 02d8ddfe42 Replace add upload link by button.
References #41
2013-08-17 13:49:10 +02:00
Matthias Mees 279126262b Remove pointless link. 2013-08-17 13:44:46 +02:00
Matthias Mees bb0f599a2f Change media_rename to button. 2013-08-17 13:40:18 +02:00
Matthias Mees 14faae9c6d Make info texts a bit more readable. 2013-08-17 13:27:34 +02:00
Matthias Mees 51fc20c96f Properly label category delete button. 2013-08-17 13:25:46 +02:00
Garvin Hicking 526e1d2869 upport 2013-08-16 14:58:51 +02:00
Garvin Hicking 17aae92f7f upport 2013-08-15 15:30:56 +02:00
Ian 1b06ae8c30 upport d080d7e 2013-08-11 15:51:43 +02:00
Ian 2b71d7f814 upport 592ed17007
fixed $serendipity['baseurl'] → $serendipity['baseURL']
Maybe this was the real issue!!! Anything to revert?
2013-08-10 15:48:56 +02:00
Matthias Mees 532f5c9c37 Maintenance: clean out obsolete TODOs. 2013-08-01 19:08:17 +02:00
Matthias Mees 398fefa919 New iconfont build.
Removes obsolete wrench icon; replaces icon-off with icon-logout
and icon-eye with icon-globe or icon-zoom-in; adds icon-cancel as
state indicator for smallscreen navigation.
2013-08-01 17:15:41 +02:00
onli 7bdb4d7c6c Fix ML-Popup in html-nuggets (#27) 2013-07-30 17:35:23 +02:00
onli 266f8dd3a8 Fix array_merge-error in ML-Popup (#27) 2013-07-30 17:31:07 +02:00
Matthias Mees 19388f063c Backport fix for comment_author_self. 2013-07-27 23:30:32 +02:00
Ian bfc333624d upport db fix 2013-07-26 20:49:38 +02:00
Matthias Gutjahr c9e9d93f92 Added fix for comment_author_self (cp. http://board.s9y.org/viewtopic.php?f=10&t=19115) 2013-07-26 12:43:09 +02:00
Matthias Mees 55f10e2a09 Bump 2k11 update date. 2013-07-24 16:23:37 +02:00
Matthias Mees bbf358f161 CSS fixes for CKE in plugin configuration.
References #27
2013-07-24 10:16:02 +02:00
onli 068767c80d Load ckeditor for html-nugget (#27)
Need still to be tested and adapted for other editors
2013-07-23 23:30:02 +02:00
Matthias Mees 827248cc74 Remove protocol from google webfonts in 2k11's preview. 2013-07-23 10:47:29 +02:00
Matthias Mees d9835634b8 Remove protocol from google webfonts in 2k11. 2013-07-23 10:46:57 +02:00
Garvin Hicking 8a4467a33c also available on 1.7 2013-07-23 10:04:05 +02:00
Garvin Hicking c5708f746c Added new event hooks for plugin and template installation/update 2013-07-23 09:46:44 +02:00
Garvin Hicking e72aa19280 upport 2013-07-23 09:34:12 +02:00
onli 731b044d50 Drop use of serendipity_admin_image_selector.php
Enhance admin/images.inc.tpl instead. Gets rid of the fieldset-construct (#30)
2013-07-23 03:06:27 +02:00
onli f744ef7464 Use magnific for ML-popup
Also for not wysiwyg
2013-07-22 23:30:43 +02:00
Matthias Mees 21dee86554 Highlight and add an info label to comments pending approval.
References #37
2013-07-21 17:26:13 +02:00
Matthias Mees ffb7d19497 Replaced hard-coded $item.class in sidebar.tpl.
2.0 changed some of the item class names for consistency. BP is
affected by this as well. This does not need to be backported to
master!
2013-07-21 16:32:35 +02:00
Matthias Mees 8994711cd4 Replaced hard-coded $item.class in sidebar.tpl.
References #36
2013-07-21 16:28:16 +02:00
Matthias Mees 8e1081e8b6 UI consistency fix for media selector bar. 2013-07-21 12:23:09 +02:00
Matthias Mees eeba0187bc Move #add_upload button inside the uploads tab to simplify interface.
References #26
2013-07-21 12:09:19 +02:00
Matthias Mees 64f64bd139 Use tab interface for add media upload/download options.
References #26
2013-07-21 11:58:53 +02:00
Matthias Mees 1b98d3c25c Re-add download/hotlink functionality to media upload form.
References #26
2013-07-21 11:05:19 +02:00
onli b2bcd08c99 rework spamblock action buttons
anchor workaround and restored event order, should fix #24
2013-07-21 01:00:15 +02:00
Matthias Mees fac1558de3 Use additional_info functionality for comment data display.
References #33
2013-07-20 23:09:38 +02:00
Matthias Mees b5fafaada2 Dashboard needs to include magnific popup for comment reply overlay.
References #31
2013-07-20 22:58:53 +02:00
Matthias Mees d1bf5f628b Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-07-20 22:52:54 +02:00
Matthias Mees a6993eae9e A better layout for creating categories.
References #32
2013-07-20 22:51:45 +02:00
onli 379b9255b2 Comment reply in backend as modal
Removes the alert dialogue also from the normal popup
2013-07-20 22:47:54 +02:00
Matthias Mees e8867012cd Only display hide subcats info on demand.
References #32
2013-07-20 22:16:45 +02:00
Matthias Mees 0a275a74de Waste less space on install new plugins page.
References #32
2013-07-20 21:57:41 +02:00
Matthias Gutjahr 2e060c3e5f Added userlevel name in user admin section of backend (#28) 2013-07-20 20:43:55 +02:00
Matthias Mees 14c519fa1c Namespace AddKeyword call.
References #29
2013-07-20 20:08:44 +02:00
Matthias Mees a4ed49d510 Fix broken image in entry save confirmation.
References #23
2013-07-20 19:59:15 +02:00
Matthias Mees 5149eaab2a Add active state indicators for show/hide buttons.
References #25
2013-07-20 19:49:32 +02:00
Matthias Mees 210e694e6c Fix minor issues
Changed Reactions to Activity; removed font icons from Install and
Upgrade buttons for plugins.

References #34
2013-07-20 19:14:13 +02:00
Garvin Hicking 9aef3bc41a HOTFIX: We need Smarty. Dunno why this is an issue?! 2013-07-20 16:19:59 +02:00
Matthias Mees 5fed774201 Make installer msgs more compact. 2013-07-20 12:45:16 +02:00
Matthias Mees 9a00e7cba9 Hide more elements which don't make sense on no-js. 2013-07-20 12:30:44 +02:00
onli 3f63746052 textile: Update to 2.5
see http://board.s9y.org/viewtopic.php?p=10435702
2013-07-17 00:03:41 +02:00
Ian 1f17c35656 upport upgrade notes and News 2013-07-16 15:28:31 +02:00
Matthias Mees 62a32c08be Updated bundled jQuery to 1.10.2. 2013-07-16 10:18:07 +02:00
onli 8f42e2346c fix double var 2013-07-10 13:52:36 +02:00
onli 94881ba4c0 Make imagemagick use the real size
See http://board.s9y.org/viewtopic.php?f=3&t=19427
2013-07-10 13:35:08 +02:00
Matthias Mees ebe9695cc6 Temporary CSS fixes for treeview. 2013-07-10 12:00:38 +02:00
Matthias Mees 95dffd86e7 Minor treeview markup cleanup. 2013-07-10 11:55:40 +02:00
Matthias Mees a8e372ebef External onlick handler and button style for tree toggle. 2013-07-10 11:43:34 +02:00
Matthias Mees 60136d89b4 Fix toggle tree in media popup. 2013-07-10 11:38:48 +02:00
Matthias Mees 952a842509 Some installer refinements. 2013-07-10 11:19:27 +02:00
Matthias Mees bf3628f33a Use font icons instead of images in spamblock plugin. 2013-07-09 15:39:04 +02:00
Matthias Mees fde5cbc313 CSS maintenance: drop some unused selectors; UI consistency. 2013-07-09 15:13:42 +02:00
Matthias Mees d767fe7f12 Adapted selection to color scheme. 2013-07-09 14:54:27 +02:00
Matthias Mees 7f622c7401 More readable color scheme for msg_notice. 2013-07-09 10:39:45 +02:00
Matthias Mees 8bb91a070e Fix broken timestamp replacement. 2013-07-08 16:32:45 +02:00
Matthias Mees d277684331 Move the huge screen breakpoint to 1600px. 2013-07-08 16:21:15 +02:00
Matthias Mees d7a63f2277 Move Magnific Popup CSS before @media declarations.
Yes, this is a bit anal, but we might at some point need to over-
write MPs @media styles with our own.
2013-07-08 16:15:10 +02:00
Matthias Mees 3dd430026b JS maintenance: save some variables. 2013-07-08 15:39:52 +02:00
Matthias Mees efcb30ed69 Add alt text to non-wysiwyg img button. 2013-07-08 14:13:29 +02:00
Matthias Mees 96b68f0dba Use namespaced insertText to fix non-wysiwyg img button. 2013-07-08 14:10:33 +02:00
Matthias Mees fcee7086eb More verbose update notification message. 2013-07-08 13:58:11 +02:00
Matthias Mees 13253957ec Give dashboard items content some room. 2013-07-08 13:54:01 +02:00
Matthias Mees bc17eec490 Add 'upcoming' status msg to dashboard entries list.
Also added some general layout styles.
2013-07-08 13:49:22 +02:00
Matthias Mees 625458ecda Better titles for fullsize previews (media/templates). 2013-07-08 11:21:47 +02:00
onli 1a829d5273 dashboard: fix entries-box 2013-07-08 10:43:54 +02:00
onli 2a3d80ac18 proper content-type for serendipity_editor.js 2013-07-07 23:05:00 +02:00
onli 71c986ed29 dashboard: don't die when no entries exist 2013-07-07 23:04:19 +02:00
onli 5d99bd934e remove serendipity_editor.js from installer, cause the link got translated to the html-page 2013-07-07 23:01:23 +02:00
onli fb100aaa79 use magnific popup 2013-07-07 22:43:11 +02:00
onli a4ec72dbd4 Dashboard: Also show drafts 2013-07-07 20:42:20 +02:00
onli 8f3b3fabaa dashboard: fix commentlink 2013-07-07 19:14:07 +02:00
onli 4f719c7c7e spamblock: show captcha-example at bottom (echo/return) 2013-07-07 19:00:34 +02:00
Matthias Mees 02a07a59d9 Improved header layout on small screens. 2013-07-07 18:24:43 +02:00
Matthias Mees 078bf9a18a Replace responsive nav plugin with a simpler solution.
responsive-nav.js is nice, but it imposes a performance issue and
we already have code for that behaviour. This is much simpler, but
still lacks some accessibility feature (aria-hidden). I'll add
those later after some proper accessibility testing.
2013-07-07 18:07:34 +02:00
Matthias Mees cf284194f2 Make further links collapsible. 2013-07-07 17:25:48 +02:00
Matthias Mees cba3d9acdb Restyle the login form. 2013-07-07 16:56:40 +02:00
Matthias Mees 7cfac8b59c Lighter footer style. 2013-07-07 15:25:26 +02:00
Matthias Mees 65df50346a Minor fix for installer styles. 2013-07-07 12:41:03 +02:00
Matthias Mees b92cf09eb2 Onclick handler for dashboard bookmarklet hint. 2013-07-06 13:38:44 +02:00
Matthias Mees 175e73202a Only fire smallscreen nav script if there is a nav. 2013-07-06 13:32:45 +02:00
Matthias Mees 43a2225778 Minor markup maintenance. 2013-07-06 13:20:27 +02:00
Matthias Mees 7811150fe5 Use custom toggle for smallscreen nav. 2013-07-06 09:54:12 +02:00
Matthias Mees 7a94df491a Styling the captchabox. 2013-07-06 00:53:35 +02:00
Matthias Mees f6ba7f0e0e Some subtle UI refinements for polish. 2013-07-06 00:25:32 +02:00
Matthias Mees b4347bd901 A little 'bling' for the color scheme. 2013-07-06 00:01:43 +02:00
Matthias Mees 697aef6be6 Move comment author to details content.
Turns out it wasn't a good idea to have the comment author as the
summary element's content since it prevents clicking the comment
author action (because expanding the details element is the click
action).
2013-07-05 22:02:11 +02:00
Matthias Mees 58e8752e45 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-07-05 21:32:51 +02:00
Matthias Mees 096e4e917b Make sure comment summaries are not hidden in dashboard. 2013-07-05 21:32:35 +02:00
Matthias Mees aa08d8c7ae Tiny fix to improve rendering of navigation. 2013-07-05 21:30:20 +02:00
onli d80a8334c8 Use return instead of echo in the remaining core
Debug-messages still may use echo, and some functions in functions_image and trackback still use it to generate progress messages, which should get cleaned up as well but is not that urgent
2013-07-05 19:16:11 +02:00
onli 0614fcdf51 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-07-05 14:47:33 +02:00
Matthias Mees ce2a679a3c Move JS plugins out of domready area. 2013-07-05 14:39:08 +02:00
Matthias Mees 0765354589 (Basic) styling for nav on larger screens. 2013-07-05 14:34:32 +02:00
onli 9d3d04a00c upport (from falks 1.7-2.0-merge) 2013-07-05 14:08:24 +02:00
Matthias Mees 2ab6c09339 Added smallscreen navigation. 2013-07-05 13:59:40 +02:00
Matthias Mees 532a126289 Introducing new header color scheme. 2013-07-04 23:54:31 +02:00
Matthias Mees be5c39e50a Layout changes to make styling the nav easier. 2013-07-04 23:27:08 +02:00
Matthias Mees b2b11a6ffd Reorganize core menu items. 2013-07-04 22:24:59 +02:00
Matthias Mees b66618093a Oops. Testing code relicts. 2013-07-04 21:12:28 +02:00
Matthias Mees 3d5059e882 Restyles core dashboard. 2013-07-04 21:08:42 +02:00
onli 145ced3ea9 remove image editor from core 2013-07-04 20:25:21 +02:00
Matthias Mees ce83b03fc7 Safari needs this to make info toggler clickable. 2013-07-02 22:09:31 +02:00
Matthias Mees 26d4b32987 Remove s9y image editor from 2k11 admin theme.
This removes the proof-of-concept image editor from 2k11 – as far
as I can see/do that. @onli should probably have a look at whether
there are other code parts which need/should be removed along with
this.
2013-07-02 12:15:36 +02:00
Ian eaa8a29d2d upport e7c93ad835 2013-07-01 18:47:45 +02:00
Matthias Mees 67de70303e Position field info left. 2013-06-30 16:23:27 +02:00
Matthias Mees 8bc65c5320 A more compact view for comments. 2013-06-29 16:06:13 +02:00
Matthias Mees 2f079c3ca4 Even further simplied header styles. 2013-06-29 15:31:49 +02:00
Matthias Mees 2f566a3c25 CSS-only zebra-striping for media upload.
This will only work in modern browsers, but it's the only way to
get zebra-striping for this because new elements will be inserted
in the DOM using jQuery.
2013-06-29 14:11:45 +02:00
Matthias Mees 41c4c7ec37 Adapt non-wysiwyg editor fields to match wyiwyg height. 2013-06-29 13:53:29 +02:00
Matthias Mees 32f77551ae A simpler header layout. 2013-06-29 13:43:49 +02:00
Matthias Mees c261027930 A simpler header layout. 2013-06-29 13:35:55 +02:00
onli f87121f42d fix ckeditor not inserting media in the right textarea 2013-06-28 19:05:39 +02:00
Ian 070fdb7275 upgrade Smarty to 3.1.14 - see changelog 2013-06-28 16:56:23 +02:00
onli cecf41cb20 Document (BC-)relevant 2.0 changes 2013-06-28 16:19:40 +02:00
Matthias Mees 8091a4fc34 Replace href-less insert_image with button. 2013-06-28 14:29:43 +02:00
Matthias Mees 47ca296b66 Replace status timestamp with a simple info tooltip. 2013-06-28 14:21:37 +02:00
Matthias Mees a245a28c4b Fix insert (category) image JS. 2013-06-28 12:24:24 +02:00
Matthias Mees f7a7dc61d3 Use namespaced call to SetCookie. 2013-06-28 12:07:44 +02:00
Matthias Mees 2f5daac8b2 Use namespaced call to toggle_categoryselector. 2013-06-28 12:05:54 +02:00
Matthias Mees 67c3f8fcc4 Update jQuery to 1.10.1 including jQuery Migrate.
NOTE: The jQuery Migrate plugin is only included temporarily for
      debugging purposes. If and when everything (including plugins
      and themes) is tested with jQuery 1.10.1, Migrate can and
      will be removed.

      The reason for this is that jQuery 1.9 deprecates some stuff,
      see http://jquery.com/upgrade-guide/1.9/. If core, plugins or
      themes use a deprecated feature, jQuery Migrate will note it
      in the browser's JS console.
2013-06-28 11:59:21 +02:00
Matthias Mees 1fdec50702 Dashboard layout. 2013-06-28 11:36:45 +02:00
Matthias Mees 0d23cb0d30 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-27 23:39:06 +02:00
Matthias Mees 7c3e390c04 Add plainList, drop iconfont from installer to fix installation. 2013-06-27 23:38:51 +02:00
onli 36aee4324c fix last page of the installer 2013-06-27 23:15:03 +02:00
Matthias Mees 1385341bc8 Layout and CSS fixes for the installer. 2013-06-27 22:41:34 +02:00
onli 8a188747ae Fix installer, smartification broke it
Sorry Falk
2013-06-27 21:01:16 +02:00
Matthias Mees adcb2f3e87 Skip toggle_extended if wysiwyg editor is used.
With a wysiwyg editor, collapsing the extended entry editor does
not work, so we'll just skip it in that case.
2013-06-27 12:39:23 +02:00
Matthias Mees 5e40d76375 Reconfigured CK editor.
– removed buttons which produce unsemantic markup
– reordered buttons according to expected usage
2013-06-27 12:30:23 +02:00
Matthias Mees d8425e7bd9 Open large template preview in seperate window.
This replicates the behaviour of fullsize view for media db images.
Ultimately, we'll want to replace this with a lightbox or modal.
2013-06-27 11:23:48 +02:00
Matthias Mees e3c113f11d Limit template preview width. 2013-06-27 11:21:10 +02:00
onli fda91f045d Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-26 21:33:12 +02:00
onli 99eb79957e Move ckeditor into htmlarea
Easier for shared installations
2013-06-26 21:31:04 +02:00
Matthias Mees a683f775ce Save some space in entry editor on large screens. 2013-06-25 11:14:26 +02:00
Matthias Mees 399261b643 A more compact view for the dashboard. 2013-06-25 11:10:04 +02:00
onli ce79ed9657 ckeditor-init for more than one textarea 2013-06-25 01:14:48 +02:00
onli f2cf17804b fix toggle_extended (missing namespace) 2013-06-25 01:12:28 +02:00
onli 4c95630c4c Replace xinha with ckeditor
Removes also a lot of the code needed by the wysiwyg-plugins, but the whole spawn()-logic has to get checked anyway
2013-06-25 01:05:19 +02:00
onli ce9ac484d9 namespace serendipity_editor.js 2013-06-24 23:17:16 +02:00
onli edaf7e9d6f serendipity_editor.js.tpl: escapeBrackets(str) 2013-06-24 21:56:54 +02:00
Matthias Mees 49181fb06d A better solution for show/hide additional form info text.
This is based on the show/hide functionality already used in the
backend in various places with a nice no-js fallback.o
2013-06-24 20:59:03 +02:00
Matthias Mees 3c3369f64b Markup maintenance. 2013-06-24 16:08:26 +02:00
Matthias Mees 765e232693 Replace some icons. 2013-06-24 12:01:24 +02:00
Matthias Mees 35b40c4434 New iconfont build. 2013-06-24 11:48:45 +02:00
Matthias Mees 17e0f159b0 Revert jQuery tooltips. 2013-06-24 11:04:56 +02:00
Matthias Mees 1d95cf19f0 Manually revert 37dfa0. 2013-06-24 10:49:13 +02:00
Matthias Mees c3f21c4a95 Template preview does not need these. 2013-06-24 02:59:37 +02:00
onli a7ad3dd8e8 template preview: remove inline styles 2013-06-23 21:47:46 +02:00
onli ea317649ac Use bigger previews in template list
TODO: Generate real previews instead of downscaling the bigger ones, Cleanup inline css
2013-06-23 21:38:23 +02:00
onli c2f788c69b spartacus: improve template preview cache 2013-06-23 21:37:21 +02:00
onli 6d3404c763 spartacus: only set template fullsize preview if existing, cached 2013-06-23 21:13:45 +02:00
Matthias Mees 52a24d511e Let's not style anything in the new dashboard until it's finished. 2013-06-23 20:37:47 +02:00
Matthias Mees 9ef4523f47 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-23 20:20:07 +02:00
Matthias Mees 37dfa061c4 More compact config items by stashing away extra info in tooltips. 2013-06-23 20:18:58 +02:00
onli 9a989dddb3 Remove Advanced-JS option 2013-06-23 20:12:06 +02:00
onli ae2ff8a3b2 fix missing import-inputs 2013-06-23 19:54:42 +02:00
onli 80a34b036d Implement Dashboard into the core
Update-Notifier, future Entries, new comments so far
2013-06-23 19:47:14 +02:00
Matthias Mees f2e39bf9be CSS maintenance: drop unused classes, some vendor prefixes. 2013-06-23 19:38:41 +02:00
Matthias Mees 5f2339d105 Better tooltips for categories and media db dirs. 2013-06-23 19:13:26 +02:00
Matthias Mees f5b4355a9a Tooltip for configure anti-spam. 2013-06-23 18:56:44 +02:00
Matthias Mees 0bc97cbc88 Tooltips, tooltips, tooltips. Everywhere. Almost. 2013-06-23 18:45:58 +02:00
Matthias Mees 3bd03b0129 Add jQuery tooltips.
There are responsive and touch-friendly, including a tweakable
timeout so they don't get too annoying when used on a collection
of icon buttons. Demoed on reset timestamp button in entry editor.
2013-06-23 18:25:37 +02:00
onli 67a0b93456 fix noscript pluginmove 2013-06-23 16:23:08 +02:00
Matthias Mees 1d66235e57 Config options layout fix. 2013-06-23 13:37:24 +02:00
Matthias Mees d653ccd38b Minor typo. 2013-06-23 13:20:08 +02:00
Matthias Mees d30b62ad0a Zebra striping for plugin options. 2013-06-22 15:54:35 +02:00
Matthias Mees b7b3415e9a Zebra striping for theme options.
TODO: Needs to be checked with a theme like BP which actually uses
      nested configuration groups here once all themes use the 2k11
      backend.
2013-06-22 14:56:28 +02:00
Matthias Mees 22cc0ce643 A hint of zebra striping for create/edit groups. 2013-06-22 14:26:01 +02:00
Matthias Mees 5bec2323ac Switch show_config_all plus/minus icon. 2013-06-22 14:11:59 +02:00
Matthias Mees 95b5764edf Zebra striping for configuration groups. 2013-06-22 13:57:08 +02:00
Matthias Mees 08fe4a0c96 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-22 13:33:36 +02:00
Matthias Mees 06f6a164f1 Do not use .clearfix for layout selectors. 2013-06-22 13:31:49 +02:00
onli a654b13a9a Complete include_once usage, romove constants 2013-06-22 12:32:54 +02:00
Matthias Mees f0b7d6631b Spped up configuration display.
Since we now hide controls on no-js, we can skip some JS which
affected rendering performance.
2013-06-22 11:14:18 +02:00
Matthias Mees 01b390fcb7 Clean up comments reply click handler. 2013-06-21 23:06:50 +02:00
Matthias Mees 727a49fb46 UI consistency: sync cancel/submit orders. 2013-06-21 22:50:58 +02:00
Matthias Mees e9f55cc418 JS cleanup. 2013-06-21 22:24:01 +02:00
Matthias Mees dc87322f43 The OR is redundant. 2013-06-21 20:25:17 +02:00
Matthias Mees 6560136ec4 UI consistency: icon button color. 2013-06-21 20:23:31 +02:00
Matthias Mees 6a70625563 UI consistency fixes for plugin installation. 2013-06-21 20:10:50 +02:00
Matthias Mees fca08c03bf Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-21 18:25:59 +02:00
Matthias Mees f572ff84ea Media upload form rewrite.
This version no longer requires a hidden form template in the DOM,
which makes the logic for cloning the upload form a bit easier to
understand and avoids an initial clone to put the initial upload
for into the DOM.
2013-06-21 18:23:19 +02:00
onli cbe07715fd use include_once 2013-06-21 18:11:03 +02:00
Matthias Mees 01a93d5488 Adapt fillInput() to media upload; fix addUploadField(). 2013-06-21 17:58:03 +02:00
Matthias Mees fd2f4ea5bf Drop foreign upload from add media form. 2013-06-21 14:30:40 +02:00
Matthias Mees f7dd8ba630 Externalize onsubmit events. 2013-06-21 14:16:46 +02:00
Matthias Mees 748cf0b8b1 Insert .media_choose preview dynamically; hide stuff on no-js. 2013-06-21 13:49:26 +02:00
Matthias Mees 64a9f4fef7 Layout fixes for plugin configuration. 2013-06-21 13:16:37 +02:00
Matthias Mees 265608196d More input focus indications being cut off. 2013-06-21 12:54:02 +02:00
Matthias Mees b4b6f98d1f Missed a spot. 2013-06-21 12:50:05 +02:00
onli da64502850 fix missing load of media-config-item, small cleanup 2013-06-21 12:44:29 +02:00
Matthias Mees 93158337c1 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-21 12:35:11 +02:00
Matthias Mees f1a6e22cb6 Hide things which don't make sense on no-js. 2013-06-21 12:34:54 +02:00
onli 342d8676bf show_plugin_config: use return instead of echo 2013-06-21 12:28:43 +02:00
Matthias Mees 6aa0f69ce0 Fix for input focus indication being cut off. 2013-06-21 12:12:34 +02:00
Matthias Mees 318bd7a92d Icon button for install new plugins. 2013-06-21 11:44:57 +02:00
Matthias Mees d62bb7a516 Icon button for set as template. 2013-06-21 11:41:54 +02:00
Matthias Mees f44424a75a New iconfont build.
Added new icon 'download', remove unused icon 'link'.
2013-06-21 11:37:35 +02:00
Matthias Mees c2a2058fcf Icon button for theme options. 2013-06-21 11:31:37 +02:00
Matthias Mees 02a6a45796 Icon button for configure anti-spam methods. 2013-06-21 11:24:55 +02:00
Matthias Mees 5798ca100f Minor UI consistency fixes. 2013-06-21 11:19:39 +02:00
onli 487f71bd0b Fix preview of future entries
by hiding the footer. NOTE: This whole area needs a cleanup and is not smartified yet
2013-06-20 00:07:23 +02:00
onli 99caf8d74e set default plugins to their new canonical names so installer can work again 2013-06-19 23:23:38 +02:00
onli b79cf1b9b4 group plugin dragdrop targets 2013-06-19 23:18:46 +02:00
Matthias Mees 8a58c5eb1a Some minor UI consistency fixes. 2013-06-19 15:36:01 +02:00
Matthias Mees e1aac9cc13 Simplified media upload submit; added icon button. 2013-06-19 10:26:12 +02:00
Matthias Mees 0dd6014135 Better styling for media file metadata. 2013-06-19 10:13:06 +02:00
Matthias Mees dbaf23ed69 Media file metadata rewrite.
Also fixes media upload form not being submitted.
2013-06-19 09:58:41 +02:00
Matthias Mees 45986fb2da External event handlers for theme options choose media. 2013-06-19 08:18:31 +02:00
onli 637a75f0fc propagate token_url for js-initiated form-actions like ML-rename 2013-06-18 22:21:22 +02:00
onli a52e05598b fix ML-Image insert in template options 2013-06-18 22:05:36 +02:00
Matthias Mees f32de44b19 Icon buttons for toggle expand all. 2013-06-18 19:58:29 +02:00
Matthias Mees 04372a3738 Inline styles. Still. Jeez. 2013-06-18 16:52:51 +02:00
Matthias Mees 6906e2cac4 External onclick handler for checking inputs on submit. 2013-06-18 16:49:59 +02:00
Matthias Mees 7818fb1c96 External onclick handler for adding keywords. 2013-06-18 16:45:48 +02:00
Matthias Mees 96e7ad74c9 Avoid unnecessary equal heights. 2013-06-18 16:34:48 +02:00
Matthias Mees 664ed5c7aa Different style for showitem media thumb. 2013-06-18 16:26:59 +02:00
Matthias Mees d139cc3fb1 Remove obsolete upload button. 2013-06-18 16:11:57 +02:00
Matthias Mees 8ce7457f3f External onclick handler for media cropping. 2013-06-18 16:07:21 +02:00
Matthias Mees 0a9b5f4f0a Remove obsolete onclick handler for media resize. 2013-06-18 14:36:16 +02:00
Matthias Mees 850652f527 External onclick handler for media fullsize view. 2013-06-18 14:27:35 +02:00
Matthias Mees 6bba09cbf2 External onclick handler for renaming media file.
NOTE: Renaming is not completed, submitting the prompt results in
      an error msg:

"Your browser did not sent a valid HTTP-Referrer string. This may
have either been caused by a misconfigured browser/proxy or by a
Cross Site Request Forgery (XSRF) aimed at you. The action you
requested could not be completed."

      This is beyond my JS knowledge. @onli …?
2013-06-18 14:12:07 +02:00
Matthias Mees 891792b987 Fix media db popup layout. 2013-06-18 13:09:51 +02:00
Matthias Mees c8ccc5c9bd New layout for choose media config item. 2013-06-18 12:01:11 +02:00
Matthias Mees a57a39082b Remove obsolete template options styles. 2013-06-18 11:31:34 +02:00
onli 8da2368e26 fix js-init error 2013-06-16 19:57:26 +02:00
onli 6987468364 remove links to serendipity_define.js.php 2013-06-16 19:49:31 +02:00
onli 566d8606d0 remove unused serendipity_define.js.php 2013-06-16 19:45:28 +02:00
onli 02d4df2a02 Move internal plugins into plugin-folder
Stepping stone to later use spartacus for all of them. Will break installed plugins
2013-06-16 19:39:44 +02:00
onli 143cb1de21 fix serendipity_admin_image_selector.php 2013-06-16 16:00:47 +02:00
onli 06f65b44b3 datetime-local fallback and fix timestamp-button 2013-06-16 15:56:35 +02:00
onli 325d3be574 editor: use date-timelocal, works in chrome 2013-06-16 15:20:50 +02:00
onli c7162adf31 fix entries-preview 2013-06-16 15:13:18 +02:00
onli 2af76d2e69 Repair ML-Upload in editor
Change function-comments according to the new logic
2013-06-16 14:13:51 +02:00
Matthias Mees 7a8b5e755f Maintenance: type attribute is obsolete for script elements in HTML5. 2013-06-15 19:37:10 +02:00
onli 0dfdb3af4e Add plugin-hook js 2013-06-15 16:16:04 +02:00
onli be3d4d1d74 Add plugin-hook "js"
Use $link_head_script in a smarty-template to emit the path to the generated virtual javascript file
2013-06-15 16:14:14 +02:00
onli 33ff9c1f7c Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-15 15:40:58 +02:00
onli 347311e78d rely on smarty-init-css also in the backend 2013-06-15 15:40:42 +02:00
onli 0044e210ae Remove layout.php remains 2013-06-15 15:29:54 +02:00
Matthias Mees 606764fc9e External onchange handler for media upload. 2013-06-15 14:10:37 +02:00
onli b2fa981e36 serendipity_admin.php: move installer template selection to the bottom 2013-06-14 23:37:00 +02:00
onli e62eb56f4a drop smarty_display-option from ML
Always use smarty
2013-06-14 23:31:24 +02:00
onli 43a8bb9a39 smartify placement of entryeditor page elements 2013-06-14 23:26:49 +02:00
onli d6857176d8 further smartify serendipity_iframe 2013-06-14 23:05:09 +02:00
onli 574ab0a834 fix hidden valeus in entryform 2013-06-14 22:45:16 +02:00
onli 8e5ec60e2d remove no-smarty-bc-mode from genpage 2013-06-14 21:42:06 +02:00
onli 4de8ff7269 Further smartify show_plugins()
Remove ownership() and placement_box()
2013-06-14 21:37:06 +02:00
onli faa0781c8b smartified serendipity_emit_htmlarea_code 2013-06-14 20:39:29 +02:00
onli 38f71856a2 further smartified serendipity_printEntryForm 2013-06-14 19:42:22 +02:00
Matthias Mees 91ff747733 External onchange handlers for media scale. 2013-06-14 19:07:26 +02:00
Matthias Mees 41734c682e Move rescale() to serendipity_editor.js.tpl.
Also jQueryfied rescale() a bit, simplified rescale preview.
2013-06-14 19:00:01 +02:00
Matthias Mees d7144c0a24 Drop unused FT_toggle(). 2013-06-14 17:59:44 +02:00
Matthias Mees 2b2ed7551d External onclick handler for scaling images. 2013-06-14 17:18:37 +02:00
Matthias Mees a6470864fb External onclick handlers for comments. 2013-06-14 17:09:25 +02:00
Matthias Mees a2021c2704 Remove editor toolbar legacy fallback. 2013-06-14 16:33:20 +02:00
Matthias Mees 1331f5b634 Minor CSS fixes (media db). 2013-06-14 11:57:05 +02:00
Matthias Mees a7c7d1426e External onclick handler for entry preview. 2013-06-14 11:32:41 +02:00
Matthias Mees bc0549397a External onclick handlers for editor tools. 2013-06-14 11:24:55 +02:00
Matthias Mees 5894a82ced Drop editor toolbar access keys.
The accesskey attribute is rarely used due to a lack of standards
and cross-browser implementation. Most screenreader users find them
confusing.
2013-06-14 09:36:24 +02:00
Matthias Mees 11853c6f5b Remove inline JS to hide editor tools. 2013-06-14 09:26:36 +02:00
Matthias Mees cdeb113846 Replace inline onlick handler for go back. 2013-06-13 16:07:44 +02:00
Matthias Mees 97b847314b Dropped invertSelection inline onclick handlers. 2013-06-13 16:02:41 +02:00
Matthias Mees 6cb397247f Replace onclick handler for reset timestamp. 2013-06-13 15:53:49 +02:00
Matthias Mees a658e20b27 New iconfont build.
This includes only the icons actually used or intended to be used
in the backend. Please note that unfortunately, some class names
have changed. Also some icons have been exchanged.
2013-06-11 12:54:58 +02:00
Matthias Mees f5837b5245 Maintenance: cleaned out some TODO notes. 2013-06-10 12:54:19 +02:00
Garvin Hicking 45ad808d0d port 2013-06-09 20:08:07 +02:00
Matthias Mees d847b85c7a Proper pagination values for entries/media; thanks to @onli. 2013-06-09 18:29:28 +02:00
onli 4927f38429 {} shows the amount of available entries in the entry-list 2013-06-09 17:57:56 +02:00
onli 294fef724b ML: Give Smarty amount of total images 2013-06-09 17:51:48 +02:00
onli 6413493e9d Admin-entrylist: give to smarty 2013-06-09 17:19:09 +02:00
Matthias Mees 393bbd547c Better markup for manage dirs messages. 2013-06-09 16:26:26 +02:00
Matthias Mees 60657014ea Show/hide full comment. 2013-06-09 16:16:59 +02:00
Matthias Mees daf199c520 Pagination info for entries/media; missing some variables. 2013-06-09 15:47:52 +02:00
Garvin Hicking 451601348a upport 2013-06-09 13:40:10 +02:00
Matthias Mees e8447d24ac Pagination info for media db; needs proper lang constant. 2013-06-09 13:04:14 +02:00
onli 2a8225ddeb Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-09 12:45:33 +02:00
onli b0cbdd8ba7 fix ML return/echo mix so used template isn't shown anymore 2013-06-09 12:45:14 +02:00
Ian e1789dcc81 fixed c47bd93 extended hook to respect toggle 2013-06-09 12:26:28 +02:00
Ian c47bd93bb2 remove backend_entry_toolbar_* hook doublette 2013-06-09 12:09:21 +02:00
Matthias Mees 886a027c6b Minor CSS fix. 2013-06-08 16:39:49 +02:00
Matthias Mees a9774d3920 Backported checkSave() function. 2013-06-08 15:41:25 +02:00
Matthias Mees 391882fbf6 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-08 15:38:33 +02:00
Matthias Mees bb33238efc Minor CSS fixes. 2013-06-08 15:38:20 +02:00
onli 2113c1308c removed unused onlick checkInput from editor save 2013-06-08 15:34:35 +02:00
onli dc6a5fce29 fix setcookie in media library 2013-06-08 13:03:13 +02:00
onli ad98a01899 cleanup of images.inc.php 2013-06-08 12:24:46 +02:00
Matthias Mees 0fa8720145 Just documenting something. 2013-06-07 23:39:29 +02:00
Matthias Mees 0feb4c18c2 Fix checkInputs error in media upload. 2013-06-07 23:30:13 +02:00
onli 3472e11ef8 Include SetCookie-calls into entries.tpl, first cleanup of admin/entries.inc.php
Instead of using serendipity_JSsetCookie, and using .ready
2013-06-07 17:45:20 +02:00
Matthias Mees 1b4c33da51 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-07 15:21:23 +02:00
Matthias Mees 331f2c441a Add getfilename helper function; adapted checkInputs() to 2.0.
NOTE: checkInputs() is currently broken as I don't have time for
      further debugging right now. I assume it's broken due to
      changes to the upload form by jQueryfying addUploadField().
2013-06-07 15:18:20 +02:00
onli 0933bf3682 renamed plugin-config templates 2013-06-07 15:15:57 +02:00
Matthias Mees d882a94368 Added missing checkInputs() and helper function from master. 2013-06-07 15:07:07 +02:00
Matthias Mees a96a8184a2 Fix uncaught exception error due to wrong selector being applied. 2013-06-07 14:14:50 +02:00
Matthias Mees a3c03d139a Added class to logged in msg. 2013-06-07 13:44:30 +02:00
Matthias Mees 9ad88fece8 Minor CSS cleanup. 2013-06-07 13:37:43 +02:00
Matthias Mees 44a9f8491d Restyled and less breakable header layout. 2013-06-07 13:23:34 +02:00
Matthias Mees b528c2e57c Now we finally don't need those any longer. 2013-06-07 12:01:17 +02:00
Matthias Mees 37e40e4a0d Use iconfont button for toggle_extended(). 2013-06-07 11:58:47 +02:00
Matthias Mees 0861cbbd80 Removed obsolete comments; improve functions. 2013-06-07 11:40:14 +02:00
Matthias Mees 43b46ceccb Only fire those if there actually is an entry editor. 2013-06-06 22:07:39 +02:00
Matthias Mees 1f3a6348b0 Of course we still need those for the time being. 2013-06-06 22:06:23 +02:00
Matthias Mees 0b4379b06d Removed obsolete functions. 2013-06-06 21:03:14 +02:00
Matthias Mees a7e100888b Switch personal/configuration/create/edit users to smartified config. 2013-06-06 20:41:33 +02:00
onli 357285a579 smartified serendipity_guessInput 2013-06-06 19:19:10 +02:00
onli 6447659882 config_template: respect PHP-decision not to print config-option 2013-06-06 18:34:26 +02:00
onli 3df663e0fe typo 2013-06-06 18:31:09 +02:00
onli 35625c3f81 smartify serendipity_printConfigTemplate 2013-06-06 18:26:49 +02:00
Matthias Mees 97dc035bcc Use iconfont button for category selector; add styling. 2013-06-06 15:49:37 +02:00
Matthias Mees 2d51cdae66 Maintenance: removed duplicate function, moved editor functions. 2013-06-06 14:48:41 +02:00
Matthias Mees f166322976 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0
Conflicts:
	templates/2k11/admin/serendipity_editor.js.tpl
2013-06-06 14:36:03 +02:00
Matthias Mees e5addc8965 jQuery rewrite of config options show/hide/all.
This will replace showConfig + showConfigAll globally once @onli has
switched the parts which don't use the smartified code base yet. It
also adds a sensible no-js fallback and proper state indicators.
2013-06-06 14:27:56 +02:00
onli 8267989279 restore extended editor toggle, renamed category toggle function 2013-06-06 14:20:52 +02:00
onli a8d7c8a9c4 restore category_toggle 2013-06-06 14:13:23 +02:00
Matthias Mees d4d3515c8a Some minor preparations for config show/hide/all. 2013-06-06 12:52:44 +02:00
Matthias Mees f40546b1f5 chkAll function is used by some plugins. 2013-06-06 11:36:28 +02:00
Matthias Mees a41b66ae8f Another attempt to style the type-based filters. 2013-06-05 21:14:02 +02:00
Matthias Mees 4d8eab61cb Adapted installer.tpl to 2k11/2.0 backend. 2013-06-05 19:48:52 +02:00
Matthias Mees 76c49a67dd Maintenance: removed obsolete functions. 2013-06-05 18:46:51 +02:00
Matthias Mees af0115d4f5 Clean up code comments. 2013-06-05 18:45:34 +02:00
Matthias Mees cb09463326 jQuery rewrite of invertSelection() function.
This works for entries, comments and media items including changing
the multidelete marker. Needs to be tested with Karma plugin which
uses the old function as well.
2013-06-05 18:37:55 +02:00
Matthias Mees 26df96b886 Multidelete markers for plugins. 2013-06-05 16:15:09 +02:00
Ian 4e9c666886 upport e2bad7d 2013-06-05 11:48:04 +02:00
onli 8bcfa19259 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-04 18:17:24 +02:00
onli 9944effb93 Further smartify installer
by placing the code of serendipity_admin.php into installer.inc.tpl. Also removes php-fallback.
2013-06-04 18:15:25 +02:00
Matthias Mees 8d72e632cc Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-04 17:51:48 +02:00
onli 566359a20f test: filecategory-buttons as header bar 2013-06-04 17:31:39 +02:00
onli e3a126af54 media_pane: Move filters from sort-order to filters 2013-06-04 16:45:05 +02:00
onli bc6f48e1b6 instant reaction from media filter buttons 2013-06-04 15:53:00 +02:00
onli 885150daac fix category icon selector
window.open with &amp; lead to filename_only being lost, so additional options were shown
2013-06-04 12:16:26 +02:00
Matthias Mees e404792c29 Maintenance: clean out tpl files. 2013-06-04 11:53:12 +02:00
Matthias Mees 3d38d0be9f Maintenance: edit JS comments, mark functions for removal. 2013-06-04 11:17:37 +02:00
Matthias Mees 43146eac1f Maintenance: stylesheet readability. 2013-06-04 10:55:01 +02:00
Matthias Mees 3997e7fa65 Multidelete highlighting for media db items. 2013-06-04 06:54:44 +02:00
Matthias Mees 5a77d39355 Multidelete highlighting for entries.
Also made highlightComment() and multidelete highlighting more
flexible to use.
2013-06-04 06:49:44 +02:00
Matthias Mees d348235050 Hide/show media db filters and sorting. 2013-06-04 00:05:54 +02:00
onli 4617ed15a9 templates: using correct data for overlay 2013-06-03 21:59:32 +02:00
Matthias Mees e7d3488ea6 Limit media file info width. 2013-06-03 20:44:41 +02:00
Matthias Mees 23d1a51134 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-03 20:20:56 +02:00
Matthias Mees cb5c5fc67c Include comments pagination heading in pagination. 2013-06-03 20:20:43 +02:00
Matthias Mees 6fdef21374 Adapt spamblock plugin link to 2.0 backend. 2013-06-03 20:06:00 +02:00
onli 32be9063b8 give thumbSize into the ML 2013-06-03 20:05:37 +02:00
Matthias Mees 8b3c8024a7 Hide/show comments filters, prepare Spamblock button for toolbar. 2013-06-03 20:02:00 +02:00
Matthias Mees e4a8a2662b Entry list filters alignment. 2013-06-03 17:13:05 +02:00
Matthias Mees 14aad65c0c Hide/show entry list filters, sorting etc. Needs more styling. 2013-06-03 17:01:59 +02:00
Matthias Mees 0e07a54085 Template info no-js fallback fix. 2013-06-03 15:13:04 +02:00
Matthias Mees 60797bddca Info overlay for templates.
NOTE: This would be way nicer if template preview images were a
      bit larger (just like media db thumbnails), but I guess
      were going to have to discuss how to implement that first.
2013-06-03 15:07:46 +02:00
Matthias Mees ca4a0c37e8 Show info button must be visible if file is not editable. 2013-06-03 13:25:30 +02:00
Matthias Mees d02fea28ea A more usable overlay for media files; fixed duplicate ids.
This looks about the same as @onli's solution, but more usable on
smaller and/or touch devices since it's triggered by a button which
also makes sense if JS is deactivated. Has a no-js fallback, too.
2013-06-03 13:20:41 +02:00
Matthias Mees d1e79a7d7a Minor CSS fixes. 2013-06-03 10:59:38 +02:00
Matthias Mees 19bebc50de Minor fixes. 2013-06-02 16:13:12 +02:00
Matthias Mees 78ee899da0 Properly styled pagination for media db, entries + comments.
Also, the pagination is now being clones using JS.
2013-06-02 14:59:31 +02:00
Matthias Mees df283db810 Media db overlay cleanup. 2013-06-02 13:39:21 +02:00
Matthias Mees dcc02f75c3 Typos. 2013-06-01 18:28:13 +02:00
onli 328a77bd03 fix image selection 2013-06-01 16:53:55 +02:00
Matthias Mees 0c7bf67e99 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-01 15:39:03 +02:00
Matthias Mees f79a258c80 Fixes highlighting of comments selected for multidelete.
NOTE: Also figured out the mystery about the duplicate function
      invertSelection, but will take care of that in a seperate
      commit. Documented it in a comment, though.
2013-06-01 15:37:21 +02:00
onli 4dc037bac8 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-06-01 15:21:51 +02:00
onli e1d403057b Add Media Category Filter Buttons 2013-06-01 15:21:13 +02:00
Matthias Mees 2e886e9405 Rewrite of category icon onclick handler.
NOTE: This is not testable right now since something's broken in
      inserting images from the media db.
2013-06-01 14:52:34 +02:00
onli cff869e33c add image overlay in ML 2013-06-01 13:42:10 +02:00
onli 9943db95a3 bigger default thumbnail size 2013-06-01 13:27:20 +02:00
Matthias Mees d4e47e9dd6 Also needs modernizr for no-js class to work properly. 2013-06-01 11:15:38 +02:00
Matthias Mees da69d6cd2e viewport can't hurt here. 2013-06-01 11:13:11 +02:00
Matthias Mees 00d97e59b3 Use proper doctype and html helper classes. 2013-06-01 11:11:40 +02:00
Matthias Mees 6a9bdd0c6a Removed stupid HTML5/jQuery progress hints. 2013-06-01 11:09:10 +02:00
Matthias Mees 9dd573f971 Improved media db meta info display. 2013-06-01 11:05:40 +02:00
Matthias Mees bf9a58bdd4 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-05-31 23:28:56 +02:00
Matthias Mees be832ceb4d Externalized click handler for cloning upload form.
Also fixed duplicated id in upload form and fixed setting the target
directory in cloned form.
2013-05-31 23:26:37 +02:00
onli 5f565184c1 Dont call smarty->getconfigDir twice 2013-05-31 23:22:25 +02:00
onli d75de7f627 smartified preview-image generation in media library 2013-05-31 21:16:11 +02:00
Matthias Mees b4e18b48f3 Found a typo. Ooops. 2013-05-31 21:15:19 +02:00
Matthias Mees 75d45f811f Replaces inline onclick handler for .status_timestamp.
Also moved reference to serendipity_editor.js before the closing
body element. This way, jQuery's $(document).ready() equals
$(window).load(), so we don't have to use that any longer.
2013-05-31 18:10:16 +02:00
Matthias Mees c0e8922500 Dropped redundant onclick handler.
This really isn't necessary – there is a warning plus a confirm or
abort dialogue on the following page. I don't see extra value for
users in the JS-based confirm/abort dialogue.
2013-05-31 17:40:34 +02:00
Matthias Mees 66deb345a2 Document what this does. 2013-05-31 17:11:57 +02:00
Matthias Mees 1ab2389cdb Getting rid of inline body onload. 2013-05-31 17:01:06 +02:00
Matthias Mees a009893522 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-05-31 16:36:10 +02:00
Matthias Mees 6507fa5b1d Simplified current template box. 2013-05-31 16:35:53 +02:00
onli 121c796d48 revert 61ae46383e 2013-05-31 16:10:17 +02:00
Matthias Mees 88e5c9a1ba Extract currently selected template from template list.
Also skip currently selected template in template list. Note to
self: this needs more styling to set it off better. (If my code
can be improved, please do so. Best I could come up with.)
2013-05-31 14:47:38 +02:00
Ian af3c686111 Update serendipity_editor.js.tpl
uarrgh
2013-05-31 12:58:18 +03:00
Ian c980451725 Update serendipity_editor.js.tpl
Hey, never assume something is “obvious”
2013-05-31 11:57:01 +02:00
Matthias Mees ed704a4dd7 Some minor CSS fixes. 2013-05-31 10:58:17 +02:00
Matthias Mees 0c22d50477 Removed some redundant comments. 2013-05-31 10:29:44 +02:00
Matthias Mees 3cff5465d6 Drop legacy IE support. 2013-05-31 10:23:51 +02:00
Matthias Mees 6d0106df22 Updated normalize.css to v2.1.2. 2013-05-31 10:07:47 +02:00
Ian 7316e74b65 upport master → 2.0 in 2k11/serendipity_editor.js.tpl (fixed typos)
Do not forget to remove engl short (not) notations in js file doc notes, to help github prettifier
2013-05-31 10:04:08 +03:00
Ian 61ae46383e upport master → 2.0 in 2k11/serendipity_editor.js.tpl
added CKEDITOR, some better mode switches and re-added noWysiwygAdd() since this was changed and fixed, after the jquery refactoring was done in 2.0.

Note docs should not get removed, sonce this is done automatically in any modifier.
2013-05-31 08:58:48 +02:00
Matthias Mees f646621cc8 Styling template options button. 2013-05-30 23:15:25 +02:00
onli 2911e71bc6 Moved theme-settings to own page 2013-05-30 22:56:40 +02:00
onli 5b4146c967 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-05-30 22:20:32 +02:00
onli ae74401668 2k11 is default template, included admin-tpls, and made it installable 2013-05-30 22:19:07 +02:00
Matthias Mees 72a6e9473a Documented a JS error I can't fix right now. 2013-05-30 22:06:42 +02:00
Matthias Mees 7f72419e3c I think that makes the backend noConflict-free. 2013-05-30 21:43:51 +02:00
onli ff9c31b88e remove remaining tplold-links 2013-05-30 21:00:20 +02:00
onli 615a1300ec only include config if exists, fixes installer 2013-05-30 20:55:20 +02:00
Matthias Mees 6503b98e28 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-05-30 20:28:12 +02:00
Matthias Mees ccd4fca695 No more noConflict, yay. 2013-05-30 20:27:32 +02:00
Ian 75cba2cccd upport master->2.0 default/serendipity_editor.js noWysiwygAdd()
temporary disbled jquerified function, since this did not support nugget textareas.
2013-05-30 21:16:13 +03:00
Ian ab3f3efceb upport master->2.0 default/serendipity_editor.js CKEDITOR and mode switches
in func serendipity_imageSelector_addToBody

still did not touch my changes within noWysiwygAdd()
2013-05-30 21:08:14 +03:00
Matthias Mees 992df72fac Some changes to make the console.log thingy work in .tpl file. 2013-05-30 19:19:35 +02:00
Matthias Mees ddadd81f4a Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-05-30 19:07:02 +02:00
Matthias Mees b2ca3ef066 Include admin_scripts.js in serendipity_editor.js.tpl.
Also update redundant references in .tpl files.
2013-05-30 19:06:10 +02:00
Ian 5ae5329de8 Update serendipity_editor.js.tpl
remove note "..'t" notation, to have github prettify code view back
2013-05-30 19:54:54 +03:00
Matthias Mees 251f61a039 Disable jQuery noConflict mode in the backend.
NOTE: If someone can improve this, by all means: do so. And excuse
      my toddler's PHP here.
2013-05-30 18:44:42 +02:00
Matthias Mees 486985f330 Forgot to dump redundant pluginmanager.css. 2013-05-30 18:25:42 +02:00
Matthias Mees d0d2b246e4 Include pluginmanager.css in style.css. Another HTTP request saved. 2013-05-30 18:23:54 +02:00
Matthias Mees c2c27470ff Include header_spawn.js in serendipity_editor.js.tpl. 2013-05-30 18:13:33 +02:00
Matthias Mees 69e8f8e050 Remove redundant serendipity_editor.js references.
Since we're now including serendipity_editor.js in the index.tpl,
there's no need to load it in the body in various .tpl files any
longer.
2013-05-30 18:01:44 +02:00
Matthias Mees 9255d01d6d Must include serendipity_editor.js after jQuery. Duh. 2013-05-30 17:55:18 +02:00
Matthias Mees f2257718c6 Move serendipity_editor.js to head.
NOTE: This is probably only temporary so that unported JS functions
      will still work. In the end, we'll want to references this
      file right before the closing </body> tag since it's going
      to get pretty big.
2013-05-30 17:48:24 +02:00
Matthias Mees 5edc98545d include 2k11.admin.js in serendipity_editor.js.tpl. 2013-05-30 17:41:35 +02:00
Matthias Mees 5058866698 Include image_selector.js in serendipity_editor.js.tpl. 2013-05-30 17:28:46 +02:00
Matthias Mees 1a3f4d37be Drop IE7 boxsizing polyfill. 2013-05-30 17:19:41 +02:00
Matthias Mees 3e536dd4a8 Move backend jQuery plugins to dedicated subdirectory.
From now on, we'll keep jQuery plugins required by the backend in
/templates/2k11/admin/js/ (as well as other vendor JS like e.g.
Modernizr).
2013-05-30 17:15:54 +02:00
onli 85c20f7b4b add autoscroll to plugins 2013-05-30 16:52:51 +02:00
onli e4f3365414 typo 2013-05-30 16:51:01 +02:00
onli 8165bd59a4 jquery.sortable needs position: relative on the container 2013-05-30 16:49:56 +02:00
onli a89de7da1f entryproperties: Always delete cache on uninstall 2013-05-28 18:00:27 +02:00
onli d566e54dfe smarty_show: use fetch, for better control 2013-05-28 17:34:24 +02:00
onli c9e0f26fd0 cleanup of serendipity_smart_show 2013-05-28 11:53:35 +02:00
Ian 6573a64544 upport fc184b8 2013-05-28 11:44:01 +03:00
Ian 7fd2cab387 upport 4883824 2013-05-28 10:43:17 +02:00
onli a56b5382e1 removed TEMPLATE_SWITCH 2013-05-27 21:06:52 +02:00
Matthias Mees 9f59ab6081 Use smartified serendipity_editor.js. 2013-05-27 17:23:49 +02:00
Matthias Mees 5ce2f4aeff We'll need this. Oops. 2013-05-27 17:07:02 +02:00
Matthias Mees e3d4841808 Equal heights for template selection. 2013-05-27 12:30:01 +02:00
Matthias Mees f2e40a87d4 Equal heights for media library elements. 2013-05-27 12:05:59 +02:00
Matthias Mees 2ae8c3dca5 Move drag 'n' drop styles to admin stylesheet.
References #6b49f49
2013-05-27 11:24:42 +02:00
Matthias Mees 73bd4bb628 Use proper markup in the footer. 2013-05-27 11:03:46 +02:00
Matthias Mees a0333cfffc Stylesheet readability. 2013-05-27 11:00:55 +02:00
Matthias Mees 65d5cd5918 Slight tweaking of lighter color scheme. 2013-05-27 10:55:32 +02:00
onli 6b49f49ba0 ported plugin drag&drop to jquery 2013-05-24 20:40:39 +02:00
Ian 5aebdf4119 Update 2.0 NEWS 2013-05-16 18:52:03 +03:00
Ian dfa7f535ab upport 4db855d
fixed curl result bug
2013-05-16 17:31:12 +02:00
Ian e25a128bb7 logicals, thanks to Jos
http://board.s9y.org/viewtopic.php?f=4&t=19296
2013-05-13 20:08:17 +02:00
Ian e1eb605394 fixed statistics sidebar querys for PostgreSQL 2013-05-13 20:07:56 +02:00
Matthias Mees 0cd4115c25 Trying out a lighter color scheme. 2013-05-11 22:00:33 +02:00
Matthias Mees f37663053e Update AccessifyHTML5 to support main element. 2013-05-11 14:44:10 +02:00
Matthias Mees 1281376681 Use new HTML5 main element. 2013-05-11 14:07:16 +02:00
Garvin Hicking 42ed0a0345 fix typo 2013-05-09 12:38:05 +02:00
Ian 48750943db upport 7fb6b5a
serendipity_emit_htmlarea_code() does not need to return true which can note badly as 1 in 'backend_wysiwyg' hooks
2013-05-08 21:14:16 +03:00
Garvin Hicking 5ec7481030 Port of patch #16 to 2.0 2013-05-06 09:47:19 +02:00
Matthias Mees b543fae655 Updated 2k11 to v1.2.7. 2013-05-04 13:27:43 +02:00
Garvin Hicking f31800fad9 merged pull #15 2013-04-29 13:34:36 +02:00
Garvin Hicking f6295a2e4a document 2013-04-29 13:24:45 +02:00
Garvin Hicking e5905d5b59 port from 1.7 2013-04-29 13:23:24 +02:00
Ian 1e540cb6d0 upport b54d5f9693 - fixed testing checksum empty 2013-04-25 12:14:50 +03:00
Ian 09af30f24f upport ae2414134e fixed spamblock PHP 5.4 warning 2013-04-23 11:19:31 +03:00
Ian 4a317336fe upport 1b53092a21 exception tuning
mainly this was introduced to seperate db connect errors from tracing, while these errors carried security data in thrown trace path
2013-04-08 20:08:35 +03:00
Matthias Mees 4affeb3107 Backported 2k11 translations from master branch. 2013-03-31 22:03:24 +02:00
Matthias Mees d4341061e5 Updated 2k11 to v1.2.6. 2013-03-30 12:55:45 +01:00
Matthias Mees fb544e8ad5 Fixes static page date format. 2013-03-26 18:43:48 +01:00
Ian db3ea84b02 Update upgrader.inc.php
fixed upgrader typo
2013-03-21 17:33:09 +01:00
Ian b8e3b08153 typo 2013-03-13 10:36:58 +01:00
Ian 882efc32d1 Update 2.0 NEWS
global template vars
2013-03-13 10:25:08 +01:00
Ian 0efea59a55 upport update news 2013-03-13 10:09:44 +01:00
Ian 2598ceef51 Update serendipity_event_entryproperties.php
entryproperties userlevel check var strictly changed
2013-03-12 18:48:28 +01:00
onli 88bb8e0920 removed unused register_handle (alternative poc) 2013-03-06 20:44:11 +01:00
onli aad1ea6a01 2k11 config.inc.php: Removed debug and unused code 2013-03-06 20:42:49 +01:00
onli 0cd974fa6d proof-of-concept .js.tpl: Added fallback for serendipity_editor.js.tpl as serendipity_editor.js to default-template, and changed serendipity_get_file to react to .js.tpl-files in template-directories 2013-03-06 14:55:21 +01:00
onli e1526d87b8 added serendipity_smart_show-function to core, as it was used in multiple places like plugins and templates 2013-03-06 14:52:36 +01:00
onli 581bcfe066 proof of concept: include serendipity_editor.js from a serendipity_editor.js.tpl out of the template-directory. Breaks comment-page in backend for templates other than 2k11 2013-03-04 16:35:52 +01:00
onli 2ed4d470b2 updated origin-comment 2013-03-02 13:48:14 +01:00
onli ad6b1da130 removed unused var thisForm, jquerified comment-functions 2013-03-02 13:24:49 +01:00
onli 09d946edea removed checkInput-function, called in media-upload, which had no appearent effect 2013-02-27 23:05:28 +01:00
onli f035629a35 minor improvements to media-upload-scripts 2013-02-27 22:39:00 +01:00
onli 279bbfe00c jquerified rememberMediaOptions - minor enhancement 2 2013-02-27 22:10:39 +01:00
onli 4a2c89f0d0 jquerified rememberMediaOptions - minor enhancement 2013-02-27 22:09:55 +01:00
onli fd7ae69b13 jquerified rememberMediaOptions 2013-02-27 22:09:25 +01:00
onli 8e03cfb2cb jquerified toggle_extended 2013-02-27 21:53:08 +01:00
onli 2a88167957 simplifying media db function in serendipity_editor.js and correcting a mixup with serendipity[isLink] in media_chooser 2013-02-25 21:09:25 +01:00
onli 49b855c55f removed no longer used simpler functions like serendipity_insImage because the advanced version will now always get called 2013-02-24 19:28:27 +01:00
onli 97933a097c wysiwyg.advanced is now always true, so default-template can always print the same editor-buttons 2013-02-24 19:26:14 +01:00
onli efbe7a8fb3 removed (broken) browser-sniffing in php-code to emit targeted non-wysiwyg-buttons further 2013-02-24 19:22:37 +01:00
onli fb2abdbe1e removed (broken) browser-sniffing in php-code to emit targeted non-wysiwyg-buttons 2013-02-24 19:19:39 +01:00
onli 05291b606d simplified wrapInsImage 2013-02-24 19:02:19 +01:00
onli efa9ffbd3a simplified showItem(id) 2013-02-24 18:21:32 +01:00
Ian b4b3541088 Update include/admin/groups.inc.php
stick to constant string and revert 5c3b2d3
2013-02-20 17:16:55 +01:00
Matthias Mees 319231ecf4 Minor markup improvements for media choose popup. 2013-02-19 11:48:28 +01:00
Matthias Mees 4d144a10b1 Minor layout fixes for data import. 2013-02-18 19:34:02 +01:00
Matthias Mees 5e0c752f37 Various minor layout fixes. 2013-02-18 19:17:36 +01:00
Matthias Mees f23a9a0b7c Fixed display of theme options (dropping floats). 2013-02-18 18:38:02 +01:00
Matthias Mees 2de81f9d1f Fixed layout for editing categories. 2013-02-18 18:22:00 +01:00
Matthias Mees 25c8884db9 More layout fixes for plugin configuration, especially groups. 2013-02-18 17:43:12 +01:00
Matthias Mees 0ec5a237dd Layout fixes for plugin configuration. 2013-02-18 17:24:57 +01:00
Matthias Mees 6bbbb6ac34 Switching to proper main role. 2013-02-18 16:48:11 +01:00
Ian 6c699fed35 Update templates/default/admin/media_items.tpl
fixed wrong tag
2013-02-18 15:41:52 +01:00
Ian da173dc398 Update templates/default/admin/media_pane.tpl
fixed media_pane redundant </td>
2013-02-18 15:40:32 +01:00
Matthias Mees b93a9b37ca Removed previously commented, potentially harmful code. 2013-02-18 15:32:29 +01:00
Ian 5c3b2d3591 Update include/admin/groups.inc.php
fixed display group name

analog to 412359adf7
2013-02-18 14:59:05 +01:00
Matthias Mees 5344f90338 Proper layout for editing users. 2013-02-18 14:47:16 +01:00
Matthias Mees 95506cff4f Layout fixes and UI consistency for media properties form. 2013-02-18 14:39:05 +01:00
Matthias Mees 991266a50c Proper error messages, layout and button states for rebuilding thumbs. 2013-02-18 14:28:14 +01:00
Matthias Mees cc0c879538 Fixed display of resize preview & resize form layout. 2013-02-18 14:18:10 +01:00
Matthias Mees bd3a260096 UI consistency: tweaked some buttons to reflect button state. 2013-02-18 13:57:12 +01:00
Matthias Mees d8ebb6163a Ported code by @onli to emit nested media db directories. Yay. 2013-02-18 13:21:10 +01:00
Matthias Mees 5dddaeb89d Proper styling for plugin installation. 2013-02-18 12:57:59 +01:00
Matthias Mees 8c4f470d16 Amended comment to reflect it's not a tpl error but a bug. 2013-02-18 12:25:46 +01:00
Matthias Mees 11b9c86ad0 Commented something out which disrupts backend layout.
The phrase 'userid: ' plus the actual user id is being emitted at
a somewhat arbitrary positon in the backend when editing a user.
If this actually serves a purpose, I'm happy to add it back, but
it doesn't seem to …
2013-02-18 12:11:54 +01:00
Matthias Mees bccff56e74 Various minor CSS tweaks. 2013-02-16 14:21:01 +01:00
Matthias Mees a74408c966 Last bits of documentation. 2013-02-14 23:12:54 +01:00
Matthias Mees 56679cf481 Added AccessifyHTML5 plugin to take care of WAI-ARIA roles. 2013-02-14 22:11:25 +01:00
Matthias Mees f7662ab0a5 More documentation. 2013-02-14 16:07:33 +01:00
Matthias Mees ed3930edac Minor header layout adjustment. 2013-02-14 15:02:47 +01:00
Matthias Mees c9a4e980a1 More documentation. 2013-02-14 14:11:59 +01:00
Matthias Mees d4a2633699 Minor fixes to comments list. 2013-02-14 13:34:03 +01:00
Matthias Mees 6336fb0d2d Documented where these JS files are referenced. 2013-02-14 13:14:58 +01:00
Matthias Mees d8928959e3 Coding style QA; documentation. 2013-02-13 20:25:22 +01:00
Matthias Mees 6ec262af8d Coding style QA; documentation preparation. 2013-02-13 19:45:58 +01:00
Matthias Mees 5a45794726 Proper camel-casing for this particular function's name. 2013-02-13 19:26:03 +01:00
Matthias Mees 3b4dfac6f6 Copy imgedit.js to 2k11 and move it to admin dir. 2013-02-13 19:22:26 +01:00
Matthias Mees 0a3d63ab01 Added smaller backend JS files to 2k11 admin theme; also coding style QA and documentation in those files. 2013-02-13 19:13:12 +01:00
Ian ec83606bf1 debug_backtrace >= php 5.3.6 only 2013-02-12 09:26:31 +01:00
Matthias Mees c1df4145db Some small screen fixes, including media upload form. 2013-02-11 12:33:16 +01:00
Matthias Mees 0d3e8ff2ff Adapt the header area better to very small and large screens. 2013-02-11 11:48:42 +01:00
Matthias Mees 4469e71cb5 Give the banner a bit more room, so it works better on small screens. 2013-02-11 11:38:04 +01:00
Matthias Mees 22b6dadcbb Reverting layout back to 'old style' (nav left, temporarily). 2013-02-11 11:31:36 +01:00
Matthias Mees 56464c99f4 Fixes for media item display. 2013-02-11 11:07:19 +01:00
Matthias Mees 976cff1783 Fix for dropping floats in template info. 2013-02-11 10:57:46 +01:00
Matthias Mees f3926d247e Some minor color scheme adjustments. 2013-02-11 10:16:21 +01:00
Matthias Mees 7d5776f731 Fix header link text-decoration; add bottom padding to #content. 2013-02-10 21:41:32 +01:00
Garvin Hicking 19dad1f586 escape more 2013-02-08 08:38:48 +01:00
Garvin Hicking 63ba9b0431 escape hotlinked image 2013-02-08 08:29:48 +01:00
Matthias Mees b6fa7eb1ef Minor template selection layout fixes. 2013-02-08 03:51:09 +01:00
Matthias Mees f65fe67d86 Properly nested, zebra-striped categories list. (Almost. Best possible solution.) 2013-02-08 03:06:08 +01:00
Matthias Mees f48ef1c9c6 Escaping. Final version. Hopefully. 2013-02-07 23:44:55 +01:00
onli 94df72ed99 last li-child of complete category-list didn't get closed 2013-02-07 20:34:51 +01:00
onli 80b4fa8a6e last li-child in nested category-list didn't get closed 2013-02-07 20:32:50 +01:00
Matthias Mees 4d2801f6ae Escaping JS instead of HTML. 2013-02-07 19:34:02 +01:00
onli 8d1db9572f output categories as nested lists, following https://gist.github.com/yellowled/4731544 2013-02-07 19:24:22 +01:00
Matthias Mees e00855f877 Escape emitted template option HTML (overlooked one instance). 2013-02-07 17:02:30 +01:00
Matthias Mees 923f8e7497 Escape emitted template option HTML. 2013-02-07 16:56:13 +01:00
Matthias Mees f26917ad37 Escape emitted template option HTML. 2013-02-07 16:28:32 +01:00
Matthias Mees 2e61009a4c Proper headline for creating new or editing existing entry. 2013-02-07 14:16:23 +01:00
Matthias Mees fdbed20394 Proper headline for edit entries section. 2013-02-07 14:10:59 +01:00
Matthias Mees 203fe955aa Added more proper headlines for markup/layout consistency. 2013-02-07 13:34:41 +01:00
Garvin Hicking e50879f5a3 upport 2013-02-07 12:39:44 +01:00
Ian 8c1adf2189 typo 2013-02-07 12:34:44 +01:00
Ian 119f64c25c reset verbosity in testing environments back to original intention
and be more strict to $serendipity['production']
2013-02-07 12:34:19 +01:00
Ian 2b88bc3fcd fix double slash in target 2013-02-07 12:33:47 +01:00
Matthias Mees 6d0bcb46ae Added some missing #content headlines to straighten out layout in media library. 2013-02-06 23:27:55 +01:00
Matthias Mees 00fd4ccebc Added some missing #content headlines to straighten out layout. 2013-02-06 23:16:34 +01:00
Matthias Mees 06860070ab Slight vertical adjustment for actions/edit actions buttons. 2013-02-06 19:07:03 +01:00
Matthias Mees 858066dc20 I guess 'delete' should resemble 'cancel' here. 2013-02-06 19:03:05 +01:00
Matthias Mees 66b07aeb13 Minor layout fix in config screens. 2013-02-06 18:58:50 +01:00
Matthias Mees 28067ea3e1 Finally able to properly style radio elements in config screens. 2013-02-06 18:48:16 +01:00
Matthias Mees 0f8ce8dba1 Seems like we missed the .form_int class. Should be .form_field as well. 2013-02-06 18:30:12 +01:00
Matthias Mees 92b2486dab More submit/cancel states for buttons and buttonized links. Maybe even all of them? 2013-02-06 17:32:06 +01:00
Matthias Mees 8c66b261d3 FINALLY nailed down and fixed a nasty specifity issue. Phew. 2013-02-06 16:30:31 +01:00
Matthias Mees 9348064432 Finalizing what @onli prepped for proper radio element markup. Hooray. 2013-02-06 15:51:19 +01:00
Matthias Gutjahr df09953d8e Fix for "Illegal string offset 'tag'" error 2013-02-06 15:14:21 +01:00
Matthias Mees 94a577bc72 Added classed for buttonized links which resemble submit/cancel buttons. 2013-02-06 14:49:59 +01:00
onli 7472400477 changed output of radio_bool in configuration-template according to https://gist.github.com/yellowled/4722166, wrapping them in a fieldset 2013-02-06 14:47:44 +01:00
Matthias Mees 90af5ef06d Proper layout/markup for configuration as well. 2013-02-06 14:34:29 +01:00
Matthias Mees 6b55c264e5 Preparations for styling some buttons differently to convey their intent. 2013-02-06 14:32:42 +01:00
Matthias Mees b5fe7e2a56 Make buttonized links look a bit more like button/input elements. 2013-02-06 13:19:43 +01:00
Matthias Mees bcf8ada78f Proper layout for personal config. Still needs work with radio elements. 2013-02-06 13:05:49 +01:00
Matthias Mees f84fe7b854 Proper layout for theme options. 2013-02-06 12:09:57 +01:00
Matthias Mees 2b512ed4bf At last – properly indented group permissions courtesy of @onli. Yay. 2013-02-06 01:31:14 +01:00
onli 3bca687f19 start list in parent-li, don't create a following one for the new ul 2013-02-06 00:45:00 +01:00
Matthias Mees 440c023f42 Substitute .form_fullprotected as well. 2013-02-05 22:43:30 +01:00
Matthias Mees 223599f4e4 Some changes to make styling the group permissions easier. 2013-02-05 22:39:25 +01:00
Ian 1559472ca3 Update include/admin/templates.inc.php
to avoid displaying older template vars in case of a template change like from BP to some other Template, in case of:
- previouses config_groups in templates with a config file and 
- all other other core used vars in case of no config file
This may need further finetuning...
2013-02-05 17:24:39 +01:00
onli ad3301e932 permission-list when adding/editing a group will now be in lists and indented lists 2013-02-05 15:50:27 +01:00
onli b2cba84ac0 personal-options will now replace the correct classes for the input-wrapper-divs according to YLs codex (generic for bool, as form_radio breaks the layout) 2013-02-05 15:17:22 +01:00
Ian eb77dc369a added empty $template_config_groups var
for template changes, if previous template had these set
2013-02-03 11:28:11 +01:00
Matthias Mees 883abd17d5 Dropped style made redundant by markup adaption. 2013-01-29 09:41:41 +01:00
Matthias Mees 7a08431a58 Proper markup for user deletion. 2013-01-29 09:34:20 +01:00
Matthias Mees 0aaa44e063 Drop summary outlines. 2013-01-29 09:32:49 +01:00
Matthias Mees d7d89119e2 Use different selector to cover #banner and #banner_install. 2013-01-28 16:36:32 +01:00
Matthias Mees d3b40684c1 Use different selector to cover #banner and #banner_install. 2013-01-28 16:34:16 +01:00
Matthias Mees c7915f4387 Just some documentation/notes about date vs datetime. 2013-01-28 16:01:27 +01:00
Matthias Mees df19c361be A bit more space for publish/draft status. 2013-01-28 15:37:27 +01:00
Matthias Mees d9e682babd Grouped publish/draft status with preview/save buttons. 2013-01-28 15:32:03 +01:00
Matthias Mees c755f57c17 Use backend main heading as back-to-index-page link. 2013-01-28 15:09:35 +01:00
Matthias Mees 5a6b95d343 Title and message for installation integrity check adapted to new backend. 2013-01-28 15:01:33 +01:00
Garvin Hicking 71ee300143 Purge browser cache using a timestamp variable when switching templates.
This should hopefully fix Ian and my problems.
2013-01-28 09:35:34 +01:00
Matthias Mees 18dcec7bdd Minor UI adaptation for printConfigTemplate. 2013-01-27 21:47:49 +01:00
Matthias Mees 3656c654e9 Using the proper lang constant now. 2013-01-27 12:44:46 +01:00
Matthias Mees 1a489a91e8 Reverted use of non-available lang constant. 2013-01-27 12:43:02 +01:00
Ian b2b415a5a0 fixed explode 2cd param to string 2013-01-24 18:01:27 +01:00
Ian a3061f3ab5 Update include/serendipity_smarty_class.inc.php
added smarty BC function get_template_vars()

relies on some additional plugins like serendipity_event_autotitle.php, serendipity_event_multilingual, serendipity_event_sidebarhider, serendipity_event_downloadmanager, serendipity_event_microformats and possibly also more plugins by custom developers.
2013-01-24 15:50:21 +01:00
Ian 0c82384137 Update templates/bulletproof/info.txt
bump date in changed BP template
2013-01-23 12:21:54 +01:00
Ian 7e55d8d183 Update templates/bulletproof/config.inc.php
reflect POST in BP template configs re-set situations
2013-01-23 11:22:57 +01:00
Ian 76b3a1ae71 Update include/serendipity_smarty_class.inc.php
re-added prev removed disabled config switch
2013-01-21 17:08:06 +01:00
Matthias Mees 7f320909ff Note changed to reflect safer version. 2013-01-21 16:55:24 +01:00
Matthias Mees dbe612e9dc Safer version of Smarty3 compatibility. 2013-01-21 16:52:05 +01:00
Garvin Hicking 53ea38aa3c Port from master 2013-01-21 10:06:09 +01:00
Ian 88f69a298e Update plugins/serendipity_event_spartacus/serendipity_event_spartacus.php
fixed Illegal string offset 'tag'
2013-01-19 12:42:38 +01:00
Matthias Mees 6942bf541a Code consistency w/ show_plugins.fnc.tpl to help @ophian debug the Dashboard. 2013-01-18 13:55:44 +01:00
Matthias Mees a0493aa6f0 Make pluginmanager styles a bit more bulletproof. 2013-01-17 15:40:55 +01:00
Ian 60fef3d0e0 Smarty 3.1.13 - see changelog 2013-01-16 17:41:43 +01:00
Ian d100d6cad7 missing space broke function 2013-01-15 22:22:46 +01:00
Matthias Mees 7f55a93825 And, you guessed it, zebra-striping for comments. 2013-01-15 16:49:10 +01:00
Matthias Mees 37d2e46a3d Zebra-striping for categories, groups, images, and users. 2013-01-15 16:09:47 +01:00
Matthias Mees 4619a22b97 Making zebra-striped lists reusable. 2013-01-15 15:55:22 +01:00
Matthias Mees 397b5b5635 Minor presentation fixes in entry list. 2013-01-15 15:52:11 +01:00
Matthias Mees 11a1eb8869 Better presentation for entry status. 2013-01-15 15:38:35 +01:00
Matthias Mees 646b8f68b9 Some eye-candy/layout for the edit entries list. 2013-01-15 15:13:01 +01:00
Matthias Mees e78fe1e233 Something like a layout for creating/editing groups. 2013-01-14 17:40:17 +01:00
Matthias Mees 2235c90136 Better layout for add media form. 2013-01-14 17:07:52 +01:00
Matthias Mees c0304a1a19 QA: some minor UI consistency fixes. 2013-01-14 16:26:06 +01:00
Matthias Mees 31301cd5f9 Fix for reposonsive images (#27155077) by @ophian. 2013-01-14 15:42:34 +01:00
Matthias Mees 271550778f Disabled responsive images in the backend for the time being.
Explanation: there's a CSS technique for making images responsive by applying
max-width: 100%; and height: auto; to them. This messes with the bundled Xinha
WYSIWYG editor. The buttons in Xinha's toobars can't have max-width: auto;, it
makes them disappear.

So far, I haven't found a way to overwrite this for the toolbar images only due
to selector specifity. Either need to find a way or find a way to make other
images (media, actually) in the backend have a class which assigns the responsive
media CSS to them.

(Or drop Xinha for good, but that doesn't seem to be an option.)
2013-01-14 13:37:41 +01:00
Matthias Mees 95ceae7711 Proper CSS classes for styling markup buttons etc. 2013-01-14 13:23:17 +01:00
Matthias Mees 79353bc30e Removed inline styles. Again. 2013-01-14 12:49:11 +01:00
Matthias Mees 744d339c9e Re-used some lang constants. 2013-01-14 12:31:58 +01:00
Matthias Mees 4404f07691 Re-used some lang constants. 2013-01-14 12:26:30 +01:00
Matthias Mees bf7e6ef42e QA: UI consistency fixes. 2013-01-14 11:56:05 +01:00
Matthias Mees f3d2bab969 Updated 2k11 to v1.2.5. 2013-01-13 21:19:21 +01:00
Ian e536ec678e fix bad noting end in last note 2013-01-13 17:18:12 +01:00
Ian f779070199 some notes to former extended body toolbar handling 2013-01-13 16:58:07 +01:00
Ian 2c31840fae removed bad copy&paste class 2013-01-13 16:14:07 +01:00
Ian 2a3ae83eb2 2k11 n.b. admin entry form toolbar document.write replacement
fixed and re-added missing hooks and non-JS mode inline style display:none
2013-01-13 15:46:29 +01:00
Ian 6d7d2cd893 entry form toolbar document.write replacement 2013-01-13 15:36:16 +01:00
Matthias Mees 6da6a347fb Unified layout for buttons. 2013-01-10 21:35:41 +01:00
Matthias Mees 15b0610051 QA: more stylesheet organisation plus some extra classes. 2013-01-10 18:23:34 +01:00
Matthias Mees 024d0f8f16 QA: more CSS restructuring. 2013-01-08 21:24:13 +01:00
Matthias Mees 3fb154355f QA: add 'areas' in style.css to prepare for restructuring. 2013-01-06 17:59:50 +01:00
Matthias Mees be56571256 Added media constants provided by @ophian. 2013-01-06 17:18:07 +01:00
Matthias Mees 54f166805e Make checkboxes and radios a bit more bulletproof. 2013-01-06 17:06:16 +01:00
Matthias Mees 3889703ca7 UI consistency fix: delete entry. 2013-01-06 16:50:21 +01:00
Matthias Mees 536e85263a UI consistency fixes (delete images). 2013-01-05 23:13:33 +01:00
Matthias Mees e6aaa620ef UI consistency fixes (delete images). 2013-01-05 23:12:04 +01:00
Matthias Mees bb845fc267 Better layout for media properties. 2013-01-05 22:54:57 +01:00
Matthias Mees be1e58013b Some layout for resizing images in media db. 2013-01-05 22:39:44 +01:00
Matthias Mees 6578d99845 Making media items a bit more bulletproof. 2013-01-05 22:25:20 +01:00
Matthias Mees 6da68ea87e Some layout for editing dirs in media db. 2013-01-05 22:17:18 +01:00
Matthias Mees dba59f32ad Some improvements for creating dirs in media db. 2013-01-05 22:03:58 +01:00
Matthias Mees 68471a932d Proper layout for media pane filters/sorting. 2013-01-05 19:13:58 +01:00
Matthias Mees b310936e45 Better layout/UI for media database overview. 2013-01-05 17:22:31 +01:00
Matthias Mees 245a8050db Various minor CSS fixes/QA. 2013-01-05 15:51:22 +01:00
Matthias Mees 812c262b7e Minor layout fixes for plugin configuration. 2013-01-05 14:29:38 +01:00
Matthias Mees edf31114c6 Minor layout fixes for configuration. 2013-01-05 14:22:07 +01:00
Matthias Mees 6f306c1622 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2013-01-04 19:08:32 +01:00
Matthias Mees 1342d5408b Buttonized some links for better UI consistency. 2013-01-04 19:07:37 +01:00
Ian 82a62df7d5 port 7e061d to oldtpl 2013-01-04 18:48:13 +01:00
Ian 7e061d8c8c fixed addnew plugin count 2013-01-04 18:41:15 +01:00
Matthias Mees 166a811104 Markup fixed for plugin installation; also seem to have found a bug here. 2013-01-04 18:08:09 +01:00
Matthias Mees 500d650ad0 Minor fix for plugin manager. 2013-01-04 14:50:58 +01:00
Matthias Mees ae524435cc More minor layout fixes. 2013-01-04 14:45:08 +01:00
Matthias Mees b0684cb748 Minor CSS fixes for template display. 2013-01-03 16:06:04 +01:00
Matthias Mees 8361a9648b More robust markup and layout for comments. 2013-01-03 15:59:14 +01:00
Matthias Mees bcbd5ba880 Some minor UI fixes. 2013-01-02 19:43:36 +01:00
Matthias Mees 2ee9b482c3 Fix for plugin layout on small screens. 2013-01-02 19:35:36 +01:00
Matthias Mees 4679447591 Proper layout for (advanced JS) plugin lists. 2013-01-02 19:08:15 +01:00
Matthias Mees ff19028f87 Added stupid JS whitespace. 2013-01-02 18:35:38 +01:00
Matthias Mees 57e55c99ec Added .editorconfig. 2013-01-02 18:34:32 +01:00
Matthias Mees f9d059e706 Basic layout for template selection. 2013-01-02 17:47:42 +01:00
Matthias Mees ecc0bbd5d4 Layout fixes for editing categories. 2013-01-02 16:12:32 +01:00
Matthias Mees 8a890f15f5 Layout (rudimentary) for editing categories. 2013-01-02 16:06:46 +01:00
Garvin Hicking 19042479fb typo fix by qbi 2013-01-01 21:20:31 +01:00
Ian a083033a73 moved script part to head and some indent 2012-12-30 10:54:57 +01:00
Ian ece2db5782 convert document.write and removed some wrong closing tags 2012-12-30 10:48:13 +01:00
Ian bc810ca90c imageCrop now opens via window.open 2012-12-30 10:47:28 +01:00
Ian d970d06624 added doctype and moved script vars into head 2012-12-22 13:47:16 +01:00
Ian c3123d70d8 Merge branch '2.0' of github.com:s9y/Serendipity into 2.0 2012-12-22 13:28:46 +01:00
Ian bf39d5d017 removed wrong tags and rewrote document.write to jQuery 2012-12-22 12:32:28 +01:00
Ian 49a35624c8 crop image page now opens as window.open page 2012-12-22 12:21:41 +01:00
Matthias Mees 4d993012d7 More icons for 2k11 admin theme to complement dashboard plugin. 2012-12-19 17:32:24 +01:00
Ian c0c5cf747a revert last commit and fix only error line 1512 2012-12-13 15:44:11 +01:00
3314 changed files with 146749 additions and 232977 deletions
+12
View File
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Defaults
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
charset = utf-8
+48 -4
View File
@@ -1,6 +1,47 @@
uploads/*
templates_c/*
serendipity_config_local.inc.php
# application stuff
/node_modules/
/uploads/*
/templates_c/*
/serendipity_config_local.inc.php
# all non-bundled plugins
/plugins/*
!/plugins/serendipity_event_bbcode/
!/plugins/serendipity_event_creativecommons/
!/plugins/serendipity_event_emoticate/
!/plugins/serendipity_event_entryproperties/
!/plugins/serendipity_event_gravatar/
!/plugins/serendipity_event_mailer/
!/plugins/serendipity_event_nl2br/
!/plugins/serendipity_event_responsiveimages/
!/plugins/serendipity_event_s9ymarkup/
!/plugins/serendipity_event_spamblock/
!/plugins/serendipity_event_spartacus/
!/plugins/serendipity_event_templatechooser/
!/plugins/serendipity_event_textile/
!/plugins/serendipity_event_xhtmlcleanup/
!/plugins/serendipity_plugin_archives/
!/plugins/serendipity_plugin_authors/
!/plugins/serendipity_plugin_calendar/
!/plugins/serendipity_plugin_categories/
!/plugins/serendipity_plugin_comments/
!/plugins/serendipity_plugin_creativecommons/
!/plugins/serendipity_plugin_entrylinks/
!/plugins/serendipity_plugin_eventwrapper/
!/plugins/serendipity_plugin_history/
!/plugins/serendipity_plugin_html_nugget/
!/plugins/serendipity_plugin_plug/
!/plugins/serendipity_plugin_quicksearch/
!/plugins/serendipity_plugin_recententries/
!/plugins/serendipity_plugin_remoterss/
!/plugins/serendipity_plugin_superuser/
!/plugins/serendipity_plugin_syndication/
!/plugins/serendipity_plugin_templatedropdown/
# Nova IDE
/.nova/
# ide / dev stuff
.cvsignore
.htaccess*
*.db
@@ -8,8 +49,11 @@ private/*
archives/*
*~
DEADJOE
plugins/additional_plugins*
/.settings
/.buildpath
/.project
.DS_Store
*.git
/tags.lock
tests/phpunit.xml
vagrant/*
+148
View File
@@ -0,0 +1,148 @@
build:
nodes:
analysis:
project_setup:
override:
- 'true'
tests:
override:
- php-scrutinizer-run
-
command: phpcs-run
use_website_config: true
- js-scrutinizer-run
filter:
excluded_paths:
- 'tests/*'
- '*.min.js'
dependency_paths:
- 'bundled-libs/*'
- 'vendor/*'
- '*/vendor/*'
checks:
php:
fix_php_opening_tag: false
remove_php_closing_tag: false
one_class_per_file: false
side_effects_or_types: false
no_mixed_inline_html: false
require_braces_around_control_structures: false
no_global_keyword: false
avoid_usage_of_logical_operators: false
psr2_class_declaration: false
no_underscore_prefix_in_properties: false
no_underscore_prefix_in_methods: false
blank_line_after_namespace_declaration: false
single_namespace_per_use: false
psr2_switch_declaration: false
psr2_control_structure_declaration: false
avoid_superglobals: false
security_vulnerabilities: true
no_exit: true
no_goto: true
javascript: true
coding_style:
php:
indentation:
general:
use_tabs: false
size: 4
switch:
indent_case: true
spaces:
general:
linefeed_character: newline
before_parentheses:
function_declaration: false
closure_definition: true
function_call: false
if: true
for: true
while: true
switch: true
catch: true
array_initializer: false
around_operators:
assignment: true
logical: true
equality: true
relational: true
bitwise: true
additive: true
multiplicative: true
shift: false
unary_additive: false
concatenation: true
negation: false
before_left_brace:
class: true
function: true
if: true
else: true
for: true
while: true
do: true
switch: true
try: true
catch: true
finally: true
before_keywords:
else: true
while: true
catch: true
finally: true
within:
brackets: false
array_initializer: false
grouping: false
function_call: false
function_declaration: false
if: false
for: false
while: false
switch: false
catch: false
type_cast: false
ternary_operator:
before_condition: true
after_condition: true
before_alternative: true
after_alternative: true
in_short_version: false
other:
before_comma: false
after_comma: true
before_semicolon: false
after_semicolon: true
after_type_cast: true
braces:
classes_functions:
class: new-line
function: new-line
closure: undefined
if:
opening: end-of-line
always: true
else_on_new_line: false
for:
opening: end-of-line
always: true
while:
opening: end-of-line
always: true
do_while:
opening: end-of-line
always: true
while_on_new_line: false
switch:
opening: end-of-line
try:
opening: end-of-line
catch_on_new_line: false
finally_on_new_line: false
upper_lower_casing:
keywords:
general: lower
constants:
true_false_null: lower
+29
View File
@@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2003-2019, Jannis Hermanns (on behalf the Serendipity Developer Team)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-9
View File
@@ -1,9 +0,0 @@
# Serendipity - a PHP Weblog/Blog software
[Serendipity](http://s9y.org) is a PHP-powered weblog application which gives the user an easy way to maintain an online diary, weblog or even a complete homepage. While the default package is designed for the casual blogger, Serendipity offers a flexible, expandable and easy-to-use framework with the power for professional applications.
This is a testing branch to mainly support the new backend smartification.
Use with care!
https://github.com/ophian/s9y-admin-tpl forked from https://github.com/yellowled/s9y-admin-tpl
+4
View File
@@ -0,0 +1,4 @@
幸運な偶然 - Lucky Coinkydink
===========================
Based on the [Serendipity](https://s9y.org/) PHP blogging engine.
+6
View File
@@ -0,0 +1,6 @@
To do
=====
* compare old version against this to find a list of files to delete for updater
* make PRs to plugins that still use e.g. included Cache_Lite or Net_DNSBL PEAR modules
* use Twig instead of Smarty (https://github.com/sankarsuda/to-twig)
+15 -11
View File
@@ -1,11 +1,15 @@
Cache_Lite 1.5.1
HTTP_Request 1.2.4
Net_CheckIP 1.1
Net_Socket 1.0.6
Net_URL 1.0.14
PEAR 1.3.5
Text_Wiki 0.25.0
XML_RPC 1.4.0
Onyx 1.0 (customized)
Smarty 2.6.9
Net_DNSBL 1.0.0
Cache_Lite 1.5.1 (CVS 1.54)
HTTP_Request 1.2.4 (CVS 1.43)
HTTP_Request2 2.2.1 (CVS 2.2.1)
Net_CheckIP 1.1 (CVS 1.5)
Net_DNSBL 1.0.0 (CVS 1.4)
Net_Socket 1.0.6 (CVS 1.24)
Net_URL 1.0.4 (CVS 1.36)
Net_SURBL 1.4
Onyx (customized) 1.0
PEAR 1.9.5 (CVS 1.83)
SimplePie 1.2.1
Smarty 3.1.18
Text_Wiki 0.25.0 (CVS 1.27)
XML_RPC 1.4.0 (1.5.5)
+78 -15
View File
@@ -19,8 +19,8 @@
*
* @package Cache_Lite
* @category Caching
* @version $Id: Lite.php,v 1.54 2009/07/07 05:34:37 tacker Exp $
* @author Fabien MARTY <fab@php.net>
* @author Markus Tacker <tacker@php.net>
*/
define('CACHE_LITE_ERROR_RETURN', 1);
@@ -247,6 +247,12 @@ class Cache_Lite
* @var boolean
*/
var $_errorHandlingAPIBreak = false;
var $_hashedDirectoryGroup = NULL;
var $_cacheFileMode = NULL;
var $_cacheFileGroup = NULL;
// --- Public methods ---
@@ -272,16 +278,40 @@ class Cache_Lite
* 'hashedDirectoryLevel' => level of the hashed directory system (int),
* 'hashedDirectoryUmask' => umask for hashed directory structure (int),
* 'errorHandlingAPIBreak' => API break for better error handling ? (boolean)
* 'hashedDirectoryGroup' => group of hashed directory structure (int | string) (see function chgrp)
* 'cacheFileMode' => filesystem mode of newly created cache files (int)
* 'cacheFileGroup' => group of newly created cache files (int | string) (see function chgrp)
* );
*
* If sys_get_temp_dir() is available and the
* 'cacheDir' option is not provided in the
* constructor options array its output is used
* to determine the suitable temporary directory.
*
* @see http://de.php.net/sys_get_temp_dir
* @see http://pear.php.net/bugs/bug.php?id=18328
*
* @param array $options options
* @access public
*/
function Cache_Lite($options = array(NULL))
function __construct($options = array(NULL))
{
foreach($options as $key => $value) {
$this->setOption($key, $value);
}
if (!isset($options['cacheDir']) && function_exists('sys_get_temp_dir')) {
$this->setOption('cacheDir', sys_get_temp_dir() . DIRECTORY_SEPARATOR);
}
}
/**
* PHP4 constructor for backwards compatibility with older code
*
* @param array $options Options
*/
function Cache_Lite($options = array(NULL))
{
self::__construct($options);
}
/**
@@ -295,7 +325,7 @@ class Cache_Lite
*/
function setOption($name, $value)
{
$availableOptions = array('errorHandlingAPIBreak', 'hashedDirectoryUmask', 'hashedDirectoryLevel', 'automaticCleaningFactor', 'automaticSerialization', 'fileNameProtection', 'memoryCaching', 'onlyMemoryCaching', 'memoryCachingLimit', 'cacheDir', 'caching', 'lifeTime', 'fileLocking', 'writeControl', 'readControl', 'readControlType', 'pearErrorMode');
$availableOptions = array('errorHandlingAPIBreak', 'hashedDirectoryUmask', 'hashedDirectoryLevel', 'automaticCleaningFactor', 'automaticSerialization', 'fileNameProtection', 'memoryCaching', 'onlyMemoryCaching', 'memoryCachingLimit', 'cacheDir', 'caching', 'lifeTime', 'fileLocking', 'writeControl', 'readControl', 'readControlType', 'pearErrorMode', 'hashedDirectoryGroup', 'cacheFileMode', 'cacheFileGroup');
if (in_array($name, $availableOptions)) {
$property = '_'.$name;
$this->$property = $value;
@@ -534,7 +564,7 @@ class Cache_Lite
*/
function raiseError($msg, $code)
{
include_once dirname(__FILE__) . '/../PEAR.php';
include_once('PEAR.php');
return PEAR::raiseError($msg, $code, $this->_pearErrorMode);
}
@@ -613,7 +643,7 @@ class Cache_Lite
return $this->raiseError('Cache_Lite : Unable to open cache directory !', -4);
}
$result = true;
while ($file = readdir($dh)) {
while (($file = readdir($dh)) !== false) {
if (($file != '.') && ($file != '..')) {
if (substr($file, 0, 6)=='cache_') {
$file2 = $dir . $file;
@@ -654,7 +684,19 @@ class Cache_Lite
}
return $result;
}
/**
* Touch the cache file while are recreating it to avoid
* launch this task more then once when necessary
* When the cache recreated and Added in Cache Memory
* @return void
* @access private
*/
function _touchCacheFile(){
if (file_exists($this->_file)) {
@touch($this->_file);
}
}
/**
* Add some date in the memory caching array
*
@@ -663,10 +705,13 @@ class Cache_Lite
*/
function _memoryCacheAdd($data)
{
$this->_touchCacheFile();
$this->_memoryCachingArray[$this->_file] = $data;
if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
list($key, ) = each($this->_memoryCachingArray);
$key = key($this->_memoryCachingArray);
next($this->_memoryCachingArray);
unset($this->_memoryCachingArray[$key]);
} else {
$this->_memoryCachingCounter = $this->_memoryCachingCounter + 1;
}
@@ -707,20 +752,24 @@ class Cache_Lite
function _read()
{
$fp = @fopen($this->_file, "rb");
if ($this->_fileLocking) @flock($fp, LOCK_SH);
if ($fp) {
if ($this->_fileLocking) @flock($fp, LOCK_SH);
clearstatcache();
$length = @filesize($this->_file);
$mqr = get_magic_quotes_runtime();
$mqr = (function_exists('get_magic_quotes_runtime') ? @get_magic_quotes_runtime() : 0);
if ($mqr) {
set_magic_quotes_runtime(0);
}
if ($this->_readControl) {
$hashControl = @fread($fp, 32);
$length = $length - 32;
}
}
if ($length) {
$data = @fread($fp, $length);
$data = '';
// See https://bugs.php.net/bug.php?id=30936
// The 8192 magic number is the chunk size used internally by PHP.
while(!feof($fp)) $data .= fread($fp, 8192);
} else {
$data = '';
}
@@ -760,17 +809,33 @@ class Cache_Lite
for ($i=0 ; $i<$this->_hashedDirectoryLevel ; $i++) {
$root = $root . 'cache_' . substr($hash, 0, $i + 1) . '/';
if (!(@is_dir($root))) {
@mkdir($root, $this->_hashedDirectoryUmask);
if (@mkdir($root))
{
@chmod($root, $this->_hashedDirectoryUmask);
if (! is_null($this->_hashedDirectoryGroup))
@chgrp($root, $this->_hashedDirectoryGroup);
}
}
}
}
// if both _cacheFileMode and _cacheFileGroup is null, then we don't need to call
// file_exists (see below: if ($is_newfile) ...)
$is_newfile = (! is_null($this->_cacheFileMode) || !is_null($this->_cacheFileGroup))
&& ! @file_exists($this->_file);
$fp = @fopen($this->_file, "wb");
if ($fp) {
if ($this->_fileLocking) @flock($fp, LOCK_EX);
if ($is_newfile)
{
if (! is_null($this->_cacheFileMode))
@chmod($this->_file, $this->_cacheFileMode);
if (! is_null($this->_cacheFileGroup))
@chgrp($this->_file, $this->_cacheFileGroup);
}
if ($this->_readControl) {
@fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
}
$mqr = get_magic_quotes_runtime();
$mqr = (function_exists('get_magic_quotes_runtime') ? @get_magic_quotes_runtime() : 0);
if ($mqr) {
set_magic_quotes_runtime(0);
}
@@ -831,5 +896,3 @@ class Cache_Lite
}
}
?>
+100
View File
@@ -0,0 +1,100 @@
<?php
/**
* This class extends Cache_Lite and offers a cache system driven by a master file
*
* With this class, cache validity is only dependent of a given file. Cache files
* are valid only if they are older than the master file. It's a perfect way for
* caching templates results (if the template file is newer than the cache, cache
* must be rebuild...) or for config classes...
* There are some examples in the 'docs/examples' file
* Technical choices are described in the 'docs/technical' file
*
* @package Cache_Lite
* @author Fabien MARTY <fab@php.net>
*/
require_once('Cache/Lite.php');
class Cache_Lite_File extends Cache_Lite
{
// --- Private properties ---
/**
* Complete path of the file used for controlling the cache lifetime
*
* @var string $_masterFile
*/
var $_masterFile = '';
/**
* Masterfile mtime
*
* @var int $_masterFile_mtime
*/
var $_masterFile_mtime = 0;
// --- Public methods ----
/**
* Constructor
*
* $options is an assoc. To have a look at availables options,
* see the constructor of the Cache_Lite class in 'Cache_Lite.php'
*
* Comparing to Cache_Lite constructor, there is another option :
* $options = array(
* (...) see Cache_Lite constructor
* 'masterFile' => complete path of the file used for controlling the cache lifetime(string)
* );
*
* @param array $options options
* @access public
*/
function __construct($options = array(NULL))
{
$options['lifetime'] = 0;
parent::__construct($options);
if (isset($options['masterFile'])) {
$this->_masterFile = $options['masterFile'];
} else {
return $this->raiseError('Cache_Lite_File : masterFile option must be set !');
}
if (!($this->_masterFile_mtime = @filemtime($this->_masterFile))) {
return $this->raiseError('Cache_Lite_File : Unable to read masterFile : '.$this->_masterFile, -3);
}
}
/**
* PHP4 constructor for backwards compatibility with older code
*
* @param array $options Options
*/
function Cache_Lite_File($options = array(NULL))
{
self::__construct($options);
}
/**
* Test if a cache is available and (if yes) return it
*
* @param string $id cache id
* @param string $group name of the cache group
* @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
* @return string data of the cache (else : false)
* @access public
*/
function get($id, $group = 'default', $doNotTestCacheValidity = false)
{
if ($data = parent::get($id, $group, true)) {
if ($filemtime = $this->lastModified()) {
if ($filemtime > $this->_masterFile_mtime) {
return $data;
}
}
}
return false;
}
}
+14 -7
View File
@@ -11,12 +11,11 @@
* Technical choices are described in the 'docs/technical' file
*
* @package Cache_Lite
* @version $Id: Function.php,v 1.11 2006/12/14 12:59:43 cweiske Exp $
* @author Sebastian BERGMANN <sb@sebastian-bergmann.de>
* @author Fabien MARTY <fab@php.net>
*/
require_once dirname(__FILE__) . '/../Lite.php';
require_once('Cache/Lite.php');
class Cache_Lite_Function extends Cache_Lite
{
@@ -82,17 +81,27 @@ class Cache_Lite_Function extends Cache_Lite
* @param array $options options
* @access public
*/
function Cache_Lite_Function($options = array(NULL))
function __construct($options = array(NULL))
{
$availableOptions = array('debugCacheLiteFunction', 'defaultGroup', 'dontCacheWhenTheOutputContainsNOCACHE', 'dontCacheWhenTheResultIsFalse', 'dontCacheWhenTheResultIsNull');
while (list($name, $value) = each($options)) {
foreach ($options as $name => $value) {
if (in_array($name, $availableOptions)) {
$property = '_'.$name;
$this->$property = $value;
}
}
reset($options);
$this->Cache_Lite($options);
parent::__construct($options);
}
/**
* PHP4 constructor for backwards compatibility with older code
*
* @param array $options Options
*/
function Cache_Lite_Function($options = array(NULL))
{
self::__construct($options);
}
/**
@@ -207,5 +216,3 @@ class Cache_Lite_Function extends Cache_Lite
}
}
?>
+56
View File
@@ -0,0 +1,56 @@
<?php
/**
* This class extends Cache_Lite and uses output buffering to get the data to cache.
* It supports nesting of caches
*
* @package Cache_Lite
* @author Markus Tacker <tacker@php.net>
*/
require_once('Cache/Lite/Output.php');
class Cache_Lite_NestedOutput extends Cache_Lite_Output
{
private $nestedIds = array();
private $nestedGroups = array();
/**
* Start the cache
*
* @param string $id cache id
* @param string $group name of the cache group
* @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
* @return boolean|string false if the cache is not hit else the data
* @access public
*/
function start($id, $group = 'default', $doNotTestCacheValidity = false)
{
$this->nestedIds[] = $id;
$this->nestedGroups[] = $group;
$data = $this->get($id, $group, $doNotTestCacheValidity);
if ($data !== false) {
return $data;
}
ob_start();
ob_implicit_flush(false);
return false;
}
/**
* Stop the cache
*
* @param boolen
* @return string return contents of cache
*/
function end()
{
$data = ob_get_contents();
ob_end_clean();
$id = array_pop($this->nestedIds);
$group = array_pop($this->nestedGroups);
$this->save($data, $id, $group);
return $data;
}
}
+13 -7
View File
@@ -7,11 +7,10 @@
* Technical choices are described in the 'docs/technical' file
*
* @package Cache_Lite
* @version $Id: Output.php,v 1.4 2006/01/29 00:22:07 fab Exp $
* @author Fabien MARTY <fab@php.net>
*/
require_once dirname(__FILE__) . '/../Lite.php';
require_once('Cache/Lite.php');
class Cache_Lite_Output extends Cache_Lite
{
@@ -27,9 +26,19 @@ class Cache_Lite_Output extends Cache_Lite
* @param array $options options
* @access public
*/
function Cache_Lite_Output($options)
function __construct($options)
{
$this->Cache_Lite($options);
parent::__construct($options);
}
/**
* PHP4 constructor for backwards compatibility with older code
*
* @param array $options Options
*/
function Cache_Lite_Output($options = array(NULL))
{
self::__construct($options);
}
/**
@@ -67,6 +76,3 @@ class Cache_Lite_Output extends Cache_Lite
}
}
?>
+31 -31
View File
@@ -89,7 +89,7 @@ class HTTP_Request {
* @var string
*/
var $_user;
/**
* Basic Auth Password
* @var string
@@ -101,25 +101,25 @@ class HTTP_Request {
* @var object Net_Socket
*/
var $_sock;
/**
* Proxy server
* @var string
*/
var $_proxy_host;
/**
* Proxy port
* @var integer
*/
var $_proxy_port;
/**
* Proxy username
* @var string
*/
var $_proxy_user;
/**
* Proxy password
* @var string
@@ -133,7 +133,7 @@ class HTTP_Request {
var $_postData;
/**
* Request body
* Request body
* @var string
*/
var $_body;
@@ -145,7 +145,7 @@ class HTTP_Request {
var $_bodyDisallowed = array('TRACE');
/**
* Files to post
* Files to post
* @var array
*/
var $_postFiles = array();
@@ -155,25 +155,25 @@ class HTTP_Request {
* @var float
*/
var $_timeout;
/**
* HTTP_Response object
* @var object HTTP_Response
*/
var $_response;
/**
* Whether to allow redirects
* @var boolean
*/
var $_allowRedirects;
/**
* Maximum redirects allowed
* @var integer
*/
var $_maxRedirects;
/**
* Current number of redirects
* @var integer
@@ -193,7 +193,7 @@ class HTTP_Request {
var $_listeners = array();
/**
* Whether to save response body in response object property
* Whether to save response body in response object property
* @var bool
*/
var $_saveBody = true;
@@ -286,7 +286,7 @@ class HTTP_Request {
$this->addHeader('Accept-Encoding', 'gzip');
}
}
/**
* Generates a Host header for HTTP/1.1 requests
*
@@ -303,14 +303,14 @@ class HTTP_Request {
} elseif ($this->_url->port == 443 AND strcasecmp($this->_url->protocol, 'https') == 0 AND strpos($this->_url->url, ':443') !== false) {
$host = $this->_url->host . ':' . $this->_url->port;
} else {
$host = $this->_url->host;
}
return $host;
}
/**
* Resets the object to its initial state (DEPRECATED).
* Takes the same parameters as the constructor.
@@ -344,7 +344,7 @@ class HTTP_Request {
$this->addHeader('Host', $this->_generateHostHeader());
}
}
/**
* Sets a proxy to be used
*
@@ -438,8 +438,8 @@ class HTTP_Request {
function addQueryString($name, $value, $preencoded = false)
{
$this->_url->addQueryString($name, $value, $preencoded);
}
}
/**
* Sets the querystring to literally what you supply
*
@@ -546,7 +546,7 @@ class HTTP_Request {
}
/**
* Clears any postdata that has been added (DEPRECATED).
* Clears any postdata that has been added (DEPRECATED).
*
* Useful for multiple request scenarios.
*
@@ -570,9 +570,9 @@ class HTTP_Request {
$cookies = isset($this->_requestHeaders['cookie']) ? $this->_requestHeaders['cookie']. '; ' : '';
$this->addHeader('Cookie', $cookies . $name . '=' . $value);
}
/**
* Clears any cookies that have been added (DEPRECATED).
* Clears any cookies that have been added (DEPRECATED).
*
* Useful for multiple request scenarios
*
@@ -645,7 +645,7 @@ class HTTP_Request {
AND $this->getResponseCode() < 399
AND !empty($this->_response->_headers['location'])) {
$redirect = $this->_response->_headers['location'];
// Absolute URL
@@ -655,7 +655,7 @@ class HTTP_Request {
// Absolute path
} elseif ($redirect[0] == '/') {
$this->_url->path = $redirect;
// Relative path
} elseif (substr($redirect, 0, 3) == '../' OR substr($redirect, 0, 2) == './') {
if (substr($this->_url->path, -1) == '/') {
@@ -665,7 +665,7 @@ class HTTP_Request {
}
$redirect = Net_URL::resolvePath($redirect);
$this->_url->path = $redirect;
// Filename, no path
} else {
if (substr($this->_url->path, -1) == '/') {
@@ -842,7 +842,7 @@ class HTTP_Request {
$request .= 'Content-Length: ' . strlen($this->_body) . "\r\n\r\n";
$request .= $this->_body;
}
return $request;
}
@@ -894,7 +894,7 @@ class HTTP_Request {
/**
* Removes a Listener from the list of listeners
* Removes a Listener from the list of listeners
*
* @param object HTTP_Request_Listener instance to detach
* @return boolean whether the listener was successfully detached
@@ -951,13 +951,13 @@ class HTTP_Response
* @var string
*/
var $_protocol;
/**
* Return code
* @var string
*/
var $_code;
/**
* Response headers
* @var array
@@ -965,7 +965,7 @@ class HTTP_Response
var $_headers;
/**
* Cookies set in response
* Cookies set in response
* @var array
*/
var $_cookies;
@@ -1078,7 +1078,7 @@ class HTTP_Response
list($headername, $headervalue) = explode(':', $header, 2);
$headername = strtolower($headername);
$headervalue = ltrim($headervalue);
if ('set-cookie' != $headername) {
if (isset($this->_headers[$headername])) {
$this->_headers[$headername] .= ',' . $headervalue;
@@ -1154,7 +1154,7 @@ class HTTP_Response
if (0 == $this->_chunkLength) {
$line = $this->_sock->readLine();
if (preg_match('/^([0-9a-f]+)/i', $line, $matches)) {
$this->_chunkLength = hexdec($matches[1]);
$this->_chunkLength = hexdec($matches[1]);
// Chunk with zero length indicates the end
if (0 == $this->_chunkLength) {
$this->_sock->readLine(); // make this an eof()
File diff suppressed because it is too large Load Diff
+137
View File
@@ -0,0 +1,137 @@
<?php
/**
* Base class for HTTP_Request2 adapters
*
* PHP version 5
*
* LICENSE
*
* This source file is subject to BSD 3-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @copyright 2008-2016 Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link http://pear.php.net/package/HTTP_Request2
*/
/**
* Class representing a HTTP response
*/
require_once 'HTTP/Request2/Response.php';
/**
* Base class for HTTP_Request2 adapters
*
* HTTP_Request2 class itself only defines methods for aggregating the request
* data, all actual work of sending the request to the remote server and
* receiving its response is performed by adapters.
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
*/
abstract class HTTP_Request2_Adapter
{
/**
* A list of methods that MUST NOT have a request body, per RFC 2616
* @var array
*/
protected static $bodyDisallowed = array('TRACE');
/**
* Methods having defined semantics for request body
*
* Content-Length header (indicating that the body follows, section 4.3 of
* RFC 2616) will be sent for these methods even if no body was added
*
* @var array
* @link http://pear.php.net/bugs/bug.php?id=12900
* @link http://pear.php.net/bugs/bug.php?id=14740
*/
protected static $bodyRequired = array('POST', 'PUT');
/**
* Request being sent
* @var HTTP_Request2
*/
protected $request;
/**
* Request body
* @var string|resource|HTTP_Request2_MultipartBody
* @see HTTP_Request2::getBody()
*/
protected $requestBody;
/**
* Length of the request body
* @var integer
*/
protected $contentLength;
/**
* Sends request to the remote server and returns its response
*
* @param HTTP_Request2 $request HTTP request message
*
* @return HTTP_Request2_Response
* @throws HTTP_Request2_Exception
*/
abstract public function sendRequest(HTTP_Request2 $request);
/**
* Calculates length of the request body, adds proper headers
*
* @param array &$headers associative array of request headers, this method
* will add proper 'Content-Length' and 'Content-Type'
* headers to this array (or remove them if not needed)
*/
protected function calculateRequestLength(&$headers)
{
$this->requestBody = $this->request->getBody();
if (is_string($this->requestBody)) {
$this->contentLength = strlen($this->requestBody);
} elseif (is_resource($this->requestBody)) {
$stat = fstat($this->requestBody);
$this->contentLength = $stat['size'];
rewind($this->requestBody);
} else {
$this->contentLength = $this->requestBody->getLength();
$headers['content-type'] = 'multipart/form-data; boundary=' .
$this->requestBody->getBoundary();
$this->requestBody->rewind();
}
if (in_array($this->request->getMethod(), self::$bodyDisallowed)
|| 0 == $this->contentLength
) {
// No body: send a Content-Length header nonetheless (request #12900),
// but do that only for methods that require a body (bug #14740)
if (in_array($this->request->getMethod(), self::$bodyRequired)) {
$headers['content-length'] = 0;
} else {
unset($headers['content-length']);
// if the method doesn't require a body and doesn't have a
// body, don't send a Content-Type header. (request #16799)
unset($headers['content-type']);
}
} else {
if (empty($headers['content-type'])) {
$headers['content-type'] = 'application/x-www-form-urlencoded';
}
// Content-Length should not be sent for chunked Transfer-Encoding (bug #20125)
if (!isset($headers['transfer-encoding'])) {
$headers['content-length'] = $this->contentLength;
}
}
}
}
?>
+577
View File
@@ -0,0 +1,577 @@
<?php
/**
* Adapter for HTTP_Request2 wrapping around cURL extension
*
* PHP version 5
*
* LICENSE
*
* This source file is subject to BSD 3-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @copyright 2008-2016 Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link http://pear.php.net/package/HTTP_Request2
*/
/**
* Base class for HTTP_Request2 adapters
*/
require_once 'HTTP/Request2/Adapter.php';
/**
* Adapter for HTTP_Request2 wrapping around cURL extension
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
*/
class HTTP_Request2_Adapter_Curl extends HTTP_Request2_Adapter
{
/**
* Mapping of header names to cURL options
* @var array
*/
protected static $headerMap = array(
'accept-encoding' => CURLOPT_ENCODING,
'cookie' => CURLOPT_COOKIE,
'referer' => CURLOPT_REFERER,
'user-agent' => CURLOPT_USERAGENT
);
/**
* Mapping of SSL context options to cURL options
* @var array
*/
protected static $sslContextMap = array(
'ssl_verify_peer' => CURLOPT_SSL_VERIFYPEER,
'ssl_cafile' => CURLOPT_CAINFO,
'ssl_capath' => CURLOPT_CAPATH,
'ssl_local_cert' => CURLOPT_SSLCERT,
'ssl_passphrase' => CURLOPT_SSLCERTPASSWD
);
/**
* Mapping of CURLE_* constants to Exception subclasses and error codes
* @var array
*/
protected static $errorMap = array(
CURLE_UNSUPPORTED_PROTOCOL => array('HTTP_Request2_MessageException',
HTTP_Request2_Exception::NON_HTTP_REDIRECT),
CURLE_COULDNT_RESOLVE_PROXY => array('HTTP_Request2_ConnectionException'),
CURLE_COULDNT_RESOLVE_HOST => array('HTTP_Request2_ConnectionException'),
CURLE_COULDNT_CONNECT => array('HTTP_Request2_ConnectionException'),
// error returned from write callback
CURLE_WRITE_ERROR => array('HTTP_Request2_MessageException',
HTTP_Request2_Exception::NON_HTTP_REDIRECT),
CURLE_OPERATION_TIMEOUTED => array('HTTP_Request2_MessageException',
HTTP_Request2_Exception::TIMEOUT),
CURLE_HTTP_RANGE_ERROR => array('HTTP_Request2_MessageException'),
CURLE_SSL_CONNECT_ERROR => array('HTTP_Request2_ConnectionException'),
CURLE_LIBRARY_NOT_FOUND => array('HTTP_Request2_LogicException',
HTTP_Request2_Exception::MISCONFIGURATION),
CURLE_FUNCTION_NOT_FOUND => array('HTTP_Request2_LogicException',
HTTP_Request2_Exception::MISCONFIGURATION),
CURLE_ABORTED_BY_CALLBACK => array('HTTP_Request2_MessageException',
HTTP_Request2_Exception::NON_HTTP_REDIRECT),
CURLE_TOO_MANY_REDIRECTS => array('HTTP_Request2_MessageException',
HTTP_Request2_Exception::TOO_MANY_REDIRECTS),
CURLE_SSL_PEER_CERTIFICATE => array('HTTP_Request2_ConnectionException'),
CURLE_GOT_NOTHING => array('HTTP_Request2_MessageException'),
CURLE_SSL_ENGINE_NOTFOUND => array('HTTP_Request2_LogicException',
HTTP_Request2_Exception::MISCONFIGURATION),
CURLE_SSL_ENGINE_SETFAILED => array('HTTP_Request2_LogicException',
HTTP_Request2_Exception::MISCONFIGURATION),
CURLE_SEND_ERROR => array('HTTP_Request2_MessageException'),
CURLE_RECV_ERROR => array('HTTP_Request2_MessageException'),
CURLE_SSL_CERTPROBLEM => array('HTTP_Request2_LogicException',
HTTP_Request2_Exception::INVALID_ARGUMENT),
CURLE_SSL_CIPHER => array('HTTP_Request2_ConnectionException'),
CURLE_SSL_CACERT => array('HTTP_Request2_ConnectionException'),
CURLE_BAD_CONTENT_ENCODING => array('HTTP_Request2_MessageException'),
);
/**
* Response being received
* @var HTTP_Request2_Response
*/
protected $response;
/**
* Whether 'sentHeaders' event was sent to observers
* @var boolean
*/
protected $eventSentHeaders = false;
/**
* Whether 'receivedHeaders' event was sent to observers
* @var boolean
*/
protected $eventReceivedHeaders = false;
/**
* Whether 'sentBoody' event was sent to observers
* @var boolean
*/
protected $eventSentBody = false;
/**
* Position within request body
* @var integer
* @see callbackReadBody()
*/
protected $position = 0;
/**
* Information about last transfer, as returned by curl_getinfo()
* @var array
*/
protected $lastInfo;
/**
* Creates a subclass of HTTP_Request2_Exception from curl error data
*
* @param resource $ch curl handle
*
* @return HTTP_Request2_Exception
*/
protected static function wrapCurlError($ch)
{
$nativeCode = curl_errno($ch);
$message = 'Curl error: ' . curl_error($ch);
if (!isset(self::$errorMap[$nativeCode])) {
return new HTTP_Request2_Exception($message, 0, $nativeCode);
} else {
$class = self::$errorMap[$nativeCode][0];
$code = empty(self::$errorMap[$nativeCode][1])
? 0 : self::$errorMap[$nativeCode][1];
return new $class($message, $code, $nativeCode);
}
}
/**
* Sends request to the remote server and returns its response
*
* @param HTTP_Request2 $request HTTP request message
*
* @return HTTP_Request2_Response
* @throws HTTP_Request2_Exception
*/
public function sendRequest(HTTP_Request2 $request)
{
if (!extension_loaded('curl')) {
throw new HTTP_Request2_LogicException(
'cURL extension not available', HTTP_Request2_Exception::MISCONFIGURATION
);
}
$this->request = $request;
$this->response = null;
$this->position = 0;
$this->eventSentHeaders = false;
$this->eventReceivedHeaders = false;
$this->eventSentBody = false;
try {
if (false === curl_exec($ch = $this->createCurlHandle())) {
$e = self::wrapCurlError($ch);
}
} catch (Exception $e) {
}
if (isset($ch)) {
$this->lastInfo = curl_getinfo($ch);
if (CURLE_OK !== curl_errno($ch)) {
$this->request->setLastEvent('warning', curl_error($ch));
}
curl_close($ch);
}
$response = $this->response;
unset($this->request, $this->requestBody, $this->response);
if (!empty($e)) {
throw $e;
}
if ($jar = $request->getCookieJar()) {
$jar->addCookiesFromResponse($response);
}
if (0 < $this->lastInfo['size_download']) {
$request->setLastEvent('receivedBody', $response);
}
return $response;
}
/**
* Returns information about last transfer
*
* @return array associative array as returned by curl_getinfo()
*/
public function getInfo()
{
return $this->lastInfo;
}
/**
* Creates a new cURL handle and populates it with data from the request
*
* @return resource a cURL handle, as created by curl_init()
* @throws HTTP_Request2_LogicException
* @throws HTTP_Request2_NotImplementedException
*/
protected function createCurlHandle()
{
$ch = curl_init();
curl_setopt_array($ch, array(
// setup write callbacks
CURLOPT_HEADERFUNCTION => array($this, 'callbackWriteHeader'),
CURLOPT_WRITEFUNCTION => array($this, 'callbackWriteBody'),
// buffer size
CURLOPT_BUFFERSIZE => $this->request->getConfig('buffer_size'),
// connection timeout
CURLOPT_CONNECTTIMEOUT => $this->request->getConfig('connect_timeout'),
// save full outgoing headers, in case someone is interested
CURLINFO_HEADER_OUT => true,
// request url
CURLOPT_URL => $this->request->getUrl()->getUrl()
));
// set up redirects
if (!$this->request->getConfig('follow_redirects')) {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
} else {
if (!@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true)) {
throw new HTTP_Request2_LogicException(
'Redirect support in curl is unavailable due to open_basedir or safe_mode setting',
HTTP_Request2_Exception::MISCONFIGURATION
);
}
curl_setopt($ch, CURLOPT_MAXREDIRS, $this->request->getConfig('max_redirects'));
// limit redirects to http(s), works in 5.2.10+
if (defined('CURLOPT_REDIR_PROTOCOLS')) {
curl_setopt($ch, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
}
// works in 5.3.2+, http://bugs.php.net/bug.php?id=49571
if ($this->request->getConfig('strict_redirects') && defined('CURLOPT_POSTREDIR')) {
curl_setopt($ch, CURLOPT_POSTREDIR, 3);
}
}
// set local IP via CURLOPT_INTERFACE (request #19515)
if ($ip = $this->request->getConfig('local_ip')) {
curl_setopt($ch, CURLOPT_INTERFACE, $ip);
}
// request timeout
if ($timeout = $this->request->getConfig('timeout')) {
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
}
// set HTTP version
switch ($this->request->getConfig('protocol_version')) {
case '1.0':
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
break;
case '1.1':
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
}
// set request method
switch ($this->request->getMethod()) {
case HTTP_Request2::METHOD_GET:
curl_setopt($ch, CURLOPT_HTTPGET, true);
break;
case HTTP_Request2::METHOD_POST:
curl_setopt($ch, CURLOPT_POST, true);
break;
case HTTP_Request2::METHOD_HEAD:
curl_setopt($ch, CURLOPT_NOBODY, true);
break;
case HTTP_Request2::METHOD_PUT:
curl_setopt($ch, CURLOPT_UPLOAD, true);
break;
default:
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->request->getMethod());
}
// set proxy, if needed
if ($host = $this->request->getConfig('proxy_host')) {
if (!($port = $this->request->getConfig('proxy_port'))) {
throw new HTTP_Request2_LogicException(
'Proxy port not provided', HTTP_Request2_Exception::MISSING_VALUE
);
}
curl_setopt($ch, CURLOPT_PROXY, $host . ':' . $port);
if ($user = $this->request->getConfig('proxy_user')) {
curl_setopt(
$ch, CURLOPT_PROXYUSERPWD,
$user . ':' . $this->request->getConfig('proxy_password')
);
switch ($this->request->getConfig('proxy_auth_scheme')) {
case HTTP_Request2::AUTH_BASIC:
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
break;
case HTTP_Request2::AUTH_DIGEST:
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_DIGEST);
}
}
if ($type = $this->request->getConfig('proxy_type')) {
switch ($type) {
case 'http':
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
break;
case 'socks5':
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
break;
default:
throw new HTTP_Request2_NotImplementedException(
"Proxy type '{$type}' is not supported"
);
}
}
}
// set authentication data
if ($auth = $this->request->getAuth()) {
curl_setopt($ch, CURLOPT_USERPWD, $auth['user'] . ':' . $auth['password']);
switch ($auth['scheme']) {
case HTTP_Request2::AUTH_BASIC:
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
break;
case HTTP_Request2::AUTH_DIGEST:
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
}
}
// set SSL options
foreach ($this->request->getConfig() as $name => $value) {
if ('ssl_verify_host' == $name && null !== $value) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $value? 2: 0);
} elseif (isset(self::$sslContextMap[$name]) && null !== $value) {
curl_setopt($ch, self::$sslContextMap[$name], $value);
}
}
$headers = $this->request->getHeaders();
// make cURL automagically send proper header
if (!isset($headers['accept-encoding'])) {
$headers['accept-encoding'] = '';
}
if (($jar = $this->request->getCookieJar())
&& ($cookies = $jar->getMatching($this->request->getUrl(), true))
) {
$headers['cookie'] = (empty($headers['cookie'])? '': $headers['cookie'] . '; ') . $cookies;
}
// set headers having special cURL keys
foreach (self::$headerMap as $name => $option) {
if (isset($headers[$name])) {
curl_setopt($ch, $option, $headers[$name]);
unset($headers[$name]);
}
}
$this->calculateRequestLength($headers);
if (isset($headers['content-length']) || isset($headers['transfer-encoding'])) {
$this->workaroundPhpBug47204($ch, $headers);
}
// set headers not having special keys
$headersFmt = array();
foreach ($headers as $name => $value) {
$canonicalName = implode('-', array_map('ucfirst', explode('-', $name)));
$headersFmt[] = $canonicalName . ': ' . $value;
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $headersFmt);
return $ch;
}
/**
* Workaround for PHP bug #47204 that prevents rewinding request body
*
* The workaround consists of reading the entire request body into memory
* and setting it as CURLOPT_POSTFIELDS, so it isn't recommended for large
* file uploads, use Socket adapter instead.
*
* @param resource $ch cURL handle
* @param array &$headers Request headers
*/
protected function workaroundPhpBug47204($ch, &$headers)
{
// no redirects, no digest auth -> probably no rewind needed
// also apply workaround only for POSTs, othrerwise we get
// https://pear.php.net/bugs/bug.php?id=20440 for PUTs
if (!$this->request->getConfig('follow_redirects')
&& (!($auth = $this->request->getAuth())
|| HTTP_Request2::AUTH_DIGEST != $auth['scheme'])
|| HTTP_Request2::METHOD_POST !== $this->request->getMethod()
) {
curl_setopt($ch, CURLOPT_READFUNCTION, array($this, 'callbackReadBody'));
} else {
// rewind may be needed, read the whole body into memory
if ($this->requestBody instanceof HTTP_Request2_MultipartBody) {
$this->requestBody = $this->requestBody->__toString();
} elseif (is_resource($this->requestBody)) {
$fp = $this->requestBody;
$this->requestBody = '';
while (!feof($fp)) {
$this->requestBody .= fread($fp, 16384);
}
}
// curl hangs up if content-length is present
unset($headers['content-length']);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
}
}
/**
* Callback function called by cURL for reading the request body
*
* @param resource $ch cURL handle
* @param resource $fd file descriptor (not used)
* @param integer $length maximum length of data to return
*
* @return string part of the request body, up to $length bytes
*/
protected function callbackReadBody($ch, $fd, $length)
{
if (!$this->eventSentHeaders) {
$this->request->setLastEvent(
'sentHeaders', curl_getinfo($ch, CURLINFO_HEADER_OUT)
);
$this->eventSentHeaders = true;
}
if (in_array($this->request->getMethod(), self::$bodyDisallowed)
|| 0 == $this->contentLength || $this->position >= $this->contentLength
) {
return '';
}
if (is_string($this->requestBody)) {
$string = substr($this->requestBody, $this->position, $length);
} elseif (is_resource($this->requestBody)) {
$string = fread($this->requestBody, $length);
} else {
$string = $this->requestBody->read($length);
}
$this->request->setLastEvent('sentBodyPart', strlen($string));
$this->position += strlen($string);
return $string;
}
/**
* Callback function called by cURL for saving the response headers
*
* @param resource $ch cURL handle
* @param string $string response header (with trailing CRLF)
*
* @return integer number of bytes saved
* @see HTTP_Request2_Response::parseHeaderLine()
*/
protected function callbackWriteHeader($ch, $string)
{
if (!$this->eventSentHeaders
// we may receive a second set of headers if doing e.g. digest auth
// but don't bother with 100-Continue responses (bug #15785)
|| $this->eventReceivedHeaders && $this->response->getStatus() >= 200
) {
$this->request->setLastEvent(
'sentHeaders', curl_getinfo($ch, CURLINFO_HEADER_OUT)
);
}
if (!$this->eventSentBody) {
$upload = curl_getinfo($ch, CURLINFO_SIZE_UPLOAD);
// if body wasn't read by the callback, send event with total body size
if ($upload > $this->position) {
$this->request->setLastEvent(
'sentBodyPart', $upload - $this->position
);
}
if ($upload > 0) {
$this->request->setLastEvent('sentBody', $upload);
}
}
$this->eventSentHeaders = true;
$this->eventSentBody = true;
if ($this->eventReceivedHeaders || empty($this->response)) {
$this->eventReceivedHeaders = false;
$this->response = new HTTP_Request2_Response(
$string, false, curl_getinfo($ch, CURLINFO_EFFECTIVE_URL)
);
} else {
$this->response->parseHeaderLine($string);
if ('' == trim($string)) {
// don't bother with 100-Continue responses (bug #15785)
if (200 <= $this->response->getStatus()) {
$this->request->setLastEvent('receivedHeaders', $this->response);
}
if ($this->request->getConfig('follow_redirects') && $this->response->isRedirect()) {
$redirectUrl = new Net_URL2($this->response->getHeader('location'));
// for versions lower than 5.2.10, check the redirection URL protocol
if (!defined('CURLOPT_REDIR_PROTOCOLS') && $redirectUrl->isAbsolute()
&& !in_array($redirectUrl->getScheme(), array('http', 'https'))
) {
return -1;
}
if ($jar = $this->request->getCookieJar()) {
$jar->addCookiesFromResponse($this->response);
if (!$redirectUrl->isAbsolute()) {
$redirectUrl = $this->request->getUrl()->resolve($redirectUrl);
}
if ($cookies = $jar->getMatching($redirectUrl, true)) {
curl_setopt($ch, CURLOPT_COOKIE, $cookies);
}
}
}
$this->eventReceivedHeaders = true;
$this->eventSentBody = false;
}
}
return strlen($string);
}
/**
* Callback function called by cURL for saving the response body
*
* @param resource $ch cURL handle (not used)
* @param string $string part of the response body
*
* @return integer number of bytes saved
* @throws HTTP_Request2_MessageException
* @see HTTP_Request2_Response::appendBody()
*/
protected function callbackWriteBody($ch, $string)
{
// cURL calls WRITEFUNCTION callback without calling HEADERFUNCTION if
// response doesn't start with proper HTTP status line (see bug #15716)
if (empty($this->response)) {
throw new HTTP_Request2_MessageException(
"Malformed response: {$string}",
HTTP_Request2_Exception::MALFORMED_RESPONSE
);
}
if ($this->request->getConfig('store_body')) {
$this->response->appendBody($string);
}
$this->request->setLastEvent('receivedBodyPart', $string);
return strlen($string);
}
}
?>
+166
View File
@@ -0,0 +1,166 @@
<?php
/**
* Mock adapter intended for testing
*
* PHP version 5
*
* LICENSE
*
* This source file is subject to BSD 3-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @copyright 2008-2016 Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link http://pear.php.net/package/HTTP_Request2
*/
/**
* Base class for HTTP_Request2 adapters
*/
require_once 'HTTP/Request2/Adapter.php';
/**
* Mock adapter intended for testing
*
* Can be used to test applications depending on HTTP_Request2 package without
* actually performing any HTTP requests. This adapter will return responses
* previously added via addResponse()
* <code>
* $mock = new HTTP_Request2_Adapter_Mock();
* $mock->addResponse("HTTP/1.1 ... ");
*
* $request = new HTTP_Request2();
* $request->setAdapter($mock);
*
* // This will return the response set above
* $response = $req->send();
* </code>
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
*/
class HTTP_Request2_Adapter_Mock extends HTTP_Request2_Adapter
{
/**
* A queue of responses to be returned by sendRequest()
* @var array
*/
protected $responses = array();
/**
* Returns the next response from the queue built by addResponse()
*
* Only responses without explicit URLs or with URLs equal to request URL
* will be considered. If matching response is not found or the queue is
* empty then default empty response with status 400 will be returned,
* if an Exception object was added to the queue it will be thrown.
*
* @param HTTP_Request2 $request HTTP request message
*
* @return HTTP_Request2_Response
* @throws Exception
*/
public function sendRequest(HTTP_Request2 $request)
{
$requestUrl = (string)$request->getUrl();
$response = null;
foreach ($this->responses as $k => $v) {
if (!$v[1] || $requestUrl == $v[1]) {
$response = $v[0];
array_splice($this->responses, $k, 1);
break;
}
}
if (!$response) {
return self::createResponseFromString("HTTP/1.1 400 Bad Request\r\n\r\n");
} elseif ($response instanceof HTTP_Request2_Response) {
return $response;
} else {
// rethrow the exception
$class = get_class($response);
$message = $response->getMessage();
$code = $response->getCode();
throw new $class($message, $code);
}
}
/**
* Adds response to the queue
*
* @param mixed $response either a string, a pointer to an open file,
* an instance of HTTP_Request2_Response or Exception
* @param string $url A request URL this response should be valid for
* (see {@link http://pear.php.net/bugs/bug.php?id=19276})
*
* @throws HTTP_Request2_Exception
*/
public function addResponse($response, $url = null)
{
if (is_string($response)) {
$response = self::createResponseFromString($response);
} elseif (is_resource($response)) {
$response = self::createResponseFromFile($response);
} elseif (!$response instanceof HTTP_Request2_Response &&
!$response instanceof Exception
) {
throw new HTTP_Request2_Exception('Parameter is not a valid response');
}
$this->responses[] = array($response, $url);
}
/**
* Creates a new HTTP_Request2_Response object from a string
*
* @param string $str string containing HTTP response message
*
* @return HTTP_Request2_Response
* @throws HTTP_Request2_Exception
*/
public static function createResponseFromString($str)
{
$parts = preg_split('!(\r?\n){2}!m', $str, 2);
$headerLines = explode("\n", $parts[0]);
$response = new HTTP_Request2_Response(array_shift($headerLines));
foreach ($headerLines as $headerLine) {
$response->parseHeaderLine($headerLine);
}
$response->parseHeaderLine('');
if (isset($parts[1])) {
$response->appendBody($parts[1]);
}
return $response;
}
/**
* Creates a new HTTP_Request2_Response object from a file
*
* @param resource $fp file pointer returned by fopen()
*
* @return HTTP_Request2_Response
* @throws HTTP_Request2_Exception
*/
public static function createResponseFromFile($fp)
{
$response = new HTTP_Request2_Response(fgets($fp));
do {
$headerLine = fgets($fp);
$response->parseHeaderLine($headerLine);
} while ('' != trim($headerLine));
while (!feof($fp)) {
$response->appendBody(fread($fp, 8192));
}
return $response;
}
}
?>
File diff suppressed because it is too large Load Diff
+547
View File
@@ -0,0 +1,547 @@
<?php
/**
* Stores cookies and passes them between HTTP requests
*
* PHP version 5
*
* LICENSE
*
* This source file is subject to BSD 3-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @copyright 2008-2016 Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link http://pear.php.net/package/HTTP_Request2
*/
/** Class representing a HTTP request message */
require_once 'HTTP/Request2.php';
/**
* Stores cookies and passes them between HTTP requests
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: @package_version@
* @link http://pear.php.net/package/HTTP_Request2
*/
class HTTP_Request2_CookieJar implements Serializable
{
/**
* Array of stored cookies
*
* The array is indexed by domain, path and cookie name
* .example.com
* /
* some_cookie => cookie data
* /subdir
* other_cookie => cookie data
* .example.org
* ...
*
* @var array
*/
protected $cookies = array();
/**
* Whether session cookies should be serialized when serializing the jar
* @var bool
*/
protected $serializeSession = false;
/**
* Whether Public Suffix List should be used for domain matching
* @var bool
*/
protected $useList = true;
/**
* Whether an attempt to store an invalid cookie should be ignored, rather than cause an Exception
* @var bool
*/
protected $ignoreInvalid = false;
/**
* Array with Public Suffix List data
* @var array
* @link http://publicsuffix.org/
*/
protected static $psl = array();
/**
* Class constructor, sets various options
*
* @param bool $serializeSessionCookies Controls serializing session cookies,
* see {@link serializeSessionCookies()}
* @param bool $usePublicSuffixList Controls using Public Suffix List,
* see {@link usePublicSuffixList()}
* @param bool $ignoreInvalidCookies Whether invalid cookies should be ignored,
* see {@link ignoreInvalidCookies()}
*/
public function __construct(
$serializeSessionCookies = false, $usePublicSuffixList = true,
$ignoreInvalidCookies = false
) {
$this->serializeSessionCookies($serializeSessionCookies);
$this->usePublicSuffixList($usePublicSuffixList);
$this->ignoreInvalidCookies($ignoreInvalidCookies);
}
/**
* Returns current time formatted in ISO-8601 at UTC timezone
*
* @return string
*/
protected function now()
{
$dt = new DateTime();
$dt->setTimezone(new DateTimeZone('UTC'));
return $dt->format(DateTime::ISO8601);
}
/**
* Checks cookie array for correctness, possibly updating its 'domain', 'path' and 'expires' fields
*
* The checks are as follows:
* - cookie array should contain 'name' and 'value' fields;
* - name and value should not contain disallowed symbols;
* - 'expires' should be either empty parseable by DateTime;
* - 'domain' and 'path' should be either not empty or an URL where
* cookie was set should be provided.
* - if $setter is provided, then document at that URL should be allowed
* to set a cookie for that 'domain'. If $setter is not provided,
* then no domain checks will be made.
*
* 'expires' field will be converted to ISO8601 format from COOKIE format,
* 'domain' and 'path' will be set from setter URL if empty.
*
* @param array $cookie cookie data, as returned by
* {@link HTTP_Request2_Response::getCookies()}
* @param Net_URL2 $setter URL of the document that sent Set-Cookie header
*
* @return array Updated cookie array
* @throws HTTP_Request2_LogicException
* @throws HTTP_Request2_MessageException
*/
protected function checkAndUpdateFields(array $cookie, Net_URL2 $setter = null)
{
if ($missing = array_diff(array('name', 'value'), array_keys($cookie))) {
throw new HTTP_Request2_LogicException(
"Cookie array should contain 'name' and 'value' fields",
HTTP_Request2_Exception::MISSING_VALUE
);
}
if (preg_match(HTTP_Request2::REGEXP_INVALID_COOKIE, $cookie['name'])) {
throw new HTTP_Request2_LogicException(
"Invalid cookie name: '{$cookie['name']}'",
HTTP_Request2_Exception::INVALID_ARGUMENT
);
}
if (preg_match(HTTP_Request2::REGEXP_INVALID_COOKIE, $cookie['value'])) {
throw new HTTP_Request2_LogicException(
"Invalid cookie value: '{$cookie['value']}'",
HTTP_Request2_Exception::INVALID_ARGUMENT
);
}
$cookie += array('domain' => '', 'path' => '', 'expires' => null, 'secure' => false);
// Need ISO-8601 date @ UTC timezone
if (!empty($cookie['expires'])
&& !preg_match('/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\+0000$/', $cookie['expires'])
) {
try {
$dt = new DateTime($cookie['expires']);
$dt->setTimezone(new DateTimeZone('UTC'));
$cookie['expires'] = $dt->format(DateTime::ISO8601);
} catch (Exception $e) {
throw new HTTP_Request2_LogicException($e->getMessage());
}
}
if (empty($cookie['domain']) || empty($cookie['path'])) {
if (!$setter) {
throw new HTTP_Request2_LogicException(
'Cookie misses domain and/or path component, cookie setter URL needed',
HTTP_Request2_Exception::MISSING_VALUE
);
}
if (empty($cookie['domain'])) {
if ($host = $setter->getHost()) {
$cookie['domain'] = $host;
} else {
throw new HTTP_Request2_LogicException(
'Setter URL does not contain host part, can\'t set cookie domain',
HTTP_Request2_Exception::MISSING_VALUE
);
}
}
if (empty($cookie['path'])) {
$path = $setter->getPath();
$cookie['path'] = empty($path)? '/': substr($path, 0, strrpos($path, '/') + 1);
}
}
if ($setter && !$this->domainMatch($setter->getHost(), $cookie['domain'])) {
throw new HTTP_Request2_MessageException(
"Domain " . $setter->getHost() . " cannot set cookies for "
. $cookie['domain']
);
}
return $cookie;
}
/**
* Stores a cookie in the jar
*
* @param array $cookie cookie data, as returned by
* {@link HTTP_Request2_Response::getCookies()}
* @param Net_URL2 $setter URL of the document that sent Set-Cookie header
*
* @return bool whether the cookie was successfully stored
* @throws HTTP_Request2_Exception
*/
public function store(array $cookie, Net_URL2 $setter = null)
{
try {
$cookie = $this->checkAndUpdateFields($cookie, $setter);
} catch (HTTP_Request2_Exception $e) {
if ($this->ignoreInvalid) {
return false;
} else {
throw $e;
}
}
if (strlen($cookie['value'])
&& (is_null($cookie['expires']) || $cookie['expires'] > $this->now())
) {
if (!isset($this->cookies[$cookie['domain']])) {
$this->cookies[$cookie['domain']] = array();
}
if (!isset($this->cookies[$cookie['domain']][$cookie['path']])) {
$this->cookies[$cookie['domain']][$cookie['path']] = array();
}
$this->cookies[$cookie['domain']][$cookie['path']][$cookie['name']] = $cookie;
} elseif (isset($this->cookies[$cookie['domain']][$cookie['path']][$cookie['name']])) {
unset($this->cookies[$cookie['domain']][$cookie['path']][$cookie['name']]);
}
return true;
}
/**
* Adds cookies set in HTTP response to the jar
*
* @param HTTP_Request2_Response $response HTTP response message
* @param Net_URL2 $setter original request URL, needed for
* setting default domain/path. If not given,
* effective URL from response will be used.
*
* @return bool whether all cookies were successfully stored
* @throws HTTP_Request2_LogicException
*/
public function addCookiesFromResponse(HTTP_Request2_Response $response, Net_URL2 $setter = null)
{
if (null === $setter) {
if (!($effectiveUrl = $response->getEffectiveUrl())) {
throw new HTTP_Request2_LogicException(
'Response URL required for adding cookies from response',
HTTP_Request2_Exception::MISSING_VALUE
);
}
$setter = new Net_URL2($effectiveUrl);
}
$success = true;
foreach ($response->getCookies() as $cookie) {
$success = $this->store($cookie, $setter) && $success;
}
return $success;
}
/**
* Returns all cookies matching a given request URL
*
* The following checks are made:
* - cookie domain should match request host
* - cookie path should be a prefix for request path
* - 'secure' cookies will only be sent for HTTPS requests
*
* @param Net_URL2 $url Request url
* @param bool $asString Whether to return cookies as string for "Cookie: " header
*
* @return array|string Matching cookies
*/
public function getMatching(Net_URL2 $url, $asString = false)
{
$host = $url->getHost();
$path = $url->getPath();
$secure = 0 == strcasecmp($url->getScheme(), 'https');
$matched = $ret = array();
foreach (array_keys($this->cookies) as $domain) {
if ($this->domainMatch($host, $domain)) {
foreach (array_keys($this->cookies[$domain]) as $cPath) {
if (0 === strpos($path, $cPath)) {
foreach ($this->cookies[$domain][$cPath] as $name => $cookie) {
if (!$cookie['secure'] || $secure) {
$matched[$name][strlen($cookie['path'])] = $cookie;
}
}
}
}
}
}
foreach ($matched as $cookies) {
krsort($cookies);
$ret = array_merge($ret, $cookies);
}
if (!$asString) {
return $ret;
} else {
$str = '';
foreach ($ret as $c) {
$str .= (empty($str)? '': '; ') . $c['name'] . '=' . $c['value'];
}
return $str;
}
}
/**
* Returns all cookies stored in a jar
*
* @return array
*/
public function getAll()
{
$cookies = array();
foreach (array_keys($this->cookies) as $domain) {
foreach (array_keys($this->cookies[$domain]) as $path) {
foreach ($this->cookies[$domain][$path] as $name => $cookie) {
$cookies[] = $cookie;
}
}
}
return $cookies;
}
/**
* Sets whether session cookies should be serialized when serializing the jar
*
* @param boolean $serialize serialize?
*/
public function serializeSessionCookies($serialize)
{
$this->serializeSession = (bool)$serialize;
}
/**
* Sets whether invalid cookies should be silently ignored or cause an Exception
*
* @param boolean $ignore ignore?
* @link http://pear.php.net/bugs/bug.php?id=19937
* @link http://pear.php.net/bugs/bug.php?id=20401
*/
public function ignoreInvalidCookies($ignore)
{
$this->ignoreInvalid = (bool)$ignore;
}
/**
* Sets whether Public Suffix List should be used for restricting cookie-setting
*
* Without PSL {@link domainMatch()} will only prevent setting cookies for
* top-level domains like '.com' or '.org'. However, it will not prevent
* setting a cookie for '.co.uk' even though only third-level registrations
* are possible in .uk domain.
*
* With the List it is possible to find the highest level at which a domain
* may be registered for a particular top-level domain and consequently
* prevent cookies set for '.co.uk' or '.msk.ru'. The same list is used by
* Firefox, Chrome and Opera browsers to restrict cookie setting.
*
* Note that PSL is licensed differently to HTTP_Request2 package (refer to
* the license information in public-suffix-list.php), so you can disable
* its use if this is an issue for you.
*
* @param boolean $useList use the list?
*
* @link http://publicsuffix.org/learn/
*/
public function usePublicSuffixList($useList)
{
$this->useList = (bool)$useList;
}
/**
* Returns string representation of object
*
* @return string
*
* @see Serializable::serialize()
*/
public function serialize()
{
$cookies = $this->getAll();
if (!$this->serializeSession) {
for ($i = count($cookies) - 1; $i >= 0; $i--) {
if (empty($cookies[$i]['expires'])) {
unset($cookies[$i]);
}
}
}
return serialize(array(
'cookies' => $cookies,
'serializeSession' => $this->serializeSession,
'useList' => $this->useList,
'ignoreInvalid' => $this->ignoreInvalid
));
}
/**
* Constructs the object from serialized string
*
* @param string $serialized string representation
*
* @see Serializable::unserialize()
*/
public function unserialize($serialized)
{
$data = unserialize($serialized);
$now = $this->now();
$this->serializeSessionCookies($data['serializeSession']);
$this->usePublicSuffixList($data['useList']);
if (array_key_exists('ignoreInvalid', $data)) {
$this->ignoreInvalidCookies($data['ignoreInvalid']);
}
foreach ($data['cookies'] as $cookie) {
if (!empty($cookie['expires']) && $cookie['expires'] <= $now) {
continue;
}
if (!isset($this->cookies[$cookie['domain']])) {
$this->cookies[$cookie['domain']] = array();
}
if (!isset($this->cookies[$cookie['domain']][$cookie['path']])) {
$this->cookies[$cookie['domain']][$cookie['path']] = array();
}
$this->cookies[$cookie['domain']][$cookie['path']][$cookie['name']] = $cookie;
}
}
/**
* Checks whether a cookie domain matches a request host.
*
* The method is used by {@link store()} to check for whether a document
* at given URL can set a cookie with a given domain attribute and by
* {@link getMatching()} to find cookies matching the request URL.
*
* @param string $requestHost request host
* @param string $cookieDomain cookie domain
*
* @return bool match success
*/
public function domainMatch($requestHost, $cookieDomain)
{
if ($requestHost == $cookieDomain) {
return true;
}
// IP address, we require exact match
if (preg_match('/^(?:\d{1,3}\.){3}\d{1,3}$/', $requestHost)) {
return false;
}
if ('.' != $cookieDomain[0]) {
$cookieDomain = '.' . $cookieDomain;
}
// prevents setting cookies for '.com' and similar domains
if (!$this->useList && substr_count($cookieDomain, '.') < 2
|| $this->useList && !self::getRegisteredDomain($cookieDomain)
) {
return false;
}
return substr('.' . $requestHost, -strlen($cookieDomain)) == $cookieDomain;
}
/**
* Removes subdomains to get the registered domain (the first after top-level)
*
* The method will check Public Suffix List to find out where top-level
* domain ends and registered domain starts. It will remove domain parts
* to the left of registered one.
*
* @param string $domain domain name
*
* @return string|bool registered domain, will return false if $domain is
* either invalid or a TLD itself
*/
public static function getRegisteredDomain($domain)
{
$domainParts = explode('.', ltrim($domain, '.'));
// load the list if needed
if (empty(self::$psl)) {
$path = '@data_dir@' . DIRECTORY_SEPARATOR . 'HTTP_Request2';
if (0 === strpos($path, '@' . 'data_dir@')) {
$path = realpath(
dirname(__FILE__) . DIRECTORY_SEPARATOR . '..'
. DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'data'
);
}
self::$psl = include_once $path . DIRECTORY_SEPARATOR . 'public-suffix-list.php';
}
if (!($result = self::checkDomainsList($domainParts, self::$psl))) {
// known TLD, invalid domain name
return false;
}
// unknown TLD
if (!strpos($result, '.')) {
// fallback to checking that domain "has at least two dots"
if (2 > ($count = count($domainParts))) {
return false;
}
return $domainParts[$count - 2] . '.' . $domainParts[$count - 1];
}
return $result;
}
/**
* Recursive helper method for {@link getRegisteredDomain()}
*
* @param array $domainParts remaining domain parts
* @param mixed $listNode node in {@link HTTP_Request2_CookieJar::$psl} to check
*
* @return string|null concatenated domain parts, null in case of error
*/
protected static function checkDomainsList(array $domainParts, $listNode)
{
$sub = array_pop($domainParts);
$result = null;
if (!is_array($listNode) || is_null($sub)
|| array_key_exists('!' . $sub, $listNode)
) {
return $sub;
} elseif (array_key_exists($sub, $listNode)) {
$result = self::checkDomainsList($domainParts, $listNode[$sub]);
} elseif (array_key_exists('*', $listNode)) {
$result = self::checkDomainsList($domainParts, $listNode['*']);
} else {
return $sub;
}
return (strlen($result) > 0) ? ($result . '.' . $sub) : null;
}
}
?>
+160
View File
@@ -0,0 +1,160 @@
<?php
/**
* Exception classes for HTTP_Request2 package
*
* PHP version 5
*
* LICENSE
*
* This source file is subject to BSD 3-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @copyright 2008-2016 Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link http://pear.php.net/package/HTTP_Request2
*/
/**
* Base class for exceptions in PEAR
*/
require_once 'PEAR/Exception.php';
/**
* Base exception class for HTTP_Request2 package
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=132
*/
class HTTP_Request2_Exception extends PEAR_Exception
{
/** An invalid argument was passed to a method */
const INVALID_ARGUMENT = 1;
/** Some required value was not available */
const MISSING_VALUE = 2;
/** Request cannot be processed due to errors in PHP configuration */
const MISCONFIGURATION = 3;
/** Error reading the local file */
const READ_ERROR = 4;
/** Server returned a response that does not conform to HTTP protocol */
const MALFORMED_RESPONSE = 10;
/** Failure decoding Content-Encoding or Transfer-Encoding of response */
const DECODE_ERROR = 20;
/** Operation timed out */
const TIMEOUT = 30;
/** Number of redirects exceeded 'max_redirects' configuration parameter */
const TOO_MANY_REDIRECTS = 40;
/** Redirect to a protocol other than http(s):// */
const NON_HTTP_REDIRECT = 50;
/**
* Native error code
* @var int
*/
private $_nativeCode;
/**
* Constructor, can set package error code and native error code
*
* @param string $message exception message
* @param int $code package error code, one of class constants
* @param int $nativeCode error code from underlying PHP extension
*/
public function __construct($message = null, $code = null, $nativeCode = null)
{
parent::__construct($message, $code);
$this->_nativeCode = $nativeCode;
}
/**
* Returns error code produced by underlying PHP extension
*
* For Socket Adapter this may contain error number returned by
* stream_socket_client(), for Curl Adapter this will contain error number
* returned by curl_errno()
*
* @return integer
*/
public function getNativeCode()
{
return $this->_nativeCode;
}
}
/**
* Exception thrown in case of missing features
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
*/
class HTTP_Request2_NotImplementedException extends HTTP_Request2_Exception
{
}
/**
* Exception that represents error in the program logic
*
* This exception usually implies a programmer's error, like passing invalid
* data to methods or trying to use PHP extensions that weren't installed or
* enabled. Usually exceptions of this kind will be thrown before request even
* starts.
*
* The exception will usually contain a package error code.
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
*/
class HTTP_Request2_LogicException extends HTTP_Request2_Exception
{
}
/**
* Exception thrown when connection to a web or proxy server fails
*
* The exception will not contain a package error code, but will contain
* native error code, as returned by stream_socket_client() or curl_errno().
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
*/
class HTTP_Request2_ConnectionException extends HTTP_Request2_Exception
{
}
/**
* Exception thrown when sending or receiving HTTP message fails
*
* The exception may contain both package error code and native error code.
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
*/
class HTTP_Request2_MessageException extends HTTP_Request2_Exception
{
}
?>
@@ -0,0 +1,268 @@
<?php
/**
* Helper class for building multipart/form-data request body
*
* PHP version 5
*
* LICENSE
*
* This source file is subject to BSD 3-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @copyright 2008-2016 Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link http://pear.php.net/package/HTTP_Request2
*/
/** Exception class for HTTP_Request2 package */
require_once 'HTTP/Request2/Exception.php';
/**
* Class for building multipart/form-data request body
*
* The class helps to reduce memory consumption by streaming large file uploads
* from disk, it also allows monitoring of upload progress (see request #7630)
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
* @link http://tools.ietf.org/html/rfc1867
*/
class HTTP_Request2_MultipartBody
{
/**
* MIME boundary
* @var string
*/
private $_boundary;
/**
* Form parameters added via {@link HTTP_Request2::addPostParameter()}
* @var array
*/
private $_params = array();
/**
* File uploads added via {@link HTTP_Request2::addUpload()}
* @var array
*/
private $_uploads = array();
/**
* Header for parts with parameters
* @var string
*/
private $_headerParam = "--%s\r\nContent-Disposition: form-data; name=\"%s\"\r\n\r\n";
/**
* Header for parts with uploads
* @var string
*/
private $_headerUpload = "--%s\r\nContent-Disposition: form-data; name=\"%s\"; filename=\"%s\"\r\nContent-Type: %s\r\n\r\n";
/**
* Current position in parameter and upload arrays
*
* First number is index of "current" part, second number is position within
* "current" part
*
* @var array
*/
private $_pos = array(0, 0);
/**
* Constructor. Sets the arrays with POST data.
*
* @param array $params values of form fields set via
* {@link HTTP_Request2::addPostParameter()}
* @param array $uploads file uploads set via
* {@link HTTP_Request2::addUpload()}
* @param bool $useBrackets whether to append brackets to array variable names
*/
public function __construct(array $params, array $uploads, $useBrackets = true)
{
$this->_params = self::_flattenArray('', $params, $useBrackets);
foreach ($uploads as $fieldName => $f) {
if (!is_array($f['fp'])) {
$this->_uploads[] = $f + array('name' => $fieldName);
} else {
for ($i = 0; $i < count($f['fp']); $i++) {
$upload = array(
'name' => ($useBrackets? $fieldName . '[' . $i . ']': $fieldName)
);
foreach (array('fp', 'filename', 'size', 'type') as $key) {
$upload[$key] = $f[$key][$i];
}
$this->_uploads[] = $upload;
}
}
}
}
/**
* Returns the length of the body to use in Content-Length header
*
* @return integer
*/
public function getLength()
{
$boundaryLength = strlen($this->getBoundary());
$headerParamLength = strlen($this->_headerParam) - 4 + $boundaryLength;
$headerUploadLength = strlen($this->_headerUpload) - 8 + $boundaryLength;
$length = $boundaryLength + 6;
foreach ($this->_params as $p) {
$length += $headerParamLength + strlen($p[0]) + strlen($p[1]) + 2;
}
foreach ($this->_uploads as $u) {
$length += $headerUploadLength + strlen($u['name']) + strlen($u['type']) +
strlen($u['filename']) + $u['size'] + 2;
}
return $length;
}
/**
* Returns the boundary to use in Content-Type header
*
* @return string
*/
public function getBoundary()
{
if (empty($this->_boundary)) {
$this->_boundary = '--' . md5('PEAR-HTTP_Request2-' . microtime());
}
return $this->_boundary;
}
/**
* Returns next chunk of request body
*
* @param integer $length Number of bytes to read
*
* @return string Up to $length bytes of data, empty string if at end
* @throws HTTP_Request2_LogicException
*/
public function read($length)
{
$ret = '';
$boundary = $this->getBoundary();
$paramCount = count($this->_params);
$uploadCount = count($this->_uploads);
while ($length > 0 && $this->_pos[0] <= $paramCount + $uploadCount) {
$oldLength = $length;
if ($this->_pos[0] < $paramCount) {
$param = sprintf(
$this->_headerParam, $boundary, $this->_params[$this->_pos[0]][0]
) . $this->_params[$this->_pos[0]][1] . "\r\n";
$ret .= substr($param, $this->_pos[1], $length);
$length -= min(strlen($param) - $this->_pos[1], $length);
} elseif ($this->_pos[0] < $paramCount + $uploadCount) {
$pos = $this->_pos[0] - $paramCount;
$header = sprintf(
$this->_headerUpload, $boundary, $this->_uploads[$pos]['name'],
$this->_uploads[$pos]['filename'], $this->_uploads[$pos]['type']
);
if ($this->_pos[1] < strlen($header)) {
$ret .= substr($header, $this->_pos[1], $length);
$length -= min(strlen($header) - $this->_pos[1], $length);
}
$filePos = max(0, $this->_pos[1] - strlen($header));
if ($filePos < $this->_uploads[$pos]['size']) {
while ($length > 0 && !feof($this->_uploads[$pos]['fp'])) {
if (false === ($chunk = fread($this->_uploads[$pos]['fp'], $length))) {
throw new HTTP_Request2_LogicException(
'Failed reading file upload', HTTP_Request2_Exception::READ_ERROR
);
}
$ret .= $chunk;
$length -= strlen($chunk);
}
}
if ($length > 0) {
$start = $this->_pos[1] + ($oldLength - $length) -
strlen($header) - $this->_uploads[$pos]['size'];
$ret .= substr("\r\n", $start, $length);
$length -= min(2 - $start, $length);
}
} else {
$closing = '--' . $boundary . "--\r\n";
$ret .= substr($closing, $this->_pos[1], $length);
$length -= min(strlen($closing) - $this->_pos[1], $length);
}
if ($length > 0) {
$this->_pos = array($this->_pos[0] + 1, 0);
} else {
$this->_pos[1] += $oldLength;
}
}
return $ret;
}
/**
* Sets the current position to the start of the body
*
* This allows reusing the same body in another request
*/
public function rewind()
{
$this->_pos = array(0, 0);
foreach ($this->_uploads as $u) {
rewind($u['fp']);
}
}
/**
* Returns the body as string
*
* Note that it reads all file uploads into memory so it is a good idea not
* to use this method with large file uploads and rely on read() instead.
*
* @return string
*/
public function __toString()
{
$this->rewind();
return $this->read($this->getLength());
}
/**
* Helper function to change the (probably multidimensional) associative array
* into the simple one.
*
* @param string $name name for item
* @param mixed $values item's values
* @param bool $useBrackets whether to append [] to array variables' names
*
* @return array array with the following items: array('item name', 'item value');
*/
private static function _flattenArray($name, $values, $useBrackets)
{
if (!is_array($values)) {
return array(array($name, $values));
} else {
$ret = array();
foreach ($values as $k => $v) {
if (empty($name)) {
$newName = $k;
} elseif ($useBrackets) {
$newName = $name . '[' . $k . ']';
} else {
$newName = $name;
}
$ret = array_merge($ret, self::_flattenArray($newName, $v, $useBrackets));
}
return $ret;
}
}
}
?>
+192
View File
@@ -0,0 +1,192 @@
<?php
/**
* An observer useful for debugging / testing.
*
* PHP version 5
*
* LICENSE
*
* This source file is subject to BSD 3-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE
*
* @category HTTP
* @package HTTP_Request2
* @author David Jean Louis <izi@php.net>
* @author Alexey Borzov <avb@php.net>
* @copyright 2008-2016 Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link http://pear.php.net/package/HTTP_Request2
*/
/**
* Exception class for HTTP_Request2 package
*/
require_once 'HTTP/Request2/Exception.php';
/**
* A debug observer useful for debugging / testing.
*
* This observer logs to a log target data corresponding to the various request
* and response events, it logs by default to php://output but can be configured
* to log to a file or via the PEAR Log package.
*
* A simple example:
* <code>
* require_once 'HTTP/Request2.php';
* require_once 'HTTP/Request2/Observer/Log.php';
*
* $request = new HTTP_Request2('http://www.example.com');
* $observer = new HTTP_Request2_Observer_Log();
* $request->attach($observer);
* $request->send();
* </code>
*
* A more complex example with PEAR Log:
* <code>
* require_once 'HTTP/Request2.php';
* require_once 'HTTP/Request2/Observer/Log.php';
* require_once 'Log.php';
*
* $request = new HTTP_Request2('http://www.example.com');
* // we want to log with PEAR log
* $observer = new HTTP_Request2_Observer_Log(Log::factory('console'));
*
* // we only want to log received headers
* $observer->events = array('receivedHeaders');
*
* $request->attach($observer);
* $request->send();
* </code>
*
* @category HTTP
* @package HTTP_Request2
* @author David Jean Louis <izi@php.net>
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
*/
class HTTP_Request2_Observer_Log implements SplObserver
{
// properties {{{
/**
* The log target, it can be a a resource or a PEAR Log instance.
*
* @var resource|Log $target
*/
protected $target = null;
/**
* The events to log.
*
* @var array $events
*/
public $events = array(
'connect',
'sentHeaders',
'sentBody',
'receivedHeaders',
'receivedBody',
'disconnect',
);
// }}}
// __construct() {{{
/**
* Constructor.
*
* @param mixed $target Can be a file path (default: php://output), a resource,
* or an instance of the PEAR Log class.
* @param array $events Array of events to listen to (default: all events)
*
* @return void
*/
public function __construct($target = 'php://output', array $events = array())
{
if (!empty($events)) {
$this->events = $events;
}
if (is_resource($target) || $target instanceof Log) {
$this->target = $target;
} elseif (false === ($this->target = @fopen($target, 'ab'))) {
throw new HTTP_Request2_Exception("Unable to open '{$target}'");
}
}
// }}}
// update() {{{
/**
* Called when the request notifies us of an event.
*
* @param HTTP_Request2 $subject The HTTP_Request2 instance
*
* @return void
*/
public function update(SplSubject $subject)
{
$event = $subject->getLastEvent();
if (!in_array($event['name'], $this->events)) {
return;
}
switch ($event['name']) {
case 'connect':
$this->log('* Connected to ' . $event['data']);
break;
case 'sentHeaders':
$headers = explode("\r\n", $event['data']);
array_pop($headers);
foreach ($headers as $header) {
$this->log('> ' . $header);
}
break;
case 'sentBody':
$this->log('> ' . $event['data'] . ' byte(s) sent');
break;
case 'receivedHeaders':
$this->log(sprintf(
'< HTTP/%s %s %s', $event['data']->getVersion(),
$event['data']->getStatus(), $event['data']->getReasonPhrase()
));
$headers = $event['data']->getHeader();
foreach ($headers as $key => $val) {
$this->log('< ' . $key . ': ' . $val);
}
$this->log('< ');
break;
case 'receivedBody':
$this->log($event['data']->getBody());
break;
case 'disconnect':
$this->log('* Disconnected');
break;
}
}
// }}}
// log() {{{
/**
* Logs the given message to the configured target.
*
* @param string $message Message to display
*
* @return void
*/
protected function log($message)
{
if ($this->target instanceof Log) {
$this->target->debug($message);
} elseif (is_resource($this->target)) {
fwrite($this->target, $message . "\r\n");
}
}
// }}}
}
?>
@@ -0,0 +1,265 @@
<?php
/**
* An observer that saves response body to stream, possibly uncompressing it
*
* PHP version 5
*
* LICENSE
*
* This source file is subject to BSD 3-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE
*
* @category HTTP
* @package HTTP_Request2
* @author Delian Krustev <krustev@krustev.net>
* @author Alexey Borzov <avb@php.net>
* @copyright 2008-2016 Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link http://pear.php.net/package/HTTP_Request2
*/
require_once 'HTTP/Request2/Response.php';
/**
* An observer that saves response body to stream, possibly uncompressing it
*
* This Observer is written in compliment to pear's HTTP_Request2 in order to
* avoid reading the whole response body in memory. Instead it writes the body
* to a stream. If the body is transferred with content-encoding set to
* "deflate" or "gzip" it is decoded on the fly.
*
* The constructor accepts an already opened (for write) stream (file_descriptor).
* If the response is deflate/gzip encoded a "zlib.inflate" filter is applied
* to the stream. When the body has been read from the request and written to
* the stream ("receivedBody" event) the filter is removed from the stream.
*
* The "zlib.inflate" filter works fine with pure "deflate" encoding. It does
* not understand the "deflate+zlib" and "gzip" headers though, so they have to
* be removed prior to being passed to the stream. This is done in the "update"
* method.
*
* It is also possible to limit the size of written extracted bytes by passing
* "max_bytes" to the constructor. This is important because e.g. 1GB of
* zeroes take about a MB when compressed.
*
* Exceptions are being thrown if data could not be written to the stream or
* the written bytes have already exceeded the requested maximum. If the "gzip"
* header is malformed or could not be parsed an exception will be thrown too.
*
* Example usage follows:
*
* <code>
* require_once 'HTTP/Request2.php';
* require_once 'HTTP/Request2/Observer/UncompressingDownload.php';
*
* #$inPath = 'http://carsten.codimi.de/gzip.yaws/daniels.html';
* #$inPath = 'http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on';
* $inPath = 'http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on&zlib=on';
* #$outPath = "/dev/null";
* $outPath = "delme";
*
* $stream = fopen($outPath, 'wb');
* if (!$stream) {
* throw new Exception('fopen failed');
* }
*
* $request = new HTTP_Request2(
* $inPath,
* HTTP_Request2::METHOD_GET,
* array(
* 'store_body' => false,
* 'connect_timeout' => 5,
* 'timeout' => 10,
* 'ssl_verify_peer' => true,
* 'ssl_verify_host' => true,
* 'ssl_cafile' => null,
* 'ssl_capath' => '/etc/ssl/certs',
* 'max_redirects' => 10,
* 'follow_redirects' => true,
* 'strict_redirects' => false
* )
* );
*
* $observer = new HTTP_Request2_Observer_UncompressingDownload($stream, 9999999);
* $request->attach($observer);
*
* $response = $request->send();
*
* fclose($stream);
* echo "OK\n";
* </code>
*
* @category HTTP
* @package HTTP_Request2
* @author Delian Krustev <krustev@krustev.net>
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
*/
class HTTP_Request2_Observer_UncompressingDownload implements SplObserver
{
/**
* The stream to write response body to
* @var resource
*/
private $_stream;
/**
* zlib.inflate filter possibly added to stream
* @var resource
*/
private $_streamFilter;
/**
* The value of response's Content-Encoding header
* @var string
*/
private $_encoding;
/**
* Whether the observer is still waiting for gzip/deflate header
* @var bool
*/
private $_processingHeader = true;
/**
* Starting position in the stream observer writes to
* @var int
*/
private $_startPosition = 0;
/**
* Maximum bytes to write
* @var int|null
*/
private $_maxDownloadSize;
/**
* Whether response being received is a redirect
* @var bool
*/
private $_redirect = false;
/**
* Accumulated body chunks that may contain (gzip) header
* @var string
*/
private $_possibleHeader = '';
/**
* Class constructor
*
* Note that there might be problems with max_bytes and files bigger
* than 2 GB on 32bit platforms
*
* @param resource $stream a stream (or file descriptor) opened for writing.
* @param int $maxDownloadSize maximum bytes to write
*/
public function __construct($stream, $maxDownloadSize = null)
{
$this->_stream = $stream;
if ($maxDownloadSize) {
$this->_maxDownloadSize = $maxDownloadSize;
$this->_startPosition = ftell($this->_stream);
}
}
/**
* Called when the request notifies us of an event.
*
* @param SplSubject $request The HTTP_Request2 instance
*
* @return void
* @throws HTTP_Request2_MessageException
*/
public function update(SplSubject $request)
{
/* @var $request HTTP_Request2 */
$event = $request->getLastEvent();
$encoded = false;
/* @var $event['data'] HTTP_Request2_Response */
switch ($event['name']) {
case 'receivedHeaders':
$this->_processingHeader = true;
$this->_redirect = $event['data']->isRedirect();
$this->_encoding = strtolower($event['data']->getHeader('content-encoding'));
$this->_possibleHeader = '';
break;
case 'receivedEncodedBodyPart':
if (!$this->_streamFilter
&& ($this->_encoding === 'deflate' || $this->_encoding === 'gzip')
) {
$this->_streamFilter = stream_filter_append(
$this->_stream, 'zlib.inflate', STREAM_FILTER_WRITE
);
}
$encoded = true;
// fall-through is intentional
case 'receivedBodyPart':
if ($this->_redirect) {
break;
}
if (!$encoded || !$this->_processingHeader) {
$bytes = fwrite($this->_stream, $event['data']);
} else {
$offset = 0;
$this->_possibleHeader .= $event['data'];
if ('deflate' === $this->_encoding) {
if (2 > strlen($this->_possibleHeader)) {
break;
}
$header = unpack('n', substr($this->_possibleHeader, 0, 2));
if (0 == $header[1] % 31) {
$offset = 2;
}
} elseif ('gzip' === $this->_encoding) {
if (10 > strlen($this->_possibleHeader)) {
break;
}
try {
$offset = HTTP_Request2_Response::parseGzipHeader($this->_possibleHeader, false);
} catch (HTTP_Request2_MessageException $e) {
// need more data?
if (false !== strpos($e->getMessage(), 'data too short')) {
break;
}
throw $e;
}
}
$this->_processingHeader = false;
$bytes = fwrite($this->_stream, substr($this->_possibleHeader, $offset));
}
if (false === $bytes) {
throw new HTTP_Request2_MessageException('fwrite failed.');
}
if ($this->_maxDownloadSize
&& ftell($this->_stream) - $this->_startPosition > $this->_maxDownloadSize
) {
throw new HTTP_Request2_MessageException(sprintf(
'Body length limit (%d bytes) reached',
$this->_maxDownloadSize
));
}
break;
case 'receivedBody':
if ($this->_streamFilter) {
stream_filter_remove($this->_streamFilter);
$this->_streamFilter = null;
}
break;
}
}
}
@@ -0,0 +1,456 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
/**
* PEAR_Exception
*
* PHP version 5
*
* @category PEAR
* @package PEAR_Exception
* @author Tomas V. V. Cox <cox@idecnet.com>
* @author Hans Lellelid <hans@velum.net>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR_Exception
* @since File available since Release 1.0.0
*/
/**
* Base PEAR_Exception Class
*
* 1) Features:
*
* - Nestable exceptions (throw new PEAR_Exception($msg, $prev_exception))
* - Definable triggers, shot when exceptions occur
* - Pretty and informative error messages
* - Added more context info available (like class, method or cause)
* - cause can be a PEAR_Exception or an array of mixed
* PEAR_Exceptions/PEAR_ErrorStack warnings
* - callbacks for specific exception classes and their children
*
* 2) Ideas:
*
* - Maybe a way to define a 'template' for the output
*
* 3) Inherited properties from PHP Exception Class:
*
* protected $message
* protected $code
* protected $line
* protected $file
* private $trace
*
* 4) Inherited methods from PHP Exception Class:
*
* __clone
* __construct
* getMessage
* getCode
* getFile
* getLine
* getTraceSafe
* getTraceSafeAsString
* __toString
*
* 5) Usage example
*
* <code>
* require_once 'PEAR/Exception.php';
*
* class Test {
* function foo() {
* throw new PEAR_Exception('Error Message', ERROR_CODE);
* }
* }
*
* function myLogger($pear_exception) {
* echo $pear_exception->getMessage();
* }
* // each time a exception is thrown the 'myLogger' will be called
* // (its use is completely optional)
* PEAR_Exception::addObserver('myLogger');
* $test = new Test;
* try {
* $test->foo();
* } catch (PEAR_Exception $e) {
* print $e;
* }
* </code>
*
* @category PEAR
* @package PEAR_Exception
* @author Tomas V.V.Cox <cox@idecnet.com>
* @author Hans Lellelid <hans@velum.net>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: @package_version@
* @link http://pear.php.net/package/PEAR_Exception
* @since Class available since Release 1.0.0
*/
class PEAR_Exception extends Exception
{
const OBSERVER_PRINT = -2;
const OBSERVER_TRIGGER = -4;
const OBSERVER_DIE = -8;
protected $cause;
private static $_observers = array();
private static $_uniqueid = 0;
private $_trace;
/**
* Supported signatures:
* - PEAR_Exception(string $message);
* - PEAR_Exception(string $message, int $code);
* - PEAR_Exception(string $message, Exception $cause);
* - PEAR_Exception(string $message, Exception $cause, int $code);
* - PEAR_Exception(string $message, PEAR_Error $cause);
* - PEAR_Exception(string $message, PEAR_Error $cause, int $code);
* - PEAR_Exception(string $message, array $causes);
* - PEAR_Exception(string $message, array $causes, int $code);
*
* @param string $message exception message
* @param int|Exception|PEAR_Error|array|null $p2 exception cause
* @param int|null $p3 exception code or null
*/
public function __construct($message, $p2 = null, $p3 = null)
{
if (is_int($p2)) {
$code = $p2;
$this->cause = null;
} elseif (is_object($p2) || is_array($p2)) {
// using is_object allows both Exception and PEAR_Error
if (is_object($p2) && !($p2 instanceof Exception)) {
if (!class_exists('PEAR_Error') || !($p2 instanceof PEAR_Error)) {
throw new PEAR_Exception(
'exception cause must be Exception, ' .
'array, or PEAR_Error'
);
}
}
$code = $p3;
if (is_array($p2) && isset($p2['message'])) {
// fix potential problem of passing in a single warning
$p2 = array($p2);
}
$this->cause = $p2;
} else {
$code = null;
$this->cause = null;
}
parent::__construct($message, $code);
$this->signal();
}
/**
* Add an exception observer
*
* @param mixed $callback - A valid php callback, see php func is_callable()
* - A PEAR_Exception::OBSERVER_* constant
* - An array(const PEAR_Exception::OBSERVER_*,
* mixed $options)
* @param string $label The name of the observer. Use this if you want
* to remove it later with removeObserver()
*
* @return void
*/
public static function addObserver($callback, $label = 'default')
{
self::$_observers[$label] = $callback;
}
/**
* Remove an exception observer
*
* @param string $label Name of the observer
*
* @return void
*/
public static function removeObserver($label = 'default')
{
unset(self::$_observers[$label]);
}
/**
* Generate a unique ID for an observer
*
* @return int unique identifier for an observer
*/
public static function getUniqueId()
{
return self::$_uniqueid++;
}
/**
* Send a signal to all observers
*
* @return void
*/
protected function signal()
{
foreach (self::$_observers as $func) {
if (is_callable($func)) {
call_user_func($func, $this);
continue;
}
settype($func, 'array');
switch ($func[0]) {
case self::OBSERVER_PRINT :
$f = (isset($func[1])) ? $func[1] : '%s';
printf($f, $this->getMessage());
break;
case self::OBSERVER_TRIGGER :
$f = (isset($func[1])) ? $func[1] : E_USER_NOTICE;
trigger_error($this->getMessage(), $f);
break;
case self::OBSERVER_DIE :
$f = (isset($func[1])) ? $func[1] : '%s';
die(printf($f, $this->getMessage()));
break;
default:
trigger_error('invalid observer type', E_USER_WARNING);
}
}
}
/**
* Return specific error information that can be used for more detailed
* error messages or translation.
*
* This method may be overridden in child exception classes in order
* to add functionality not present in PEAR_Exception and is a placeholder
* to define API
*
* The returned array must be an associative array of parameter => value like so:
* <pre>
* array('name' => $name, 'context' => array(...))
* </pre>
*
* @return array
*/
public function getErrorData()
{
return array();
}
/**
* Returns the exception that caused this exception to be thrown
*
* @return Exception|array The context of the exception
*/
public function getCause()
{
return $this->cause;
}
/**
* Function must be public to call on caused exceptions
*
* @param array $causes Array that gets filled.
*
* @return void
*/
public function getCauseMessage(&$causes)
{
$trace = $this->getTraceSafe();
$cause = array('class' => get_class($this),
'message' => $this->message,
'file' => 'unknown',
'line' => 'unknown');
if (isset($trace[0])) {
if (isset($trace[0]['file'])) {
$cause['file'] = $trace[0]['file'];
$cause['line'] = $trace[0]['line'];
}
}
$causes[] = $cause;
if ($this->cause instanceof PEAR_Exception) {
$this->cause->getCauseMessage($causes);
} elseif ($this->cause instanceof Exception) {
$causes[] = array('class' => get_class($this->cause),
'message' => $this->cause->getMessage(),
'file' => $this->cause->getFile(),
'line' => $this->cause->getLine());
} elseif (class_exists('PEAR_Error') && $this->cause instanceof PEAR_Error) {
$causes[] = array('class' => get_class($this->cause),
'message' => $this->cause->getMessage(),
'file' => 'unknown',
'line' => 'unknown');
} elseif (is_array($this->cause)) {
foreach ($this->cause as $cause) {
if ($cause instanceof PEAR_Exception) {
$cause->getCauseMessage($causes);
} elseif ($cause instanceof Exception) {
$causes[] = array('class' => get_class($cause),
'message' => $cause->getMessage(),
'file' => $cause->getFile(),
'line' => $cause->getLine());
} elseif (class_exists('PEAR_Error')
&& $cause instanceof PEAR_Error
) {
$causes[] = array('class' => get_class($cause),
'message' => $cause->getMessage(),
'file' => 'unknown',
'line' => 'unknown');
} elseif (is_array($cause) && isset($cause['message'])) {
// PEAR_ErrorStack warning
$causes[] = array(
'class' => $cause['package'],
'message' => $cause['message'],
'file' => isset($cause['context']['file']) ?
$cause['context']['file'] :
'unknown',
'line' => isset($cause['context']['line']) ?
$cause['context']['line'] :
'unknown',
);
}
}
}
}
/**
* Build a backtrace and return it
*
* @return array Backtrace
*/
public function getTraceSafe()
{
if (!isset($this->_trace)) {
$this->_trace = $this->getTrace();
if (empty($this->_trace)) {
$backtrace = debug_backtrace();
$this->_trace = array($backtrace[count($backtrace)-1]);
}
}
return $this->_trace;
}
/**
* Gets the first class of the backtrace
*
* @return string Class name
*/
public function getErrorClass()
{
$trace = $this->getTraceSafe();
return $trace[0]['class'];
}
/**
* Gets the first method of the backtrace
*
* @return string Method/function name
*/
public function getErrorMethod()
{
$trace = $this->getTraceSafe();
return $trace[0]['function'];
}
/**
* Converts the exception to a string (HTML or plain text)
*
* @return string String representation
*
* @see toHtml()
* @see toText()
*/
public function __toString()
{
if (isset($_SERVER['REQUEST_URI'])) {
return $this->toHtml();
}
return $this->toText();
}
/**
* Generates a HTML representation of the exception
*
* @return string HTML code
*/
public function toHtml()
{
$trace = $this->getTraceSafe();
$causes = array();
$this->getCauseMessage($causes);
$html = '<table style="border: 1px" cellspacing="0">' . "\n";
foreach ($causes as $i => $cause) {
$html .= '<tr><td colspan="3" style="background: #ff9999">'
. str_repeat('-', $i) . ' <b>' . $cause['class'] . '</b>: '
. htmlspecialchars($cause['message'])
. ' in <b>' . $cause['file'] . '</b> '
. 'on line <b>' . $cause['line'] . '</b>'
. "</td></tr>\n";
}
$html .= '<tr><td colspan="3" style="background-color: #aaaaaa; text-align: center; font-weight: bold;">Exception trace</td></tr>' . "\n"
. '<tr><td style="text-align: center; background: #cccccc; width:20px; font-weight: bold;">#</td>'
. '<td style="text-align: center; background: #cccccc; font-weight: bold;">Function</td>'
. '<td style="text-align: center; background: #cccccc; font-weight: bold;">Location</td></tr>' . "\n";
foreach ($trace as $k => $v) {
$html .= '<tr><td style="text-align: center;">' . $k . '</td>'
. '<td>';
if (!empty($v['class'])) {
$html .= $v['class'] . $v['type'];
}
$html .= $v['function'];
$args = array();
if (!empty($v['args'])) {
foreach ($v['args'] as $arg) {
if (is_null($arg)) {
$args[] = 'null';
} else if (is_array($arg)) {
$args[] = 'Array';
} else if (is_object($arg)) {
$args[] = 'Object('.get_class($arg).')';
} else if (is_bool($arg)) {
$args[] = $arg ? 'true' : 'false';
} else if (is_int($arg) || is_double($arg)) {
$args[] = $arg;
} else {
$arg = (string)$arg;
$str = htmlspecialchars(substr($arg, 0, 16));
if (strlen($arg) > 16) {
$str .= '&hellip;';
}
$args[] = "'" . $str . "'";
}
}
}
$html .= '(' . implode(', ', $args) . ')'
. '</td>'
. '<td>' . (isset($v['file']) ? $v['file'] : 'unknown')
. ':' . (isset($v['line']) ? $v['line'] : 'unknown')
. '</td></tr>' . "\n";
}
$html .= '<tr><td style="text-align: center;">' . ($k+1) . '</td>'
. '<td>{main}</td>'
. '<td>&nbsp;</td></tr>' . "\n"
. '</table>';
return $html;
}
/**
* Generates text representation of the exception and stack trace
*
* @return string
*/
public function toText()
{
$causes = array();
$this->getCauseMessage($causes);
$causeMsg = '';
foreach ($causes as $i => $cause) {
$causeMsg .= str_repeat(' ', $i) . $cause['class'] . ': '
. $cause['message'] . ' in ' . $cause['file']
. ' on line ' . $cause['line'] . "\n";
}
return $causeMsg . $this->getTraceAsString();
}
}
?>
+680
View File
@@ -0,0 +1,680 @@
<?php
/**
* Class representing a HTTP response
*
* PHP version 5
*
* LICENSE
*
* This source file is subject to BSD 3-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @copyright 2008-2016 Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link http://pear.php.net/package/HTTP_Request2
*/
/**
* Exception class for HTTP_Request2 package
*/
require_once 'HTTP/Request2/Exception.php';
/**
* Class representing a HTTP response
*
* The class is designed to be used in "streaming" scenario, building the
* response as it is being received:
* <code>
* $statusLine = read_status_line();
* $response = new HTTP_Request2_Response($statusLine);
* do {
* $headerLine = read_header_line();
* $response->parseHeaderLine($headerLine);
* } while ($headerLine != '');
*
* while ($chunk = read_body()) {
* $response->appendBody($chunk);
* }
*
* var_dump($response->getHeader(), $response->getCookies(), $response->getBody());
* </code>
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
* @link http://tools.ietf.org/html/rfc2616#section-6
*/
class HTTP_Request2_Response
{
/**
* HTTP protocol version (e.g. 1.0, 1.1)
* @var string
*/
protected $version;
/**
* Status code
* @var integer
* @link http://tools.ietf.org/html/rfc2616#section-6.1.1
*/
protected $code;
/**
* Reason phrase
* @var string
* @link http://tools.ietf.org/html/rfc2616#section-6.1.1
*/
protected $reasonPhrase;
/**
* Effective URL (may be different from original request URL in case of redirects)
* @var string
*/
protected $effectiveUrl;
/**
* Associative array of response headers
* @var array
*/
protected $headers = array();
/**
* Cookies set in the response
* @var array
*/
protected $cookies = array();
/**
* Name of last header processed by parseHederLine()
*
* Used to handle the headers that span multiple lines
*
* @var string
*/
protected $lastHeader = null;
/**
* Response body
* @var string
*/
protected $body = '';
/**
* Whether the body is still encoded by Content-Encoding
*
* cURL provides the decoded body to the callback; if we are reading from
* socket the body is still gzipped / deflated
*
* @var bool
*/
protected $bodyEncoded;
/**
* Associative array of HTTP status code / reason phrase.
*
* @var array
* @link http://tools.ietf.org/html/rfc2616#section-10
*/
protected static $phrases = array(
// 1xx: Informational - Request received, continuing process
100 => 'Continue',
101 => 'Switching Protocols',
// 2xx: Success - The action was successfully received, understood and
// accepted
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
// 3xx: Redirection - Further action must be taken in order to complete
// the request
300 => 'Multiple Choices',
301 => 'Moved Permanently',
302 => 'Found', // 1.1
303 => 'See Other',
304 => 'Not Modified',
305 => 'Use Proxy',
307 => 'Temporary Redirect',
// 4xx: Client Error - The request contains bad syntax or cannot be
// fulfilled
400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
403 => 'Forbidden',
404 => 'Not Found',
405 => 'Method Not Allowed',
406 => 'Not Acceptable',
407 => 'Proxy Authentication Required',
408 => 'Request Timeout',
409 => 'Conflict',
410 => 'Gone',
411 => 'Length Required',
412 => 'Precondition Failed',
413 => 'Request Entity Too Large',
414 => 'Request-URI Too Long',
415 => 'Unsupported Media Type',
416 => 'Requested Range Not Satisfiable',
417 => 'Expectation Failed',
// 5xx: Server Error - The server failed to fulfill an apparently
// valid request
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported',
509 => 'Bandwidth Limit Exceeded',
);
/**
* Returns the default reason phrase for the given code or all reason phrases
*
* @param int $code Response code
*
* @return string|array|null Default reason phrase for $code if $code is given
* (null if no phrase is available), array of all
* reason phrases if $code is null
* @link http://pear.php.net/bugs/18716
*/
public static function getDefaultReasonPhrase($code = null)
{
if (null === $code) {
return self::$phrases;
} else {
return isset(self::$phrases[$code]) ? self::$phrases[$code] : null;
}
}
/**
* Constructor, parses the response status line
*
* @param string $statusLine Response status line (e.g. "HTTP/1.1 200 OK")
* @param bool $bodyEncoded Whether body is still encoded by Content-Encoding
* @param string $effectiveUrl Effective URL of the response
*
* @throws HTTP_Request2_MessageException if status line is invalid according to spec
*/
public function __construct($statusLine, $bodyEncoded = true, $effectiveUrl = null)
{
if (!preg_match('!^HTTP/(\d\.\d) (\d{3})(?: (.+))?!', $statusLine, $m)) {
throw new HTTP_Request2_MessageException(
"Malformed response: {$statusLine}",
HTTP_Request2_Exception::MALFORMED_RESPONSE
);
}
$this->version = $m[1];
$this->code = intval($m[2]);
$this->reasonPhrase = !empty($m[3]) ? trim($m[3]) : self::getDefaultReasonPhrase($this->code);
$this->bodyEncoded = (bool)$bodyEncoded;
$this->effectiveUrl = (string)$effectiveUrl;
}
/**
* Parses the line from HTTP response filling $headers array
*
* The method should be called after reading the line from socket or receiving
* it into cURL callback. Passing an empty string here indicates the end of
* response headers and triggers additional processing, so be sure to pass an
* empty string in the end.
*
* @param string $headerLine Line from HTTP response
*/
public function parseHeaderLine($headerLine)
{
$headerLine = trim($headerLine, "\r\n");
if ('' == $headerLine) {
// empty string signals the end of headers, process the received ones
if (!empty($this->headers['set-cookie'])) {
$cookies = is_array($this->headers['set-cookie'])?
$this->headers['set-cookie']:
array($this->headers['set-cookie']);
foreach ($cookies as $cookieString) {
$this->parseCookie($cookieString);
}
unset($this->headers['set-cookie']);
}
foreach (array_keys($this->headers) as $k) {
if (is_array($this->headers[$k])) {
$this->headers[$k] = implode(', ', $this->headers[$k]);
}
}
} elseif (preg_match('!^([^\x00-\x1f\x7f-\xff()<>@,;:\\\\"/\[\]?={}\s]+):(.+)$!', $headerLine, $m)) {
// string of the form header-name: header value
$name = strtolower($m[1]);
$value = trim($m[2]);
if (empty($this->headers[$name])) {
$this->headers[$name] = $value;
} else {
if (!is_array($this->headers[$name])) {
$this->headers[$name] = array($this->headers[$name]);
}
$this->headers[$name][] = $value;
}
$this->lastHeader = $name;
} elseif (preg_match('!^\s+(.+)$!', $headerLine, $m) && $this->lastHeader) {
// continuation of a previous header
if (!is_array($this->headers[$this->lastHeader])) {
$this->headers[$this->lastHeader] .= ' ' . trim($m[1]);
} else {
$key = count($this->headers[$this->lastHeader]) - 1;
$this->headers[$this->lastHeader][$key] .= ' ' . trim($m[1]);
}
}
}
/**
* Parses a Set-Cookie header to fill $cookies array
*
* @param string $cookieString value of Set-Cookie header
*
* @link http://web.archive.org/web/20080331104521/http://cgi.netscape.com/newsref/std/cookie_spec.html
*/
protected function parseCookie($cookieString)
{
$cookie = array(
'expires' => null,
'domain' => null,
'path' => null,
'secure' => false
);
if (!strpos($cookieString, ';')) {
// Only a name=value pair
$pos = strpos($cookieString, '=');
$cookie['name'] = trim(substr($cookieString, 0, $pos));
$cookie['value'] = trim(substr($cookieString, $pos + 1));
} else {
// Some optional parameters are supplied
$elements = explode(';', $cookieString);
$pos = strpos($elements[0], '=');
$cookie['name'] = trim(substr($elements[0], 0, $pos));
$cookie['value'] = trim(substr($elements[0], $pos + 1));
for ($i = 1; $i < count($elements); $i++) {
if (false === strpos($elements[$i], '=')) {
$elName = trim($elements[$i]);
$elValue = null;
} else {
list ($elName, $elValue) = array_map('trim', explode('=', $elements[$i]));
}
$elName = strtolower($elName);
if ('secure' == $elName) {
$cookie['secure'] = true;
} elseif ('expires' == $elName) {
$cookie['expires'] = str_replace('"', '', $elValue);
} elseif ('path' == $elName || 'domain' == $elName) {
$cookie[$elName] = urldecode($elValue);
} else {
$cookie[$elName] = $elValue;
}
}
}
$this->cookies[] = $cookie;
}
/**
* Appends a string to the response body
*
* @param string $bodyChunk part of response body
*/
public function appendBody($bodyChunk)
{
$this->body .= $bodyChunk;
}
/**
* Returns the effective URL of the response
*
* This may be different from the request URL if redirects were followed.
*
* @return string
* @link http://pear.php.net/bugs/bug.php?id=18412
*/
public function getEffectiveUrl()
{
return $this->effectiveUrl;
}
/**
* Returns the status code
*
* @return integer
*/
public function getStatus()
{
return $this->code;
}
/**
* Returns the reason phrase
*
* @return string
*/
public function getReasonPhrase()
{
return $this->reasonPhrase;
}
/**
* Whether response is a redirect that can be automatically handled by HTTP_Request2
*
* @return bool
*/
public function isRedirect()
{
return in_array($this->code, array(300, 301, 302, 303, 307))
&& isset($this->headers['location']);
}
/**
* Returns either the named header or all response headers
*
* @param string $headerName Name of header to return
*
* @return string|array Value of $headerName header (null if header is
* not present), array of all response headers if
* $headerName is null
*/
public function getHeader($headerName = null)
{
if (null === $headerName) {
return $this->headers;
} else {
$headerName = strtolower($headerName);
return isset($this->headers[$headerName])? $this->headers[$headerName]: null;
}
}
/**
* Returns cookies set in response
*
* @return array
*/
public function getCookies()
{
return $this->cookies;
}
/**
* Returns the body of the response
*
* @return string
* @throws HTTP_Request2_Exception if body cannot be decoded
*/
public function getBody()
{
if (0 == strlen($this->body) || !$this->bodyEncoded
|| !in_array(strtolower($this->getHeader('content-encoding')), array('gzip', 'deflate'))
) {
return $this->body;
} else {
if (extension_loaded('mbstring') && (2 & ini_get('mbstring.func_overload'))) {
$oldEncoding = mb_internal_encoding();
mb_internal_encoding('8bit');
}
try {
switch (strtolower($this->getHeader('content-encoding'))) {
case 'gzip':
$decoded = self::decodeGzip($this->body);
break;
case 'deflate':
$decoded = self::decodeDeflate($this->body);
}
} catch (Exception $e) {
}
if (!empty($oldEncoding)) {
mb_internal_encoding($oldEncoding);
}
if (!empty($e)) {
throw $e;
}
return $decoded;
}
}
/**
* Get the HTTP version of the response
*
* @return string
*/
public function getVersion()
{
return $this->version;
}
/**
* Checks whether data starts with GZIP format identification bytes from RFC 1952
*
* @param string $data gzip-encoded (presumably) data
*
* @return bool
*/
public static function hasGzipIdentification($data)
{
return 0 === strcmp(substr($data, 0, 2), "\x1f\x8b");
}
/**
* Tries to parse GZIP format header in the given string
*
* If the header conforms to RFC 1952, its length is returned. If any
* sanity check fails, HTTP_Request2_MessageException is thrown.
*
* Note: This function might be usable outside of HTTP_Request2 so it might
* be good idea to be moved to some common package. (Delian Krustev)
*
* @param string $data Either the complete response body or
* the leading part of it
* @param boolean $dataComplete Whether $data contains complete response body
*
* @return int gzip header length in bytes
* @throws HTTP_Request2_MessageException
* @link http://tools.ietf.org/html/rfc1952
*/
public static function parseGzipHeader($data, $dataComplete = false)
{
// if data is complete, trailing 8 bytes should be present for size and crc32
$length = strlen($data) - ($dataComplete ? 8 : 0);
if ($length < 10 || !self::hasGzipIdentification($data)) {
throw new HTTP_Request2_MessageException(
'The data does not seem to contain a valid gzip header',
HTTP_Request2_Exception::DECODE_ERROR
);
}
$method = ord(substr($data, 2, 1));
if (8 != $method) {
throw new HTTP_Request2_MessageException(
'Error parsing gzip header: unknown compression method',
HTTP_Request2_Exception::DECODE_ERROR
);
}
$flags = ord(substr($data, 3, 1));
if ($flags & 224) {
throw new HTTP_Request2_MessageException(
'Error parsing gzip header: reserved bits are set',
HTTP_Request2_Exception::DECODE_ERROR
);
}
// header is 10 bytes minimum. may be longer, though.
$headerLength = 10;
// extra fields, need to skip 'em
if ($flags & 4) {
if ($length - $headerLength - 2 < 0) {
throw new HTTP_Request2_MessageException(
'Error parsing gzip header: data too short',
HTTP_Request2_Exception::DECODE_ERROR
);
}
$extraLength = unpack('v', substr($data, 10, 2));
if ($length - $headerLength - 2 - $extraLength[1] < 0) {
throw new HTTP_Request2_MessageException(
'Error parsing gzip header: data too short',
HTTP_Request2_Exception::DECODE_ERROR
);
}
$headerLength += $extraLength[1] + 2;
}
// file name, need to skip that
if ($flags & 8) {
if ($length - $headerLength - 1 < 0) {
throw new HTTP_Request2_MessageException(
'Error parsing gzip header: data too short',
HTTP_Request2_Exception::DECODE_ERROR
);
}
$filenameLength = strpos(substr($data, $headerLength), chr(0));
if (false === $filenameLength
|| $length - $headerLength - $filenameLength - 1 < 0
) {
throw new HTTP_Request2_MessageException(
'Error parsing gzip header: data too short',
HTTP_Request2_Exception::DECODE_ERROR
);
}
$headerLength += $filenameLength + 1;
}
// comment, need to skip that also
if ($flags & 16) {
if ($length - $headerLength - 1 < 0) {
throw new HTTP_Request2_MessageException(
'Error parsing gzip header: data too short',
HTTP_Request2_Exception::DECODE_ERROR
);
}
$commentLength = strpos(substr($data, $headerLength), chr(0));
if (false === $commentLength
|| $length - $headerLength - $commentLength - 1 < 0
) {
throw new HTTP_Request2_MessageException(
'Error parsing gzip header: data too short',
HTTP_Request2_Exception::DECODE_ERROR
);
}
$headerLength += $commentLength + 1;
}
// have a CRC for header. let's check
if ($flags & 2) {
if ($length - $headerLength - 2 < 0) {
throw new HTTP_Request2_MessageException(
'Error parsing gzip header: data too short',
HTTP_Request2_Exception::DECODE_ERROR
);
}
$crcReal = 0xffff & crc32(substr($data, 0, $headerLength));
$crcStored = unpack('v', substr($data, $headerLength, 2));
if ($crcReal != $crcStored[1]) {
throw new HTTP_Request2_MessageException(
'Header CRC check failed',
HTTP_Request2_Exception::DECODE_ERROR
);
}
$headerLength += 2;
}
return $headerLength;
}
/**
* Decodes the message-body encoded by gzip
*
* The real decoding work is done by gzinflate() built-in function, this
* method only parses the header and checks data for compliance with
* RFC 1952
*
* @param string $data gzip-encoded data
*
* @return string decoded data
* @throws HTTP_Request2_LogicException
* @throws HTTP_Request2_MessageException
* @link http://tools.ietf.org/html/rfc1952
*/
public static function decodeGzip($data)
{
// If it doesn't look like gzip-encoded data, don't bother
if (!self::hasGzipIdentification($data)) {
return $data;
}
if (!function_exists('gzinflate')) {
throw new HTTP_Request2_LogicException(
'Unable to decode body: gzip extension not available',
HTTP_Request2_Exception::MISCONFIGURATION
);
}
// unpacked data CRC and size at the end of encoded data
$tmp = unpack('V2', substr($data, -8));
$dataCrc = $tmp[1];
$dataSize = $tmp[2];
$headerLength = self::parseGzipHeader($data, true);
// don't pass $dataSize to gzinflate, see bugs #13135, #14370
$unpacked = gzinflate(substr($data, $headerLength, -8));
if (false === $unpacked) {
throw new HTTP_Request2_MessageException(
'gzinflate() call failed',
HTTP_Request2_Exception::DECODE_ERROR
);
} elseif ($dataSize != strlen($unpacked)) {
throw new HTTP_Request2_MessageException(
'Data size check failed',
HTTP_Request2_Exception::DECODE_ERROR
);
} elseif ((0xffffffff & $dataCrc) != (0xffffffff & crc32($unpacked))) {
throw new HTTP_Request2_MessageException(
'Data CRC check failed',
HTTP_Request2_Exception::DECODE_ERROR
);
}
return $unpacked;
}
/**
* Decodes the message-body encoded by deflate
*
* @param string $data deflate-encoded data
*
* @return string decoded data
* @throws HTTP_Request2_LogicException
*/
public static function decodeDeflate($data)
{
if (!function_exists('gzuncompress')) {
throw new HTTP_Request2_LogicException(
'Unable to decode body: gzip extension not available',
HTTP_Request2_Exception::MISCONFIGURATION
);
}
// RFC 2616 defines 'deflate' encoding as zlib format from RFC 1950,
// while many applications send raw deflate stream from RFC 1951.
// We should check for presence of zlib header and use gzuncompress() or
// gzinflate() as needed. See bug #15305
$header = unpack('n', substr($data, 0, 2));
return (0 == $header[1] % 31)? gzuncompress($data): gzinflate($data);
}
}
?>
+135
View File
@@ -0,0 +1,135 @@
<?php
/**
* SOCKS5 proxy connection class
*
* PHP version 5
*
* LICENSE
*
* This source file is subject to BSD 3-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @copyright 2008-2016 Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link http://pear.php.net/package/HTTP_Request2
*/
/** Socket wrapper class used by Socket Adapter */
require_once 'HTTP/Request2/SocketWrapper.php';
/**
* SOCKS5 proxy connection class (used by Socket Adapter)
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
* @link http://pear.php.net/bugs/bug.php?id=19332
* @link http://tools.ietf.org/html/rfc1928
*/
class HTTP_Request2_SOCKS5 extends HTTP_Request2_SocketWrapper
{
/**
* Constructor, tries to connect and authenticate to a SOCKS5 proxy
*
* @param string $address Proxy address, e.g. 'tcp://localhost:1080'
* @param int $timeout Connection timeout (seconds)
* @param array $contextOptions Stream context options
* @param string $username Proxy user name
* @param string $password Proxy password
*
* @throws HTTP_Request2_LogicException
* @throws HTTP_Request2_ConnectionException
* @throws HTTP_Request2_MessageException
*/
public function __construct(
$address, $timeout = 10, array $contextOptions = array(),
$username = null, $password = null
) {
parent::__construct($address, $timeout, $contextOptions);
if (strlen($username)) {
$request = pack('C4', 5, 2, 0, 2);
} else {
$request = pack('C3', 5, 1, 0);
}
$this->write($request);
$response = unpack('Cversion/Cmethod', $this->read(3));
if (5 != $response['version']) {
throw new HTTP_Request2_MessageException(
'Invalid version received from SOCKS5 proxy: ' . $response['version'],
HTTP_Request2_Exception::MALFORMED_RESPONSE
);
}
switch ($response['method']) {
case 2:
$this->performAuthentication($username, $password);
case 0:
break;
default:
throw new HTTP_Request2_ConnectionException(
"Connection rejected by proxy due to unsupported auth method"
);
}
}
/**
* Performs username/password authentication for SOCKS5
*
* @param string $username Proxy user name
* @param string $password Proxy password
*
* @throws HTTP_Request2_ConnectionException
* @throws HTTP_Request2_MessageException
* @link http://tools.ietf.org/html/rfc1929
*/
protected function performAuthentication($username, $password)
{
$request = pack('C2', 1, strlen($username)) . $username
. pack('C', strlen($password)) . $password;
$this->write($request);
$response = unpack('Cvn/Cstatus', $this->read(3));
if (1 != $response['vn'] || 0 != $response['status']) {
throw new HTTP_Request2_ConnectionException(
'Connection rejected by proxy due to invalid username and/or password'
);
}
}
/**
* Connects to a remote host via proxy
*
* @param string $remoteHost Remote host
* @param int $remotePort Remote port
*
* @throws HTTP_Request2_ConnectionException
* @throws HTTP_Request2_MessageException
*/
public function connect($remoteHost, $remotePort)
{
$request = pack('C5', 0x05, 0x01, 0x00, 0x03, strlen($remoteHost))
. $remoteHost . pack('n', $remotePort);
$this->write($request);
$response = unpack('Cversion/Creply/Creserved', $this->read(1024));
if (5 != $response['version'] || 0 != $response['reserved']) {
throw new HTTP_Request2_MessageException(
'Invalid response received from SOCKS5 proxy',
HTTP_Request2_Exception::MALFORMED_RESPONSE
);
} elseif (0 != $response['reply']) {
throw new HTTP_Request2_ConnectionException(
"Unable to connect to {$remoteHost}:{$remotePort} through SOCKS5 proxy",
0, $response['reply']
);
}
}
}
?>
@@ -0,0 +1,320 @@
<?php
/**
* Socket wrapper class used by Socket Adapter
*
* PHP version 5
*
* LICENSE
*
* This source file is subject to BSD 3-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @copyright 2008-2016 Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link http://pear.php.net/package/HTTP_Request2
*/
/** Exception classes for HTTP_Request2 package */
require_once 'HTTP/Request2/Exception.php';
/**
* Socket wrapper class used by Socket Adapter
*
* Needed to properly handle connection errors, global timeout support and
* similar things. Loosely based on Net_Socket used by older HTTP_Request.
*
* @category HTTP
* @package HTTP_Request2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @version Release: 2.3.0
* @link http://pear.php.net/package/HTTP_Request2
* @link http://pear.php.net/bugs/bug.php?id=19332
* @link http://tools.ietf.org/html/rfc1928
*/
class HTTP_Request2_SocketWrapper
{
/**
* PHP warning messages raised during stream_socket_client() call
* @var array
*/
protected $connectionWarnings = array();
/**
* Connected socket
* @var resource
*/
protected $socket;
/**
* Sum of start time and global timeout, exception will be thrown if request continues past this time
* @var integer
*/
protected $deadline;
/**
* Global timeout value, mostly for exception messages
* @var integer
*/
protected $timeout;
/**
* Class constructor, tries to establish connection
*
* @param string $address Address for stream_socket_client() call,
* e.g. 'tcp://localhost:80'
* @param int $timeout Connection timeout (seconds)
* @param array $contextOptions Context options
*
* @throws HTTP_Request2_LogicException
* @throws HTTP_Request2_ConnectionException
*/
public function __construct($address, $timeout, array $contextOptions = array())
{
if (!empty($contextOptions)
&& !isset($contextOptions['socket']) && !isset($contextOptions['ssl'])
) {
// Backwards compatibility with 2.1.0 and 2.1.1 releases
$contextOptions = array('ssl' => $contextOptions);
}
if (isset($contextOptions['ssl'])) {
$contextOptions['ssl'] += array(
// Using "Intermediate compatibility" cipher bundle from
// https://wiki.mozilla.org/Security/Server_Side_TLS
'ciphers' => 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:'
. 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:'
. 'DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:'
. 'ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:'
. 'ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:'
. 'ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:'
. 'ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:'
. 'DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:'
. 'DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:'
. 'ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:'
. 'AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:'
. 'AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:'
. '!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA'
);
if (version_compare(phpversion(), '5.4.13', '>=')) {
$contextOptions['ssl']['disable_compression'] = true;
if (version_compare(phpversion(), '5.6', '>=')) {
$contextOptions['ssl']['crypto_method'] = STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT
| STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
}
}
}
$context = stream_context_create();
foreach ($contextOptions as $wrapper => $options) {
foreach ($options as $name => $value) {
if (!stream_context_set_option($context, $wrapper, $name, $value)) {
throw new HTTP_Request2_LogicException(
"Error setting '{$wrapper}' wrapper context option '{$name}'"
);
}
}
}
set_error_handler(array($this, 'connectionWarningsHandler'));
$this->socket = stream_socket_client(
$address, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $context
);
restore_error_handler();
// if we fail to bind to a specified local address (see request #19515),
// connection still succeeds, albeit with a warning. Throw an Exception
// with the warning text in this case as that connection is unlikely
// to be what user wants and as Curl throws an error in similar case.
if ($this->connectionWarnings) {
if ($this->socket) {
fclose($this->socket);
}
$error = $errstr ? $errstr : implode("\n", $this->connectionWarnings);
throw new HTTP_Request2_ConnectionException(
"Unable to connect to {$address}. Error: {$error}", 0, $errno
);
}
}
/**
* Destructor, disconnects socket
*/
public function __destruct()
{
fclose($this->socket);
}
/**
* Wrapper around fread(), handles global request timeout
*
* @param int $length Reads up to this number of bytes
*
* @return string Data read from socket
* @throws HTTP_Request2_MessageException In case of timeout
*/
public function read($length)
{
if ($this->deadline) {
stream_set_timeout($this->socket, max($this->deadline - time(), 1));
}
$data = fread($this->socket, $length);
$this->checkTimeout();
return $data;
}
/**
* Reads until either the end of the socket or a newline, whichever comes first
*
* Strips the trailing newline from the returned data, handles global
* request timeout. Method idea borrowed from Net_Socket PEAR package.
*
* @param int $bufferSize buffer size to use for reading
* @param int $localTimeout timeout value to use just for this call
* (used when waiting for "100 Continue" response)
*
* @return string Available data up to the newline (not including newline)
* @throws HTTP_Request2_MessageException In case of timeout
*/
public function readLine($bufferSize, $localTimeout = null)
{
$line = '';
while (!feof($this->socket)) {
if (null !== $localTimeout) {
stream_set_timeout($this->socket, $localTimeout);
} elseif ($this->deadline) {
stream_set_timeout($this->socket, max($this->deadline - time(), 1));
}
$line .= @fgets($this->socket, $bufferSize);
if (null === $localTimeout) {
$this->checkTimeout();
} else {
$info = stream_get_meta_data($this->socket);
// reset socket timeout if we don't have request timeout specified,
// prevents further calls failing with a bogus Exception
if (!$this->deadline) {
$default = (int)@ini_get('default_socket_timeout');
stream_set_timeout($this->socket, $default > 0 ? $default : PHP_INT_MAX);
}
if ($info['timed_out']) {
throw new HTTP_Request2_MessageException(
"readLine() call timed out", HTTP_Request2_Exception::TIMEOUT
);
}
}
if (substr($line, -1) == "\n") {
return rtrim($line, "\r\n");
}
}
return $line;
}
/**
* Wrapper around fwrite(), handles global request timeout
*
* @param string $data String to be written
*
* @return int
* @throws HTTP_Request2_MessageException
*/
public function write($data)
{
if ($this->deadline) {
stream_set_timeout($this->socket, max($this->deadline - time(), 1));
}
$written = fwrite($this->socket, $data);
$this->checkTimeout();
// http://www.php.net/manual/en/function.fwrite.php#96951
if ($written < strlen($data)) {
throw new HTTP_Request2_MessageException('Error writing request');
}
return $written;
}
/**
* Tests for end-of-file on a socket
*
* @return bool
*/
public function eof()
{
return feof($this->socket);
}
/**
* Sets request deadline
*
* @param int $deadline Exception will be thrown if request continues
* past this time
* @param int $timeout Original request timeout value, to use in
* Exception message
*/
public function setDeadline($deadline, $timeout)
{
$this->deadline = $deadline;
$this->timeout = $timeout;
}
/**
* Turns on encryption on a socket
*
* @throws HTTP_Request2_ConnectionException
*/
public function enableCrypto()
{
if (version_compare(phpversion(), '5.6', '<')) {
$cryptoMethod = STREAM_CRYPTO_METHOD_TLS_CLIENT;
} else {
$cryptoMethod = STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT
| STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
}
if (!stream_socket_enable_crypto($this->socket, true, $cryptoMethod)) {
throw new HTTP_Request2_ConnectionException(
'Failed to enable secure connection when connecting through proxy'
);
}
}
/**
* Throws an Exception if stream timed out
*
* @throws HTTP_Request2_MessageException
*/
protected function checkTimeout()
{
$info = stream_get_meta_data($this->socket);
if ($info['timed_out'] || $this->deadline && time() > $this->deadline) {
$reason = $this->deadline
? "after {$this->timeout} second(s)"
: 'due to default_socket_timeout php.ini setting';
throw new HTTP_Request2_MessageException(
"Request timed out {$reason}", HTTP_Request2_Exception::TIMEOUT
);
}
}
/**
* Error handler to use during stream_socket_client() call
*
* One stream_socket_client() call may produce *multiple* PHP warnings
* (especially OpenSSL-related), we keep them in an array to later use for
* the message of HTTP_Request2_ConnectionException
*
* @param int $errno error level
* @param string $errstr error message
*
* @return bool
*/
protected function connectionWarningsHandler($errno, $errstr)
{
if ($errno & E_WARNING) {
array_unshift($this->connectionWarnings, $errstr);
}
return true;
}
}
?>
File diff suppressed because it is too large Load Diff
+254
View File
@@ -0,0 +1,254 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* a class to handle converting RR bitmaps to arrays and back; used on NSEC
* and NSEC3 RR's
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_Packet
*
*/
class Net_DNS2_BitMap
{
/**
* parses a RR bitmap field defined in RFC3845, into an array of RR names.
*
* Type Bit Map(s) Field = ( Window Block # | Bitmap Length | Bitmap ) +
*
* @param string $data a bitmap stringto parse
*
* @return array
* @access public
*
*/
public static function bitMapToArray($data)
{
if (strlen($data) == 0) {
return null;
}
$output = array();
$offset = 0;
$length = strlen($data);
while ($offset < $length) {
//
// unpack the window and length values
//
$x = unpack('@' . $offset . '/Cwindow/Clength', $data);
$offset += 2;
//
// copy out the bitmap value
//
$bitmap = unpack('C*', substr($data, $offset, $x['length']));
$offset += $x['length'];
//
// I'm not sure if there's a better way of doing this, but PHP doesn't
// have a 'B' flag for unpack()
//
$bitstr = '';
foreach ($bitmap as $r) {
$bitstr .= sprintf('%08b', $r);
}
$blen = strlen($bitstr);
for ($i=0; $i<$blen; $i++) {
if ($bitstr[$i] == '1') {
$type = $x['window'] * 256 + $i;
if (isset(Net_DNS2_Lookups::$rr_types_by_id[$type])) {
$output[] = Net_DNS2_Lookups::$rr_types_by_id[$type];
} else {
$output[] = 'TYPE' . $type;
}
}
}
}
return $output;
}
/**
* builds a RR Bit map from an array of RR type names
*
* @param array $data a list of RR names
*
* @return string
* @access public
*
*/
public static function arrayToBitMap(array $data)
{
if (count($data) == 0) {
return null;
}
$current_window = 0;
//
// go through each RR
//
$max = 0;
$bm = array();
foreach ($data as $rr) {
$rr = strtoupper($rr);
//
// get the type id for the RR
//
$type = @Net_DNS2_Lookups::$rr_types_by_name[$rr];
if (isset($type)) {
//
// skip meta types or qtypes
//
if ( (isset(Net_DNS2_Lookups::$rr_qtypes_by_id[$type]))
|| (isset(Net_DNS2_Lookups::$rr_metatypes_by_id[$type]))
) {
continue;
}
} else {
//
// if it's not found, then it must be defined as TYPE<id>, per
// RFC3845 section 2.2, if it's not, we ignore it.
//
list($name, $type) = explode('TYPE', $rr);
if (!isset($type)) {
continue;
}
}
//
// build the current window
//
$current_window = (int)($type / 256);
$val = $type - $current_window * 256.0;
if ($val > $max) {
$max = $val;
}
$bm[$current_window][$val] = 1;
$bm[$current_window]['length'] = ceil(($max + 1) / 8);
}
$output = '';
foreach ($bm as $window => $bitdata) {
$bitstr = '';
for ($i=0; $i<$bm[$window]['length'] * 8; $i++) {
if (isset($bm[$window][$i])) {
$bitstr .= '1';
} else {
$bitstr .= '0';
}
}
$output .= pack('CC', $window, $bm[$window]['length']);
$output .= pack('H*', self::bigBaseConvert($bitstr));
}
return $output;
}
/**
* a base_convert that handles large numbers; forced to 2/16
*
* @param string $number a bit string
*
* @return string
* @access public
*
*/
public static function bigBaseConvert($number)
{
$result = '';
$bin = substr(chunk_split(strrev($number), 4, '-'), 0, -1);
$temp = preg_split('[-]', $bin, -1, PREG_SPLIT_DELIM_CAPTURE);
for ($i = count($temp)-1;$i >= 0;$i--) {
$result = $result . base_convert(strrev($temp[$i]), 2, 16);
}
return strtoupper($result);
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+311
View File
@@ -0,0 +1,311 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.1.0
*
*/
/**
* A class to provide simple dns lookup caching.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_Packet
*
*/
class Net_DNS2_Cache
{
/*
* the filename of the cache file
*/
protected $cache_file = '';
/*
* the local data store for the cache
*/
protected $cache_data = array();
/*
* the size of the cache to use
*/
protected $cache_size = 0;
/*
* the cache serializer
*/
protected $cache_serializer;
/*
* an internal flag to make sure we don't load the cache content more
* than once per instance.
*/
protected $cache_opened = false;
/**
* returns true/false if the provided key is defined in the cache
*
* @param string $key the key to lookup in the local cache
*
* @return boolean
* @access public
*
*/
public function has($key)
{
return isset($this->cache_data[$key]);
}
/**
* returns the value for the given key
*
* @param string $key the key to lookup in the local cache
*
* @return mixed returns the cache data on sucess, false on error
* @access public
*
*/
public function get($key)
{
if (isset($this->cache_data[$key])) {
if ($this->cache_serializer == 'json') {
return json_decode($this->cache_data[$key]['object']);
} else {
return unserialize($this->cache_data[$key]['object']);
}
} else {
return false;
}
}
/**
* adds a new key/value pair to the cache
*
* @param string $key the key for the new cache entry
* @param mixed $data the data to store in cache
*
* @return void
* @access public
*
*/
public function put($key, $data)
{
$ttl = 86400 * 365;
//
// clear the rdata values
//
$data->rdata = '';
$data->rdlength = 0;
//
// find the lowest TTL, and use that as the TTL for the whole cached
// object. The downside to using one TTL for the whole object, is that
// we'll invalidate entries before they actuall expire, causing a
// real lookup to happen.
//
// The upside is that we don't need to require() each RR type in the
// cache, so we can look at their individual TTL's on each run- we only
// unserialize the actual RR object when it's get() from the cache.
//
foreach ($data->answer as $index => $rr) {
if ($rr->ttl < $ttl) {
$ttl = $rr->ttl;
}
$rr->rdata = '';
$rr->rdlength = 0;
}
foreach ($data->authority as $index => $rr) {
if ($rr->ttl < $ttl) {
$ttl = $rr->ttl;
}
$rr->rdata = '';
$rr->rdlength = 0;
}
foreach ($data->additional as $index => $rr) {
if ($rr->ttl < $ttl) {
$ttl = $rr->ttl;
}
$rr->rdata = '';
$rr->rdlength = 0;
}
$this->cache_data[$key] = array(
'cache_date' => time(),
'ttl' => $ttl
);
if ($this->cache_serializer == 'json') {
$this->cache_data[$key]['object'] = json_encode($data);
} else {
$this->cache_data[$key]['object'] = serialize($data);
}
}
/**
* runs a clean up process on the cache data
*
* @return void
* @access protected
*
*/
protected function clean()
{
if (count($this->cache_data) > 0) {
//
// go through each entry and adjust their TTL, and remove entries that
// have expired
//
$now = time();
foreach ($this->cache_data as $key => $data) {
$diff = $now - $data['cache_date'];
if ($data['ttl'] <= $diff) {
unset($this->cache_data[$key]);
} else {
$this->cache_data[$key]['ttl'] -= $diff;
$this->cache_data[$key]['cache_date'] = $now;
}
}
}
}
/**
* runs a clean up process on the cache data
*
* @return mixed
* @access protected
*
*/
protected function resize()
{
if (count($this->cache_data) > 0) {
//
// serialize the cache data
//
if ($this->cache_serializer == 'json') {
$cache = json_encode($this->cache_data);
} else {
$cache = serialize($this->cache_data);
}
//
// only do this part if the size allocated to the cache storage
// is smaller than the actual cache data
//
if (strlen($cache) > $this->cache_size) {
while (strlen($cache) > $this->cache_size) {
//
// go through the data, and remove the entries closed to
// their expiration date.
//
$smallest_ttl = time();
$smallest_key = null;
foreach ($this->cache_data as $key => $data) {
if ($data['ttl'] < $smallest_ttl) {
$smallest_ttl = $data['ttl'];
$smallest_key = $key;
}
}
//
// unset the key with the smallest TTL
//
unset($this->cache_data[$smallest_key]);
//
// re-serialize
//
if ($this->cache_serializer == 'json') {
$cache = json_encode($this->cache_data);
} else {
$cache = serialize($this->cache_data);
}
}
}
if ( ($cache == 'a:0:{}') || ($cache == '{}') ) {
return null;
} else {
return $cache;
}
}
return null;
}
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+247
View File
@@ -0,0 +1,247 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.1.0
*
*/
/**
* File-based caching for the Net_DNS2_Cache class
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_Packet
*
*/
class Net_DNS2_Cache_File extends Net_DNS2_Cache
{
/**
* open a cache object
*
* @param string $cache_file path to a file to use for cache storage
* @param integer $size the size of the shared memory segment to create
* @param string $serializer the name of the cache serialize to use
*
* @throws Net_DNS2_Exception
* @access public
* @return void
*
*/
public function open($cache_file, $size, $serializer)
{
$this->cache_size = $size;
$this->cache_file = $cache_file;
$this->cache_serializer = $serializer;
//
// check that the file exists first
//
if ( ($this->cache_opened == false)
&& (file_exists($this->cache_file) == true)
&& (filesize($this->cache_file) > 0)
) {
//
// open the file for reading
//
$fp = @fopen($this->cache_file, 'r');
if ($fp !== false) {
//
// lock the file just in case
//
flock($fp, LOCK_EX);
//
// read the file contents
//
$data = fread($fp, filesize($this->cache_file));
$decoded = null;
if ($this->cache_serializer == 'json') {
$decoded = json_decode($data, true);
} else {
$decoded = unserialize($data);
}
if (is_array($decoded) == true) {
$this->cache_data = $decoded;
} else {
$this->cache_data = array();
}
//
// unlock
//
flock($fp, LOCK_UN);
//
// close the file
//
fclose($fp);
//
// clean up the data
//
$this->clean();
//
// mark this so we don't read this contents more than once per instance.
//
$this->cache_opened = true;
}
}
}
/**
* Destructor
*
* @access public
*
*/
public function __destruct()
{
//
// if there's no cache file set, then there's nothing to do
//
if (strlen($this->cache_file) == 0) {
return;
}
//
// open the file for reading/writing
//
$fp = fopen($this->cache_file, 'a+');
if ($fp !== false) {
//
// lock the file just in case
//
flock($fp, LOCK_EX);
//
// seek to the start of the file to read
//
fseek($fp, 0, SEEK_SET);
//
// read the file contents
//
$data = @fread($fp, filesize($this->cache_file));
if ( ($data !== false) && (strlen($data) > 0) ) {
//
// unserialize and store the data
//
$c = $this->cache_data;
$decoded = null;
if ($this->cache_serializer == 'json') {
$decoded = json_decode($data, true);
} else {
$decoded = unserialize($data);
}
if (is_array($decoded) == true) {
$this->cache_data = array_merge($c, $decoded);
}
}
//
// trucate the file
//
ftruncate($fp, 0);
//
// clean the data
//
$this->clean();
//
// resize the data
//
$data = $this->resize();
if (!is_null($data)) {
//
// write the file contents
//
fwrite($fp, $data);
}
//
// unlock
//
flock($fp, LOCK_UN);
//
// close the file
//
fclose($fp);
}
}
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+318
View File
@@ -0,0 +1,318 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.1.0
*
*/
/**
* Shared Memory-based caching for the Net_DNS2_Cache class
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_Packet
*
*/
class Net_DNS2_Cache_Shm extends Net_DNS2_Cache
{
/*
* resource id of the shared memory cache
*/
private $_cache_id = false;
/*
* the IPC key
*/
private $_cache_file_tok = -1;
/**
* open a cache object
*
* @param string $cache_file path to a file to use for cache storage
* @param integer $size the size of the shared memory segment to create
* @param string $serializer the name of the cache serialize to use
*
* @throws Net_DNS2_Exception
* @access public
* @return void
*
*/
public function open($cache_file, $size, $serializer)
{
$this->cache_size = $size;
$this->cache_file = $cache_file;
$this->cache_serializer = $serializer;
//
// if we've already loaded the cache data, then just return right away
//
if ($this->cache_opened == true)
{
return;
}
//
// make sure the file exists first
//
if (!file_exists($cache_file)) {
if (file_put_contents($cache_file, '') === false) {
throw new Net_DNS2_Exception(
'failed to create empty SHM file: ' . $cache_file,
Net_DNS2_Lookups::E_CACHE_SHM_FILE
);
}
}
//
// convert the filename to a IPC key
//
$this->_cache_file_tok = ftok($cache_file, 't');
if ($this->_cache_file_tok == -1) {
throw new Net_DNS2_Exception(
'failed on ftok() file: ' . $this->_cache_file_tok,
Net_DNS2_Lookups::E_CACHE_SHM_FILE
);
}
//
// try to open an existing cache; if it doesn't exist, then there's no
// cache, and nothing to do.
//
$this->_cache_id = @shmop_open($this->_cache_file_tok, 'w', 0, 0);
if ($this->_cache_id !== false) {
//
// this returns the size allocated, and not the size used, but it's
// still a good check to make sure there's space allocated.
//
$allocated = shmop_size($this->_cache_id);
if ($allocated > 0) {
//
// read the data from the shared memory segment
//
$data = trim(shmop_read($this->_cache_id, 0, $allocated));
if ( ($data !== false) && (strlen($data) > 0) ) {
//
// unserialize and store the data
//
$decoded = null;
if ($this->cache_serializer == 'json') {
$decoded = json_decode($data, true);
} else {
$decoded = unserialize($data);
}
if (is_array($decoded) == true) {
$this->cache_data = $decoded;
} else {
$this->cache_data = array();
}
//
// call clean to clean up old entries
//
$this->clean();
//
// mark the cache as loaded, so we don't load it more than once
//
$this->cache_opened = true;
}
}
}
}
/**
* Destructor
*
* @access public
*
*/
public function __destruct()
{
//
// if there's no cache file set, then there's nothing to do
//
if (strlen($this->cache_file) == 0) {
return;
}
$fp = fopen($this->cache_file, 'r');
if ($fp !== false) {
//
// lock the file
//
flock($fp, LOCK_EX);
//
// check to see if we have an open shm segment
//
if ($this->_cache_id === false) {
//
// try opening it again, incase it was created by another
// process in the mean time
//
$this->_cache_id = @shmop_open(
$this->_cache_file_tok, 'w', 0, 0
);
if ($this->_cache_id === false) {
//
// otherwise, create it.
//
$this->_cache_id = @shmop_open(
$this->_cache_file_tok, 'c', 0, $this->cache_size
);
}
}
//
// get the size allocated to the segment
//
$allocated = shmop_size($this->_cache_id);
//
// read the contents
//
$data = trim(shmop_read($this->_cache_id, 0, $allocated));
//
// if there was some data
//
if ( ($data !== false) && (strlen($data) > 0) ) {
//
// unserialize and store the data
//
$c = $this->cache_data;
$decoded = null;
if ($this->cache_serializer == 'json') {
$decoded = json_decode($data, true);
} else {
$decoded = unserialize($data);
}
if (is_array($decoded) == true) {
$this->cache_data = array_merge($c, $decoded);
}
}
//
// delete the segment
//
shmop_delete($this->_cache_id);
//
// clean the data
//
$this->clean();
//
// clean up and write the data
//
$data = $this->resize();
if (!is_null($data)) {
//
// re-create segment
//
$this->_cache_id = @shmop_open(
$this->_cache_file_tok, 'c', 0644, $this->cache_size
);
if ($this->_cache_id === false) {
return;
}
$o = shmop_write($this->_cache_id, $data, 0);
}
//
// close the segment
//
shmop_close($this->_cache_id);
//
// unlock
//
flock($fp, LOCK_UN);
//
// close the file
//
fclose($fp);
}
}
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+142
View File
@@ -0,0 +1,142 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*/
/**
* Exception handler used by Net_DNS2
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
*
*/
class Net_DNS2_Exception extends Exception
{
private $_request;
private $_response;
/**
* Constructor - overload the constructor so we can pass in the request
* and response object (when it's available)
*
* @param string $message the exception message
* @param int $code the exception code
* @param object $previous the previous Exception object
* @param object $request the Net_DNS2_Packet_Request object for this request
* @param object $response the Net_DNS2_Packet_Response object for this request
*
* @access public
*
*/
public function __construct(
$message = '',
$code = 0,
$previous = null,
Net_DNS2_Packet_Request $request = null,
Net_DNS2_Packet_Response $response = null
) {
//
// store the request/response objects (if passed)
//
$this->_request = $request;
$this->_response = $response;
//
// call the parent constructor
//
// the "previous" argument was added in PHP 5.3.0
//
// https://code.google.com/p/netdns2/issues/detail?id=25
//
if (version_compare(PHP_VERSION, '5.3.0', '>=') == true) {
parent::__construct($message, $code, $previous);
} else {
parent::__construct($message, $code);
}
}
/**
* returns the Net_DNS2_Packet_Request object (if available)
*
* @return Net_DNS2_Packet_Request object
* @access public
* @since function available since release 1.3.1
*
*/
public function getRequest()
{
return $this->_request;
}
/**
* returns the Net_DNS2_Packet_Response object (if available)
*
* @return Net_DNS2_Packet_Response object
* @access public
* @since function available since release 1.3.1
*
*/
public function getResponse()
{
return $this->_response;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+277
View File
@@ -0,0 +1,277 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* DNS Packet Header class
*
* This class handles parsing and constructing DNS Packet Headers as defined
* by section 4.1.1 of RFC1035.
*
* DNS header format - RFC1035 section 4.1.1
* DNS header format - RFC4035 section 3.2
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ID |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* |QR| Opcode |AA|TC|RD|RA| Z|AD|CD| RCODE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | QDCOUNT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ANCOUNT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | NSCOUNT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ARCOUNT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
*
*/
class Net_DNS2_Header
{
public $id; // 16 bit - identifier
public $qr; // 1 bit - 0 = query, 1 = response
public $opcode; // 4 bit - op code
public $aa; // 1 bit - Authoritative Answer
public $tc; // 1 bit - TrunCation
public $rd; // 1 bit - Recursion Desired
public $ra; // 1 bit - Recursion Available
public $z; // 1 bit - Reserved
public $ad; // 1 bit - Authentic Data (RFC4035)
public $cd; // 1 bit - Checking Disabled (RFC4035)
public $rcode; // 4 bit - Response code
public $qdcount; // 16 bit - entries in the question section
public $ancount; // 16 bit - resource records in the answer section
public $nscount; // 16 bit - name server rr in the authority records section
public $arcount; // 16 bit - rr's in the additional records section
/**
* Constructor - builds a new Net_DNS2_Header object
*
* @param mixed &$packet either a Net_DNS2_Packet object or null
*
* @throws Net_DNS2_Exception
* @access public
*
*/
public function __construct(Net_DNS2_Packet &$packet = null)
{
if (!is_null($packet)) {
$this->set($packet);
} else {
$this->id = $this->nextPacketId();
$this->qr = Net_DNS2_Lookups::QR_QUERY;
$this->opcode = Net_DNS2_Lookups::OPCODE_QUERY;
$this->aa = 0;
$this->tc = 0;
$this->rd = 1;
$this->ra = 0;
$this->z = 0;
$this->ad = 0;
$this->cd = 0;
$this->rcode = Net_DNS2_Lookups::RCODE_NOERROR;
$this->qdcount = 1;
$this->ancount = 0;
$this->nscount = 0;
$this->arcount = 0;
}
}
/**
* returns the next available packet id
*
* @return integer
* @access public
*
*/
public function nextPacketId()
{
if (++Net_DNS2_Lookups::$next_packet_id > 65535) {
Net_DNS2_Lookups::$next_packet_id = 1;
}
return Net_DNS2_Lookups::$next_packet_id;
}
/**
* magic __toString() method to return the header as a string
*
* @return string
* @access public
*
*/
public function __toString()
{
$output = ";;\n;; Header:\n";
$output .= ";;\t id = " . $this->id . "\n";
$output .= ";;\t qr = " . $this->qr . "\n";
$output .= ";;\t opcode = " . $this->opcode . "\n";
$output .= ";;\t aa = " . $this->aa . "\n";
$output .= ";;\t tc = " . $this->tc . "\n";
$output .= ";;\t rd = " . $this->rd . "\n";
$output .= ";;\t ra = " . $this->ra . "\n";
$output .= ";;\t z = " . $this->z . "\n";
$output .= ";;\t ad = " . $this->ad . "\n";
$output .= ";;\t cd = " . $this->cd . "\n";
$output .= ";;\t rcode = " . $this->rcode . "\n";
$output .= ";;\t qdcount = " . $this->qdcount . "\n";
$output .= ";;\t ancount = " . $this->ancount . "\n";
$output .= ";;\t nscount = " . $this->nscount . "\n";
$output .= ";;\t arcount = " . $this->arcount . "\n";
return $output;
}
/**
* constructs a Net_DNS2_Header from a Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet Object
*
* @return boolean
* @throws Net_DNS2_Exception
* @access public
*
*/
public function set(Net_DNS2_Packet &$packet)
{
//
// the header must be at least 12 bytes long.
//
if ($packet->rdlength < Net_DNS2_Lookups::DNS_HEADER_SIZE) {
throw new Net_DNS2_Exception(
'invalid header data provided; to small',
Net_DNS2_Lookups::E_HEADER_INVALID
);
}
$offset = 0;
//
// parse the values
//
$this->id = ord($packet->rdata[$offset]) << 8 |
ord($packet->rdata[++$offset]);
++$offset;
$this->qr = (ord($packet->rdata[$offset]) >> 7) & 0x1;
$this->opcode = (ord($packet->rdata[$offset]) >> 3) & 0xf;
$this->aa = (ord($packet->rdata[$offset]) >> 2) & 0x1;
$this->tc = (ord($packet->rdata[$offset]) >> 1) & 0x1;
$this->rd = ord($packet->rdata[$offset]) & 0x1;
++$offset;
$this->ra = (ord($packet->rdata[$offset]) >> 7) & 0x1;
$this->z = (ord($packet->rdata[$offset]) >> 6) & 0x1;
$this->ad = (ord($packet->rdata[$offset]) >> 5) & 0x1;
$this->cd = (ord($packet->rdata[$offset]) >> 4) & 0x1;
$this->rcode = ord($packet->rdata[$offset]) & 0xf;
$this->qdcount = ord($packet->rdata[++$offset]) << 8 |
ord($packet->rdata[++$offset]);
$this->ancount = ord($packet->rdata[++$offset]) << 8 |
ord($packet->rdata[++$offset]);
$this->nscount = ord($packet->rdata[++$offset]) << 8 |
ord($packet->rdata[++$offset]);
$this->arcount = ord($packet->rdata[++$offset]) << 8 |
ord($packet->rdata[++$offset]);
//
// increment the internal offset
//
$packet->offset += Net_DNS2_Lookups::DNS_HEADER_SIZE;
return true;
}
/**
* returns a binary packed DNS Header
*
* @param Net_DNS2_Packet &$packet Object
*
* @return string
* @access public
*
*/
public function get(Net_DNS2_Packet &$packet)
{
$packet->offset += Net_DNS2_Lookups::DNS_HEADER_SIZE;
return pack('n', $this->id) .
chr(
($this->qr << 7) | ($this->opcode << 3) |
($this->aa << 2) | ($this->tc << 1) | ($this->rd)
) .
chr(
($this->ra << 7) | ($this->ad << 5) | ($this->cd << 4) | $this->rcode
) .
pack('n4', $this->qdcount, $this->ancount, $this->nscount, $this->arcount);
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+578
View File
@@ -0,0 +1,578 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
//
// initalize the packet id value
//
Net_DNS2_Lookups::$next_packet_id = mt_rand(0, 65535);
//
// build the reverse lookup tables; this is just so we don't have to
// have duplicate static content laying around.
//
Net_DNS2_Lookups::$rr_types_by_id = array_flip(Net_DNS2_Lookups::$rr_types_by_name);
Net_DNS2_Lookups::$classes_by_id = array_flip(Net_DNS2_Lookups::$classes_by_name);
Net_DNS2_Lookups::$rr_types_class_to_id = array_flip(Net_DNS2_Lookups::$rr_types_id_to_class);
Net_DNS2_Lookups::$algorithm_name_to_id = array_flip(Net_DNS2_Lookups::$algorithm_id_to_name);
Net_DNS2_Lookups::$digest_name_to_id = array_flip(Net_DNS2_Lookups::$digest_id_to_name);
Net_DNS2_Lookups::$rr_qtypes_by_id = array_flip(Net_DNS2_Lookups::$rr_qtypes_by_name);
Net_DNS2_Lookups::$rr_metatypes_by_id = array_flip(Net_DNS2_Lookups::$rr_metatypes_by_name);
Net_DNS2_Lookups::$protocol_by_id = array_flip(Net_DNS2_Lookups::$protocol_by_name);
/**
* This class provides simple lookups used througout the Net_DNS2 code
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
*
*/
class Net_DNS2_Lookups
{
/*
* size (in bytes) of a header in a standard DNS packet
*/
const DNS_HEADER_SIZE = 12;
/*
* max size of a UDP packet
*/
const DNS_MAX_UDP_SIZE = 512;
/*
* Query/Response flag
*/
const QR_QUERY = 0; // RFC 1035
const QR_RESPONSE = 1; // RFC 1035
/*
* DNS Op Codes
*/
const OPCODE_QUERY = 0; // RFC 1035
const OPCODE_IQUERY = 1; // RFC 1035, RFC 3425
const OPCODE_STATUS = 2; // RFC 1035
const OPCODE_NOTIFY = 4; // RFC 1996
const OPCODE_UPDATE = 5; // RFC 2136
/*
* Resource Record Classes
*/
const RR_CLASS_IN = 1; // RFC 1035
const RR_CLASS_CH = 3; // RFC 1035
const RR_CLASS_HS = 4; // RFC 1035
const RR_CLASS_NONE = 254; // RFC 2136
const RR_CLASS_ANY = 255; // RFC 1035
/*
* DNS Response Codes
*/
const RCODE_NOERROR = 0; // RFC 1035
const RCODE_FORMERR = 1; // RFC 1035
const RCODE_SERVFAIL = 2; // RFC 1035
const RCODE_NXDOMAIN = 3; // RFC 1035
const RCODE_NOTIMP = 4; // RFC 1035
const RCODE_REFUSED = 5; // RFC 1035
const RCODE_YXDOMAIN = 6; // RFC 2136
const RCODE_YXRRSET = 7; // RFC 2136
const RCODE_NXRRSET = 8; // RFC 2136
const RCODE_NOTAUTH = 9; // RFC 2136
const RCODE_NOTZONE = 10; // RFC 2136
// 11-15 reserved
const RCODE_BADSIG = 16; // RFC 2845
const RCODE_BADVERS = 16; // RFC 6891
const RCODE_BADKEY = 17; // RFC 2845
const RCODE_BADTIME = 18; // RFC 2845
const RCODE_BADMODE = 19; // RFC 2930
const RCODE_BADNAME = 20; // RFC 2930
const RCODE_BADALG = 21; // RFC 2930
const RCODE_BADTRUNC = 22; // RFC 4635
const RCODE_BADCOOKIE = 23; // RFC 7873
/*
* internal errors codes returned by the exceptions class
*/
const E_NONE = 0;
const E_DNS_FORMERR = self::RCODE_FORMERR;
const E_DNS_SERVFAIL = self::RCODE_SERVFAIL;
const E_DNS_NXDOMAIN = self::RCODE_NXDOMAIN;
const E_DNS_NOTIMP = self::RCODE_NOTIMP;
const E_DNS_REFUSED = self::RCODE_REFUSED;
const E_DNS_YXDOMAIN = self::RCODE_YXDOMAIN;
const E_DNS_YXRRSET = self::RCODE_YXRRSET;
const E_DNS_NXRRSET = self::RCODE_NXRRSET;
const E_DNS_NOTAUTH = self::RCODE_NOTAUTH;
const E_DNS_NOTZONE = self::RCODE_NOTZONE;
// 11-15 reserved
const E_DNS_BADSIG = self::RCODE_BADSIG;
const E_DNS_BADKEY = self::RCODE_BADKEY;
const E_DNS_BADTIME = self::RCODE_BADTIME;
const E_DNS_BADMODE = self::RCODE_BADMODE;
const E_DNS_BADNAME = self::RCODE_BADNAME;
const E_DNS_BADALG = self::RCODE_BADALG;
const E_DNS_BADTRUNC = self::RCODE_BADTRUNC;
const E_DNS_BADCOOKIE = self::RCODE_BADCOOKIE;
// other error conditions
const E_NS_INVALID_FILE = 200;
const E_NS_INVALID_ENTRY = 201;
const E_NS_FAILED = 202;
const E_NS_SOCKET_FAILED = 203;
const E_NS_INVALID_SOCKET = 204;
const E_PACKET_INVALID = 300;
const E_PARSE_ERROR = 301;
const E_HEADER_INVALID = 302;
const E_QUESTION_INVALID = 303;
const E_RR_INVALID = 304;
const E_OPENSSL_ERROR = 400;
const E_OPENSSL_UNAVAIL = 401;
const E_OPENSSL_INV_PKEY = 402;
const E_OPENSSL_INV_ALGO = 403;
const E_CACHE_UNSUPPORTED = 500;
const E_CACHE_SHM_FILE = 501;
const E_CACHE_SHM_UNAVAIL = 502;
/*
* EDNS0 Option Codes (OPT)
*/
// 0 - Reserved
const EDNS0_OPT_LLQ = 1;
const EDNS0_OPT_UL = 2;
const EDNS0_OPT_NSID = 3;
// 4 - Reserved
const EDNS0_OPT_DAU = 5;
const EDNS0_OPT_DHU = 6;
const EDNS0_OPT_N3U = 7;
const EDNS0_OPT_CLIENT_SUBNET = 8;
const EDNS0_OPT_EXPIRE = 9;
const EDNS0_OPT_COOKIE = 10;
const EDNS0_OPT_TCP_KEEPALIVE = 11;
const EDNS0_OPT_PADDING = 12;
const EDNS0_OPT_CHAIN = 13;
/*
* DNSSEC Algorithms
*/
const DNSSEC_ALGORITHM_RES = 0;
const DNSSEC_ALGORITHM_RSAMD5 = 1;
const DNSSEC_ALGORITHM_DH = 2;
const DNSSEC_ALGORITHM_DSA = 3;
const DNSSEC_ALGORITHM_ECC = 4;
const DNSSEC_ALGORITHM_RSASHA1 = 5;
const DNSSEC_ALGORITHM_DSANSEC3SHA1 = 6;
const DSNSEC_ALGORITHM_RSASHA1NSEC3SHA1 = 7;
const DNSSEC_ALGORITHM_RSASHA256 = 8;
const DNSSEC_ALGORITHM_RSASHA512 = 10;
const DNSSEC_ALGORITHM_ECCGOST = 12;
const DNSSEC_ALGORITHM_INDIRECT = 252;
const DNSSEC_ALGORITHM_PRIVATEDNS = 253;
const DNSSEC_ALGORITHM_PRIVATEOID = 254;
/*
* DNSSEC Digest Types
*/
const DNSSEC_DIGEST_RES = 0;
const DNSSEC_DIGEST_SHA1 = 1;
/*
* The packet id used when sending requests
*/
public static $next_packet_id;
/*
* Used to map resource record types to their id's, and back
*/
public static $rr_types_by_id = array();
public static $rr_types_by_name = array(
'SIG0' => 0, // RFC 2931 pseudo type
'A' => 1, // RFC 1035
'NS' => 2, // RFC 1035
'MD' => 3, // RFC 1035 - obsolete, Not implemented
'MF' => 4, // RFC 1035 - obsolete, Not implemented
'CNAME' => 5, // RFC 1035
'SOA' => 6, // RFC 1035
'MB' => 7, // RFC 1035 - obsolete, Not implemented
'MG' => 8, // RFC 1035 - obsolete, Not implemented
'MR' => 9, // RFC 1035 - obsolete, Not implemented
'NULL' => 10, // RFC 1035 - obsolete, Not implemented
'WKS' => 11, // RFC 1035
'PTR' => 12, // RFC 1035
'HINFO' => 13, // RFC 1035
'MINFO' => 14, // RFC 1035 - obsolete, Not implemented
'MX' => 15, // RFC 1035
'TXT' => 16, // RFC 1035
'RP' => 17, // RFC 1183
'AFSDB' => 18, // RFC 1183
'X25' => 19, // RFC 1183
'ISDN' => 20, // RFC 1183
'RT' => 21, // RFC 1183
'NSAP' => 22, // RFC 1706
'NSAP_PTR' => 23, // RFC 1348 - obsolete, Not implemented
'SIG' => 24, // RFC 2535
'KEY' => 25, // RFC 2535, RFC 2930
'PX' => 26, // RFC 2163
'GPOS' => 27, // RFC 1712 - Not implemented
'AAAA' => 28, // RFC 3596
'LOC' => 29, // RFC 1876
'NXT' => 30, // RFC 2065, obsoleted by by RFC 3755
'EID' => 31, // [Patton][Patton1995]
'NIMLOC' => 32, // [Patton][Patton1995]
'SRV' => 33, // RFC 2782
'ATMA' => 34, // Windows only
'NAPTR' => 35, // RFC 2915
'KX' => 36, // RFC 2230
'CERT' => 37, // RFC 4398
'A6' => 38, // downgraded to experimental by RFC 3363
'DNAME' => 39, // RFC 2672
'SINK' => 40, // Not implemented
'OPT' => 41, // RFC 2671
'APL' => 42, // RFC 3123
'DS' => 43, // RFC 4034
'SSHFP' => 44, // RFC 4255
'IPSECKEY' => 45, // RFC 4025
'RRSIG' => 46, // RFC 4034
'NSEC' => 47, // RFC 4034
'DNSKEY' => 48, // RFC 4034
'DHCID' => 49, // RFC 4701
'NSEC3' => 50, // RFC 5155
'NSEC3PARAM' => 51, // RFC 5155
'TLSA' => 52, // RFC 6698
'SMIMEA' => 53, // draft-ietf-dane-smime-10
// 54 unassigned
'HIP' => 55, // RFC 5205
'NINFO' => 56, // Not implemented
'RKEY' => 57, // Not implemented
'TALINK' => 58, //
'CDS' => 59, // RFC 7344
'CDNSKEY' => 60, // RFC 7344
'OPENPGPKEY' => 61, // RFC 7929
'CSYNC' => 62, // RFC 7477
// 63 - 98 unassigned
'SPF' => 99, // RFC 4408
'UINFO' => 100, // no RFC, Not implemented
'UID' => 101, // no RFC, Not implemented
'GID' => 102, // no RFC, Not implemented
'UNSPEC' => 103, // no RFC, Not implemented
'NID' => 104, // RFC 6742
'L32' => 105, // RFC 6742
'L64' => 106, // RFC 6742
'LP' => 107, // RFC 6742
'EUI48' => 108, // RFC 7043
'EUI64' => 109, // RFC 7043
// 110 - 248 unassigned
'TKEY' => 249, // RFC 2930
'TSIG' => 250, // RFC 2845
'IXFR' => 251, // RFC 1995 - only a full (AXFR) is supported
'AXFR' => 252, // RFC 1035
'MAILB' => 253, // RFC 883, Not implemented
'MAILA' => 254, // RFC 973, Not implemented
'ANY' => 255, // RFC 1035 - we support both 'ANY' and '*'
'URI' => 256, // tools.ietf.org/html/draft-faltstrom-uri-06
'CAA' => 257, // tools.ietf.org/html/draft-ietf-pkix-caa-03
'AVC' => 258, // Application Visibility and Control
// 259 - 32767 unassigned
'TA' => 32768, // same as DS
'DLV' => 32769 // RFC 4431
);
/*
* Qtypes and Metatypes - defined in RFC2929 section 3.1
*/
public static $rr_qtypes_by_id = array();
public static $rr_qtypes_by_name = array(
'IXFR' => 251, // RFC 1995 - only a full (AXFR) is supported
'AXFR' => 252, // RFC 1035
'MAILB' => 253, // RFC 883, Not implemented
'MAILA' => 254, // RFC 973, Not implemented
'ANY' => 255 // RFC 1035 - we support both 'ANY' and '*'
);
public static $rr_metatypes_by_id = array();
public static $rr_metatypes_by_name = array(
'OPT' => 41, // RFC 2671
'TKEY' => 249, // RFC 2930
'TSIG' => 250 // RFC 2845
);
/*
* used to map resource record id's to RR class names
*/
public static $rr_types_class_to_id = array();
public static $rr_types_id_to_class = array(
1 => 'Net_DNS2_RR_A',
2 => 'Net_DNS2_RR_NS',
5 => 'Net_DNS2_RR_CNAME',
6 => 'Net_DNS2_RR_SOA',
11 => 'Net_DNS2_RR_WKS',
12 => 'Net_DNS2_RR_PTR',
13 => 'Net_DNS2_RR_HINFO',
15 => 'Net_DNS2_RR_MX',
16 => 'Net_DNS2_RR_TXT',
17 => 'Net_DNS2_RR_RP',
18 => 'Net_DNS2_RR_AFSDB',
19 => 'Net_DNS2_RR_X25',
20 => 'Net_DNS2_RR_ISDN',
21 => 'Net_DNS2_RR_RT',
22 => 'Net_DNS2_RR_NSAP',
24 => 'Net_DNS2_RR_SIG',
25 => 'Net_DNS2_RR_KEY',
26 => 'Net_DNS2_RR_PX',
28 => 'Net_DNS2_RR_AAAA',
29 => 'Net_DNS2_RR_LOC',
31 => 'Net_DNS2_RR_EID',
32 => 'Net_DNS2_RR_NIMLOC',
33 => 'Net_DNS2_RR_SRV',
34 => 'Net_DNS2_RR_ATMA',
35 => 'Net_DNS2_RR_NAPTR',
36 => 'Net_DNS2_RR_KX',
37 => 'Net_DNS2_RR_CERT',
39 => 'Net_DNS2_RR_DNAME',
41 => 'Net_DNS2_RR_OPT',
42 => 'Net_DNS2_RR_APL',
43 => 'Net_DNS2_RR_DS',
44 => 'Net_DNS2_RR_SSHFP',
45 => 'Net_DNS2_RR_IPSECKEY',
46 => 'Net_DNS2_RR_RRSIG',
47 => 'Net_DNS2_RR_NSEC',
48 => 'Net_DNS2_RR_DNSKEY',
49 => 'Net_DNS2_RR_DHCID',
50 => 'Net_DNS2_RR_NSEC3',
51 => 'Net_DNS2_RR_NSEC3PARAM',
52 => 'Net_DNS2_RR_TLSA',
53 => 'Net_DNS2_RR_SMIMEA',
55 => 'Net_DNS2_RR_HIP',
58 => 'Net_DNS2_RR_TALINK',
59 => 'Net_DNS2_RR_CDS',
60 => 'Net_DNS2_RR_CDNSKEY',
61 => 'Net_DNS2_RR_OPENPGPKEY',
62 => 'Net_DNS2_RR_CSYNC',
99 => 'Net_DNS2_RR_SPF',
104 => 'Net_DNS2_RR_NID',
105 => 'Net_DNS2_RR_L32',
106 => 'Net_DNS2_RR_L64',
107 => 'Net_DNS2_RR_LP',
108 => 'Net_DNS2_RR_EUI48',
109 => 'Net_DNS2_RR_EUI64',
249 => 'Net_DNS2_RR_TKEY',
250 => 'Net_DNS2_RR_TSIG',
// 251 - IXFR - handled as a full zone transfer (252)
// 252 - AXFR - handled as a function call
255 => 'Net_DNS2_RR_ANY',
256 => 'Net_DNS2_RR_URI',
257 => 'Net_DNS2_RR_CAA',
258 => 'Net_DNS2_RR_AVC',
32768 => 'Net_DNS2_RR_TA',
32769 => 'Net_DNS2_RR_DLV'
);
/*
* used to map resource record class names to their id's, and back
*/
public static $classes_by_id = array();
public static $classes_by_name = array(
'IN' => self::RR_CLASS_IN, // RFC 1035
'CH' => self::RR_CLASS_CH, // RFC 1035
'HS' => self::RR_CLASS_HS, // RFC 1035
'NONE' => self::RR_CLASS_NONE, // RFC 2136
'ANY' => self::RR_CLASS_ANY // RFC 1035
);
/*
* maps response codes to error messages
*/
public static $result_code_messages = array(
self::RCODE_NOERROR => 'The request completed successfully.',
self::RCODE_FORMERR => 'The name server was unable to interpret the query.',
self::RCODE_SERVFAIL => 'The name server was unable to process this query due to a problem with the name server.',
self::RCODE_NXDOMAIN => 'The domain name referenced in the query does not exist.',
self::RCODE_NOTIMP => 'The name server does not support the requested kind of query.',
self::RCODE_REFUSED => 'The name server refuses to perform the specified operation for policy reasons.',
self::RCODE_YXDOMAIN => 'Name Exists when it should not.',
self::RCODE_YXRRSET => 'RR Set Exists when it should not.',
self::RCODE_NXRRSET => 'RR Set that should exist does not.',
self::RCODE_NOTAUTH => 'Server Not Authoritative for zone.',
self::RCODE_NOTZONE => 'Name not contained in zone.',
self::RCODE_BADSIG => 'TSIG Signature Failure.',
self::RCODE_BADKEY => 'Key not recognized.',
self::RCODE_BADTIME => 'Signature out of time window.',
self::RCODE_BADMODE => 'Bad TKEY Mode.',
self::RCODE_BADNAME => 'Duplicate key name.',
self::RCODE_BADALG => 'Algorithm not supported.',
self::RCODE_BADTRUNC => 'Bad truncation.'
);
/*
* maps DNS SEC alrorithms to their mnemonics
*/
public static $algorithm_name_to_id = array();
public static $algorithm_id_to_name = array(
self::DNSSEC_ALGORITHM_RES => 'RES',
self::DNSSEC_ALGORITHM_RSAMD5 => 'RSAMD5',
self::DNSSEC_ALGORITHM_DH => 'DH',
self::DNSSEC_ALGORITHM_DSA => 'DSA',
self::DNSSEC_ALGORITHM_ECC => 'ECC',
self::DNSSEC_ALGORITHM_RSASHA1 => 'RSASHA1',
self::DNSSEC_ALGORITHM_DSANSEC3SHA1 => 'DSA-NSEC3-SHA1',
self::DSNSEC_ALGORITHM_RSASHA1NSEC3SHA1 => 'RSASHA1-NSEC3-SHA1',
self::DNSSEC_ALGORITHM_RSASHA256 => 'RSASHA256',
self::DNSSEC_ALGORITHM_RSASHA512 => 'RSASHA512',
self::DNSSEC_ALGORITHM_ECCGOST => 'ECC-GOST',
self::DNSSEC_ALGORITHM_INDIRECT => 'INDIRECT',
self::DNSSEC_ALGORITHM_PRIVATEDNS => 'PRIVATEDNS',
self::DNSSEC_ALGORITHM_PRIVATEOID => 'PRIVATEOID'
);
/*
* maps DNSSEC digest types to their mnemonics
*/
public static $digest_name_to_id = array();
public static $digest_id_to_name = array(
self::DNSSEC_DIGEST_RES => 'RES',
self::DNSSEC_DIGEST_SHA1 => 'SHA-1'
);
/*
* Protocols names - RFC 1010
*/
public static $protocol_by_id = array();
public static $protocol_by_name = array(
'ICMP' => 1,
'IGMP' => 2,
'GGP' => 3,
'ST' => 5,
'TCP' => 6,
'UCL' => 7,
'EGP' => 8,
'IGP' => 9,
'BBN-RCC-MON' => 10,
'NVP-II' => 11,
'PUP' => 12,
'ARGUS' => 13,
'EMCON' => 14,
'XNET' => 15,
'CHAOS' => 16,
'UDP' => 17,
'MUX' => 18,
'DCN-MEAS' => 19,
'HMP' => 20,
'PRM' => 21,
'XNS-IDP' => 22,
'TRUNK-1' => 23,
'TRUNK-2' => 24,
'LEAF-1' => 25,
'LEAF-2' => 26,
'RDP' => 27,
'IRTP' => 28,
'ISO-TP4' => 29,
'NETBLT' => 30,
'MFE-NSP' => 31,
'MERIT-INP' => 32,
'SEP' => 33,
// 34 - 60 - Unassigned
// 61 - any host internal protocol
'CFTP' => 62,
// 63 - any local network
'SAT-EXPAK' => 64,
'MIT-SUBNET' => 65,
'RVD' => 66,
'IPPC' => 67,
// 68 - any distributed file system
'SAT-MON' => 69,
// 70 - Unassigned
'IPCV' => 71,
// 72 - 75 - Unassigned
'BR-SAT-MON' => 76,
// 77 - Unassigned
'WB-MON' => 78,
'WB-EXPAK' => 79
// 80 - 254 - Unassigned
// 255 - Reserved
);
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+434
View File
@@ -0,0 +1,434 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
* This file contains code based off the Net::DNS Perl module by
* Michael Fuhr.
*
* This is the copyright notice from the PERL Net::DNS module:
*
* Copyright (c) 1997-2000 Michael Fuhr. All rights reserved. This
* program is free software; you can redistribute it and/or modify it
* under the same terms as Perl itself.
*
*/
/**
* This is the base class that holds a standard DNS packet.
*
* The Net_DNS2_Packet_Request and Net_DNS2_Packet_Response classes extend this
* class.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_Packet_Request, Net_DNS2_Packet_Response
*
*/
class Net_DNS2_Packet
{
/*
* the full binary data and length for this packet
*/
public $rdata;
public $rdlength;
/*
* the offset pointer used when building/parsing packets
*/
public $offset = 0;
/*
* Net_DNS2_Header object with the DNS packet header
*/
public $header;
/*
* array of Net_DNS2_Question objects
*
* used as "zone" for updates per RFC2136
*
*/
public $question = array();
/*
* array of Net_DNS2_RR Objects for Answers
*
* used as "prerequisite" for updates per RFC2136
*
*/
public $answer = array();
/*
* array of Net_DNS2_RR Objects for Authority
*
* used as "update" for updates per RFC2136
*
*/
public $authority = array();
/*
* array of Net_DNS2_RR Objects for Addtitional
*/
public $additional = array();
/*
* array of compressed labeles
*/
private $_compressed = array();
/**
* magic __toString() method to return the Net_DNS2_Packet as a string
*
* @return string
* @access public
*
*/
public function __toString()
{
$output = $this->header->__toString();
foreach ($this->question as $x) {
$output .= $x->__toString() . "\n";
}
foreach ($this->answer as $x) {
$output .= $x->__toString() . "\n";
}
foreach ($this->authority as $x) {
$output .= $x->__toString() . "\n";
}
foreach ($this->additional as $x) {
$output .= $x->__toString() . "\n";
}
return $output;
}
/**
* returns a full binary DNS packet
*
* @return string
* @throws Net_DNS2_Exception
* @access public
*
*/
public function get()
{
$data = $this->header->get($this);
foreach ($this->question as $x) {
$data .= $x->get($this);
}
foreach ($this->answer as $x) {
$data .= $x->get($this);
}
foreach ($this->authority as $x) {
$data .= $x->get($this);
}
foreach ($this->additional as $x) {
$data .= $x->get($this);
}
return $data;
}
/**
* applies a standard DNS name compression on the given name/offset
*
* This logic was based on the Net::DNS::Packet::dn_comp() function
* by Michanel Fuhr
*
* @param string $name the name to be compressed
* @param integer &$offset the offset into the given packet object
*
* @return string
* @access public
*
*/
public function compress($name, &$offset)
{
$names = explode('.', $name);
$compname = '';
while (!empty($names)) {
$dname = join('.', $names);
if (isset($this->_compressed[$dname])) {
$compname .= pack('n', 0xc000 | $this->_compressed[$dname]);
$offset += 2;
break;
}
$this->_compressed[$dname] = $offset;
$first = array_shift($names);
$length = strlen($first);
if ($length <= 0) {
continue;
}
//
// truncate see RFC1035 2.3.1
//
if ($length > 63) {
$length = 63;
$first = substr($first, 0, $length);
}
$compname .= pack('Ca*', $length, $first);
$offset += $length + 1;
}
if (empty($names)) {
$compname .= pack('C', 0);
$offset++;
}
return $compname;
}
/**
* applies a standard DNS name compression on the given name/offset
*
* This logic was based on the Net::DNS::Packet::dn_comp() function
* by Michanel Fuhr
*
* @param string $name the name to be compressed
*
* @return string
* @access public
*
*/
public static function pack($name)
{
$offset = 0;
$names = explode('.', $name);
$compname = '';
while (!empty($names)) {
$first = array_shift($names);
$length = strlen($first);
$compname .= pack('Ca*', $length, $first);
$offset += $length + 1;
}
$compname .= "\0";
$offset++;
return $compname;
}
/**
* expands the domain name stored at a given offset in a DNS Packet
*
* This logic was based on the Net::DNS::Packet::dn_expand() function
* by Michanel Fuhr
*
* @param Net_DNS2_Packet &$packet the DNS packet to look in for the domain name
* @param integer &$offset the offset into the given packet object
*
* @return mixed either the domain name or null if it's not found.
* @access public
*
*/
public static function expand(Net_DNS2_Packet &$packet, &$offset)
{
$name = '';
while (1) {
if ($packet->rdlength < ($offset + 1)) {
return null;
}
$xlen = ord($packet->rdata[$offset]);
if ($xlen == 0) {
++$offset;
break;
} else if (($xlen & 0xc0) == 0xc0) {
if ($packet->rdlength < ($offset + 2)) {
return null;
}
$ptr = ord($packet->rdata[$offset]) << 8 |
ord($packet->rdata[$offset+1]);
$ptr = $ptr & 0x3fff;
$name2 = Net_DNS2_Packet::expand($packet, $ptr);
if (is_null($name2)) {
return null;
}
$name .= $name2;
$offset += 2;
break;
} else {
++$offset;
if ($packet->rdlength < ($offset + $xlen)) {
return null;
}
$elem = '';
$elem = substr($packet->rdata, $offset, $xlen);
$name .= $elem . '.';
$offset += $xlen;
}
}
return trim($name, '.');
}
/**
* parses a domain label from a DNS Packet at the given offset
*
* @param Net_DNS2_Packet &$packet the DNS packet to look in for the domain name
* @param integer &$offset the offset into the given packet object
*
* @return mixed either the domain name or null if it's not found.
* @access public
*
*/
public static function label(Net_DNS2_Packet &$packet, &$offset)
{
$name = '';
if ($packet->rdlength < ($offset + 1)) {
return null;
}
$xlen = ord($packet->rdata[$offset]);
++$offset;
if (($xlen + $offset) > $packet->rdlength) {
$name = substr($packet->rdata, $offset);
$offset = $packet->rdlength;
} else {
$name = substr($packet->rdata, $offset, $xlen);
$offset += $xlen;
}
return $name;
}
/**
* copies the contents of the given packet, to the local packet object. this
* function intentionally ignores some of the packet data.
*
* @param Net_DNS2_Packet $packet the DNS packet to copy the data from
*
* @return boolean
* @access public
*
*/
public function copy(Net_DNS2_Packet $packet)
{
$this->header = $packet->header;
$this->question = $packet->question;
$this->answer = $packet->answer;
$this->authority = $packet->authority;
$this->additional = $packet->additional;
return true;
}
/**
* resets the values in the current packet object
*
* @return boolean
* @access public
*
*/
public function reset()
{
$this->header->id = $this->header->nextPacketId();
$this->rdata = '';
$this->rdlength = 0;
$this->offset = 0;
$this->answer = array();
$this->authority = array();
$this->additional = array();
$this->_compressed = array();
return true;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+217
View File
@@ -0,0 +1,217 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* This class handles building new DNS request packets; packets used for DNS
* queries and updates.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_Packet
*
*/
class Net_DNS2_Packet_Request extends Net_DNS2_Packet
{
/**
* Constructor - builds a new Net_DNS2_Packet_Request object
*
* @param string $name the domain name for the packet
* @param string $type the DNS RR type for the packet
* @param string $class the DNS class for the packet
*
* @throws Net_DNS2_Exception
* @access public
*
*/
public function __construct($name, $type = null, $class = null)
{
$this->set($name, $type, $class);
}
/**
* builds a new Net_DNS2_Packet_Request object
*
* @param string $name the domain name for the packet
* @param string $type the DNS RR type for the packet
* @param string $class the DNS class for the packet
*
* @return boolean
* @throws Net_DNS2_Exception
* @access public
*
*/
public function set($name, $type = 'A', $class = 'IN')
{
//
// generate a new header
//
$this->header = new Net_DNS2_Header;
//
// add a new question
//
$q = new Net_DNS2_Question();
//
// allow queries directly to . for the root name servers
//
if ($name != '.') {
$name = trim(strtolower($name), " \t\n\r\0\x0B.");
}
$type = strtoupper(trim($type));
$class = strtoupper(trim($class));
//
// check that the input string has some data in it
//
if (empty($name)) {
throw new Net_DNS2_Exception(
'empty query string provided',
Net_DNS2_Lookups::E_PACKET_INVALID
);
}
//
// if the type is "*", rename it to "ANY"- both are acceptable.
//
if ($type == '*') {
$type = 'ANY';
}
//
// check that the type and class are valid
//
if ( (!isset(Net_DNS2_Lookups::$rr_types_by_name[$type]))
|| (!isset(Net_DNS2_Lookups::$classes_by_name[$class]))
) {
throw new Net_DNS2_Exception(
'invalid type (' . $type . ') or class (' . $class . ') specified.',
Net_DNS2_Lookups::E_PACKET_INVALID
);
}
if ($type == 'PTR') {
//
// if it's a PTR request for an IP address, then make sure we tack on
// the arpa domain.
//
// there are other types of PTR requests, so if an IP adress doesn't match,
// then just let it flow through and assume it's a hostname
//
if (Net_DNS2::isIPv4($name) == true) {
//
// IPv4
//
$name = implode('.', array_reverse(explode('.', $name)));
$name .= '.in-addr.arpa';
} else if (Net_DNS2::isIPv6($name) == true) {
//
// IPv6
//
$e = Net_DNS2::expandIPv6($name);
if ($e !== false) {
$name = implode(
'.', array_reverse(str_split(str_replace(':', '', $e)))
);
$name .= '.ip6.arpa';
} else {
throw new Net_DNS2_Exception(
'unsupported PTR value: ' . $name,
Net_DNS2_Lookups::E_PACKET_INVALID
);
}
}
}
//
// store the data
//
$q->qname = $name;
$q->qtype = $type;
$q->qclass = $class;
$this->question[] = $q;
//
// the answer, authority and additional are empty; they can be modified
// after the request is created for UPDATE requests if needed.
//
$this->answer = array();
$this->authority = array();
$this->additional = array();
return true;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+194
View File
@@ -0,0 +1,194 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* This class handles building new DNS response packets; it parses binary packed
* packets that come off the wire
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_Packet
*
*/
class Net_DNS2_Packet_Response extends Net_DNS2_Packet
{
/*
* The name servers that this response came from
*/
public $answer_from;
/*
* The socket type the answer came from (TCP/UDP)
*/
public $answer_socket_type;
/*
* The query response time in microseconds
*/
public $response_time = 0;
/**
* Constructor - builds a new Net_DNS2_Packet_Response object
*
* @param string $data binary DNS packet
* @param integer $size the length of the DNS packet
*
* @throws Net_DNS2_Exception
* @access public
*
*/
public function __construct($data, $size)
{
$this->set($data, $size);
}
/**
* builds a new Net_DNS2_Packet_Response object
*
* @param string $data binary DNS packet
* @param integer $size the length of the DNS packet
*
* @return boolean
* @throws Net_DNS2_Exception
* @access public
*
*/
public function set($data, $size)
{
//
// store the full packet
//
$this->rdata = $data;
$this->rdlength = $size;
//
// parse the header
//
// we don't bother checking the size earlier, because the first thing the
// header class does, is check the size and throw and exception if it's
// invalid.
//
$this->header = new Net_DNS2_Header($this);
//
// if the truncation bit is set, then just return right here, because the
// rest of the packet is probably empty; and there's no point in processing
// anything else.
//
// we also don't need to worry about checking to see if the the header is
// null or not, since the Net_DNS2_Header() constructor will throw an
// exception if the packet is invalid.
//
if ($this->header->tc == 1) {
return false;
}
//
// parse the questions
//
for ($x = 0; $x < $this->header->qdcount; ++$x) {
$this->question[$x] = new Net_DNS2_Question($this);
}
//
// parse the answers
//
for ($x = 0; $x < $this->header->ancount; ++$x) {
$o = Net_DNS2_RR::parse($this);
if (!is_null($o)) {
$this->answer[] = $o;
}
}
//
// parse the authority section
//
for ($x = 0; $x < $this->header->nscount; ++$x) {
$o = Net_DNS2_RR::parse($this);
if (!is_null($o)) {
$this->authority[] = $o;
}
}
//
// parse the additional section
//
for ($x = 0; $x < $this->header->arcount; ++$x) {
$o = Net_DNS2_RR::parse($this);
if (!is_null($o)) {
$this->additional[] = $o;
}
}
return true;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+424
View File
@@ -0,0 +1,424 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2011 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.1.0
*
*/
/**
* SSL Private Key container class
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
*
*/
class Net_DNS2_PrivateKey
{
/*
* the filename that was loaded; stored for reference
*/
public $filename;
/*
* the keytag for the signature
*/
public $keytag;
/*
* the sign name for the signature
*/
public $signname;
/*
* the algorithm used for the signature
*/
public $algorithm;
/*
* the key format fo the signature
*/
public $key_format;
/*
* the openssl private key id
*/
public $instance;
/*
* RSA: modulus
*/
private $_modulus;
/*
* RSA: public exponent
*/
private $_public_exponent;
/*
* RSA: rivate exponent
*/
private $_private_exponent;
/*
* RSA: prime1
*/
private $_prime1;
/*
* RSA: prime2
*/
private $_prime2;
/*
* RSA: exponent 1
*/
private $_exponent1;
/*
* RSA: exponent 2
*/
private $_exponent2;
/*
* RSA: coefficient
*/
private $_coefficient;
/*
* DSA: prime
*/
public $prime;
/*
* DSA: subprime
*/
public $subprime;
/*
* DSA: base
*/
public $base;
/*
* DSA: private value
*/
public $private_value;
/*
* DSA: public value
*/
public $public_value;
/**
* Constructor - base constructor the private key container class
*
* @param string $file path to a private-key file to parse and load
*
* @throws Net_DNS2_Exception
* @access public
*
*/
public function __construct($file = null)
{
if (isset($file)) {
$this->parseFile($file);
}
}
/**
* parses a private key file generated by dnssec-keygen
*
* @param string $file path to a private-key file to parse and load
*
* @return boolean
* @throws Net_DNS2_Exception
* @access public
*
*/
public function parseFile($file)
{
//
// check for OpenSSL
//
if (extension_loaded('openssl') === false) {
throw new Net_DNS2_Exception(
'the OpenSSL extension is required to use parse private key.',
Net_DNS2_Lookups::E_OPENSSL_UNAVAIL
);
}
//
// check to make sure the file exists
//
if (is_readable($file) == false) {
throw new Net_DNS2_Exception(
'invalid private key file: ' . $file,
Net_DNS2_Lookups::E_OPENSSL_INV_PKEY
);
}
//
// get the base filename, and parse it for the local value
//
$keyname = basename($file);
if (strlen($keyname) == 0) {
throw new Net_DNS2_Exception(
'failed to get basename() for: ' . $file,
Net_DNS2_Lookups::E_OPENSSL_INV_PKEY
);
}
//
// parse the keyname
//
if (preg_match("/K(.*)\.\+(\d{3})\+(\d*)\.private/", $keyname, $matches)) {
$this->signname = $matches[1];
$this->algorithm = intval($matches[2]);
$this->keytag = intval($matches[3]);
} else {
throw new Net_DNS2_Exception(
'file ' . $keyname . ' does not look like a private key file!',
Net_DNS2_Lookups::E_OPENSSL_INV_PKEY
);
}
//
// read all the data from the
//
$data = file($file, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
if (count($data) == 0) {
throw new Net_DNS2_Exception(
'file ' . $keyname . ' is empty!',
Net_DNS2_Lookups::E_OPENSSL_INV_PKEY
);
}
foreach ($data as $line) {
list($key, $value) = explode(':', $line);
$key = trim($key);
$value = trim($value);
switch(strtolower($key)) {
case 'private-key-format':
$this->_key_format = $value;
break;
case 'algorithm':
if ($this->algorithm != $value) {
throw new Net_DNS2_Exception(
'Algorithm mis-match! filename is ' . $this->algorithm .
', contents say ' . $value,
Net_DNS2_Lookups::E_OPENSSL_INV_ALGO
);
}
break;
//
// RSA
//
case 'modulus':
$this->_modulus = $value;
break;
case 'publicexponent':
$this->_public_exponent = $value;
break;
case 'privateexponent':
$this->_private_exponent = $value;
break;
case 'prime1':
$this->_prime1 = $value;
break;
case 'prime2':
$this->_prime2 = $value;
break;
case 'exponent1':
$this->_exponent1 = $value;
break;
case 'exponent2':
$this->_exponent2 = $value;
break;
case 'coefficient':
$this->_coefficient = $value;
break;
//
// DSA - this won't work in PHP until the OpenSSL extension is better
//
case 'prime(p)':
$this->prime = $value;
break;
case 'subprime(q)':
$this->subprime = $value;
break;
case 'base(g)':
$this->base = $value;
break;
case 'private_value(x)':
$this->private_value = $value;
break;
case 'public_value(y)':
$this->public_value = $value;
break;
default:
throw new Net_DNS2_Exception(
'unknown private key data: ' . $key . ': ' . $value,
Net_DNS2_Lookups::E_OPENSSL_INV_PKEY
);
}
}
//
// generate the private key
//
$args = array();
switch($this->algorithm) {
//
// RSA
//
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSAMD5:
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSASHA1:
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSASHA256:
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSASHA512:
$args = array(
'rsa' => array(
'n' => base64_decode($this->_modulus),
'e' => base64_decode($this->_public_exponent),
'd' => base64_decode($this->_private_exponent),
'p' => base64_decode($this->_prime1),
'q' => base64_decode($this->_prime2),
'dmp1' => base64_decode($this->_exponent1),
'dmq1' => base64_decode($this->_exponent2),
'iqmp' => base64_decode($this->_coefficient)
)
);
break;
//
// DSA - this won't work in PHP until the OpenSSL extension is better
//
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_DSA:
$args = array(
'dsa' => array(
'p' => base64_decode($this->prime),
'q' => base64_decode($this->subprime),
'g' => base64_decode($this->base),
'priv_key' => base64_decode($this->private_value),
'pub_key' => base64_decode($this->public_value)
)
);
break;
default:
throw new Net_DNS2_Exception(
'we only currently support RSAMD5 and RSASHA1 encryption.',
Net_DNS2_Lookups::E_OPENSSL_INV_PKEY
);
}
//
// generate and store the key
//
$this->instance = openssl_pkey_new($args);
if ($this->instance === false) {
throw new Net_DNS2_Exception(
openssl_error_string(),
Net_DNS2_Lookups::E_OPENSSL_ERROR
);
}
//
// store the filename incase we need it for something
//
$this->filename = $file;
return true;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+244
View File
@@ -0,0 +1,244 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* This class handles parsing and constructing the question sectino of DNS
* packets.
*
* This is referred to as the "zone" for update per RFC2136
*
* DNS question format - RFC1035 section 4.1.2
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | |
* / QNAME /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | QTYPE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | QCLASS |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_Packet
*
*/
class Net_DNS2_Question
{
/*
* The name of the question
*
* referred to as "zname" for updates per RFC2136
*
*/
public $qname;
/*
* The RR type for the questino
*
* referred to as "ztype" for updates per RFC2136
*
*/
public $qtype;
/*
* The RR class for the questino
*
* referred to as "zclass" for updates per RFC2136
*
*/
public $qclass;
/**
* Constructor - builds a new Net_DNS2_Question object
*
* @param mixed &$packet either a Net_DNS2_Packet object, or null to
* build an empty object
*
* @throws Net_DNS2_Exception
* @access public
*
*/
public function __construct(Net_DNS2_Packet &$packet = null)
{
if (!is_null($packet)) {
$this->set($packet);
} else {
$this->qname = '';
$this->qtype = 'A';
$this->qclass = 'IN';
}
}
/**
* magic __toString() function to return the Net_DNS2_Question object as a string
*
* @return string
* @access public
*
*/
public function __toString()
{
return ";;\n;; Question:\n;;\t " . $this->qname . '. ' .
$this->qtype . ' ' . $this->qclass . "\n";
}
/**
* builds a new Net_DNS2_Header object from a Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet object
*
* @return boolean
* @throws Net_DNS2_Exception
* @access public
*
*/
public function set(Net_DNS2_Packet &$packet)
{
//
// expand the name
//
$this->qname = $packet->expand($packet, $packet->offset);
if ($packet->rdlength < ($packet->offset + 4)) {
throw new Net_DNS2_Exception(
'invalid question section: to small',
Net_DNS2_Lookups::E_QUESTION_INVALID
);
}
//
// unpack the type and class
//
$type = ord($packet->rdata[$packet->offset++]) << 8 |
ord($packet->rdata[$packet->offset++]);
$class = ord($packet->rdata[$packet->offset++]) << 8 |
ord($packet->rdata[$packet->offset++]);
//
// validate it
//
$type_name = Net_DNS2_Lookups::$rr_types_by_id[$type];
$class_name = Net_DNS2_Lookups::$classes_by_id[$class];
if ( (!isset($type_name)) || (!isset($class_name)) ) {
throw new Net_DNS2_Exception(
'invalid question section: invalid type (' . $type .
') or class (' . $class . ') specified.',
Net_DNS2_Lookups::E_QUESTION_INVALID
);
}
//
// store it
//
$this->qtype = $type_name;
$this->qclass = $class_name;
return true;
}
/**
* returns a binary packed Net_DNS2_Question object
*
* @param Net_DNS2_Packet &$packet the Net_DNS2_Packet object this question is
* part of. This needs to be passed in so that
* the compressed qname value can be packed in
* with the names of the other parts of the
* packet.
*
* @return string
* @throws Net_DNS2_Exception
* @access public
*
*/
public function get(Net_DNS2_Packet &$packet)
{
//
// validate the type and class
//
$type = Net_DNS2_Lookups::$rr_types_by_name[$this->qtype];
$class = Net_DNS2_Lookups::$classes_by_name[$this->qclass];
if ( (!isset($type)) || (!isset($class)) ) {
throw new Net_DNS2_Exception(
'invalid question section: invalid type (' . $this->qtype .
') or class (' . $this->qclass . ') specified.',
Net_DNS2_Lookups::E_QUESTION_INVALID
);
}
$data = $packet->compress($this->qname, $packet->offset);
$data .= chr($type >> 8) . chr($type) . chr($class >> 8) . chr($class);
$packet->offset += 4;
return $data;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+644
View File
@@ -0,0 +1,644 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* This is the base class for DNS Resource Records
*
* Each resource record type (defined in RR/*.php) extends this class for
* base functionality.
*
* This class handles parsing and constructing the common parts of the DNS
* resource records, while the RR specific functionality is handled in each
* child class.
*
* DNS resource record format - RFC1035 section 4.1.3
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | |
* / /
* / NAME /
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | TYPE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | CLASS |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | TTL |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | RDLENGTH |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
* / RDATA /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
*
*/
abstract class Net_DNS2_RR
{
/*
* The name of the resource record
*/
public $name;
/*
* The resource record type
*/
public $type;
/*
* The resouce record class
*/
public $class;
/*
* The time to live for this resource record
*/
public $ttl;
/*
* The length of the rdata field
*/
public $rdlength;
/*
* The resource record specific data as a packed binary string
*/
public $rdata;
/**
* abstract definition - method to return a RR as a string; not to
* be confused with the __toString() magic method.
*
* @return string
* @access protected
*
*/
abstract protected function rrToString();
/**
* abstract definition - parses a RR from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
abstract protected function rrFromString(array $rdata);
/**
* abstract definition - sets a Net_DNS2_RR from a Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
abstract protected function rrSet(Net_DNS2_Packet &$packet);
/**
* abstract definition - returns a binary packet DNS RR object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed string or
* null on failure
* @access protected
*
*/
abstract protected function rrGet(Net_DNS2_Packet &$packet);
/**
* Constructor - builds a new Net_DNS2_RR object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet or null to create
* an empty object
* @param array $rr an array with RR parse values or null to
* create an empty object
*
* @throws Net_DNS2_Exception
* @access public
*
*/
public function __construct(Net_DNS2_Packet &$packet = null, array $rr = null)
{
if ( (!is_null($packet)) && (!is_null($rr)) ) {
if ($this->set($packet, $rr) == false) {
throw new Net_DNS2_Exception(
'failed to generate resource record',
Net_DNS2_Lookups::E_RR_INVALID
);
}
} else {
$class = Net_DNS2_Lookups::$rr_types_class_to_id[get_class($this)];
if (isset($class)) {
$this->type = Net_DNS2_Lookups::$rr_types_by_id[$class];
}
$this->class = 'IN';
$this->ttl = 86400;
}
}
/**
* magic __toString() method to return the Net_DNS2_RR object object as a string
*
* @return string
* @access public
*
*/
public function __toString()
{
return $this->name . '. ' . $this->ttl . ' ' . $this->class .
' ' . $this->type . ' ' . $this->rrToString();
}
/**
* return a formatted string; if a string has spaces in it, then return
* it with double quotes around it, otherwise, return it as it was passed in.
*
* @param string $string the string to format
*
* @return string
* @access protected
*
*/
protected function formatString($string)
{
return '"' . str_replace('"', '\"', trim($string, '"')) . '"';
}
/**
* builds an array of strings from an array of chunks of text split by spaces
*
* @param array $chunks an array of chunks of text split by spaces
*
* @return array
* @access protected
*
*/
protected function buildString(array $chunks)
{
$data = array();
$c = 0;
$in = false;
foreach ($chunks as $r) {
$r = trim($r);
if (strlen($r) == 0) {
continue;
}
if ( ($r[0] == '"')
&& ($r[strlen($r) - 1] == '"')
&& ($r[strlen($r) - 2] != '\\')
) {
$data[$c] = $r;
++$c;
$in = false;
} else if ($r[0] == '"') {
$data[$c] = $r;
$in = true;
} else if ( ($r[strlen($r) - 1] == '"')
&& ($r[strlen($r) - 2] != '\\')
) {
$data[$c] .= ' ' . $r;
++$c;
$in = false;
} else {
if ($in == true) {
$data[$c] .= ' ' . $r;
} else {
$data[$c++] = $r;
}
}
}
foreach ($data as $index => $string) {
$data[$index] = str_replace('\"', '"', trim($string, '"'));
}
return $data;
}
/**
* builds a new Net_DNS2_RR object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet or null to create
* an empty object
* @param array $rr an array with RR parse values or null to
* create an empty object
*
* @return boolean
* @throws Net_DNS2_Exception
* @access public
*
*/
public function set(Net_DNS2_Packet &$packet, array $rr)
{
$this->name = $rr['name'];
$this->type = Net_DNS2_Lookups::$rr_types_by_id[$rr['type']];
//
// for RR OPT (41), the class value includes the requestors UDP payload size,
// and not a class value
//
if ($this->type == 'OPT') {
$this->class = $rr['class'];
} else {
$this->class = Net_DNS2_Lookups::$classes_by_id[$rr['class']];
}
$this->ttl = $rr['ttl'];
$this->rdlength = $rr['rdlength'];
$this->rdata = substr($packet->rdata, $packet->offset, $rr['rdlength']);
return $this->rrSet($packet);
}
/**
* returns a binary packed DNS RR object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet used for
* compressing names
*
* @return string
* @throws Net_DNS2_Exception
* @access public
*
*/
public function get(Net_DNS2_Packet &$packet)
{
$data = '';
$rdata = '';
//
// pack the name
//
$data = $packet->compress($this->name, $packet->offset);
//
// pack the main values
//
if ($this->type == 'OPT') {
//
// pre-build the TTL value
//
$this->preBuild();
//
// the class value is different for OPT types
//
$data .= pack(
'nnN',
Net_DNS2_Lookups::$rr_types_by_name[$this->type],
$this->class,
$this->ttl
);
} else {
$data .= pack(
'nnN',
Net_DNS2_Lookups::$rr_types_by_name[$this->type],
Net_DNS2_Lookups::$classes_by_name[$this->class],
$this->ttl
);
}
//
// increase the offset, and allow for the rdlength
//
$packet->offset += 10;
//
// get the RR specific details
//
if ($this->rdlength != -1) {
$rdata = $this->rrGet($packet);
}
//
// add the RR
//
$data .= pack('n', strlen($rdata)) . $rdata;
return $data;
}
/**
* parses a binary packet, and returns the appropriate Net_DNS2_RR object,
* based on the RR type of the binary content.
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet used for
* decompressing names
*
* @return mixed returns a new Net_DNS2_RR_* object for
* the given RR
* @throws Net_DNS2_Exception
* @access public
*
*/
public static function parse(Net_DNS2_Packet &$packet)
{
$object = array();
//
// expand the name
//
$object['name'] = $packet->expand($packet, $packet->offset);
if (is_null($object['name'])) {
throw new Net_DNS2_Exception(
'failed to parse resource record: failed to expand name.',
Net_DNS2_Lookups::E_PARSE_ERROR
);
}
if ($packet->rdlength < ($packet->offset + 10)) {
throw new Net_DNS2_Exception(
'failed to parse resource record: packet too small.',
Net_DNS2_Lookups::E_PARSE_ERROR
);
}
//
// unpack the RR details
//
$object['type'] = ord($packet->rdata[$packet->offset++]) << 8 |
ord($packet->rdata[$packet->offset++]);
$object['class'] = ord($packet->rdata[$packet->offset++]) << 8 |
ord($packet->rdata[$packet->offset++]);
$object['ttl'] = ord($packet->rdata[$packet->offset++]) << 24 |
ord($packet->rdata[$packet->offset++]) << 16 |
ord($packet->rdata[$packet->offset++]) << 8 |
ord($packet->rdata[$packet->offset++]);
$object['rdlength'] = ord($packet->rdata[$packet->offset++]) << 8 |
ord($packet->rdata[$packet->offset++]);
if ($packet->rdlength < ($packet->offset + $object['rdlength'])) {
return null;
}
//
// lookup the class to use
//
$o = null;
$class = Net_DNS2_Lookups::$rr_types_id_to_class[$object['type']];
if (isset($class)) {
$o = new $class($packet, $object);
if ($o) {
$packet->offset += $object['rdlength'];
}
} else {
throw new Net_DNS2_Exception(
'un-implemented resource record type: ' . $object['type'],
Net_DNS2_Lookups::E_RR_INVALID
);
}
return $o;
}
/**
* cleans up some RR data
*
* @param string $data the text string to clean
*
* @return string returns the cleaned string
*
* @access public
*
*/
public function cleanString($data)
{
return strtolower(rtrim($data, '.'));
}
/**
* parses a standard RR format lines, as defined by rfc1035 (kinda)
*
* In our implementation, the domain *must* be specified- format must be
*
* <name> [<ttl>] [<class>] <type> <rdata>
* or
* <name> [<class>] [<ttl>] <type> <rdata>
*
* name, title, class and type are parsed by this function, rdata is passed
* to the RR specific classes for parsing.
*
* @param string $line a standard DNS config line
*
* @return mixed returns a new Net_DNS2_RR_* object for the given RR
* @throws Net_DNS2_Exception
* @access public
*
*/
public static function fromString($line)
{
if (strlen($line) == 0) {
throw new Net_DNS2_Exception(
'empty config line provided.',
Net_DNS2_Lookups::E_PARSE_ERROR
);
}
$name = '';
$type = '';
$class = 'IN';
$ttl = 86400;
//
// split the line by spaces
//
$values = preg_split('/[\s]+/', $line);
if (count($values) < 3) {
throw new Net_DNS2_Exception(
'failed to parse config: minimum of name, type and rdata required.',
Net_DNS2_Lookups::E_PARSE_ERROR
);
}
//
// assume the first value is the name
//
$name = trim(strtolower(array_shift($values)), '.');
//
// The next value is either a TTL, Class or Type
//
foreach ($values as $value) {
switch(true) {
case is_numeric($value):
$ttl = array_shift($values);
break;
//
// this is here because of a bug in is_numeric() in certain versions of
// PHP on windows.
//
case ($value === 0):
$ttl = array_shift($values);
break;
case isset(Net_DNS2_Lookups::$classes_by_name[strtoupper($value)]):
$class = strtoupper(array_shift($values));
break;
case isset(Net_DNS2_Lookups::$rr_types_by_name[strtoupper($value)]):
$type = strtoupper(array_shift($values));
break 2;
break;
default:
throw new Net_DNS2_Exception(
'invalid config line provided: unknown file: ' . $value,
Net_DNS2_Lookups::E_PARSE_ERROR
);
}
}
//
// lookup the class to use
//
$o = null;
$class_name = Net_DNS2_Lookups::$rr_types_id_to_class[
Net_DNS2_Lookups::$rr_types_by_name[$type]
];
if (isset($class_name)) {
$o = new $class_name;
if (!is_null($o)) {
//
// set the parsed values
//
$o->name = $name;
$o->class = $class;
$o->ttl = $ttl;
//
// parse the rdata
//
if ($o->rrFromString($values) === false) {
throw new Net_DNS2_Exception(
'failed to parse rdata for config: ' . $line,
Net_DNS2_Lookups::E_PARSE_ERROR
);
}
} else {
throw new Net_DNS2_Exception(
'failed to create new RR record for type: ' . $type,
Net_DNS2_Lookups::E_RR_INVALID
);
}
} else {
throw new Net_DNS2_Exception(
'un-implemented resource record type: '. $type,
Net_DNS2_Lookups::E_RR_INVALID
);
}
return $o;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+156
View File
@@ -0,0 +1,156 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* A Resource Record - RFC1035 section 3.4.1
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ADDRESS |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_A extends Net_DNS2_RR
{
/*
* The IPv4 address in quad-dotted notation
*/
public $address;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->address;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$value = array_shift($rdata);
if (Net_DNS2::isIPv4($value) == true) {
$this->address = $value;
return true;
}
return false;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$this->address = inet_ntop($this->rdata);
if ($this->address !== false) {
return true;
}
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
$packet->offset += 4;
return inet_pton($this->address);
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+177
View File
@@ -0,0 +1,177 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* A Resource Record - RFC1035 section 3.4.1
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | |
* | |
* | |
* | ADDRESS |
* | |
* | (128 bit) |
* | |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_AAAA extends Net_DNS2_RR
{
/*
* the IPv6 address in the preferred hexadecimal values of the eight
* 16-bit pieces
* per RFC1884
*
*/
public $address;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->address;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
//
// expand out compressed formats
//
$value = array_shift($rdata);
if (Net_DNS2::isIPv6($value) == true) {
$this->address = $value;
return true;
}
return false;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
//
// must be 8 x 16bit chunks, or 16 x 8bit
//
if ($this->rdlength == 16) {
//
// PHP's inet_ntop returns IPv6 addresses in their compressed form,
// but we want to keep with the preferred standard, so we'll parse
// it manually.
//
$x = unpack('n8', $this->rdata);
if (count($x) == 8) {
$this->address = vsprintf('%x:%x:%x:%x:%x:%x:%x:%x', $x);
return true;
}
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
$packet->offset += 16;
return inet_pton($this->address);
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+174
View File
@@ -0,0 +1,174 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* AFSDB Resource Record - RFC1183 section 1
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | SUBTYPE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / HOSTNAME /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_AFSDB extends Net_DNS2_RR
{
/*
* The AFSDB sub type
*/
public $subtype;
/*
* The AFSDB hostname
*/
public $hostname;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->subtype . ' ' . $this->cleanString($this->hostname) . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->subtype = array_shift($rdata);
$this->hostname = $this->cleanString(array_shift($rdata));
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the subtype
//
$x = unpack('nsubtype', $this->rdata);
$this->subtype = $x['subtype'];
$offset = $packet->offset + 2;
$this->hostname = Net_DNS2_Packet::expand($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->hostname) > 0) {
$data = pack('n', $this->subtype);
$packet->offset += 2;
$data .= $packet->compress($this->hostname, $packet->offset);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+129
View File
@@ -0,0 +1,129 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* This is only used for generating an empty ANY RR.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_ANY extends Net_DNS2_RR
{
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return '';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
return true;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
return '';
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+343
View File
@@ -0,0 +1,343 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.0.0
*
*/
/**
* APL Resource Record - RFC3123
*
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
* | ADDRESSFAMILY |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
* | PREFIX | N | AFDLENGTH |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
* / AFDPART /
* | |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_APL extends Net_DNS2_RR
{
/*
* a list of all the address prefix list items
*/
public $apl_items = array();
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
$out = '';
foreach ($this->apl_items as $item) {
if ($item['n'] == 1) {
$out .= '!';
}
$out .= $item['address_family'] . ':' .
$item['afd_part'] . '/' . $item['prefix'] . ' ';
}
return trim($out);
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
foreach ($rdata as $item) {
if (preg_match('/^(!?)([1|2])\:([^\/]*)\/([0-9]{1,3})$/', $item, $m)) {
$i = array(
'address_family' => $m[2],
'prefix' => $m[4],
'n' => ($m[1] == '!') ? 1 : 0,
'afd_part' => strtolower($m[3])
);
$address = $this->_trimZeros(
$i['address_family'], $i['afd_part']
);
$i['afd_length'] = count(explode('.', $address));
$this->apl_items[] = $i;
}
}
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$offset = 0;
while ($offset < $this->rdlength) {
//
// unpack the family, prefix, negate and length values
//
$x = unpack(
'naddress_family/Cprefix/Cextra', substr($this->rdata, $offset)
);
$item = array(
'address_family' => $x['address_family'],
'prefix' => $x['prefix'],
'n' => ($x['extra'] >> 7) & 0x1,
'afd_length' => $x['extra'] & 0xf
);
switch($item['address_family']) {
case 1:
$r = unpack(
'C*', substr($this->rdata, $offset + 4, $item['afd_length'])
);
if (count($r) < 4) {
for ($c=count($r)+1; $c<4+1; $c++) {
$r[$c] = 0;
}
}
$item['afd_part'] = implode('.', $r);
break;
case 2:
$r = unpack(
'C*', substr($this->rdata, $offset + 4, $item['afd_length'])
);
if (count($r) < 8) {
for ($c=count($r)+1; $c<8+1; $c++) {
$r[$c] = 0;
}
}
$item['afd_part'] = sprintf(
'%x:%x:%x:%x:%x:%x:%x:%x',
$r[1], $r[2], $r[3], $r[4], $r[5], $r[6], $r[7], $r[8]
);
break;
default:
return false;
}
$this->apl_items[] = $item;
$offset += 4 + $item['afd_length'];
}
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (count($this->apl_items) > 0) {
$data = '';
foreach ($this->apl_items as $item) {
//
// pack the address_family and prefix values
//
$data .= pack(
'nCC',
$item['address_family'],
$item['prefix'],
($item['n'] << 7) | $item['afd_length']
);
switch($item['address_family']) {
case 1:
$address = explode(
'.',
$this->_trimZeros($item['address_family'], $item['afd_part'])
);
foreach ($address as $b) {
$data .= chr($b);
}
break;
case 2:
$address = explode(
':',
$this->_trimZeros($item['address_family'], $item['afd_part'])
);
foreach ($address as $b) {
$data .= pack('H', $b);
}
break;
default:
return null;
}
}
$packet->offset += strlen($data);
return $data;
}
return null;
}
/**
* returns an IP address with the right-hand zero's trimmed
*
* @param integer $family the IP address family from the rdata
* @param string $address the IP address
*
* @return string the trimmed IP addresss.
*
* @access private
*
*/
private function _trimZeros($family, $address)
{
$a = array();
switch($family) {
case 1:
$a = array_reverse(explode('.', $address));
break;
case 2:
$a = array_reverse(explode(':', $address));
break;
default:
return '';
}
foreach ($a as $value) {
if ($value === '0') {
array_shift($a);
}
}
$out = '';
switch($family) {
case 1:
$out = implode('.', array_reverse($a));
break;
case 2:
$out = implode(':', array_reverse($a));
break;
default:
return '';
}
return $out;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+210
View File
@@ -0,0 +1,210 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.1.0
*
*/
/**
* ATMA Resource Record
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | FORMAT | |
* | +--+--+--+--+--+--+--+--+
* / ADDRESS /
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_ATMA extends Net_DNS2_RR
{
/*
* One octet that indicates the format of ADDRESS. The two possible values
* for FORMAT are value 0 indicating ATM End System Address (AESA) format
* and value 1 indicating E.164 format
*/
public $format;
/*
* The IPv4 address in quad-dotted notation
*/
public $address;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->address;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$value = array_shift($rdata);
if (ctype_xdigit($value) == true) {
$this->format = 0;
$this->address = $value;
} else if (is_numeric($value) == true) {
$this->format = 1;
$this->address = $value;
} else {
return false;
}
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the format
//
$x = unpack('Cformat/N*address', $this->rdata);
$this->format = $x['format'];
if ($this->format == 0) {
$a = unpack('@1/H*address', $this->rdata);
$this->address = $a['address'];
} else if ($this->format == 1) {
$this->address = substr($this->rdata, 1, $this->rdlength - 1);
} else {
return false;
}
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
$data = chr($this->format);
if ($this->format == 0) {
$data .= pack('H*', $this->address);
} else if ($this->format == 1) {
$data .= $this->address;
} else {
return null;
}
$packet->offset += strlen($data);
return $data;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+75
View File
@@ -0,0 +1,75 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2016, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2016 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.4.2
*
*/
/**
* The AVC RR is implemented exactly like the TXT record, so
* for now we just extend the TXT RR and use it.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_AVC extends Net_DNS2_RR_TXT
{
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+179
View File
@@ -0,0 +1,179 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2011, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2011 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.2.0
*
*/
/**
* CAA Resource Record - http://tools.ietf.org/html/draft-ietf-pkix-caa-03
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | FLAGS | TAG LENGTH |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / TAG /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / DATA /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_CAA extends Net_DNS2_RR
{
/*
* The critcal flag
*/
public $flags;
/*
* The property identifier
*/
public $tag;
/*
* The property value
*/
public $value;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->flags . ' ' . $this->tag . ' "' .
trim($this->cleanString($this->value), '"') . '"';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->flags = array_shift($rdata);
$this->tag = array_shift($rdata);
$this->value = trim($this->cleanString(implode($rdata, ' ')), '"');
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the flags and tag length
//
$x = unpack('Cflags/Ctag_length', $this->rdata);
$this->flags = $x['flags'];
$offset = 2;
$this->tag = substr($this->rdata, $offset, $x['tag_length']);
$offset += $x['tag_length'];
$this->value = substr($this->rdata, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->value) > 0) {
$data = chr($this->flags);
$data .= chr(strlen($this->tag)) . $this->tag . $this->value;
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
?>
+77
View File
@@ -0,0 +1,77 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2014, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2014 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.4.0
*
*/
/**
* The CDNSKEY RR is implemented exactly like the DNSKEY record, so
* for now we just extend the DNSKEY RR and use it.
*
* http://www.rfc-editor.org/rfc/rfc7344.txt
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_CDNSKEY extends Net_DNS2_RR_DNSKEY
{
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+77
View File
@@ -0,0 +1,77 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2011, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2011 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.2.0
*
*/
/**
* The CDS RR is implemented exactly like the DS record, so
* for now we just extend the DS RR and use it.
*
* http://www.rfc-editor.org/rfc/rfc7344.txt
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_CDS extends Net_DNS2_RR_DS
{
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+292
View File
@@ -0,0 +1,292 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* CERT Resource Record - RFC4398 section 2
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | format | key tag |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | algorithm | /
* +---------------+ certificate or CRL /
* / /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_CERT extends Net_DNS2_RR
{
/*
* format's allowed for certificates
*/
const CERT_FORMAT_RES = 0;
const CERT_FORMAT_PKIX = 1;
const CERT_FORMAT_SPKI = 2;
const CERT_FORMAT_PGP = 3;
const CERT_FORMAT_IPKIX = 4;
const CERT_FORMAT_ISPKI = 5;
const CERT_FORMAT_IPGP = 6;
const CERT_FORMAT_ACPKIX = 7;
const CERT_FORMAT_IACPKIX = 8;
const CERT_FORMAT_URI = 253;
const CERT_FORMAT_OID = 254;
public $cert_format_name_to_id = array();
public $cert_format_id_to_name = array(
self::CERT_FORMAT_RES => 'Reserved',
self::CERT_FORMAT_PKIX => 'PKIX',
self::CERT_FORMAT_SPKI => 'SPKI',
self::CERT_FORMAT_PGP => 'PGP',
self::CERT_FORMAT_IPKIX => 'IPKIX',
self::CERT_FORMAT_ISPKI => 'ISPKI',
self::CERT_FORMAT_IPGP => 'IPGP',
self::CERT_FORMAT_ACPKIX => 'ACPKIX',
self::CERT_FORMAT_IACPKIX => 'IACPKIX',
self::CERT_FORMAT_URI => 'URI',
self::CERT_FORMAT_OID => 'OID'
);
/*
* certificate format
*/
public $format;
/*
* key tag
*/
public $keytag;
/*
* The algorithm used for the CERt
*/
public $algorithm;
/*
* certificate
*/
public $certificate;
/**
* we have our own constructor so that we can load our certificate
* information for parsing.
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
* @param array $rr a array with parsed RR values
*
* @return
*
*/
public function __construct(Net_DNS2_Packet &$packet = null, array $rr = null)
{
parent::__construct($packet, $rr);
//
// load the lookup values
//
$this->cert_format_name_to_id = array_flip($this->cert_format_id_to_name);
}
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->format . ' ' . $this->keytag . ' ' . $this->algorithm .
' ' . base64_encode($this->certificate);
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
//
// load and check the format; can be an int, or a mnemonic symbol
//
$this->format = array_shift($rdata);
if (!is_numeric($this->format)) {
$mnemonic = strtoupper(trim($this->format));
if (!isset($this->cert_format_name_to_id[$mnemonic])) {
return false;
}
$this->format = $this->cert_format_name_to_id[$mnemonic];
} else {
if (!isset($this->cert_format_id_to_name[$this->format])) {
return false;
}
}
$this->keytag = array_shift($rdata);
//
// parse and check the algorithm; can be an int, or a mnemonic symbol
//
$this->algorithm = array_shift($rdata);
if (!is_numeric($this->algorithm)) {
$mnemonic = strtoupper(trim($this->algorithm));
if (!isset(Net_DNS2_Lookups::$algorithm_name_to_id[$mnemonic])) {
return false;
}
$this->algorithm = Net_DNS2_Lookups::$algorithm_name_to_id[
$mnemonic
];
} else {
if (!isset(Net_DNS2_Lookups::$algorithm_id_to_name[$this->algorithm])) {
return false;
}
}
//
// parse and base64 decode the certificate
//
// certificates MUST be provided base64 encoded, if not, everything will
// be broken after this point, as we assume it's base64 encoded.
//
$this->certificate = base64_decode(implode(' ', $rdata));
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the format, keytag and algorithm
//
$x = unpack('nformat/nkeytag/Calgorithm', $this->rdata);
$this->format = $x['format'];
$this->keytag = $x['keytag'];
$this->algorithm = $x['algorithm'];
//
// copy the certificate
//
$this->certificate = substr($this->rdata, 5, $this->rdlength - 5);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->certificate) > 0) {
$data = pack('nnC', $this->format, $this->keytag, $this->algorithm) .
$this->certificate;
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+153
View File
@@ -0,0 +1,153 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* CNAME Resource Record - RFC1035 section 3.3.1
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / CNAME /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_CNAME extends Net_DNS2_RR
{
/*
* The canonical name
*/
public $cname;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->cleanString($this->cname) . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->cname = $this->cleanString(array_shift($rdata));
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$offset = $packet->offset;
$this->cname = Net_DNS2_Packet::expand($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->cname) > 0) {
return $packet->compress($this->cname, $packet->offset);
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+203
View File
@@ -0,0 +1,203 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2015, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2015 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.4.1
*
*/
/**
* CSYNC Resource Record - RFC 7477 seciond 2.1.1
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | SOA Serial |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | Flags |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / Type Bit Map /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_CSYNC extends Net_DNS2_RR
{
/*
* serial number
*/
public $serial;
/*
* flags
*/
public $flags;
/*
* array of RR type names
*/
public $type_bit_maps = array();
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
$out = $this->serial . ' ' . $this->flags;
//
// show the RR's
//
foreach ($this->type_bit_maps as $rr) {
$out .= ' ' . strtoupper($rr);
}
return $out;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->serial = array_shift($rdata);
$this->flags = array_shift($rdata);
$this->type_bit_maps = $rdata;
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the serial and flags values
//
$x = unpack('@' . $packet->offset . '/Nserial/nflags', $packet->rdata);
$this->serial = Net_DNS2::expandUint32($x['serial']);
$this->flags = $x['flags'];
//
// parse out the RR bitmap
//
$this->type_bit_maps = Net_DNS2_BitMap::bitMapToArray(
substr($this->rdata, 6)
);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
//
// pack the serial and flags values
//
$data = pack('Nn', $this->serial, $this->flags);
//
// convert the array of RR names to a type bitmap
//
$data .= Net_DNS2_BitMap::arrayToBitMap($this->type_bit_maps);
//
// advance the offset
//
$packet->offset += strlen($data);
return $data;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+207
View File
@@ -0,0 +1,207 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* DHCID Resource Record - RFC4701 section 3.1
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ID Type Code |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | Digest Type | /
* +--+--+--+--+--+--+--+--+ /
* / /
* / Digest /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_DHCID extends Net_DNS2_RR
{
/*
* Identifier type
*/
public $id_type;
/*
* Digest Type
*/
public $digest_type;
/*
* The digest
*/
public $digest;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
$out = pack('nC', $this->id_type, $this->digest_type);
$out .= base64_decode($this->digest);
return base64_encode($out);
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$data = base64_decode(array_shift($rdata));
if (strlen($data) > 0) {
//
// unpack the id type and digest type
//
$x = unpack('nid_type/Cdigest_type', $data);
$this->id_type = $x['id_type'];
$this->digest_type = $x['digest_type'];
//
// copy out the digest
//
$this->digest = base64_encode(substr($data, 3, strlen($data) - 3));
return true;
}
return false;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the id type and digest type
//
$x = unpack('nid_type/Cdigest_type', $this->rdata);
$this->id_type = $x['id_type'];
$this->digest_type = $x['digest_type'];
//
// copy out the digest
//
$this->digest = base64_encode(
substr($this->rdata, 3, $this->rdlength - 3)
);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->digest) > 0) {
$data = pack('nC', $this->id_type, $this->digest_type) .
base64_decode($this->digest);
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+75
View File
@@ -0,0 +1,75 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* The DLV RR is implemented exactly like the DS RR; so we just extend that
* class, and use all of it's methods
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_DLV extends Net_DNS2_RR_DS
{
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+153
View File
@@ -0,0 +1,153 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* DNAME Resource Record - RFC2672 section 3
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / DNAME /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_DNAME extends Net_DNS2_RR
{
/*
* The target name
*/
public $dname;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->cleanString($this->dname) . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->dname = $this->cleanString(array_shift($rdata));
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$offset = $packet->offset;
$this->dname = Net_DNS2_Packet::expand($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->dname) > 0) {
return $packet->compress($this->dname, $packet->offset);
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+198
View File
@@ -0,0 +1,198 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* DNSKEY Resource Record - RFC4034 sction 2.1
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Flags | Protocol | Algorithm |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* / /
* / Public Key /
* / /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_DNSKEY extends Net_DNS2_RR
{
/*
* flags
*/
public $flags;
/*
* protocol
*/
public $protocol;
/*
* algorithm used
*/
public $algorithm;
/*
* the public key
*/
public $key;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->flags . ' ' . $this->protocol . ' ' .
$this->algorithm . ' ' . $this->key;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->flags = array_shift($rdata);
$this->protocol = array_shift($rdata);
$this->algorithm = array_shift($rdata);
$this->key = implode(' ', $rdata);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the flags, protocol and algorithm
//
$x = unpack('nflags/Cprotocol/Calgorithm', $this->rdata);
//
// TODO: right now we're just displaying what's in DNS; we really
// should be parsing bit 7 and bit 15 of the flags field, and store
// those separately.
//
// right now the DNSSEC implementation is really just for display,
// we don't validate or handle any of the keys
//
$this->flags = $x['flags'];
$this->protocol = $x['protocol'];
$this->algorithm = $x['algorithm'];
$this->key = base64_encode(substr($this->rdata, 4));
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->key) > 0) {
$data = pack('nCC', $this->flags, $this->protocol, $this->algorithm);
$data .= base64_decode($this->key);
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+209
View File
@@ -0,0 +1,209 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* DS Resource Record - RFC4034 sction 5.1
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Key Tag | Algorithm | Digest Type |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* / /
* / Digest /
* / /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_DS extends Net_DNS2_RR
{
/*
* key tag
*/
public $keytag;
/*
* algorithm number
*/
public $algorithm;
/*
* algorithm used to construct the digest
*/
public $digesttype;
/*
* the digest data
*/
public $digest;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->keytag . ' ' . $this->algorithm . ' ' .
$this->digesttype . ' ' . $this->digest;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->keytag = array_shift($rdata);
$this->algorithm = array_shift($rdata);
$this->digesttype = array_shift($rdata);
$this->digest = implode('', $rdata);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the keytag, algorithm and digesttype
//
$x = unpack('nkeytag/Calgorithm/Cdigesttype', $this->rdata);
$this->keytag = $x['keytag'];
$this->algorithm = $x['algorithm'];
$this->digesttype = $x['digesttype'];
//
// figure out the digest size
//
$digest_size = 0;
if ($this->digesttype == 1) {
$digest_size = 20; // SHA1
} else if ($this->digesttype == 2) {
$digest_size = 32; // SHA256
}
//
// copy the digest
//
$x = unpack('H*', substr($this->rdata, 4, $digest_size));
$this->digest = $x[1];
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->digest) > 0) {
$data = pack(
'nCCH*',
$this->keytag, $this->algorithm, $this->digesttype, $this->digest
);
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+130
View File
@@ -0,0 +1,130 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* EID Resource Record - undefined; the rdata is simply used as-is in it's
* binary format, so not process has to be done.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_EID extends Net_DNS2_RR
{
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return '';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
return true;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
return $this->rdata;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+187
View File
@@ -0,0 +1,187 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2013, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2013 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.3.2
*
*/
/**
* EUI48 Resource Record - RFC7043 section 3.1
*
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | EUI-48 Address |
* | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_EUI48 extends Net_DNS2_RR
{
/*
* The EUI48 address, in hex format
*/
public $address;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->address;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$value = array_shift($rdata);
//
// re: RFC 7043, the field must be represented as six two-digit hex numbers
// separated by hyphens.
//
$a = explode('-', $value);
if (count($a) != 6) {
return false;
}
//
// make sure they're all hex values
//
foreach ($a as $i) {
if (ctype_xdigit($i) == false) {
return false;
}
}
//
// store it
//
$this->address = strtolower($value);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$x = unpack('C6', $this->rdata);
if (count($x) == 6) {
$this->address = vsprintf('%02x-%02x-%02x-%02x-%02x-%02x', $x);
return true;
}
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
$data = '';
$a = explode('-', $this->address);
foreach ($a as $b) {
$data .= chr(hexdec($b));
}
$packet->offset += 6;
return $data;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+188
View File
@@ -0,0 +1,188 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2013, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2013 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.3.2
*
*/
/**
* EUI64 Resource Record - RFC7043 section 4.1
*
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | EUI-48 Address |
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_EUI64 extends Net_DNS2_RR
{
/*
* The EUI64 address, in hex format
*/
public $address;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->address;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$value = array_shift($rdata);
//
// re: RFC 7043, the field must be represented as 8 two-digit hex numbers
// separated by hyphens.
//
$a = explode('-', $value);
if (count($a) != 8) {
return false;
}
//
// make sure they're all hex values
//
foreach ($a as $i) {
if (ctype_xdigit($i) == false) {
return false;
}
}
//
// store it
//
$this->address = strtolower($value);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$x = unpack('C8', $this->rdata);
if (count($x) == 8) {
$this->address = vsprintf(
'%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x', $x
);
return true;
}
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
$data = '';
$a = explode('-', $this->address);
foreach ($a as $b) {
$data .= chr(hexdec($b));
}
$packet->offset += 8;
return $data;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+175
View File
@@ -0,0 +1,175 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* HINFO Resource Record - RFC1035 section 3.3.2
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / CPU /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / OS /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_HINFO extends Net_DNS2_RR
{
/*
* computer informatino
*/
public $cpu;
/*
* operataing system
*/
public $os;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->formatString($this->cpu) . ' ' .
$this->formatString($this->os);
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$data = $this->buildString($rdata);
if (count($data) == 2) {
$this->cpu = $data[0];
$this->os = $data[1];
return true;
}
return false;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$offset = $packet->offset;
$this->cpu = trim(Net_DNS2_Packet::label($packet, $offset), '"');
$this->os = trim(Net_DNS2_Packet::label($packet, $offset), '"');
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->cpu) > 0) {
$data = chr(strlen($this->cpu)) . $this->cpu;
$data .= chr(strlen($this->os)) . $this->os;
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+287
View File
@@ -0,0 +1,287 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.0.0
*
*/
/**
* HIP Resource Record - RFC5205 section 5
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | HIT length | PK algorithm | PK length |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* ~ HIT ~
* | |
* + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | | |
* +-+-+-+-+-+-+-+-+-+-+-+ +
* | Public Key |
* ~ ~
* | |
* + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
* | |
* ~ Rendezvous Servers ~
* | |
* + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* +-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_HIP extends Net_DNS2_RR
{
/*
* The length of the HIT field
*/
public $hit_length;
/*
* the public key cryptographic algorithm
*/
public $pk_algorithm;
/*
* the length of the public key field
*/
public $pk_length;
/*
* The HIT is stored as a binary value in network byte order.
*/
public $hit;
/*
* The public key
*/
public $public_key;
/*
* a list of rendezvous servers
*/
public $rendezvous_servers = array();
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
$out = $this->pk_algorithm . ' ' .
$this->hit . ' ' . $this->public_key . ' ';
foreach ($this->rendezvous_servers as $index => $server) {
$out .= $server . '. ';
}
return trim($out);
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->pk_algorithm = array_shift($rdata);
$this->hit = strtoupper(array_shift($rdata));
$this->public_key = array_shift($rdata);
//
// anything left on the array, must be one or more rendezevous servers. add
// them and strip off the trailing dot
//
if (count($rdata) > 0) {
$this->rendezvous_servers = preg_replace('/\.$/', '', $rdata);
}
//
// store the lengths;
//
$this->hit_length = strlen(pack('H*', $this->hit));
$this->pk_length = strlen(base64_decode($this->public_key));
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the algorithm and length values
//
$x = unpack('Chit_length/Cpk_algorithm/npk_length', $this->rdata);
$this->hit_length = $x['hit_length'];
$this->pk_algorithm = $x['pk_algorithm'];
$this->pk_length = $x['pk_length'];
$offset = 4;
//
// copy out the HIT value
//
$hit = unpack('H*', substr($this->rdata, $offset, $this->hit_length));
$this->hit = strtoupper($hit[1]);
$offset += $this->hit_length;
//
// copy out the public key
//
$this->public_key = base64_encode(
substr($this->rdata, $offset, $this->pk_length)
);
$offset += $this->pk_length;
//
// copy out any possible rendezvous servers
//
$offset = $packet->offset + $offset;
while ( ($offset - $packet->offset) < $this->rdlength) {
$this->rendezvous_servers[] = Net_DNS2_Packet::expand(
$packet, $offset
);
}
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if ( (strlen($this->hit) > 0) && (strlen($this->public_key) > 0) ) {
//
// pack the length, algorithm and HIT values
//
$data = pack(
'CCnH*',
$this->hit_length,
$this->pk_algorithm,
$this->pk_length,
$this->hit
);
//
// add the public key
//
$data .= base64_decode($this->public_key);
//
// add the offset
//
$packet->offset += strlen($data);
//
// add each rendezvous server
//
foreach ($this->rendezvous_servers as $index => $server) {
$data .= $packet->compress($server, $packet->offset);
}
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+386
View File
@@ -0,0 +1,386 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* IPSECKEY Resource Record - RFC4025 section 2.1
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | precedence | gateway type | algorithm | gateway |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-------------+ +
* ~ gateway ~
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | /
* / public key /
* / /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_IPSECKEY extends Net_DNS2_RR
{
const GATEWAY_TYPE_NONE = 0;
const GATEWAY_TYPE_IPV4 = 1;
const GATEWAY_TYPE_IPV6 = 2;
const GATEWAY_TYPE_DOMAIN = 3;
const ALGORITHM_NONE = 0;
const ALGORITHM_DSA = 1;
const ALGORITHM_RSA = 2;
/*
* Precedence (used the same was as a preference field)
*/
public $precedence;
/*
* Gateway type - specifies the format of the gataway information
* This can be either:
*
* 0 No Gateway
* 1 IPv4 address
* 2 IPV6 address
* 3 wire-encoded domain name (not compressed)
*
*/
public $gateway_type;
/*
* The algorithm used
*
* This can be:
*
* 0 No key is present
* 1 DSA key is present
* 2 RSA key is present
*
*/
public $algorithm;
/*
* The gatway information
*/
public $gateway;
/*
* the public key
*/
public $key;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
$out = $this->precedence . ' ' . $this->gateway_type . ' ' .
$this->algorithm . ' ';
switch($this->gateway_type) {
case self::GATEWAY_TYPE_NONE:
$out .= '. ';
break;
case self::GATEWAY_TYPE_IPV4:
case self::GATEWAY_TYPE_IPV6:
$out .= $this->gateway . ' ';
break;
case self::GATEWAY_TYPE_DOMAIN:
$out .= $this->gateway . '. ';
break;
}
$out .= $this->key;
return $out;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
//
// load the data
//
$precedence = array_shift($rdata);
$gateway_type = array_shift($rdata);
$algorithm = array_shift($rdata);
$gateway = strtolower(trim(array_shift($rdata)));
$key = array_shift($rdata);
//
// validate it
//
switch($gateway_type) {
case self::GATEWAY_TYPE_NONE:
$gateway = '';
break;
case self::GATEWAY_TYPE_IPV4:
if (Net_DNS2::isIPv4($gateway) == false) {
return false;
}
break;
case self::GATEWAY_TYPE_IPV6:
if (Net_DNS2::isIPv6($gateway) == false) {
return false;
}
break;
case self::GATEWAY_TYPE_DOMAIN:
; // do nothing
break;
default:
return false;
}
//
// check the algorithm and key
//
switch($algorithm) {
case self::ALGORITHM_NONE:
$key = '';
break;
case self::ALGORITHM_DSA:
case self::ALGORITHM_RSA:
; // do nothing
break;
default:
return false;
}
//
// store the values
//
$this->precedence = $precedence;
$this->gateway_type = $gateway_type;
$this->algorithm = $algorithm;
$this->gateway = $gateway;
$this->key = $key;
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// parse off the precedence, gateway type and algorithm
//
$x = unpack('Cprecedence/Cgateway_type/Calgorithm', $this->rdata);
$this->precedence = $x['precedence'];
$this->gateway_type = $x['gateway_type'];
$this->algorithm = $x['algorithm'];
$offset = 3;
//
// extract the gatway based on the type
//
switch($this->gateway_type) {
case self::GATEWAY_TYPE_NONE:
$this->gateway = '';
break;
case self::GATEWAY_TYPE_IPV4:
$this->gateway = inet_ntop(substr($this->rdata, $offset, 4));
$offset += 4;
break;
case self::GATEWAY_TYPE_IPV6:
$ip = unpack('n8', substr($this->rdata, $offset, 16));
if (count($ip) == 8) {
$this->gateway = vsprintf('%x:%x:%x:%x:%x:%x:%x:%x', $ip);
$offset += 16;
} else {
return false;
}
break;
case self::GATEWAY_TYPE_DOMAIN:
$doffset = $offset + $packet->offset;
$this->gateway = Net_DNS2_Packet::expand($packet, $doffset);
$offset = ($doffset - $packet->offset);
break;
default:
return false;
}
//
// extract the key
//
switch($this->algorithm) {
case self::ALGORITHM_NONE:
$this->key = '';
break;
case self::ALGORITHM_DSA:
case self::ALGORITHM_RSA:
$this->key = base64_encode(substr($this->rdata, $offset));
break;
default:
return false;
}
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
//
// pack the precedence, gateway type and algorithm
//
$data = pack(
'CCC', $this->precedence, $this->gateway_type, $this->algorithm
);
//
// add the gateway based on the type
//
switch($this->gateway_type) {
case self::GATEWAY_TYPE_NONE:
; // add nothing
break;
case self::GATEWAY_TYPE_IPV4:
case self::GATEWAY_TYPE_IPV6:
$data .= inet_pton($this->gateway);
break;
case self::GATEWAY_TYPE_DOMAIN:
$data .= chr(strlen($this->gateway)) . $this->gateway;
break;
default:
return null;
}
//
// add the key if there's one specified
//
switch($this->algorithm) {
case self::ALGORITHM_NONE:
; // add nothing
break;
case self::ALGORITHM_DSA:
case self::ALGORITHM_RSA:
$data .= base64_decode($this->key);
break;
default:
return null;
}
$packet->offset += strlen($data);
return $data;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+190
View File
@@ -0,0 +1,190 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* ISDN Resource Record - RFC1183 section 3.2
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / ISDN-address /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / SA /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_ISDN extends Net_DNS2_RR
{
/*
* ISDN Number
*/
public $isdnaddress;
/*
* Sub-Address
*/
public $sa;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->formatString($this->isdnaddress) . ' ' .
$this->formatString($this->sa);
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$data = $this->buildString($rdata);
if (count($data) >= 1) {
$this->isdnaddress = $data[0];
if (isset($data[1])) {
$this->sa = $data[1];
}
return true;
}
return false;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$this->isdnaddress = Net_DNS2_Packet::label($packet, $packet->offset);
//
// look for a SA (sub address) - it's optional
//
if ( (strlen($this->isdnaddress) + 1) < $this->rdlength) {
$this->sa = Net_DNS2_Packet::label($packet, $packet->offset);
} else {
$this->sa = '';
}
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->isdnaddress) > 0) {
$data = chr(strlen($this->isdnaddress)) . $this->isdnaddress;
if (!empty($this->sa)) {
$data .= chr(strlen($this->sa));
$data .= $this->sa;
}
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+85
View File
@@ -0,0 +1,85 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* the KEY RR is implemented the same as the DNSKEY RR, the only difference
* is how the flags data is parsed.
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
* | A/C | Z | XT| Z | Z | NAMTYP| Z | Z | Z | Z | SIG |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
*
* DNSKEY only uses bits 7 and 15
*
* We're not doing anything with these flags right now, so duplicating the
* class like this is fine.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_KEY extends Net_DNS2_RR_DNSKEY
{
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+179
View File
@@ -0,0 +1,179 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* KX Resource Record - RFC2230 section 3.1
*
* This class is almost identical to MX, except that the the exchanger
* domain is not compressed, it's added as a label
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | PREFERENCE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / EXCHANGER /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_KX extends Net_DNS2_RR
{
/*
* the preference for this mail exchanger
*/
public $preference;
/*
* the hostname of the mail exchanger
*/
public $exchange;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->preference . ' ' . $this->cleanString($this->exchange) . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->preference = array_shift($rdata);
$this->exchange = $this->cleanString(array_shift($rdata));
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// parse the preference
//
$x = unpack('npreference', $this->rdata);
$this->preference = $x['preference'];
//
// get the exchange entry server)
//
$offset = $packet->offset + 2;
$this->exchange = Net_DNS2_Packet::label($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->exchange) > 0) {
$data = pack('nC', $this->preference, strlen($this->exchange)) .
$this->exchange;
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+180
View File
@@ -0,0 +1,180 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2013, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2013 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.3.1
*
*/
/**
* L32 Resource Record - RFC6742 section 2.2
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Preference | Locator32 (16 MSBs) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Locator32 (16 LSBs) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_L32 extends Net_DNS2_RR
{
/*
* The preference
*/
public $preference;
/*
* The locator32 field
*/
public $locator32;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->preference . ' ' . $this->locator32;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->preference = array_shift($rdata);
$this->locator32 = array_shift($rdata);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the values
//
$x = unpack('npreference/C4locator', $this->rdata);
$this->preference = $x['preference'];
//
// build the locator value
//
$this->locator32 = $x['locator1'] . '.' . $x['locator2'] . '.' .
$x['locator3'] . '.' . $x['locator4'];
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->locator32) > 0) {
//
// break out the locator value
//
$n = explode('.', $this->locator32);
//
// pack the data
//
return pack('nC4', $this->preference, $n[0], $n[1], $n[2], $n[3]);
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+187
View File
@@ -0,0 +1,187 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2013, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2013 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.3.1
*
*/
/**
* L64 Resource Record - RFC6742 section 2.3
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Preference | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
* | Locator64 |
* + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_L64 extends Net_DNS2_RR
{
/*
* The preference
*/
public $preference;
/*
* The locator64 field
*/
public $locator64;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->preference . ' ' . $this->locator64;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->preference = array_shift($rdata);
$this->locator64 = array_shift($rdata);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the values
//
$x = unpack('npreference/n4locator', $this->rdata);
$this->preference = $x['preference'];
//
// build the locator64
//
$this->locator64 = dechex($x['locator1']) . ':' .
dechex($x['locator2']) . ':' .
dechex($x['locator3']) . ':' .
dechex($x['locator4']);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->locator64) > 0) {
//
// break out the locator64
//
$n = explode(':', $this->locator64);
//
// pack the data
//
return pack(
'n5', $this->preference, hexdec($n[0]), hexdec($n[1]),
hexdec($n[2]), hexdec($n[3])
);
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+440
View File
@@ -0,0 +1,440 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* LOC Resource Record - RFC1876 section 2
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | VERSION | SIZE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | HORIZ PRE | VERT PRE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | LATITUDE |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | LONGITUDE |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ALTITUDE |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_LOC extends Net_DNS2_RR
{
/*
* the LOC version- should only ever be 0
*/
public $version;
/*
* The diameter of a sphere enclosing the described entity
*/
public $size;
/*
* The horizontal precision of the data
*/
public $horiz_pre;
/*
* The vertical precision of the data
*/
public $vert_pre;
/*
* The latitude - stored in decimal degrees
*/
public $latitude;
/*
* The longitude - stored in decimal degrees
*/
public $longitude;
/*
* The altitude - stored in decimal
*/
public $altitude;
/*
* used for quick power-of-ten lookups
*/
private $_powerOfTen = array(1, 10, 100, 1000, 10000, 100000,
1000000,10000000,100000000,1000000000);
/*
* some conversion values
*/
const CONV_SEC = 1000;
const CONV_MIN = 60000;
const CONV_DEG = 3600000;
const REFERENCE_ALT = 10000000;
const REFERENCE_LATLON = 2147483648;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
if ($this->version == 0) {
return $this->_d2Dms($this->latitude, 'LAT') . ' ' .
$this->_d2Dms($this->longitude, 'LNG') . ' ' .
sprintf('%.2fm', $this->altitude) . ' ' .
sprintf('%.2fm', $this->size) . ' ' .
sprintf('%.2fm', $this->horiz_pre) . ' ' .
sprintf('%.2fm', $this->vert_pre);
}
return '';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
//
// format as defined by RFC1876 section 3
//
// d1 [m1 [s1]] {"N"|"S"} d2 [m2 [s2]] {"E"|"W"} alt["m"]
// [siz["m"] [hp["m"] [vp["m"]]]]
//
$res = preg_match(
'/^(\d+) \s+((\d+) \s+)?(([\d.]+) \s+)?(N|S) \s+(\d+) ' .
'\s+((\d+) \s+)?(([\d.]+) \s+)?(E|W) \s+(-?[\d.]+) m?(\s+ ' .
'([\d.]+) m?)?(\s+ ([\d.]+) m?)?(\s+ ([\d.]+) m?)?/ix',
implode(' ', $rdata), $x
);
if ($res) {
//
// latitude
//
$latdeg = $x[1];
$latmin = (isset($x[3])) ? $x[3] : 0;
$latsec = (isset($x[5])) ? $x[5] : 0;
$lathem = strtoupper($x[6]);
$this->latitude = $this->_dms2d($latdeg, $latmin, $latsec, $lathem);
//
// longitude
//
$londeg = $x[7];
$lonmin = (isset($x[9])) ? $x[9] : 0;
$lonsec = (isset($x[11])) ? $x[11] : 0;
$lonhem = strtoupper($x[12]);
$this->longitude = $this->_dms2d($londeg, $lonmin, $lonsec, $lonhem);
//
// the rest of teh values
//
$version = 0;
$this->size = (isset($x[15])) ? $x[15] : 1;
$this->horiz_pre = ((isset($x[17])) ? $x[17] : 10000);
$this->vert_pre = ((isset($x[19])) ? $x[19] : 10);
$this->altitude = $x[13];
return true;
}
return false;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack all the values
//
$x = unpack(
'Cver/Csize/Choriz_pre/Cvert_pre/Nlatitude/Nlongitude/Naltitude',
$this->rdata
);
//
// version must be 0 per RFC 1876 section 2
//
$this->version = $x['ver'];
if ($this->version == 0) {
$this->size = $this->_precsizeNtoA($x['size']);
$this->horiz_pre = $this->_precsizeNtoA($x['horiz_pre']);
$this->vert_pre = $this->_precsizeNtoA($x['vert_pre']);
//
// convert the latitude and longitude to degress in decimal
//
if ($x['latitude'] < 0) {
$this->latitude = ($x['latitude'] +
self::REFERENCE_LATLON) / self::CONV_DEG;
} else {
$this->latitude = ($x['latitude'] -
self::REFERENCE_LATLON) / self::CONV_DEG;
}
if ($x['longitude'] < 0) {
$this->longitude = ($x['longitude'] +
self::REFERENCE_LATLON) / self::CONV_DEG;
} else {
$this->longitude = ($x['longitude'] -
self::REFERENCE_LATLON) / self::CONV_DEG;
}
//
// convert down the altitude
//
$this->altitude = ($x['altitude'] - self::REFERENCE_ALT) / 100;
return true;
} else {
return false;
}
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if ($this->version == 0) {
$lat = 0;
$lng = 0;
if ($this->latitude < 0) {
$lat = ($this->latitude * self::CONV_DEG) - self::REFERENCE_LATLON;
} else {
$lat = ($this->latitude * self::CONV_DEG) + self::REFERENCE_LATLON;
}
if ($this->longitude < 0) {
$lng = ($this->longitude * self::CONV_DEG) - self::REFERENCE_LATLON;
} else {
$lng = ($this->longitude * self::CONV_DEG) + self::REFERENCE_LATLON;
}
$packet->offset += 16;
return pack(
'CCCCNNN',
$this->version,
$this->_precsizeAtoN($this->size),
$this->_precsizeAtoN($this->horiz_pre),
$this->_precsizeAtoN($this->vert_pre),
$lat, $lng,
($this->altitude * 100) + self::REFERENCE_ALT
);
}
return null;
}
/**
* takes an XeY precision/size value, returns a string representation.
* shamlessly stolen from RFC1876 Appendix A
*
* @param integer $prec the value to convert
*
* @return string
* @access private
*
*/
private function _precsizeNtoA($prec)
{
$mantissa = (($prec >> 4) & 0x0f) % 10;
$exponent = (($prec >> 0) & 0x0f) % 10;
return $mantissa * $this->_powerOfTen[$exponent];
}
/**
* converts ascii size/precision X * 10**Y(cm) to 0xXY.
* shamlessly stolen from RFC1876 Appendix A
*
* @param string $prec the value to convert
*
* @return integer
* @access private
*
*/
private function _precsizeAtoN($prec)
{
$exponent = 0;
while ($prec >= 10) {
$prec /= 10;
++$exponent;
}
return ($prec << 4) | ($exponent & 0x0f);
}
/**
* convert lat/lng in deg/min/sec/hem to decimal value
*
* @param integer $deg the degree value
* @param integer $min the minutes value
* @param integer $sec the seconds value
* @param string $hem the hemisphere (N/E/S/W)
*
* @return float the decinmal value
* @access private
*
*/
private function _dms2d($deg, $min, $sec, $hem)
{
$deg = $deg - 0;
$min = $min - 0;
$sign = ($hem == 'W' || $hem == 'S') ? -1 : 1;
return ((($sec/60+$min)/60)+$deg) * $sign;
}
/**
* convert lat/lng in decimal to deg/min/sec/hem
*
* @param float $data the decimal value
* @param string $latlng either LAT or LNG so we can determine the HEM value
*
* @return string
* @access private
*
*/
private function _d2Dms($data, $latlng)
{
$deg = 0;
$min = 0;
$sec = 0;
$msec = 0;
$hem = '';
if ($latlng == 'LAT') {
$hem = ($data > 0) ? 'N' : 'S';
} else {
$hem = ($data > 0) ? 'E' : 'W';
}
$data = abs($data);
$deg = (int)$data;
$min = (int)(($data - $deg) * 60);
$sec = (int)(((($data - $deg) * 60) - $min) * 60);
$msec = round((((((($data - $deg) * 60) - $min) * 60) - $sec) * 1000));
return sprintf('%d %02d %02d.%03d %s', $deg, $min, $sec, round($msec), $hem);
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+177
View File
@@ -0,0 +1,177 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2013, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2013 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.3.1
*
*/
/**
* LP Resource Record - RFC6742 section 2.4
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Preference | /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ /
* / /
* / FQDN /
* / /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_LP extends Net_DNS2_RR
{
/*
* The preference
*/
public $preference;
/*
* The fdqn field
*/
public $fqdn;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->preference . ' ' . $this->fqdn . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->preference = array_shift($rdata);
$this->fqdn = trim(array_shift($rdata), '.');
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// parse the preference
//
$x = unpack('npreference', $this->rdata);
$this->preference = $x['preference'];
$offset = $packet->offset + 2;
//
// get the hostname
//
$this->fqdn = Net_DNS2_Packet::expand($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->fqdn) > 0) {
$data = pack('n', $this->preference);
$packet->offset += 2;
$data .= $packet->compress($this->fqdn, $packet->offset);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+175
View File
@@ -0,0 +1,175 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* MX Resource Record - RFC1035 section 3.3.9
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | PREFERENCE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / EXCHANGE /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_MX extends Net_DNS2_RR
{
/*
* the preference for this mail exchanger
*/
public $preference;
/*
* the hostname of the mail exchanger
*/
public $exchange;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->preference . ' ' . $this->cleanString($this->exchange) . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->preference = array_shift($rdata);
$this->exchange = $this->cleanString(array_shift($rdata));
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// parse the preference
//
$x = unpack('npreference', $this->rdata);
$this->preference = $x['preference'];
//
// get the exchange entry server)
//
$offset = $packet->offset + 2;
$this->exchange = Net_DNS2_Packet::expand($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->exchange) > 0) {
$data = pack('n', $this->preference);
$packet->offset += 2;
$data .= $packet->compress($this->exchange, $packet->offset);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+231
View File
@@ -0,0 +1,231 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* NAPTR Resource Record - RFC2915
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ORDER |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | PREFERENCE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / FLAGS /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / SERVICES /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / REGEXP /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / REPLACEMENT /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_NAPTR extends Net_DNS2_RR
{
/*
* the order in which the NAPTR records MUST be processed
*/
public $order;
/*
* specifies the order in which NAPTR records with equal "order"
* values SHOULD be processed
*/
public $preference;
/*
* rewrite flags
*/
public $flags;
/*
* Specifies the service(s) available down this rewrite path
*/
public $services;
/*
* regular expression
*/
public $regexp;
/*
* The next NAME to query for NAPTR, SRV, or address records
* depending on the value of the flags field
*/
public $replacement;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->order . ' ' . $this->preference . ' ' .
$this->formatString($this->flags) . ' ' .
$this->formatString($this->services) . ' ' .
$this->formatString($this->regexp) . ' ' .
$this->cleanString($this->replacement) . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->order = array_shift($rdata);
$this->preference = array_shift($rdata);
$data = $this->buildString($rdata);
if (count($data) == 4) {
$this->flags = $data[0];
$this->services = $data[1];
$this->regexp = $data[2];
$this->replacement = $this->cleanString($data[3]);
return true;
}
return false;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the order and preference
//
$x = unpack('norder/npreference', $this->rdata);
$this->order = $x['order'];
$this->preference = $x['preference'];
$offset = $packet->offset + 4;
$this->flags = Net_DNS2_Packet::label($packet, $offset);
$this->services = Net_DNS2_Packet::label($packet, $offset);
$this->regexp = Net_DNS2_Packet::label($packet, $offset);
$this->replacement = Net_DNS2_Packet::expand($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if ( (isset($this->order)) && (strlen($this->services) > 0) ) {
$data = pack('nn', $this->order, $this->preference);
$data .= chr(strlen($this->flags)) . $this->flags;
$data .= chr(strlen($this->services)) . $this->services;
$data .= chr(strlen($this->regexp)) . $this->regexp;
$packet->offset += strlen($data);
$data .= $packet->compress($this->replacement, $packet->offset);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+187
View File
@@ -0,0 +1,187 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2013, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2013 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.3.1
*
*/
/**
* NID Resource Record - RFC6742 section 2.1
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Preference | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
* | NodeID |
* + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_NID extends Net_DNS2_RR
{
/*
* The preference
*/
public $preference;
/*
* The node ID field
*/
public $nodeid;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->preference . ' ' . $this->nodeid;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->preference = array_shift($rdata);
$this->nodeid = array_shift($rdata);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the values
//
$x = unpack('npreference/n4nodeid', $this->rdata);
$this->preference = $x['preference'];
//
// build the node id
//
$this->nodeid = dechex($x['nodeid1']) . ':' .
dechex($x['nodeid2']) . ':' .
dechex($x['nodeid3']) . ':' .
dechex($x['nodeid4']);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->nodeid) > 0) {
//
// break out the node id
//
$n = explode(':', $this->nodeid);
//
// pack the data
//
return pack(
'n5', $this->preference, hexdec($n[0]), hexdec($n[1]),
hexdec($n[2]), hexdec($n[3])
);
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+130
View File
@@ -0,0 +1,130 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* NIMLOCK Resource Record - undefined; the rdata is simply used as-is in it's
* binary format, so not process has to be done.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_NIMLOCK extends Net_DNS2_RR
{
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return '';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
return true;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
return $this->rdata;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+153
View File
@@ -0,0 +1,153 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* NS Resource Record - RFC1035 section 3.3.11
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / NSDNAME /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_NS extends Net_DNS2_RR
{
/*
* the hostname of the DNS server
*/
public $nsdname;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->cleanString($this->nsdname) . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->nsdname = $this->cleanString(array_shift($rdata));
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$offset = $packet->offset;
$this->nsdname = Net_DNS2_Packet::expand($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->nsdname) > 0) {
return $packet->compress($this->nsdname, $packet->offset);
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+262
View File
@@ -0,0 +1,262 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* NSAP Resource Record - RFC1706
*
* |--------------|
* | <-- IDP --> |
* |--------------|-------------------------------------|
* | AFI | IDI | <-- DSP --> |
* |-----|--------|-------------------------------------|
* | 47 | 0005 | DFI | AA |Rsvd | RD |Area | ID |Sel |
* |-----|--------|-----|----|-----|----|-----|----|----|
* octets | 1 | 2 | 1 | 3 | 2 | 2 | 2 | 6 | 1 |
* |-----|--------|-----|----|-----|----|-----|----|----|
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_NSAP extends Net_DNS2_RR
{
public $afi;
public $idi;
public $dfi;
public $aa;
public $rsvd;
public $rd;
public $area;
public $id;
public $sel;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->cleanString($this->afi) . '.' .
$this->cleanString($this->idi) . '.' .
$this->cleanString($this->dfi) . '.' .
$this->cleanString($this->aa) . '.' .
$this->cleanString($this->rsvd) . '.' .
$this->cleanString($this->rd) . '.' .
$this->cleanString($this->area) . '.' .
$this->cleanString($this->id) . '.' .
$this->sel;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$data = strtolower(trim(array_shift($rdata)));
//
// there is no real standard for format, so we can't rely on the fact that
// the value will come in with periods separating the values- so strip
// them out if they're included, and parse without them.
//
$data = str_replace(array('.', '0x'), '', $data);
//
// unpack it as ascii characters
//
$x = unpack('A2afi/A4idi/A2dfi/A6aa/A4rsvd/A4rd/A4area/A12id/A2sel', $data);
//
// make sure the afi value is 47
//
if ($x['afi'] == '47') {
$this->afi = '0x' . $x['afi'];
$this->idi = $x['idi'];
$this->dfi = $x['dfi'];
$this->aa = $x['aa'];
$this->rsvd = $x['rsvd'];
$this->rd = $x['rd'];
$this->area = $x['area'];
$this->id = $x['id'];
$this->sel = $x['sel'];
return true;
}
return false;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength == 20) {
//
// get the AFI value
//
$this->afi = dechex(ord($this->rdata[0]));
//
// we only support AFI 47- there arent' any others defined.
//
if ($this->afi == '47') {
//
// unpack the rest of the values
//
$x = unpack(
'Cafi/nidi/Cdfi/C3aa/nrsvd/nrd/narea/Nidh/nidl/Csel',
$this->rdata
);
$this->afi = sprintf('0x%02x', $x['afi']);
$this->idi = sprintf('%04x', $x['idi']);
$this->dfi = sprintf('%02x', $x['dfi']);
$this->aa = sprintf(
'%06x', $x['aa1'] << 16 | $x['aa2'] << 8 | $x['aa3']
);
$this->rsvd = sprintf('%04x', $x['rsvd']);
$this->rd = sprintf('%04x', $x['rd']);
$this->area = sprintf('%04x', $x['area']);
$this->id = sprintf('%08x', $x['idh']) .
sprintf('%04x', $x['idl']);
$this->sel = sprintf('%02x', $x['sel']);
return true;
}
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if ($this->afi == '0x47') {
//
// build the aa field
//
$aa = unpack('A2x/A2y/A2z', $this->aa);
//
// build the id field
//
$id = unpack('A8a/A4b', $this->id);
//
$data = pack(
'CnCCCCnnnNnC',
hexdec($this->afi),
hexdec($this->idi),
hexdec($this->dfi),
hexdec($aa['x']),
hexdec($aa['y']),
hexdec($aa['z']),
hexdec($this->rsvd),
hexdec($this->rd),
hexdec($this->area),
hexdec($id['a']),
hexdec($id['b']),
hexdec($this->sel)
);
if (strlen($data) == 20) {
$packet->offset += 20;
return $data;
}
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+184
View File
@@ -0,0 +1,184 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* NSEC Resource Record - RFC3845 section 2.1
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* / Next Domain Name /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* / List of Type Bit Map(s) /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_NSEC extends Net_DNS2_RR
{
/*
* The next owner name
*/
public $next_domain_name;
/*
* identifies the RRset types that exist at the NSEC RR's owner name.
*/
public $type_bit_maps = array();
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
$data = $this->cleanString($this->next_domain_name) . '.';
foreach ($this->type_bit_maps as $rr) {
$data .= ' ' . $rr;
}
return $data;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->next_domain_name = $this->cleanString(array_shift($rdata));
$this->type_bit_maps = $rdata;
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// expand the next domain name
//
$offset = $packet->offset;
$this->next_domain_name = Net_DNS2_Packet::expand($packet, $offset);
//
// parse out the RR's from the bitmap
//
$this->type_bit_maps = Net_DNS2_BitMap::bitMapToArray(
substr($this->rdata, $offset - $packet->offset)
);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->next_domain_name) > 0) {
$data = $packet->compress($this->next_domain_name, $packet->offset);
$bitmap = Net_DNS2_BitMap::arrayToBitMap($this->type_bit_maps);
$packet->offset += strlen($bitmap);
return $data . $bitmap;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+310
View File
@@ -0,0 +1,310 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* NSEC3 Resource Record - RFC5155 section 3.2
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Hash Alg. | Flags | Iterations |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Salt Length | Salt /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Hash Length | Next Hashed Owner Name /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* / Type Bit Maps /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_NSEC3 extends Net_DNS2_RR
{
/*
* Algorithm to use
*/
public $algorithm;
/*
* flags
*/
public $flags;
/*
* defines the number of additional times the hash is performed.
*/
public $iterations;
/*
* the length of the salt- not displayed
*/
public $salt_length;
/*
* the salt
*/
public $salt;
/*
* the length of the hash value
*/
public $hash_length;
/*
* the hashed value of the owner name
*/
public $hashed_owner_name;
/*
* array of RR type names
*/
public $type_bit_maps = array();
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
$out = $this->algorithm . ' ' . $this->flags . ' ' . $this->iterations . ' ';
//
// per RFC5155, the salt_length value isn't displayed, and if the salt
// is empty, the salt is displayed as '-'
//
if ($this->salt_length > 0) {
$out .= $this->salt;
} else {
$out .= '-';
}
//
// per RFC5255 the hash length isn't shown
//
$out .= ' ' . $this->hashed_owner_name;
//
// show the RR's
//
foreach ($this->type_bit_maps as $rr) {
$out .= ' ' . strtoupper($rr);
}
return $out;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->algorithm = array_shift($rdata);
$this->flags = array_shift($rdata);
$this->iterations = array_shift($rdata);
//
// an empty salt is represented as '-' per RFC5155 section 3.3
//
$salt = array_shift($rdata);
if ($salt == '-') {
$this->salt_length = 0;
$this->salt = '';
} else {
$this->salt_length = strlen(pack('H*', $salt));
$this->salt = strtoupper($salt);
}
$this->hashed_owner_name = array_shift($rdata);
$this->hash_length = strlen(base64_decode($this->hashed_owner_name));
$this->type_bit_maps = $rdata;
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the first values
//
$x = unpack('Calgorithm/Cflags/niterations/Csalt_length', $this->rdata);
$this->algorithm = $x['algorithm'];
$this->flags = $x['flags'];
$this->iterations = $x['iterations'];
$this->salt_length = $x['salt_length'];
$offset = 5;
if ($this->salt_length > 0) {
$x = unpack('H*', substr($this->rdata, $offset, $this->salt_length));
$this->salt = strtoupper($x[1]);
$offset += $this->salt_length;
}
//
// unpack the hash length
//
$x = unpack('@' . $offset . '/Chash_length', $this->rdata);
$offset++;
//
// copy out the hash
//
$this->hash_length = $x['hash_length'];
if ($this->hash_length > 0) {
$this->hashed_owner_name = base64_encode(
substr($this->rdata, $offset, $this->hash_length)
);
$offset += $this->hash_length;
}
//
// parse out the RR bitmap
//
$this->type_bit_maps = Net_DNS2_BitMap::bitMapToArray(
substr($this->rdata, $offset)
);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
//
// pull the salt and build the length
//
$salt = pack('H*', $this->salt);
$this->salt_length = strlen($salt);
//
// pack the algorithm, flags, iterations and salt length
//
$data = pack(
'CCnC',
$this->algorithm, $this->flags, $this->iterations, $this->salt_length
);
$data .= $salt;
//
// add the hash length and hash
//
$data .= chr($this->hash_length);
if ($this->hash_length > 0) {
$data .= base64_decode($this->hashed_owner_name);
}
//
// conver the array of RR names to a type bitmap
//
$data .= Net_DNS2_BitMap::arrayToBitMap($this->type_bit_maps);
$packet->offset += strlen($data);
return $data;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+220
View File
@@ -0,0 +1,220 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* NSEC3PARAM Resource Record - RFC5155 section 4.2
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Hash Alg. | Flags | Iterations |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Salt Length | Salt /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_NSEC3PARAM extends Net_DNS2_RR
{
/*
* Algorithm to use
*
* TODO: same as the NSEC3
*/
public $algorithm;
/*
* flags
*/
public $flags;
/*
* defines the number of additional times the hash is performed.
*/
public $iterations;
/*
* the length of the salt- not displayed
*/
public $salt_length;
/*
* the salt
*/
public $salt;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
$out = $this->algorithm . ' ' . $this->flags . ' ' . $this->iterations . ' ';
//
// per RFC5155, the salt_length value isn't displayed, and if the salt
// is empty, the salt is displayed as "-"
//
if ($this->salt_length > 0) {
$out .= $this->salt;
} else {
$out .= '-';
}
return $out;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->algorithm = array_shift($rdata);
$this->flags = array_shift($rdata);
$this->iterations = array_shift($rdata);
$salt = array_shift($rdata);
if ($salt == '-') {
$this->salt_length = 0;
$this->salt = '';
} else {
$this->salt_length = strlen(pack('H*', $salt));
$this->salt = strtoupper($salt);
}
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$x = unpack('Calgorithm/Cflags/niterations/Csalt_length', $this->rdata);
$this->algorithm = $x['algorithm'];
$this->flags = $x['flags'];
$this->iterations = $x['iterations'];
$this->salt_length = $x['salt_length'];
if ($this->salt_length > 0) {
$x = unpack('H*', substr($this->rdata, 5, $this->salt_length));
$this->salt = strtoupper($x[1]);
}
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
$salt = pack('H*', $this->salt);
$this->salt_length = strlen($salt);
$data = pack(
'CCnC',
$this->algorithm, $this->flags, $this->iterations, $this->salt_length
) . $salt;
$packet->offset += strlen($data);
return $data;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+159
View File
@@ -0,0 +1,159 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2014, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2014 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.4.0
*
*/
/**
* OPENPGPKEY Resource Record - https://tools.ietf.org/html/draft-ietf-dane-openpgpkey-01
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* / /
* / OpenPGP Public KeyRing /
* / /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_OPENPGPKEY extends Net_DNS2_RR
{
/*
* the public key
*/
public $key;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->key;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->key = array_shift($rdata);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$this->key = base64_encode(substr($this->rdata, 0, $this->rdlength));
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->key) > 0) {
$data = base64_decode($this->key);
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+292
View File
@@ -0,0 +1,292 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.0.0
*
*/
/**
* OPT Resource Record - RFC2929 section 3.1
*
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
* | OPTION-CODE |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
* | OPTION-LENGTH |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
* | |
* / OPTION-DATA /
* / /
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_OPT extends Net_DNS2_RR
{
/*
* option code - assigned by IANA
*/
public $option_code;
/*
* the length of the option data
*/
public $option_length;
/*
* the option data
*/
public $option_data;
/*
* the extended response code stored in the TTL
*/
public $extended_rcode;
/*
* the implementation level
*/
public $version;
/*
* the DO bit used for DNSSEC - RFC3225
*/
public $do;
/*
* the extended flags
*/
public $z;
/**
* Constructor - builds a new Net_DNS2_RR_OPT object; normally you wouldn't call
* this directly, but OPT RR's are a little different
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet or null to create
* an empty object
* @param array $rr an array with RR parse values or null to
* create an empty object
*
* @throws Net_DNS2_Exception
* @access public
*
*/
public function __construct(Net_DNS2_Packet &$packet = null, array $rr = null)
{
//
// this is for when we're manually building an OPT RR object; we aren't
// passing in binary data to parse, we just want a clean/empty object.
//
$this->type = 'OPT';
$this->rdlength = 0;
$this->option_length = 0;
$this->extended_rcode = 0;
$this->version = 0;
$this->do = 0;
$this->z = 0;
//
// everthing else gets passed through to the parent.
//
if ( (!is_null($packet)) && (!is_null($rr)) ) {
parent::__construct($packet, $rr);
}
}
/**
* method to return the rdata portion of the packet as a string. There is no
* defintion for returning an OPT RR by string- this is just here to validate
* the binary parsing / building routines.
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->option_code . ' ' . $this->option_data;
}
/**
* parses the rdata portion from a standard DNS config line. There is no
* definition for parsing a OPT RR by string- this is just here to validate
* the binary parsing / building routines.
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->option_code = array_shift($rdata);
$this->option_data = array_shift($rdata);
$this->option_length = strlen($this->option_data);
$x = unpack('Cextended/Cversion/Cdo/Cz', pack('N', $this->ttl));
$this->extended_rcode = $x['extended'];
$this->version = $x['version'];
$this->do = ($x['do'] >> 7);
$this->z = $x['z'];
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
//
// parse out the TTL value
//
$x = unpack('Cextended/Cversion/Cdo/Cz', pack('N', $this->ttl));
$this->extended_rcode = $x['extended'];
$this->version = $x['version'];
$this->do = ($x['do'] >> 7);
$this->z = $x['z'];
//
// parse the data, if there is any
//
if ($this->rdlength > 0) {
//
// unpack the code and length
//
$x = unpack('noption_code/noption_length', $this->rdata);
$this->option_code = $x['option_code'];
$this->option_length = $x['option_length'];
//
// copy out the data based on the length
//
$this->option_data = substr($this->rdata, 4);
}
return true;
}
/**
* pre-builds the TTL value for this record; we needed to separate this out
* from the rrGet() function, as the logic in the Net_DNS2_RR packs the TTL
* value before it builds the rdata value.
*
* @return void
* @access protected
*
*/
protected function preBuild()
{
//
// build the TTL value based on the local values
//
$ttl = unpack(
'N',
pack('CCCC', $this->extended_rcode, $this->version, ($this->do << 7), 0)
);
$this->ttl = $ttl[1];
return;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
//
// if there is an option code, then pack that data too
//
if ($this->option_code) {
$data = pack('nn', $this->option_code, $this->option_length) .
$this->option_data;
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+152
View File
@@ -0,0 +1,152 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* PTR Resource Record - RFC1035 section 3.3.12
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / PTRDNAME /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_PTR extends Net_DNS2_RR
{
/*
* the hostname of the PTR entry
*/
public $ptrdname;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return rtrim($this->ptrdname, '.') . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->ptrdname = rtrim(implode(' ', $rdata), '.');
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$offset = $packet->offset;
$this->ptrdname = Net_DNS2_Packet::expand($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->ptrdname) > 0) {
return $packet->compress($this->ptrdname, $packet->offset);
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+186
View File
@@ -0,0 +1,186 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* PX Resource Record - RFC2163 section 4
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | PREFERENCE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / MAP822 /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / MAPX400 /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_PX extends Net_DNS2_RR
{
/*
* preference
*/
public $preference;
/*
* the RFC822 part of the MCGAM
*/
public $map822;
/*
* the X.400 part of the MCGAM
*/
public $mapx400;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->preference . ' ' . $this->cleanString($this->map822) . '. ' .
$this->cleanString($this->mapx400) . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->preference = $rdata[0];
$this->map822 = $this->cleanString($rdata[1]);
$this->mapx400 = $this->cleanString($rdata[2]);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// parse the preference
//
$x = unpack('npreference', $this->rdata);
$this->preference = $x['preference'];
$offset = $packet->offset + 2;
$this->map822 = Net_DNS2_Packet::expand($packet, $offset);
$this->mapx400 = Net_DNS2_Packet::expand($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->map822) > 0) {
$data = pack('n', $this->preference);
$packet->offset += 2;
$data .= $packet->compress($this->map822, $packet->offset);
$data .= $packet->compress($this->mapx400, $packet->offset);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+167
View File
@@ -0,0 +1,167 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* RP Resource Record - RFC1183 section 2.2
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / mboxdname /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / txtdname /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_RP extends Net_DNS2_RR
{
/*
* mailbox for the responsible person
*/
public $mboxdname;
/*
* is a domain name for which TXT RR's exists
*/
public $txtdname;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->cleanString($this->mboxdname) . '. ' .
$this->cleanString($this->txtdname) . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->mboxdname = $this->cleanString($rdata[0]);
$this->txtdname = $this->cleanString($rdata[1]);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$offset = $packet->offset;
$this->mboxdname = Net_DNS2_Packet::expand($packet, $offset);
$this->txtdname = Net_DNS2_Packet::expand($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->mboxdname) > 0) {
return $packet->compress($this->mboxdname, $packet->offset) .
$packet->compress($this->txtdname, $packet->offset);
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+329
View File
@@ -0,0 +1,329 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
* This file contains code based off the Net::DNS::SEC Perl module by
* Olaf M. Kolkman
*
* This is the copyright notice from the PERL Net::DNS::SEC module:
*
* Copyright (c) 2001 - 2005 RIPE NCC. Author Olaf M. Kolkman
* Copyright (c) 2007 - 2008 NLnet Labs. Author Olaf M. Kolkman
* <olaf@net-dns.org>
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of the author not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
* AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/**
* RRSIG Resource Record - RFC4034 sction 3.1
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Type Covered | Algorithm | Labels |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Original TTL |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Signature Expiration |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Signature Inception |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Key Tag | /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Signer's Name /
* / /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* / /
* / Signature /
* / /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_RRSIG extends Net_DNS2_RR
{
/*
* the RR type covered by this signature
*/
public $typecovered;
/*
* the algorithm used for the signature
*/
public $algorithm;
/*
* the number of labels in the name
*/
public $labels;
/*
* the original TTL
*/
public $origttl;
/*
* the signature expiration
*/
public $sigexp;
/*
* the inception of the signature
*/
public $sigincep;
/*
* the keytag used
*/
public $keytag;
/*
* the signer's name
*/
public $signname;
/*
* the signature
*/
public $signature;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->typecovered . ' ' . $this->algorithm . ' ' .
$this->labels . ' ' . $this->origttl . ' ' .
$this->sigexp . ' ' . $this->sigincep . ' ' .
$this->keytag . ' ' . $this->cleanString($this->signname) . '. ' .
$this->signature;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->typecovered = strtoupper(array_shift($rdata));
$this->algorithm = array_shift($rdata);
$this->labels = array_shift($rdata);
$this->origttl = array_shift($rdata);
$this->sigexp = array_shift($rdata);
$this->sigincep = array_shift($rdata);
$this->keytag = array_shift($rdata);
$this->signname = $this->cleanString(array_shift($rdata));
foreach ($rdata as $line) {
$this->signature .= $line;
}
$this->signature = trim($this->signature);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack
//
$x = unpack(
'ntc/Calgorithm/Clabels/Norigttl/Nsigexp/Nsigincep/nkeytag',
$this->rdata
);
$this->typecovered = Net_DNS2_Lookups::$rr_types_by_id[$x['tc']];
$this->algorithm = $x['algorithm'];
$this->labels = $x['labels'];
$this->origttl = Net_DNS2::expandUint32($x['origttl']);
//
// the dates are in GM time
//
$this->sigexp = gmdate('YmdHis', $x['sigexp']);
$this->sigincep = gmdate('YmdHis', $x['sigincep']);
//
// get the keytag
//
$this->keytag = $x['keytag'];
//
// get teh signers name and signature
//
$offset = $packet->offset + 18;
$sigoffset = $offset;
$this->signname = strtolower(
Net_DNS2_Packet::expand($packet, $sigoffset)
);
$this->signature = base64_encode(
substr($this->rdata, 18 + ($sigoffset - $offset))
);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->signature) > 0) {
//
// parse the values out of the dates
//
preg_match(
'/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/', $this->sigexp, $e
);
preg_match(
'/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/', $this->sigincep, $i
);
//
// pack the value
//
$data = pack(
'nCCNNNn',
Net_DNS2_Lookups::$rr_types_by_name[$this->typecovered],
$this->algorithm,
$this->labels,
$this->origttl,
gmmktime($e[4], $e[5], $e[6], $e[2], $e[3], $e[1]),
gmmktime($i[4], $i[5], $i[6], $i[2], $i[3], $i[1]),
$this->keytag
);
//
// the signer name is special; it's not allowed to be compressed
// (see section 3.1.7)
//
$names = explode('.', strtolower($this->signname));
foreach ($names as $name) {
$data .= chr(strlen($name));
$data .= $name;
}
$data .= "\0";
//
// add the signature
//
$data .= base64_decode($this->signature);
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+175
View File
@@ -0,0 +1,175 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* RT Resource Record - RFC1183 section 3.3
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | preference |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / intermediate-host /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_RT extends Net_DNS2_RR
{
/*
* the preference of this route
*/
public $preference;
/*
* host which will servce as an intermediate in reaching the owner host
*/
public $intermediatehost;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->preference . ' ' .
$this->cleanString($this->intermediatehost) . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->preference = $rdata[0];
$this->intermediatehost = $this->cleanString($rdata[1]);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the preference
//
$x = unpack('npreference', $this->rdata);
$this->preference = $x['preference'];
$offset = $packet->offset + 2;
$this->intermediatehost = Net_DNS2_Packet::expand($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->intermediatehost) > 0) {
$data = pack('n', $this->preference);
$packet->offset += 2;
$data .= $packet->compress($this->intermediatehost, $packet->offset);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+459
View File
@@ -0,0 +1,459 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
* This file contains code based off the Net::DNS::SEC Perl module by
* Olaf M. Kolkman
*
* This is the copyright notice from the PERL Net::DNS::SEC module:
*
* Copyright (c) 2001 - 2005 RIPE NCC. Author Olaf M. Kolkman
* Copyright (c) 2007 - 2008 NLnet Labs. Author Olaf M. Kolkman
* <olaf@net-dns.org>
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of the author not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
* AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/**
* SIG Resource Record - RFC2535 section 4.1
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Type Covered | Algorithm | Labels |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Original TTL |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Signature Expiration |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Signature Inception |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Key Tag | /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Signer's Name /
* / /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* / /
* / Signature /
* / /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_SIG extends Net_DNS2_RR
{
/*
* and instance of a Net_DNS2_PrivateKey object
*/
public $private_key = null;
/*
* the RR type covered by this signature
*/
public $typecovered;
/*
* the algorithm used for the signature
*/
public $algorithm;
/*
* the number of labels in the name
*/
public $labels;
/*
* the original TTL
*/
public $origttl;
/*
* the signature expiration
*/
public $sigexp;
/*
* the inception of the signature
*/
public $sigincep;
/*
* the keytag used
*/
public $keytag;
/*
* the signer's name
*/
public $signname;
/*
* the signature
*/
public $signature;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->typecovered . ' ' . $this->algorithm . ' ' .
$this->labels . ' ' . $this->origttl . ' ' .
$this->sigexp . ' ' . $this->sigincep . ' ' .
$this->keytag . ' ' . $this->cleanString($this->signname) . '. ' .
$this->signature;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->typecovered = strtoupper(array_shift($rdata));
$this->algorithm = array_shift($rdata);
$this->labels = array_shift($rdata);
$this->origttl = array_shift($rdata);
$this->sigexp = array_shift($rdata);
$this->sigincep = array_shift($rdata);
$this->keytag = array_shift($rdata);
$this->signname = $this->cleanString(array_shift($rdata));
foreach ($rdata as $line) {
$this->signature .= $line;
}
$this->signature = trim($this->signature);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack
//
$x = unpack(
'ntc/Calgorithm/Clabels/Norigttl/Nsigexp/Nsigincep/nkeytag',
$this->rdata
);
$this->typecovered = Net_DNS2_Lookups::$rr_types_by_id[$x['tc']];
$this->algorithm = $x['algorithm'];
$this->labels = $x['labels'];
$this->origttl = Net_DNS2::expandUint32($x['origttl']);
//
// the dates are in GM time
//
$this->sigexp = gmdate('YmdHis', $x['sigexp']);
$this->sigincep = gmdate('YmdHis', $x['sigincep']);
//
// get the keytag
//
$this->keytag = $x['keytag'];
//
// get teh signers name and signature
//
$offset = $packet->offset + 18;
$sigoffset = $offset;
$this->signname = strtolower(
Net_DNS2_Packet::expand($packet, $sigoffset)
);
$this->signature = base64_encode(
substr($this->rdata, 18 + ($sigoffset - $offset))
);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
//
// parse the values out of the dates
//
preg_match(
'/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/', $this->sigexp, $e
);
preg_match(
'/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/', $this->sigincep, $i
);
//
// pack the value
//
$data = pack(
'nCCNNNn',
Net_DNS2_Lookups::$rr_types_by_name[$this->typecovered],
$this->algorithm,
$this->labels,
$this->origttl,
gmmktime($e[4], $e[5], $e[6], $e[2], $e[3], $e[1]),
gmmktime($i[4], $i[5], $i[6], $i[2], $i[3], $i[1]),
$this->keytag
);
//
// the signer name is special; it's not allowed to be compressed
// (see section 3.1.7)
//
$names = explode('.', strtolower($this->signname));
foreach ($names as $name) {
$data .= chr(strlen($name));
$data .= $name;
}
$data .= chr('0');
//
// if the signature is empty, and $this->private_key is an instance of a
// private key object, and we have access to openssl, then assume this
// is a SIG(0), and generate a new signature
//
if ( (strlen($this->signature) == 0)
&& ($this->private_key instanceof Net_DNS2_PrivateKey)
&& (extension_loaded('openssl') === true)
) {
//
// create a new packet for the signature-
//
$new_packet = new Net_DNS2_Packet_Request('example.com', 'SOA', 'IN');
//
// copy the packet data over
//
$new_packet->copy($packet);
//
// remove the SIG object from the additional list
//
array_pop($new_packet->additional);
$new_packet->header->arcount = count($new_packet->additional);
//
// copy out the data
//
$sigdata = $data . $new_packet->get();
//
// based on the algorithm
//
$algorithm = 0;
switch($this->algorithm) {
//
// MD5
//
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSAMD5:
$algorithm = OPENSSL_ALGO_MD5;
break;
//
// SHA1
//
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSASHA1:
$algorithm = OPENSSL_ALGO_SHA1;
break;
//
// SHA256 (PHP 5.4.8 or higher)
//
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSASHA256:
if (version_compare(PHP_VERSION, '5.4.8', '<') == true) {
throw new Net_DNS2_Exception(
'SHA256 support is only available in PHP >= 5.4.8',
Net_DNS2_Lookups::E_OPENSSL_INV_ALGO
);
}
$algorithm = OPENSSL_ALGO_SHA256;
break;
//
// SHA512 (PHP 5.4.8 or higher)
//
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSASHA512:
if (version_compare(PHP_VERSION, '5.4.8', '<') == true) {
throw new Net_DNS2_Exception(
'SHA512 support is only available in PHP >= 5.4.8',
Net_DNS2_Lookups::E_OPENSSL_INV_ALGO
);
}
$algorithm = OPENSSL_ALGO_SHA512;
break;
//
// unsupported at the moment
//
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_DSA:
case Net_DNS2_Lookups::DSNSEC_ALGORITHM_RSASHA1NSEC3SHA1:
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_DSANSEC3SHA1:
default:
throw new Net_DNS2_Exception(
'invalid or unsupported algorithm',
Net_DNS2_Lookups::E_OPENSSL_INV_ALGO
);
break;
}
//
// sign the data
//
if (openssl_sign($sigdata, $this->signature, $this->private_key->instance, $algorithm) == false) {
throw new Net_DNS2_Exception(
openssl_error_string(),
Net_DNS2_Lookups::E_OPENSSL_ERROR
);
}
//
// build the signature value based
//
switch($this->algorithm) {
//
// RSA- add it directly
//
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSAMD5:
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSASHA1:
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSASHA256:
case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSASHA512:
$this->signature = base64_encode($this->signature);
break;
}
}
//
// add the signature
//
$data .= base64_decode($this->signature);
$packet->offset += strlen($data);
return $data;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+75
View File
@@ -0,0 +1,75 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2016, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2016 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.4.2
*
*/
/**
* The SMIMEA RR is implemented exactly like the TLSA record, so
* for now we just extend the TLSA RR and use it.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_SMIMEA extends Net_DNS2_RR_TLSA
{
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+240
View File
@@ -0,0 +1,240 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* SOA Resource Record - RFC1035 section 3.3.13
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / MNAME /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / RNAME /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | SERIAL |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | REFRESH |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | RETRY |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | EXPIRE |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | MINIMUM |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_SOA extends Net_DNS2_RR
{
/*
* The master DNS server
*/
public $mname;
/*
* mailbox of the responsible person
*/
public $rname;
/*
* serial number
*/
public $serial;
/*
* refresh time
*/
public $refresh;
/*
* retry interval
*/
public $retry;
/*
* expire time
*/
public $expire;
/*
* minimum TTL for any RR in this zone
*/
public $minimum;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->cleanString($this->mname) . '. ' .
$this->cleanString($this->rname) . '. ' .
$this->serial . ' ' . $this->refresh . ' ' . $this->retry . ' ' .
$this->expire . ' ' . $this->minimum;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->mname = $this->cleanString($rdata[0]);
$this->rname = $this->cleanString($rdata[1]);
$this->serial = $rdata[2];
$this->refresh = $rdata[3];
$this->retry = $rdata[4];
$this->expire = $rdata[5];
$this->minimum = $rdata[6];
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// parse the
//
$offset = $packet->offset;
$this->mname = Net_DNS2_Packet::expand($packet, $offset);
$this->rname = Net_DNS2_Packet::expand($packet, $offset);
//
// get the SOA values
//
$x = unpack(
'@' . $offset . '/Nserial/Nrefresh/Nretry/Nexpire/Nminimum/',
$packet->rdata
);
$this->serial = Net_DNS2::expandUint32($x['serial']);
$this->refresh = Net_DNS2::expandUint32($x['refresh']);
$this->retry = Net_DNS2::expandUint32($x['retry']);
$this->expire = Net_DNS2::expandUint32($x['expire']);
$this->minimum = Net_DNS2::expandUint32($x['minimum']);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->mname) > 0) {
$data = $packet->compress($this->mname, $packet->offset);
$data .= $packet->compress($this->rname, $packet->offset);
$data .= pack(
'N5', $this->serial, $this->refresh, $this->retry,
$this->expire, $this->minimum
);
$packet->offset += 20;
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+75
View File
@@ -0,0 +1,75 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* The SPF RR is implemented exactly like the TXT record, so
* for now we just extend the TXT RR and use it.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_SPF extends Net_DNS2_RR_TXT
{
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+186
View File
@@ -0,0 +1,186 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* SRV Resource Record - RFC2782
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | PRIORITY |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | WEIGHT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | PORT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / TARGET /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_SRV extends Net_DNS2_RR
{
/*
* The priority of this target host.
*/
public $priority;
/*
* a relative weight for entries with the same priority
*/
public $weight;
/*
* The port on this target host of this service.
*/
public $port;
/*
* The domain name of the target host
*/
public $target;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->priority . ' ' . $this->weight . ' ' .
$this->port . ' ' . $this->cleanString($this->target) . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->priority = $rdata[0];
$this->weight = $rdata[1];
$this->port = $rdata[2];
$this->target = $this->cleanString($rdata[3]);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the priority, weight and port
//
$x = unpack('npriority/nweight/nport', $this->rdata);
$this->priority = $x['priority'];
$this->weight = $x['weight'];
$this->port = $x['port'];
$offset = $packet->offset + 6;
$this->target = Net_DNS2_Packet::expand($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->target) > 0) {
$data = pack('nnn', $this->priority, $this->weight, $this->port);
$packet->offset += 6;
$data .= $packet->compress($this->target, $packet->offset);
return $data;
}
return null;
}
}
?>
+250
View File
@@ -0,0 +1,250 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* SSHFP Resource Record - RFC4255 section 3.1
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | algorithm | fp type | /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ /
* / /
* / fingerprint /
* / /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_SSHFP extends Net_DNS2_RR
{
/*
* the algorithm used
*/
public $algorithm;
/*
* The finger print type
*/
public $fp_type;
/*
* the finger print data
*/
public $fingerprint;
/*
* Algorithms
*/
const SSHFP_ALGORITHM_RES = 0;
const SSHFP_ALGORITHM_RSA = 1;
const SSHFP_ALGORITHM_DSS = 2;
const SSHFP_ALGORITHM_ECDSA = 3;
/*
* Fingerprint Types
*/
const SSHFP_FPTYPE_RES = 0;
const SSHFP_FPTYPE_SHA1 = 1;
const SSHFP_FPTYPE_SHA256 = 2;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->algorithm . ' ' . $this->fp_type . ' ' . $this->fingerprint;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
//
// "The use of mnemonics instead of numbers is not allowed."
//
// RFC4255 section 3.2
//
$algorithm = array_shift($rdata);
$fp_type = array_shift($rdata);
$fingerprint = strtolower(implode('', $rdata));
//
// There are only two algorithm's defined
//
if ( ($algorithm != self::SSHFP_ALGORITHM_RSA)
&& ($algorithm != self::SSHFP_ALGORITHM_DSS)
&& ($algorithm != self::SSHFP_ALGORITHM_ECDSA)
) {
return false;
}
//
// there are only two fingerprints defined
//
if ( ($fp_type != self::SSHFP_FPTYPE_SHA1)
&& ($fp_type != self::SSHFP_FPTYPE_SHA256)
) {
return false;
}
$this->algorithm = $algorithm;
$this->fp_type = $fp_type;
$this->fingerprint = $fingerprint;
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the algorithm and finger print type
//
$x = unpack('Calgorithm/Cfp_type', $this->rdata);
$this->algorithm = $x['algorithm'];
$this->fp_type = $x['fp_type'];
//
// There are only three algorithm's defined
//
if ( ($this->algorithm != self::SSHFP_ALGORITHM_RSA)
&& ($this->algorithm != self::SSHFP_ALGORITHM_DSS)
&& ($this->algorithm != self::SSHFP_ALGORITHM_ECDSA)
) {
return false;
}
//
// there are only two fingerprints defined
//
if ( ($this->fp_type != self::SSHFP_FPTYPE_SHA1)
&& ($this->fp_type != self::SSHFP_FPTYPE_SHA256)
) {
return false;
}
//
// parse the finger print; this assumes SHA-1
//
$fp = unpack('H*a', substr($this->rdata, 2));
$this->fingerprint = strtolower($fp['a']);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->fingerprint) > 0) {
$data = pack(
'CCH*', $this->algorithm, $this->fp_type, $this->fingerprint
);
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+75
View File
@@ -0,0 +1,75 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2011, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2011 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.2.0
*
*/
/**
* The TA RR is implemented exactly like the DS record, so
* for now we just extend the DS RR and use it.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_TA extends Net_DNS2_RR_DS
{
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+171
View File
@@ -0,0 +1,171 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2011, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2011 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.2.0
*
*/
/**
* TALINK Resource Record - DNSSEC Trust Anchor
*
* http://tools.ietf.org/id/draft-ietf-dnsop-dnssec-trust-history-00.txt
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / PREVIOUS /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / NEXT /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_TALINK extends Net_DNS2_RR
{
/*
* the previous domain name
*/
public $previous;
/*
* the next domain name
*/
public $next;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->cleanString($this->previous) . '. ' .
$this->cleanString($this->next) . '.';
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->previous = $this->cleanString($rdata[0]);
$this->next = $this->cleanString($rdata[1]);
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
$offset = $packet->offset;
$this->previous = Net_DNS2_Packet::label($packet, $offset);
$this->next = Net_DNS2_Packet::label($packet, $offset);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if ( (strlen($this->previous) > 0) || (strlen($this->next) > 0) ) {
$data = chr(strlen($this->previous)) . $this->previous .
chr(strlen($this->next)) . $this->next;
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+307
View File
@@ -0,0 +1,307 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 0.6.0
*
*/
/**
* TKEY Resource Record - RFC 2930 section 2
*
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / ALGORITHM /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | INCEPTION |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | EXPIRATION |
* | |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | MODE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ERROR |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | KEY SIZE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / KEY DATA /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | OTHER SIZE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* / OTHER DATA /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_TKEY extends Net_DNS2_RR
{
public $algorithm;
public $inception;
public $expiration;
public $mode;
public $error;
public $key_size;
public $key_data;
public $other_size;
public $other_data;
/*
* TSIG Modes
*/
const TSIG_MODE_RES = 0;
const TSIG_MODE_SERV_ASSIGN = 1;
const TSIG_MODE_DH = 2;
const TSIG_MODE_GSS_API = 3;
const TSIG_MODE_RESV_ASSIGN = 4;
const TSIG_MODE_KEY_DELE = 5;
/*
* map the mod id's to names so we can validate
*/
public $tsgi_mode_id_to_name = array(
self::TSIG_MODE_RES => 'Reserved',
self::TSIG_MODE_SERV_ASSIGN => 'Server Assignment',
self::TSIG_MODE_DH => 'Diffie-Hellman',
self::TSIG_MODE_GSS_API => 'GSS-API',
self::TSIG_MODE_RESV_ASSIGN => 'Resolver Assignment',
self::TSIG_MODE_KEY_DELE => 'Key Deletion'
);
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
$out = $this->cleanString($this->algorithm) . '. ' . $this->mode;
if ($this->key_size > 0) {
$out .= ' ' . trim($this->key_data, '.') . '.';
} else {
$out .= ' .';
}
return $out;
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
//
// data passed in is assumed: <algorithm> <mode> <key>
//
$this->algorithm = $this->cleanString(array_shift($rdata));
$this->mode = array_shift($rdata);
$this->key_data = trim(array_shift($rdata), '.');
//
// the rest of the data is set manually
//
$this->inception = time();
$this->expiration = time() + 86400; // 1 day
$this->error = 0;
$this->key_size = strlen($this->key_data);
$this->other_size = 0;
$this->other_data = '';
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// expand the algorithm
//
$offset = $packet->offset;
$this->algorithm = Net_DNS2_Packet::expand($packet, $offset);
//
// unpack inception, expiration, mode, error and key size
//
$x = unpack(
'@' . $offset . '/Ninception/Nexpiration/nmode/nerror/nkey_size',
$packet->rdata
);
$this->inception = Net_DNS2::expandUint32($x['inception']);
$this->expiration = Net_DNS2::expandUint32($x['expiration']);
$this->mode = $x['mode'];
$this->error = $x['error'];
$this->key_size = $x['key_size'];
$offset += 14;
//
// if key_size > 0, then copy out the key
//
if ($this->key_size > 0) {
$this->key_data = substr($packet->rdata, $offset, $this->key_size);
$offset += $this->key_size;
}
//
// unpack the other length
//
$x = unpack('@' . $offset . '/nother_size', $packet->rdata);
$this->other_size = $x['other_size'];
$offset += 2;
//
// if other_size > 0, then copy out the data
//
if ($this->other_size > 0) {
$this->other_data = substr(
$packet->rdata, $offset, $this->other_size
);
}
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->algorithm) > 0) {
//
// make sure the size values are correct
//
$this->key_size = strlen($this->key_data);
$this->other_size = strlen($this->other_data);
//
// add the algorithm without compression
//
$data = Net_DNS2_Packet::pack($this->algorithm);
//
// pack in the inception, expiration, mode, error and key size
//
$data .= pack(
'NNnnn', $this->inception, $this->expiration,
$this->mode, 0, $this->key_size
);
//
// if the key_size > 0, then add the key
//
if ($this->key_size > 0) {
$data .= $this->key_data;
}
//
// pack in the other size
//
$data .= pack('n', $this->other_size);
if ($this->other_size > 0) {
$data .= $this->other_data;
}
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>
+194
View File
@@ -0,0 +1,194 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* DNS Library for handling lookups and updates.
*
* PHP Version 5
*
* Copyright (c) 2012, Mike Pultz <mike@mikepultz.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Mike Pultz nor the names of his contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @copyright 2012 Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/Net_DNS2
* @since File available since Release 1.2.5
*
*/
/**
* TLSA Resource Record - RFC 6698
*
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Cert. Usage | Selector | Matching Type | /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ /
* / /
* / Certificate Association Data /
* / /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @category Networking
* @package Net_DNS2
* @author Mike Pultz <mike@mikepultz.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Net_DNS2
* @see Net_DNS2_RR
*
*/
class Net_DNS2_RR_TLSA extends Net_DNS2_RR
{
/*
* The Certificate Usage Field
*/
public $cert_usage;
/*
* The Selector Field
*/
public $selector;
/*
* The Matching Type Field
*/
public $matching_type;
/*
* The Certificate Association Data Field
*/
public $certificate;
/**
* method to return the rdata portion of the packet as a string
*
* @return string
* @access protected
*
*/
protected function rrToString()
{
return $this->cert_usage . ' ' . $this->selector . ' ' .
$this->matching_type . ' ' . base64_encode($this->certificate);
}
/**
* parses the rdata portion from a standard DNS config line
*
* @param array $rdata a string split line of values for the rdata
*
* @return boolean
* @access protected
*
*/
protected function rrFromString(array $rdata)
{
$this->cert_usage = array_shift($rdata);
$this->selector = array_shift($rdata);
$this->matching_type = array_shift($rdata);
$this->certificate = base64_decode(implode('', $rdata));
return true;
}
/**
* parses the rdata of the Net_DNS2_Packet object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
*
* @return boolean
* @access protected
*
*/
protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {
//
// unpack the format, keytag and algorithm
//
$x = unpack('Cusage/Cselector/Ctype', $this->rdata);
$this->cert_usage = $x['usage'];
$this->selector = $x['selector'];
$this->matching_type = $x['type'];
//
// copy the certificate
//
$this->certificate = substr($this->rdata, 3, $this->rdlength - 3);
return true;
}
return false;
}
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->certificate) > 0) {
$data = pack(
'CCC', $this->cert_usage, $this->selector, $this->matching_type
) . $this->certificate;
$packet->offset += strlen($data);
return $data;
}
return null;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>

Some files were not shown because too many files have changed in this diff Show More