More linting. Explicitly declare these class variables, as well as comment out dead code.
This commit is contained in:
parent
6e4ae229ef
commit
780d5f8709
8 changed files with 69 additions and 64 deletions
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
class AjaxCall {
|
||||
|
||||
public $reqType;
|
||||
|
||||
function AjaxCall($log = null) {
|
||||
header('Content-type: application/json');
|
||||
session_start();
|
||||
|
@ -24,8 +27,10 @@
|
|||
$ys = ys($_SESSION['yLog']);
|
||||
|
||||
if ($ys->banned(ip())) { $this->sendBanned(); break; }
|
||||
if ($post = $ys->post($nickname, $message)) // To use $post somewheres later
|
||||
$this->sendUpdates();
|
||||
if ($post = $ys->post($nickname, $message)) {
|
||||
// To use $post somewheres later
|
||||
$this->sendUpdates();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'refresh':
|
||||
|
@ -138,7 +143,6 @@
|
|||
$send['error'] = false;
|
||||
|
||||
echo jsonEncode($send);
|
||||
|
||||
}
|
||||
|
||||
function unbanSelf() {
|
||||
|
@ -235,7 +239,7 @@
|
|||
}
|
||||
|
||||
function clearLog() {
|
||||
$log = $_POST['log'];
|
||||
//$log = $_POST['log'];
|
||||
$send = array();
|
||||
$ys = ys($_SESSION['yLog']);
|
||||
|
||||
|
@ -254,10 +258,10 @@
|
|||
function clearLogs() {
|
||||
global $prefs;
|
||||
|
||||
$log = $_POST['log'];
|
||||
//$log = $_POST['log'];
|
||||
$send = array();
|
||||
|
||||
$ys = ys($_SESSION['yLog']);
|
||||
//$ys = ys($_SESSION['yLog']);
|
||||
|
||||
switch(true) {
|
||||
case !loggedIn():
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
class FileStorage {
|
||||
|
||||
public $shoutLog, $path, $handle;
|
||||
|
||||
function FileStorage($path, $shoutLog = false) {
|
||||
$this->shoutLog = $shoutLog;
|
||||
$folder = 'logs';
|
||||
|
@ -56,7 +58,6 @@ class FileStorage {
|
|||
fseek($this->handle, 0);
|
||||
//return stream_get_contents($this->handle);
|
||||
return file_get_contents($this->path);
|
||||
|
||||
}
|
||||
|
||||
function write($contents) {
|
||||
|
@ -79,7 +80,5 @@ class FileStorage {
|
|||
$this->save($default, false);
|
||||
return $default;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -16,8 +16,8 @@
|
|||
}
|
||||
|
||||
function getVar($name) {
|
||||
if (isset($_POST[$name])) return $_POST[$name];
|
||||
if (isset($_GET[$name])) return $_GET[$name];
|
||||
if (isset($_POST[$name])) { return $_POST[$name]; }
|
||||
if (isset($_GET[$name])) { return $_GET[$name]; }
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
|||
}
|
||||
|
||||
function magic($s) {
|
||||
if (get_magic_quotes_gpc()) $s = stripslashes($s);
|
||||
if (get_magic_quotes_gpc()) { $s = stripslashes($s); }
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
@ -147,6 +147,5 @@
|
|||
return $_SESSION['yLoginHash'] == md5($prefs['password']);
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
|
@ -250,4 +250,3 @@ class YShout {
|
|||
}
|
||||
|
||||
|
||||
?>
|
|
@ -1,4 +1,4 @@
|
|||
/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
|
||||
/*jshint dojo:true, forin:false, nonew:true, undef:true, strict:false, browser:true, jquery:true */
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||
* Tagger - Advanced Tagging v2 *
|
||||
|
@ -27,7 +27,7 @@ var Tagger = {
|
|||
this.tag.suggest = null;
|
||||
this.tag.image_tags();
|
||||
|
||||
// reveal
|
||||
// reveal
|
||||
this.editor.container.style.display = "";
|
||||
|
||||
// dragging
|
||||
|
@ -41,7 +41,7 @@ var Tagger = {
|
|||
},
|
||||
|
||||
alert : function (type,text,timeout) {
|
||||
var id = "tagger_alert-"+type
|
||||
var id = "tagger_alert-"+type;
|
||||
var t_alert = byId(id);
|
||||
if (t_alert) {
|
||||
if(text === false) {
|
||||
|
@ -152,10 +152,10 @@ var Tagger = {
|
|||
},
|
||||
|
||||
ajax : function (url, callback) {
|
||||
var http = (new XMLHttpRequest || new ActiveXObject("Microsoft.XMLHTTP"));
|
||||
var http = (new XMLHttpRequest() || new ActiveXObject("Microsoft.XMLHTTP"));
|
||||
http.open("GET",url,true);
|
||||
http.onreadystatechange = function () {
|
||||
if(http.readyState == 4) callback(http);
|
||||
if(http.readyState == 4) { callback(http); }
|
||||
};
|
||||
http.send(null);
|
||||
}
|
||||
|
@ -164,22 +164,19 @@ var Tagger = {
|
|||
position : {
|
||||
set : function (x,y) {
|
||||
if (!x || !y) {
|
||||
with(this.parent.editor.container.style) {
|
||||
top = "25px";
|
||||
left = "";
|
||||
right = "25px";
|
||||
bottom = "";
|
||||
}
|
||||
this.parent.editor.container.style.top = "25px";
|
||||
this.parent.editor.container.style.left = "";
|
||||
this.parent.editor.container.style.right = "25px";
|
||||
this.parent.editor.container.style.bottom = "";
|
||||
|
||||
var xy = this.get();
|
||||
x = xy[0];
|
||||
y = xy[1];
|
||||
}
|
||||
with(this.parent.editor.container.style) {
|
||||
top = y+"px";
|
||||
left = x+"px";
|
||||
right = "";
|
||||
bottom = "";
|
||||
}
|
||||
this.parent.editor.container.style.top = y+"px";
|
||||
this.parent.editor.container.style.left = x+"px";
|
||||
this.parent.editor.container.style.right = "";
|
||||
this.parent.editor.container.style.bottom = "";
|
||||
},
|
||||
|
||||
get : function () {
|
||||
|
|
|
@ -11,10 +11,14 @@ class taggerTheme extends Themelet {
|
|||
// Initialization code
|
||||
$base_href = get_base_href();
|
||||
// TODO: AJAX test and fallback.
|
||||
|
||||
$page->add_html_header("<script src='$base_href/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>");
|
||||
$page->add_block(new Block(null,
|
||||
"<script type='text/javascript'>Tagger.initialize("
|
||||
.$event->get_image()->id.");</script>","main",1000));
|
||||
"<script type='text/javascript'>
|
||||
$( document ).ready(function() {
|
||||
Tagger.initialize(".$event->get_image()->id.");
|
||||
});
|
||||
</script>","main",1000));
|
||||
|
||||
// Tagger block
|
||||
$page->add_block( new Block(
|
||||
|
|
|
@ -11,7 +11,7 @@ class Themelet extends BaseThemelet {
|
|||
|
||||
private function gen_page_link($base_url, $query, $page, $name) {
|
||||
$link = make_link("$base_url/$page", $query);
|
||||
return "[<a href='$link'>$name</a>]";
|
||||
return "[<a href='$link'>{$name}</a>]";
|
||||
}
|
||||
|
||||
private function gen_page_link_block($base_url, $query, $page, $current_page, $name) {
|
||||
|
@ -25,16 +25,16 @@ class Themelet extends BaseThemelet {
|
|||
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
||||
$next = $current_page + 1;
|
||||
$prev = $current_page - 1;
|
||||
$rand = mt_rand(1, $total_pages);
|
||||
//$rand = mt_rand(1, $total_pages);
|
||||
|
||||
$at_start = ($current_page <= 1 || $total_pages <= 1);
|
||||
$at_end = ($current_page >= $total_pages);
|
||||
|
||||
$first_html = $at_start ? "First" : $this->gen_page_link($base_url, $query, 1, "First");
|
||||
//$first_html = $at_start ? "First" : $this->gen_page_link($base_url, $query, 1, "First");
|
||||
$prev_html = $at_start ? "Prev" : $this->gen_page_link($base_url, $query, $prev, "Prev");
|
||||
$random_html = $this->gen_page_link($base_url, $query, $rand, "Random");
|
||||
//$random_html = $this->gen_page_link($base_url, $query, $rand, "Random");
|
||||
$next_html = $at_end ? "Next" : $this->gen_page_link($base_url, $query, $next, "Next");
|
||||
$last_html = $at_end ? "Last" : $this->gen_page_link($base_url, $query, $total_pages, "Last");
|
||||
//$last_html = $at_end ? "Last" : $this->gen_page_link($base_url, $query, $total_pages, "Last");
|
||||
|
||||
$start = $current_page-5 > 1 ? $current_page-5 : 1;
|
||||
$end = $start+10 < $total_pages ? $start+10 : $total_pages;
|
||||
|
@ -47,7 +47,7 @@ class Themelet extends BaseThemelet {
|
|||
|
||||
//return "<p class='paginator'>$first_html | $prev_html | $random_html | $next_html | $last_html".
|
||||
// "<br><< $pages_html >></p>";
|
||||
return "<p class='paginator'>$prev_html $pages_html $next_html</p>";
|
||||
return "<p class='paginator'>{$prev_html} {$pages_html} {$next_html}</p>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,21 +16,21 @@ class Layout {
|
|||
$h = $block->header;
|
||||
$b = $block->body;
|
||||
$i = str_replace(' ', '_', $h) . $salt;
|
||||
$html = "<section id='$i'>";
|
||||
$html = "<section id='{$i}'>";
|
||||
if(!is_null($h)) {
|
||||
if($salt == "main") {
|
||||
$html .= "<div class='maintop navside tab shm-toggler' data-toggle-sel='#$i'>$h</div>";
|
||||
$html .= "<div class='maintop navside tab shm-toggler' data-toggle-sel='#{$i}'>{$h}</div>";
|
||||
} else {
|
||||
$html .= "<div class='navtop navside tab shm-toggler' data-toggle-sel='#$i'>$h</div>";
|
||||
$html .= "<div class='navtop navside tab shm-toggler' data-toggle-sel='#{$i}'>{$h}</div>";
|
||||
}
|
||||
}
|
||||
if(!is_null($b)) {
|
||||
if($salt =="main") {
|
||||
$html .= "<div class='blockbody'>$b</div>";
|
||||
$html .= "<div class='blockbody'>{$b}</div>";
|
||||
}
|
||||
else {
|
||||
$html .= "
|
||||
<div class='navside tab'>$b</div>
|
||||
<div class='navside tab'>{$b}</div>
|
||||
";
|
||||
}
|
||||
}
|
||||
|
@ -56,11 +56,11 @@ class Layout {
|
|||
|
||||
for($i=0; $i < $count_pages_matched; $i++) {
|
||||
if($url == $pages_matched[$i]) {
|
||||
$html = "<a class='tab-selected' href='$link'>$desc</a>";
|
||||
$html = "<a class='tab-selected' href='{$link}'>{$desc}</a>";
|
||||
}
|
||||
}
|
||||
|
||||
if(is_null($html)) {$html = "<a class='tab' href='$link'>$desc</a>";}
|
||||
if(is_null($html)) {$html = "<a class='tab' href='{$link}'>{$desc}</a>";}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
@ -79,12 +79,12 @@ class Layout {
|
|||
$header_html = "";
|
||||
ksort($page->html_headers);
|
||||
foreach($page->html_headers as $line) {
|
||||
$header_html .= "\t\t$line\n";
|
||||
$header_html .= "\t\t{$line}\n";
|
||||
}
|
||||
|
||||
$menu = "<div class='menu'>
|
||||
<script type='text/javascript' src='$data_href/themes/$theme_name/wz_tooltip.js'></script>
|
||||
<a href='".make_link()."' onmouseover='Tip('Home', BGCOLOR, '#C3D2E0', FADEIN, 100)' onmouseout='UnTip()'><img src='$data_href/favicon.ico' style='position: relative; top: 3px;'></a>
|
||||
<script type='text/javascript' src='{$data_href}/themes/{$theme_name}/wz_tooltip.js'></script>
|
||||
<a href='".make_link()."' onmouseover='Tip('Home', BGCOLOR, '#C3D2E0', FADEIN, 100)' onmouseout='UnTip()'><img src='{$data_href}/favicon.ico' style='position: relative; top: 3px;'></a>
|
||||
<b>{$site_name}</b> ";
|
||||
|
||||
// Custom links: These appear on the menu.
|
||||
|
@ -105,7 +105,7 @@ class Layout {
|
|||
$custom_links .= $this->navlinks(make_link('wiki/rules'), "Rules", array("wiki/rules"));
|
||||
$custom_links .= $this->navlinks(make_link('wiki'), "Wiki", array("wiki"));
|
||||
}
|
||||
$menu .= "$custom_links</div>";
|
||||
$menu .= "{$custom_links}</div>";
|
||||
|
||||
$left_block_html = "";
|
||||
$main_block_html = "";
|
||||
|
@ -134,11 +134,9 @@ class Layout {
|
|||
|
||||
$custom_sublinks = "<div class='sbar'>";
|
||||
// hack
|
||||
global $user;
|
||||
$username = url_escape($user->name);
|
||||
// hack
|
||||
$qp = explode("/", ltrim(@$_GET["q"], "/"));
|
||||
$hw = class_exists("Wiki");
|
||||
$cs = "";
|
||||
|
||||
// php sucks
|
||||
|
@ -153,12 +151,14 @@ class Layout {
|
|||
# the subnav links aren't shown, but it would
|
||||
# be nice to be correct
|
||||
case "post":
|
||||
if(class_exists("NumericScore")){ $cs .= "<b>Popular by </b><a href='".make_link('popular_by_day')."'>Day</a><b>/</b><a href='".make_link('popular_by_month')."'>Month</a><b>/</b><a href='".make_link('popular_by_year')."'>Year</a> ";}
|
||||
if(class_exists("NumericScore")){
|
||||
$cs .= "<b>Popular by </b><a href='".make_link('popular_by_day')."'>Day</a><b>/</b><a href='".make_link('popular_by_month')."'>Month</a><b>/</b><a href='".make_link('popular_by_year')."'>Year</a> ";
|
||||
}
|
||||
$cs .= "<a class='tab' href='".make_link('post/list')."'>All</a>";
|
||||
if(class_exists("Favorites")){ $cs .= "<a class='tab' href='".make_link("post/list/favorited_by=$username/1")."'>My Favorites</a>";}
|
||||
if(class_exists("Favorites")){ $cs .= "<a class='tab' href='".make_link("post/list/favorited_by={$username}/1")."'>My Favorites</a>";}
|
||||
if(class_exists("RSS_Images")){ $cs .= "<a class='tab' href='".make_link('rss/images')."'>Feed</a>";}
|
||||
if(class_exists("Random_Image")){ $cs .= "<a class='tab' href='".make_link("random_image/view")."'>Random Image</a>";}
|
||||
if($hw){ $cs .= "<a class='tab' href='".make_link("wiki/posts")."'>Help</a>";
|
||||
if(class_exists("Wiki")){ $cs .= "<a class='tab' href='".make_link("wiki/posts")."'>Help</a>";
|
||||
}else{ $cs .= "<a class='tab' href='".make_link("ext_doc/index")."'>Help</a>";}
|
||||
break;
|
||||
case "comment":
|
||||
|
@ -187,7 +187,7 @@ class Layout {
|
|||
$cs .= "<a class='tab' href='".make_link("ext_doc/tag_edit")."'>Help</a>";
|
||||
break;
|
||||
case "upload":
|
||||
if($hw) $cs .= "<a class='tab' href='".make_link("wiki/upload_guidelines")."'>Guidelines</a>";
|
||||
if(class_exists("Wiki")) { $cs .= "<a class='tab' href='".make_link("wiki/upload_guidelines")."'>Guidelines</a>"; }
|
||||
break;
|
||||
case "random":
|
||||
$cs .= "<a class='tab' href='".make_link('random/view')."'>Shuffle</a>";
|
||||
|
@ -197,25 +197,28 @@ class Layout {
|
|||
$cs .= "<a class='tab' href='".make_link('featured/download')."'>Download</a>";
|
||||
break;
|
||||
}
|
||||
if($cs == "") {$custom_sublinks = "";} else {
|
||||
$custom_sublinks .= "$cs</div>";}
|
||||
|
||||
if($cs == "") {
|
||||
$custom_sublinks = "";
|
||||
} else {
|
||||
$custom_sublinks .= "$cs</div>";
|
||||
}
|
||||
|
||||
$debug = get_debug_info();
|
||||
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='mailto:{$contact_link}'>Contact</a>";
|
||||
//$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
|
||||
|
||||
/*$wrapper = "";
|
||||
if(strlen($page->heading) > 100) {
|
||||
$wrapper = ' style="height: 3em; overflow: auto;"';
|
||||
}*/
|
||||
if($page->left_enabled==false) {
|
||||
if($page->left_enabled == false) {
|
||||
$left_block_html = "";
|
||||
$main_block_html = "<article id='body_noleft'>$main_block_html</article>";
|
||||
$main_block_html = "<article id='body_noleft'>{$main_block_html}</article>";
|
||||
} else {
|
||||
$left_block_html = "<nav>$left_block_html</nav>";
|
||||
$main_block_html = "<article>$main_block_html</article>";
|
||||
$left_block_html = "<nav>{$left_block_html}</nav>";
|
||||
$main_block_html = "<article>{$main_block_html}</article>";
|
||||
}
|
||||
|
||||
$flash = get_prefixed_cookie("flash_message");
|
||||
|
|
Reference in a new issue