Mercurial > dirlist-php
comparison index.php @ 16:3c0b3a38a7fc
Stupid lightbox2 can't copy image url directly ._.
author | edogawaconan <me@myconan.net> |
---|---|
date | Wed, 22 Oct 2014 01:36:37 +0900 |
parents | 3dbddf76760a |
children | 8b222e3ffe25 |
comparison
equal
deleted
inserted
replaced
15:3dbddf76760a | 16:3c0b3a38a7fc |
---|---|
43 function h($string) { return htmlspecialchars($string, ENT_QUOTES, "UTF-8"); } | 43 function h($string) { return htmlspecialchars($string, ENT_QUOTES, "UTF-8"); } |
44 function a($string) { return preg_replace("#(%2F)+#", "/", rawurlencode($string)); } | 44 function a($string) { return preg_replace("#(%2F)+#", "/", rawurlencode($string)); } |
45 function link_to($target, $title) { | 45 function link_to($target, $title) { |
46 $lightbox = ""; | 46 $lightbox = ""; |
47 if (substr($target, -1) !== "/" && preg_match("/(jpe?g|gif|png|webp)$/i", pathinfo($target, PATHINFO_EXTENSION)) === 1) { | 47 if (substr($target, -1) !== "/" && preg_match("/(jpe?g|gif|png|webp)$/i", pathinfo($target, PATHINFO_EXTENSION)) === 1) { |
48 $lightbox = ' data-lightbox="aa" data-title="' . $target . '" '; | 48 $lightbox = ' data-lightbox="aa" data-title="' . h('<a href="' . a($target) . '">' . h($target) . "</a>") . '" '; |
49 } | 49 } |
50 | 50 |
51 return('<a href="' . a($target) . '"' . $lightbox . ">" . h($title) . "</a>"); | 51 return('<a href="' . a($target) . '"' . $lightbox . ">" . h($title) . "</a>"); |
52 } | 52 } |
53 | 53 |
125 <head> | 125 <head> |
126 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> | 126 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
127 <title>Index of <?php echo h($prefix . $path); ?></title> | 127 <title>Index of <?php echo h($prefix . $path); ?></title> |
128 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> | 128 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> |
129 <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/lightbox2/2.7.1/css/lightbox.css"> | 129 <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/lightbox2/2.7.1/css/lightbox.css"> |
130 <style type="text/css"> | |
131 .lb-data a { color: #ccc; } | |
132 </style> | |
130 <style type="text/css"> | 133 <style type="text/css"> |
131 * { box-sizing: border-box; } | 134 * { box-sizing: border-box; } |
132 body { | 135 body { |
133 font-family: Segoe UI, sans-serif; | 136 font-family: Segoe UI, sans-serif; |
134 font-size: 14px; | 137 font-size: 14px; |