From e1d6ff0f4ee4006a904c0ee2122e45bce88719eb Mon Sep 17 00:00:00 2001 From: Shish <shish@shishnet.org> Date: Sun, 17 Sep 2017 17:08:08 +0100 Subject: [PATCH 1/2] composer update --- composer.lock | 250 ++++++++++++++++++--------------------------- tests/test-deep.sh | 2 +- 2 files changed, 100 insertions(+), 152 deletions(-) diff --git a/composer.lock b/composer.lock index 4eed5ce6..bd153b0b 100644 --- a/composer.lock +++ b/composer.lock @@ -18,23 +18,11 @@ "type": "zip", "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/3a43d7e563314bf32970b773dd31ecf2b90813dd", "reference": "3a43d7e563314bf32970b773dd31ecf2b90813dd", - "shasum": "" - }, - "type": "bower-asset-library", - "extra": { - "bower-asset-main": "dist/jquery.js", - "bower-asset-ignore": [ - "package.json" - ] + "shasum": null }, + "type": "bower-asset", "license": [ "MIT" - ], - "keywords": [ - "browser", - "javascript", - "jquery", - "library" ] }, { @@ -49,19 +37,12 @@ "type": "zip", "url": "https://api.github.com/repos/rmm5t/jquery-timeago/zipball/67c11951ae9b6020341c1056a42b5406162db40c", "reference": "67c11951ae9b6020341c1056a42b5406162db40c", - "shasum": "" + "shasum": null }, "require": { "bower-asset/jquery": ">=1.4" }, - "type": "bower-asset-library", - "extra": { - "bower-asset-main": "jquery.timeago.js", - "bower-asset-ignore": [ - "test", - "vendor" - ] - }, + "type": "bower-asset", "license": [ "MIT" ] @@ -78,25 +59,9 @@ "type": "zip", "url": "https://api.github.com/repos/js-cookie/js-cookie/zipball/5c830fb71a2bd3acce9cb733d692e13316991891", "reference": "5c830fb71a2bd3acce9cb733d692e13316991891", - "shasum": "" - }, - "type": "bower-asset-library", - "extra": { - "bower-asset-main": [ - "src/js.cookie.js" - ], - "bower-asset-ignore": [ - "travis.sh", - "test", - "Gruntfile.js", - "package.json", - ".gitignore", - ".jshintignore", - ".jshintrc", - ".tm_properties", - ".travis.yml" - ] + "shasum": null }, + "type": "bower-asset", "license": [ "MIT" ] @@ -106,38 +71,18 @@ "version": "2.21.1", "source": { "type": "git", - "url": "https://github.com/johndyer/mediaelement.git", + "url": "https://github.com/mediaelement/mediaelement.git", "reference": "6e80b260172f4ddc3b0bbee046775d2ba4c6f9b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johndyer/mediaelement/zipball/6e80b260172f4ddc3b0bbee046775d2ba4c6f9b7", + "url": "https://api.github.com/repos/mediaelement/mediaelement/zipball/6e80b260172f4ddc3b0bbee046775d2ba4c6f9b7", "reference": "6e80b260172f4ddc3b0bbee046775d2ba4c6f9b7", - "shasum": "" - }, - "type": "bower-asset-library", - "extra": { - "bower-asset-main": [ - "./build/mediaelement-and-player.js", - "./build/mediaelementplayer.css" - ], - "bower-asset-ignore": [ - "**", - "!/build/**", - "!/bower.json", - "!/README*", - "!/changelog*" - ] + "shasum": null }, + "type": "bower-asset", "license": [ "MIT" - ], - "description": "HTML5 <video> and <audio> made easy.", - "keywords": [ - "audio", - "html5", - "shim", - "video" ] }, { @@ -180,7 +125,7 @@ "sort", "table" ], - "time": "2015-12-03 01:22:52" + "time": "2015-12-03T01:22:52+00:00" }, { "name": "dapphp/securimage", @@ -325,7 +270,7 @@ "recaptcha", "spam" ], - "time": "2017-03-09 18:57:45" + "time": "2017-03-09T18:57:45+00:00" }, { "name": "ifixit/php-akismet", @@ -345,28 +290,28 @@ "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "5acd2bd8c2b600ad5cc4c9180ebf0a930604d6a5" + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/5acd2bd8c2b600ad5cc4c9180ebf0a930604d6a5", - "reference": "5acd2bd8c2b600ad5cc4c9180ebf0a930604d6a5", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -391,20 +336,20 @@ "constructor", "instantiate" ], - "time": "2017-02-16 16:15:51" + "time": "2017-07-22T11:58:36+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.6.0", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", - "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", "shasum": "" }, "require": { @@ -433,7 +378,7 @@ "object", "object graph" ], - "time": "2017-01-26T22:05:40+00:00" + "time": "2017-04-12T18:52:22+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -441,12 +386,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", "shasum": "" }, "require": { @@ -487,26 +432,26 @@ "reflection", "static analysis" ], - "time": "2015-12-27 11:43:31" + "time": "2017-09-11T18:02:19+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", + "version": "4.1.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", + "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^7.0", "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", + "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -532,24 +477,24 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" + "time": "2017-08-30T18:51:59+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.2.1", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^5.5 || ^7.0", "phpdocumentor/reflection-common": "^1.0" }, "require-dev": { @@ -579,7 +524,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-11-25T06:54:22+00:00" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", @@ -587,18 +532,18 @@ "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "abe41cb27f4e4207c6f54a09272969fe55e0bbff" + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/abe41cb27f4e4207c6f54a09272969fe55e0bbff", - "reference": "abe41cb27f4e4207c6f54a09272969fe55e0bbff", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", "sebastian/comparator": "^1.1|^2.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, @@ -642,7 +587,7 @@ "spy", "stub" ], - "time": "2017-03-03 17:09:02" + "time": "2017-09-04T11:05:03+00:00" }, { "name": "phpunit/php-code-coverage", @@ -650,12 +595,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "cb9dd0ea37df29fa3c6ae5ac26c3408a7609cb4f" + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cb9dd0ea37df29fa3c6ae5ac26c3408a7609cb4f", - "reference": "cb9dd0ea37df29fa3c6ae5ac26c3408a7609cb4f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", "shasum": "" }, "require": { @@ -705,7 +650,7 @@ "testing", "xunit" ], - "time": "2017-03-07 10:28:00" + "time": "2017-04-02T07:44:40+00:00" }, { "name": "phpunit/php-file-iterator", @@ -752,7 +697,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03 07:40:28" + "time": "2016-10-03T07:40:28+00:00" }, { "name": "phpunit/php-text-template", @@ -842,7 +787,7 @@ "keywords": [ "timer" ], - "time": "2017-03-07 15:42:04" + "time": "2017-03-07T15:42:04+00:00" }, { "name": "phpunit/php-token-stream", @@ -850,20 +795,20 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9ddb181faa4a3841fe131c357fd01de75cbb4da9" + "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9ddb181faa4a3841fe131c357fd01de75cbb4da9", - "reference": "9ddb181faa4a3841fe131c357fd01de75cbb4da9", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9a02332089ac48e704c70f6cefed30c224e3c0b0", + "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^5.6 || ^7.0" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^6.2.4" }, "type": "library", "extra": { @@ -891,7 +836,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-03-07 07:36:57" + "time": "2017-08-20T05:47:52+00:00" }, { "name": "phpunit/phpunit", @@ -899,12 +844,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d421807ce5f372ecaf0bff3a5d41f5c60a18329f" + "reference": "4eba3374803c6c0903145e8940844e6f1d665c07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d421807ce5f372ecaf0bff3a5d41f5c60a18329f", - "reference": "d421807ce5f372ecaf0bff3a5d41f5c60a18329f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4eba3374803c6c0903145e8940844e6f1d665c07", + "reference": "4eba3374803c6c0903145e8940844e6f1d665c07", "shasum": "" }, "require": { @@ -922,7 +867,7 @@ "phpunit/php-timer": "^1.0.6", "phpunit/phpunit-mock-objects": "^3.2", "sebastian/comparator": "^1.2.4", - "sebastian/diff": "~1.2", + "sebastian/diff": "^1.4.3", "sebastian/environment": "^1.3.4 || ^2.0", "sebastian/exporter": "~2.0", "sebastian/global-state": "^1.1", @@ -973,7 +918,7 @@ "testing", "xunit" ], - "time": "2017-03-09 13:47:42" + "time": "2017-09-01T08:38:37+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -981,12 +926,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "4001a301f86fc006c32f532a741ab613f2bd8990" + "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/4001a301f86fc006c32f532a741ab613f2bd8990", - "reference": "4001a301f86fc006c32f532a741ab613f2bd8990", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", + "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", "shasum": "" }, "require": { @@ -1032,7 +977,7 @@ "mock", "xunit" ], - "time": "2017-03-07 08:47:31" + "time": "2017-06-30T09:13:00+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1077,7 +1022,7 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04 10:23:55" + "time": "2017-03-04T10:23:55+00:00" }, { "name": "sebastian/comparator", @@ -1141,20 +1086,20 @@ "compare", "equality" ], - "time": "2017-03-07 10:34:43" + "time": "2017-03-07T10:34:43+00:00" }, { "name": "sebastian/diff", - "version": "dev-master", + "version": "1.4.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "763d7adeb8c35d2af2b04c0f6cafeee059074dfb" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/763d7adeb8c35d2af2b04c0f6cafeee059074dfb", - "reference": "763d7adeb8c35d2af2b04c0f6cafeee059074dfb", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { @@ -1193,27 +1138,27 @@ "keywords": [ "diff" ], - "time": "2017-03-07 07:26:53" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", - "version": "dev-master", + "version": "2.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "144fedf9aa8e3f1c52199f3634eb699cb59741d9" + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/144fedf9aa8e3f1c52199f3634eb699cb59741d9", - "reference": "144fedf9aa8e3f1c52199f3634eb699cb59741d9", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", "shasum": "" }, "require": { "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^5.0" }, "type": "library", "extra": { @@ -1243,7 +1188,7 @@ "environment", "hhvm" ], - "time": "2017-03-07 12:59:58" + "time": "2016-11-26T07:53:53+00:00" }, { "name": "sebastian/exporter", @@ -1310,7 +1255,7 @@ "export", "exporter" ], - "time": "2017-03-07 10:36:49" + "time": "2017-03-07T10:36:49+00:00" }, { "name": "sebastian/global-state", @@ -1361,7 +1306,7 @@ "keywords": [ "global state" ], - "time": "2017-02-23 14:11:06" + "time": "2017-02-23T14:11:06+00:00" }, { "name": "sebastian/object-enumerator", @@ -1407,7 +1352,7 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-03-07 10:37:45" + "time": "2017-03-07T10:37:45+00:00" }, { "name": "sebastian/recursion-context", @@ -1460,7 +1405,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-08 08:21:15" + "time": "2017-03-08T08:21:15+00:00" }, { "name": "sebastian/resource-operations", @@ -1502,7 +1447,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2016-10-03 07:43:09" + "time": "2016-10-03T07:43:09+00:00" }, { "name": "sebastian/version", @@ -1545,27 +1490,30 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03 07:35:21" + "time": "2016-10-03T07:35:21+00:00" }, { "name": "symfony/yaml", - "version": "dev-master", + "version": "3.4.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "d1abb473764f82339862b114b45b3cd424b2d1a3" + "reference": "a0e15688972f012156cf1ffa076fe1203bce6bc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/d1abb473764f82339862b114b45b3cd424b2d1a3", - "reference": "d1abb473764f82339862b114b45b3cd424b2d1a3", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a0e15688972f012156cf1ffa076fe1203bce6bc9", + "reference": "a0e15688972f012156cf1ffa076fe1203bce6bc9", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/console": "<3.4" }, "require-dev": { - "symfony/console": "~2.8|~3.0" + "symfony/console": "~3.4|~4.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -1573,7 +1521,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1600,7 +1548,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-03-07 16:54:31" + "time": "2017-09-17T10:10:45+00:00" }, { "name": "webmozart/assert", @@ -1650,7 +1598,7 @@ "check", "validate" ], - "time": "2016-11-23 20:04:41" + "time": "2016-11-23T20:04:41+00:00" } ], "aliases": [], diff --git a/tests/test-deep.sh b/tests/test-deep.sh index 8e63ef98..bc630357 100755 --- a/tests/test-deep.sh +++ b/tests/test-deep.sh @@ -4,6 +4,6 @@ php \ -d extension=xdebug.so \ -d xdebug.profiler_output_dir=./data/prof/ \ -d xdebug.profiler_enable=1 \ - ./phpunit.phar \ + ./vendor/bin/phpunit \ --config tests/phpunit.xml \ --coverage-clover data/coverage.clover From a32bc6448c4916591d5791d185483487627df386 Mon Sep 17 00:00:00 2001 From: Shish <shish@shishnet.org> Date: Sun, 17 Sep 2017 18:59:48 +0100 Subject: [PATCH 2/2] make user list slightly more useful --- core/user.class.php | 13 ------------- core/util.inc.php | 12 ++++++++++-- ext/user/main.php | 33 ++++++++++++++++++++++++--------- ext/user/theme.php | 44 +++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 75 insertions(+), 27 deletions(-) diff --git a/core/user.class.php b/core/user.class.php index e2b30a1d..662300cd 100644 --- a/core/user.class.php +++ b/core/user.class.php @@ -140,19 +140,6 @@ class User { } } - /** - * @param int $offset - * @param int $limit - * @return array - */ - public static function by_list(/*int*/ $offset, /*int*/ $limit=50) { - assert('is_numeric($offset)', var_export($offset, true)); - assert('is_numeric($limit)', var_export($limit, true)); - global $database; - $rows = $database->get_all("SELECT * FROM users WHERE id >= :start AND id < :end", array("start"=>$offset, "end"=>$offset+$limit)); - return array_map("_new_user", $rows); - } - /* useful user object functions start here */ diff --git a/core/util.inc.php b/core/util.inc.php index 81582cdf..6b0e081c 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -555,7 +555,15 @@ function make_http(/*string*/ $link) { */ function make_form($target, $method="POST", $multipart=False, $form_id="", $onsubmit="") { global $user; - $auth = $user->get_auth_html(); + if($method == "GET") { + $link = html_escape($target); + $target = make_link($target); + $extra_inputs = "<input type='hidden' name='q' value='$link'>"; + } + else { + $extra_inputs = $user->get_auth_html(); + } + $extra = empty($form_id) ? '' : 'id="'. $form_id .'"'; if($multipart) { $extra .= " enctype='multipart/form-data'"; @@ -563,7 +571,7 @@ function make_form($target, $method="POST", $multipart=False, $form_id="", $onsu if($onsubmit) { $extra .= ' onsubmit="'.$onsubmit.'"'; } - return '<form action="'.$target.'" method="'.$method.'" '.$extra.'>'.$auth; + return '<form action="'.$target.'" method="'.$method.'" '.$extra.'>'.$extra_inputs; } /** diff --git a/ext/user/main.php b/ext/user/main.php index c2bc2f8e..263af280 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -95,7 +95,7 @@ class UserPage extends Extension { } public function onPageRequest(PageRequestEvent $event) { - global $config, $page, $user; + global $config, $database, $page, $user; $this->show_user_info(); @@ -115,15 +115,30 @@ class UserPage extends Extension { $this->page_create(); } else if($event->get_arg(0) == "list") { -// select users.id,name,joindate,admin, -// (select count(*) from images where images.owner_id=users.id) as images, -// (select count(*) from comments where comments.owner_id=users.id) as comments from users; + $offset = 0; + $limit = 50; -// select users.id,name,joindate,admin,image_count,comment_count -// from users -// join (select owner_id,count(*) as image_count from images group by owner_id) as _images on _images.owner_id=users.id -// join (select owner_id,count(*) as comment_count from comments group by owner_id) as _comments on _comments.owner_id=users.id; - $this->theme->display_user_list($page, User::by_list(0), $user); + $q = "SELECT * FROM users WHERE id >= :start AND id < :end"; + $a = array("start"=>$offset, "end"=>$offset+$limit); + + if(@$_GET['username']) { + $q .= " AND name LIKE :name"; + $a["name"] = '%' . $_GET['username'] . '%'; + } + + if(@$_GET['email']) { + $q .= " AND name LIKE :email"; + $a["email"] = '%' . $_GET['email'] . '%'; + } + + if(@$_GET['class']) { + $q .= " AND class LIKE :class"; + $a["class"] = $_GET['class']; + } + + $rows = $database->get_all($q, $a); + $users = array_map("_new_user", $rows); + $this->theme->display_user_list($page, $users, $user); } else if($event->get_arg(0) == "logout") { $this->page_logout(); diff --git a/ext/user/theme.php b/ext/user/theme.php index ef3b7809..6f16a86c 100644 --- a/ext/user/theme.php +++ b/ext/user/theme.php @@ -9,18 +9,56 @@ class UserPageTheme extends Themelet { "There should be a login box to the left")); } + /** + * @param Page $page + * @param User[] $users + * @param User $user + */ public function display_user_list(Page $page, $users, User $user) { $page->set_title("User List"); $page->set_heading("User List"); $page->add_block(new NavBlock()); - $html = "<table>"; - $html .= "<tr><td>Name</td></tr>"; + + $html = "<table class='zebra'>"; + + $html .= "<tr>"; + $html .= "<td>Name</td>"; + if($user->can('delete_user')) + $html .= "<td>Email</td>"; + $html .= "<td>Class</td>"; + $html .= "<td>Action</td>"; + $html .= "</tr>"; + + $h_username = html_escape(@$_GET['username']); + $h_email = html_escape(@$_GET['email']); + $h_class = html_escape(@$_GET['class']); + + $html .= "<tr>" . make_form("user_admin/list", "GET"); + $html .= "<td><input type='text' name='username' value='$h_username'/></td>"; + if($user->can('delete_user')) + $html .= "<td><input type='email' name='email' value='$h_email'/></td>"; + $html .= "<td><input type='text' name='class' value='$h_class'/></td>"; + $html .= "<td><input type='submit' value='Search'/></td>"; + $html .= "</form></tr>"; + foreach($users as $duser) { + $h_name = html_escape($duser->name); + $h_email = html_escape($duser->email); + $h_class = html_escape($duser->class->name); + $u_link = make_link("user/" . url_escape($duser->name)); + $u_posts = make_link("post/list/user_id=" . url_escape($duser->id) . "/1"); + $html .= "<tr>"; - $html .= "<td><a href='".make_link("user/".url_escape($duser->name))."'>".html_escape($duser->name)."</a></td>"; + $html .= "<td><a href='$u_link'>$h_name</a></td>"; + if($user->can('delete_user')) + $html .= "<td>$h_email</td>"; + $html .= "<td>$h_class</td>"; + $html .= "<td><a href='$u_posts'>Show Posts</a></td>"; $html .= "</tr>"; } + $html .= "</table>"; + $page->add_block(new Block("Users", $html)); }