format
This commit is contained in:
		
							parent
							
								
									0b2e36303d
								
							
						
					
					
						commit
						2cae6cd273
					
				| @ -409,7 +409,8 @@ function get_base_href(): string | |||||||
| /** | /** | ||||||
|  * The opposite of the standard library's parse_url |  * The opposite of the standard library's parse_url | ||||||
|  */ |  */ | ||||||
| function unparse_url($parsed_url) { | function unparse_url($parsed_url) | ||||||
|  | { | ||||||
|     $scheme   = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; |     $scheme   = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; | ||||||
|     $host     = isset($parsed_url['host']) ? $parsed_url['host'] : ''; |     $host     = isset($parsed_url['host']) ? $parsed_url['host'] : ''; | ||||||
|     $port     = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; |     $port     = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; | ||||||
|  | |||||||
| @ -2,7 +2,8 @@ | |||||||
| 
 | 
 | ||||||
| use PHPUnit\Framework\TestCase; | use PHPUnit\Framework\TestCase; | ||||||
| 
 | 
 | ||||||
| class TestInit extends TestCase { | class TestInit extends TestCase | ||||||
|  | { | ||||||
|     public function testInitExt() |     public function testInitExt() | ||||||
|     { |     { | ||||||
|         send_event(new InitExtEvent()); |         send_event(new InitExtEvent()); | ||||||
|  | |||||||
| @ -60,7 +60,9 @@ function modify_url(string $url, array $changes): string | |||||||
|     $parts = parse_url($url); |     $parts = parse_url($url); | ||||||
| 
 | 
 | ||||||
|     $params = []; |     $params = []; | ||||||
|     if(isset($parts['query'])) parse_str($parts['query'], $params); |     if (isset($parts['query'])) { | ||||||
|  |         parse_str($parts['query'], $params); | ||||||
|  |     } | ||||||
|     foreach ($changes as $k => $v) { |     foreach ($changes as $k => $v) { | ||||||
|         if (is_null($v) and isset($params[$k])) { |         if (is_null($v) and isset($params[$k])) { | ||||||
|             unset($params[$k]); |             unset($params[$k]); | ||||||
| @ -98,10 +100,14 @@ function make_http(string $link): string | |||||||
|  */ |  */ | ||||||
| function referer_or(string $dest, ?array $blacklist=null): string | function referer_or(string $dest, ?array $blacklist=null): string | ||||||
| { | { | ||||||
|     if(empty($_SERVER['HTTP_REFERER'])) return $dest; |     if (empty($_SERVER['HTTP_REFERER'])) { | ||||||
|     if($blacklist) { |         return $dest; | ||||||
|         foreach($blacklist as $b) { |     } | ||||||
|             if(strstr($_SERVER['HTTP_REFERER'], $b)) return $dest; |     if ($blacklist) { | ||||||
|  |         foreach ($blacklist as $b) { | ||||||
|  |             if (strstr($_SERVER['HTTP_REFERER'], $b)) { | ||||||
|  |                 return $dest; | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     return $_SERVER['HTTP_REFERER']; |     return $_SERVER['HTTP_REFERER']; | ||||||
|  | |||||||
| @ -2,7 +2,6 @@ | |||||||
| 
 | 
 | ||||||
| class HelpPagesTest extends ShimmiePHPUnitTestCase | class HelpPagesTest extends ShimmiePHPUnitTestCase | ||||||
| { | { | ||||||
| 
 |  | ||||||
|     public function test_list() |     public function test_list() | ||||||
|     { |     { | ||||||
|         send_event(new HelpPageListBuildingEvent()); |         send_event(new HelpPageListBuildingEvent()); | ||||||
|  | |||||||
| @ -198,9 +198,8 @@ class IndexTest extends ShimmiePHPUnitTestCase | |||||||
|         send_event(new UserLoginEvent(User::by_name(self::$user_name))); |         send_event(new UserLoginEvent(User::by_name(self::$user_name))); | ||||||
|         send_event(new PageNavBuildingEvent()); |         send_event(new PageNavBuildingEvent()); | ||||||
|         // just a few common parents
 |         // just a few common parents
 | ||||||
|         foreach(["help", "posts", "system", "user"] as $parent) { |         foreach (["help", "posts", "system", "user"] as $parent) { | ||||||
|             send_event(new PageSubNavBuildingEvent($parent)); |             send_event(new PageSubNavBuildingEvent($parent)); | ||||||
| 
 |  | ||||||
|         } |         } | ||||||
|         $this->assertTrue(true); |         $this->assertTrue(true); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -47,8 +47,7 @@ class PoolCreationEvent extends Event | |||||||
|         User $pool_user = null, |         User $pool_user = null, | ||||||
|         bool $public = false, |         bool $public = false, | ||||||
|         string $description = "" |         string $description = "" | ||||||
|     ) |     ) { | ||||||
|     { |  | ||||||
|         parent::__construct(); |         parent::__construct(); | ||||||
|         global $user; |         global $user; | ||||||
| 
 | 
 | ||||||
| @ -59,7 +58,8 @@ class PoolCreationEvent extends Event | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| class Pool { | class Pool | ||||||
|  | { | ||||||
|     public $id; |     public $id; | ||||||
|     public $user_id; |     public $user_id; | ||||||
|     public $user_name; |     public $user_name; | ||||||
| @ -81,7 +81,8 @@ class Pool { | |||||||
|         $this->posts = (int)$row['posts']; |         $this->posts = (int)$row['posts']; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public static function makePool(array $row): Pool { |     public static function makePool(array $row): Pool | ||||||
|  |     { | ||||||
|         return new Pool($row); |         return new Pool($row); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -316,7 +317,8 @@ class Pools extends Extension | |||||||
|                 case "import": |                 case "import": | ||||||
|                     if ($this->have_permission($user, $pool)) { |                     if ($this->have_permission($user, $pool)) { | ||||||
|                         $images = Image::find_images( |                         $images = Image::find_images( | ||||||
|                             0, $config->get_int(PoolsConfig::MAX_IMPORT_RESULTS, 1000), |                             0, | ||||||
|  |                             $config->get_int(PoolsConfig::MAX_IMPORT_RESULTS, 1000), | ||||||
|                             Tag::explode($_POST["pool_tag"]) |                             Tag::explode($_POST["pool_tag"]) | ||||||
|                         ); |                         ); | ||||||
|                         $this->theme->pool_result($page, $images, $pool); |                         $this->theme->pool_result($page, $images, $pool); | ||||||
|  | |||||||
| @ -1,5 +1,15 @@ | |||||||
| <?php declare(strict_types=1); | <?php declare(strict_types=1); | ||||||
| use function MicroHTML\{UL,LI,A,INPUT,FORM,DIV,LABEL,P,B,SPAN,rawHTML}; | use function MicroHTML\UL; | ||||||
|  | use function MicroHTML\LI; | ||||||
|  | use function MicroHTML\A; | ||||||
|  | use function MicroHTML\INPUT; | ||||||
|  | use function MicroHTML\FORM; | ||||||
|  | use function MicroHTML\DIV; | ||||||
|  | use function MicroHTML\LABEL; | ||||||
|  | use function MicroHTML\P; | ||||||
|  | use function MicroHTML\B; | ||||||
|  | use function MicroHTML\SPAN; | ||||||
|  | use function MicroHTML\rawHTML; | ||||||
| 
 | 
 | ||||||
| class SourceHistoryTheme extends Themelet | class SourceHistoryTheme extends Themelet | ||||||
| { | { | ||||||
|  | |||||||
| @ -1,5 +1,15 @@ | |||||||
| <?php declare(strict_types=1); | <?php declare(strict_types=1); | ||||||
| use function MicroHTML\{UL,LI,A,INPUT,FORM,DIV,LABEL,P,B,SPAN,rawHTML}; | use function MicroHTML\UL; | ||||||
|  | use function MicroHTML\LI; | ||||||
|  | use function MicroHTML\A; | ||||||
|  | use function MicroHTML\INPUT; | ||||||
|  | use function MicroHTML\FORM; | ||||||
|  | use function MicroHTML\DIV; | ||||||
|  | use function MicroHTML\LABEL; | ||||||
|  | use function MicroHTML\P; | ||||||
|  | use function MicroHTML\B; | ||||||
|  | use function MicroHTML\SPAN; | ||||||
|  | use function MicroHTML\rawHTML; | ||||||
| 
 | 
 | ||||||
| class TagHistoryTheme extends Themelet | class TagHistoryTheme extends Themelet | ||||||
| { | { | ||||||
|  | |||||||
| @ -132,10 +132,9 @@ abstract class ShimmiePHPUnitTestCase extends TestCase | |||||||
|         } |         } | ||||||
|         $_SERVER['REQUEST_URI'] = make_link($page_name); |         $_SERVER['REQUEST_URI'] = make_link($page_name); | ||||||
|         foreach ($args as $k=>$v) { |         foreach ($args as $k=>$v) { | ||||||
|             if(is_array($v)) { |             if (is_array($v)) { | ||||||
|                 $args[$k] = $v; |                 $args[$k] = $v; | ||||||
|             } |             } else { | ||||||
|             else { |  | ||||||
|                 $args[$k] = (string)$v; |                 $args[$k] = (string)$v; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user