Merge pull request #59 from DakuTree/master

More fixes!
This commit is contained in:
Shish Moom 2011-12-21 14:29:08 -08:00
commit 990dbe5fd1
15 changed files with 235 additions and 63 deletions

View File

@ -7,7 +7,6 @@
class FlashFileHandler extends DataHandlerExtension {
protected function create_thumb($hash) {
// FIXME: scale image, as not all boards use 192x192
copy("ext/handle_flash/thumb.jpg", warehouse_path("thumbs", $hash));
}

View File

@ -7,7 +7,6 @@
class MP3FileHandler extends DataHandlerExtension {
protected function create_thumb($hash) {
// FIXME: scale image, as not all boards use 192x192
copy("ext/handle_mp3/thumb.jpg", warehouse_path("thumbs", $hash));
}

View File

@ -40,7 +40,6 @@ class SVGFileHandler implements Extension {
// exec("convert images/{$ha}/{$hash}[0] -geometry {$w}x{$h} -quality {$q} jpg:thumbs/{$ha}/{$hash}");
// }
// else {
// FIXME: scale image, as not all boards use 192x192
copy("ext/handle_svg/thumb.jpg", warehouse_path("thumbs", $hash));
// }
}

View File

@ -253,8 +253,8 @@ function captcha_get_html() {
if(DEBUG && ip_in_range($_SERVER['REMOTE_ADDR'], "127.0.0.0/8")) return "";
$captcha = "";
if($user->is_anonymous() && $config->get_bool("use_captchas")) {
$rpk = $config->get_string("api_recaptcha_pubkey");
if($user->is_anonymous() && $config->get_bool("comment_captcha")) {
$rpk = $config->get_string("api_recaptcha_privkey");
if(!empty($rpk)) {
$captcha = recaptcha_get_html($rpk);
}
@ -274,8 +274,8 @@ function captcha_check() {
if(DEBUG && ip_in_range($_SERVER['REMOTE_ADDR'], "127.0.0.0/8")) return true;
if($user->is_anonymous() && $config->get_bool("use_captchas")) {
$rpk = $config->get_string('api_recaptcha_privkey');
if($user->is_anonymous() && $config->get_bool("comment_captcha")) {
$rpk = $config->get_string('api_recaptcha_pubkey');
if(!empty($rpk)) {
$resp = recaptcha_check_answer(
$rpk,

View File

@ -171,7 +171,7 @@ class Setup extends SimpleExtension {
$config->set_default_string("theme", "default");
$config->set_default_bool("use_autodate", true);
$config->set_default_bool("word_wrap", true);
$config->set_default_bool("use_captchas", false);
$config->set_default_bool("comment_captcha", false);
$config->set_default_string("autodate_format", "F j, Y");
// Automatic caching is disabled by default
$config->set_default_string("autocache_location", "data/cache");

View File

@ -1,4 +1,9 @@
#large_upload_form INPUT {
/* Only need to change the file/url inputs */
#large_upload_form INPUT.wid {
width: 100%;
}
#radio_button {
width: auto;
}
/* This is needed since the theme style.css forcibly sets vertical align to "top". */
TABLE.vert TD, TABLE.vert TH {vertical-align: middle;}

View File

@ -12,22 +12,27 @@ class UploadTheme extends Themelet {
public function display_page(Page $page) {
global $config;
$tl_enabled = ($config->get_string("transload_engine", "none") != "none");
// Uploader 2.0!
$upload_list = "";
for($i=0; $i<$config->get_int('upload_count'); $i++) {
$n = $i + 1;
$width = $tl_enabled ? "35%" : "80%";
$upload_list .= "
<tr>
<td width='50'>File $n</td>
<td width='250'><input id='data$i' name='data$i' type='file'></td>
";
if($tl_enabled) {
$upload_list .= "
<td width='50'>URL $n</td>
<td width='250'><input id='url$i' name='url$i' type='text'></td>
";
}
<td width='60'><form><input id='radio_buttona' type='radio' name='method' value='file' checked='checked' onclick='javascript:document.getElementById(&quot;url$i&quot;).style.display = &quot;none&quot;;document.getElementById(&quot;url$i&quot;).value = &quot;&quot;;document.getElementById(&quot;data$i&quot;).style.display = &quot;inline&quot;' /> File<br>";
if($tl_enabled) {
$upload_list .="
<input id='radio_buttonb' type='radio' name='method' value='url' onclick='javascript:document.getElementById(&quot;data$i&quot;).style.display = &quot;none&quot;;document.getElementById(&quot;data$i&quot;).value = &quot;&quot;;document.getElementById(&quot;url$i&quot;).style.display = &quot;inline&quot;' /> URL</ br></td></form>
<td><input id='data$i' name='data$i' class='wid' type='file'><input id='url$i' name='url$i' class='wid' type='text' style='display:none'></td>
";
}
else {
$upload_list .= "</form></td>
<td width='250'><input id='data$i' name='data$i' class='wid' type='file'></td>
";
}
$upload_list .= "
</tr>
";
@ -51,7 +56,7 @@ class UploadTheme extends Themelet {
});
</script>
".make_form(make_link("upload"), "POST", $multipart=True)."
<table id='large_upload_form'>
<table id='large_upload_form' class='vert'>
$upload_list
<tr><td>Tags</td><td colspan='3'><input id='tag_box' name='tags' type='text'></td></tr>
<tr><td>Source</td><td colspan='3'><input name='source' type='text'></td></tr>
@ -60,7 +65,7 @@ class UploadTheme extends Themelet {
</form>
<small>(Max file size is $max_kb)</small>
";
if($tl_enabled) {
$link = make_http(make_link("upload"));
if($config->get_bool('nice_urls')){
@ -99,21 +104,18 @@ class UploadTheme extends Themelet {
$tl_enabled = ($config->get_string("transload_engine", "none") != "none");
$upload_list = '';
$width = $tl_enabled ? "35%" : "80%";
$upload_list .= "
<tr>
<td width='50'>File</td>
<td width='250'><input id='data0' name='data0' type='file'></td>
</tr>
";
if($tl_enabled) {
$upload_list .= "
<tr>
<td width='50'>URL</td>
<td width='250'><input id='url0' name='url0' type='text'></td>
</tr>
";
}
<tr>
<td width='60'><form><input id='radio_buttona' type='radio' name='method' value='file' checked='checked' onclick='javascript:document.getElementById(&quot;url0&quot;).style.display = &quot;none&quot;;document.getElementById(&quot;url0&quot;).value = &quot;&quot;;document.getElementById(&quot;data0&quot;).style.display = &quot;inline&quot;' /> File<br>";
if($tl_enabled) {
$upload_list .="
<input id='radio_buttonb' type='radio' name='method' value='url' onclick='javascript:document.getElementById(&quot;data0&quot;).style.display = &quot;none&quot;;document.getElementById(&quot;data0&quot;).value = &quot;&quot;;document.getElementById(&quot;url0&quot;).style.display = &quot;inline&quot;' /> URL</ br></td></form>
<td><input id='data0' name='data0' class='wid' type='file'><input id='url0' name='url0' class='wid' type='text' style='display:none'></td>
";
} else {
$upload_list .= "</form></td>
";
}
$max_size = $config->get_int('upload_size');
$max_kb = to_shorthand_int($max_size);
@ -127,7 +129,7 @@ class UploadTheme extends Themelet {
.$thumbnail."<br>"
.make_form(make_link("upload/replace/".$image_id), "POST", $multipart=True)."
<input type='hidden' name='image_id' value='$image_id'>
<table id='large_upload_form'>
<table id='large_upload_form' class='vert'>
$upload_list
<tr><td>Source</td><td colspan='3'><input name='source' type='text'></td></tr>
<tr><td colspan='4'><input id='uploadbutton' type='submit' value='Post'></td></tr>

View File

@ -4,7 +4,7 @@
* - Documentation and latest version
* http://recaptcha.net/plugins/php/
* - Get a reCAPTCHA API Key
* http://recaptcha.net/api/getkey
* https://www.google.com/recaptcha/admin/create
* - Discussion group
* http://groups.google.com/group/recaptcha
*
@ -35,9 +35,9 @@
/**
* The reCAPTCHA server URL's
*/
define("RECAPTCHA_API_SERVER", "http://api.recaptcha.net");
define("RECAPTCHA_API_SECURE_SERVER", "https://api-secure.recaptcha.net");
define("RECAPTCHA_VERIFY_SERVER", "api-verify.recaptcha.net");
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
/**
* Encodes the given data into a query string format
@ -106,7 +106,7 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) {
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
{
if ($pubkey == null || $pubkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>");
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
}
if ($use_ssl) {
@ -152,7 +152,7 @@ class ReCaptchaResponse {
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
{
if ($privkey == null || $privkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>");
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
}
if ($remoteip == null || $remoteip == '') {
@ -169,7 +169,7 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
return $recaptcha_response;
}
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/verify",
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
array (
'privatekey' => $privkey,
'remoteip' => $remoteip,
@ -200,7 +200,7 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
* @param string $appname The name of your application
*/
function recaptcha_get_signup_url ($domain = null, $appname = null) {
return "http://recaptcha.net/api/getkey?" . _recaptcha_qsencode (array ('domain' => $domain, 'app' => $appname));
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
}
function _recaptcha_aes_pad($val) {
@ -230,14 +230,14 @@ function _recaptcha_mailhide_urlbase64 ($x) {
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
"you can do so at <a href='http://mailhide.recaptcha.net/apikey'>http://mailhide.recaptcha.net/apikey</a>");
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
}
$ky = pack('H*', $privkey);
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
return "http://mailhide.recaptcha.net/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
}
/**
@ -262,7 +262,7 @@ function _recaptcha_mailhide_email_parts ($email) {
* Gets html to display an email address given a public an private key.
* to get a key, go to:
*
* http://mailhide.recaptcha.net/apikey
* http://www.google.com/recaptcha/mailhide/apikey
*/
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
$emailparts = _recaptcha_mailhide_email_parts ($email);

View File

@ -18,9 +18,33 @@ class Themelet {
public function build_thumb_html(Image $image, $query=null) {
global $config;
$h_view_link = make_link("post/view/{$image->id}", $query);
$h_tip = html_escape($image->get_tooltip());
$h_thumb_link = $image->get_thumb_link();
$tsize = get_thumbnail_size($image->width, $image->height);
// Removes the size tag if the file is an mp3
if($image->ext == 'mp3'){
$iitip = $image->get_tooltip();
$mp3tip = array("0x0");
$h_tip = str_replace($mp3tip, " ", $iitip);
// Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size)
$justincase = array(" //", "// ", " //", "// ", " ");
if(strstr($h_tip, " ")){
$h_tip = html_escape(str_replace($justincase, "", $h_tip));
}else{
$h_tip = html_escape($h_tip);
}
}else{
$h_tip = html_escape($image->get_tooltip());
}
// If file is flash or svg then sets thumbnail to max size.
if($image->ext == 'swf' || $image->ext == 'svg'){
$tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); }
else{
$tsize = get_thumbnail_size($image->width, $image->height); }
return "<a href='$h_view_link'><img title='$h_tip' alt='$h_tip' ".
"width='{$tsize[0]}' height='{$tsize[1]}' src='$h_thumb_link' /></a>";
}

View File

@ -31,9 +31,33 @@ class Themelet {
global $config;
$i_id = int_escape($image->id);
$h_view_link = make_link("post/view/$i_id", $query);
$h_tip = html_escape($image->get_tooltip());
$h_thumb_link = $image->get_thumb_link();
$tsize = get_thumbnail_size($image->width, $image->height);
// Removes the size tag if the file is an mp3
if($image->ext == 'mp3'){
$iitip = $image->get_tooltip();
$mp3tip = array("0x0");
$h_tip = str_replace($mp3tip, " ", $iitip);
// Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size)
$justincase = array(" //", "// ", " //", "// ", " ");
if(strstr($h_tip, " ")){
$h_tip = html_escape(str_replace($justincase, "", $h_tip));
}else{
$h_tip = html_escape($h_tip);
}
}else{
$h_tip = html_escape($image->get_tooltip());
}
// If file is flash or svg then sets thumbnail to max size.
if($image->ext == 'swf' || $image->ext == 'svg'){
$tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); }
else{
$tsize = get_thumbnail_size($image->width, $image->height); }
return "
<!-- cancel border -->
<div class='thumbblock'>

View File

@ -31,9 +31,33 @@ class Themelet {
global $config;
$i_id = int_escape($image->id);
$h_view_link = make_link("post/view/$i_id", $query);
$h_tip = html_escape($image->get_tooltip());
$h_thumb_link = $image->get_thumb_link();
$tsize = get_thumbnail_size($image->width, $image->height);
// Removes the size tag if the file is an mp3
if($image->ext == 'mp3'){
$iitip = $image->get_tooltip();
$mp3tip = array("0x0");
$h_tip = str_replace($mp3tip, " ", $iitip);
// Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size)
$justincase = array(" //", "// ", " //", "// ", " ");
if(strstr($h_tip, " ")){
$h_tip = html_escape(str_replace($justincase, "", $h_tip));
}else{
$h_tip = html_escape($h_tip);
}
}else{
$h_tip = html_escape($image->get_tooltip());
}
// If file is flash or svg then sets thumbnail to max size.
if($image->ext == 'swf' || $image->ext == 'svg'){
$tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); }
else{
$tsize = get_thumbnail_size($image->width, $image->height); }
return "
<div class='thumbblock'>
<div class='rr thumb'>

View File

@ -19,9 +19,33 @@ class Themelet {
public function build_thumb_html(Image $image, $query=null) {
global $config;
$h_view_link = make_link("post/view/{$image->id}", $query);
$h_tip = html_escape($image->get_tooltip());
$h_thumb_link = $image->get_thumb_link();
$tsize = get_thumbnail_size($image->width, $image->height);
// Removes the size tag if the file is an mp3
if($image->ext == 'mp3'){
$iitip = $image->get_tooltip();
$mp3tip = array("0x0");
$h_tip = str_replace($mp3tip, " ", $iitip);
// Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size)
$justincase = array(" //", "// ", " //", "// ", " ");
if(strstr($h_tip, " ")){
$h_tip = html_escape(str_replace($justincase, "", $h_tip));
}else{
$h_tip = html_escape($h_tip);
}
}else{
$h_tip = html_escape($image->get_tooltip());
}
// If file is flash or svg then sets thumbnail to max size.
if($image->ext == 'swf' || $image->ext == 'svg'){
$tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); }
else{
$tsize = get_thumbnail_size($image->width, $image->height); }
return "<a class='thumb' href='$h_view_link'><img title='$h_tip' alt='$h_tip' ".
"width='{$tsize[0]}' height='{$tsize[1]}' src='$h_thumb_link' /></a>";
}

View File

@ -31,9 +31,33 @@ class Themelet {
global $config;
$i_id = int_escape($image->id);
$h_view_link = make_link("post/view/$i_id", $query);
$h_tip = html_escape($image->get_tooltip());
$h_thumb_link = $image->get_thumb_link();
$tsize = get_thumbnail_size($image->width, $image->height);
// Removes the size tag if the file is an mp3
if($image->ext == 'mp3'){
$iitip = $image->get_tooltip();
$mp3tip = array("0x0");
$h_tip = str_replace($mp3tip, " ", $iitip);
// Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size)
$justincase = array(" //", "// ", " //", "// ", " ");
if(strstr($h_tip, " ")){
$h_tip = html_escape(str_replace($justincase, "", $h_tip));
}else{
$h_tip = html_escape($h_tip);
}
}else{
$h_tip = html_escape($image->get_tooltip());
}
// If file is flash or svg then sets thumbnail to max size.
if($image->ext == 'swf' || $image->ext == 'svg'){
$tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); }
else{
$tsize = get_thumbnail_size($image->width, $image->height); }
return "
<div class='thumbblock'>

View File

@ -29,9 +29,33 @@ class Themelet {
global $config;
$i_id = int_escape($image->id);
$h_view_link = make_link("post/view/$i_id", $query);
$h_tip = html_escape($image->get_tooltip());
$h_thumb_link = $image->get_thumb_link();
$tsize = get_thumbnail_size($image->width, $image->height);
// Removes the size tag if the file is an mp3
if($image->ext == 'mp3'){
$iitip = $image->get_tooltip();
$mp3tip = array("0x0");
$h_tip = str_replace($mp3tip, " ", $iitip);
// Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size)
$justincase = array(" //", "// ", " //", "// ", " ");
if(strstr($h_tip, " ")){
$h_tip = html_escape(str_replace($justincase, "", $h_tip));
}else{
$h_tip = html_escape($h_tip);
}
}else{
$h_tip = html_escape($image->get_tooltip());
}
// If file is flash or svg then sets thumbnail to max size.
if($image->ext == 'swf' || $image->ext == 'svg'){
$tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); }
else{
$tsize = get_thumbnail_size($image->width, $image->height); }
return "<a class='thumb' href='$h_view_link'><img id='$i_id' title='$h_tip' alt='$h_tip' ".
"width='{$tsize[0]}' height='{$tsize[1]}' src='$h_thumb_link' /></a>";
}

View File

@ -31,10 +31,34 @@ class Themelet {
global $config;
$i_id = int_escape($image->id);
$h_view_link = make_link("post/view/$i_id", $query);
$h_tip = html_escape($image->get_tooltip());
$h_image_link = $image->get_image_link();
$h_thumb_link = $image->get_thumb_link();
$tsize = get_thumbnail_size($image->width, $image->height);
// Removes the size tag if the file is an mp3
if($image->ext == 'mp3'){
$iitip = $image->get_tooltip();
$mp3tip = array("0x0");
$h_tip = str_replace($mp3tip, " ", $iitip);
// Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size)
$justincase = array(" //", "// ", " //", "// ", " ");
if(strstr($h_tip, " ")){
$h_tip = html_escape(str_replace($justincase, "", $h_tip));
}else{
$h_tip = html_escape($h_tip);
}
}else{
$h_tip = html_escape($image->get_tooltip());
}
// If file is flash or svg then sets thumbnail to max size.
if($image->ext == 'swf' || $image->ext == 'svg'){
$tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); }
else{
$tsize = get_thumbnail_size($image->width, $image->height); }
return "
<div class='thumbblock'>
<div class='rr thumb'>