Browse Source

Merge branch '1.10.x' of https://github.com/chamilo/chamilo-lms into 9071

Angel Fernando Quiroz Campos 10 years ago
parent
commit
4d7a10ee23
100 changed files with 445 additions and 8035 deletions
  1. 15 0
      .gitattributes
  2. 1 0
      .gitignore
  3. 34 1
      composer.json
  4. 139 47
      composer.lock
  5. 25 4
      documentation/optimization.html
  6. 6 6
      main/admin/usergroup_export.php
  7. 26 6
      main/admin/usergroup_import.php
  8. 30 35
      main/announcements/announcements.php
  9. 1 1
      main/course_notice/index.php
  10. 108 10
      main/cron/import_csv.php
  11. 0 3
      main/cron/user_import/client.php
  12. 5 5
      main/document/create_audio.php
  13. 18 18
      main/document/file.php
  14. 3 3
      main/exercice/export/aiken/aiken_import.inc.php
  15. 15 10
      main/gradebook/lib/be/studentpublicationlink.class.php
  16. 0 2
      main/inc/ajax/install.ajax.php
  17. 0 18
      main/inc/autoload.inc.php
  18. 14 10
      main/inc/global.inc.php
  19. 0 0
      main/inc/lib/AnnouncementEmail.php
  20. 3 0
      main/inc/lib/add_course.lib.inc.php
  21. 1 1
      main/inc/lib/autoload.class.php
  22. 1 2
      main/inc/lib/certificate.lib.php
  23. 0 3072
      main/inc/lib/ezpdf/class.pdf.php
  24. 0 2
      main/inc/lib/formvalidator/Rule/allowed_tags.inc.php
  25. 0 1
      main/inc/lib/htmlpurifier/VERSION
  26. 0 64
      main/inc/lib/htmlpurifier/configdoc/generate.php
  27. 0 6
      main/inc/lib/htmlpurifier/configdoc/index.html
  28. 0 6
      main/inc/lib/htmlpurifier/configdoc/styles/index.html
  29. 0 253
      main/inc/lib/htmlpurifier/configdoc/styles/plain.xsl
  30. 0 69
      main/inc/lib/htmlpurifier/configdoc/types.xml
  31. 0 472
      main/inc/lib/htmlpurifier/configdoc/usage.xml
  32. 0 86
      main/inc/lib/htmlpurifier/extras/ConfigDoc/HTMLXSLTProcessor.php
  33. 0 6
      main/inc/lib/htmlpurifier/extras/ConfigDoc/index.html
  34. 0 157
      main/inc/lib/htmlpurifier/extras/FSTools.php
  35. 0 126
      main/inc/lib/htmlpurifier/extras/FSTools/File.php
  36. 0 6
      main/inc/lib/htmlpurifier/extras/FSTools/index.html
  37. 0 25
      main/inc/lib/htmlpurifier/extras/HTMLPurifierExtras.autoload.php
  38. 0 29
      main/inc/lib/htmlpurifier/extras/HTMLPurifierExtras.php
  39. 0 6
      main/inc/lib/htmlpurifier/extras/index.html
  40. 0 6
      main/inc/lib/htmlpurifier/index.html
  41. 0 26
      main/inc/lib/htmlpurifier/library/HTMLPurifier.autoload.php
  42. 0 23
      main/inc/lib/htmlpurifier/library/HTMLPurifier.func.php
  43. 0 212
      main/inc/lib/htmlpurifier/library/HTMLPurifier.includes.php
  44. 0 30
      main/inc/lib/htmlpurifier/library/HTMLPurifier.kses.php
  45. 0 237
      main/inc/lib/htmlpurifier/library/HTMLPurifier.php
  46. 0 206
      main/inc/lib/htmlpurifier/library/HTMLPurifier.safe-includes.php
  47. 0 128
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrCollections.php
  48. 0 123
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef.php
  49. 0 87
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS.php
  50. 0 21
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php
  51. 0 87
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php
  52. 0 133
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php
  53. 0 43
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Border.php
  54. 0 78
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Color.php
  55. 0 38
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Composite.php
  56. 0 28
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php
  57. 0 54
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Filter.php
  58. 0 149
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Font.php
  59. 0 72
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php
  60. 0 40
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php
  61. 0 47
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Length.php
  62. 0 78
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ListStyle.php
  63. 0 58
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Multiple.php
  64. 0 69
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Number.php
  65. 0 40
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Percentage.php
  66. 0 38
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php
  67. 0 52
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/URI.php
  68. 0 6
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/index.html
  69. 0 65
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/Enum.php
  70. 0 28
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Bool.php
  71. 0 34
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Class.php
  72. 0 32
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Color.php
  73. 0 21
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/FrameTarget.php
  74. 0 70
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/ID.php
  75. 0 41
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Length.php
  76. 0 53
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/LinkTypes.php
  77. 0 41
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/MultiLength.php
  78. 0 52
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Nmtokens.php
  79. 0 48
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Pixels.php
  80. 0 6
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/index.html
  81. 0 73
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/Integer.php
  82. 0 73
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/Lang.php
  83. 0 34
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/Switch.php
  84. 0 15
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/Text.php
  85. 0 77
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI.php
  86. 0 17
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email.php
  87. 0 21
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php
  88. 0 6
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email/index.html
  89. 0 68
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php
  90. 0 39
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/IPv4.php
  91. 0 99
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/IPv6.php
  92. 0 6
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/index.html
  93. 0 6
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/index.html
  94. 0 56
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform.php
  95. 0 23
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/Background.php
  96. 0 19
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/BdoDir.php
  97. 0 23
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/BgColor.php
  98. 0 36
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/BoolToCSS.php
  99. 0 18
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/Border.php
  100. 0 58
      main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/EnumToCSS.php

+ 15 - 0
.gitattributes

@@ -2,3 +2,18 @@
 .gitignore export-ignore
 .travis.yml export-ignore
 /tests export-ignore
+
+/vendor/ezyang/htmlpurifier/docs export-ignore
+/vendor/ezyang/htmlpurifier/benchmarks export-ignore
+/vendor/ezyang/htmlpurifier/tests export-ignore
+/vendor/ezyang/htmlpurifier/smoketests export-ignore
+/vendor/ezyang/htmlpurifier/package.php export-ignore
+/vendor/ezyang/htmlpurifier/release1-update.php export-ignore
+/vendor/ezyang/htmlpurifier/release2-tag.php export-ignore
+/vendor/ezyang/htmlpurifier/test-settings.sample.php export-ignore
+/vendor/twig/twig/test export-ignore
+/vendor/monolog/monolog/tests/ export-ignore
+/vendor/neutron/temporary-filesystem/tests export-ignore
+/vendor/sabre/vobject/tests export-ignore
+/vendor/twig/twig/test export-ignore
+/vendor/symfony/console/Symfony/Component/Console/Tests export-ignore

+ 1 - 0
.gitignore

@@ -35,3 +35,4 @@ searchdb/*
 nbproject/*
 
 plugin/bbb/config.vm.php
+main/cron/incoming/*

+ 34 - 1
composer.json

@@ -1,11 +1,44 @@
 {
+    "name": "chamilo/chamilo-lms",
+    "description": "E-learning and collaboration software",
+    "type": "project",
+    "homepage": "http://www.chamilo.org",
+    "license": "GPL-3.0",
+    "support": {
+        "forum": "http://www.chamilo.org/forum",
+        "irc": "irc://irc.freenode.org/chamilo"
+    },
+    "autoload": {
+        "classmap": [
+            "main/auth",
+            "main/admin",
+            "main/cron/lang",
+            "main/coursecopy",
+            "main/exercice",
+            "main/gradebook/lib",
+            "main/newscorm",
+            "main/inc/lib",
+            "plugin",
+            "main/install",
+            "main/inc/lib/getid3",
+            "main/survey"
+        ]
+    },
     "require": {
+        "php": ">=5.3.3",
         "php-ffmpeg/php-ffmpeg": "0.3.x-dev@dev",
         "sabre/vobject": "~3.1",
         "toin0u/digitalocean": "~1.4",
         "twig/twig": "1.*",
         "michelf/php-markdown": "1.4.1",
         "emojione/emojione": "1.3.0",
-        "zendframework/zend-config": "2.3.3"
+        "zendframework/zend-config": "2.3.3",
+        "ezyang/htmlpurifier": "4.6.0",
+        "aferrandini/phpqrcode": "1.0.1"
+    },
+    "extra": {
+        "branch-alias": {
+            "dev-master": "1.10.x-dev"
+        }
     }
 }

+ 139 - 47
composer.lock

@@ -4,8 +4,52 @@
         "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "1abe77cf0b8752805b4ac0e3cde352b0",
+    "hash": "a422c2e4eb5cfff2fa4784fd9036ed9c",
     "packages": [
+        {
+            "name": "aferrandini/phpqrcode",
+            "version": "1.0.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/aferrandini/PHPQRCode.git",
+                "reference": "3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/aferrandini/PHPQRCode/zipball/3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46",
+                "reference": "3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "PHPQRCode": "lib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Ariel Ferrandini",
+                    "email": "arielferrandini@gmail.com",
+                    "homepage": "http://www.ferrandini.com/",
+                    "role": "Developer"
+                }
+            ],
+            "description": "PHPQRCode porting and changed for PHP 5.3 compatibility",
+            "homepage": "https://github.com/aferrandini/PHPQRCode",
+            "keywords": [
+                "barcode",
+                "php",
+                "qrcode"
+            ],
+            "time": "2013-07-08 09:39:08"
+        },
         {
             "name": "alchemy/binary-driver",
             "version": "1.5.0",
@@ -65,16 +109,16 @@
         },
         {
             "name": "doctrine/cache",
-            "version": "v1.3.1",
+            "version": "v1.4.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/cache.git",
-                "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7"
+                "reference": "2346085d2b027b233ae1d5de59b07440b9f288c8"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/cache/zipball/cf483685798a72c93bf4206e3dd6358ea07d64e7",
-                "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7",
+                "url": "https://api.github.com/repos/doctrine/cache/zipball/2346085d2b027b233ae1d5de59b07440b9f288c8",
+                "reference": "2346085d2b027b233ae1d5de59b07440b9f288c8",
                 "shasum": ""
             },
             "require": {
@@ -85,6 +129,7 @@
             },
             "require-dev": {
                 "phpunit/phpunit": ">=3.7",
+                "predis/predis": "~0.8",
                 "satooshi/php-coveralls": "~0.6"
             },
             "type": "library",
@@ -130,7 +175,7 @@
                 "cache",
                 "caching"
             ],
-            "time": "2014-09-17 14:24:04"
+            "time": "2015-01-15 20:38:55"
         },
         {
             "name": "emojione/emojione",
@@ -210,6 +255,50 @@
             ],
             "time": "2012-05-30 15:01:08"
         },
+        {
+            "name": "ezyang/htmlpurifier",
+            "version": "v4.6.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/ezyang/htmlpurifier.git",
+                "reference": "6f389f0f25b90d0b495308efcfa073981177f0fd"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/6f389f0f25b90d0b495308efcfa073981177f0fd",
+                "reference": "6f389f0f25b90d0b495308efcfa073981177f0fd",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.2"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "HTMLPurifier": "library/"
+                },
+                "files": [
+                    "library/HTMLPurifier.composer.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL"
+            ],
+            "authors": [
+                {
+                    "name": "Edward Z. Yang",
+                    "email": "admin@htmlpurifier.org",
+                    "homepage": "http://ezyang.com"
+                }
+            ],
+            "description": "Standards compliant HTML filter written in PHP",
+            "homepage": "http://htmlpurifier.org/",
+            "keywords": [
+                "html"
+            ],
+            "time": "2013-11-30 08:25:19"
+        },
         {
             "name": "michelf/php-markdown",
             "version": "1.4.1",
@@ -263,16 +352,16 @@
         },
         {
             "name": "monolog/monolog",
-            "version": "1.11.0",
+            "version": "1.12.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/Seldaek/monolog.git",
-                "reference": "ec3961874c43840e96da3a8a1ed20d8c73d7e5aa"
+                "reference": "1fbe8c2641f2b163addf49cc5e18f144bec6b19f"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/Seldaek/monolog/zipball/ec3961874c43840e96da3a8a1ed20d8c73d7e5aa",
-                "reference": "ec3961874c43840e96da3a8a1ed20d8c73d7e5aa",
+                "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1fbe8c2641f2b163addf49cc5e18f144bec6b19f",
+                "reference": "1fbe8c2641f2b163addf49cc5e18f144bec6b19f",
                 "shasum": ""
             },
             "require": {
@@ -286,7 +375,7 @@
                 "aws/aws-sdk-php": "~2.4, >2.4.8",
                 "doctrine/couchdb": "~1.0@dev",
                 "graylog2/gelf-php": "~1.0",
-                "phpunit/phpunit": "~3.7.0",
+                "phpunit/phpunit": "~4.0",
                 "raven/raven": "~0.5",
                 "ruflin/elastica": "0.90.*",
                 "videlalvaro/php-amqplib": "~2.4"
@@ -305,7 +394,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.11.x-dev"
+                    "dev-master": "1.12.x-dev"
                 }
             },
             "autoload": {
@@ -331,7 +420,7 @@
                 "logging",
                 "psr-3"
             ],
-            "time": "2014-09-30 13:30:58"
+            "time": "2014-12-29 21:29:35"
         },
         {
             "name": "neutron/temporary-filesystem",
@@ -482,16 +571,16 @@
         },
         {
             "name": "sabre/vobject",
-            "version": "3.3.4",
+            "version": "3.3.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/fruux/sabre-vobject.git",
-                "reference": "e7cbc59a7a77325dfa32924865e1802c9216a3e0"
+                "reference": "77cb636a5bde4c19d7522c2c548b258859ddd1ef"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/fruux/sabre-vobject/zipball/e7cbc59a7a77325dfa32924865e1802c9216a3e0",
-                "reference": "e7cbc59a7a77325dfa32924865e1802c9216a3e0",
+                "url": "https://api.github.com/repos/fruux/sabre-vobject/zipball/77cb636a5bde4c19d7522c2c548b258859ddd1ef",
+                "reference": "77cb636a5bde4c19d7522c2c548b258859ddd1ef",
                 "shasum": ""
             },
             "require": {
@@ -544,21 +633,21 @@
                 "jCard",
                 "vCard"
             ],
-            "time": "2014-11-19 22:15:24"
+            "time": "2015-01-10 00:54:52"
         },
         {
             "name": "symfony/console",
-            "version": "v2.6.1",
+            "version": "v2.6.4",
             "target-dir": "Symfony/Component/Console",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/Console.git",
-                "reference": "ef825fd9f809d275926547c9e57cbf14968793e8"
+                "reference": "e44154bfe3e41e8267d7a3794cd9da9a51cfac34"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/Console/zipball/ef825fd9f809d275926547c9e57cbf14968793e8",
-                "reference": "ef825fd9f809d275926547c9e57cbf14968793e8",
+                "url": "https://api.github.com/repos/symfony/Console/zipball/e44154bfe3e41e8267d7a3794cd9da9a51cfac34",
+                "reference": "e44154bfe3e41e8267d7a3794cd9da9a51cfac34",
                 "shasum": ""
             },
             "require": {
@@ -601,21 +690,21 @@
             ],
             "description": "Symfony Console Component",
             "homepage": "http://symfony.com",
-            "time": "2014-12-02 20:19:20"
+            "time": "2015-01-25 04:39:26"
         },
         {
             "name": "symfony/filesystem",
-            "version": "v2.6.1",
+            "version": "v2.6.4",
             "target-dir": "Symfony/Component/Filesystem",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/Filesystem.git",
-                "reference": "ff6efc95256cb33031933729e68b01d720b5436b"
+                "reference": "a1f566d1f92e142fa1593f4555d6d89e3044a9b7"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/Filesystem/zipball/ff6efc95256cb33031933729e68b01d720b5436b",
-                "reference": "ff6efc95256cb33031933729e68b01d720b5436b",
+                "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a1f566d1f92e142fa1593f4555d6d89e3044a9b7",
+                "reference": "a1f566d1f92e142fa1593f4555d6d89e3044a9b7",
                 "shasum": ""
             },
             "require": {
@@ -648,21 +737,21 @@
             ],
             "description": "Symfony Filesystem Component",
             "homepage": "http://symfony.com",
-            "time": "2014-12-02 20:19:20"
+            "time": "2015-01-03 21:13:09"
         },
         {
             "name": "symfony/process",
-            "version": "v2.6.1",
+            "version": "v2.6.4",
             "target-dir": "Symfony/Component/Process",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/Process.git",
-                "reference": "bf0c9bd625f13b0b0bbe39919225cf145dfb935a"
+                "reference": "ecfc23e89d9967999fa5f60a1e9af7384396e9ae"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/Process/zipball/bf0c9bd625f13b0b0bbe39919225cf145dfb935a",
-                "reference": "bf0c9bd625f13b0b0bbe39919225cf145dfb935a",
+                "url": "https://api.github.com/repos/symfony/Process/zipball/ecfc23e89d9967999fa5f60a1e9af7384396e9ae",
+                "reference": "ecfc23e89d9967999fa5f60a1e9af7384396e9ae",
                 "shasum": ""
             },
             "require": {
@@ -695,21 +784,21 @@
             ],
             "description": "Symfony Process Component",
             "homepage": "http://symfony.com",
-            "time": "2014-12-02 20:19:20"
+            "time": "2015-01-25 04:39:26"
         },
         {
             "name": "symfony/yaml",
-            "version": "v2.6.1",
+            "version": "v2.6.4",
             "target-dir": "Symfony/Component/Yaml",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/Yaml.git",
-                "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20"
+                "reference": "60ed7751671113cf1ee7d7778e691642c2e9acd8"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/Yaml/zipball/3346fc090a3eb6b53d408db2903b241af51dcb20",
-                "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20",
+                "url": "https://api.github.com/repos/symfony/Yaml/zipball/60ed7751671113cf1ee7d7778e691642c2e9acd8",
+                "reference": "60ed7751671113cf1ee7d7778e691642c2e9acd8",
                 "shasum": ""
             },
             "require": {
@@ -742,7 +831,7 @@
             ],
             "description": "Symfony Yaml Component",
             "homepage": "http://symfony.com",
-            "time": "2014-12-02 20:19:20"
+            "time": "2015-01-25 04:39:26"
         },
         {
             "name": "toin0u/digitalocean",
@@ -866,16 +955,16 @@
         },
         {
             "name": "twig/twig",
-            "version": "v1.16.2",
+            "version": "v1.18.0",
             "source": {
                 "type": "git",
-                "url": "https://github.com/fabpot/Twig.git",
-                "reference": "42f758d9fe2146d1f0470604fc05ee43580873fc"
+                "url": "https://github.com/twigphp/Twig.git",
+                "reference": "4cf7464348e7f9893a93f7096a90b73722be99cf"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/fabpot/Twig/zipball/42f758d9fe2146d1f0470604fc05ee43580873fc",
-                "reference": "42f758d9fe2146d1f0470604fc05ee43580873fc",
+                "url": "https://api.github.com/repos/twigphp/Twig/zipball/4cf7464348e7f9893a93f7096a90b73722be99cf",
+                "reference": "4cf7464348e7f9893a93f7096a90b73722be99cf",
                 "shasum": ""
             },
             "require": {
@@ -884,7 +973,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.16-dev"
+                    "dev-master": "1.18-dev"
                 }
             },
             "autoload": {
@@ -910,7 +999,7 @@
                 },
                 {
                     "name": "Twig Team",
-                    "homepage": "https://github.com/fabpot/Twig/graphs/contributors",
+                    "homepage": "http://twig.sensiolabs.org/contributors",
                     "role": "Contributors"
                 }
             ],
@@ -919,7 +1008,7 @@
             "keywords": [
                 "templating"
             ],
-            "time": "2014-10-17 12:53:44"
+            "time": "2015-01-25 17:32:08"
         },
         {
             "name": "zendframework/zend-config",
@@ -1035,6 +1124,9 @@
         "php-ffmpeg/php-ffmpeg": 20
     },
     "prefer-stable": false,
-    "platform": [],
+    "prefer-lowest": false,
+    "platform": {
+        "php": ">=5.3.3"
+    },
     "platform-dev": []
 }

+ 25 - 4
documentation/optimization.html

@@ -51,6 +51,7 @@
   <li><a href="#9.xsendfile">Speeding file downloads with mod_xsendfile</a></li>
   <li><a href="#10.igbinary">IGBinary for faster courses backups and better sessions</a></li>
   <li><a href="#11.permissions-check">Removing files download permissions check</a></li>
+  <li><a href="#12.MySQL-compression">MySQL/MariaDB compression</a></li>
 </ol>
 
 <h2><a name="1.Using-XCache"></a>1. Using xCache or APC</h2>
@@ -355,12 +356,14 @@ Don't have time or resources to optimize your Chamilo installation yourself? Hir
 		<img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" style="margin: 1em; float: right;" alt="Valid CSS" />
 	</a>
 <hr />
+
 <h2><a name="7.High-numbers-memory"></a>Memory considerations for high numbers of users</h2>
 Some administration scripts *have to* handle lists of all users, and this might have a considerable impact on portals with very high numbers of users. For example, the main/admin/add_users_to_session.php script that handles the registration of users into a specific session, if used with the (non-default) full list of users, will devour about 3KB per user, which, for 100,000 users, translates into the need for around 300MB of RAM just to show this page, and to around 3GB for 1,000,000 users.<br />
 This mode is not loaded by default, but could still be selected, leading to a "Fatal error: Allowed memory size ... exhausted" message.<br />
 The only non-scripted solution here is to allow for the corresponding amount of RAM for your PHP configuration (<em>memory_limit = 300M</em>) or your specific VirtualHost if you use mod-php5 (<em>php_value memory_limit 300M</em>).<br/>
 <hr />
-<h2><a name="#8.Avoid-non-fixed-values"></a>Avoiding non-fixed values</h2>
+
+<h2><a name="8.Avoid-non-fixed-values"></a>Avoiding non-fixed values</h2>
 Many things in Chamilo are written focusing on the ease of use, even for the administrator. Sometimes, these settings are weighing a little bit more on the system. This is the case, between others, of the mail.conf.php file (being loaded unconditionally) and its CONSTANT "IS_WINDOWS_OS", which is defined by a function call (api_is_windows_os()) at the beginning of main_api.lib.php.
 
 The definition of this constant (which is executed at *every* page load) can easily be avoided, and the only place where it is used inconditionally (mail.conf.php) can be modified to set the line as you expect it (depending on whether you use sendmail/exim or smtp).
@@ -373,7 +376,7 @@ $platform_email['SMTP_MAILER']       = 'mail';
 </pre>
 In fact, the complete loading of mail.conf.php can also be avoided if loaded conditionally (with <i>require_once</i>) when sending an e-mail (which is the only case where it is useful).
 <hr />
-<h2><a name="#9.xsendfile"></a>Speeding file downloads with mod_xsendfile</h2>
+<h2><a name="9.xsendfile"></a>Speeding file downloads with mod_xsendfile</h2>
 <p>It might have come to your attention that file downloads through Chamilo might get slow, under default conditions, in particular using Apache 2.</p>
 <p>There are several ways to fix this, one of which is removing the .htaccess inside the courses/ directory. This, however, will remove all permissions checks on the files contained in this directory, so... most of the time, not ideal unless your portal is *really* open to the world.</p>
 <p>Another technique, revealed to us by <a href="http://stackoverflow.com/users/46594/virtualblackfox">VirtualBlackFox</a> on <a href="http://stackoverflow.com/questions/3697748/fastest-way-to-serve-a-file-using-php">this Stackoverflow post</a>, is to use the X-SendFile module for Apache 2.2+ (other web servers might offer other solutions, or avoid the problem initially).</p>
@@ -398,11 +401,13 @@ $_configuration['enable_x_sendfile_headers'] = true;
 </pre>
 Done! Now your downloads should go substantially faster. This is still a feature in observation. We're not sure the benefits are sufficient, so don't hesitate to let us know in <a href="https://support.chamilo.org/issues/6853">the related issue in Chamilo's tracking system</a>
 </p>
-<h2><a name="#10.igbinary"></a>IGBinary for courses backups and better sessions management</h2>
+<hr />
+<h2><a name="10.igbinary"></a>IGBinary for courses backups and better sessions management</h2>
 <p>
 <a href="http://pecl.php.net/package/igbinary">IGBinary</a> is a small PECL library that replaces the PHP serializer. It uses less space (so less memory for serialized objects) and is particularly efficient with memory-based storages (like Memcached). Use it for course backups (see <a href="https://support.chamilo.org/issues/4443">issue 4443</a>) or <a href="http://www.neanderthal-technology.com/2011/11/ubuntu-10-install-php-memcached-with-igbinary-support/">to boost sessions management</a>.
 </p>
-<h2><a name="#11.permissions-check"></a>Removing files download permissions check</h2>
+<hr />
+<h2><a name="11.permissions-check"></a>Removing files download permissions check</h2>
 <p>
 This measure is not cumulative with mod_xsendfile explained above. It is not *recommended* either, as it removes an important security layer.<br />
 <br />
@@ -435,13 +440,29 @@ RewriteRule ([^/]+)/work/(.*)$ /main/work/download.php?file=work/$2&cDir=$1 [QSA
 </pre><br />
 This is easy, doesn't require a server reload and you should see the results pretty quickly. As mentioned above, if security of your content is an issue, though, you should avoid using this technique.
 </p>
+<hr />
+<h2><a name="12.MySQL-compression"></a>MySQL/MariaDB compression</h2>
 <p>
+If your database server is separate from your web server, you have to play with bandwidth, firewalls, and network restrictions in general.<br />
+In particular, when dealing with large-scale portals, the time a SQL query will take to return to the web server will take longer and, eventually, in the most critical cases, will take <b>too long</b>, and your web servers will be completely overloaded (load average very high because the system is waiting for I/O operations, but processors usage not being very high is a clear sign of this).<br />
+To solve this kind of issues, MySQL and MariaDB offer a data compression mechanism, which will reduce the amount of data passed between PHP and the database server. Ultimately, this reduction will lower bandwidth usage and reduce the impact of numerous and heavy data requests (and save you).<br />
+In 1.10.0, we have added the possibility to enable this compression very easily, from the configuration.php file, uncommenting the following line:
+<pre>
+//$_configuration['db_client_flags'] = MYSQL_CLIENT_COMPRESS;
+</pre>
+This should have an immediate effect on the load average on your server.
 </p>
 <hr />
 <h2>Authors</h2>
 <ul>
 <li>Yannick Warnier, Zend Certified PHP Engineer, BeezNest Belgium SPRL, <a href="mailto:ywarnier@beeznest.net">ywarnier@beeznest.net</a></li>
 </ul>
+<hr />
+Don't have time or resources to optimize your Chamilo installation yourself? Hire an <a href="http://www.chamilo.org/en/providers">official Chamilo provider</a> and get it sorted out professionally by specialists.
+    <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" style="margin: 1em; float: right;" height="31" width="88" /></a>
+	<a href="http://jigsaw.w3.org/css-validator/">
+		<img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" style="margin: 1em; float: right;" alt="Valid CSS" />
+	</a>
 </div>
 </body>
 </html>

+ 6 - 6
main/admin/usergroup_export.php

@@ -1,11 +1,10 @@
 <?php
 /* For licensing terms, see /license.txt */
+
 /**
  *	@package chamilo.admin
  */
-/**
- * Code
- */
+
 // name of the language file that needs to be included
 $language_file = 'admin';
 $cidReset = true;
@@ -29,14 +28,15 @@ $form->addElement('header', $tool_name);
 $form->addElement('style_submit_button', 'submit', get_lang('Export'), 'class="save"');
 
 if ($form->validate()) {
-    $user_group = new UserGroup;
-    $header = array(array('id', 'name', 'description'));
-    $data = $user_group->get_all_for_export();
+    $userGroup = new UserGroup();
+    $header = array(array('id', 'name', 'description', 'users'));
+    $data = $userGroup->getDataToExport();
     $data = array_merge($header, $data);
     $filename = 'export_classes_'.api_get_local_time();
     Export::export_table_csv($data, $filename);
     exit;
 }
+
 Display :: display_header($tool_name);
 $form->display();
 Display::display_footer();

+ 26 - 6
main/admin/usergroup_import.php

@@ -1,5 +1,6 @@
 <?php
 /* For licensing terms, see /license.txt */
+
 /**
  *  This tool allows platform admins to add classes by uploading a CSV file
  *  @todo Add some langvars to DLTT
@@ -13,7 +14,7 @@ function validate_data($classes) {
     $errors = array();
     $usergroup = new UserGroup();
     foreach ($classes as $index => $class) {
-        // 1. Check wheter ClassName is available.
+        // 1. Check of class name is available.
         if (!isset($class['name']) || strlen(trim($class['name'])) == 0) {
             $class['line'] = $index + 2;
             $class['error'] = get_lang('MissingClassName');
@@ -41,15 +42,34 @@ function validate_data($classes) {
  */
 function save_data($classes)
 {
-    $number_of_added_classes = 0;
+    $count = 0;
     $usergroup = new UserGroup();
     foreach ($classes as $index => $class) {
+        $usersToAdd = isset($class['users']) ? $class['users'] : null;
+        unset($class['users']);
         $id = $usergroup->save($class);
         if ($id) {
-            $number_of_added_classes++;
+            if (!empty($usersToAdd)) {
+                $usersToAddList = explode(',', $usersToAdd);
+                $userIdList = array();
+                foreach ($usersToAddList as $username) {
+                    $userInfo = api_get_user_info_from_username($username);
+                    $userIdList[] = $userInfo['user_id'];
+                }
+                if (!empty($userIdList)) {
+                    $usergroup->subscribe_users_to_usergroup(
+                        $id,
+                        $userIdList,
+                        false
+                    );
+                }
+            }
+
+            $count++;
         }
     }
-    return $number_of_added_classes;
+
+    return $count;
 }
 
 // Language files that should be included.
@@ -113,8 +133,8 @@ $form->display();
 <p><?php echo get_lang('CSVMustLookLike') . ' (' . get_lang('MandatoryFields') . ')'; ?> :</p>
 
 <pre>
-<b>name;description</b>
-"User group 1";"Description"
+<b>name;description;</b>users
+"User group 1";"Description";admin,username1,username2
 </pre>
 <?php
 // Displaying the footer.

+ 30 - 35
main/announcements/announcements.php

@@ -220,7 +220,6 @@ if (api_is_allowed_to_edit(false,true) OR
             // tooledit : visibility = 2 : only visible for platform administrator
             if ($ctok == $_GET['sec_token']) {
                 AnnouncementManager::delete_announcement($_course, $id);
-                //delete_added_resource("Ad_Valvas", $delete);
 
                 $id = null;
                 $emailTitle = null;
@@ -263,7 +262,7 @@ if (api_is_allowed_to_edit(false,true) OR
         $id = intval($_GET['id']);
 
         if (!api_is_course_coach() || api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $id)) {
-            $sql="SELECT * FROM  $tbl_announcement WHERE c_id = $course_id AND id = '$id'";
+            $sql = "SELECT * FROM  $tbl_announcement WHERE c_id = $course_id AND id = '$id'";
             $rs 	= Database::query($sql);
             $myrow  = Database::fetch_array($rs);
             $last_id = $id;
@@ -326,7 +325,6 @@ if (api_is_allowed_to_edit(false,true) OR
         while (list ($announcementId, $announcementOrder) = Database::fetch_row($result)) {
             // STEP 2 : FOUND THE NEXT ANNOUNCEMENT ID AND ORDER.
             //          COMMIT ORDER SWAP ON THE DB
-
             if ($thisAnnouncementOrderFound) {
                 $nextAnnouncementId = $announcementId;
                 $nextAnnouncementOrder = $announcementOrder;
@@ -471,7 +469,7 @@ if (api_is_allowed_to_edit(false,true))  {
 } else {
     // students only get to see the visible announcements
     if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') {
-        $group_memberships=GroupManager::get_group_ids($_course['real_id'], $_user['user_id']);
+        $group_memberships = GroupManager::get_group_ids($_course['real_id'], $_user['user_id']);
 
         if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
 
@@ -494,19 +492,19 @@ if (api_is_allowed_to_edit(false,true))  {
 
         // the user is member of several groups => display personal announcements AND his group announcements AND the general announcements
         if (is_array($group_memberships) && count($group_memberships)>0) {
-            $sql="SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id
-                FROM $tbl_announcement announcement, $tbl_item_property ip
-                WHERE
-                announcement.c_id = $course_id AND
-                ip.c_id = $course_id AND
-                announcement.id = ip.ref AND
-                ip.tool='announcement'
-                AND ip.visibility='1'
-                $cond_user_id
-                $condition_session
-                GROUP BY ip.ref
-                ORDER BY display_order DESC
-                LIMIT 0,$maximum";
+            $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id
+                    FROM $tbl_announcement announcement, $tbl_item_property ip
+                    WHERE
+                        announcement.c_id = $course_id AND
+                        ip.c_id = $course_id AND
+                        announcement.id = ip.ref AND
+                        ip.tool='announcement'
+                        AND ip.visibility='1'
+                        $cond_user_id
+                        $condition_session
+                    GROUP BY ip.ref
+                    ORDER BY display_order DESC
+                    LIMIT 0, $maximum";
         } else {
             // the user is not member of any group
             // this is an identified user => show the general announcements AND his personal announcements
@@ -520,16 +518,16 @@ if (api_is_allowed_to_edit(false,true))  {
                 $sql="SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id
                     FROM $tbl_announcement announcement, $tbl_item_property ip
                     WHERE
-                    announcement.c_id = $course_id AND
-                    ip.c_id = $course_id AND
-                    announcement.id = ip.ref
-                    AND ip.tool='announcement'
-                    AND ip.visibility='1'
-                    $cond_user_id
-                    $condition_session
+                        announcement.c_id = $course_id AND
+                        ip.c_id = $course_id AND
+                        announcement.id = ip.ref
+                        AND ip.tool='announcement'
+                        AND ip.visibility='1'
+                        $cond_user_id
+                        $condition_session
                     GROUP BY ip.ref
                     ORDER BY display_order DESC
-                    LIMIT 0,$maximum";
+                    LIMIT 0, $maximum";
             } else {
 
                 if (api_get_course_setting('allow_user_edit_announcement')) {
@@ -542,13 +540,13 @@ if (api_is_allowed_to_edit(false,true))  {
                 $sql="SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id
                     FROM $tbl_announcement announcement, $tbl_item_property ip
                     WHERE
-                    announcement.c_id = $course_id AND
-                    ip.c_id = $course_id AND
-                    announcement.id = ip.ref
-                    AND ip.tool='announcement'
-                    AND ip.visibility='1'
-                    AND ip.to_group_id='0'
-                    $condition_session
+                        announcement.c_id = $course_id AND
+                        ip.c_id = $course_id AND
+                        announcement.id = ip.ref
+                        AND ip.tool='announcement'
+                        AND ip.visibility='1'
+                        AND ip.to_group_id='0'
+                        $condition_session
                     GROUP BY ip.ref
                     ORDER BY display_order DESC
                     LIMIT 0,$maximum";
@@ -619,7 +617,6 @@ if ($display_form) {
     $title_to_modify 	= stripslashes($title_to_modify);
 
     // DISPLAY ADD ANNOUNCEMENT COMMAND
-    //echo '<form method="post" name="f1" enctype = "multipart/form-data" action="'.api_get_self().'?publish_survey='.Security::remove_XSS($surveyid).'&id='.Security::remove_XSS($_GET['id']).'&db_name='.$db_name.'&cidReq='.Security::remove_XSS($_GET['cidReq']).'" style="margin:0px;">';
     $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
     echo '<form class="form-horizontal" method="post" name="f1" enctype = "multipart/form-data" action="'.api_get_self().'?id='.$id.'&'.api_get_cidreq().'" style="margin:0px;">';
     if (empty($_GET['id'])) {
@@ -668,8 +665,6 @@ if ($display_form) {
                 $title_to_modify = sprintf(get_lang('RemindInactiveLearnersMailSubject'), api_get_setting('siteName'));
                 $content_to_modify = get_lang('YourAccountIsActiveYouCanLoginAndCheckYourCourses');
             }
-        } else {
-            //echo '<span id="recipient_overview">' . get_lang('Everybody') . '</span>';
         }
         AnnouncementManager::show_to_form($to);
         echo '		</div>

+ 1 - 1
main/course_notice/index.php

@@ -6,7 +6,7 @@
  * @license see /license.txt
  * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
  */
-require_once dirname(__FILE__) . '/../inc/autoload.inc.php';
+require_once dirname(__FILE__) . '/../../vendor/autoload.php';
 
 $controller = CourseNoticeController::instance();
 KeyAuth::enable_services($controller);

+ 108 - 10
main/cron/import_csv.php

@@ -109,7 +109,10 @@ class ImportCsv
                     $isStatic = strpos($method, 'Static');
 
                     if (method_exists($this, $method)) {
-                        if ($method == 'importUnsubscribeStatic' || empty($isStatic)) {
+                        if (($method == 'importUnsubscribeStatic' ||
+                            $method == 'importSubscribeStatic') ||
+                            empty($isStatic)
+                        ) {
                             $fileToProcess[$parts[1]][] = array(
                                 'method' => $method,
                                 'file' => $path.$fileInfo['basename']
@@ -144,8 +147,10 @@ class ImportCsv
                 'teachers',
                 'courses',
                 'sessions',
+                'subscribe-static',
                 'unsubscribe-static'
             );
+
             foreach ($sections as $section) {
                 $this->logger->addInfo("-- Import $section --");
 
@@ -169,6 +174,7 @@ class ImportCsv
                 'sessions-static',
                 'calendar-static',
             );
+
             foreach ($sections as $section) {
                 $this->logger->addInfo("-- Import static files $section --");
 
@@ -1010,7 +1016,6 @@ class ImportCsv
                     // 2014-06-30
                     $dateStart = explode('/', $session['DateStart']);
                     $dateEnd = explode('/', $session['DateEnd']);
-                    //$visibility = $session['visibility'];
                     $visibility = $this->defaultSessionVisibility;
 
                     $coachId = null;
@@ -1028,12 +1033,13 @@ class ImportCsv
                             $dateEnd[0],
                             $dateEnd[1],
                             $dateEnd[2],
-                            null, //$session['nb_days_access_before_beginning'],
-                            null, //$session['nb_days_access_after_end'],
+                            $this->daysCoachAccessBeforeBeginning,
+                            $this->daysCoachAccessAfterBeginning,
                             null,
                             $coachUserName,
                             $categoryId,
-                            $visibility
+                            $visibility,
+                            1
                         );
 
                         if (is_numeric($result)) {
@@ -1045,6 +1051,28 @@ class ImportCsv
                             );
                         }
                     } else {
+
+                        $sessionInfo = api_get_session_info($sessionId);
+                        $accessBefore = null;
+                        $accessAfter = null;
+
+                        if (empty($sessionInfo['nb_days_access_before_beginning']) ||
+                            (!empty($sessionInfo['nb_days_access_before_beginning']) &&
+                                $sessionInfo['nb_days_access_before_beginning'] < $this->daysCoachAccessBeforeBeginning)
+                        ) {
+                            $accessBefore = intval($this->daysCoachAccessBeforeBeginning);
+                        }
+
+                        $accessAfter = null;
+                        if (empty($sessionInfo['nb_days_access_after_end']) ||
+                            (!empty($sessionInfo['nb_days_access_after_end']) &&
+                                $sessionInfo['nb_days_access_after_end'] < $this->daysCoachAccessAfterBeginning)
+                        ) {
+                            $accessAfter = intval($this->daysCoachAccessAfterBeginning);
+                        }
+
+                        $showDescription = isset($sessionInfo['show_description']) ? $sessionInfo['show_description'] : 1;
+
                         $result = SessionManager::edit_session(
                             $sessionId,
                             $session['SessionName'],
@@ -1054,12 +1082,16 @@ class ImportCsv
                             $dateEnd[0],
                             $dateEnd[1],
                             $dateEnd[2],
-                            null,//$session['nb_days_access_before_beginning'],
-                            null,//$session['nb_days_access_after_end'],
+                            $accessBefore,
+                            $accessAfter,
                             null,
                             $coachId,
                             $categoryId,
-                            $visibility
+                            $visibility,
+                            true, //$start_limit =
+                            true, //$end_limit =
+                            null, //$description
+                            $showDescription // $showDescription = null,
                         );
 
                         if (is_numeric($result)) {
@@ -1183,7 +1215,10 @@ class ImportCsv
             $avoid,
             false, // deleteUsersNotInList
             false, // updateCourseCoaches
-            true // sessionWithCoursesModifier
+            true, // sessionWithCoursesModifier
+            true, //$addOriginalCourseTeachersAsCourseSessionCoaches
+            true, //$removeAllTeachersFromCourse
+            1 // $showDescription
         );
 
         if (!empty($result['error_message'])) {
@@ -1196,6 +1231,67 @@ class ImportCsv
         }
     }
 
+    /**
+     * @param string $file
+     */
+    private function importSubscribeStatic($file)
+    {
+        $data = Import::csv_reader($file);
+
+        if (!empty($data)) {
+            $this->logger->addInfo(count($data) . " records found.");
+            foreach ($data as $row) {
+                $chamiloUserName = $row['UserName'];
+                $chamiloCourseCode = $row['CourseCode'];
+                $chamiloSessionId = $row['SessionID'];
+                $type = $row['Type'];
+
+                $sessionInfo = api_get_session_info($chamiloSessionId);
+
+                if (empty($sessionInfo)) {
+                    $this->logger->addError('Session does not exists: '.$chamiloSessionId);
+                    continue;
+                }
+
+                $courseInfo = api_get_course_info($chamiloCourseCode);
+                if (empty($courseInfo)) {
+                    $this->logger->addError('Course does not exists: '.$courseInfo);
+                    continue;
+                }
+
+                $userId = Usermanager::get_user_id_from_username($chamiloUserName);
+
+                if (empty($userId)) {
+                    $this->logger->addError('User does not exists: '.$chamiloUserName);
+                    continue;
+                }
+                $status = null;
+                switch ($type) {
+                    case 'student':
+                        SessionManager::subscribe_users_to_session_course(
+                            array($userId),
+                            $chamiloSessionId,
+                            $courseInfo['code'],
+                            null,
+                            false
+                        );
+                        break;
+                    case 'teacher':
+                        SessionManager::set_coach_to_course_session(
+                            $userId,
+                            $chamiloSessionId,
+                            $courseInfo['code']
+                        );
+                        break;
+                }
+
+                $this->logger->addError(
+                    "User '$chamiloUserName' with status $type was added to session: #$chamiloSessionId - Course: " . $courseInfo['code']
+                );
+            }
+        }
+    }
+
     /**
      * @param string $file
      */
@@ -1231,7 +1327,9 @@ class ImportCsv
                 }
 
                 CourseManager::unsubscribe_user($userId, $courseInfo['code'], $chamiloSessionId);
-                $this->logger->addError("User '$chamiloUserName' was removed from session: #$chamiloSessionId, Course: ".$courseInfo['code']);
+                $this->logger->addError(
+                    "User '$chamiloUserName' was removed from session: #$chamiloSessionId, Course: ".$courseInfo['code']
+                );
             }
         }
     }

+ 0 - 3
main/cron/user_import/client.php

@@ -19,9 +19,6 @@ if (php_sapi_name()!='cli') {
     die();
 }
 
-// include nusoap library
-require_once(api_get_path(LIBRARY_PATH).'nusoap/nusoap.php');
-
 // create client
 $client = new nusoap_client(api_get_path(WEB_CODE_PATH).'cron/user_import/service.php');
 

+ 5 - 5
main/document/create_audio.php

@@ -28,7 +28,7 @@ if (api_get_setting('enabled_text2audio') == 'false'){
 	api_not_allowed(true);
 }
 
-$document_data = DocumentManager::get_document_data_by_id($_GET['id'], api_get_course_id());
+$document_data = DocumentManager::get_document_data_by_id($_REQUEST['id'], api_get_course_id());
 if (empty($document_data)) {
     if (api_is_in_group()) {
         $group_properties   = GroupManager::get_group_properties(api_get_group_id());
@@ -212,7 +212,7 @@ $(document).ready(function(){
 		echo '<div>';
 		$form = new FormValidator('form1', 'post', null, '', array('id' => 'form1'));
 		$form->addElement('hidden', 'text2voice_mode', 'google');
-		$form->addElement('hidden', 'document_id', $document_id);
+		$form->addElement('hidden', 'id', $document_id);
 		$form->addElement('text', 'title', get_lang('Title'));
 		$form->addElement('select', 'lang', get_lang('Language'), $options);
 		$form->addElement('textarea', 'text', get_lang('InsertText2Audio'), array('id' => 'textarea_google', 'class' =>'span6' ));
@@ -235,7 +235,7 @@ $(document).ready(function(){
 
 		$form = new FormValidator('form2', 'post', null, '', array('id' => 'form2'));
 		$form->addElement('hidden', 'text2voice_mode','pediaphon');
-		$form->addElement('hidden', 'document_id', $document_id);
+		$form->addElement('hidden', 'id', $document_id);
 		$form->addElement('text', 'title', get_lang('Title'));
 		$form->addElement('select', 'lang', get_lang('Language'), $options_pedia, array('onclick' => 'update_voices(this.selectedIndex);'));
 		$form->addElement('select', 'voices', get_lang('Voice'), array(get_lang('FirstSelectALanguage')), array());
@@ -345,7 +345,7 @@ Display :: display_footer();
  */
 function downloadMP3_google($filepath, $dir)
 {
-	$location='create_audio.php?'.api_get_cidreq().'&id='.Security::remove_XSS($_POST['document_id']).'&dt2a=google';
+    $location='create_audio.php?'.api_get_cidreq().'&id='.intval($_POST['id']).'&dt2a=google';
 
 	//security
 	if (!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) {
@@ -420,7 +420,7 @@ function downloadMP3_google($filepath, $dir)
  * @version january 2011, chamilo 1.8.8
  */
 function downloadMP3_pediaphon($filepath, $dir){
-	$location='create_audio.php?'.api_get_cidreq().'&id='.Security::remove_XSS($_POST['document_id']).'&dt2a=pediaphon';
+	$location='create_audio.php?'.api_get_cidreq().'&id='.intval($_POST['id']).'&dt2a=pediaphon';
 	//security
 	if(!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) {
 		echo '<script>window.location.href="'.$location.'"</script>';

+ 18 - 18
main/document/file.php

@@ -11,25 +11,25 @@ Use Model\Document;
 Use Model\Course;
 
 /**
- * 	Return either 
- * 
+ * 	Return either
+ *
  *      - one document
  *      - several documents (file and/or folders) zipped together
- * 
+ *
  * Used to transfer files to another application through http.
- * 
+ *
  * Script parameters:
- * 
- *      - id        id(s) of the document id=1 or id=1,2,4  
+ *
+ *      - id        id(s) of the document id=1 or id=1,2,4
  *      - cidReq    course code
- * 
+ *
  * Note this script enables key authentication so access with a key token is possible.
- * 
+ *
  * @package chamilo.document
  * @license see /license.txt
  * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
  */
-require_once __DIR__ . '/../inc/autoload.inc.php';
+require_once __DIR__ . '/../../vendor/autoload.php';
 KeyAuth::enable();
 
 require_once __DIR__ . '/../inc/global.inc.php';
@@ -48,14 +48,14 @@ $course = Course::current();
 
 /**
  * No files requested. We make sure we return 404 error to tell the client
- * that the call failed. 
+ * that the call failed.
  */
 if (count($ids) == 0 || empty($course)) {
     Response::not_found();
 }
 
 /**
- * One file requested. In this case we return the file itself. 
+ * One file requested. In this case we return the file itself.
  */
 if (count($ids) == 1) {
     $id = reset($ids);
@@ -77,7 +77,7 @@ if (count($ids) == 1) {
 }
 
 /**
- * Several files requested. In this case we zip them together. 
+ * Several files requested. In this case we zip them together.
  */
 $files = array();
 $folders = array();
@@ -97,9 +97,9 @@ foreach ($ids as $id) {
 $requested_folders = $folders;
 
 /**
- * Note that if a parent folder is hidden children should not be accesible 
- * even if they are visible. It is therefore not sufficient to check document 
- * visibility. 
+ * Note that if a parent folder is hidden children should not be accesible
+ * even if they are visible. It is therefore not sufficient to check document
+ * visibility.
  */
 while ($folders) {
     $items = $folders;
@@ -123,7 +123,7 @@ while ($folders) {
 $folders = $requested_folders;
 
 /**
- * Requested files may not be accessible. 
+ * Requested files may not be accessible.
  */
 if (count($files) == 0) {
     Response::not_found();
@@ -142,7 +142,7 @@ foreach ($items as $item) {
 }
 
 /**
- * Zip files together. 
+ * Zip files together.
  */
 $temp_zip_path = Chamilo::temp_file('zip');
 $zip_folder = new PclZip($temp_zip_path);
@@ -155,7 +155,7 @@ foreach ($files as $file) {
 }
 
 /**
- * Send file for download 
+ * Send file for download
  */
 event_download(Uri::here());
 DocumentManager::file_send_for_download($temp_zip_path, false, get_lang('Documents') . '.zip');

+ 3 - 3
main/exercice/export/aiken/aiken_import.inc.php

@@ -289,11 +289,11 @@ function aiken_parse_file(&$exercise_info, $exercisePath, $file, $questionFile)
             $new_question = true;
         } else {
             if (empty($exercise_info['question'][$question_index]['title'])) {
-                if (strlen($info) < 40) {
+                if (strlen($info) < 100) {
                     $exercise_info['question'][$question_index]['title'] = $info;
                 } else {
-                    //Question itself (use a 40-chars long title and a larger description)
-                    $exercise_info['question'][$question_index]['title'] = trim(substr($info,0,40)).'...';
+                    //Question itself (use a 100-chars long title and a larger description)
+                    $exercise_info['question'][$question_index]['title'] = trim(substr($info, 0, 100)) . '...';
                     $exercise_info['question'][$question_index]['description'] = $info;
                 }
             } else {

+ 15 - 10
main/gradebook/lib/be/studentpublicationlink.class.php

@@ -158,27 +158,32 @@ class StudentPublicationLink extends AbstractLink
 	public function calc_score($stud_id = null)
 	{
 		$stud_id = intval($stud_id);
-		$tbl_stats = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
-		$sql = 'SELECT * FROM '.$tbl_stats."
+		$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
+		$sql = 'SELECT * FROM '.$table."
     			WHERE
     				c_id = {$this->course_id} AND
     				id  = '".intval($this->get_ref_id())."' AND
-    				session_id	= ".api_get_session_id()."";
+    				session_id	= ".api_get_session_id()."
+				"
+		;
+
 		$query = Database::query($sql);
 		$assignment = Database::fetch_array($query);
 
-		if (count($assignment)==0) {
-			$v_assigment_id ='0';
+		if (count($assignment) == 0) {
+			$parentId = '0';
 		} else {
-			$v_assigment_id = $assignment['id'];
+			$parentId = $assignment['id'];
 		}
-		$sql = 'SELECT * FROM '.$tbl_stats.'
+
+		$sql = 'SELECT * FROM '.$table.'
     			WHERE
     				c_id = '.$this->course_id.' AND
     				active = 1 AND
-    				parent_id ="'.$v_assigment_id.'" AND
-    				session_id='.api_get_session_id().'';
-
+    				parent_id = "'.$parentId.'" AND
+    				session_id = '.api_get_session_id() .' AND
+    				qualificator_id <> 0
+				';
 		if (!empty($stud_id)) {
 			$sql .= " AND user_id = $stud_id ";
 		}

+ 0 - 2
main/inc/ajax/install.ajax.php

@@ -37,8 +37,6 @@ switch ($action) {
             } else {
 
                 // save contact information with web service
-                require_once '../lib/nusoap/nusoap.php';
-
                 // create a client
                 $client = new nusoap_client('http://version.chamilo.org/contact.php?wsdl', true);
 

+ 0 - 18
main/inc/autoload.inc.php

@@ -1,18 +0,0 @@
-<?php
-
-/**
- * Set up the Chamilo autoload stack. Can be called several time if needed also
- * better to avoid it.
- */
-
-require_once dirname(__FILE__) . '/lib/autoload.class.php';
-Autoload::register();
-
-/**
-use Symfony\Component\ClassLoader\UniversalClassLoader;
-$loader = new UniversalClassLoader();
-$loader->registerNamespaces(array(
-    'Symfony\\Component\\HttpFoundation', __DIR__.'/vendor/symfony/http-foundation',
-));
-$loader->register();
- */

+ 14 - 10
main/inc/global.inc.php

@@ -84,7 +84,7 @@ if (api_get_setting('login_is_email') == 'true') {
 define('USERNAME_MAX_LENGTH', $default_username_length);
 
 // Do not over-use this variable. It is only for this script's local use.
-$lib_path = api_get_path(LIBRARY_PATH);
+$lib_path = dirname(__FILE__).'/../../main/inc/lib/';
 
 // Fix bug in IIS that doesn't fill the $_SERVER['REQUEST_URI'].
 api_request_uri();
@@ -96,7 +96,7 @@ ini_set('include_path', api_create_include_path_setting());
 ini_set('auto_detect_line_endings', '1');
 
 // Include the libraries that are necessary everywhere
-require_once dirname(__FILE__).'/autoload.inc.php';
+require_once dirname(__FILE__).'/../../vendor/autoload.php';
 
 require_once $lib_path.'database.lib.php';
 require_once $lib_path.'text.lib.php';
@@ -115,14 +115,18 @@ if (empty($_configuration['statistics_database']) && $already_installed) {
 global $database_connection;
 // Connect to the server database and select the main chamilo database.
 // When $_configuration['db_persistent_connection'] is set, it is expected to be a boolean type.
-if (!($conn_return = @Database::connect(
-    array(
-        'server'        => $_configuration['db_host'],
-        'username'      => $_configuration['db_user'],
-        'password'      => $_configuration['db_password'],
-        'persistent'    => $_configuration['db_persistent_connection']
-    )))
-) {
+$params = array(
+    'server'        => $_configuration['db_host'],
+    'username'      => $_configuration['db_user'],
+    'password'      => $_configuration['db_password'],
+    'persistent'    => $_configuration['db_persistent_connection']
+);
+// $_configuration['db_client_flags'] can be set in configuration.php to pass 
+// flags to the DB connection
+if (isset($_configuration['db_client_flags']) && !empty($_configuration['db_client_flags'])) {
+    $params['client_flags'] = $_configuration['db_client_flags'];
+}
+if (!($conn_return = @Database::connect($params))) {
     $global_error_code = 3;
     // The database server is not available or credentials are invalid.
     require $includePath.'/global_error_message.inc.php';

+ 0 - 0
main/announcements/announcement_email.class.php → main/inc/lib/AnnouncementEmail.php


+ 3 - 0
main/inc/lib/add_course.lib.inc.php

@@ -2015,6 +2015,9 @@ function create_course_tables($course_db_name = null) {
 
     Database::query($sql);
 
+    // New course tables for 1.10.x come here
+
+
     return 0;
 }
 

+ 1 - 1
main/inc/lib/autoload.class.php

@@ -2,7 +2,7 @@
 
 /**
  * Autoload Chamilo classes
- *
+ * @deprecated
  * @license see /license.txt
  * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
  */

+ 1 - 2
main/inc/lib/certificate.lib.php

@@ -261,9 +261,8 @@ class Certificate extends Model
     {
         //Make sure HTML certificate is generated
         if (!empty($text) && !empty($path)) {
-            require_once api_get_path(LIBRARY_PATH).'phpqrcode/qrlib.php';
             //L low, M - Medium, L large error correction
-            return QRcode::png($text, $path, 'M', 2, 2);
+            return PHPQRCode\QRcode::png($text, $path, 'M', 2, 2);
         }
         return false;
     }

+ 0 - 3072
main/inc/lib/ezpdf/class.pdf.php

@@ -1,3072 +0,0 @@
-<?php
-/**
-* Cpdf
-*
-* http://www.ros.co.nz/pdf
-*
-* A PHP class to provide the basic functionality to create a pdf document without
-* any requirement for additional modules.
-*
-* Note that they companion class CezPdf can be used to extend this class and dramatically
-* simplify the creation of documents.
-*
-* IMPORTANT NOTE
-* there is no warranty, implied or otherwise with this software.
-*
-* LICENCE
-* This code has been placed in the Public Domain for all to enjoy.
-*
-* @author		Wayne Munro <pdf@ros.co.nz>
-* @version 	009
-* @package	Cpdf
-*/
-class Cpdf {
-
-/**
-* the current number of pdf objects in the document
-*/
-var $numObj=0;
-/**
-* this array contains all of the pdf objects, ready for final assembly
-*/
-var $objects = array();
-/**
-* the objectId (number within the objects array) of the document catalog
-*/
-var $catalogId;
-/**
-* array carrying information about the fonts that the system currently knows about
-* used to ensure that a font is not loaded twice, among other things
-*/
-var $fonts=array();
-/**
-* a record of the current font
-*/
-var $currentFont='';
-/**
-* the current base font
-*/
-var $currentBaseFont='';
-/**
-* the number of the current font within the font array
-*/
-var $currentFontNum=0;
-/**
-*
-*/
-var $currentNode;
-/**
-* object number of the current page
-*/
-var $currentPage;
-/**
-* object number of the currently active contents block
-*/
-var $currentContents;
-/**
-* number of fonts within the system
-*/
-var $numFonts=0;
-/**
-* current colour for fill operations, defaults to inactive value, all three components should be between 0 and 1 inclusive when active
-*/
-var $currentColour=array('r'=>-1,'g'=>-1,'b'=>-1);
-/**
-* current colour for stroke operations (lines etc.)
-*/
-var $currentStrokeColour=array('r'=>-1,'g'=>-1,'b'=>-1);
-/**
-* current style that lines are drawn in
-*/
-var $currentLineStyle='';
-/**
-* an array which is used to save the state of the document, mainly the colours and styles
-* it is used to temporarily change to another state, the change back to what it was before
-*/
-var $stateStack = array();
-/**
-* number of elements within the state stack
-*/
-var $nStateStack = 0;
-/**
-* number of page objects within the document
-*/
-var $numPages=0;
-/**
-* object Id storage stack
-*/
-var $stack=array();
-/**
-* number of elements within the object Id storage stack
-*/
-var $nStack=0;
-/**
-* an array which contains information about the objects which are not firmly attached to pages
-* these have been added with the addObject function
-*/
-var $looseObjects=array();
-/**
-* array contains infomation about how the loose objects are to be added to the document
-*/
-var $addLooseObjects=array();
-/**
-* the objectId of the information object for the document
-* this contains authorship, title etc.
-*/
-var $infoObject=0;
-/**
-* number of images being tracked within the document
-*/
-var $numImages=0;
-/**
-* an array containing options about the document
-* it defaults to turning on the compression of the objects
-*/
-var $options=array('compression'=>1);
-/**
-* the objectId of the first page of the document
-*/
-var $firstPageId;
-/**
-* used to track the last used value of the inter-word spacing, this is so that it is known
-* when the spacing is changed.
-*/
-var $wordSpaceAdjust=0;
-/**
-* the object Id of the procset object
-*/
-var $procsetObjectId;
-/**
-* store the information about the relationship between font families
-* this used so that the code knows which font is the bold version of another font, etc.
-* the value of this array is initialised in the constuctor function.
-*/
-var $fontFamilies = array();
-/**
-* track if the current font is bolded or italicised
-*/
-var $currentTextState = '';
-/**
-* messages are stored here during processing, these can be selected afterwards to give some useful debug information
-*/
-var $messages='';
-/**
-* the ancryption array for the document encryption is stored here
-*/
-var $arc4='';
-/**
-* the object Id of the encryption information
-*/
-var $arc4_objnum=0;
-/**
-* the file identifier, used to uniquely identify a pdf document
-*/
-var $fileIdentifier='';
-/**
-* a flag to say if a document is to be encrypted or not
-*/
-var $encrypted=0;
-/**
-* the ancryption key for the encryption of all the document content (structure is not encrypted)
-*/
-var $encryptionKey='';
-/**
-* array which forms a stack to keep track of nested callback functions
-*/
-var $callback = array();
-/**
-* the number of callback functions in the callback array
-*/
-var $nCallback = 0;
-/**
-* store label->id pairs for named destinations, these will be used to replace internal links
-* done this way so that destinations can be defined after the location that links to them
-*/
-var $destinations = array();
-/**
-* store the stack for the transaction commands, each item in here is a record of the values of all the
-* variables within the class, so that the user can rollback at will (from each 'start' command)
-* note that this includes the objects array, so these can be large.
-*/
-var $checkpoint = '';
-/**
-* class constructor
-* this will start a new document
-* @var array array of 4 numbers, defining the bottom left and upper right corner of the page. first two are normally zero.
-*/
-function Cpdf ($pageSize=array(0,0,612,792)){
-  $this->newDocument($pageSize);
-
-  // also initialize the font families that are known about already
-  $this->setFontFamily('init');
-//  $this->fileIdentifier = md5('xxxxxxxx'.time());
-
-}
-
-/**
-* Document object methods (internal use only)
-*
-* There is about one object method for each type of object in the pdf document
-* Each function has the same call list ($id,$action,$options).
-* $id = the object ID of the object, or what it is to be if it is being created
-* $action = a string specifying the action to be performed, though ALL must support:
-*           'new' - create the object with the id $id
-*           'out' - produce the output for the pdf object
-* $options = optional, a string or array containing the various parameters for the object
-*
-* These, in conjunction with the output function are the ONLY way for output to be produced
-* within the pdf 'file'.
-*/
-
-/**
-*destination object, used to specify the location for the user to jump to, presently on opening
-*/
-function o_destination($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch($action){
-    case 'new':
-      $this->objects[$id]=array('t'=>'destination','info'=>array());
-      $tmp = '';
-      switch ($options['type']){
-        case 'XYZ':
-        case 'FitR':
-          $tmp =  ' '.$options['p3'].$tmp;
-        case 'FitH':
-        case 'FitV':
-        case 'FitBH':
-        case 'FitBV':
-          $tmp =  ' '.$options['p1'].' '.$options['p2'].$tmp;
-        case 'Fit':
-        case 'FitB':
-          $tmp =  $options['type'].$tmp;
-          $this->objects[$id]['info']['string']=$tmp;
-          $this->objects[$id]['info']['page']=$options['page'];
-      }
-      break;
-    case 'out':
-      $tmp = $o['info'];
-      $res="\n".$id." 0 obj\n".'['.$tmp['page'].' 0 R /'.$tmp['string']."]\nendobj\n";
-      return $res;
-      break;
-  }
-}
-
-/**
-* set the viewer preferences
-*/
-function o_viewerPreferences($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      $this->objects[$id]=array('t'=>'viewerPreferences','info'=>array());
-      break;
-    case 'add':
-      foreach($options as $k=>$v){
-        switch ($k){
-          case 'HideToolbar':
-          case 'HideMenubar':
-          case 'HideWindowUI':
-          case 'FitWindow':
-          case 'CenterWindow':
-          case 'NonFullScreenPageMode':
-          case 'Direction':
-            $o['info'][$k]=$v;
-          break;
-        }
-      }
-      break;
-    case 'out':
-
-      $res="\n".$id." 0 obj\n".'<< ';
-      foreach($o['info'] as $k=>$v){
-        $res.="\n/".$k.' '.$v;
-      }
-      $res.="\n>>\n";
-      return $res;
-      break;
-  }
-}
-
-/**
-* define the document catalog, the overall controller for the document
-*/
-function o_catalog($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      $this->objects[$id]=array('t'=>'catalog','info'=>array());
-      $this->catalogId=$id;
-      break;
-    case 'outlines':
-    case 'pages':
-    case 'openHere':
-      $o['info'][$action]=$options;
-      break;
-    case 'viewerPreferences':
-      if (!isset($o['info']['viewerPreferences'])){
-        $this->numObj++;
-        $this->o_viewerPreferences($this->numObj,'new');
-        $o['info']['viewerPreferences']=$this->numObj;
-      }
-      $vp = $o['info']['viewerPreferences'];
-      $this->o_viewerPreferences($vp,'add',$options);
-      break;
-    case 'out':
-      $res="\n".$id." 0 obj\n".'<< /Type /Catalog';
-      foreach($o['info'] as $k=>$v){
-        switch($k){
-          case 'outlines':
-            $res.="\n".'/Outlines '.$v.' 0 R';
-            break;
-          case 'pages':
-            $res.="\n".'/Pages '.$v.' 0 R';
-            break;
-          case 'viewerPreferences':
-            $res.="\n".'/ViewerPreferences '.$o['info']['viewerPreferences'].' 0 R';
-            break;
-          case 'openHere':
-            $res.="\n".'/OpenAction '.$o['info']['openHere'].' 0 R';
-            break;
-        }
-      }
-      $res.=" >>\nendobj";
-      return $res;
-      break;
-  }
-}
-
-/**
-* object which is a parent to the pages in the document
-*/
-function o_pages($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      $this->objects[$id]=array('t'=>'pages','info'=>array());
-      $this->o_catalog($this->catalogId,'pages',$id);
-      break;
-    case 'page':
-      if (!is_array($options)){
-        // then it will just be the id of the new page
-        $o['info']['pages'][]=$options;
-      } else {
-        // then it should be an array having 'id','rid','pos', where rid=the page to which this one will be placed relative
-        // and pos is either 'before' or 'after', saying where this page will fit.
-        if (isset($options['id']) && isset($options['rid']) && isset($options['pos'])){
-          $i = array_search($options['rid'],$o['info']['pages']);
-          if (isset($o['info']['pages'][$i]) && $o['info']['pages'][$i]==$options['rid']){
-            // then there is a match
-            // make a space
-            switch ($options['pos']){
-              case 'before':
-                $k = $i;
-                break;
-              case 'after':
-                $k=$i+1;
-                break;
-              default:
-                $k=-1;
-                break;
-            }
-            if ($k>=0){
-              for ($j=count($o['info']['pages'])-1;$j>=$k;$j--){
-                $o['info']['pages'][$j+1]=$o['info']['pages'][$j];
-              }
-              $o['info']['pages'][$k]=$options['id'];
-            }
-          }
-        }
-      }
-      break;
-    case 'procset':
-      $o['info']['procset']=$options;
-      break;
-    case 'mediaBox':
-      $o['info']['mediaBox']=$options; // which should be an array of 4 numbers
-      break;
-    case 'font':
-      $o['info']['fonts'][]=array('objNum'=>$options['objNum'],'fontNum'=>$options['fontNum']);
-      break;
-    case 'xObject':
-      $o['info']['xObjects'][]=array('objNum'=>$options['objNum'],'label'=>$options['label']);
-      break;
-    case 'out':
-      if (count($o['info']['pages'])){
-        $res="\n".$id." 0 obj\n<< /Type /Pages\n/Kids [";
-        foreach($o['info']['pages'] as $k=>$v){
-          $res.=$v." 0 R\n";
-        }
-        $res.="]\n/Count ".count($this->objects[$id]['info']['pages']);
-        if ((isset($o['info']['fonts']) && count($o['info']['fonts'])) || isset($o['info']['procset'])){
-          $res.="\n/Resources <<";
-          if (isset($o['info']['procset'])){
-            $res.="\n/ProcSet ".$o['info']['procset']." 0 R";
-          }
-          if (isset($o['info']['fonts']) && count($o['info']['fonts'])){
-            $res.="\n/Font << ";
-            foreach($o['info']['fonts'] as $finfo){
-              $res.="\n/F".$finfo['fontNum']." ".$finfo['objNum']." 0 R";
-            }
-            $res.=" >>";
-          }
-          if (isset($o['info']['xObjects']) && count($o['info']['xObjects'])){
-            $res.="\n/XObject << ";
-            foreach($o['info']['xObjects'] as $finfo){
-              $res.="\n/".$finfo['label']." ".$finfo['objNum']." 0 R";
-            }
-            $res.=" >>";
-          }
-          $res.="\n>>";
-          if (isset($o['info']['mediaBox'])){
-            $tmp=$o['info']['mediaBox'];
-            $res.="\n/MediaBox [".sprintf('%.3f',$tmp[0]).' '.sprintf('%.3f',$tmp[1]).' '.sprintf('%.3f',$tmp[2]).' '.sprintf('%.3f',$tmp[3]).']';
-          }
-        }
-        $res.="\n >>\nendobj";
-      } else {
-        $res="\n".$id." 0 obj\n<< /Type /Pages\n/Count 0\n>>\nendobj";
-      }
-      return $res;
-    break;
-  }
-}
-
-/**
-* define the outlines in the doc, empty for now
-*/
-function o_outlines($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      $this->objects[$id]=array('t'=>'outlines','info'=>array('outlines'=>array()));
-      $this->o_catalog($this->catalogId,'outlines',$id);
-      break;
-    case 'outline':
-      $o['info']['outlines'][]=$options;
-      break;
-    case 'out':
-      if (count($o['info']['outlines'])){
-        $res="\n".$id." 0 obj\n<< /Type /Outlines /Kids [";
-        foreach($o['info']['outlines'] as $k=>$v){
-          $res.=$v." 0 R ";
-        }
-        $res.="] /Count ".count($o['info']['outlines'])." >>\nendobj";
-      } else {
-        $res="\n".$id." 0 obj\n<< /Type /Outlines /Count 0 >>\nendobj";
-      }
-      return $res;
-      break;
-  }
-}
-
-/**
-* an object to hold the font description
-*/
-function o_font($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      $this->objects[$id]=array('t'=>'font','info'=>array('name'=>$options['name'],'SubType'=>'Type1'));
-      $fontNum=$this->numFonts;
-      $this->objects[$id]['info']['fontNum']=$fontNum;
-      // deal with the encoding and the differences
-      if (isset($options['differences'])){
-        // then we'll need an encoding dictionary
-        $this->numObj++;
-        $this->o_fontEncoding($this->numObj,'new',$options);
-        $this->objects[$id]['info']['encodingDictionary']=$this->numObj;
-      } else if (isset($options['encoding'])){
-        // we can specify encoding here
-        switch($options['encoding']){
-          case 'WinAnsiEncoding':
-          case 'MacRomanEncoding':
-          case 'MacExpertEncoding':
-            $this->objects[$id]['info']['encoding']=$options['encoding'];
-            break;
-          case 'none':
-            break;
-          default:
-            $this->objects[$id]['info']['encoding']='WinAnsiEncoding';
-            break;
-        }
-      } else {
-        $this->objects[$id]['info']['encoding']='WinAnsiEncoding';
-      }
-      // also tell the pages node about the new font
-      $this->o_pages($this->currentNode,'font',array('fontNum'=>$fontNum,'objNum'=>$id));
-      break;
-    case 'add':
-      foreach ($options as $k=>$v){
-        switch ($k){
-          case 'BaseFont':
-            $o['info']['name'] = $v;
-            break;
-          case 'FirstChar':
-          case 'LastChar':
-          case 'Widths':
-          case 'FontDescriptor':
-          case 'SubType':
-          $this->addMessage('o_font '.$k." : ".$v);
-            $o['info'][$k] = $v;
-            break;
-        }
-     }
-      break;
-    case 'out':
-      $res="\n".$id." 0 obj\n<< /Type /Font\n/Subtype /".$o['info']['SubType']."\n";
-      $res.="/Name /F".$o['info']['fontNum']."\n";
-      $res.="/BaseFont /".$o['info']['name']."\n";
-      if (isset($o['info']['encodingDictionary'])){
-        // then place a reference to the dictionary
-        $res.="/Encoding ".$o['info']['encodingDictionary']." 0 R\n";
-      } else if (isset($o['info']['encoding'])){
-        // use the specified encoding
-        $res.="/Encoding /".$o['info']['encoding']."\n";
-      }
-      if (isset($o['info']['FirstChar'])){
-        $res.="/FirstChar ".$o['info']['FirstChar']."\n";
-      }
-      if (isset($o['info']['LastChar'])){
-        $res.="/LastChar ".$o['info']['LastChar']."\n";
-      }
-      if (isset($o['info']['Widths'])){
-        $res.="/Widths ".$o['info']['Widths']." 0 R\n";
-      }
-      if (isset($o['info']['FontDescriptor'])){
-        $res.="/FontDescriptor ".$o['info']['FontDescriptor']." 0 R\n";
-      }
-      $res.=">>\nendobj";
-      return $res;
-      break;
-  }
-}
-
-/**
-* a font descriptor, needed for including additional fonts
-*/
-function o_fontDescriptor($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      $this->objects[$id]=array('t'=>'fontDescriptor','info'=>$options);
-      break;
-    case 'out':
-      $res="\n".$id." 0 obj\n<< /Type /FontDescriptor\n";
-      foreach ($o['info'] as $label => $value){
-        switch ($label){
-          case 'Ascent':
-          case 'CapHeight':
-          case 'Descent':
-          case 'Flags':
-          case 'ItalicAngle':
-          case 'StemV':
-          case 'AvgWidth':
-          case 'Leading':
-          case 'MaxWidth':
-          case 'MissingWidth':
-          case 'StemH':
-          case 'XHeight':
-          case 'CharSet':
-            if (strlen($value)){
-              $res.='/'.$label.' '.$value."\n";
-            }
-            break;
-          case 'FontFile':
-          case 'FontFile2':
-          case 'FontFile3':
-            $res.='/'.$label.' '.$value." 0 R\n";
-            break;
-          case 'FontBBox':
-            $res.='/'.$label.' ['.$value[0].' '.$value[1].' '.$value[2].' '.$value[3]."]\n";
-            break;
-          case 'FontName':
-            $res.='/'.$label.' /'.$value."\n";
-            break;
-        }
-      }
-      $res.=">>\nendobj";
-      return $res;
-      break;
-  }
-}
-
-/**
-* the font encoding
-*/
-function o_fontEncoding($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      // the options array should contain 'differences' and maybe 'encoding'
-      $this->objects[$id]=array('t'=>'fontEncoding','info'=>$options);
-      break;
-    case 'out':
-      $res="\n".$id." 0 obj\n<< /Type /Encoding\n";
-      if (!isset($o['info']['encoding'])){
-        $o['info']['encoding']='WinAnsiEncoding';
-      }
-      if ($o['info']['encoding']!='none'){
-        $res.="/BaseEncoding /".$o['info']['encoding']."\n";
-      }
-      $res.="/Differences \n[";
-      $onum=-100;
-      foreach($o['info']['differences'] as $num=>$label){
-        if ($num!=$onum+1){
-          // we cannot make use of consecutive numbering
-          $res.= "\n".$num." /".$label;
-        } else {
-          $res.= " /".$label;
-        }
-        $onum=$num;
-      }
-      $res.="\n]\n>>\nendobj";
-      return $res;
-      break;
-  }
-}
-
-/**
-* the document procset, solves some problems with printing to old PS printers
-*/
-function o_procset($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      $this->objects[$id]=array('t'=>'procset','info'=>array('PDF'=>1,'Text'=>1));
-      $this->o_pages($this->currentNode,'procset',$id);
-      $this->procsetObjectId=$id;
-      break;
-    case 'add':
-      // this is to add new items to the procset list, despite the fact that this is considered
-      // obselete, the items are required for printing to some postscript printers
-      switch ($options) {
-        case 'ImageB':
-        case 'ImageC':
-        case 'ImageI':
-          $o['info'][$options]=1;
-          break;
-      }
-      break;
-    case 'out':
-      $res="\n".$id." 0 obj\n[";
-      foreach ($o['info'] as $label=>$val){
-        $res.='/'.$label.' ';
-      }
-      $res.="]\nendobj";
-      return $res;
-      break;
-  }
-}
-
-/**
-* define the document information
-*/
-function o_info($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      $this->infoObject=$id;
-      $date='D:'.date('Ymd');
-      $this->objects[$id]=array('t'=>'info','info'=>array('Creator'=>'R and OS php pdf writer, http://www.ros.co.nz','CreationDate'=>$date));
-      break;
-    case 'Title':
-    case 'Author':
-    case 'Subject':
-    case 'Keywords':
-    case 'Creator':
-    case 'Producer':
-    case 'CreationDate':
-    case 'ModDate':
-    case 'Trapped':
-      $o['info'][$action]=$options;
-      break;
-    case 'out':
-      if ($this->encrypted){
-        $this->encryptInit($id);
-      }
-      $res="\n".$id." 0 obj\n<<\n";
-      foreach ($o['info']  as $k=>$v){
-        $res.='/'.$k.' (';
-        if ($this->encrypted){
-          $res.=$this->filterText($this->ARC4($v));
-        } else {
-          $res.=$this->filterText($v);
-        }
-        $res.=")\n";
-      }
-      $res.=">>\nendobj";
-      return $res;
-      break;
-  }
-}
-
-/**
-* an action object, used to link to URLS initially
-*/
-function o_action($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      if (is_array($options)){
-        $this->objects[$id]=array('t'=>'action','info'=>$options,'type'=>$options['type']);
-      } else {
-        // then assume a URI action
-        $this->objects[$id]=array('t'=>'action','info'=>$options,'type'=>'URI');
-      }
-      break;
-    case 'out':
-      if ($this->encrypted){
-        $this->encryptInit($id);
-      }
-      $res="\n".$id." 0 obj\n<< /Type /Action";
-      switch($o['type']){
-        case 'ilink':
-          // there will be an 'label' setting, this is the name of the destination
-          $res.="\n/S /GoTo\n/D ".$this->destinations[(string)$o['info']['label']]." 0 R";
-          break;
-        case 'URI':
-          $res.="\n/S /URI\n/URI (";
-          if ($this->encrypted){
-            $res.=$this->filterText($this->ARC4($o['info']));
-          } else {
-            $res.=$this->filterText($o['info']);
-          }
-          $res.=")";
-          break;
-      }
-      $res.="\n>>\nendobj";
-      return $res;
-      break;
-  }
-}
-
-/**
-* an annotation object, this will add an annotation to the current page.
-* initially will support just link annotations
-*/
-function o_annotation($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      // add the annotation to the current page
-      $pageId = $this->currentPage;
-      $this->o_page($pageId,'annot',$id);
-      // and add the action object which is going to be required
-      switch($options['type']){
-        case 'link':
-          $this->objects[$id]=array('t'=>'annotation','info'=>$options);
-          $this->numObj++;
-          $this->o_action($this->numObj,'new',$options['url']);
-          $this->objects[$id]['info']['actionId']=$this->numObj;
-          break;
-        case 'ilink':
-          // this is to a named internal link
-          $label = $options['label'];
-          $this->objects[$id]=array('t'=>'annotation','info'=>$options);
-          $this->numObj++;
-          $this->o_action($this->numObj,'new',array('type'=>'ilink','label'=>$label));
-          $this->objects[$id]['info']['actionId']=$this->numObj;
-          break;
-      }
-      break;
-    case 'out':
-      $res="\n".$id." 0 obj\n<< /Type /Annot";
-      switch($o['info']['type']){
-        case 'link':
-        case 'ilink':
-          $res.= "\n/Subtype /Link";
-          break;
-      }
-      $res.="\n/A ".$o['info']['actionId']." 0 R";
-      $res.="\n/Border [0 0 0]";
-      $res.="\n/H /I";
-      $res.="\n/Rect [ ";
-      foreach($o['info']['rect'] as $v){
-        $res.= sprintf("%.4f ",$v);
-      }
-      $res.="]";
-      $res.="\n>>\nendobj";
-      return $res;
-      break;
-  }
-}
-
-/**
-* a page object, it also creates a contents object to hold its contents
-*/
-function o_page($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      $this->numPages++;
-      $this->objects[$id]=array('t'=>'page','info'=>array('parent'=>$this->currentNode,'pageNum'=>$this->numPages));
-      if (is_array($options)){
-        // then this must be a page insertion, array shoudl contain 'rid','pos'=[before|after]
-        $options['id']=$id;
-        $this->o_pages($this->currentNode,'page',$options);
-      } else {
-        $this->o_pages($this->currentNode,'page',$id);
-      }
-      $this->currentPage=$id;
-      //make a contents object to go with this page
-      $this->numObj++;
-      $this->o_contents($this->numObj,'new',$id);
-      $this->currentContents=$this->numObj;
-      $this->objects[$id]['info']['contents']=array();
-      $this->objects[$id]['info']['contents'][]=$this->numObj;
-      $match = ($this->numPages%2 ? 'odd' : 'even');
-      foreach($this->addLooseObjects as $oId=>$target){
-        if ($target=='all' || $match==$target){
-          $this->objects[$id]['info']['contents'][]=$oId;
-        }
-      }
-      break;
-    case 'content':
-      $o['info']['contents'][]=$options;
-      break;
-    case 'annot':
-      // add an annotation to this page
-      if (!isset($o['info']['annot'])){
-        $o['info']['annot']=array();
-      }
-      // $options should contain the id of the annotation dictionary
-      $o['info']['annot'][]=$options;
-      break;
-    case 'out':
-      $res="\n".$id." 0 obj\n<< /Type /Page";
-      $res.="\n/Parent ".$o['info']['parent']." 0 R";
-      if (isset($o['info']['annot'])){
-        $res.="\n/Annots [";
-        foreach($o['info']['annot'] as $aId){
-          $res.=" ".$aId." 0 R";
-        }
-        $res.=" ]";
-      }
-      $count = count($o['info']['contents']);
-      if ($count==1){
-        $res.="\n/Contents ".$o['info']['contents'][0]." 0 R";
-      } else if ($count>1){
-        $res.="\n/Contents [\n";
-        foreach ($o['info']['contents'] as $cId){
-          $res.=$cId." 0 R\n";
-        }
-        $res.="]";
-      }
-      $res.="\n>>\nendobj";
-      return $res;
-      break;
-  }
-}
-
-/**
-* the contents objects hold all of the content which appears on pages
-*/
-function o_contents($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch ($action){
-    case 'new':
-      $this->objects[$id]=array('t'=>'contents','c'=>'','info'=>array());
-      if (strlen($options) && intval($options)){
-        // then this contents is the primary for a page
-        $this->objects[$id]['onPage']=$options;
-      } else if ($options=='raw'){
-        // then this page contains some other type of system object
-        $this->objects[$id]['raw']=1;
-      }
-      break;
-    case 'add':
-      // add more options to the decleration
-      foreach ($options as $k=>$v){
-        $o['info'][$k]=$v;
-      }
-    case 'out':
-      $tmp=$o['c'];
-      $res= "\n".$id." 0 obj\n";
-      if (isset($this->objects[$id]['raw'])){
-        $res.=$tmp;
-      } else {
-        $res.= "<<";
-        if (function_exists('gzcompress') && $this->options['compression']){
-          // then implement ZLIB based compression on this content stream
-          $res.=" /Filter /FlateDecode";
-          $tmp = gzcompress($tmp);
-        }
-        if ($this->encrypted){
-          $this->encryptInit($id);
-          $tmp = $this->ARC4($tmp);
-        }
-        foreach($o['info'] as $k=>$v){
-          $res .= "\n/".$k.' '.$v;
-        }
-        $res.="\n/Length ".strlen($tmp)." >>\nstream\n".$tmp."\nendstream";
-      }
-      $res.="\nendobj\n";
-      return $res;
-      break;
-  }
-}
-
-/**
-* an image object, will be an XObject in the document, includes description and data
-*/
-function o_image($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch($action){
-    case 'new':
-      // make the new object
-      $this->objects[$id]=array('t'=>'image','data'=>$options['data'],'info'=>array());
-      $this->objects[$id]['info']['Type']='/XObject';
-      $this->objects[$id]['info']['Subtype']='/Image';
-      $this->objects[$id]['info']['Width']=$options['iw'];
-      $this->objects[$id]['info']['Height']=$options['ih'];
-      if (!isset($options['type']) || $options['type']=='jpg'){
-        if (!isset($options['channels'])){
-          $options['channels']=3;
-        }
-        switch($options['channels']){
-          case 1:
-            $this->objects[$id]['info']['ColorSpace']='/DeviceGray';
-            break;
-          default:
-            $this->objects[$id]['info']['ColorSpace']='/DeviceRGB';
-            break;
-        }
-        $this->objects[$id]['info']['Filter']='/DCTDecode';
-        $this->objects[$id]['info']['BitsPerComponent']=8;
-      } else if ($options['type']=='png'){
-        $this->objects[$id]['info']['Filter']='/FlateDecode';
-        $this->objects[$id]['info']['DecodeParms']='<< /Predictor 15 /Colors '.$options['ncolor'].' /Columns '.$options['iw'].' /BitsPerComponent '.$options['bitsPerComponent'].'>>';
-        if (strlen($options['pdata'])){
-          $tmp = ' [ /Indexed /DeviceRGB '.(strlen($options['pdata'])/3-1).' ';
-          $this->numObj++;
-          $this->o_contents($this->numObj,'new');
-          $this->objects[$this->numObj]['c']=$options['pdata'];
-          $tmp.=$this->numObj.' 0 R';
-          $tmp .=' ]';
-          $this->objects[$id]['info']['ColorSpace'] = $tmp;
-          if (isset($options['transparency'])){
-            switch($options['transparency']['type']){
-              case 'indexed':
-                $tmp=' [ '.$options['transparency']['data'].' '.$options['transparency']['data'].'] ';
-                $this->objects[$id]['info']['Mask'] = $tmp;
-                break;
-            }
-          }
-        } else {
-          $this->objects[$id]['info']['ColorSpace']='/'.$options['color'];
-        }
-        $this->objects[$id]['info']['BitsPerComponent']=$options['bitsPerComponent'];
-      }
-      // assign it a place in the named resource dictionary as an external object, according to
-      // the label passed in with it.
-      $this->o_pages($this->currentNode,'xObject',array('label'=>$options['label'],'objNum'=>$id));
-      // also make sure that we have the right procset object for it.
-      $this->o_procset($this->procsetObjectId,'add','ImageC');
-      break;
-    case 'out':
-      $tmp=$o['data'];
-      $res= "\n".$id." 0 obj\n<<";
-      foreach($o['info'] as $k=>$v){
-        $res.="\n/".$k.' '.$v;
-      }
-      if ($this->encrypted){
-        $this->encryptInit($id);
-        $tmp = $this->ARC4($tmp);
-      }
-      $res.="\n/Length ".strlen($tmp)." >>\nstream\n".$tmp."\nendstream\nendobj\n";
-      return $res;
-      break;
-  }
-}
-
-/**
-* encryption object.
-*/
-function o_encryption($id,$action,$options=''){
-  if ($action!='new'){
-    $o =& $this->objects[$id];
-  }
-  switch($action){
-    case 'new':
-      // make the new object
-      $this->objects[$id]=array('t'=>'encryption','info'=>$options);
-      $this->arc4_objnum=$id;
-      // figure out the additional paramaters required
-      $pad = chr(0x28).chr(0xBF).chr(0x4E).chr(0x5E).chr(0x4E).chr(0x75).chr(0x8A).chr(0x41).chr(0x64).chr(0x00).chr(0x4E).chr(0x56).chr(0xFF).chr(0xFA).chr(0x01).chr(0x08).chr(0x2E).chr(0x2E).chr(0x00).chr(0xB6).chr(0xD0).chr(0x68).chr(0x3E).chr(0x80).chr(0x2F).chr(0x0C).chr(0xA9).chr(0xFE).chr(0x64).chr(0x53).chr(0x69).chr(0x7A);
-      $len = strlen($options['owner']);
-      if ($len>32){
-        $owner = substr($options['owner'],0,32);
-      } else if ($len<32){
-        $owner = $options['owner'].substr($pad,0,32-$len);
-      } else {
-        $owner = $options['owner'];
-      }
-      $len = strlen($options['user']);
-      if ($len>32){
-        $user = substr($options['user'],0,32);
-      } else if ($len<32){
-        $user = $options['user'].substr($pad,0,32-$len);
-      } else {
-        $user = $options['user'];
-      }
-      $tmp = $this->md5_16($owner);
-      $okey = substr($tmp,0,5);
-      $this->ARC4_init($okey);
-      $ovalue=$this->ARC4($user);
-      $this->objects[$id]['info']['O']=$ovalue;
-      // now make the u value, phew.
-      $tmp = $this->md5_16($user.$ovalue.chr($options['p']).chr(255).chr(255).chr(255).$this->fileIdentifier);
-      $ukey = substr($tmp,0,5);
-
-      $this->ARC4_init($ukey);
-      $this->encryptionKey = $ukey;
-      $this->encrypted=1;
-      $uvalue=$this->ARC4($pad);
-
-      $this->objects[$id]['info']['U']=$uvalue;
-      $this->encryptionKey=$ukey;
-
-      // initialize the arc4 array
-      break;
-    case 'out':
-      $res= "\n".$id." 0 obj\n<<";
-      $res.="\n/Filter /Standard";
-      $res.="\n/V 1";
-      $res.="\n/R 2";
-      $res.="\n/O (".$this->filterText($o['info']['O']).')';
-      $res.="\n/U (".$this->filterText($o['info']['U']).')';
-      // and the p-value needs to be converted to account for the twos-complement approach
-      $o['info']['p'] = (($o['info']['p']^255)+1)*-1;
-      $res.="\n/P ".($o['info']['p']);
-      $res.="\n>>\nendobj\n";
-
-      return $res;
-      break;
-  }
-}
-
-/**
-* ARC4 functions
-* A series of function to implement ARC4 encoding in PHP
-*/
-
-/**
-* calculate the 16 byte version of the 128 bit md5 digest of the string
-*/
-function md5_16($string){
-  $tmp = md5($string);
-  $out='';
-  for ($i=0;$i<=30;$i=$i+2){
-    $out.=chr(hexdec(substr($tmp,$i,2)));
-  }
-  return $out;
-}
-
-/**
-* initialize the encryption for processing a particular object
-*/
-function encryptInit($id){
-  $tmp = $this->encryptionKey;
-  $hex = dechex($id);
-  if (strlen($hex)<6){
-    $hex = substr('000000',0,6-strlen($hex)).$hex;
-  }
-  $tmp.= chr(hexdec(substr($hex,4,2))).chr(hexdec(substr($hex,2,2))).chr(hexdec(substr($hex,0,2))).chr(0).chr(0);
-  $key = $this->md5_16($tmp);
-  $this->ARC4_init(substr($key,0,10));
-}
-
-/**
-* initialize the ARC4 encryption
-*/
-function ARC4_init($key=''){
-  $this->arc4 = '';
-  // setup the control array
-  if (strlen($key)==0){
-    return;
-  }
-  $k = '';
-  while(strlen($k)<256){
-    $k.=$key;
-  }
-  $k=substr($k,0,256);
-  for ($i=0;$i<256;$i++){
-    $this->arc4 .= chr($i);
-  }
-  $j=0;
-  for ($i=0;$i<256;$i++){
-    $t = $this->arc4[$i];
-    $j = ($j + ord($t) + ord($k[$i]))%256;
-    $this->arc4[$i]=$this->arc4[$j];
-    $this->arc4[$j]=$t;
-  }
-}
-
-/**
-* ARC4 encrypt a text string
-*/
-function ARC4($text){
-  $len=strlen($text);
-  $a=0;
-  $b=0;
-  $c = $this->arc4;
-  $out='';
-  for ($i=0;$i<$len;$i++){
-    $a = ($a+1)%256;
-    $t= $c[$a];
-    $b = ($b+ord($t))%256;
-    $c[$a]=$c[$b];
-    $c[$b]=$t;
-    $k = ord($c[(ord($c[$a])+ord($c[$b]))%256]);
-    $out.=chr(ord($text[$i]) ^ $k);
-  }
-
-  return $out;
-}
-
-/**
-* functions which can be called to adjust or add to the document
-*/
-
-/**
-* add a link in the document to an external URL
-*/
-function addLink($url,$x0,$y0,$x1,$y1){
-  $this->numObj++;
-  $info = array('type'=>'link','url'=>$url,'rect'=>array($x0,$y0,$x1,$y1));
-  $this->o_annotation($this->numObj,'new',$info);
-}
-
-/**
-* add a link in the document to an internal destination (ie. within the document)
-*/
-function addInternalLink($label,$x0,$y0,$x1,$y1){
-  $this->numObj++;
-  $info = array('type'=>'ilink','label'=>$label,'rect'=>array($x0,$y0,$x1,$y1));
-  $this->o_annotation($this->numObj,'new',$info);
-}
-
-/**
-* set the encryption of the document
-* can be used to turn it on and/or set the passwords which it will have.
-* also the functions that the user will have are set here, such as print, modify, add
-*/
-function setEncryption($userPass='',$ownerPass='',$pc=array()){
-  $p=bindec(11000000);
-
-  $options = array(
-     'print'=>4
-    ,'modify'=>8
-    ,'copy'=>16
-    ,'add'=>32
-  );
-  foreach($pc as $k=>$v){
-    if ($v && isset($options[$k])){
-      $p+=$options[$k];
-    } else if (isset($options[$v])){
-      $p+=$options[$v];
-    }
-  }
-  // implement encryption on the document
-  if ($this->arc4_objnum == 0){
-    // then the block does not exist already, add it.
-    $this->numObj++;
-    if (strlen($ownerPass)==0){
-      $ownerPass=$userPass;
-    }
-    $this->o_encryption($this->numObj,'new',array('user'=>$userPass,'owner'=>$ownerPass,'p'=>$p));
-  }
-}
-
-/**
-* should be used for internal checks, not implemented as yet
-*/
-function checkAllHere(){
-}
-
-/**
-* return the pdf stream as a string returned from the function
-*/
-function output($debug=0){
-
-  if ($debug){
-    // turn compression off
-    $this->options['compression']=0;
-  }
-
-  if ($this->arc4_objnum){
-    $this->ARC4_init($this->encryptionKey);
-  }
-
-  $this->checkAllHere();
-
-  $xref=array();
-  $content="%PDF-1.3\n%����\n";
-//  $content="%PDF-1.3\n";
-  $pos=strlen($content);
-  foreach($this->objects as $k=>$v){
-    $tmp='o_'.$v['t'];
-    $cont=$this->$tmp($k,'out');
-    $content.=$cont;
-    $xref[]=$pos;
-    $pos+=strlen($cont);
-  }
-  $content.="\nxref\n0 ".(count($xref)+1)."\n0000000000 65535 f \n";
-  foreach($xref as $p){
-    $content.=substr('0000000000',0,10-strlen($p)).$p." 00000 n \n";
-  }
-  $content.="\ntrailer\n  << /Size ".(count($xref)+1)."\n     /Root 1 0 R\n     /Info ".$this->infoObject." 0 R\n";
-  // if encryption has been applied to this document then add the marker for this dictionary
-  if ($this->arc4_objnum > 0){
-    $content .= "/Encrypt ".$this->arc4_objnum." 0 R\n";
-  }
-  if (strlen($this->fileIdentifier)){
-    $content .= "/ID[<".$this->fileIdentifier."><".$this->fileIdentifier.">]\n";
-  }
-  $content .= "  >>\nstartxref\n".$pos."\n%%EOF\n";
-  return $content;
-}
-
-/**
-* intialize a new document
-* if this is called on an existing document results may be unpredictable, but the existing document would be lost at minimum
-* this function is called automatically by the constructor function
-*
-* @access private
-*/
-function newDocument($pageSize=array(0,0,612,792)){
-  $this->numObj=0;
-  $this->objects = array();
-
-  $this->numObj++;
-  $this->o_catalog($this->numObj,'new');
-
-  $this->numObj++;
-  $this->o_outlines($this->numObj,'new');
-
-  $this->numObj++;
-  $this->o_pages($this->numObj,'new');
-
-  $this->o_pages($this->numObj,'mediaBox',$pageSize);
-  $this->currentNode = 3;
-
-  $this->numObj++;
-  $this->o_procset($this->numObj,'new');
-
-  $this->numObj++;
-  $this->o_info($this->numObj,'new');
-
-  $this->numObj++;
-  $this->o_page($this->numObj,'new');
-
-  // need to store the first page id as there is no way to get it to the user during
-  // startup
-  $this->firstPageId = $this->currentContents;
-}
-
-/**
-* open the font file and return a php structure containing it.
-* first check if this one has been done before and saved in a form more suited to php
-* note that if a php serialized version does not exist it will try and make one, but will
-* require write access to the directory to do it... it is MUCH faster to have these serialized
-* files.
-*
-* @access private
-*/
-function openFont($font){
-  // assume that $font contains both the path and perhaps the extension to the file, split them
-  $pos=strrpos($font,'/');
-  if ($pos===false){
-    $dir = './';
-    $name = $font;
-  } else {
-    $dir=substr($font,0,$pos+1);
-    $name=substr($font,$pos+1);
-  }
-
-  if (substr($name,-4)=='.afm'){
-    $name=substr($name,0,strlen($name)-4);
-  }
-  $this->addMessage('openFont: '.$font.' - '.$name);
-  if (file_exists($dir.'php_'.$name.'.afm')){
-    $this->addMessage('openFont: php file exists '.$dir.'php_'.$name.'.afm');
-    $tmp = file($dir.'php_'.$name.'.afm');
-    $this->fonts[$font]=unserialize($tmp[0]);
-    if (!isset($this->fonts[$font]['_version_']) || $this->fonts[$font]['_version_']<1){
-      // if the font file is old, then clear it out and prepare for re-creation
-      $this->addMessage('openFont: clear out, make way for new version.');
-      unset($this->fonts[$font]);
-    }
-  }
-  if (!isset($this->fonts[$font]) && file_exists($dir.$name.'.afm')){
-    // then rebuild the php_<font>.afm file from the <font>.afm file
-    $this->addMessage('openFont: build php file from '.$dir.$name.'.afm');
-    $data = array();
-    $file = file($dir.$name.'.afm');
-    foreach ($file as $rowA){
-      $row=trim($rowA);
-      $pos=strpos($row,' ');
-      if ($pos){
-        // then there must be some keyword
-        $key = substr($row,0,$pos);
-        switch ($key){
-          case 'FontName':
-          case 'FullName':
-          case 'FamilyName':
-          case 'Weight':
-          case 'ItalicAngle':
-          case 'IsFixedPitch':
-          case 'CharacterSet':
-          case 'UnderlinePosition':
-          case 'UnderlineThickness':
-          case 'Version':
-          case 'EncodingScheme':
-          case 'CapHeight':
-          case 'XHeight':
-          case 'Ascender':
-          case 'Descender':
-          case 'StdHW':
-          case 'StdVW':
-          case 'StartCharMetrics':
-            $data[$key]=trim(substr($row,$pos));
-            break;
-          case 'FontBBox':
-            $data[$key]=explode(' ',trim(substr($row,$pos)));
-            break;
-          case 'C':
-            //C 39 ; WX 222 ; N quoteright ; B 53 463 157 718 ;
-            $bits=explode(';',trim($row));
-            $dtmp=array();
-            foreach($bits as $bit){
-              $bits2 = explode(' ',trim($bit));
-              if (strlen($bits2[0])){
-                if (count($bits2)>2){
-                  $dtmp[$bits2[0]]=array();
-                  for ($i=1;$i<count($bits2);$i++){
-                    $dtmp[$bits2[0]][]=$bits2[$i];
-                  }
-                } else if (count($bits2)==2){
-                  $dtmp[$bits2[0]]=$bits2[1];
-                }
-              }
-            }
-            if ($dtmp['C']>=0){
-              $data['C'][$dtmp['C']]=$dtmp;
-              $data['C'][$dtmp['N']]=$dtmp;
-            } else {
-              $data['C'][$dtmp['N']]=$dtmp;
-            }
-            break;
-          case 'KPX':
-            //KPX Adieresis yacute -40
-            $bits=explode(' ',trim($row));
-            $data['KPX'][$bits[1]][$bits[2]]=$bits[3];
-            break;
-        }
-      }
-    }
-    $data['_version_']=1;
-    $this->fonts[$font]=$data;
-    $fp = fopen($dir.'php_'.$name.'.afm','w');
-    fwrite($fp,serialize($data));
-    fclose($fp);
-  } else if (!isset($this->fonts[$font])){
-    $this->addMessage('openFont: no font file found');
-//    echo 'Font not Found '.$font;
-  }
-}
-
-/**
-* if the font is not loaded then load it and make the required object
-* else just make it the current font
-* the encoding array can contain 'encoding'=> 'none','WinAnsiEncoding','MacRomanEncoding' or 'MacExpertEncoding'
-* note that encoding='none' will need to be used for symbolic fonts
-* and 'differences' => an array of mappings between numbers 0->255 and character names.
-*
-*/
-function selectFont($fontName,$encoding='',$set=1){
-  if (!isset($this->fonts[$fontName])){
-    // load the file
-    $this->openFont($fontName);
-    if (isset($this->fonts[$fontName])){
-      $this->numObj++;
-      $this->numFonts++;
-      $pos=strrpos($fontName,'/');
-//      $dir=substr($fontName,0,$pos+1);
-      $name=substr($fontName,$pos+1);
-      if (substr($name,-4)=='.afm'){
-        $name=substr($name,0,strlen($name)-4);
-      }
-      $options=array('name'=>$name);
-      if (is_array($encoding)){
-        // then encoding and differences might be set
-        if (isset($encoding['encoding'])){
-          $options['encoding']=$encoding['encoding'];
-        }
-        if (isset($encoding['differences'])){
-          $options['differences']=$encoding['differences'];
-        }
-      } else if (strlen($encoding)){
-        // then perhaps only the encoding has been set
-        $options['encoding']=$encoding;
-      }
-      $fontObj = $this->numObj;
-      $this->o_font($this->numObj,'new',$options);
-      $this->fonts[$fontName]['fontNum']=$this->numFonts;
-      // if this is a '.afm' font, and there is a '.pfa' file to go with it ( as there
-      // should be for all non-basic fonts), then load it into an object and put the
-      // references into the font object
-      $basefile = substr($fontName,0,strlen($fontName)-4);
-      if (file_exists($basefile.'.pfb')){
-        $fbtype = 'pfb';
-      } else if (file_exists($basefile.'.ttf')){
-        $fbtype = 'ttf';
-      } else {
-        $fbtype='';
-      }
-      $fbfile = $basefile.'.'.$fbtype;
-
-//      $pfbfile = substr($fontName,0,strlen($fontName)-4).'.pfb';
-//      $ttffile = substr($fontName,0,strlen($fontName)-4).'.ttf';
-      $this->addMessage('selectFont: checking for - '.$fbfile);
-      if (substr($fontName,-4)=='.afm' && strlen($fbtype) ){
-        $adobeFontName = $this->fonts[$fontName]['FontName'];
-//        $fontObj = $this->numObj;
-        $this->addMessage('selectFont: adding font file - '.$fbfile.' - '.$adobeFontName);
-        // find the array of fond widths, and put that into an object.
-        $firstChar = -1;
-        $lastChar = 0;
-        $widths = array();
-        foreach ($this->fonts[$fontName]['C'] as $num=>$d){
-          if (intval($num)>0 || $num=='0'){
-            if ($lastChar>0 && $num>$lastChar+1){
-              for($i=$lastChar+1;$i<$num;$i++){
-                $widths[] = 0;
-              }
-            }
-            $widths[] = $d['WX'];
-            if ($firstChar==-1){
-              $firstChar = $num;
-            }
-            $lastChar = $num;
-          }
-        }
-        // also need to adjust the widths for the differences array
-        if (isset($options['differences'])){
-          foreach($options['differences'] as $charNum=>$charName){
-            if ($charNum>$lastChar){
-              for($i=$lastChar+1;$i<=$charNum;$i++){
-                $widths[]=0;
-              }
-              $lastChar=$charNum;
-            }
-            if (isset($this->fonts[$fontName]['C'][$charName])){
-              $widths[$charNum-$firstChar]=$this->fonts[$fontName]['C'][$charName]['WX'];
-            }
-          }
-        }
-        $this->addMessage('selectFont: FirstChar='.$firstChar);
-        $this->addMessage('selectFont: LastChar='.$lastChar);
-        $this->numObj++;
-        $this->o_contents($this->numObj,'new','raw');
-        $this->objects[$this->numObj]['c'].='[';
-        foreach($widths as $width){
-          $this->objects[$this->numObj]['c'].=' '.$width;
-        }
-        $this->objects[$this->numObj]['c'].=' ]';
-        $widthid = $this->numObj;
-
-        // load the pfb file, and put that into an object too.
-        // note that pdf supports only binary format type 1 font files, though there is a
-        // simple utility to convert them from pfa to pfb.
-        $fp = fopen($fbfile,'rb');
-        $tmp = get_magic_quotes_runtime();
-        set_magic_quotes_runtime(0);
-        $data = fread($fp,filesize($fbfile));
-        set_magic_quotes_runtime($tmp);
-        fclose($fp);
-
-        // create the font descriptor
-        $this->numObj++;
-        $fontDescriptorId = $this->numObj;
-        $this->numObj++;
-        $pfbid = $this->numObj;
-        // determine flags (more than a little flakey, hopefully will not matter much)
-        $flags=0;
-        if ($this->fonts[$fontName]['ItalicAngle']!=0){ $flags+=pow(2,6); }
-        if ($this->fonts[$fontName]['IsFixedPitch']=='true'){ $flags+=1; }
-        $flags+=pow(2,5); // assume non-sybolic
-
-        $list = array('Ascent'=>'Ascender','CapHeight'=>'CapHeight','Descent'=>'Descender','FontBBox'=>'FontBBox','ItalicAngle'=>'ItalicAngle');
-        $fdopt = array(
-         'Flags'=>$flags
-         ,'FontName'=>$adobeFontName
-         ,'StemV'=>100  // don't know what the value for this should be!
-        );
-        foreach($list as $k=>$v){
-          if (isset($this->fonts[$fontName][$v])){
-            $fdopt[$k]=$this->fonts[$fontName][$v];
-          }
-        }
-
-        if ($fbtype=='pfb'){
-          $fdopt['FontFile']=$pfbid;
-        } else if ($fbtype=='ttf'){
-          $fdopt['FontFile2']=$pfbid;
-        }
-        $this->o_fontDescriptor($fontDescriptorId,'new',$fdopt);
-
-        // embed the font program
-        $this->o_contents($this->numObj,'new');
-        $this->objects[$pfbid]['c'].=$data;
-        // determine the cruicial lengths within this file
-        if ($fbtype=='pfb'){
-          $l1 = strpos($data,'eexec')+6;
-          $l2 = strpos($data,'00000000')-$l1;
-          $l3 = strlen($data)-$l2-$l1;
-          $this->o_contents($this->numObj,'add',array('Length1'=>$l1,'Length2'=>$l2,'Length3'=>$l3));
-        } else if ($fbtype=='ttf'){
-          $l1 = strlen($data);
-          $this->o_contents($this->numObj,'add',array('Length1'=>$l1));
-        }
-
-
-        // tell the font object about all this new stuff
-        $tmp = array('BaseFont'=>$adobeFontName,'Widths'=>$widthid
-                                      ,'FirstChar'=>$firstChar,'LastChar'=>$lastChar
-                                      ,'FontDescriptor'=>$fontDescriptorId);
-        if ($fbtype=='ttf'){
-          $tmp['SubType']='TrueType';
-        }
-        $this->addMessage('adding extra info to font.('.$fontObj.')');
-        foreach($tmp as $fk=>$fv){
-          $this->addMessage($fk." : ".$fv);
-        }
-        $this->o_font($fontObj,'add',$tmp);
-
-      } else {
-        $this->addMessage('selectFont: pfb or ttf file not found, ok if this is one of the 14 standard fonts');
-      }
-
-
-      // also set the differences here, note that this means that these will take effect only the
-      //first time that a font is selected, else they are ignored
-      if (isset($options['differences'])){
-        $this->fonts[$fontName]['differences']=$options['differences'];
-      }
-    }
-  }
-  if ($set && isset($this->fonts[$fontName])){
-    // so if for some reason the font was not set in the last one then it will not be selected
-    $this->currentBaseFont=$fontName;
-    // the next line means that if a new font is selected, then the current text state will be
-    // applied to it as well.
-    $this->setCurrentFont();
-  }
-  return $this->currentFontNum;
-}
-
-/**
-* sets up the current font, based on the font families, and the current text state
-* note that this system is quite flexible, a <b><i> font can be completely different to a
-* <i><b> font, and even <b><b> will have to be defined within the family to have meaning
-* This function is to be called whenever the currentTextState is changed, it will update
-* the currentFont setting to whatever the appropriatte family one is.
-* If the user calls selectFont themselves then that will reset the currentBaseFont, and the currentFont
-* This function will change the currentFont to whatever it should be, but will not change the
-* currentBaseFont.
-*
-* @access private
-*/
-function setCurrentFont(){
-  if (strlen($this->currentBaseFont)==0){
-    // then assume an initial font
-    $this->selectFont('./fonts/Helvetica.afm');
-  }
-  $cf = substr($this->currentBaseFont,strrpos($this->currentBaseFont,'/')+1);
-  if (strlen($this->currentTextState)
-    && isset($this->fontFamilies[$cf])
-      && isset($this->fontFamilies[$cf][$this->currentTextState])){
-    // then we are in some state or another
-    // and this font has a family, and the current setting exists within it
-    // select the font, then return it
-    $nf = substr($this->currentBaseFont,0,strrpos($this->currentBaseFont,'/')+1).$this->fontFamilies[$cf][$this->currentTextState];
-    $this->selectFont($nf,'',0);
-    $this->currentFont = $nf;
-    $this->currentFontNum = $this->fonts[$nf]['fontNum'];
-  } else {
-    // the this font must not have the right family member for the current state
-    // simply assume the base font
-    $this->currentFont = $this->currentBaseFont;
-    $this->currentFontNum = $this->fonts[$this->currentFont]['fontNum'];
-  }
-}
-
-/**
-* function for the user to find out what the ID is of the first page that was created during
-* startup - useful if they wish to add something to it later.
-*/
-function getFirstPageId(){
-  return $this->firstPageId;
-}
-
-/**
-* add content to the currently active object
-*
-* @access private
-*/
-function addContent($content){
-  $this->objects[$this->currentContents]['c'].=$content;
-}
-
-/**
-* sets the colour for fill operations
-*/
-function setColor($r,$g,$b,$force=0){
-  if ($r>=0 && ($force || $r!=$this->currentColour['r'] || $g!=$this->currentColour['g'] || $b!=$this->currentColour['b'])){
-    $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$r).' '.sprintf('%.3f',$g).' '.sprintf('%.3f',$b).' rg';
-    $this->currentColour=array('r'=>$r,'g'=>$g,'b'=>$b);
-  }
-}
-
-/**
-* sets the colour for stroke operations
-*/
-function setStrokeColor($r,$g,$b,$force=0){
-  if ($r>=0 && ($force || $r!=$this->currentStrokeColour['r'] || $g!=$this->currentStrokeColour['g'] || $b!=$this->currentStrokeColour['b'])){
-    $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$r).' '.sprintf('%.3f',$g).' '.sprintf('%.3f',$b).' RG';
-    $this->currentStrokeColour=array('r'=>$r,'g'=>$g,'b'=>$b);
-  }
-}
-
-/**
-* draw a line from one set of coordinates to another
-*/
-function line($x1,$y1,$x2,$y2){
-  $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$x1).' '.sprintf('%.3f',$y1).' m '.sprintf('%.3f',$x2).' '.sprintf('%.3f',$y2).' l S';
-}
-
-/**
-* draw a bezier curve based on 4 control points
-*/
-function curve($x0,$y0,$x1,$y1,$x2,$y2,$x3,$y3){
-  // in the current line style, draw a bezier curve from (x0,y0) to (x3,y3) using the other two points
-  // as the control points for the curve.
-  $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$x0).' '.sprintf('%.3f',$y0).' m '.sprintf('%.3f',$x1).' '.sprintf('%.3f',$y1);
-  $this->objects[$this->currentContents]['c'].= ' '.sprintf('%.3f',$x2).' '.sprintf('%.3f',$y2).' '.sprintf('%.3f',$x3).' '.sprintf('%.3f',$y3).' c S';
-}
-
-/**
-* draw a part of an ellipse
-*/
-function partEllipse($x0,$y0,$astart,$afinish,$r1,$r2=0,$angle=0,$nSeg=8){
-  $this->ellipse($x0,$y0,$r1,$r2,$angle,$nSeg,$astart,$afinish,0);
-}
-
-/**
-* draw a filled ellipse
-*/
-function filledEllipse($x0,$y0,$r1,$r2=0,$angle=0,$nSeg=8,$astart=0,$afinish=360){
-  return $this->ellipse($x0,$y0,$r1,$r2=0,$angle,$nSeg,$astart,$afinish,1,1);
-}
-
-/**
-* draw an ellipse
-* note that the part and filled ellipse are just special cases of this function
-*
-* draws an ellipse in the current line style
-* centered at $x0,$y0, radii $r1,$r2
-* if $r2 is not set, then a circle is drawn
-* nSeg is not allowed to be less than 2, as this will simply draw a line (and will even draw a
-* pretty crappy shape at 2, as we are approximating with bezier curves.
-*/
-function ellipse($x0,$y0,$r1,$r2=0,$angle=0,$nSeg=8,$astart=0,$afinish=360,$close=1,$fill=0){
-  if ($r1==0){
-    return;
-  }
-  if ($r2==0){
-    $r2=$r1;
-  }
-  if ($nSeg<2){
-    $nSeg=2;
-  }
-
-  $astart = deg2rad((float)$astart);
-  $afinish = deg2rad((float)$afinish);
-  $totalAngle =$afinish-$astart;
-
-  $dt = $totalAngle/$nSeg;
-  $dtm = $dt/3;
-
-  if ($angle != 0){
-    $a = -1*deg2rad((float)$angle);
-    $tmp = "\n q ";
-    $tmp .= sprintf('%.3f',cos($a)).' '.sprintf('%.3f',(-1.0*sin($a))).' '.sprintf('%.3f',sin($a)).' '.sprintf('%.3f',cos($a)).' ';
-    $tmp .= sprintf('%.3f',$x0).' '.sprintf('%.3f',$y0).' cm';
-    $this->objects[$this->currentContents]['c'].= $tmp;
-    $x0=0;
-    $y0=0;
-  }
-
-  $t1 = $astart;
-  $a0 = $x0+$r1*cos($t1);
-  $b0 = $y0+$r2*sin($t1);
-  $c0 = -$r1*sin($t1);
-  $d0 = $r2*cos($t1);
-
-  $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$a0).' '.sprintf('%.3f',$b0).' m ';
-  for ($i=1;$i<=$nSeg;$i++){
-    // draw this bit of the total curve
-    $t1 = $i*$dt+$astart;
-    $a1 = $x0+$r1*cos($t1);
-    $b1 = $y0+$r2*sin($t1);
-    $c1 = -$r1*sin($t1);
-    $d1 = $r2*cos($t1);
-    $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',($a0+$c0*$dtm)).' '.sprintf('%.3f',($b0+$d0*$dtm));
-    $this->objects[$this->currentContents]['c'].= ' '.sprintf('%.3f',($a1-$c1*$dtm)).' '.sprintf('%.3f',($b1-$d1*$dtm)).' '.sprintf('%.3f',$a1).' '.sprintf('%.3f',$b1).' c';
-    $a0=$a1;
-    $b0=$b1;
-    $c0=$c1;
-    $d0=$d1;
-  }
-  if ($fill){
-    $this->objects[$this->currentContents]['c'].=' f';
-  } else {
-    if ($close){
-      $this->objects[$this->currentContents]['c'].=' s'; // small 's' signifies closing the path as well
-    } else {
-      $this->objects[$this->currentContents]['c'].=' S';
-    }
-  }
-  if ($angle !=0){
-    $this->objects[$this->currentContents]['c'].=' Q';
-  }
-}
-
-/**
-* this sets the line drawing style.
-* width, is the thickness of the line in user units
-* cap is the type of cap to put on the line, values can be 'butt','round','square'
-*    where the diffference between 'square' and 'butt' is that 'square' projects a flat end past the
-*    end of the line.
-* join can be 'miter', 'round', 'bevel'
-* dash is an array which sets the dash pattern, is a series of length values, which are the lengths of the
-*   on and off dashes.
-*   (2) represents 2 on, 2 off, 2 on , 2 off ...
-*   (2,1) is 2 on, 1 off, 2 on, 1 off.. etc
-* phase is a modifier on the dash pattern which is used to shift the point at which the pattern starts.
-*/
-function setLineStyle($width=1,$cap='',$join='',$dash='',$phase=0){
-
-  // this is quite inefficient in that it sets all the parameters whenever 1 is changed, but will fix another day
-  $string = '';
-  if ($width>0){
-    $string.= $width.' w';
-  }
-  $ca = array('butt'=>0,'round'=>1,'square'=>2);
-  if (isset($ca[$cap])){
-    $string.= ' '.$ca[$cap].' J';
-  }
-  $ja = array('miter'=>0,'round'=>1,'bevel'=>2);
-  if (isset($ja[$join])){
-    $string.= ' '.$ja[$join].' j';
-  }
-  if (is_array($dash)){
-    $string.= ' [';
-    foreach ($dash as $len){
-      $string.=' '.$len;
-    }
-    $string.= ' ] '.$phase.' d';
-  }
-  $this->currentLineStyle = $string;
-  $this->objects[$this->currentContents]['c'].="\n".$string;
-}
-
-/**
-* draw a polygon, the syntax for this is similar to the GD polygon command
-*/
-function polygon($p,$np,$f=0){
-  $this->objects[$this->currentContents]['c'].="\n";
-  $this->objects[$this->currentContents]['c'].=sprintf('%.3f',$p[0]).' '.sprintf('%.3f',$p[1]).' m ';
-  for ($i=2;$i<$np*2;$i=$i+2){
-    $this->objects[$this->currentContents]['c'].= sprintf('%.3f',$p[$i]).' '.sprintf('%.3f',$p[$i+1]).' l ';
-  }
-  if ($f==1){
-    $this->objects[$this->currentContents]['c'].=' f';
-  } else {
-    $this->objects[$this->currentContents]['c'].=' S';
-  }
-}
-
-/**
-* a filled rectangle, note that it is the width and height of the rectangle which are the secondary paramaters, not
-* the coordinates of the upper-right corner
-*/
-function filledRectangle($x1,$y1,$width,$height){
-  $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$x1).' '.sprintf('%.3f',$y1).' '.sprintf('%.3f',$width).' '.sprintf('%.3f',$height).' re f';
-}
-
-/**
-* draw a rectangle, note that it is the width and height of the rectangle which are the secondary paramaters, not
-* the coordinates of the upper-right corner
-*/
-function rectangle($x1,$y1,$width,$height){
-  $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$x1).' '.sprintf('%.3f',$y1).' '.sprintf('%.3f',$width).' '.sprintf('%.3f',$height).' re S';
-}
-
-/**
-* add a new page to the document
-* this also makes the new page the current active object
-*/
-function newPage($insert=0,$id=0,$pos='after'){
-
-  // if there is a state saved, then go up the stack closing them
-  // then on the new page, re-open them with the right setings
-
-  if ($this->nStateStack){
-    for ($i=$this->nStateStack;$i>=1;$i--){
-      $this->restoreState($i);
-    }
-  }
-
-  $this->numObj++;
-  if ($insert){
-    // the id from the ezPdf class is the od of the contents of the page, not the page object itself
-    // query that object to find the parent
-    $rid = $this->objects[$id]['onPage'];
-    $opt= array('rid'=>$rid,'pos'=>$pos);
-    $this->o_page($this->numObj,'new',$opt);
-  } else {
-    $this->o_page($this->numObj,'new');
-  }
-  // if there is a stack saved, then put that onto the page
-  if ($this->nStateStack){
-    for ($i=1;$i<=$this->nStateStack;$i++){
-      $this->saveState($i);
-    }
-  }
-  // and if there has been a stroke or fill colour set, then transfer them
-  if ($this->currentColour['r']>=0){
-    $this->setColor($this->currentColour['r'],$this->currentColour['g'],$this->currentColour['b'],1);
-  }
-  if ($this->currentStrokeColour['r']>=0){
-    $this->setStrokeColor($this->currentStrokeColour['r'],$this->currentStrokeColour['g'],$this->currentStrokeColour['b'],1);
-  }
-
-  // if there is a line style set, then put this in too
-  if (strlen($this->currentLineStyle)){
-    $this->objects[$this->currentContents]['c'].="\n".$this->currentLineStyle;
-  }
-
-  // the call to the o_page object set currentContents to the present page, so this can be returned as the page id
-  return $this->currentContents;
-}
-
-/**
-* output the pdf code, streaming it to the browser
-* the relevant headers are set so that hopefully the browser will recognise it
-*/
-function stream($options=''){
-  // setting the options allows the adjustment of the headers
-  // values at the moment are:
-  // 'Content-Disposition'=>'filename'  - sets the filename, though not too sure how well this will
-  //        work as in my trial the browser seems to use the filename of the php file with .pdf on the end
-  // 'Accept-Ranges'=>1 or 0 - if this is not set to 1, then this header is not included, off by default
-  //    this header seems to have caused some problems despite tha fact that it is supposed to solve
-  //    them, so I am leaving it off by default.
-  // 'compress'=> 1 or 0 - apply content stream compression, this is on (1) by default
-  if (!is_array($options)){
-    $options=array();
-  }
-  if ( isset($options['compress']) && $options['compress']==0){
-    $tmp = $this->output(1);
-  } else {
-    $tmp = $this->output();
-  }
-  header("Content-type: application/pdf");
-  header("Content-Length: ".strlen(ltrim($tmp)));
-  $fileName = (isset($options['Content-Disposition'])?$options['Content-Disposition']:'file.pdf');
-  header("Content-Disposition: inline; filename=".$fileName);
-  if (isset($options['Accept-Ranges']) && $options['Accept-Ranges']==1){
-    header("Accept-Ranges: ".strlen(ltrim($tmp)));
-  }
-  echo ltrim($tmp);
-}
-
-/**
-* return the height in units of the current font in the given size
-*/
-function getFontHeight($size){
-  if (!$this->numFonts){
-    $this->selectFont('./fonts/Helvetica');
-  }
-  // for the current font, and the given size, what is the height of the font in user units
-  $h = $this->fonts[$this->currentFont]['FontBBox'][3]-$this->fonts[$this->currentFont]['FontBBox'][1];
-  return $size*$h/1000;
-}
-
-/**
-* return the font decender, this will normally return a negative number
-* if you add this number to the baseline, you get the level of the bottom of the font
-* it is in the pdf user units
-*/
-function getFontDecender($size){
-  // note that this will most likely return a negative value
-  if (!$this->numFonts){
-    $this->selectFont('./fonts/Helvetica');
-  }
-  $h = $this->fonts[$this->currentFont]['FontBBox'][1];
-  return $size*$h/1000;
-}
-
-/**
-* filter the text, this is applied to all text just before being inserted into the pdf document
-* it escapes the various things that need to be escaped, and so on
-*
-* @access private
-*/
-function filterText($text){
-  $text = str_replace('\\','\\\\',$text);
-  $text = str_replace('(','\(',$text);
-  $text = str_replace(')','\)',$text);
-  $text = str_replace('&lt;','<',$text);
-  $text = str_replace('&gt;','>',$text);
-  $text = str_replace('&#039;','\'',$text);
-  $text = str_replace('&quot;','"',$text);
-  $text = str_replace('&amp;','&',$text);
-
-  return $text;
-}
-
-/**
-* given a start position and information about how text is to be laid out, calculate where
-* on the page the text will end
-*
-* @access private
-*/
-function PRVTgetTextPosition($x,$y,$angle,$size,$wa,$text){
-  // given this information return an array containing x and y for the end position as elements 0 and 1
-  $w = $this->getTextWidth($size,$text);
-  // need to adjust for the number of spaces in this text
-  $words = explode(' ',$text);
-  $nspaces=count($words)-1;
-  $w += $wa*$nspaces;
-  $a = deg2rad((float)$angle);
-  return array(cos($a)*$w+$x,-sin($a)*$w+$y);
-}
-
-/**
-* wrapper function for PRVTcheckTextDirective1
-*
-* @access private
-*/
-function PRVTcheckTextDirective(&$text,$i,&$f){
-  $x=0;
-  $y=0;
-  return $this->PRVTcheckTextDirective1($text,$i,$f,0,$x,$y);
-}
-
-/**
-* checks if the text stream contains a control directive
-* if so then makes some changes and returns the number of characters involved in the directive
-* this has been re-worked to include everything neccesary to fins the current writing point, so that
-* the location can be sent to the callback function if required
-* if the directive does not require a font change, then $f should be set to 0
-*
-* @access private
-*/
-function PRVTcheckTextDirective1(&$text,$i,&$f,$final,&$x,&$y,$size=0,$angle=0,$wordSpaceAdjust=0){
-  $directive = 0;
-  $j=$i;
-  if ($text[$j]=='<'){
-    $j++;
-    switch($text[$j]){
-      case '/':
-        $j++;
-        if (strlen($text) <= $j){
-          return $directive;
-        }
-        switch($text[$j]){
-          case 'b':
-          case 'i':
-            $j++;
-            if ($text[$j]=='>'){
-              $p = strrpos($this->currentTextState,$text[$j-1]);
-              if ($p !== false){
-                // then there is one to remove
-                $this->currentTextState = substr($this->currentTextState,0,$p).substr($this->currentTextState,$p+1);
-              }
-              $directive=$j-$i+1;
-            }
-            break;
-          case 'c':
-            // this this might be a callback function
-            $j++;
-            $k = strpos($text,'>',$j);
-            if ($k!==false && $text[$j]==':'){
-              // then this will be treated as a callback directive
-              $directive = $k-$i+1;
-              $f=0;
-              // split the remainder on colons to get the function name and the paramater
-              $tmp = substr($text,$j+1,$k-$j-1);
-              $b1 = strpos($tmp,':');
-              if ($b1!==false){
-                $func = substr($tmp,0,$b1);
-                $parm = substr($tmp,$b1+1);
-              } else {
-                $func=$tmp;
-                $parm='';
-              }
-              if (!isset($func) || !strlen(trim($func))){
-                $directive=0;
-              } else {
-                // only call the function if this is the final call
-                if ($final){
-                  // need to assess the text position, calculate the text width to this point
-                  // can use getTextWidth to find the text width I think
-                  $tmp = $this->PRVTgetTextPosition($x,$y,$angle,$size,$wordSpaceAdjust,substr($text,0,$i));
-                  $info = array('x'=>$tmp[0],'y'=>$tmp[1],'angle'=>$angle,'status'=>'end','p'=>$parm,'nCallback'=>$this->nCallback);
-                  $x=$tmp[0];
-                  $y=$tmp[1];
-                  $ret = $this->$func($info);
-                  if (is_array($ret)){
-                    // then the return from the callback function could set the position, to start with, later will do font colour, and font
-                    foreach($ret as $rk=>$rv){
-                      switch($rk){
-                        case 'x':
-                        case 'y':
-                          $$rk=$rv;
-                          break;
-                      }
-                    }
-                  }
-                  // also remove from to the stack
-                  // for simplicity, just take from the end, fix this another day
-                  $this->nCallback--;
-                  if ($this->nCallback<0){
-                    $this->nCallBack=0;
-                  }
-                }
-              }
-            }
-            break;
-        }
-        break;
-      case 'b':
-      case 'i':
-        $j++;
-        if ($text[$j]=='>'){
-          $this->currentTextState.=$text[$j-1];
-          $directive=$j-$i+1;
-        }
-        break;
-      case 'C':
-        $noClose=1;
-      case 'c':
-        // this this might be a callback function
-        $j++;
-        $k = strpos($text,'>',$j);
-        if ($k!==false && $text[$j]==':'){
-          // then this will be treated as a callback directive
-          $directive = $k-$i+1;
-          $f=0;
-          // split the remainder on colons to get the function name and the paramater
-//          $bits = explode(':',substr($text,$j+1,$k-$j-1));
-          $tmp = substr($text,$j+1,$k-$j-1);
-          $b1 = strpos($tmp,':');
-          if ($b1!==false){
-            $func = substr($tmp,0,$b1);
-            $parm = substr($tmp,$b1+1);
-          } else {
-            $func=$tmp;
-            $parm='';
-          }
-          if (!isset($func) || !strlen(trim($func))){
-            $directive=0;
-          } else {
-            // only call the function if this is the final call, ie, the one actually doing printing, not measurement
-            if ($final){
-              // need to assess the text position, calculate the text width to this point
-              // can use getTextWidth to find the text width I think
-              // also add the text height and decender
-              $tmp = $this->PRVTgetTextPosition($x,$y,$angle,$size,$wordSpaceAdjust,substr($text,0,$i));
-              $info = array('x'=>$tmp[0],'y'=>$tmp[1],'angle'=>$angle,'status'=>'start','p'=>$parm,'f'=>$func,'height'=>$this->getFontHeight($size),'decender'=>$this->getFontDecender($size));
-              $x=$tmp[0];
-              $y=$tmp[1];
-              if (!isset($noClose) || !$noClose){
-                // only add to the stack if this is a small 'c', therefore is a start-stop pair
-                $this->nCallback++;
-                $info['nCallback']=$this->nCallback;
-                $this->callback[$this->nCallback]=$info;
-              }
-              $ret = $this->$func($info);
-              if (is_array($ret)){
-                // then the return from the callback function could set the position, to start with, later will do font colour, and font
-                foreach($ret as $rk=>$rv){
-                  switch($rk){
-                    case 'x':
-                    case 'y':
-                      $$rk=$rv;
-                      break;
-                  }
-                }
-              }
-            }
-          }
-        }
-        break;
-    }
-  }
-  return $directive;
-}
-
-/**
-* add text to the document, at a specified location, size and angle on the page
-*/
-function addText($x,$y,$size,$text,$angle=0,$wordSpaceAdjust=0){
-  if (!$this->numFonts){$this->selectFont('./fonts/Helvetica');}
-
-  // if there are any open callbacks, then they should be called, to show the start of the line
-  if ($this->nCallback>0){
-    for ($i=$this->nCallback;$i>0;$i--){
-      // call each function
-      $info = array('x'=>$x,'y'=>$y,'angle'=>$angle,'status'=>'sol','p'=>$this->callback[$i]['p'],'nCallback'=>$this->callback[$i]['nCallback'],'height'=>$this->callback[$i]['height'],'decender'=>$this->callback[$i]['decender']);
-      $func = $this->callback[$i]['f'];
-      $this->$func($info);
-    }
-  }
-  if ($angle==0){
-    $this->objects[$this->currentContents]['c'].="\n".'BT '.sprintf('%.3f',$x).' '.sprintf('%.3f',$y).' Td';
-  } else {
-    $a = deg2rad((float)$angle);
-    $tmp = "\n".'BT ';
-    $tmp .= sprintf('%.3f',cos($a)).' '.sprintf('%.3f',(-1.0*sin($a))).' '.sprintf('%.3f',sin($a)).' '.sprintf('%.3f',cos($a)).' ';
-    $tmp .= sprintf('%.3f',$x).' '.sprintf('%.3f',$y).' Tm';
-    $this->objects[$this->currentContents]['c'] .= $tmp;
-  }
-  if ($wordSpaceAdjust!=0 || $wordSpaceAdjust != $this->wordSpaceAdjust){
-    $this->wordSpaceAdjust=$wordSpaceAdjust;
-    $this->objects[$this->currentContents]['c'].=' '.sprintf('%.3f',$wordSpaceAdjust).' Tw';
-  }
-  $len=strlen($text);
-  $start=0;
-  for ($i=0;$i<$len;$i++){
-    $f=1;
-    $directive = $this->PRVTcheckTextDirective($text,$i,$f);
-    if ($directive){
-      // then we should write what we need to
-      if ($i>$start){
-        $part = substr($text,$start,$i-$start);
-        $this->objects[$this->currentContents]['c'].=' /F'.$this->currentFontNum.' '.sprintf('%.1f',$size).' Tf ';
-        $this->objects[$this->currentContents]['c'].=' ('.$this->filterText($part).') Tj';
-      }
-      if ($f){
-        // then there was nothing drastic done here, restore the contents
-        $this->setCurrentFont();
-      } else {
-        $this->objects[$this->currentContents]['c'] .= ' ET';
-        $f=1;
-        $xp=$x;
-        $yp=$y;
-        $directive = $this->PRVTcheckTextDirective1($text,$i,$f,1,$xp,$yp,$size,$angle,$wordSpaceAdjust);
-
-        // restart the text object
-          if ($angle==0){
-            $this->objects[$this->currentContents]['c'].="\n".'BT '.sprintf('%.3f',$xp).' '.sprintf('%.3f',$yp).' Td';
-          } else {
-            $a = deg2rad((float)$angle);
-            $tmp = "\n".'BT ';
-            $tmp .= sprintf('%.3f',cos($a)).' '.sprintf('%.3f',(-1.0*sin($a))).' '.sprintf('%.3f',sin($a)).' '.sprintf('%.3f',cos($a)).' ';
-            $tmp .= sprintf('%.3f',$xp).' '.sprintf('%.3f',$yp).' Tm';
-            $this->objects[$this->currentContents]['c'] .= $tmp;
-          }
-          if ($wordSpaceAdjust!=0 || $wordSpaceAdjust != $this->wordSpaceAdjust){
-            $this->wordSpaceAdjust=$wordSpaceAdjust;
-            $this->objects[$this->currentContents]['c'].=' '.sprintf('%.3f',$wordSpaceAdjust).' Tw';
-          }
-      }
-      // and move the writing point to the next piece of text
-      $i=$i+$directive-1;
-      $start=$i+1;
-    }
-
-  }
-  if ($start<$len){
-    $part = substr($text,$start);
-    $this->objects[$this->currentContents]['c'].=' /F'.$this->currentFontNum.' '.sprintf('%.1f',$size).' Tf ';
-    $this->objects[$this->currentContents]['c'].=' ('.$this->filterText($part).') Tj';
-  }
-  $this->objects[$this->currentContents]['c'].=' ET';
-
-  // if there are any open callbacks, then they should be called, to show the end of the line
-  if ($this->nCallback>0){
-    for ($i=$this->nCallback;$i>0;$i--){
-      // call each function
-      $tmp = $this->PRVTgetTextPosition($x,$y,$angle,$size,$wordSpaceAdjust,$text);
-      $info = array('x'=>$tmp[0],'y'=>$tmp[1],'angle'=>$angle,'status'=>'eol','p'=>$this->callback[$i]['p'],'nCallback'=>$this->callback[$i]['nCallback'],'height'=>$this->callback[$i]['height'],'decender'=>$this->callback[$i]['decender']);
-      $func = $this->callback[$i]['f'];
-      $this->$func($info);
-    }
-  }
-}
-
-/**
-* calculate how wide a given text string will be on a page, at a given size.
-* this can be called externally, but is alse used by the other class functions
-*/
-function getTextWidth($size,$text){
-  // this function should not change any of the settings, though it will need to
-  // track any directives which change during calculation, so copy them at the start
-  // and put them back at the end.
-  $store_currentTextState = $this->currentTextState;
-
-  if (!$this->numFonts){
-    $this->selectFont('./fonts/Helvetica');
-  }
-
-  // converts a number or a float to a string so it can get the width
-  $text = "$text";
-
-  // hmm, this is where it all starts to get tricky - use the font information to
-  // calculate the width of each character, add them up and convert to user units
-  $w=0;
-  $len=strlen($text);
-  $cf = $this->currentFont;
-  for ($i=0;$i<$len;$i++){
-    $f=1;
-    $directive = $this->PRVTcheckTextDirective($text,$i,$f);
-    if ($directive){
-      if ($f){
-        $this->setCurrentFont();
-        $cf = $this->currentFont;
-      }
-      $i=$i+$directive-1;
-    } else {
-      $char=ord($text[$i]);
-      if (isset($this->fonts[$cf]['differences'][$char])){
-        // then this character is being replaced by another
-        $name = $this->fonts[$cf]['differences'][$char];
-        if (isset($this->fonts[$cf]['C'][$name]['WX'])){
-          $w+=$this->fonts[$cf]['C'][$name]['WX'];
-        }
-      } else if (isset($this->fonts[$cf]['C'][$char]['WX'])){
-        $w+=$this->fonts[$cf]['C'][$char]['WX'];
-      }
-    }
-  }
-
-  $this->currentTextState = $store_currentTextState;
-  $this->setCurrentFont();
-
-  return $w*$size/1000;
-}
-
-/**
-* do a part of the calculation for sorting out the justification of the text
-*
-* @access private
-*/
-function PRVTadjustWrapText($text,$actual,$width,&$x,&$adjust,$justification){
-  switch ($justification){
-    case 'left':
-      return;
-      break;
-    case 'right':
-      $x+=$width-$actual;
-      break;
-    case 'center':
-    case 'centre':
-      $x+=($width-$actual)/2;
-      break;
-    case 'full':
-      // count the number of words
-      $words = explode(' ',$text);
-      $nspaces=count($words)-1;
-      if ($nspaces>0){
-        $adjust = ($width-$actual)/$nspaces;
-      } else {
-        $adjust=0;
-      }
-      break;
-  }
-}
-
-/**
-* add text to the page, but ensure that it fits within a certain width
-* if it does not fit then put in as much as possible, splitting at word boundaries
-* and return the remainder.
-* justification and angle can also be specified for the text
-*/
-function addTextWrap($x,$y,$width,$size,$text,$justification='left',$angle=0,$test=0){
-  // this will display the text, and if it goes beyond the width $width, will backtrack to the
-  // previous space or hyphen, and return the remainder of the text.
-  // $justification can be set to 'left','right','center','centre','full'
-
-  // need to store the initial text state, as this will change during the width calculation
-  // but will need to be re-set before printing, so that the chars work out right
-  $store_currentTextState = $this->currentTextState;
-  if (!$this->numFonts){$this->selectFont('./fonts/Helvetica');}
-  if ($width<=0){
-    // error, pretend it printed ok, otherwise risking a loop
-    return '';
-  }
-  $w=0;
-  $break=0;
-  $breakWidth=0;
-  $len=strlen($text);
-  $cf = $this->currentFont;
-  $tw = $width/$size*1000;
-  for ($i=0;$i<$len;$i++){
-    $f=1;
-    $directive = $this->PRVTcheckTextDirective($text,$i,$f);
-    if ($directive){
-      if ($f){
-        $this->setCurrentFont();
-        $cf = $this->currentFont;
-      }
-      $i=$i+$directive-1;
-    } else {
-      $cOrd = ord($text[$i]);
-      if (isset($this->fonts[$cf]['differences'][$cOrd])){
-        // then this character is being replaced by another
-        $cOrd2 = $this->fonts[$cf]['differences'][$cOrd];
-      } else {
-        $cOrd2 = $cOrd;
-      }
-
-      if (isset($this->fonts[$cf]['C'][$cOrd2]['WX'])){
-        $w+=$this->fonts[$cf]['C'][$cOrd2]['WX'];
-      }
-      if ($w>$tw){
-        // then we need to truncate this line
-        if ($break>0){
-          // then we have somewhere that we can split :)
-          if ($text[$break]==' '){
-            $tmp = substr($text,0,$break);
-          } else {
-            $tmp = substr($text,0,$break+1);
-          }
-          $adjust=0;
-          $this->PRVTadjustWrapText($tmp,$breakWidth,$width,$x,$adjust,$justification);
-
-          // reset the text state
-          $this->currentTextState = $store_currentTextState;
-          $this->setCurrentFont();
-          if (!$test){
-            $this->addText($x,$y,$size,$tmp,$angle,$adjust);
-          }
-          return substr($text,$break+1);
-        } else {
-          // just split before the current character
-          $tmp = substr($text,0,$i);
-          $adjust=0;
-          $ctmp=ord($text[$i]);
-          if (isset($this->fonts[$cf]['differences'][$ctmp])){
-            $ctmp=$this->fonts[$cf]['differences'][$ctmp];
-          }
-          $tmpw=($w-$this->fonts[$cf]['C'][$ctmp]['WX'])*$size/1000;
-          $this->PRVTadjustWrapText($tmp,$tmpw,$width,$x,$adjust,$justification);
-          // reset the text state
-          $this->currentTextState = $store_currentTextState;
-          $this->setCurrentFont();
-          if (!$test){
-            $this->addText($x,$y,$size,$tmp,$angle,$adjust);
-          }
-          return substr($text,$i);
-        }
-      }
-      if ($text[$i]=='-'){
-        $break=$i;
-        $breakWidth = $w*$size/1000;
-      }
-      if ($text[$i]==' '){
-        $break=$i;
-        $ctmp=ord($text[$i]);
-        if (isset($this->fonts[$cf]['differences'][$ctmp])){
-          $ctmp=$this->fonts[$cf]['differences'][$ctmp];
-        }
-        $breakWidth = ($w-$this->fonts[$cf]['C'][$ctmp]['WX'])*$size/1000;
-      }
-    }
-  }
-  // then there was no need to break this line
-  if ($justification=='full'){
-    $justification='left';
-  }
-  $adjust=0;
-  $tmpw=$w*$size/1000;
-  $this->PRVTadjustWrapText($text,$tmpw,$width,$x,$adjust,$justification);
-  // reset the text state
-  $this->currentTextState = $store_currentTextState;
-  $this->setCurrentFont();
-  if (!$test){
-    $this->addText($x,$y,$size,$text,$angle,$adjust,$angle);
-  }
-  return '';
-}
-
-/**
-* this will be called at a new page to return the state to what it was on the
-* end of the previous page, before the stack was closed down
-* This is to get around not being able to have open 'q' across pages
-*
-*/
-function saveState($pageEnd=0){
-  if ($pageEnd){
-    // this will be called at a new page to return the state to what it was on the
-    // end of the previous page, before the stack was closed down
-    // This is to get around not being able to have open 'q' across pages
-    $opt = $this->stateStack[$pageEnd]; // ok to use this as stack starts numbering at 1
-    $this->setColor($opt['col']['r'],$opt['col']['g'],$opt['col']['b'],1);
-    $this->setStrokeColor($opt['str']['r'],$opt['str']['g'],$opt['str']['b'],1);
-    $this->objects[$this->currentContents]['c'].="\n".$opt['lin'];
-//    $this->currentLineStyle = $opt['lin'];
-  } else {
-    $this->nStateStack++;
-    $this->stateStack[$this->nStateStack]=array(
-      'col'=>$this->currentColour
-     ,'str'=>$this->currentStrokeColour
-     ,'lin'=>$this->currentLineStyle
-    );
-  }
-  $this->objects[$this->currentContents]['c'].="\nq";
-}
-
-/**
-* restore a previously saved state
-*/
-function restoreState($pageEnd=0){
-  if (!$pageEnd){
-    $n = $this->nStateStack;
-    $this->currentColour = $this->stateStack[$n]['col'];
-    $this->currentStrokeColour = $this->stateStack[$n]['str'];
-    $this->objects[$this->currentContents]['c'].="\n".$this->stateStack[$n]['lin'];
-    $this->currentLineStyle = $this->stateStack[$n]['lin'];
-    unset($this->stateStack[$n]);
-    $this->nStateStack--;
-  }
-  $this->objects[$this->currentContents]['c'].="\nQ";
-}
-
-/**
-* make a loose object, the output will go into this object, until it is closed, then will revert to
-* the current one.
-* this object will not appear until it is included within a page.
-* the function will return the object number
-*/
-function openObject(){
-  $this->nStack++;
-  $this->stack[$this->nStack]=array('c'=>$this->currentContents,'p'=>$this->currentPage);
-  // add a new object of the content type, to hold the data flow
-  $this->numObj++;
-  $this->o_contents($this->numObj,'new');
-  $this->currentContents=$this->numObj;
-  $this->looseObjects[$this->numObj]=1;
-
-  return $this->numObj;
-}
-
-/**
-* open an existing object for editing
-*/
-function reopenObject($id){
-   $this->nStack++;
-   $this->stack[$this->nStack]=array('c'=>$this->currentContents,'p'=>$this->currentPage);
-   $this->currentContents=$id;
-   // also if this object is the primary contents for a page, then set the current page to its parent
-   if (isset($this->objects[$id]['onPage'])){
-     $this->currentPage = $this->objects[$id]['onPage'];
-   }
-}
-
-/**
-* close an object
-*/
-function closeObject(){
-  // close the object, as long as there was one open in the first place, which will be indicated by
-  // an objectId on the stack.
-  if ($this->nStack>0){
-    $this->currentContents=$this->stack[$this->nStack]['c'];
-    $this->currentPage=$this->stack[$this->nStack]['p'];
-    $this->nStack--;
-    // easier to probably not worry about removing the old entries, they will be overwritten
-    // if there are new ones.
-  }
-}
-
-/**
-* stop an object from appearing on pages from this point on
-*/
-function stopObject($id){
-  // if an object has been appearing on pages up to now, then stop it, this page will
-  // be the last one that could contian it.
-  if (isset($this->addLooseObjects[$id])){
-    $this->addLooseObjects[$id]='';
-  }
-}
-
-/**
-* after an object has been created, it wil only show if it has been added, using this function.
-*/
-function addObject($id,$options='add'){
-  // add the specified object to the page
-  if (isset($this->looseObjects[$id]) && $this->currentContents!=$id){
-    // then it is a valid object, and it is not being added to itself
-    switch($options){
-      case 'all':
-        // then this object is to be added to this page (done in the next block) and
-        // all future new pages.
-        $this->addLooseObjects[$id]='all';
-      case 'add':
-        if (isset($this->objects[$this->currentContents]['onPage'])){
-          // then the destination contents is the primary for the page
-          // (though this object is actually added to that page)
-          $this->o_page($this->objects[$this->currentContents]['onPage'],'content',$id);
-        }
-        break;
-      case 'even':
-        $this->addLooseObjects[$id]='even';
-        $pageObjectId=$this->objects[$this->currentContents]['onPage'];
-        if ($this->objects[$pageObjectId]['info']['pageNum']%2==0){
-          $this->addObject($id); // hacky huh :)
-        }
-        break;
-      case 'odd':
-        $this->addLooseObjects[$id]='odd';
-        $pageObjectId=$this->objects[$this->currentContents]['onPage'];
-        if ($this->objects[$pageObjectId]['info']['pageNum']%2==1){
-          $this->addObject($id); // hacky huh :)
-        }
-        break;
-      case 'next':
-        $this->addLooseObjects[$id]='all';
-        break;
-      case 'nexteven':
-        $this->addLooseObjects[$id]='even';
-        break;
-      case 'nextodd':
-        $this->addLooseObjects[$id]='odd';
-        break;
-    }
-  }
-}
-
-/**
-* add content to the documents info object
-*/
-function addInfo($label,$value=0){
-  // this will only work if the label is one of the valid ones.
-  // modify this so that arrays can be passed as well.
-  // if $label is an array then assume that it is key=>value pairs
-  // else assume that they are both scalar, anything else will probably error
-  if (is_array($label)){
-    foreach ($label as $l=>$v){
-      $this->o_info($this->infoObject,$l,$v);
-    }
-  } else {
-    $this->o_info($this->infoObject,$label,$value);
-  }
-}
-
-/**
-* set the viewer preferences of the document, it is up to the browser to obey these.
-*/
-function setPreferences($label,$value=0){
-  // this will only work if the label is one of the valid ones.
-  if (is_array($label)){
-    foreach ($label as $l=>$v){
-      $this->o_catalog($this->catalogId,'viewerPreferences',array($l=>$v));
-    }
-  } else {
-    $this->o_catalog($this->catalogId,'viewerPreferences',array($label=>$value));
-  }
-}
-
-/**
-* extract an integer from a position in a byte stream
-*
-* @access private
-*/
-function PRVT_getBytes(&$data,$pos,$num){
-  // return the integer represented by $num bytes from $pos within $data
-  $ret=0;
-  for ($i=0;$i<$num;$i++){
-    $ret=$ret*256;
-    $ret+=ord($data[$pos+$i]);
-  }
-  return $ret;
-}
-
-/**
-* add a PNG image into the document, from a file
-* this should work with remote files
-*/
-function addPngFromFile($file,$x,$y,$w=0,$h=0){
-  // read in a png file, interpret it, then add to the system
-  $error=0;
-  $tmp = get_magic_quotes_runtime();
-  set_magic_quotes_runtime(0);
-  $fp = @fopen($file,'rb');
-  if ($fp){
-    $data='';
-    while(!feof($fp)){
-      $data .= fread($fp,1024);
-    }
-    fclose($fp);
-  } else {
-    $error = 1;
-    $errormsg = 'trouble opening file: '.$file;
-  }
-  set_magic_quotes_runtime($tmp);
-
-  if (!$error){
-    $header = chr(137).chr(80).chr(78).chr(71).chr(13).chr(10).chr(26).chr(10);
-    if (substr($data,0,8)!=$header){
-      $error=1;
-      $errormsg = 'this file does not have a valid header';
-    }
-  }
-
-  if (!$error){
-    // set pointer
-    $p = 8;
-    $len = strlen($data);
-    // cycle through the file, identifying chunks
-    $haveHeader=0;
-    $info=array();
-    $idata='';
-    $pdata='';
-    while ($p<$len){
-      $chunkLen = $this->PRVT_getBytes($data,$p,4);
-      $chunkType = substr($data,$p+4,4);
-//      echo $chunkType.' - '.$chunkLen.'<br>';
-
-      switch($chunkType){
-        case 'IHDR':
-          // this is where all the file information comes from
-          $info['width']=$this->PRVT_getBytes($data,$p+8,4);
-          $info['height']=$this->PRVT_getBytes($data,$p+12,4);
-          $info['bitDepth']=ord($data[$p+16]);
-          $info['colorType']=ord($data[$p+17]);
-          $info['compressionMethod']=ord($data[$p+18]);
-          $info['filterMethod']=ord($data[$p+19]);
-          $info['interlaceMethod']=ord($data[$p+20]);
-//print_r($info);
-          $haveHeader=1;
-          if ($info['compressionMethod']!=0){
-            $error=1;
-            $errormsg = 'unsupported compression method';
-          }
-          if ($info['filterMethod']!=0){
-            $error=1;
-            $errormsg = 'unsupported filter method';
-          }
-          break;
-        case 'PLTE':
-          $pdata.=substr($data,$p+8,$chunkLen);
-          break;
-        case 'IDAT':
-          $idata.=substr($data,$p+8,$chunkLen);
-          break;
-        case 'tRNS':
-          //this chunk can only occur once and it must occur after the PLTE chunk and before IDAT chunk
-          //print "tRNS found, color type = ".$info['colorType']."<BR>";
-          $transparency = array();
-          if ($info['colorType'] == 3) { // indexed color, rbg
-          /* corresponding to entries in the plte chunk
-          Alpha for palette index 0: 1 byte
-          Alpha for palette index 1: 1 byte
-          ...etc...
-          */
-            // there will be one entry for each palette entry. up until the last non-opaque entry.
-            // set up an array, stretching over all palette entries which will be o (opaque) or 1 (transparent)
-            $transparency['type']='indexed';
-            $numPalette = strlen($pdata)/3;
-            $trans=0;
-            for ($i=$chunkLen;$i>=0;$i--){
-              if (ord($data[$p+8+$i])==0){
-                $trans=$i;
-              }
-            }
-            $transparency['data'] = $trans;
-
-          } elseif($info['colorType'] == 0) { // grayscale
-          /* corresponding to entries in the plte chunk
-          Gray: 2 bytes, range 0 .. (2^bitdepth)-1
-          */
-//            $transparency['grayscale']=$this->PRVT_getBytes($data,$p+8,2); // g = grayscale
-            $transparency['type']='indexed';
-            $transparency['data'] = ord($data[$p+8+1]);
-
-          } elseif($info['colorType'] == 2) { // truecolor
-          /* corresponding to entries in the plte chunk
-          Red: 2 bytes, range 0 .. (2^bitdepth)-1
-          Green: 2 bytes, range 0 .. (2^bitdepth)-1
-          Blue: 2 bytes, range 0 .. (2^bitdepth)-1
-          */
-            $transparency['r']=$this->PRVT_getBytes($data,$p+8,2); // r from truecolor
-            $transparency['g']=$this->PRVT_getBytes($data,$p+10,2); // g from truecolor
-            $transparency['b']=$this->PRVT_getBytes($data,$p+12,2); // b from truecolor
-
-          } else {
-          //unsupported transparency type
-          }
-          // KS End new code
-          break;
-        default:
-          break;
-      }
-
-      $p += $chunkLen+12;
-    }
-
-    if(!$haveHeader){
-      $error = 1;
-      $errormsg = 'information header is missing';
-    }
-    if (isset($info['interlaceMethod']) && $info['interlaceMethod']){
-      $error = 1;
-      $errormsg = 'There appears to be no support for interlaced images in pdf.';
-    }
-  }
-
-  if (!$error && $info['bitDepth'] > 8){
-    $error = 1;
-    $errormsg = 'only bit depth of 8 or less is supported';
-  }
-
-  if (!$error){
-    if ($info['colorType']!=2 && $info['colorType']!=0 && $info['colorType']!=3){
-      $error = 1;
-      $errormsg = 'transparancey alpha channel not supported, transparency only supported for palette images.';
-    } else {
-      switch ($info['colorType']){
-        case 3:
-          $color = 'DeviceRGB';
-          $ncolor=1;
-          break;
-        case 2:
-          $color = 'DeviceRGB';
-          $ncolor=3;
-          break;
-        case 0:
-          $color = 'DeviceGray';
-          $ncolor=1;
-          break;
-      }
-    }
-  }
-  if ($error){
-    $this->addMessage('PNG error - ('.$file.') '.$errormsg);
-    return;
-  }
-  if ($w==0){
-    $w=$h/$info['height']*$info['width'];
-  }
-  if ($h==0){
-    $h=$w*$info['height']/$info['width'];
-  }
-//print_r($info);
-  // so this image is ok... add it in.
-  $this->numImages++;
-  $im=$this->numImages;
-  $label='I'.$im;
-  $this->numObj++;
-//  $this->o_image($this->numObj,'new',array('label'=>$label,'data'=>$idata,'iw'=>$w,'ih'=>$h,'type'=>'png','ic'=>$info['width']));
-  $options = array('label'=>$label,'data'=>$idata,'bitsPerComponent'=>$info['bitDepth'],'pdata'=>$pdata
-                                      ,'iw'=>$info['width'],'ih'=>$info['height'],'type'=>'png','color'=>$color,'ncolor'=>$ncolor);
-  if (isset($transparency)){
-    $options['transparency']=$transparency;
-  }
-  $this->o_image($this->numObj,'new',$options);
-
-  $this->objects[$this->currentContents]['c'].="\nq";
-  $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$w)." 0 0 ".sprintf('%.3f',$h)." ".sprintf('%.3f',$x)." ".sprintf('%.3f',$y)." cm";
-  $this->objects[$this->currentContents]['c'].="\n/".$label.' Do';
-  $this->objects[$this->currentContents]['c'].="\nQ";
-}
-
-/**
-* add a JPEG image into the document, from a file
-*/
-function addJpegFromFile($img,$x,$y,$w=0,$h=0){
-  // attempt to add a jpeg image straight from a file, using no GD commands
-  // note that this function is unable to operate on a remote file.
-
-  if (!file_exists($img)){
-    return;
-  }
-
-  $tmp=getimagesize($img);
-  $imageWidth=$tmp[0];
-  $imageHeight=$tmp[1];
-
-  if (isset($tmp['channels'])){
-    $channels = $tmp['channels'];
-  } else {
-    $channels = 3;
-  }
-
-  if ($w<=0 && $h<=0){
-    $w=$imageWidth;
-  }
-  if ($w==0){
-    $w=$h/$imageHeight*$imageWidth;
-  }
-  if ($h==0){
-    $h=$w*$imageHeight/$imageWidth;
-  }
-
-  $fp=fopen($img,'rb');
-
-  $tmp = get_magic_quotes_runtime();
-  set_magic_quotes_runtime(0);
-  $data = fread($fp,filesize($img));
-  set_magic_quotes_runtime($tmp);
-
-  fclose($fp);
-
-  $this->addJpegImage_common($data,$x,$y,$w,$h,$imageWidth,$imageHeight,$channels);
-}
-
-/**
-* add an image into the document, from a GD object
-* this function is not all that reliable, and I would probably encourage people to use
-* the file based functions
-*/
-function addImage(&$img,$x,$y,$w=0,$h=0,$quality=75){
-  // add a new image into the current location, as an external object
-  // add the image at $x,$y, and with width and height as defined by $w & $h
-
-  // note that this will only work with full colour images and makes them jpg images for display
-  // later versions could present lossless image formats if there is interest.
-
-  // there seems to be some problem here in that images that have quality set above 75 do not appear
-  // not too sure why this is, but in the meantime I have restricted this to 75.
-  if ($quality>75){
-    $quality=75;
-  }
-
-  // if the width or height are set to zero, then set the other one based on keeping the image
-  // height/width ratio the same, if they are both zero, then give up :)
-  $imageWidth=imagesx($img);
-  $imageHeight=imagesy($img);
-
-  if ($w<=0 && $h<=0){
-    return;
-  }
-  if ($w==0){
-    $w=$h/$imageHeight*$imageWidth;
-  }
-  if ($h==0){
-    $h=$w*$imageHeight/$imageWidth;
-  }
-
-  // gotta get the data out of the img..
-
-  // so I write to a temp file, and then read it back.. soo ugly, my apologies.
-  $tmpDir='/tmp';
-  $tmpName=tempnam($tmpDir,'img');
-  imagejpeg($img,$tmpName,$quality);
-  $fp=fopen($tmpName,'rb');
-
-  $tmp = get_magic_quotes_runtime();
-  set_magic_quotes_runtime(0);
-  $fp = @fopen($tmpName,'rb');
-  if ($fp){
-    $data='';
-    while(!feof($fp)){
-      $data .= fread($fp,1024);
-    }
-    fclose($fp);
-  } else {
-    $error = 1;
-    $errormsg = 'trouble opening file';
-  }
-//  $data = fread($fp,filesize($tmpName));
-  set_magic_quotes_runtime($tmp);
-//  fclose($fp);
-  unlink($tmpName);
-  $this->addJpegImage_common($data,$x,$y,$w,$h,$imageWidth,$imageHeight);
-}
-
-/**
-* common code used by the two JPEG adding functions
-*
-* @access private
-*/
-function addJpegImage_common(&$data,$x,$y,$w=0,$h=0,$imageWidth,$imageHeight,$channels=3){
-  // note that this function is not to be called externally
-  // it is just the common code between the GD and the file options
-  $this->numImages++;
-  $im=$this->numImages;
-  $label='I'.$im;
-  $this->numObj++;
-  $this->o_image($this->numObj,'new',array('label'=>$label,'data'=>$data,'iw'=>$imageWidth,'ih'=>$imageHeight,'channels'=>$channels));
-
-  $this->objects[$this->currentContents]['c'].="\nq";
-  $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$w)." 0 0 ".sprintf('%.3f',$h)." ".sprintf('%.3f',$x)." ".sprintf('%.3f',$y)." cm";
-  $this->objects[$this->currentContents]['c'].="\n/".$label.' Do';
-  $this->objects[$this->currentContents]['c'].="\nQ";
-}
-
-/**
-* specify where the document should open when it first starts
-*/
-function openHere($style,$a=0,$b=0,$c=0){
-  // this function will open the document at a specified page, in a specified style
-  // the values for style, and the required paramters are:
-  // 'XYZ'  left, top, zoom
-  // 'Fit'
-  // 'FitH' top
-  // 'FitV' left
-  // 'FitR' left,bottom,right
-  // 'FitB'
-  // 'FitBH' top
-  // 'FitBV' left
-  $this->numObj++;
-  $this->o_destination($this->numObj,'new',array('page'=>$this->currentPage,'type'=>$style,'p1'=>$a,'p2'=>$b,'p3'=>$c));
-  $id = $this->catalogId;
-  $this->o_catalog($id,'openHere',$this->numObj);
-}
-
-/**
-* create a labelled destination within the document
-*/
-function addDestination($label,$style,$a=0,$b=0,$c=0){
-  // associates the given label with the destination, it is done this way so that a destination can be specified after
-  // it has been linked to
-  // styles are the same as the 'openHere' function
-  $this->numObj++;
-  $this->o_destination($this->numObj,'new',array('page'=>$this->currentPage,'type'=>$style,'p1'=>$a,'p2'=>$b,'p3'=>$c));
-  $id = $this->numObj;
-  // store the label->idf relationship, note that this means that labels can be used only once
-  $this->destinations["$label"]=$id;
-}
-
-/**
-* define font families, this is used to initialize the font families for the default fonts
-* and for the user to add new ones for their fonts. The default bahavious can be overridden should
-* that be desired.
-*/
-function setFontFamily($family,$options=''){
-  if (!is_array($options)){
-    if ($family=='init'){
-      // set the known family groups
-      // these font families will be used to enable bold and italic markers to be included
-      // within text streams. html forms will be used... <b></b> <i></i>
-      $this->fontFamilies['Helvetica.afm']=array(
-         'b'=>'Helvetica-Bold.afm'
-        ,'i'=>'Helvetica-Oblique.afm'
-        ,'bi'=>'Helvetica-BoldOblique.afm'
-        ,'ib'=>'Helvetica-BoldOblique.afm'
-      );
-      $this->fontFamilies['Courier.afm']=array(
-         'b'=>'Courier-Bold.afm'
-        ,'i'=>'Courier-Oblique.afm'
-        ,'bi'=>'Courier-BoldOblique.afm'
-        ,'ib'=>'Courier-BoldOblique.afm'
-      );
-      $this->fontFamilies['Times-Roman.afm']=array(
-         'b'=>'Times-Bold.afm'
-        ,'i'=>'Times-Italic.afm'
-        ,'bi'=>'Times-BoldItalic.afm'
-        ,'ib'=>'Times-BoldItalic.afm'
-      );
-    }
-  } else {
-    // the user is trying to set a font family
-    // note that this can also be used to set the base ones to something else
-    if (strlen($family)){
-      $this->fontFamilies[$family] = $options;
-    }
-  }
-}
-
-/**
-* used to add messages for use in debugging
-*/
-function addMessage($message){
-  $this->messages.=$message."\n";
-}
-
-/**
-* a few functions which should allow the document to be treated transactionally.
-*/
-function transaction($action){
-  switch ($action){
-    case 'start':
-      // store all the data away into the checkpoint variable
-      $data = get_object_vars($this);
-      $this->checkpoint = $data;
-      unset($data);
-      break;
-    case 'commit':
-      if (is_array($this->checkpoint) && isset($this->checkpoint['checkpoint'])){
-        $tmp = $this->checkpoint['checkpoint'];
-        $this->checkpoint = $tmp;
-        unset($tmp);
-      } else {
-        $this->checkpoint='';
-      }
-      break;
-    case 'rewind':
-      // do not destroy the current checkpoint, but move us back to the state then, so that we can try again
-      if (is_array($this->checkpoint)){
-        // can only abort if were inside a checkpoint
-        $tmp = $this->checkpoint;
-        foreach ($tmp as $k=>$v){
-          if ($k != 'checkpoint'){
-            $this->$k=$v;
-          }
-        }
-        unset($tmp);
-      }
-      break;
-    case 'abort':
-      if (is_array($this->checkpoint)){
-        // can only abort if were inside a checkpoint
-        $tmp = $this->checkpoint;
-        foreach ($tmp as $k=>$v){
-          $this->$k=$v;
-        }
-        unset($tmp);
-      }
-      break;
-  }
-
-}
-
-} // end of class
-
-?>

+ 0 - 2
main/inc/lib/formvalidator/Rule/allowed_tags.inc.php

@@ -921,10 +921,8 @@ $allowed_tags_teacher['body']['link'] = array();
 $allowed_tags_teacher['body']['text'] = array();
 $allowed_tags_teacher['body']['vlink'] = array();
 
-
 $allowed_tags_teacher_full_page = $allowed_tags_student_full_page;
 
-
 // ALLOWED HTML FOR ANONYMOUS USERS
 
 $allowed_tags_anonymous = $allowed_tags_student;

+ 0 - 1
main/inc/lib/htmlpurifier/VERSION

@@ -1 +0,0 @@
-4.2.0

+ 0 - 64
main/inc/lib/htmlpurifier/configdoc/generate.php

@@ -1,64 +0,0 @@
-<?php
-
-/**
- * Generates XML and HTML documents describing configuration.
- * @note PHP 5.2+ only!
- */
-
-/*
-TODO:
-- make XML format richer
-- extend XSLT transformation (see the corresponding XSLT file)
-- allow generation of packaged docs that can be easily moved
-- multipage documentation
-- determine how to multilingualize
-- add blurbs to ToC
-*/
-
-if (version_compare(PHP_VERSION, '5.2', '<')) exit('PHP 5.2+ required.');
-error_reporting(E_ALL | E_STRICT);
-
-chdir(dirname(__FILE__));
-
-// load dual-libraries
-require_once '../extras/HTMLPurifierExtras.auto.php';
-require_once '../library/HTMLPurifier.auto.php';
-
-// setup HTML Purifier singleton
-HTMLPurifier::getInstance(array(
-    'AutoFormat.PurifierLinkify' => true
-));
-
-$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
-$interchange = new HTMLPurifier_ConfigSchema_Interchange();
-$builder->buildDir($interchange);
-$loader = dirname(__FILE__) . '/../config-schema.php';
-if (file_exists($loader)) include $loader;
-$interchange->validate();
-
-$style = 'plain'; // use $_GET in the future, careful to validate!
-$configdoc_xml = 'configdoc.xml';
-
-$xml_builder = new HTMLPurifier_ConfigSchema_Builder_Xml();
-$xml_builder->openURI($configdoc_xml);
-$xml_builder->build($interchange);
-unset($xml_builder); // free handle
-
-$xslt = new ConfigDoc_HTMLXSLTProcessor();
-$xslt->importStylesheet(dirname(__FILE__) . "/styles/$style.xsl");
-$output = $xslt->transformToHTML($configdoc_xml);
-
-if (!$output) {
-    echo "Error in generating files\n";
-    exit(1);
-}
-
-// write out
-file_put_contents("$style.html", $output);
-
-if (php_sapi_name() != 'cli') {
-    // output (instant feedback if it's a browser)
-    echo $output;
-} else {
-    echo 'Files generated successfully.';
-}

+ 0 - 6
main/inc/lib/htmlpurifier/configdoc/index.html

@@ -1,6 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-</body>
-</html>

+ 0 - 6
main/inc/lib/htmlpurifier/configdoc/styles/index.html

@@ -1,6 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-</body>
-</html>

+ 0 - 253
main/inc/lib/htmlpurifier/configdoc/styles/plain.xsl

@@ -1,253 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet
-    version     = "1.0"
-    xmlns       = "http://www.w3.org/1999/xhtml"
-    xmlns:xsl   = "http://www.w3.org/1999/XSL/Transform"
->
-    <xsl:output
-        method      = "xml"
-        encoding    = "UTF-8"
-        doctype-public = "-//W3C//DTD XHTML 1.0 Transitional//EN"
-        doctype-system = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
-        indent = "no"
-        media-type = "text/html"
-    />
-    <xsl:param name="css" select="'styles/plain.css'"/>
-    <xsl:param name="title" select="'Configuration Documentation'"/>
-
-    <xsl:variable name="typeLookup"  select="document('../types.xml')/types" />
-    <xsl:variable name="usageLookup" select="document('../usage.xml')/usage" />
-
-    <!-- Twiddle this variable to get the columns as even as possible -->
-    <xsl:variable name="maxNumberAdjust" select="2" />
-
-    <xsl:template match="/">
-        <html lang="en" xml:lang="en">
-            <head>
-                <title><xsl:value-of select="$title" /> - <xsl:value-of select="/configdoc/title" /></title>
-                <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
-                <link rel="stylesheet" type="text/css" href="{$css}" />
-            </head>
-            <body>
-                <div id="content">
-                    <div id="library"><xsl:value-of select="/configdoc/title" /></div>
-                    <h1><xsl:value-of select="$title" /></h1>
-                    <div id="tocContainer">
-                        <h2>Table of Contents</h2>
-                        <ul id="toc">
-                            <xsl:apply-templates mode="toc">
-                                <xsl:with-param name="overflowNumber" select="round(count(/configdoc/namespace) div 2) + $maxNumberAdjust" />
-                            </xsl:apply-templates>
-                        </ul>
-                    </div>
-                    <div id="typesContainer">
-                        <h2>Types</h2>
-                        <xsl:apply-templates select="$typeLookup" mode="types" />
-                    </div>
-                    <xsl:apply-templates />
-                </div>
-            </body>
-        </html>
-    </xsl:template>
-
-    <xsl:template match="type" mode="types">
-        <div class="type-block">
-            <xsl:attribute name="id">type-<xsl:value-of select="@id" /></xsl:attribute>
-            <h3><code><xsl:value-of select="@id" /></code>: <xsl:value-of select="@name" /></h3>
-            <div class="type-description">
-                <xsl:copy-of xmlns:xhtml="http://www.w3.org/1999/xhtml" select="xhtml:div/node()" />
-            </div>
-        </div>
-    </xsl:template>
-
-    <xsl:template match="title" mode="toc" />
-    <xsl:template match="namespace" mode="toc">
-        <xsl:param name="overflowNumber" />
-        <xsl:variable name="number"><xsl:number level="single" /></xsl:variable>
-        <xsl:variable name="directiveNumber"><xsl:number level="any" count="directive" /></xsl:variable>
-        <xsl:if test="count(directive)&gt;0">
-            <li>
-                <!-- BEGIN multicolumn code -->
-                <xsl:if test="$number &gt;= $overflowNumber">
-                    <xsl:attribute name="class">col-2</xsl:attribute>
-                </xsl:if>
-                <xsl:if test="$number = $overflowNumber">
-                    <xsl:attribute name="style">margin-top:-<xsl:value-of select="($number * 2 + $directiveNumber - 3) * 1.2" />em</xsl:attribute>
-                </xsl:if>
-                <!-- END multicolumn code -->
-                <a href="#{@id}"><xsl:value-of select="name" /></a>
-                <ul>
-                    <xsl:apply-templates select="directive" mode="toc">
-                        <xsl:with-param name="overflowNumber" select="$overflowNumber" />
-                    </xsl:apply-templates>
-                </ul>
-                <xsl:if test="$number + 1 = $overflowNumber">
-                    <div class="col-l" />
-                </xsl:if>
-            </li>
-        </xsl:if>
-    </xsl:template>
-    <xsl:template match="directive" mode="toc">
-        <xsl:variable name="number">
-            <xsl:number level="any" count="directive|namespace" />
-        </xsl:variable>
-        <xsl:if test="not(deprecated)">
-            <li>
-                <a href="#{@id}"><xsl:value-of select="name" /></a>
-            </li>
-        </xsl:if>
-    </xsl:template>
-
-    <xsl:template match="title" />
-
-    <xsl:template match="namespace">
-        <div class="namespace">
-            <xsl:apply-templates />
-            <xsl:if test="count(directive)=0">
-                <p>No configuration directives defined for this namespace.</p>
-            </xsl:if>
-        </div>
-    </xsl:template>
-    <xsl:template match="namespace/name">
-        <h2 id="{../@id}"><xsl:value-of select="." /></h2>
-    </xsl:template>
-    <xsl:template match="namespace/description">
-        <div class="description">
-            <xsl:copy-of xmlns:xhtml="http://www.w3.org/1999/xhtml" select="xhtml:div/node()" />
-        </div>
-    </xsl:template>
-
-    <xsl:template match="directive">
-        <div>
-            <xsl:attribute name="class"><!--
-                -->directive<!--
-                --><xsl:if test="deprecated"> deprecated</xsl:if><!--
-            --></xsl:attribute>
-            <xsl:apply-templates>
-                <xsl:with-param name="id" select="@id" />
-            </xsl:apply-templates>
-        </div>
-    </xsl:template>
-    <xsl:template match="directive/name">
-        <xsl:param name="id" />
-        <xsl:apply-templates select="../aliases/alias" mode="anchor" />
-        <h3 id="{$id}"><xsl:value-of select="$id" /></h3>
-    </xsl:template>
-    <xsl:template match="alias" mode="anchor">
-        <a id="{.}"></a>
-    </xsl:template>
-
-    <!-- Do not pass through -->
-    <xsl:template match="alias"></xsl:template>
-
-    <xsl:template match="directive/constraints">
-        <xsl:param name="id" />
-        <table class="constraints">
-            <xsl:apply-templates />
-            <xsl:if test="../aliases/alias">
-                <xsl:apply-templates select="../aliases" mode="constraints" />
-            </xsl:if>
-            <xsl:apply-templates select="$usageLookup/directive[@id=$id]" />
-        </table>
-    </xsl:template>
-    <xsl:template match="directive/aliases" mode="constraints">
-        <tr>
-            <th>Aliases</th>
-            <td>
-                <xsl:for-each select="alias">
-                    <xsl:if test="position()&gt;1">, </xsl:if>
-                    <xsl:value-of select="." />
-                </xsl:for-each>
-            </td>
-        </tr>
-    </xsl:template>
-    <xsl:template match="directive/description">
-        <div class="description">
-            <xsl:copy-of xmlns:xhtml="http://www.w3.org/1999/xhtml" select="xhtml:div/node()" />
-        </div>
-    </xsl:template>
-    <xsl:template match="directive/deprecated">
-        <div class="deprecated-notice">
-            <strong>Warning:</strong>
-            This directive was deprecated in version <xsl:value-of select="version" />.
-            <a href="#{use}">%<xsl:value-of select="use" /></a> should be used instead.
-        </div>
-    </xsl:template>
-    <xsl:template match="usage/directive">
-        <tr>
-            <th>Used in</th>
-            <td>
-                <ul>
-                    <xsl:apply-templates />
-                </ul>
-            </td>
-        </tr>
-    </xsl:template>
-    <xsl:template match="usage/directive/file">
-        <li>
-            <em><xsl:value-of select="@name" /></em> on line<xsl:if test="count(line)&gt;1">s</xsl:if>
-            <xsl:text> </xsl:text>
-            <xsl:for-each select="line">
-                <xsl:if test="position()&gt;1">, </xsl:if>
-                <xsl:value-of select="." />
-            </xsl:for-each>
-        </li>
-    </xsl:template>
-
-    <xsl:template match="constraints/version">
-        <tr>
-            <th>Version added</th>
-            <td><xsl:value-of select="." /></td>
-        </tr>
-    </xsl:template>
-    <xsl:template match="constraints/type">
-        <tr>
-            <th>Type</th>
-            <td>
-                <xsl:variable name="type" select="text()" />
-                <xsl:attribute name="class">type type-<xsl:value-of select="$type" /></xsl:attribute>
-                <a>
-                    <xsl:attribute name="href">#type-<xsl:value-of select="$type" /></xsl:attribute>
-                    <xsl:value-of select="$typeLookup/type[@id=$type]/@name" />
-                    <xsl:if test="@allow-null='yes'">
-                        (or null)
-                    </xsl:if>
-                </a>
-            </td>
-        </tr>
-    </xsl:template>
-    <xsl:template match="constraints/allowed">
-        <tr>
-            <th>Allowed values</th>
-            <td>
-                <xsl:for-each select="value"><!--
-                 --><xsl:if test="position()&gt;1">, </xsl:if>
-                    &quot;<xsl:value-of select="." />&quot;<!--
-             --></xsl:for-each>
-            </td>
-        </tr>
-    </xsl:template>
-    <xsl:template match="constraints/default">
-        <tr>
-            <th>Default</th>
-            <td><pre><xsl:value-of select="." xml:space="preserve" /></pre></td>
-        </tr>
-    </xsl:template>
-    <xsl:template match="constraints/external">
-        <tr>
-            <th>External deps</th>
-            <td>
-                <ul>
-                    <xsl:apply-templates />
-                </ul>
-            </td>
-        </tr>
-    </xsl:template>
-    <xsl:template match="constraints/external/project">
-        <li><xsl:value-of select="." /></li>
-    </xsl:template>
-
-</xsl:stylesheet>
-
-<!-- vim: et sw=4 sts=4
--->

+ 0 - 69
main/inc/lib/htmlpurifier/configdoc/types.xml

@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<types>
-  <type id="string" name="String"><div xmlns="http://www.w3.org/1999/xhtml">
-    A <a
-    href="http://docs.php.net/manual/en/language.types.string.php">sequence
-    of characters</a>.
-  </div></type>
-  <type id="istring" name="Case-insensitive string"><div xmlns="http://www.w3.org/1999/xhtml">
-    A series of case-insensitive characters.  Internally, upper-case
-    ASCII characters will be converted to lower-case.
-  </div></type>
-  <type id="text" name="Text"><div xmlns="http://www.w3.org/1999/xhtml">
-    A series of characters that may contain newlines.  Text tends to
-    indicate human-oriented text, as opposed to a machine format.
-  </div></type>
-  <type id="itext" name="Case-insensitive text"><div xmlns="http://www.w3.org/1999/xhtml">
-    A series of case-insensitive characters that may contain newlines.
-  </div></type>
-  <type id="int" name="Integer"><div xmlns="http://www.w3.org/1999/xhtml">
-    An <a
-      href="http://docs.php.net/manual/en/language.types.integer.php">
-      integer</a>.  You are alternatively permitted to pass a string of
-    digits instead, which will be cast to an integer using
-    <code>(int)</code>.
-  </div></type>
-  <type id="float" name="Float"><div xmlns="http://www.w3.org/1999/xhtml">
-    A <a href="http://docs.php.net/manual/en/language.types.float.php">
-      floating point number</a>.  You are alternatively permitted to
-    pass a numeric string (as defined by <code>is_numeric()</code>),
-    which will be cast to a float using <code>(float)</code>.
-  </div></type>
-  <type id="bool" name="Boolean"><div xmlns="http://www.w3.org/1999/xhtml">
-    A <a
-      href="http://docs.php.net/manual/en/language.types.boolean.php">boolean</a>.
-    You are alternatively permitted to pass an integer <code>0</code> or
-    <code>1</code> (other integers are not permitted) or a string
-    <code>"on"</code>, <code>"true"</code> or <code>"1"</code> for
-    <code>true</code>, and <code>"off"</code>, <code>"false"</code> or
-    <code>"0"</code> for <code>false</code>.
-  </div></type>
-  <type id="lookup" name="Lookup array"><div xmlns="http://www.w3.org/1999/xhtml">
-    An array whose values are <code>true</code>, e.g. <code>array('key'
-      => true, 'key2' => true)</code>.  You are alternatively permitted
-    to pass an array list of the keys <code>array('key', 'key2')</code>
-    or a comma-separated string of keys <code>"key, key2"</code>.  If
-    you pass an array list of values, ensure that your values are
-    strictly numerically indexed: <code>array('key1', 2 =>
-      'key2')</code> will not do what you expect and emits a warning.
-  </div></type>
-  <type id="list" name="Array list"><div xmlns="http://www.w3.org/1999/xhtml">
-    An array which has consecutive integer indexes, e.g.
-    <code>array('val1', 'val2')</code>.  You are alternatively permitted
-    to pass a comma-separated string of keys <code>"val1, val2"</code>.
-    If your array is not in this form, <code>array_values</code> is run
-    on the array and a warning is emitted.
-  </div></type>
-  <type id="hash" name="Associative array"><div xmlns="http://www.w3.org/1999/xhtml">
-    An array which is a mapping of keys to values, e.g.
-    <code>array('key1' => 'val1', 'key2' => 'val2')</code>.  You are
-    alternatively permitted to pass a comma-separated string of
-    key-colon-value strings, e.g. <code>"key1: val1, key2: val2"</code>.
-  </div></type>
-  <type id="mixed" name="Mixed"><div xmlns="http://www.w3.org/1999/xhtml">
-    An arbitrary PHP value of any type.
-  </div></type>
-</types>
-
-<!-- vim: et sw=4 sts=4
--->

+ 0 - 472
main/inc/lib/htmlpurifier/configdoc/usage.xml

@@ -1,472 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<usage>
- <directive id="Core.CollectErrors">
-  <file name="HTMLPurifier.php">
-   <line>131</line>
-  </file>
-  <file name="HTMLPurifier/Lexer.php">
-   <line>81</line>
-   <line>284</line>
-  </file>
-  <file name="HTMLPurifier/Lexer/DirectLex.php">
-   <line>53</line>
-   <line>73</line>
-   <line>348</line>
-  </file>
-  <file name="HTMLPurifier/Strategy/RemoveForeignElements.php">
-   <line>47</line>
-  </file>
- </directive>
- <directive id="CSS.MaxImgLength">
-  <file name="HTMLPurifier/CSSDefinition.php">
-   <line>157</line>
-  </file>
- </directive>
- <directive id="CSS.Proprietary">
-  <file name="HTMLPurifier/CSSDefinition.php">
-   <line>214</line>
-  </file>
- </directive>
- <directive id="CSS.AllowTricky">
-  <file name="HTMLPurifier/CSSDefinition.php">
-   <line>218</line>
-  </file>
- </directive>
- <directive id="CSS.AllowImportant">
-  <file name="HTMLPurifier/CSSDefinition.php">
-   <line>222</line>
-  </file>
- </directive>
- <directive id="CSS.AllowedProperties">
-  <file name="HTMLPurifier/CSSDefinition.php">
-   <line>275</line>
-  </file>
- </directive>
- <directive id="CSS.ForbiddenProperties">
-  <file name="HTMLPurifier/CSSDefinition.php">
-   <line>289</line>
-  </file>
- </directive>
- <directive id="Cache.DefinitionImpl">
-  <file name="HTMLPurifier/DefinitionCacheFactory.php">
-   <line>49</line>
-  </file>
- </directive>
- <directive id="HTML.Doctype">
-  <file name="HTMLPurifier/DoctypeRegistry.php">
-   <line>83</line>
-  </file>
- </directive>
- <directive id="HTML.CustomDoctype">
-  <file name="HTMLPurifier/DoctypeRegistry.php">
-   <line>85</line>
-  </file>
- </directive>
- <directive id="HTML.XHTML">
-  <file name="HTMLPurifier/DoctypeRegistry.php">
-   <line>88</line>
-  </file>
- </directive>
- <directive id="HTML.Strict">
-  <file name="HTMLPurifier/DoctypeRegistry.php">
-   <line>93</line>
-  </file>
- </directive>
- <directive id="Core.Encoding">
-  <file name="HTMLPurifier/Encoder.php">
-   <line>267</line>
-   <line>300</line>
-  </file>
- </directive>
- <directive id="Test.ForceNoIconv">
-  <file name="HTMLPurifier/Encoder.php">
-   <line>272</line>
-   <line>308</line>
-  </file>
- </directive>
- <directive id="Core.EscapeNonASCIICharacters">
-  <file name="HTMLPurifier/Encoder.php">
-   <line>304</line>
-  </file>
- </directive>
- <directive id="Output.CommentScriptContents">
-  <file name="HTMLPurifier/Generator.php">
-   <line>56</line>
-  </file>
- </directive>
- <directive id="Output.SortAttr">
-  <file name="HTMLPurifier/Generator.php">
-   <line>57</line>
-  </file>
- </directive>
- <directive id="Output.FlashCompat">
-  <file name="HTMLPurifier/Generator.php">
-   <line>58</line>
-  </file>
- </directive>
- <directive id="Output.TidyFormat">
-  <file name="HTMLPurifier/Generator.php">
-   <line>87</line>
-  </file>
- </directive>
- <directive id="Core.NormalizeNewlines">
-  <file name="HTMLPurifier/Generator.php">
-   <line>101</line>
-  </file>
-  <file name="HTMLPurifier/Lexer.php">
-   <line>266</line>
-  </file>
- </directive>
- <directive id="Output.Newline">
-  <file name="HTMLPurifier/Generator.php">
-   <line>102</line>
-  </file>
- </directive>
- <directive id="HTML.BlockWrapper">
-  <file name="HTMLPurifier/HTMLDefinition.php">
-   <line>222</line>
-  </file>
- </directive>
- <directive id="HTML.Parent">
-  <file name="HTMLPurifier/HTMLDefinition.php">
-   <line>230</line>
-  </file>
- </directive>
- <directive id="HTML.AllowedElements">
-  <file name="HTMLPurifier/HTMLDefinition.php">
-   <line>247</line>
-  </file>
- </directive>
- <directive id="HTML.AllowedAttributes">
-  <file name="HTMLPurifier/HTMLDefinition.php">
-   <line>248</line>
-  </file>
- </directive>
- <directive id="HTML.Allowed">
-  <file name="HTMLPurifier/HTMLDefinition.php">
-   <line>251</line>
-  </file>
- </directive>
- <directive id="HTML.ForbiddenElements">
-  <file name="HTMLPurifier/HTMLDefinition.php">
-   <line>342</line>
-  </file>
- </directive>
- <directive id="HTML.ForbiddenAttributes">
-  <file name="HTMLPurifier/HTMLDefinition.php">
-   <line>343</line>
-  </file>
- </directive>
- <directive id="HTML.Trusted">
-  <file name="HTMLPurifier/HTMLModuleManager.php">
-   <line>202</line>
-  </file>
-  <file name="HTMLPurifier/Lexer.php">
-   <line>271</line>
-  </file>
-  <file name="HTMLPurifier/HTMLModule/Image.php">
-   <line>27</line>
-  </file>
-  <file name="HTMLPurifier/Lexer/DirectLex.php">
-   <line>36</line>
-  </file>
-  <file name="HTMLPurifier/Strategy/RemoveForeignElements.php">
-   <line>23</line>
-  </file>
- </directive>
- <directive id="HTML.AllowedModules">
-  <file name="HTMLPurifier/HTMLModuleManager.php">
-   <line>209</line>
-  </file>
- </directive>
- <directive id="HTML.CoreModules">
-  <file name="HTMLPurifier/HTMLModuleManager.php">
-   <line>210</line>
-  </file>
- </directive>
- <directive id="HTML.Proprietary">
-  <file name="HTMLPurifier/HTMLModuleManager.php">
-   <line>221</line>
-  </file>
- </directive>
- <directive id="HTML.SafeObject">
-  <file name="HTMLPurifier/HTMLModuleManager.php">
-   <line>226</line>
-  </file>
- </directive>
- <directive id="HTML.SafeEmbed">
-  <file name="HTMLPurifier/HTMLModuleManager.php">
-   <line>229</line>
-  </file>
- </directive>
- <directive id="Attr.IDBlacklist">
-  <file name="HTMLPurifier/IDAccumulator.php">
-   <line>26</line>
-  </file>
- </directive>
- <directive id="Core.Language">
-  <file name="HTMLPurifier/LanguageFactory.php">
-   <line>88</line>
-  </file>
- </directive>
- <directive id="Core.LexerImpl">
-  <file name="HTMLPurifier/Lexer.php">
-   <line>76</line>
-  </file>
- </directive>
- <directive id="Core.MaintainLineNumbers">
-  <file name="HTMLPurifier/Lexer.php">
-   <line>80</line>
-  </file>
-  <file name="HTMLPurifier/Lexer/DirectLex.php">
-   <line>48</line>
-  </file>
- </directive>
- <directive id="Core.ConvertDocumentToFragment">
-  <file name="HTMLPurifier/Lexer.php">
-   <line>282</line>
-  </file>
- </directive>
- <directive id="Core.RemoveProcessingInstructions">
-  <file name="HTMLPurifier/Lexer.php">
-   <line>303</line>
-  </file>
- </directive>
- <directive id="URI.">
-  <file name="HTMLPurifier/URIDefinition.php">
-   <line>55</line>
-  </file>
-  <file name="HTMLPurifier/URIFilter/Munge.php">
-   <line>12</line>
-  </file>
- </directive>
- <directive id="URI.Host">
-  <file name="HTMLPurifier/URIDefinition.php">
-   <line>64</line>
-  </file>
- </directive>
- <directive id="URI.Base">
-  <file name="HTMLPurifier/URIDefinition.php">
-   <line>65</line>
-  </file>
- </directive>
- <directive id="URI.DefaultScheme">
-  <file name="HTMLPurifier/URIDefinition.php">
-   <line>72</line>
-  </file>
- </directive>
- <directive id="URI.AllowedSchemes">
-  <file name="HTMLPurifier/URISchemeRegistry.php">
-   <line>41</line>
-  </file>
- </directive>
- <directive id="URI.OverrideAllowedSchemes">
-  <file name="HTMLPurifier/URISchemeRegistry.php">
-   <line>42</line>
-  </file>
- </directive>
- <directive id="URI.Disable">
-  <file name="HTMLPurifier/AttrDef/URI.php">
-   <line>28</line>
-  </file>
- </directive>
- <directive id="Core.ColorKeywords">
-  <file name="HTMLPurifier/AttrDef/CSS/Color.php">
-   <line>12</line>
-  </file>
-  <file name="HTMLPurifier/AttrDef/HTML/Color.php">
-   <line>12</line>
-  </file>
- </directive>
- <directive id="Attr.AllowedClasses">
-  <file name="HTMLPurifier/AttrDef/HTML/Class.php">
-   <line>18</line>
-  </file>
- </directive>
- <directive id="Attr.ForbiddenClasses">
-  <file name="HTMLPurifier/AttrDef/HTML/Class.php">
-   <line>19</line>
-  </file>
- </directive>
- <directive id="Attr.AllowedFrameTargets">
-  <file name="HTMLPurifier/AttrDef/HTML/FrameTarget.php">
-   <line>15</line>
-  </file>
- </directive>
- <directive id="Attr.EnableID">
-  <file name="HTMLPurifier/AttrDef/HTML/ID.php">
-   <line>20</line>
-  </file>
- </directive>
- <directive id="Attr.IDPrefix">
-  <file name="HTMLPurifier/AttrDef/HTML/ID.php">
-   <line>26</line>
-  </file>
- </directive>
- <directive id="Attr.IDPrefixLocal">
-  <file name="HTMLPurifier/AttrDef/HTML/ID.php">
-   <line>28</line>
-   <line>31</line>
-  </file>
- </directive>
- <directive id="Attr.IDBlacklistRegexp">
-  <file name="HTMLPurifier/AttrDef/HTML/ID.php">
-   <line>54</line>
-  </file>
- </directive>
- <directive id="Attr.">
-  <file name="HTMLPurifier/AttrDef/HTML/LinkTypes.php">
-   <line>30</line>
-  </file>
- </directive>
- <directive id="Attr.DefaultTextDir">
-  <file name="HTMLPurifier/AttrTransform/BdoDir.php">
-   <line>13</line>
-  </file>
- </directive>
- <directive id="Core.RemoveInvalidImg">
-  <file name="HTMLPurifier/AttrTransform/ImgRequired.php">
-   <line>18</line>
-  </file>
-  <file name="HTMLPurifier/Strategy/RemoveForeignElements.php">
-   <line>20</line>
-  </file>
- </directive>
- <directive id="Attr.DefaultInvalidImage">
-  <file name="HTMLPurifier/AttrTransform/ImgRequired.php">
-   <line>19</line>
-  </file>
- </directive>
- <directive id="Attr.DefaultImageAlt">
-  <file name="HTMLPurifier/AttrTransform/ImgRequired.php">
-   <line>25</line>
-  </file>
- </directive>
- <directive id="Attr.DefaultInvalidImageAlt">
-  <file name="HTMLPurifier/AttrTransform/ImgRequired.php">
-   <line>33</line>
-  </file>
- </directive>
- <directive id="HTML.Attr.Name.UseCDATA">
-  <file name="HTMLPurifier/AttrTransform/Name.php">
-   <line>11</line>
-  </file>
-  <file name="HTMLPurifier/HTMLModule/Name.php">
-   <line>13</line>
-  </file>
- </directive>
- <directive id="HTML.FlashAllowFullScreen">
-  <file name="HTMLPurifier/AttrTransform/SafeParam.php">
-   <line>37</line>
-  </file>
- </directive>
- <directive id="Core.EscapeInvalidChildren">
-  <file name="HTMLPurifier/ChildDef/Required.php">
-   <line>62</line>
-  </file>
- </directive>
- <directive id="Cache.SerializerPath">
-  <file name="HTMLPurifier/DefinitionCache/Serializer.php">
-   <line>91</line>
-  </file>
- </directive>
- <directive id="Filter.ExtractStyleBlocks.TidyImpl">
-  <file name="HTMLPurifier/Filter/ExtractStyleBlocks.php">
-   <line>41</line>
-  </file>
- </directive>
- <directive id="Filter.ExtractStyleBlocks.Scope">
-  <file name="HTMLPurifier/Filter/ExtractStyleBlocks.php">
-   <line>65</line>
-  </file>
- </directive>
- <directive id="Filter.ExtractStyleBlocks.Escaping">
-  <file name="HTMLPurifier/Filter/ExtractStyleBlocks.php">
-   <line>123</line>
-  </file>
- </directive>
- <directive id="HTML.MaxImgLength">
-  <file name="HTMLPurifier/HTMLModule/Image.php">
-   <line>14</line>
-  </file>
-  <file name="HTMLPurifier/HTMLModule/SafeEmbed.php">
-   <line>13</line>
-  </file>
-  <file name="HTMLPurifier/HTMLModule/SafeObject.php">
-   <line>19</line>
-  </file>
- </directive>
- <directive id="HTML.TidyLevel">
-  <file name="HTMLPurifier/HTMLModule/Tidy.php">
-   <line>45</line>
-  </file>
- </directive>
- <directive id="HTML.TidyAdd">
-  <file name="HTMLPurifier/HTMLModule/Tidy.php">
-   <line>49</line>
-  </file>
- </directive>
- <directive id="HTML.TidyRemove">
-  <file name="HTMLPurifier/HTMLModule/Tidy.php">
-   <line>50</line>
-  </file>
- </directive>
- <directive id="AutoFormat.PurifierLinkify.DocURL">
-  <file name="HTMLPurifier/Injector/PurifierLinkify.php">
-   <line>15</line>
-  </file>
- </directive>
- <directive id="AutoFormat.RemoveEmpty.RemoveNbsp">
-  <file name="HTMLPurifier/Injector/RemoveEmpty.php">
-   <line>12</line>
-  </file>
- </directive>
- <directive id="AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions">
-  <file name="HTMLPurifier/Injector/RemoveEmpty.php">
-   <line>13</line>
-  </file>
- </directive>
- <directive id="Core.AggressivelyFixLt">
-  <file name="HTMLPurifier/Lexer/DOMLex.php">
-   <line>44</line>
-  </file>
- </directive>
- <directive id="Core.DirectLexLineNumberSyncInterval">
-  <file name="HTMLPurifier/Lexer/DirectLex.php">
-   <line>70</line>
-  </file>
- </directive>
- <directive id="Core.EscapeInvalidTags">
-  <file name="HTMLPurifier/Strategy/MakeWellFormed.php">
-   <line>45</line>
-  </file>
-  <file name="HTMLPurifier/Strategy/RemoveForeignElements.php">
-   <line>19</line>
-  </file>
- </directive>
- <directive id="Core.RemoveScriptContents">
-  <file name="HTMLPurifier/Strategy/RemoveForeignElements.php">
-   <line>25</line>
-  </file>
- </directive>
- <directive id="Core.HiddenElements">
-  <file name="HTMLPurifier/Strategy/RemoveForeignElements.php">
-   <line>26</line>
-  </file>
- </directive>
- <directive id="URI.HostBlacklist">
-  <file name="HTMLPurifier/URIFilter/HostBlacklist.php">
-   <line>8</line>
-  </file>
- </directive>
- <directive id="URI.MungeResources">
-  <file name="HTMLPurifier/URIFilter/Munge.php">
-   <line>14</line>
-  </file>
- </directive>
- <directive id="URI.MungeSecretKey">
-  <file name="HTMLPurifier/URIFilter/Munge.php">
-   <line>15</line>
-  </file>
- </directive>
-</usage>

+ 0 - 86
main/inc/lib/htmlpurifier/extras/ConfigDoc/HTMLXSLTProcessor.php

@@ -1,86 +0,0 @@
-<?php
-
-/**
- * Decorator/extender XSLT processor specifically for HTML documents.
- */
-class ConfigDoc_HTMLXSLTProcessor
-{
-
-    /**
-     * Instance of XSLTProcessor
-     */
-    protected $xsltProcessor;
-
-    public function __construct($proc = false) {
-        if ($proc === false) $proc = new XSLTProcessor();
-        $this->xsltProcessor = $proc;
-    }
-
-    /**
-     * @note Allows a string $xsl filename to be passed
-     */
-    public function importStylesheet($xsl) {
-        if (is_string($xsl)) {
-            $xsl_file = $xsl;
-            $xsl = new DOMDocument();
-            $xsl->load($xsl_file);
-        }
-        return $this->xsltProcessor->importStylesheet($xsl);
-    }
-
-    /**
-     * Transforms an XML file into compatible XHTML based on the stylesheet
-     * @param $xml XML DOM tree, or string filename
-     * @return string HTML output
-     * @todo Rename to transformToXHTML, as transformToHTML is misleading
-     */
-    public function transformToHTML($xml) {
-        if (is_string($xml)) {
-            $dom = new DOMDocument();
-            $dom->load($xml);
-        } else {
-            $dom = $xml;
-        }
-        $out = $this->xsltProcessor->transformToXML($dom);
-
-        // fudges for HTML backwards compatibility
-        // assumes that document is XHTML
-        $out = str_replace('/>', ' />', $out); // <br /> not <br/>
-        $out = str_replace(' xmlns=""', '', $out); // rm unnecessary xmlns
-
-        if (class_exists('Tidy')) {
-            // cleanup output
-            $config = array(
-                'indent'        => true,
-                'output-xhtml'  => true,
-                'wrap'          => 80
-            );
-            $tidy = new Tidy;
-            $tidy->parseString($out, $config, 'utf8');
-            $tidy->cleanRepair();
-            $out = (string) $tidy;
-        }
-
-        return $out;
-    }
-
-    /**
-     * Bulk sets parameters for the XSL stylesheet
-     * @param array $options Associative array of options to set
-     */
-    public function setParameters($options) {
-        foreach ($options as $name => $value) {
-            $this->xsltProcessor->setParameter('', $name, $value);
-        }
-    }
-
-    /**
-     * Forward any other calls to the XSLT processor
-     */
-    public function __call($name, $arguments) {
-        call_user_func_array(array($this->xsltProcessor, $name), $arguments);
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 6
main/inc/lib/htmlpurifier/extras/ConfigDoc/index.html

@@ -1,6 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-</body>
-</html>

+ 0 - 157
main/inc/lib/htmlpurifier/extras/FSTools.php

@@ -1,157 +0,0 @@
-<?php
-
-/**
- * Filesystem tools not provided by default; can recursively create, copy
- * and delete folders. Some template methods are provided for extensibility.
- *
- * @note This class must be instantiated to be used, although it does
- *       not maintain state.
- */
-class FSTools
-{
-
-    private static $singleton;
-
-    /**
-     * Returns a global instance of FSTools
-     */
-    static public function singleton() {
-        if (empty(FSTools::$singleton)) FSTools::$singleton = new FSTools();
-        return FSTools::$singleton;
-    }
-
-    /**
-     * Sets our global singleton to something else; useful for overloading
-     * functions.
-     */
-    static public function setSingleton($singleton) {
-        FSTools::$singleton = $singleton;
-    }
-
-    /**
-     * Recursively creates a directory
-     * @param string $folder Name of folder to create
-     * @note Adapted from the PHP manual comment 76612
-     */
-    public function mkdirr($folder) {
-        $folders = preg_split("#[\\\\/]#", $folder);
-        $base = '';
-        for($i = 0, $c = count($folders); $i < $c; $i++) {
-            if(empty($folders[$i])) {
-                if (!$i) {
-                    // special case for root level
-                    $base .= DIRECTORY_SEPARATOR;
-                }
-                continue;
-            }
-            $base .= $folders[$i];
-            if(!is_dir($base)){
-                $this->mkdir($base);
-            }
-            $base .= DIRECTORY_SEPARATOR;
-        }
-    }
-
-    /**
-     * Copy a file, or recursively copy a folder and its contents; modified
-     * so that copied files, if PHP, have includes removed
-     * @note Adapted from http://aidanlister.com/repos/v/function.copyr.php
-     */
-    public function copyr($source, $dest) {
-        // Simple copy for a file
-        if (is_file($source)) {
-            return $this->copy($source, $dest);
-        }
-        // Make destination directory
-        if (!is_dir($dest)) {
-            $this->mkdir($dest);
-        }
-        // Loop through the folder
-        $dir = $this->dir($source);
-        while ( false !== ($entry = $dir->read()) ) {
-            // Skip pointers
-            if ($entry == '.' || $entry == '..') {
-                continue;
-            }
-            if (!$this->copyable($entry)) {
-                continue;
-            }
-            // Deep copy directories
-            if ($dest !== "$source/$entry") {
-                $this->copyr("$source/$entry", "$dest/$entry");
-            }
-        }
-        // Clean up
-        $dir->close();
-        return true;
-    }
-
-    /**
-     * Overloadable function that tests a filename for copyability. By
-     * default, everything should be copied; you can restrict things to
-     * ignore hidden files, unreadable files, etc. This function
-     * applies to copyr().
-     */
-    public function copyable($file) {
-        return true;
-    }
-
-    /**
-     * Delete a file, or a folder and its contents
-     * @note Adapted from http://aidanlister.com/repos/v/function.rmdirr.php
-     */
-    public function rmdirr($dirname)
-    {
-        // Sanity check
-        if (!$this->file_exists($dirname)) {
-            return false;
-        }
-
-        // Simple delete for a file
-        if ($this->is_file($dirname) || $this->is_link($dirname)) {
-            return $this->unlink($dirname);
-        }
-
-        // Loop through the folder
-        $dir = $this->dir($dirname);
-        while (false !== $entry = $dir->read()) {
-            // Skip pointers
-            if ($entry == '.' || $entry == '..') {
-                continue;
-            }
-            // Recurse
-            $this->rmdirr($dirname . DIRECTORY_SEPARATOR . $entry);
-        }
-
-        // Clean up
-        $dir->close();
-        return $this->rmdir($dirname);
-    }
-
-    /**
-     * Recursively globs a directory.
-     */
-    public function globr($dir, $pattern, $flags = NULL) {
-        $files = $this->glob("$dir/$pattern", $flags);
-        if ($files === false) $files = array();
-        $sub_dirs = $this->glob("$dir/*", GLOB_ONLYDIR);
-        if ($sub_dirs === false) $sub_dirs = array();
-        foreach ($sub_dirs as $sub_dir) {
-            $sub_files = $this->globr($sub_dir, $pattern, $flags);
-            $files = array_merge($files, $sub_files);
-        }
-        return $files;
-    }
-
-    /**
-     * Allows for PHP functions to be called and be stubbed.
-     * @warning This function will not work for functions that need
-     *      to pass references; manually define a stub function for those.
-     */
-    public function __call($name, $args) {
-        return call_user_func_array($name, $args);
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 126
main/inc/lib/htmlpurifier/extras/FSTools/File.php

@@ -1,126 +0,0 @@
-<?php
-
-/**
- * Represents a file in the filesystem
- *
- * @warning Be sure to distinguish between get() and write() versus
- *      read() and put(), the former operates on the entire file, while
- *      the latter operates on a handle.
- */
-class FSTools_File
-{
-
-    /** Filename of file this object represents */
-    protected $name;
-
-    /** Handle for the file */
-    protected $handle = false;
-
-    /** Instance of FSTools for interfacing with filesystem */
-    protected $fs;
-
-    /**
-     * Filename of file you wish to instantiate.
-     * @note This file need not exist
-     */
-    public function __construct($name, $fs = false) {
-        $this->name = $name;
-        $this->fs = $fs ? $fs : FSTools::singleton();
-    }
-
-    /** Returns the filename of the file. */
-    public function getName() {return $this->name;}
-
-    /** Returns directory of the file without trailing slash */
-    public function getDirectory() {return $this->fs->dirname($this->name);}
-
-    /**
-     * Retrieves the contents of a file
-     * @todo Throw an exception if file doesn't exist
-     */
-    public function get() {
-        return $this->fs->file_get_contents($this->name);
-    }
-
-    /** Writes contents to a file, creates new file if necessary */
-    public function write($contents) {
-        return $this->fs->file_put_contents($this->name, $contents);
-    }
-
-    /** Deletes the file */
-    public function delete() {
-        return $this->fs->unlink($this->name);
-    }
-
-    /** Returns true if file exists and is a file. */
-    public function exists() {
-        return $this->fs->is_file($this->name);
-    }
-
-    /** Returns last file modification time */
-    public function getMTime() {
-        return $this->fs->filemtime($this->name);
-    }
-
-    /**
-     * Chmod a file
-     * @note We ignore errors because of some weird owner trickery due
-     *       to SVN duality
-     */
-    public function chmod($octal_code) {
-        return @$this->fs->chmod($this->name, $octal_code);
-    }
-
-    /** Opens file's handle */
-    public function open($mode) {
-        if ($this->handle) $this->close();
-        $this->handle = $this->fs->fopen($this->name, $mode);
-        return true;
-    }
-
-    /** Closes file's handle */
-    public function close() {
-        if (!$this->handle) return false;
-        $status = $this->fs->fclose($this->handle);
-        $this->handle = false;
-        return $status;
-    }
-
-    /** Retrieves a line from an open file, with optional max length $length */
-    public function getLine($length = null) {
-        if (!$this->handle) $this->open('r');
-        if ($length === null) return $this->fs->fgets($this->handle);
-        else return $this->fs->fgets($this->handle, $length);
-    }
-
-    /** Retrieves a character from an open file */
-    public function getChar() {
-        if (!$this->handle) $this->open('r');
-        return $this->fs->fgetc($this->handle);
-    }
-
-    /** Retrieves an $length bytes of data from an open data */
-    public function read($length) {
-        if (!$this->handle) $this->open('r');
-        return $this->fs->fread($this->handle, $length);
-    }
-
-    /** Writes to an open file */
-    public function put($string) {
-        if (!$this->handle) $this->open('a');
-        return $this->fs->fwrite($this->handle, $string);
-    }
-
-    /** Returns TRUE if the end of the file has been reached */
-    public function eof() {
-        if (!$this->handle) return true;
-        return $this->fs->feof($this->handle);
-    }
-
-    public function __destruct() {
-        if ($this->handle) $this->close();
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 6
main/inc/lib/htmlpurifier/extras/FSTools/index.html

@@ -1,6 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-</body>
-</html>

+ 0 - 25
main/inc/lib/htmlpurifier/extras/HTMLPurifierExtras.autoload.php

@@ -1,25 +0,0 @@
-<?php
-
-/**
- * @file
- * Convenience file that registers autoload handler for HTML Purifier.
- *
- * @warning
- *      This autoloader does not contain the compatibility code seen in
- *      HTMLPurifier_Bootstrap; the user is expected to make any necessary
- *      changes to use this library.
- */
-
-if (function_exists('spl_autoload_register')) {
-    spl_autoload_register(array('HTMLPurifierExtras', 'autoload'));
-    if (function_exists('__autoload')) {
-        // Be polite and ensure that userland autoload gets retained
-        spl_autoload_register('__autoload');
-    }
-} elseif (!function_exists('__autoload')) {
-    function __autoload($class) {
-        return HTMLPurifierExtras::autoload($class);
-    }
-}
-
-// vim: et sw=4 sts=4

+ 0 - 29
main/inc/lib/htmlpurifier/extras/HTMLPurifierExtras.php

@@ -1,29 +0,0 @@
-<?php
-
-/**
- * Meta-class for HTML Purifier's extra class hierarchies, similar to
- * HTMLPurifier_Bootstrap.
- */
-class HTMLPurifierExtras
-{
-
-    public static function autoload($class) {
-        $path = HTMLPurifierExtras::getPath($class);
-        if (!$path) return false;
-        require $path;
-        return true;
-    }
-
-    public static function getPath($class) {
-        if (
-            strncmp('FSTools', $class, 7) !== 0 &&
-            strncmp('ConfigDoc', $class, 9) !== 0
-        ) return false;
-        // Custom implementations can go here
-        // Standard implementation:
-        return str_replace('_', '/', $class) . '.php';
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 6
main/inc/lib/htmlpurifier/extras/index.html

@@ -1,6 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-</body>
-</html>

+ 0 - 6
main/inc/lib/htmlpurifier/index.html

@@ -1,6 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-</body>
-</html>

+ 0 - 26
main/inc/lib/htmlpurifier/library/HTMLPurifier.autoload.php

@@ -1,26 +0,0 @@
-<?php
-
-/**
- * @file
- * Convenience file that registers autoload handler for HTML Purifier.
- * It also does some sanity checks.
- */
-
-if (function_exists('spl_autoload_register') && function_exists('spl_autoload_unregister')) {
-    // We need unregister for our pre-registering functionality
-    HTMLPurifier_Bootstrap::registerAutoload();
-    if (function_exists('__autoload')) {
-        // Be polite and ensure that userland autoload gets retained
-        spl_autoload_register('__autoload');
-    }
-} elseif (!function_exists('__autoload')) {
-    function __autoload($class) {
-        return HTMLPurifier_Bootstrap::autoload($class);
-    }
-}
-
-if (ini_get('zend.ze1_compatibility_mode')) {
-    trigger_error("HTML Purifier is not compatible with zend.ze1_compatibility_mode; please turn it off", E_USER_ERROR);
-}
-
-// vim: et sw=4 sts=4

+ 0 - 23
main/inc/lib/htmlpurifier/library/HTMLPurifier.func.php

@@ -1,23 +0,0 @@
-<?php
-
-/**
- * @file
- * Defines a function wrapper for HTML Purifier for quick use.
- * @note ''HTMLPurifier()'' is NOT the same as ''new HTMLPurifier()''
- */
-
-/**
- * Purify HTML.
- * @param $html String HTML to purify
- * @param $config Configuration to use, can be any value accepted by
- *        HTMLPurifier_Config::create()
- */
-function HTMLPurifier($html, $config = null) {
-    static $purifier = false;
-    if (!$purifier) {
-        $purifier = new HTMLPurifier();
-    }
-    return $purifier->purify($html, $config);
-}
-
-// vim: et sw=4 sts=4

+ 0 - 212
main/inc/lib/htmlpurifier/library/HTMLPurifier.includes.php

@@ -1,212 +0,0 @@
-<?php
-
-/**
- * @file
- * This file was auto-generated by generate-includes.php and includes all of
- * the core files required by HTML Purifier. Use this if performance is a
- * primary concern and you are using an opcode cache. PLEASE DO NOT EDIT THIS
- * FILE, changes will be overwritten the next time the script is run.
- *
- * @version 4.2.0
- *
- * @warning
- *      You must *not* include any other HTML Purifier files before this file,
- *      because 'require' not 'require_once' is used.
- *
- * @warning
- *      This file requires that the include path contains the HTML Purifier
- *      library directory; this is not auto-set.
- */
-
-require 'HTMLPurifier.php';
-require 'HTMLPurifier/AttrCollections.php';
-require 'HTMLPurifier/AttrDef.php';
-require 'HTMLPurifier/AttrTransform.php';
-require 'HTMLPurifier/AttrTypes.php';
-require 'HTMLPurifier/AttrValidator.php';
-require 'HTMLPurifier/Bootstrap.php';
-require 'HTMLPurifier/Definition.php';
-require 'HTMLPurifier/CSSDefinition.php';
-require 'HTMLPurifier/ChildDef.php';
-require 'HTMLPurifier/Config.php';
-require 'HTMLPurifier/ConfigSchema.php';
-require 'HTMLPurifier/ContentSets.php';
-require 'HTMLPurifier/Context.php';
-require 'HTMLPurifier/DefinitionCache.php';
-require 'HTMLPurifier/DefinitionCacheFactory.php';
-require 'HTMLPurifier/Doctype.php';
-require 'HTMLPurifier/DoctypeRegistry.php';
-require 'HTMLPurifier/ElementDef.php';
-require 'HTMLPurifier/Encoder.php';
-require 'HTMLPurifier/EntityLookup.php';
-require 'HTMLPurifier/EntityParser.php';
-require 'HTMLPurifier/ErrorCollector.php';
-require 'HTMLPurifier/ErrorStruct.php';
-require 'HTMLPurifier/Exception.php';
-require 'HTMLPurifier/Filter.php';
-require 'HTMLPurifier/Generator.php';
-require 'HTMLPurifier/HTMLDefinition.php';
-require 'HTMLPurifier/HTMLModule.php';
-require 'HTMLPurifier/HTMLModuleManager.php';
-require 'HTMLPurifier/IDAccumulator.php';
-require 'HTMLPurifier/Injector.php';
-require 'HTMLPurifier/Language.php';
-require 'HTMLPurifier/LanguageFactory.php';
-require 'HTMLPurifier/Length.php';
-require 'HTMLPurifier/Lexer.php';
-require 'HTMLPurifier/PercentEncoder.php';
-require 'HTMLPurifier/PropertyList.php';
-require 'HTMLPurifier/PropertyListIterator.php';
-require 'HTMLPurifier/Strategy.php';
-require 'HTMLPurifier/StringHash.php';
-require 'HTMLPurifier/StringHashParser.php';
-require 'HTMLPurifier/TagTransform.php';
-require 'HTMLPurifier/Token.php';
-require 'HTMLPurifier/TokenFactory.php';
-require 'HTMLPurifier/URI.php';
-require 'HTMLPurifier/URIDefinition.php';
-require 'HTMLPurifier/URIFilter.php';
-require 'HTMLPurifier/URIParser.php';
-require 'HTMLPurifier/URIScheme.php';
-require 'HTMLPurifier/URISchemeRegistry.php';
-require 'HTMLPurifier/UnitConverter.php';
-require 'HTMLPurifier/VarParser.php';
-require 'HTMLPurifier/VarParserException.php';
-require 'HTMLPurifier/AttrDef/CSS.php';
-require 'HTMLPurifier/AttrDef/Enum.php';
-require 'HTMLPurifier/AttrDef/Integer.php';
-require 'HTMLPurifier/AttrDef/Lang.php';
-require 'HTMLPurifier/AttrDef/Switch.php';
-require 'HTMLPurifier/AttrDef/Text.php';
-require 'HTMLPurifier/AttrDef/URI.php';
-require 'HTMLPurifier/AttrDef/CSS/Number.php';
-require 'HTMLPurifier/AttrDef/CSS/AlphaValue.php';
-require 'HTMLPurifier/AttrDef/CSS/Background.php';
-require 'HTMLPurifier/AttrDef/CSS/BackgroundPosition.php';
-require 'HTMLPurifier/AttrDef/CSS/Border.php';
-require 'HTMLPurifier/AttrDef/CSS/Color.php';
-require 'HTMLPurifier/AttrDef/CSS/Composite.php';
-require 'HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php';
-require 'HTMLPurifier/AttrDef/CSS/Filter.php';
-require 'HTMLPurifier/AttrDef/CSS/Font.php';
-require 'HTMLPurifier/AttrDef/CSS/FontFamily.php';
-require 'HTMLPurifier/AttrDef/CSS/ImportantDecorator.php';
-require 'HTMLPurifier/AttrDef/CSS/Length.php';
-require 'HTMLPurifier/AttrDef/CSS/ListStyle.php';
-require 'HTMLPurifier/AttrDef/CSS/Multiple.php';
-require 'HTMLPurifier/AttrDef/CSS/Percentage.php';
-require 'HTMLPurifier/AttrDef/CSS/TextDecoration.php';
-require 'HTMLPurifier/AttrDef/CSS/URI.php';
-require 'HTMLPurifier/AttrDef/HTML/Bool.php';
-require 'HTMLPurifier/AttrDef/HTML/Nmtokens.php';
-require 'HTMLPurifier/AttrDef/HTML/Class.php';
-require 'HTMLPurifier/AttrDef/HTML/Color.php';
-require 'HTMLPurifier/AttrDef/HTML/FrameTarget.php';
-require 'HTMLPurifier/AttrDef/HTML/ID.php';
-require 'HTMLPurifier/AttrDef/HTML/Pixels.php';
-require 'HTMLPurifier/AttrDef/HTML/Length.php';
-require 'HTMLPurifier/AttrDef/HTML/LinkTypes.php';
-require 'HTMLPurifier/AttrDef/HTML/MultiLength.php';
-require 'HTMLPurifier/AttrDef/URI/Email.php';
-require 'HTMLPurifier/AttrDef/URI/Host.php';
-require 'HTMLPurifier/AttrDef/URI/IPv4.php';
-require 'HTMLPurifier/AttrDef/URI/IPv6.php';
-require 'HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php';
-require 'HTMLPurifier/AttrTransform/Background.php';
-require 'HTMLPurifier/AttrTransform/BdoDir.php';
-require 'HTMLPurifier/AttrTransform/BgColor.php';
-require 'HTMLPurifier/AttrTransform/BoolToCSS.php';
-require 'HTMLPurifier/AttrTransform/Border.php';
-require 'HTMLPurifier/AttrTransform/EnumToCSS.php';
-require 'HTMLPurifier/AttrTransform/ImgRequired.php';
-require 'HTMLPurifier/AttrTransform/ImgSpace.php';
-require 'HTMLPurifier/AttrTransform/Input.php';
-require 'HTMLPurifier/AttrTransform/Lang.php';
-require 'HTMLPurifier/AttrTransform/Length.php';
-require 'HTMLPurifier/AttrTransform/Name.php';
-require 'HTMLPurifier/AttrTransform/NameSync.php';
-require 'HTMLPurifier/AttrTransform/SafeEmbed.php';
-require 'HTMLPurifier/AttrTransform/SafeObject.php';
-require 'HTMLPurifier/AttrTransform/SafeParam.php';
-require 'HTMLPurifier/AttrTransform/ScriptRequired.php';
-require 'HTMLPurifier/AttrTransform/Textarea.php';
-require 'HTMLPurifier/ChildDef/Chameleon.php';
-require 'HTMLPurifier/ChildDef/Custom.php';
-require 'HTMLPurifier/ChildDef/Empty.php';
-require 'HTMLPurifier/ChildDef/Required.php';
-require 'HTMLPurifier/ChildDef/Optional.php';
-require 'HTMLPurifier/ChildDef/StrictBlockquote.php';
-require 'HTMLPurifier/ChildDef/Table.php';
-require 'HTMLPurifier/DefinitionCache/Decorator.php';
-require 'HTMLPurifier/DefinitionCache/Null.php';
-require 'HTMLPurifier/DefinitionCache/Serializer.php';
-require 'HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
-require 'HTMLPurifier/DefinitionCache/Decorator/Memory.php';
-require 'HTMLPurifier/HTMLModule/Bdo.php';
-require 'HTMLPurifier/HTMLModule/CommonAttributes.php';
-require 'HTMLPurifier/HTMLModule/Edit.php';
-require 'HTMLPurifier/HTMLModule/Forms.php';
-require 'HTMLPurifier/HTMLModule/Hypertext.php';
-require 'HTMLPurifier/HTMLModule/Image.php';
-require 'HTMLPurifier/HTMLModule/Legacy.php';
-require 'HTMLPurifier/HTMLModule/List.php';
-require 'HTMLPurifier/HTMLModule/Name.php';
-require 'HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php';
-require 'HTMLPurifier/HTMLModule/Object.php';
-require 'HTMLPurifier/HTMLModule/Presentation.php';
-require 'HTMLPurifier/HTMLModule/Proprietary.php';
-require 'HTMLPurifier/HTMLModule/Ruby.php';
-require 'HTMLPurifier/HTMLModule/SafeEmbed.php';
-require 'HTMLPurifier/HTMLModule/SafeObject.php';
-require 'HTMLPurifier/HTMLModule/Scripting.php';
-require 'HTMLPurifier/HTMLModule/StyleAttribute.php';
-require 'HTMLPurifier/HTMLModule/Tables.php';
-require 'HTMLPurifier/HTMLModule/Target.php';
-require 'HTMLPurifier/HTMLModule/Text.php';
-require 'HTMLPurifier/HTMLModule/Tidy.php';
-require 'HTMLPurifier/HTMLModule/XMLCommonAttributes.php';
-require 'HTMLPurifier/HTMLModule/Tidy/Name.php';
-require 'HTMLPurifier/HTMLModule/Tidy/Proprietary.php';
-require 'HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php';
-require 'HTMLPurifier/HTMLModule/Tidy/Strict.php';
-require 'HTMLPurifier/HTMLModule/Tidy/Transitional.php';
-require 'HTMLPurifier/HTMLModule/Tidy/XHTML.php';
-require 'HTMLPurifier/Injector/AutoParagraph.php';
-require 'HTMLPurifier/Injector/DisplayLinkURI.php';
-require 'HTMLPurifier/Injector/Linkify.php';
-require 'HTMLPurifier/Injector/PurifierLinkify.php';
-require 'HTMLPurifier/Injector/RemoveEmpty.php';
-require 'HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php';
-require 'HTMLPurifier/Injector/SafeObject.php';
-require 'HTMLPurifier/Lexer/DOMLex.php';
-require 'HTMLPurifier/Lexer/DirectLex.php';
-require 'HTMLPurifier/Strategy/Composite.php';
-require 'HTMLPurifier/Strategy/Core.php';
-require 'HTMLPurifier/Strategy/FixNesting.php';
-require 'HTMLPurifier/Strategy/MakeWellFormed.php';
-require 'HTMLPurifier/Strategy/RemoveForeignElements.php';
-require 'HTMLPurifier/Strategy/ValidateAttributes.php';
-require 'HTMLPurifier/TagTransform/Font.php';
-require 'HTMLPurifier/TagTransform/Simple.php';
-require 'HTMLPurifier/Token/Comment.php';
-require 'HTMLPurifier/Token/Tag.php';
-require 'HTMLPurifier/Token/Empty.php';
-require 'HTMLPurifier/Token/End.php';
-require 'HTMLPurifier/Token/Start.php';
-require 'HTMLPurifier/Token/Text.php';
-require 'HTMLPurifier/URIFilter/DisableExternal.php';
-require 'HTMLPurifier/URIFilter/DisableExternalResources.php';
-require 'HTMLPurifier/URIFilter/DisableResources.php';
-require 'HTMLPurifier/URIFilter/HostBlacklist.php';
-require 'HTMLPurifier/URIFilter/MakeAbsolute.php';
-require 'HTMLPurifier/URIFilter/Munge.php';
-require 'HTMLPurifier/URIScheme/data.php';
-require 'HTMLPurifier/URIScheme/file.php';
-require 'HTMLPurifier/URIScheme/ftp.php';
-require 'HTMLPurifier/URIScheme/http.php';
-require 'HTMLPurifier/URIScheme/https.php';
-require 'HTMLPurifier/URIScheme/mailto.php';
-require 'HTMLPurifier/URIScheme/news.php';
-require 'HTMLPurifier/URIScheme/nntp.php';
-require 'HTMLPurifier/VarParser/Flexible.php';
-require 'HTMLPurifier/VarParser/Native.php';

+ 0 - 30
main/inc/lib/htmlpurifier/library/HTMLPurifier.kses.php

@@ -1,30 +0,0 @@
-<?php
-
-/**
- * @file
- * Emulation layer for code that used kses(), substituting in HTML Purifier.
- */
-
-require_once dirname(__FILE__) . '/HTMLPurifier.auto.php';
-
-function kses($string, $allowed_html, $allowed_protocols = null) {
-    $config = HTMLPurifier_Config::createDefault();
-    $allowed_elements = array();
-    $allowed_attributes = array();
-    foreach ($allowed_html as $element => $attributes) {
-        $allowed_elements[$element] = true;
-        foreach ($attributes as $attribute => $x) {
-            $allowed_attributes["$element.$attribute"] = true;
-        }
-    }
-    $config->set('HTML.AllowedElements', $allowed_elements);
-    $config->set('HTML.AllowedAttributes', $allowed_attributes);
-    $allowed_schemes = array();
-    if ($allowed_protocols !== null) {
-        $config->set('URI.AllowedSchemes', $allowed_protocols);
-    }
-    $purifier = new HTMLPurifier($config);
-    return $purifier->purify($string);
-}
-
-// vim: et sw=4 sts=4

+ 0 - 237
main/inc/lib/htmlpurifier/library/HTMLPurifier.php

@@ -1,237 +0,0 @@
-<?php
-
-/*! @mainpage
- *
- * HTML Purifier is an HTML filter that will take an arbitrary snippet of
- * HTML and rigorously test, validate and filter it into a version that
- * is safe for output onto webpages. It achieves this by:
- *
- *  -# Lexing (parsing into tokens) the document,
- *  -# Executing various strategies on the tokens:
- *      -# Removing all elements not in the whitelist,
- *      -# Making the tokens well-formed,
- *      -# Fixing the nesting of the nodes, and
- *      -# Validating attributes of the nodes; and
- *  -# Generating HTML from the purified tokens.
- *
- * However, most users will only need to interface with the HTMLPurifier
- * and HTMLPurifier_Config.
- */
-
-/*
-    HTML Purifier 4.2.0 - Standards Compliant HTML Filtering
-    Copyright (C) 2006-2008 Edward Z. Yang
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/**
- * Facade that coordinates HTML Purifier's subsystems in order to purify HTML.
- *
- * @note There are several points in which configuration can be specified
- *       for HTML Purifier.  The precedence of these (from lowest to
- *       highest) is as follows:
- *          -# Instance: new HTMLPurifier($config)
- *          -# Invocation: purify($html, $config)
- *       These configurations are entirely independent of each other and
- *       are *not* merged (this behavior may change in the future).
- *
- * @todo We need an easier way to inject strategies using the configuration
- *       object.
- */
-class HTMLPurifier
-{
-
-    /** Version of HTML Purifier */
-    public $version = '4.2.0';
-
-    /** Constant with version of HTML Purifier */
-    const VERSION = '4.2.0';
-
-    /** Global configuration object */
-    public $config;
-
-    /** Array of extra HTMLPurifier_Filter objects to run on HTML, for backwards compatibility */
-    private $filters = array();
-
-    /** Single instance of HTML Purifier */
-    private static $instance;
-
-    protected $strategy, $generator;
-
-    /**
-     * Resultant HTMLPurifier_Context of last run purification. Is an array
-     * of contexts if the last called method was purifyArray().
-     */
-    public $context;
-
-    /**
-     * Initializes the purifier.
-     * @param $config Optional HTMLPurifier_Config object for all instances of
-     *                the purifier, if omitted, a default configuration is
-     *                supplied (which can be overridden on a per-use basis).
-     *                The parameter can also be any type that
-     *                HTMLPurifier_Config::create() supports.
-     */
-    public function __construct($config = null) {
-
-            $this->config = HTMLPurifier_Config::create($config);
-
-            $this->strategy = new HTMLPurifier_Strategy_Core();
-
-    }
-
-    /**
-     * Adds a filter to process the output. First come first serve
-     * @param $filter HTMLPurifier_Filter object
-     */
-    public function addFilter($filter) {
-        trigger_error('HTMLPurifier->addFilter() is deprecated, use configuration directives in the Filter namespace or Filter.Custom', E_USER_WARNING);
-        $this->filters[] = $filter;
-    }
-
-    /**
-     * Filters an HTML snippet/document to be XSS-free and standards-compliant.
-     *
-     * @param $html String of HTML to purify
-     * @param $config HTMLPurifier_Config object for this operation, if omitted,
-     *                defaults to the config object specified during this
-     *                object's construction. The parameter can also be any type
-     *                that HTMLPurifier_Config::create() supports.
-     * @return Purified HTML
-     */
-    public function purify($html, $config = null) {
-
-        // :TODO: make the config merge in, instead of replace
-        $config = $config ? HTMLPurifier_Config::create($config) : $this->config;
-
-        // implementation is partially environment dependant, partially
-        // configuration dependant
-        $lexer = HTMLPurifier_Lexer::create($config);
-
-        $context = new HTMLPurifier_Context();
-
-        // setup HTML generator
-        $this->generator = new HTMLPurifier_Generator($config, $context);
-        $context->register('Generator', $this->generator);
-
-        // set up global context variables
-        if ($config->get('Core.CollectErrors')) {
-            // may get moved out if other facilities use it
-            $language_factory = HTMLPurifier_LanguageFactory::instance();
-            $language = $language_factory->create($config, $context);
-            $context->register('Locale', $language);
-
-            $error_collector = new HTMLPurifier_ErrorCollector($context);
-            $context->register('ErrorCollector', $error_collector);
-        }
-
-        // setup id_accumulator context, necessary due to the fact that
-        // AttrValidator can be called from many places
-        $id_accumulator = HTMLPurifier_IDAccumulator::build($config, $context);
-        $context->register('IDAccumulator', $id_accumulator);
-
-        $html = HTMLPurifier_Encoder::convertToUTF8($html, $config, $context);
-
-        // setup filters
-        $filter_flags = $config->getBatch('Filter');
-        $custom_filters = $filter_flags['Custom'];
-        unset($filter_flags['Custom']);
-        $filters = array();
-        foreach ($filter_flags as $filter => $flag) {
-            if (!$flag) continue;
-            if (strpos($filter, '.') !== false) continue;
-            $class = "HTMLPurifier_Filter_$filter";
-            $filters[] = new $class;
-        }
-        foreach ($custom_filters as $filter) {
-            // maybe "HTMLPurifier_Filter_$filter", but be consistent with AutoFormat
-            $filters[] = $filter;
-        }
-        $filters = array_merge($filters, $this->filters);
-        // maybe prepare(), but later
-
-        for ($i = 0, $filter_size = count($filters); $i < $filter_size; $i++) {
-            $html = $filters[$i]->preFilter($html, $config, $context);
-        }
-
-        // purified HTML
-        $html =
-            $this->generator->generateFromTokens(
-                // list of tokens
-                $this->strategy->execute(
-                    // list of un-purified tokens
-                    $lexer->tokenizeHTML(
-                        // un-purified HTML
-                        $html, $config, $context
-                    ),
-                    $config, $context
-                )
-            );
-
-        for ($i = $filter_size - 1; $i >= 0; $i--) {
-            $html = $filters[$i]->postFilter($html, $config, $context);
-        }
-
-        $html = HTMLPurifier_Encoder::convertFromUTF8($html, $config, $context);
-        $this->context =& $context;
-        return $html;
-    }
-
-    /**
-     * Filters an array of HTML snippets
-     * @param $config Optional HTMLPurifier_Config object for this operation.
-     *                See HTMLPurifier::purify() for more details.
-     * @return Array of purified HTML
-     */
-    public function purifyArray($array_of_html, $config = null) {
-            $context_array = array();
-            foreach ($array_of_html as $key => $html) {
-                $array_of_html[$key] = $this->purify($html, $config);
-                $context_array[$key] = $this->context;
-            }
-            $this->context = $context_array;
-            return $array_of_html;
-         }
-
-    /**
-     * Singleton for enforcing just one HTML Purifier in your system
-     * @param $prototype Optional prototype HTMLPurifier instance to
-     *                   overload singleton with, or HTMLPurifier_Config
-     *                   instance to configure the generated version with.
-     */
-    public static function instance($prototype = null) {
-        if (!self::$instance || $prototype) {
-            if ($prototype instanceof HTMLPurifier) {
-                self::$instance = $prototype;
-            } elseif ($prototype) {
-                self::$instance = new HTMLPurifier($prototype);
-            } else {
-                self::$instance = new HTMLPurifier();
-            }
-        }
-        return self::$instance;
-    }
-
-    /**
-     * @note Backwards compatibility, see instance()
-     */
-    public static function getInstance($prototype = null) {
-        return HTMLPurifier::instance($prototype);
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 206
main/inc/lib/htmlpurifier/library/HTMLPurifier.safe-includes.php

@@ -1,206 +0,0 @@
-<?php
-
-/**
- * @file
- * This file was auto-generated by generate-includes.php and includes all of
- * the core files required by HTML Purifier. This is a convenience stub that
- * includes all files using dirname(__FILE__) and require_once. PLEASE DO NOT
- * EDIT THIS FILE, changes will be overwritten the next time the script is run.
- *
- * Changes to include_path are not necessary.
- */
-
-$__dir = dirname(__FILE__);
-
-require_once $__dir . '/HTMLPurifier.php';
-require_once $__dir . '/HTMLPurifier/AttrCollections.php';
-require_once $__dir . '/HTMLPurifier/AttrDef.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform.php';
-require_once $__dir . '/HTMLPurifier/AttrTypes.php';
-require_once $__dir . '/HTMLPurifier/AttrValidator.php';
-require_once $__dir . '/HTMLPurifier/Bootstrap.php';
-require_once $__dir . '/HTMLPurifier/Definition.php';
-require_once $__dir . '/HTMLPurifier/CSSDefinition.php';
-require_once $__dir . '/HTMLPurifier/ChildDef.php';
-require_once $__dir . '/HTMLPurifier/Config.php';
-require_once $__dir . '/HTMLPurifier/ConfigSchema.php';
-require_once $__dir . '/HTMLPurifier/ContentSets.php';
-require_once $__dir . '/HTMLPurifier/Context.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCache.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCacheFactory.php';
-require_once $__dir . '/HTMLPurifier/Doctype.php';
-require_once $__dir . '/HTMLPurifier/DoctypeRegistry.php';
-require_once $__dir . '/HTMLPurifier/ElementDef.php';
-require_once $__dir . '/HTMLPurifier/Encoder.php';
-require_once $__dir . '/HTMLPurifier/EntityLookup.php';
-require_once $__dir . '/HTMLPurifier/EntityParser.php';
-require_once $__dir . '/HTMLPurifier/ErrorCollector.php';
-require_once $__dir . '/HTMLPurifier/ErrorStruct.php';
-require_once $__dir . '/HTMLPurifier/Exception.php';
-require_once $__dir . '/HTMLPurifier/Filter.php';
-require_once $__dir . '/HTMLPurifier/Generator.php';
-require_once $__dir . '/HTMLPurifier/HTMLDefinition.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule.php';
-require_once $__dir . '/HTMLPurifier/HTMLModuleManager.php';
-require_once $__dir . '/HTMLPurifier/IDAccumulator.php';
-require_once $__dir . '/HTMLPurifier/Injector.php';
-require_once $__dir . '/HTMLPurifier/Language.php';
-require_once $__dir . '/HTMLPurifier/LanguageFactory.php';
-require_once $__dir . '/HTMLPurifier/Length.php';
-require_once $__dir . '/HTMLPurifier/Lexer.php';
-require_once $__dir . '/HTMLPurifier/PercentEncoder.php';
-require_once $__dir . '/HTMLPurifier/PropertyList.php';
-require_once $__dir . '/HTMLPurifier/PropertyListIterator.php';
-require_once $__dir . '/HTMLPurifier/Strategy.php';
-require_once $__dir . '/HTMLPurifier/StringHash.php';
-require_once $__dir . '/HTMLPurifier/StringHashParser.php';
-require_once $__dir . '/HTMLPurifier/TagTransform.php';
-require_once $__dir . '/HTMLPurifier/Token.php';
-require_once $__dir . '/HTMLPurifier/TokenFactory.php';
-require_once $__dir . '/HTMLPurifier/URI.php';
-require_once $__dir . '/HTMLPurifier/URIDefinition.php';
-require_once $__dir . '/HTMLPurifier/URIFilter.php';
-require_once $__dir . '/HTMLPurifier/URIParser.php';
-require_once $__dir . '/HTMLPurifier/URIScheme.php';
-require_once $__dir . '/HTMLPurifier/URISchemeRegistry.php';
-require_once $__dir . '/HTMLPurifier/UnitConverter.php';
-require_once $__dir . '/HTMLPurifier/VarParser.php';
-require_once $__dir . '/HTMLPurifier/VarParserException.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/Enum.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/Integer.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/Lang.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/Switch.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/Text.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/URI.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Number.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/AlphaValue.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Background.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Border.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Color.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Composite.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Filter.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Font.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/FontFamily.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Length.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/ListStyle.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Multiple.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Percentage.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/TextDecoration.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/URI.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Bool.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Nmtokens.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Class.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Color.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/FrameTarget.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/ID.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Pixels.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Length.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/LinkTypes.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/MultiLength.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/URI/Email.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/URI/Host.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/URI/IPv4.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/URI/IPv6.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Background.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/BdoDir.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/BgColor.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/BoolToCSS.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Border.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/EnumToCSS.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/ImgRequired.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/ImgSpace.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Input.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Lang.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Length.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Name.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/NameSync.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/SafeEmbed.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/SafeObject.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/SafeParam.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/ScriptRequired.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Textarea.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/Chameleon.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/Custom.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/Empty.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/Required.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/Optional.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/StrictBlockquote.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/Table.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCache/Null.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCache/Serializer.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator/Memory.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Bdo.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/CommonAttributes.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Edit.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Forms.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Hypertext.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Image.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Legacy.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/List.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Name.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Object.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Presentation.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Proprietary.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Ruby.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/SafeEmbed.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/SafeObject.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Scripting.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/StyleAttribute.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tables.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Target.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Text.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/XMLCommonAttributes.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Name.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Proprietary.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Strict.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Transitional.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/XHTML.php';
-require_once $__dir . '/HTMLPurifier/Injector/AutoParagraph.php';
-require_once $__dir . '/HTMLPurifier/Injector/DisplayLinkURI.php';
-require_once $__dir . '/HTMLPurifier/Injector/Linkify.php';
-require_once $__dir . '/HTMLPurifier/Injector/PurifierLinkify.php';
-require_once $__dir . '/HTMLPurifier/Injector/RemoveEmpty.php';
-require_once $__dir . '/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php';
-require_once $__dir . '/HTMLPurifier/Injector/SafeObject.php';
-require_once $__dir . '/HTMLPurifier/Lexer/DOMLex.php';
-require_once $__dir . '/HTMLPurifier/Lexer/DirectLex.php';
-require_once $__dir . '/HTMLPurifier/Strategy/Composite.php';
-require_once $__dir . '/HTMLPurifier/Strategy/Core.php';
-require_once $__dir . '/HTMLPurifier/Strategy/FixNesting.php';
-require_once $__dir . '/HTMLPurifier/Strategy/MakeWellFormed.php';
-require_once $__dir . '/HTMLPurifier/Strategy/RemoveForeignElements.php';
-require_once $__dir . '/HTMLPurifier/Strategy/ValidateAttributes.php';
-require_once $__dir . '/HTMLPurifier/TagTransform/Font.php';
-require_once $__dir . '/HTMLPurifier/TagTransform/Simple.php';
-require_once $__dir . '/HTMLPurifier/Token/Comment.php';
-require_once $__dir . '/HTMLPurifier/Token/Tag.php';
-require_once $__dir . '/HTMLPurifier/Token/Empty.php';
-require_once $__dir . '/HTMLPurifier/Token/End.php';
-require_once $__dir . '/HTMLPurifier/Token/Start.php';
-require_once $__dir . '/HTMLPurifier/Token/Text.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternal.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternalResources.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/DisableResources.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/HostBlacklist.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/MakeAbsolute.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/Munge.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/data.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/file.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/ftp.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/http.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/https.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/mailto.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/news.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/nntp.php';
-require_once $__dir . '/HTMLPurifier/VarParser/Flexible.php';
-require_once $__dir . '/HTMLPurifier/VarParser/Native.php';

+ 0 - 128
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrCollections.php

@@ -1,128 +0,0 @@
-<?php
-
-/**
- * Defines common attribute collections that modules reference
- */
-
-class HTMLPurifier_AttrCollections
-{
-
-    /**
-     * Associative array of attribute collections, indexed by name
-     */
-    public $info = array();
-
-    /**
-     * Performs all expansions on internal data for use by other inclusions
-     * It also collects all attribute collection extensions from
-     * modules
-     * @param $attr_types HTMLPurifier_AttrTypes instance
-     * @param $modules Hash array of HTMLPurifier_HTMLModule members
-     */
-    public function __construct($attr_types, $modules) {
-        // load extensions from the modules
-        foreach ($modules as $module) {
-            foreach ($module->attr_collections as $coll_i => $coll) {
-                if (!isset($this->info[$coll_i])) {
-                    $this->info[$coll_i] = array();
-                }
-                foreach ($coll as $attr_i => $attr) {
-                    if ($attr_i === 0 && isset($this->info[$coll_i][$attr_i])) {
-                        // merge in includes
-                        $this->info[$coll_i][$attr_i] = array_merge(
-                            $this->info[$coll_i][$attr_i], $attr);
-                        continue;
-                    }
-                    $this->info[$coll_i][$attr_i] = $attr;
-                }
-            }
-        }
-        // perform internal expansions and inclusions
-        foreach ($this->info as $name => $attr) {
-            // merge attribute collections that include others
-            $this->performInclusions($this->info[$name]);
-            // replace string identifiers with actual attribute objects
-            $this->expandIdentifiers($this->info[$name], $attr_types);
-        }
-    }
-
-    /**
-     * Takes a reference to an attribute associative array and performs
-     * all inclusions specified by the zero index.
-     * @param &$attr Reference to attribute array
-     */
-    public function performInclusions(&$attr) {
-        if (!isset($attr[0])) return;
-        $merge = $attr[0];
-        $seen  = array(); // recursion guard
-        // loop through all the inclusions
-        for ($i = 0; isset($merge[$i]); $i++) {
-            if (isset($seen[$merge[$i]])) continue;
-            $seen[$merge[$i]] = true;
-            // foreach attribute of the inclusion, copy it over
-            if (!isset($this->info[$merge[$i]])) continue;
-            foreach ($this->info[$merge[$i]] as $key => $value) {
-                if (isset($attr[$key])) continue; // also catches more inclusions
-                $attr[$key] = $value;
-            }
-            if (isset($this->info[$merge[$i]][0])) {
-                // recursion
-                $merge = array_merge($merge, $this->info[$merge[$i]][0]);
-            }
-        }
-        unset($attr[0]);
-    }
-
-    /**
-     * Expands all string identifiers in an attribute array by replacing
-     * them with the appropriate values inside HTMLPurifier_AttrTypes
-     * @param &$attr Reference to attribute array
-     * @param $attr_types HTMLPurifier_AttrTypes instance
-     */
-    public function expandIdentifiers(&$attr, $attr_types) {
-
-        // because foreach will process new elements we add, make sure we
-        // skip duplicates
-        $processed = array();
-
-        foreach ($attr as $def_i => $def) {
-            // skip inclusions
-            if ($def_i === 0) continue;
-
-            if (isset($processed[$def_i])) continue;
-
-            // determine whether or not attribute is required
-            if ($required = (strpos($def_i, '*') !== false)) {
-                // rename the definition
-                unset($attr[$def_i]);
-                $def_i = trim($def_i, '*');
-                $attr[$def_i] = $def;
-            }
-
-            $processed[$def_i] = true;
-
-            // if we've already got a literal object, move on
-            if (is_object($def)) {
-                // preserve previous required
-                $attr[$def_i]->required = ($required || $attr[$def_i]->required);
-                continue;
-            }
-
-            if ($def === false) {
-                unset($attr[$def_i]);
-                continue;
-            }
-
-            if ($t = $attr_types->get($def)) {
-                $attr[$def_i] = $t;
-                $attr[$def_i]->required = $required;
-            } else {
-                unset($attr[$def_i]);
-            }
-        }
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 123
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef.php

@@ -1,123 +0,0 @@
-<?php
-
-/**
- * Base class for all validating attribute definitions.
- *
- * This family of classes forms the core for not only HTML attribute validation,
- * but also any sort of string that needs to be validated or cleaned (which
- * means CSS properties and composite definitions are defined here too).
- * Besides defining (through code) what precisely makes the string valid,
- * subclasses are also responsible for cleaning the code if possible.
- */
-
-abstract class HTMLPurifier_AttrDef
-{
-
-    /**
-     * Tells us whether or not an HTML attribute is minimized. Has no
-     * meaning in other contexts.
-     */
-    public $minimized = false;
-
-    /**
-     * Tells us whether or not an HTML attribute is required. Has no
-     * meaning in other contexts
-     */
-    public $required = false;
-
-    /**
-     * Validates and cleans passed string according to a definition.
-     *
-     * @param $string String to be validated and cleaned.
-     * @param $config Mandatory HTMLPurifier_Config object.
-     * @param $context Mandatory HTMLPurifier_AttrContext object.
-     */
-    abstract public function validate($string, $config, $context);
-
-    /**
-     * Convenience method that parses a string as if it were CDATA.
-     *
-     * This method process a string in the manner specified at
-     * <http://www.w3.org/TR/html4/types.html#h-6.2> by removing
-     * leading and trailing whitespace, ignoring line feeds, and replacing
-     * carriage returns and tabs with spaces.  While most useful for HTML
-     * attributes specified as CDATA, it can also be applied to most CSS
-     * values.
-     *
-     * @note This method is not entirely standards compliant, as trim() removes
-     *       more types of whitespace than specified in the spec. In practice,
-     *       this is rarely a problem, as those extra characters usually have
-     *       already been removed by HTMLPurifier_Encoder.
-     *
-     * @warning This processing is inconsistent with XML's whitespace handling
-     *          as specified by section 3.3.3 and referenced XHTML 1.0 section
-     *          4.7.  However, note that we are NOT necessarily
-     *          parsing XML, thus, this behavior may still be correct. We
-     *          assume that newlines have been normalized.
-     */
-    public function parseCDATA($string) {
-        $string = trim($string);
-        $string = str_replace(array("\n", "\t", "\r"), ' ', $string);
-        return $string;
-    }
-
-    /**
-     * Factory method for creating this class from a string.
-     * @param $string String construction info
-     * @return Created AttrDef object corresponding to $string
-     */
-    public function make($string) {
-        // default implementation, return a flyweight of this object.
-        // If $string has an effect on the returned object (i.e. you
-        // need to overload this method), it is best
-        // to clone or instantiate new copies. (Instantiation is safer.)
-        return $this;
-    }
-
-    /**
-     * Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work
-     * properly. THIS IS A HACK!
-     */
-    protected function mungeRgb($string) {
-        return preg_replace('/rgb\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\)/', 'rgb(\1,\2,\3)', $string);
-    }
-
-    /**
-     * Parses a possibly escaped CSS string and returns the "pure" 
-     * version of it.
-     */
-    protected function expandCSSEscape($string) {
-        // flexibly parse it
-        $ret = '';
-        for ($i = 0, $c = strlen($string); $i < $c; $i++) {
-            if ($string[$i] === '\\') {
-                $i++;
-                if ($i >= $c) {
-                    $ret .= '\\';
-                    break;
-                }
-                if (ctype_xdigit($string[$i])) {
-                    $code = $string[$i];
-                    for ($a = 1, $i++; $i < $c && $a < 6; $i++, $a++) {
-                        if (!ctype_xdigit($string[$i])) break;
-                        $code .= $string[$i];
-                    }
-                    // We have to be extremely careful when adding
-                    // new characters, to make sure we're not breaking
-                    // the encoding.
-                    $char = HTMLPurifier_Encoder::unichr(hexdec($code));
-                    if (HTMLPurifier_Encoder::cleanUTF8($char) === '') continue;
-                    $ret .= $char;
-                    if ($i < $c && trim($string[$i]) !== '') $i--;
-                    continue;
-                }
-                if ($string[$i] === "\n") continue;
-            }
-            $ret .= $string[$i];
-        }
-        return $ret;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 87
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS.php

@@ -1,87 +0,0 @@
-<?php
-
-/**
- * Validates the HTML attribute style, otherwise known as CSS.
- * @note We don't implement the whole CSS specification, so it might be
- *       difficult to reuse this component in the context of validating
- *       actual stylesheet declarations.
- * @note If we were really serious about validating the CSS, we would
- *       tokenize the styles and then parse the tokens. Obviously, we
- *       are not doing that. Doing that could seriously harm performance,
- *       but would make these components a lot more viable for a CSS
- *       filtering solution.
- */
-class HTMLPurifier_AttrDef_CSS extends HTMLPurifier_AttrDef
-{
-
-    public function validate($css, $config, $context) {
-
-        $css = $this->parseCDATA($css);
-
-        $definition = $config->getCSSDefinition();
-
-        // we're going to break the spec and explode by semicolons.
-        // This is because semicolon rarely appears in escaped form
-        // Doing this is generally flaky but fast
-        // IT MIGHT APPEAR IN URIs, see HTMLPurifier_AttrDef_CSSURI
-        // for details
-
-        $declarations = explode(';', $css);
-        $propvalues = array();
-
-        /**
-         * Name of the current CSS property being validated.
-         */
-        $property = false;
-        $context->register('CurrentCSSProperty', $property);
-
-        foreach ($declarations as $declaration) {
-            if (!$declaration) continue;
-            if (!strpos($declaration, ':')) continue;
-            list($property, $value) = explode(':', $declaration, 2);
-            $property = trim($property);
-            $value    = trim($value);
-            $ok = false;
-            do {
-                if (isset($definition->info[$property])) {
-                    $ok = true;
-                    break;
-                }
-                if (ctype_lower($property)) break;
-                $property = strtolower($property);
-                if (isset($definition->info[$property])) {
-                    $ok = true;
-                    break;
-                }
-            } while(0);
-            if (!$ok) continue;
-            // inefficient call, since the validator will do this again
-            if (strtolower(trim($value)) !== 'inherit') {
-                // inherit works for everything (but only on the base property)
-                $result = $definition->info[$property]->validate(
-                    $value, $config, $context );
-            } else {
-                $result = 'inherit';
-            }
-            if ($result === false) continue;
-            $propvalues[$property] = $result;
-        }
-
-        $context->destroy('CurrentCSSProperty');
-
-        // procedure does not write the new CSS simultaneously, so it's
-        // slightly inefficient, but it's the only way of getting rid of
-        // duplicates. Perhaps config to optimize it, but not now.
-
-        $new_declarations = '';
-        foreach ($propvalues as $prop => $value) {
-            $new_declarations .= "$prop:$value;";
-        }
-
-        return $new_declarations ? $new_declarations : false;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 21
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php

@@ -1,21 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_CSS_AlphaValue extends HTMLPurifier_AttrDef_CSS_Number
-{
-
-    public function __construct() {
-        parent::__construct(false); // opacity is non-negative, but we will clamp it
-    }
-
-    public function validate($number, $config, $context) {
-        $result = parent::validate($number, $config, $context);
-        if ($result === false) return $result;
-        $float = (float) $result;
-        if ($float < 0.0) $result = '0';
-        if ($float > 1.0) $result = '1';
-        return $result;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 87
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php

@@ -1,87 +0,0 @@
-<?php
-
-/**
- * Validates shorthand CSS property background.
- * @warning Does not support url tokens that have internal spaces.
- */
-class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Local copy of component validators.
-     * @note See HTMLPurifier_AttrDef_Font::$info for a similar impl.
-     */
-    protected $info;
-
-    public function __construct($config) {
-        $def = $config->getCSSDefinition();
-        $this->info['background-color'] = $def->info['background-color'];
-        $this->info['background-image'] = $def->info['background-image'];
-        $this->info['background-repeat'] = $def->info['background-repeat'];
-        $this->info['background-attachment'] = $def->info['background-attachment'];
-        $this->info['background-position'] = $def->info['background-position'];
-    }
-
-    public function validate($string, $config, $context) {
-
-        // regular pre-processing
-        $string = $this->parseCDATA($string);
-        if ($string === '') return false;
-
-        // munge rgb() decl if necessary
-        $string = $this->mungeRgb($string);
-
-        // assumes URI doesn't have spaces in it
-        $bits = explode(' ', strtolower($string)); // bits to process
-
-        $caught = array();
-        $caught['color']    = false;
-        $caught['image']    = false;
-        $caught['repeat']   = false;
-        $caught['attachment'] = false;
-        $caught['position'] = false;
-
-        $i = 0; // number of catches
-        $none = false;
-
-        foreach ($bits as $bit) {
-            if ($bit === '') continue;
-            foreach ($caught as $key => $status) {
-                if ($key != 'position') {
-                    if ($status !== false) continue;
-                    $r = $this->info['background-' . $key]->validate($bit, $config, $context);
-                } else {
-                    $r = $bit;
-                }
-                if ($r === false) continue;
-                if ($key == 'position') {
-                    if ($caught[$key] === false) $caught[$key] = '';
-                    $caught[$key] .= $r . ' ';
-                } else {
-                    $caught[$key] = $r;
-                }
-                $i++;
-                break;
-            }
-        }
-
-        if (!$i) return false;
-        if ($caught['position'] !== false) {
-            $caught['position'] = $this->info['background-position']->
-                validate($caught['position'], $config, $context);
-        }
-
-        $ret = array();
-        foreach ($caught as $value) {
-            if ($value === false) continue;
-            $ret[] = $value;
-        }
-
-        if (empty($ret)) return false;
-        return implode(' ', $ret);
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 133
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php

@@ -1,133 +0,0 @@
-<?php
-
-/* W3C says:
-    [ // adjective and number must be in correct order, even if
-      // you could switch them without introducing ambiguity.
-      // some browsers support that syntax
-        [
-            <percentage> | <length> | left | center | right
-        ]
-        [
-            <percentage> | <length> | top | center | bottom
-        ]?
-    ] |
-    [ // this signifies that the vertical and horizontal adjectives
-      // can be arbitrarily ordered, however, there can only be two,
-      // one of each, or none at all
-        [
-            left | center | right
-        ] ||
-        [
-            top | center | bottom
-        ]
-    ]
-    top, left = 0%
-    center, (none) = 50%
-    bottom, right = 100%
-*/
-
-/* QuirksMode says:
-    keyword + length/percentage must be ordered correctly, as per W3C
-
-    Internet Explorer and Opera, however, support arbitrary ordering. We
-    should fix it up.
-
-    Minor issue though, not strictly necessary.
-*/
-
-// control freaks may appreciate the ability to convert these to
-// percentages or something, but it's not necessary
-
-/**
- * Validates the value of background-position.
- */
-class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
-{
-
-    protected $length;
-    protected $percentage;
-
-    public function __construct() {
-        $this->length     = new HTMLPurifier_AttrDef_CSS_Length();
-        $this->percentage = new HTMLPurifier_AttrDef_CSS_Percentage();
-    }
-
-    public function validate($string, $config, $context) {
-        $string = $this->parseCDATA($string);
-        $bits = explode(' ', $string);
-
-        $keywords = array();
-        $keywords['h'] = false; // left, right
-        $keywords['v'] = false; // top, bottom
-        $keywords['ch'] = false; // center (first word)
-        $keywords['cv'] = false; // center (second word)
-        $measures = array();
-
-        $i = 0;
-
-        $lookup = array(
-            'top' => 'v',
-            'bottom' => 'v',
-            'left' => 'h',
-            'right' => 'h',
-            'center' => 'c'
-        );
-
-        foreach ($bits as $bit) {
-            if ($bit === '') continue;
-
-            // test for keyword
-            $lbit = ctype_lower($bit) ? $bit : strtolower($bit);
-            if (isset($lookup[$lbit])) {
-                $status = $lookup[$lbit];
-                if ($status == 'c') {
-                    if ($i == 0) {
-                        $status = 'ch';
-                    } else {
-                        $status = 'cv';
-                    }
-                }
-                $keywords[$status] = $lbit;
-                $i++;
-            }
-
-            // test for length
-            $r = $this->length->validate($bit, $config, $context);
-            if ($r !== false) {
-                $measures[] = $r;
-                $i++;
-            }
-
-            // test for percentage
-            $r = $this->percentage->validate($bit, $config, $context);
-            if ($r !== false) {
-                $measures[] = $r;
-                $i++;
-            }
-
-        }
-
-        if (!$i) return false; // no valid values were caught
-
-        $ret = array();
-
-        // first keyword
-        if     ($keywords['h'])     $ret[] = $keywords['h'];
-        elseif ($keywords['ch']) {
-            $ret[] = $keywords['ch'];
-            $keywords['cv'] = false; // prevent re-use: center = center center
-        }
-        elseif (count($measures))   $ret[] = array_shift($measures);
-
-        if     ($keywords['v'])     $ret[] = $keywords['v'];
-        elseif ($keywords['cv'])    $ret[] = $keywords['cv'];
-        elseif (count($measures))   $ret[] = array_shift($measures);
-
-        if (empty($ret)) return false;
-        return implode(' ', $ret);
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 43
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Border.php

@@ -1,43 +0,0 @@
-<?php
-
-/**
- * Validates the border property as defined by CSS.
- */
-class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Local copy of properties this property is shorthand for.
-     */
-    protected $info = array();
-
-    public function __construct($config) {
-        $def = $config->getCSSDefinition();
-        $this->info['border-width'] = $def->info['border-width'];
-        $this->info['border-style'] = $def->info['border-style'];
-        $this->info['border-top-color'] = $def->info['border-top-color'];
-    }
-
-    public function validate($string, $config, $context) {
-        $string = $this->parseCDATA($string);
-        $string = $this->mungeRgb($string);
-        $bits = explode(' ', $string);
-        $done = array(); // segments we've finished
-        $ret = ''; // return value
-        foreach ($bits as $bit) {
-            foreach ($this->info as $propname => $validator) {
-                if (isset($done[$propname])) continue;
-                $r = $validator->validate($bit, $config, $context);
-                if ($r !== false) {
-                    $ret .= $r . ' ';
-                    $done[$propname] = true;
-                    break;
-                }
-            }
-        }
-        return rtrim($ret);
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 78
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Color.php

@@ -1,78 +0,0 @@
-<?php
-
-/**
- * Validates Color as defined by CSS.
- */
-class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
-{
-
-    public function validate($color, $config, $context) {
-
-        static $colors = null;
-        if ($colors === null) $colors = $config->get('Core.ColorKeywords');
-
-        $color = trim($color);
-        if ($color === '') return false;
-
-        $lower = strtolower($color);
-        if (isset($colors[$lower])) return $colors[$lower];
-
-        if (strpos($color, 'rgb(') !== false) {
-            // rgb literal handling
-            $length = strlen($color);
-            if (strpos($color, ')') !== $length - 1) return false;
-            $triad = substr($color, 4, $length - 4 - 1);
-            $parts = explode(',', $triad);
-            if (count($parts) !== 3) return false;
-            $type = false; // to ensure that they're all the same type
-            $new_parts = array();
-            foreach ($parts as $part) {
-                $part = trim($part);
-                if ($part === '') return false;
-                $length = strlen($part);
-                if ($part[$length - 1] === '%') {
-                    // handle percents
-                    if (!$type) {
-                        $type = 'percentage';
-                    } elseif ($type !== 'percentage') {
-                        return false;
-                    }
-                    $num = (float) substr($part, 0, $length - 1);
-                    if ($num < 0) $num = 0;
-                    if ($num > 100) $num = 100;
-                    $new_parts[] = "$num%";
-                } else {
-                    // handle integers
-                    if (!$type) {
-                        $type = 'integer';
-                    } elseif ($type !== 'integer') {
-                        return false;
-                    }
-                    $num = (int) $part;
-                    if ($num < 0) $num = 0;
-                    if ($num > 255) $num = 255;
-                    $new_parts[] = (string) $num;
-                }
-            }
-            $new_triad = implode(',', $new_parts);
-            $color = "rgb($new_triad)";
-        } else {
-            // hexadecimal handling
-            if ($color[0] === '#') {
-                $hex = substr($color, 1);
-            } else {
-                $hex = $color;
-                $color = '#' . $color;
-            }
-            $length = strlen($hex);
-            if ($length !== 3 && $length !== 6) return false;
-            if (!ctype_xdigit($hex)) return false;
-        }
-
-        return $color;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 38
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Composite.php

@@ -1,38 +0,0 @@
-<?php
-
-/**
- * Allows multiple validators to attempt to validate attribute.
- *
- * Composite is just what it sounds like: a composite of many validators.
- * This means that multiple HTMLPurifier_AttrDef objects will have a whack
- * at the string.  If one of them passes, that's what is returned.  This is
- * especially useful for CSS values, which often are a choice between
- * an enumerated set of predefined values or a flexible data type.
- */
-class HTMLPurifier_AttrDef_CSS_Composite extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * List of HTMLPurifier_AttrDef objects that may process strings
-     * @todo Make protected
-     */
-    public $defs;
-
-    /**
-     * @param $defs List of HTMLPurifier_AttrDef objects
-     */
-    public function __construct($defs) {
-        $this->defs = $defs;
-    }
-
-    public function validate($string, $config, $context) {
-        foreach ($this->defs as $i => $def) {
-            $result = $this->defs[$i]->validate($string, $config, $context);
-            if ($result !== false) return $result;
-        }
-        return false;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 28
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php

@@ -1,28 +0,0 @@
-<?php
-
-/**
- * Decorator which enables CSS properties to be disabled for specific elements.
- */
-class HTMLPurifier_AttrDef_CSS_DenyElementDecorator extends HTMLPurifier_AttrDef
-{
-    public $def, $element;
-
-    /**
-     * @param $def Definition to wrap
-     * @param $element Element to deny
-     */
-    public function __construct($def, $element) {
-        $this->def = $def;
-        $this->element = $element;
-    }
-    /**
-     * Checks if CurrentToken is set and equal to $this->element
-     */
-    public function validate($string, $config, $context) {
-        $token = $context->get('CurrentToken', true);
-        if ($token && $token->name == $this->element) return false;
-        return $this->def->validate($string, $config, $context);
-    }
-}
-
-// vim: et sw=4 sts=4

+ 0 - 54
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Filter.php

@@ -1,54 +0,0 @@
-<?php
-
-/**
- * Microsoft's proprietary filter: CSS property
- * @note Currently supports the alpha filter. In the future, this will
- *       probably need an extensible framework
- */
-class HTMLPurifier_AttrDef_CSS_Filter extends HTMLPurifier_AttrDef
-{
-
-    protected $intValidator;
-
-    public function __construct() {
-        $this->intValidator = new HTMLPurifier_AttrDef_Integer();
-    }
-
-    public function validate($value, $config, $context) {
-        $value = $this->parseCDATA($value);
-        if ($value === 'none') return $value;
-        // if we looped this we could support multiple filters
-        $function_length = strcspn($value, '(');
-        $function = trim(substr($value, 0, $function_length));
-        if ($function !== 'alpha' &&
-            $function !== 'Alpha' &&
-            $function !== 'progid:DXImageTransform.Microsoft.Alpha'
-            ) return false;
-        $cursor = $function_length + 1;
-        $parameters_length = strcspn($value, ')', $cursor);
-        $parameters = substr($value, $cursor, $parameters_length);
-        $params = explode(',', $parameters);
-        $ret_params = array();
-        $lookup = array();
-        foreach ($params as $param) {
-            list($key, $value) = explode('=', $param);
-            $key   = trim($key);
-            $value = trim($value);
-            if (isset($lookup[$key])) continue;
-            if ($key !== 'opacity') continue;
-            $value = $this->intValidator->validate($value, $config, $context);
-            if ($value === false) continue;
-            $int = (int) $value;
-            if ($int > 100) $value = '100';
-            if ($int < 0) $value = '0';
-            $ret_params[] = "$key=$value";
-            $lookup[$key] = true;
-        }
-        $ret_parameters = implode(',', $ret_params);
-        $ret_function = "$function($ret_parameters)";
-        return $ret_function;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 149
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Font.php

@@ -1,149 +0,0 @@
-<?php
-
-/**
- * Validates shorthand CSS property font.
- */
-class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Local copy of component validators.
-     *
-     * @note If we moved specific CSS property definitions to their own
-     *       classes instead of having them be assembled at run time by
-     *       CSSDefinition, this wouldn't be necessary.  We'd instantiate
-     *       our own copies.
-     */
-    protected $info = array();
-
-    public function __construct($config) {
-        $def = $config->getCSSDefinition();
-        $this->info['font-style']   = $def->info['font-style'];
-        $this->info['font-variant'] = $def->info['font-variant'];
-        $this->info['font-weight']  = $def->info['font-weight'];
-        $this->info['font-size']    = $def->info['font-size'];
-        $this->info['line-height']  = $def->info['line-height'];
-        $this->info['font-family']  = $def->info['font-family'];
-    }
-
-    public function validate($string, $config, $context) {
-
-        static $system_fonts = array(
-            'caption' => true,
-            'icon' => true,
-            'menu' => true,
-            'message-box' => true,
-            'small-caption' => true,
-            'status-bar' => true
-        );
-
-        // regular pre-processing
-        $string = $this->parseCDATA($string);
-        if ($string === '') return false;
-
-        // check if it's one of the keywords
-        $lowercase_string = strtolower($string);
-        if (isset($system_fonts[$lowercase_string])) {
-            return $lowercase_string;
-        }
-
-        $bits = explode(' ', $string); // bits to process
-        $stage = 0; // this indicates what we're looking for
-        $caught = array(); // which stage 0 properties have we caught?
-        $stage_1 = array('font-style', 'font-variant', 'font-weight');
-        $final = ''; // output
-
-        for ($i = 0, $size = count($bits); $i < $size; $i++) {
-            if ($bits[$i] === '') continue;
-            switch ($stage) {
-
-                // attempting to catch font-style, font-variant or font-weight
-                case 0:
-                    foreach ($stage_1 as $validator_name) {
-                        if (isset($caught[$validator_name])) continue;
-                        $r = $this->info[$validator_name]->validate(
-                                                $bits[$i], $config, $context);
-                        if ($r !== false) {
-                            $final .= $r . ' ';
-                            $caught[$validator_name] = true;
-                            break;
-                        }
-                    }
-                    // all three caught, continue on
-                    if (count($caught) >= 3) $stage = 1;
-                    if ($r !== false) break;
-
-                // attempting to catch font-size and perhaps line-height
-                case 1:
-                    $found_slash = false;
-                    if (strpos($bits[$i], '/') !== false) {
-                        list($font_size, $line_height) =
-                                                    explode('/', $bits[$i]);
-                        if ($line_height === '') {
-                            // ooh, there's a space after the slash!
-                            $line_height = false;
-                            $found_slash = true;
-                        }
-                    } else {
-                        $font_size = $bits[$i];
-                        $line_height = false;
-                    }
-                    $r = $this->info['font-size']->validate(
-                                              $font_size, $config, $context);
-                    if ($r !== false) {
-                        $final .= $r;
-                        // attempt to catch line-height
-                        if ($line_height === false) {
-                            // we need to scroll forward
-                            for ($j = $i + 1; $j < $size; $j++) {
-                                if ($bits[$j] === '') continue;
-                                if ($bits[$j] === '/') {
-                                    if ($found_slash) {
-                                        return false;
-                                    } else {
-                                        $found_slash = true;
-                                        continue;
-                                    }
-                                }
-                                $line_height = $bits[$j];
-                                break;
-                            }
-                        } else {
-                            // slash already found
-                            $found_slash = true;
-                            $j = $i;
-                        }
-                        if ($found_slash) {
-                            $i = $j;
-                            $r = $this->info['line-height']->validate(
-                                              $line_height, $config, $context);
-                            if ($r !== false) {
-                                $final .= '/' . $r;
-                            }
-                        }
-                        $final .= ' ';
-                        $stage = 2;
-                        break;
-                    }
-                    return false;
-
-                // attempting to catch font-family
-                case 2:
-                    $font_family =
-                        implode(' ', array_slice($bits, $i, $size - $i));
-                    $r = $this->info['font-family']->validate(
-                                              $font_family, $config, $context);
-                    if ($r !== false) {
-                        $final .= $r . ' ';
-                        // processing completed successfully
-                        return rtrim($final);
-                    }
-                    return false;
-            }
-        }
-        return false;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 72
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php

@@ -1,72 +0,0 @@
-<?php
-
-/**
- * Validates a font family list according to CSS spec
- * @todo whitelisting allowed fonts would be nice
- */
-class HTMLPurifier_AttrDef_CSS_FontFamily extends HTMLPurifier_AttrDef
-{
-
-    public function validate($string, $config, $context) {
-        static $generic_names = array(
-            'serif' => true,
-            'sans-serif' => true,
-            'monospace' => true,
-            'fantasy' => true,
-            'cursive' => true
-        );
-
-        // assume that no font names contain commas in them
-        $fonts = explode(',', $string);
-        $final = '';
-        foreach($fonts as $font) {
-            $font = trim($font);
-            if ($font === '') continue;
-            // match a generic name
-            if (isset($generic_names[$font])) {
-                $final .= $font . ', ';
-                continue;
-            }
-            // match a quoted name
-            if ($font[0] === '"' || $font[0] === "'") {
-                $length = strlen($font);
-                if ($length <= 2) continue;
-                $quote = $font[0];
-                if ($font[$length - 1] !== $quote) continue;
-                $font = substr($font, 1, $length - 2);
-            }
-
-            $font = $this->expandCSSEscape($font);
-
-            // $font is a pure representation of the font name
-
-            if (ctype_alnum($font) && $font !== '') {
-                // very simple font, allow it in unharmed
-                $final .= $font . ', ';
-                continue;
-            }
-
-            // bugger out on whitespace.  form feed (0C) really
-            // shouldn't show up regardless
-            $font = str_replace(array("\n", "\t", "\r", "\x0C"), ' ', $font);
-
-            // These ugly transforms don't pose a security
-            // risk (as \\ and \" might).  We could try to be clever and
-            // use single-quote wrapping when there is a double quote
-            // present, but I have choosen not to implement that.
-            // (warning: this code relies on the selection of quotation
-            // mark below)
-            $font = str_replace('\\', '\\5C ', $font);
-            $font = str_replace('"',  '\\22 ', $font);
-
-            // complicated font, requires quoting
-            $final .= "\"$font\", "; // note that this will later get turned into &quot;
-        }
-        $final = rtrim($final, ', ');
-        if ($final === '') return false;
-        return $final;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 40
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php

@@ -1,40 +0,0 @@
-<?php
-
-/**
- * Decorator which enables !important to be used in CSS values.
- */
-class HTMLPurifier_AttrDef_CSS_ImportantDecorator extends HTMLPurifier_AttrDef
-{
-    public $def, $allow;
-
-    /**
-     * @param $def Definition to wrap
-     * @param $allow Whether or not to allow !important
-     */
-    public function __construct($def, $allow = false) {
-        $this->def = $def;
-        $this->allow = $allow;
-    }
-    /**
-     * Intercepts and removes !important if necessary
-     */
-    public function validate($string, $config, $context) {
-        // test for ! and important tokens
-        $string = trim($string);
-        $is_important = false;
-        // :TODO: optimization: test directly for !important and ! important
-        if (strlen($string) >= 9 && substr($string, -9) === 'important') {
-            $temp = rtrim(substr($string, 0, -9));
-            // use a temp, because we might want to restore important
-            if (strlen($temp) >= 1 && substr($temp, -1) === '!') {
-                $string = rtrim(substr($temp, 0, -1));
-                $is_important = true;
-            }
-        }
-        $string = $this->def->validate($string, $config, $context);
-        if ($this->allow && $is_important) $string .= ' !important';
-        return $string;
-    }
-}
-
-// vim: et sw=4 sts=4

+ 0 - 47
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Length.php

@@ -1,47 +0,0 @@
-<?php
-
-/**
- * Represents a Length as defined by CSS.
- */
-class HTMLPurifier_AttrDef_CSS_Length extends HTMLPurifier_AttrDef
-{
-
-    protected $min, $max;
-
-    /**
-     * @param HTMLPurifier_Length $max Minimum length, or null for no bound. String is also acceptable.
-     * @param HTMLPurifier_Length $max Maximum length, or null for no bound. String is also acceptable.
-     */
-    public function __construct($min = null, $max = null) {
-        $this->min = $min !== null ? HTMLPurifier_Length::make($min) : null;
-        $this->max = $max !== null ? HTMLPurifier_Length::make($max) : null;
-    }
-
-    public function validate($string, $config, $context) {
-        $string = $this->parseCDATA($string);
-
-        // Optimizations
-        if ($string === '') return false;
-        if ($string === '0') return '0';
-        if (strlen($string) === 1) return false;
-
-        $length = HTMLPurifier_Length::make($string);
-        if (!$length->isValid()) return false;
-
-        if ($this->min) {
-            $c = $length->compareTo($this->min);
-            if ($c === false) return false;
-            if ($c < 0) return false;
-        }
-        if ($this->max) {
-            $c = $length->compareTo($this->max);
-            if ($c === false) return false;
-            if ($c > 0) return false;
-        }
-
-        return $length->toString();
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 78
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ListStyle.php

@@ -1,78 +0,0 @@
-<?php
-
-/**
- * Validates shorthand CSS property list-style.
- * @warning Does not support url tokens that have internal spaces.
- */
-class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Local copy of component validators.
-     * @note See HTMLPurifier_AttrDef_CSS_Font::$info for a similar impl.
-     */
-    protected $info;
-
-    public function __construct($config) {
-        $def = $config->getCSSDefinition();
-        $this->info['list-style-type']     = $def->info['list-style-type'];
-        $this->info['list-style-position'] = $def->info['list-style-position'];
-        $this->info['list-style-image'] = $def->info['list-style-image'];
-    }
-
-    public function validate($string, $config, $context) {
-
-        // regular pre-processing
-        $string = $this->parseCDATA($string);
-        if ($string === '') return false;
-
-        // assumes URI doesn't have spaces in it
-        $bits = explode(' ', strtolower($string)); // bits to process
-
-        $caught = array();
-        $caught['type']     = false;
-        $caught['position'] = false;
-        $caught['image']    = false;
-
-        $i = 0; // number of catches
-        $none = false;
-
-        foreach ($bits as $bit) {
-            if ($i >= 3) return; // optimization bit
-            if ($bit === '') continue;
-            foreach ($caught as $key => $status) {
-                if ($status !== false) continue;
-                $r = $this->info['list-style-' . $key]->validate($bit, $config, $context);
-                if ($r === false) continue;
-                if ($r === 'none') {
-                    if ($none) continue;
-                    else $none = true;
-                    if ($key == 'image') continue;
-                }
-                $caught[$key] = $r;
-                $i++;
-                break;
-            }
-        }
-
-        if (!$i) return false;
-
-        $ret = array();
-
-        // construct type
-        if ($caught['type']) $ret[] = $caught['type'];
-
-        // construct image
-        if ($caught['image']) $ret[] = $caught['image'];
-
-        // construct position
-        if ($caught['position']) $ret[] = $caught['position'];
-
-        if (empty($ret)) return false;
-        return implode(' ', $ret);
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 58
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Multiple.php

@@ -1,58 +0,0 @@
-<?php
-
-/**
- * Framework class for strings that involve multiple values.
- *
- * Certain CSS properties such as border-width and margin allow multiple
- * lengths to be specified.  This class can take a vanilla border-width
- * definition and multiply it, usually into a max of four.
- *
- * @note Even though the CSS specification isn't clear about it, inherit
- *       can only be used alone: it will never manifest as part of a multi
- *       shorthand declaration.  Thus, this class does not allow inherit.
- */
-class HTMLPurifier_AttrDef_CSS_Multiple extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Instance of component definition to defer validation to.
-     * @todo Make protected
-     */
-    public $single;
-
-    /**
-     * Max number of values allowed.
-     * @todo Make protected
-     */
-    public $max;
-
-    /**
-     * @param $single HTMLPurifier_AttrDef to multiply
-     * @param $max Max number of values allowed (usually four)
-     */
-    public function __construct($single, $max = 4) {
-        $this->single = $single;
-        $this->max = $max;
-    }
-
-    public function validate($string, $config, $context) {
-        $string = $this->parseCDATA($string);
-        if ($string === '') return false;
-        $parts = explode(' ', $string); // parseCDATA replaced \r, \t and \n
-        $length = count($parts);
-        $final = '';
-        for ($i = 0, $num = 0; $i < $length && $num < $this->max; $i++) {
-            if (ctype_space($parts[$i])) continue;
-            $result = $this->single->validate($parts[$i], $config, $context);
-            if ($result !== false) {
-                $final .= $result . ' ';
-                $num++;
-            }
-        }
-        if ($final === '') return false;
-        return rtrim($final);
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 69
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Number.php

@@ -1,69 +0,0 @@
-<?php
-
-/**
- * Validates a number as defined by the CSS spec.
- */
-class HTMLPurifier_AttrDef_CSS_Number extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Bool indicating whether or not only positive values allowed.
-     */
-    protected $non_negative = false;
-
-    /**
-     * @param $non_negative Bool indicating whether negatives are forbidden
-     */
-    public function __construct($non_negative = false) {
-        $this->non_negative = $non_negative;
-    }
-
-    /**
-     * @warning Some contexts do not pass $config, $context. These
-     *          variables should not be used without checking HTMLPurifier_Length
-     */
-    public function validate($number, $config, $context) {
-
-        $number = $this->parseCDATA($number);
-
-        if ($number === '') return false;
-        if ($number === '0') return '0';
-
-        $sign = '';
-        switch ($number[0]) {
-            case '-':
-                if ($this->non_negative) return false;
-                $sign = '-';
-            case '+':
-                $number = substr($number, 1);
-        }
-
-        if (ctype_digit($number)) {
-            $number = ltrim($number, '0');
-            return $number ? $sign . $number : '0';
-        }
-
-        // Period is the only non-numeric character allowed
-        if (strpos($number, '.') === false) return false;
-
-        list($left, $right) = explode('.', $number, 2);
-
-        if ($left === '' && $right === '') return false;
-        if ($left !== '' && !ctype_digit($left)) return false;
-
-        $left  = ltrim($left,  '0');
-        $right = rtrim($right, '0');
-
-        if ($right === '') {
-            return $left ? $sign . $left : '0';
-        } elseif (!ctype_digit($right)) {
-            return false;
-        }
-
-        return $sign . $left . '.' . $right;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 40
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Percentage.php

@@ -1,40 +0,0 @@
-<?php
-
-/**
- * Validates a Percentage as defined by the CSS spec.
- */
-class HTMLPurifier_AttrDef_CSS_Percentage extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Instance of HTMLPurifier_AttrDef_CSS_Number to defer number validation
-     */
-    protected $number_def;
-
-    /**
-     * @param Bool indicating whether to forbid negative values
-     */
-    public function __construct($non_negative = false) {
-        $this->number_def = new HTMLPurifier_AttrDef_CSS_Number($non_negative);
-    }
-
-    public function validate($string, $config, $context) {
-
-        $string = $this->parseCDATA($string);
-
-        if ($string === '') return false;
-        $length = strlen($string);
-        if ($length === 1) return false;
-        if ($string[$length - 1] !== '%') return false;
-
-        $number = substr($string, 0, $length - 1);
-        $number = $this->number_def->validate($number, $config, $context);
-
-        if ($number === false) return false;
-        return "$number%";
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 38
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php

@@ -1,38 +0,0 @@
-<?php
-
-/**
- * Validates the value for the CSS property text-decoration
- * @note This class could be generalized into a version that acts sort of
- *       like Enum except you can compound the allowed values.
- */
-class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
-{
-
-    public function validate($string, $config, $context) {
-
-        static $allowed_values = array(
-            'line-through' => true,
-            'overline' => true,
-            'underline' => true,
-        );
-
-        $string = strtolower($this->parseCDATA($string));
-
-        if ($string === 'none') return $string;
-
-        $parts = explode(' ', $string);
-        $final = '';
-        foreach ($parts as $part) {
-            if (isset($allowed_values[$part])) {
-                $final .= $part . ' ';
-            }
-        }
-        $final = rtrim($final);
-        if ($final === '') return false;
-        return $final;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 52
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/URI.php

@@ -1,52 +0,0 @@
-<?php
-
-/**
- * Validates a URI in CSS syntax, which uses url('http://example.com')
- * @note While theoretically speaking a URI in a CSS document could
- *       be non-embedded, as of CSS2 there is no such usage so we're
- *       generalizing it. This may need to be changed in the future.
- * @warning Since HTMLPurifier_AttrDef_CSS blindly uses semicolons as
- *          the separator, you cannot put a literal semicolon in
- *          in the URI. Try percent encoding it, in that case.
- */
-class HTMLPurifier_AttrDef_CSS_URI extends HTMLPurifier_AttrDef_URI
-{
-
-    public function __construct() {
-        parent::__construct(true); // always embedded
-    }
-
-    public function validate($uri_string, $config, $context) {
-        // parse the URI out of the string and then pass it onto
-        // the parent object
-
-        $uri_string = $this->parseCDATA($uri_string);
-        if (strpos($uri_string, 'url(') !== 0) return false;
-        $uri_string = substr($uri_string, 4);
-        $new_length = strlen($uri_string) - 1;
-        if ($uri_string[$new_length] != ')') return false;
-        $uri = trim(substr($uri_string, 0, $new_length));
-
-        if (!empty($uri) && ($uri[0] == "'" || $uri[0] == '"')) {
-            $quote = $uri[0];
-            $new_length = strlen($uri) - 1;
-            if ($uri[$new_length] !== $quote) return false;
-            $uri = substr($uri, 1, $new_length - 1);
-        }
-
-        $uri = $this->expandCSSEscape($uri);
-
-        $result = parent::validate($uri, $config, $context);
-
-        if ($result === false) return false;
-
-        // extra sanity check; should have been done by URI
-        $result = str_replace(array('"', "\\", "\n", "\x0c", "\r"), "", $result);
-
-        return "url(\"$result\")";
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 6
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/index.html

@@ -1,6 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-</body>
-</html>

+ 0 - 65
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/Enum.php

@@ -1,65 +0,0 @@
-<?php
-
-// Enum = Enumerated
-/**
- * Validates a keyword against a list of valid values.
- * @warning The case-insensitive compare of this function uses PHP's
- *          built-in strtolower and ctype_lower functions, which may
- *          cause problems with international comparisons
- */
-class HTMLPurifier_AttrDef_Enum extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Lookup table of valid values.
-     * @todo Make protected
-     */
-    public $valid_values   = array();
-
-    /**
-     * Bool indicating whether or not enumeration is case sensitive.
-     * @note In general this is always case insensitive.
-     */
-    protected $case_sensitive = false; // values according to W3C spec
-
-    /**
-     * @param $valid_values List of valid values
-     * @param $case_sensitive Bool indicating whether or not case sensitive
-     */
-    public function __construct(
-        $valid_values = array(), $case_sensitive = false
-    ) {
-        $this->valid_values = array_flip($valid_values);
-        $this->case_sensitive = $case_sensitive;
-    }
-
-    public function validate($string, $config, $context) {
-        $string = trim($string);
-        if (!$this->case_sensitive) {
-            // we may want to do full case-insensitive libraries
-            $string = ctype_lower($string) ? $string : strtolower($string);
-        }
-        $result = isset($this->valid_values[$string]);
-
-        return $result ? $string : false;
-    }
-
-    /**
-     * @param $string In form of comma-delimited list of case-insensitive
-     *      valid values. Example: "foo,bar,baz". Prepend "s:" to make
-     *      case sensitive
-     */
-    public function make($string) {
-        if (strlen($string) > 2 && $string[0] == 's' && $string[1] == ':') {
-            $string = substr($string, 2);
-            $sensitive = true;
-        } else {
-            $sensitive = false;
-        }
-        $values = explode(',', $string);
-        return new HTMLPurifier_AttrDef_Enum($values, $sensitive);
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 28
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Bool.php

@@ -1,28 +0,0 @@
-<?php
-
-/**
- * Validates a boolean attribute
- */
-class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
-{
-
-    protected $name;
-    public $minimized = true;
-
-    public function __construct($name = false) {$this->name = $name;}
-
-    public function validate($string, $config, $context) {
-        if (empty($string)) return false;
-        return $this->name;
-    }
-
-    /**
-     * @param $string Name of attribute
-     */
-    public function make($string) {
-        return new HTMLPurifier_AttrDef_HTML_Bool($string);
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 34
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Class.php

@@ -1,34 +0,0 @@
-<?php
-
-/**
- * Implements special behavior for class attribute (normally NMTOKENS)
- */
-class HTMLPurifier_AttrDef_HTML_Class extends HTMLPurifier_AttrDef_HTML_Nmtokens
-{
-    protected function split($string, $config, $context) {
-        // really, this twiddle should be lazy loaded
-        $name = $config->getDefinition('HTML')->doctype->name;
-        if ($name == "XHTML 1.1" || $name == "XHTML 2.0") {
-            return parent::split($string, $config, $context);
-        } else {
-            return preg_split('/\s+/', $string);
-        }
-    }
-    protected function filter($tokens, $config, $context) {
-        $allowed = $config->get('Attr.AllowedClasses');
-        $forbidden = $config->get('Attr.ForbiddenClasses');
-        $ret = array();
-        foreach ($tokens as $token) {
-            if (
-                ($allowed === null || isset($allowed[$token])) &&
-                !isset($forbidden[$token]) &&
-                // We need this O(n) check because of PHP's array
-                // implementation that casts -0 to 0.
-                !in_array($token, $ret, true)
-            ) {
-                $ret[] = $token;
-            }
-        }
-        return $ret;
-    }
-}

+ 0 - 32
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Color.php

@@ -1,32 +0,0 @@
-<?php
-
-/**
- * Validates a color according to the HTML spec.
- */
-class HTMLPurifier_AttrDef_HTML_Color extends HTMLPurifier_AttrDef
-{
-
-    public function validate($string, $config, $context) {
-
-        static $colors = null;
-        if ($colors === null) $colors = $config->get('Core.ColorKeywords');
-
-        $string = trim($string);
-
-        if (empty($string)) return false;
-        if (isset($colors[$string])) return $colors[$string];
-        if ($string[0] === '#') $hex = substr($string, 1);
-        else $hex = $string;
-
-        $length = strlen($hex);
-        if ($length !== 3 && $length !== 6) return false;
-        if (!ctype_xdigit($hex)) return false;
-        if ($length === 3) $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2];
-
-        return "#$hex";
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 21
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/FrameTarget.php

@@ -1,21 +0,0 @@
-<?php
-
-/**
- * Special-case enum attribute definition that lazy loads allowed frame targets
- */
-class HTMLPurifier_AttrDef_HTML_FrameTarget extends HTMLPurifier_AttrDef_Enum
-{
-
-    public $valid_values = false; // uninitialized value
-    protected $case_sensitive = false;
-
-    public function __construct() {}
-
-    public function validate($string, $config, $context) {
-        if ($this->valid_values === false) $this->valid_values = $config->get('Attr.AllowedFrameTargets');
-        return parent::validate($string, $config, $context);
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 70
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/ID.php

@@ -1,70 +0,0 @@
-<?php
-
-/**
- * Validates the HTML attribute ID.
- * @warning Even though this is the id processor, it
- *          will ignore the directive Attr:IDBlacklist, since it will only
- *          go according to the ID accumulator. Since the accumulator is
- *          automatically generated, it will have already absorbed the
- *          blacklist. If you're hacking around, make sure you use load()!
- */
-
-class HTMLPurifier_AttrDef_HTML_ID extends HTMLPurifier_AttrDef
-{
-
-    // ref functionality disabled, since we also have to verify
-    // whether or not the ID it refers to exists
-
-    public function validate($id, $config, $context) {
-
-        if (!$config->get('Attr.EnableID')) return false;
-
-        $id = trim($id); // trim it first
-
-        if ($id === '') return false;
-
-        $prefix = $config->get('Attr.IDPrefix');
-        if ($prefix !== '') {
-            $prefix .= $config->get('Attr.IDPrefixLocal');
-            // prevent re-appending the prefix
-            if (strpos($id, $prefix) !== 0) $id = $prefix . $id;
-        } elseif ($config->get('Attr.IDPrefixLocal') !== '') {
-            trigger_error('%Attr.IDPrefixLocal cannot be used unless '.
-                '%Attr.IDPrefix is set', E_USER_WARNING);
-        }
-
-        //if (!$this->ref) {
-            $id_accumulator =& $context->get('IDAccumulator');
-            if (isset($id_accumulator->ids[$id])) return false;
-        //}
-
-        // we purposely avoid using regex, hopefully this is faster
-
-        if (ctype_alpha($id)) {
-            $result = true;
-        } else {
-            if (!ctype_alpha(@$id[0])) return false;
-            $trim = trim( // primitive style of regexps, I suppose
-                $id,
-                'A..Za..z0..9:-._'
-              );
-            $result = ($trim === '');
-        }
-
-        $regexp = $config->get('Attr.IDBlacklistRegexp');
-        if ($regexp && preg_match($regexp, $id)) {
-            return false;
-        }
-
-        if (/*!$this->ref && */$result) $id_accumulator->add($id);
-
-        // if no change was made to the ID, return the result
-        // else, return the new id if stripping whitespace made it
-        //     valid, or return false.
-        return $result ? $id : false;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 41
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Length.php

@@ -1,41 +0,0 @@
-<?php
-
-/**
- * Validates the HTML type length (not to be confused with CSS's length).
- *
- * This accepts integer pixels or percentages as lengths for certain
- * HTML attributes.
- */
-
-class HTMLPurifier_AttrDef_HTML_Length extends HTMLPurifier_AttrDef_HTML_Pixels
-{
-
-    public function validate($string, $config, $context) {
-
-        $string = trim($string);
-        if ($string === '') return false;
-
-        $parent_result = parent::validate($string, $config, $context);
-        if ($parent_result !== false) return $parent_result;
-
-        $length = strlen($string);
-        $last_char = $string[$length - 1];
-
-        if ($last_char !== '%') return false;
-
-        $points = substr($string, 0, $length - 1);
-
-        if (!is_numeric($points)) return false;
-
-        $points = (int) $points;
-
-        if ($points < 0) return '0%';
-        if ($points > 100) return '100%';
-
-        return ((string) $points) . '%';
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 53
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/LinkTypes.php

@@ -1,53 +0,0 @@
-<?php
-
-/**
- * Validates a rel/rev link attribute against a directive of allowed values
- * @note We cannot use Enum because link types allow multiple
- *       values.
- * @note Assumes link types are ASCII text
- */
-class HTMLPurifier_AttrDef_HTML_LinkTypes extends HTMLPurifier_AttrDef
-{
-
-    /** Name config attribute to pull. */
-    protected $name;
-
-    public function __construct($name) {
-        $configLookup = array(
-            'rel' => 'AllowedRel',
-            'rev' => 'AllowedRev'
-        );
-        if (!isset($configLookup[$name])) {
-            trigger_error('Unrecognized attribute name for link '.
-                'relationship.', E_USER_ERROR);
-            return;
-        }
-        $this->name = $configLookup[$name];
-    }
-
-    public function validate($string, $config, $context) {
-
-        $allowed = $config->get('Attr.' . $this->name);
-        if (empty($allowed)) return false;
-
-        $string = $this->parseCDATA($string);
-        $parts = explode(' ', $string);
-
-        // lookup to prevent duplicates
-        $ret_lookup = array();
-        foreach ($parts as $part) {
-            $part = strtolower(trim($part));
-            if (!isset($allowed[$part])) continue;
-            $ret_lookup[$part] = true;
-        }
-
-        if (empty($ret_lookup)) return false;
-        $string = implode(' ', array_keys($ret_lookup));
-
-        return $string;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 41
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/MultiLength.php

@@ -1,41 +0,0 @@
-<?php
-
-/**
- * Validates a MultiLength as defined by the HTML spec.
- *
- * A multilength is either a integer (pixel count), a percentage, or
- * a relative number.
- */
-class HTMLPurifier_AttrDef_HTML_MultiLength extends HTMLPurifier_AttrDef_HTML_Length
-{
-
-    public function validate($string, $config, $context) {
-
-        $string = trim($string);
-        if ($string === '') return false;
-
-        $parent_result = parent::validate($string, $config, $context);
-        if ($parent_result !== false) return $parent_result;
-
-        $length = strlen($string);
-        $last_char = $string[$length - 1];
-
-        if ($last_char !== '*') return false;
-
-        $int = substr($string, 0, $length - 1);
-
-        if ($int == '') return '*';
-        if (!is_numeric($int)) return false;
-
-        $int = (int) $int;
-
-        if ($int < 0) return false;
-        if ($int == 0) return '0';
-        if ($int == 1) return '*';
-        return ((string) $int) . '*';
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 52
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Nmtokens.php

@@ -1,52 +0,0 @@
-<?php
-
-/**
- * Validates contents based on NMTOKENS attribute type.
- */
-class HTMLPurifier_AttrDef_HTML_Nmtokens extends HTMLPurifier_AttrDef
-{
-
-    public function validate($string, $config, $context) {
-
-        $string = trim($string);
-
-        // early abort: '' and '0' (strings that convert to false) are invalid
-        if (!$string) return false;
-
-        $tokens = $this->split($string, $config, $context);
-        $tokens = $this->filter($tokens, $config, $context);
-        if (empty($tokens)) return false;
-        return implode(' ', $tokens);
-
-    }
-
-    /**
-     * Splits a space separated list of tokens into its constituent parts.
-     */
-    protected function split($string, $config, $context) {
-        // OPTIMIZABLE!
-        // do the preg_match, capture all subpatterns for reformulation
-
-        // we don't support U+00A1 and up codepoints or
-        // escaping because I don't know how to do that with regexps
-        // and plus it would complicate optimization efforts (you never
-        // see that anyway).
-        $pattern = '/(?:(?<=\s)|\A)'. // look behind for space or string start
-                   '((?:--|-?[A-Za-z_])[A-Za-z_\-0-9]*)'.
-                   '(?:(?=\s)|\z)/'; // look ahead for space or string end
-        preg_match_all($pattern, $string, $matches);
-        return $matches[1];
-    }
-
-    /**
-     * Template method for removing certain tokens based on arbitrary criteria.
-     * @note If we wanted to be really functional, we'd do an array_filter
-     *       with a callback. But... we're not.
-     */
-    protected function filter($tokens, $config, $context) {
-        return $tokens;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 48
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Pixels.php

@@ -1,48 +0,0 @@
-<?php
-
-/**
- * Validates an integer representation of pixels according to the HTML spec.
- */
-class HTMLPurifier_AttrDef_HTML_Pixels extends HTMLPurifier_AttrDef
-{
-
-    protected $max;
-
-    public function __construct($max = null) {
-        $this->max = $max;
-    }
-
-    public function validate($string, $config, $context) {
-
-        $string = trim($string);
-        if ($string === '0') return $string;
-        if ($string === '')  return false;
-        $length = strlen($string);
-        if (substr($string, $length - 2) == 'px') {
-            $string = substr($string, 0, $length - 2);
-        }
-        if (!is_numeric($string)) return false;
-        $int = (int) $string;
-
-        if ($int < 0) return '0';
-
-        // upper-bound value, extremely high values can
-        // crash operating systems, see <http://ha.ckers.org/imagecrash.html>
-        // WARNING, above link WILL crash you if you're using Windows
-
-        if ($this->max !== null && $int > $this->max) return (string) $this->max;
-
-        return (string) $int;
-
-    }
-
-    public function make($string) {
-        if ($string === '') $max = null;
-        else $max = (int) $string;
-        $class = get_class($this);
-        return new $class($max);
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 6
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/index.html

@@ -1,6 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-</body>
-</html>

+ 0 - 73
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/Integer.php

@@ -1,73 +0,0 @@
-<?php
-
-/**
- * Validates an integer.
- * @note While this class was modeled off the CSS definition, no currently
- *       allowed CSS uses this type.  The properties that do are: widows,
- *       orphans, z-index, counter-increment, counter-reset.  Some of the
- *       HTML attributes, however, find use for a non-negative version of this.
- */
-class HTMLPurifier_AttrDef_Integer extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Bool indicating whether or not negative values are allowed
-     */
-    protected $negative = true;
-
-    /**
-     * Bool indicating whether or not zero is allowed
-     */
-    protected $zero = true;
-
-    /**
-     * Bool indicating whether or not positive values are allowed
-     */
-    protected $positive = true;
-
-    /**
-     * @param $negative Bool indicating whether or not negative values are allowed
-     * @param $zero Bool indicating whether or not zero is allowed
-     * @param $positive Bool indicating whether or not positive values are allowed
-     */
-    public function __construct(
-        $negative = true, $zero = true, $positive = true
-    ) {
-        $this->negative = $negative;
-        $this->zero     = $zero;
-        $this->positive = $positive;
-    }
-
-    public function validate($integer, $config, $context) {
-
-        $integer = $this->parseCDATA($integer);
-        if ($integer === '') return false;
-
-        // we could possibly simply typecast it to integer, but there are
-        // certain fringe cases that must not return an integer.
-
-        // clip leading sign
-        if ( $this->negative && $integer[0] === '-' ) {
-            $digits = substr($integer, 1);
-            if ($digits === '0') $integer = '0'; // rm minus sign for zero
-        } elseif( $this->positive && $integer[0] === '+' ) {
-            $digits = $integer = substr($integer, 1); // rm unnecessary plus
-        } else {
-            $digits = $integer;
-        }
-
-        // test if it's numeric
-        if (!ctype_digit($digits)) return false;
-
-        // perform scope tests
-        if (!$this->zero     && $integer == 0) return false;
-        if (!$this->positive && $integer > 0) return false;
-        if (!$this->negative && $integer < 0) return false;
-
-        return $integer;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 73
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/Lang.php

@@ -1,73 +0,0 @@
-<?php
-
-/**
- * Validates the HTML attribute lang, effectively a language code.
- * @note Built according to RFC 3066, which obsoleted RFC 1766
- */
-class HTMLPurifier_AttrDef_Lang extends HTMLPurifier_AttrDef
-{
-
-    public function validate($string, $config, $context) {
-
-        $string = trim($string);
-        if (!$string) return false;
-
-        $subtags = explode('-', $string);
-        $num_subtags = count($subtags);
-
-        if ($num_subtags == 0) return false; // sanity check
-
-        // process primary subtag : $subtags[0]
-        $length = strlen($subtags[0]);
-        switch ($length) {
-            case 0:
-                return false;
-            case 1:
-                if (! ($subtags[0] == 'x' || $subtags[0] == 'i') ) {
-                    return false;
-                }
-                break;
-            case 2:
-            case 3:
-                if (! ctype_alpha($subtags[0]) ) {
-                    return false;
-                } elseif (! ctype_lower($subtags[0]) ) {
-                    $subtags[0] = strtolower($subtags[0]);
-                }
-                break;
-            default:
-                return false;
-        }
-
-        $new_string = $subtags[0];
-        if ($num_subtags == 1) return $new_string;
-
-        // process second subtag : $subtags[1]
-        $length = strlen($subtags[1]);
-        if ($length == 0 || ($length == 1 && $subtags[1] != 'x') || $length > 8 || !ctype_alnum($subtags[1])) {
-            return $new_string;
-        }
-        if (!ctype_lower($subtags[1])) $subtags[1] = strtolower($subtags[1]);
-
-        $new_string .= '-' . $subtags[1];
-        if ($num_subtags == 2) return $new_string;
-
-        // process all other subtags, index 2 and up
-        for ($i = 2; $i < $num_subtags; $i++) {
-            $length = strlen($subtags[$i]);
-            if ($length == 0 || $length > 8 || !ctype_alnum($subtags[$i])) {
-                return $new_string;
-            }
-            if (!ctype_lower($subtags[$i])) {
-                $subtags[$i] = strtolower($subtags[$i]);
-            }
-            $new_string .= '-' . $subtags[$i];
-        }
-
-        return $new_string;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 34
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/Switch.php

@@ -1,34 +0,0 @@
-<?php
-
-/**
- * Decorator that, depending on a token, switches between two definitions.
- */
-class HTMLPurifier_AttrDef_Switch
-{
-
-    protected $tag;
-    protected $withTag, $withoutTag;
-
-    /**
-     * @param string $tag Tag name to switch upon
-     * @param HTMLPurifier_AttrDef $with_tag Call if token matches tag
-     * @param HTMLPurifier_AttrDef $without_tag Call if token doesn't match, or there is no token
-     */
-    public function __construct($tag, $with_tag, $without_tag) {
-        $this->tag = $tag;
-        $this->withTag = $with_tag;
-        $this->withoutTag = $without_tag;
-    }
-
-    public function validate($string, $config, $context) {
-        $token = $context->get('CurrentToken', true);
-        if (!$token || $token->name !== $this->tag) {
-            return $this->withoutTag->validate($string, $config, $context);
-        } else {
-            return $this->withTag->validate($string, $config, $context);
-        }
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 15
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/Text.php

@@ -1,15 +0,0 @@
-<?php
-
-/**
- * Validates arbitrary text according to the HTML spec.
- */
-class HTMLPurifier_AttrDef_Text extends HTMLPurifier_AttrDef
-{
-
-    public function validate($string, $config, $context) {
-        return $this->parseCDATA($string);
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 77
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI.php

@@ -1,77 +0,0 @@
-<?php
-
-/**
- * Validates a URI as defined by RFC 3986.
- * @note Scheme-specific mechanics deferred to HTMLPurifier_URIScheme
- */
-class HTMLPurifier_AttrDef_URI extends HTMLPurifier_AttrDef
-{
-
-    protected $parser;
-    protected $embedsResource;
-
-    /**
-     * @param $embeds_resource_resource Does the URI here result in an extra HTTP request?
-     */
-    public function __construct($embeds_resource = false) {
-        $this->parser = new HTMLPurifier_URIParser();
-        $this->embedsResource = (bool) $embeds_resource;
-    }
-
-    public function make($string) {
-        $embeds = (bool) $string;
-        return new HTMLPurifier_AttrDef_URI($embeds);
-    }
-
-    public function validate($uri, $config, $context) {
-
-        if ($config->get('URI.Disable')) return false;
-
-        $uri = $this->parseCDATA($uri);
-
-        // parse the URI
-        $uri = $this->parser->parse($uri);
-        if ($uri === false) return false;
-
-        // add embedded flag to context for validators
-        $context->register('EmbeddedURI', $this->embedsResource);
-
-        $ok = false;
-        do {
-
-            // generic validation
-            $result = $uri->validate($config, $context);
-            if (!$result) break;
-
-            // chained filtering
-            $uri_def = $config->getDefinition('URI');
-            $result = $uri_def->filter($uri, $config, $context);
-            if (!$result) break;
-
-            // scheme-specific validation
-            $scheme_obj = $uri->getSchemeObj($config, $context);
-            if (!$scheme_obj) break;
-            if ($this->embedsResource && !$scheme_obj->browsable) break;
-            $result = $scheme_obj->validate($uri, $config, $context);
-            if (!$result) break;
-
-            // Post chained filtering
-            $result = $uri_def->postFilter($uri, $config, $context);
-            if (!$result) break;
-
-            // survived gauntlet
-            $ok = true;
-
-        } while (false);
-
-        $context->destroy('EmbeddedURI');
-        if (!$ok) return false;
-
-        // back to string
-        return $uri->toString();
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 17
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email.php

@@ -1,17 +0,0 @@
-<?php
-
-abstract class HTMLPurifier_AttrDef_URI_Email extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Unpacks a mailbox into its display-name and address
-     */
-    function unpack($string) {
-        // needs to be implemented
-    }
-
-}
-
-// sub-implementations
-
-// vim: et sw=4 sts=4

+ 0 - 21
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php

@@ -1,21 +0,0 @@
-<?php
-
-/**
- * Primitive email validation class based on the regexp found at
- * http://www.regular-expressions.info/email.html
- */
-class HTMLPurifier_AttrDef_URI_Email_SimpleCheck extends HTMLPurifier_AttrDef_URI_Email
-{
-
-    public function validate($string, $config, $context) {
-        // no support for named mailboxes i.e. "Bob <bob@example.com>"
-        // that needs more percent encoding to be done
-        if ($string == '') return false;
-        $string = trim($string);
-        $result = preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $string);
-        return $result ? $string : false;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 6
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email/index.html

@@ -1,6 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-</body>
-</html>

+ 0 - 68
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php

@@ -1,68 +0,0 @@
-<?php
-
-/**
- * Validates a host according to the IPv4, IPv6 and DNS (future) specifications.
- */
-class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Instance of HTMLPurifier_AttrDef_URI_IPv4 sub-validator
-     */
-    protected $ipv4;
-
-    /**
-     * Instance of HTMLPurifier_AttrDef_URI_IPv6 sub-validator
-     */
-    protected $ipv6;
-
-    public function __construct() {
-        $this->ipv4 = new HTMLPurifier_AttrDef_URI_IPv4();
-        $this->ipv6 = new HTMLPurifier_AttrDef_URI_IPv6();
-    }
-
-    public function validate($string, $config, $context) {
-        $length = strlen($string);
-        // empty hostname is OK; it's usually semantically equivalent:
-        // the default host as defined by a URI scheme is used:
-        //
-        //      If the URI scheme defines a default for host, then that
-        //      default applies when the host subcomponent is undefined
-        //      or when the registered name is empty (zero length).
-        if ($string === '') return '';
-        if ($length > 1 && $string[0] === '[' && $string[$length-1] === ']') {
-            //IPv6
-            $ip = substr($string, 1, $length - 2);
-            $valid = $this->ipv6->validate($ip, $config, $context);
-            if ($valid === false) return false;
-            return '['. $valid . ']';
-        }
-
-        // need to do checks on unusual encodings too
-        $ipv4 = $this->ipv4->validate($string, $config, $context);
-        if ($ipv4 !== false) return $ipv4;
-
-        // A regular domain name.
-
-        // This breaks I18N domain names, but we don't have proper IRI support,
-        // so force users to insert Punycode. If there's complaining we'll
-        // try to fix things into an international friendly form.
-
-        // The productions describing this are:
-        $a   = '[a-z]';     // alpha
-        $an  = '[a-z0-9]';  // alphanum
-        $and = '[a-z0-9-]'; // alphanum | "-"
-        // domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
-        $domainlabel   = "$an($and*$an)?";
-        // toplabel    = alpha | alpha *( alphanum | "-" ) alphanum
-        $toplabel      = "$a($and*$an)?";
-        // hostname    = *( domainlabel "." ) toplabel [ "." ]
-        $match = preg_match("/^($domainlabel\.)*$toplabel\.?$/i", $string);
-        if (!$match) return false;
-
-        return $string;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 39
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/IPv4.php

@@ -1,39 +0,0 @@
-<?php
-
-/**
- * Validates an IPv4 address
- * @author Feyd @ forums.devnetwork.net (public domain)
- */
-class HTMLPurifier_AttrDef_URI_IPv4 extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * IPv4 regex, protected so that IPv6 can reuse it
-     */
-    protected $ip4;
-
-    public function validate($aIP, $config, $context) {
-
-        if (!$this->ip4) $this->_loadRegex();
-
-        if (preg_match('#^' . $this->ip4 . '$#s', $aIP))
-        {
-                return $aIP;
-        }
-
-        return false;
-
-    }
-
-    /**
-     * Lazy load function to prevent regex from being stuffed in
-     * cache.
-     */
-    protected function _loadRegex() {
-        $oct = '(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])'; // 0-255
-        $this->ip4 = "(?:{$oct}\\.{$oct}\\.{$oct}\\.{$oct})";
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 99
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/IPv6.php

@@ -1,99 +0,0 @@
-<?php
-
-/**
- * Validates an IPv6 address.
- * @author Feyd @ forums.devnetwork.net (public domain)
- * @note This function requires brackets to have been removed from address
- *       in URI.
- */
-class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4
-{
-
-    public function validate($aIP, $config, $context) {
-
-        if (!$this->ip4) $this->_loadRegex();
-
-        $original = $aIP;
-
-        $hex = '[0-9a-fA-F]';
-        $blk = '(?:' . $hex . '{1,4})';
-        $pre = '(?:/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))';   // /0 - /128
-
-        //      prefix check
-        if (strpos($aIP, '/') !== false)
-        {
-                if (preg_match('#' . $pre . '$#s', $aIP, $find))
-                {
-                        $aIP = substr($aIP, 0, 0-strlen($find[0]));
-                        unset($find);
-                }
-                else
-                {
-                        return false;
-                }
-        }
-
-        //      IPv4-compatiblity check
-        if (preg_match('#(?<=:'.')' . $this->ip4 . '$#s', $aIP, $find))
-        {
-                $aIP = substr($aIP, 0, 0-strlen($find[0]));
-                $ip = explode('.', $find[0]);
-                $ip = array_map('dechex', $ip);
-                $aIP .= $ip[0] . $ip[1] . ':' . $ip[2] . $ip[3];
-                unset($find, $ip);
-        }
-
-        //      compression check
-        $aIP = explode('::', $aIP);
-        $c = count($aIP);
-        if ($c > 2)
-        {
-                return false;
-        }
-        elseif ($c == 2)
-        {
-                list($first, $second) = $aIP;
-                $first = explode(':', $first);
-                $second = explode(':', $second);
-
-                if (count($first) + count($second) > 8)
-                {
-                        return false;
-                }
-
-                while(count($first) < 8)
-                {
-                        array_push($first, '0');
-                }
-
-                array_splice($first, 8 - count($second), 8, $second);
-                $aIP = $first;
-                unset($first,$second);
-        }
-        else
-        {
-                $aIP = explode(':', $aIP[0]);
-        }
-        $c = count($aIP);
-
-        if ($c != 8)
-        {
-                return false;
-        }
-
-        //      All the pieces should be 16-bit hex strings. Are they?
-        foreach ($aIP as $piece)
-        {
-                if (!preg_match('#^[0-9a-fA-F]{4}$#s', sprintf('%04s', $piece)))
-                {
-                        return false;
-                }
-        }
-
-        return $original;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 6
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/URI/index.html

@@ -1,6 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-</body>
-</html>

+ 0 - 6
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrDef/index.html

@@ -1,6 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-</body>
-</html>

+ 0 - 56
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform.php

@@ -1,56 +0,0 @@
-<?php
-
-/**
- * Processes an entire attribute array for corrections needing multiple values.
- *
- * Occasionally, a certain attribute will need to be removed and popped onto
- * another value.  Instead of creating a complex return syntax for
- * HTMLPurifier_AttrDef, we just pass the whole attribute array to a
- * specialized object and have that do the special work.  That is the
- * family of HTMLPurifier_AttrTransform.
- *
- * An attribute transformation can be assigned to run before or after
- * HTMLPurifier_AttrDef validation.  See HTMLPurifier_HTMLDefinition for
- * more details.
- */
-
-abstract class HTMLPurifier_AttrTransform
-{
-
-    /**
-     * Abstract: makes changes to the attributes dependent on multiple values.
-     *
-     * @param $attr Assoc array of attributes, usually from
-     *              HTMLPurifier_Token_Tag::$attr
-     * @param $config Mandatory HTMLPurifier_Config object.
-     * @param $context Mandatory HTMLPurifier_Context object
-     * @returns Processed attribute array.
-     */
-    abstract public function transform($attr, $config, $context);
-
-    /**
-     * Prepends CSS properties to the style attribute, creating the
-     * attribute if it doesn't exist.
-     * @param $attr Attribute array to process (passed by reference)
-     * @param $css CSS to prepend
-     */
-    public function prependCSS(&$attr, $css) {
-        $attr['style'] = isset($attr['style']) ? $attr['style'] : '';
-        $attr['style'] = $css . $attr['style'];
-    }
-
-    /**
-     * Retrieves and removes an attribute
-     * @param $attr Attribute array to process (passed by reference)
-     * @param $key Key of attribute to confiscate
-     */
-    public function confiscateAttr(&$attr, $key) {
-        if (!isset($attr[$key])) return null;
-        $value = $attr[$key];
-        unset($attr[$key]);
-        return $value;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 23
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/Background.php

@@ -1,23 +0,0 @@
-<?php
-
-/**
- * Pre-transform that changes proprietary background attribute to CSS.
- */
-class HTMLPurifier_AttrTransform_Background extends HTMLPurifier_AttrTransform {
-
-    public function transform($attr, $config, $context) {
-
-        if (!isset($attr['background'])) return $attr;
-
-        $background = $this->confiscateAttr($attr, 'background');
-        // some validation should happen here
-
-        $this->prependCSS($attr, "background-image:url($background);");
-
-        return $attr;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 19
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/BdoDir.php

@@ -1,19 +0,0 @@
-<?php
-
-// this MUST be placed in post, as it assumes that any value in dir is valid
-
-/**
- * Post-trasnform that ensures that bdo tags have the dir attribute set.
- */
-class HTMLPurifier_AttrTransform_BdoDir extends HTMLPurifier_AttrTransform
-{
-
-    public function transform($attr, $config, $context) {
-        if (isset($attr['dir'])) return $attr;
-        $attr['dir'] = $config->get('Attr.DefaultTextDir');
-        return $attr;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 23
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/BgColor.php

@@ -1,23 +0,0 @@
-<?php
-
-/**
- * Pre-transform that changes deprecated bgcolor attribute to CSS.
- */
-class HTMLPurifier_AttrTransform_BgColor extends HTMLPurifier_AttrTransform {
-
-    public function transform($attr, $config, $context) {
-
-        if (!isset($attr['bgcolor'])) return $attr;
-
-        $bgcolor = $this->confiscateAttr($attr, 'bgcolor');
-        // some validation should happen here
-
-        $this->prependCSS($attr, "background-color:$bgcolor;");
-
-        return $attr;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 36
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/BoolToCSS.php

@@ -1,36 +0,0 @@
-<?php
-
-/**
- * Pre-transform that changes converts a boolean attribute to fixed CSS
- */
-class HTMLPurifier_AttrTransform_BoolToCSS extends HTMLPurifier_AttrTransform {
-
-    /**
-     * Name of boolean attribute that is trigger
-     */
-    protected $attr;
-
-    /**
-     * CSS declarations to add to style, needs trailing semicolon
-     */
-    protected $css;
-
-    /**
-     * @param $attr string attribute name to convert from
-     * @param $css string CSS declarations to add to style (needs semicolon)
-     */
-    public function __construct($attr, $css) {
-        $this->attr = $attr;
-        $this->css  = $css;
-    }
-
-    public function transform($attr, $config, $context) {
-        if (!isset($attr[$this->attr])) return $attr;
-        unset($attr[$this->attr]);
-        $this->prependCSS($attr, $this->css);
-        return $attr;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 18
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/Border.php

@@ -1,18 +0,0 @@
-<?php
-
-/**
- * Pre-transform that changes deprecated border attribute to CSS.
- */
-class HTMLPurifier_AttrTransform_Border extends HTMLPurifier_AttrTransform {
-
-    public function transform($attr, $config, $context) {
-        if (!isset($attr['border'])) return $attr;
-        $border_width = $this->confiscateAttr($attr, 'border');
-        // some validation should happen here
-        $this->prependCSS($attr, "border:{$border_width}px solid;");
-        return $attr;
-    }
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 58
main/inc/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/EnumToCSS.php

@@ -1,58 +0,0 @@
-<?php
-
-/**
- * Generic pre-transform that converts an attribute with a fixed number of
- * values (enumerated) to CSS.
- */
-class HTMLPurifier_AttrTransform_EnumToCSS extends HTMLPurifier_AttrTransform {
-
-    /**
-     * Name of attribute to transform from
-     */
-    protected $attr;
-
-    /**
-     * Lookup array of attribute values to CSS
-     */
-    protected $enumToCSS = array();
-
-    /**
-     * Case sensitivity of the matching
-     * @warning Currently can only be guaranteed to work with ASCII
-     *          values.
-     */
-    protected $caseSensitive = false;
-
-    /**
-     * @param $attr String attribute name to transform from
-     * @param $enumToCSS Lookup array of attribute values to CSS
-     * @param $case_sensitive Boolean case sensitivity indicator, default false
-     */
-    public function __construct($attr, $enum_to_css, $case_sensitive = false) {
-        $this->attr = $attr;
-        $this->enumToCSS = $enum_to_css;
-        $this->caseSensitive = (bool) $case_sensitive;
-    }
-
-    public function transform($attr, $config, $context) {
-
-        if (!isset($attr[$this->attr])) return $attr;
-
-        $value = trim($attr[$this->attr]);
-        unset($attr[$this->attr]);
-
-        if (!$this->caseSensitive) $value = strtolower($value);
-
-        if (!isset($this->enumToCSS[$value])) {
-            return $attr;
-        }
-
-        $this->prependCSS($attr, $this->enumToCSS[$value]);
-
-        return $attr;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4

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