remove broken / non-gpl extensions
git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.2@731 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
2a990735a0
commit
a5f7b400f0
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Name: Autocomplete
|
||||
* Author: Shish <webmaster@shishnet.org>
|
||||
* Link: http://trac.shishnet.org/shimmie2/
|
||||
* License: GPLv2
|
||||
* Description: Auto-complete for search and upload tags
|
||||
*/
|
||||
|
||||
class AutoComplete extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index" || $event->page_name == "view")) {
|
||||
$event->page->add_header("<script>autocomplete_url='".html_escape(make_link("autocomplete"))."';</script>");
|
||||
}
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "autocomplete")) {
|
||||
$event->page->set_mode("data");
|
||||
$event->page->set_type("text/plain");
|
||||
$event->page->set_data($this->get_completions($event->get_arg(0)));
|
||||
}
|
||||
}
|
||||
|
||||
private function get_completions($start) {
|
||||
global $database;
|
||||
$tags = $database->db->GetCol("SELECT tag,count FROM tags WHERE tag LIKE ? ORDER BY count DESC", array($start.'%'));
|
||||
return implode("\n", $tags);
|
||||
}
|
||||
}
|
||||
add_event_listener(new AutoComplete());
|
||||
?>
|
@ -1,98 +0,0 @@
|
||||
|
||||
// addEvent(window, "load", function() {
|
||||
// initAjax("searchBox", "search_completions");
|
||||
// initAjax("tagBox", "upload_completions");
|
||||
// });
|
||||
|
||||
function endWord(sentance) {
|
||||
words = sentance.split(" ");
|
||||
return words[words.length-1];
|
||||
}
|
||||
|
||||
var resultCache = new Array();
|
||||
resultCache[""] = new Array();
|
||||
|
||||
function complete(boxname, text) {
|
||||
box = byId(boxname);
|
||||
words = box.value.split(" ");
|
||||
box.value = "";
|
||||
for(n=0; n<words.length-1; n++) {
|
||||
box.value += words[n]+" ";
|
||||
}
|
||||
box.value += text+" ";
|
||||
box.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
function fillCompletionZone(boxname, areaname, results) {
|
||||
byId(areaname).innerHTML = "";
|
||||
for(i=0; i<results.length; i++) {
|
||||
byId(areaname).innerHTML += "<br><a href=\"#\" onclick=\"complete('"+boxname+"', '"+results[i]+"');\">"+results[i]+"</a>";
|
||||
}
|
||||
}
|
||||
|
||||
function initAjax(boxname, areaname) {
|
||||
var box = byId(boxname);
|
||||
if(!box) return;
|
||||
|
||||
addEvent(
|
||||
box,
|
||||
"keyup",
|
||||
function f() {
|
||||
starter = endWord(box.value);
|
||||
|
||||
if(resultCache[starter]) {
|
||||
fillCompletionZone(boxname, areaname, resultCache[starter]);
|
||||
}
|
||||
else {
|
||||
ajaxRequest(
|
||||
"ajax.php?start="+starter,
|
||||
function g(text) {
|
||||
resultCache[starter] = text.split("\n");
|
||||
fillCompletionZone(boxname, areaname, resultCache[starter]);
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//completion_cache = new array();
|
||||
|
||||
input = byId("search_input");
|
||||
output = byId("search_completions");
|
||||
|
||||
function get_cached_completions(start) {
|
||||
// if(completion_cache[start]) {
|
||||
// return completion_cache[start];
|
||||
// }
|
||||
// else {
|
||||
return null;
|
||||
// }
|
||||
}
|
||||
function get_completions(start) {
|
||||
cached = get_cached_completions(start);
|
||||
if(cached) {
|
||||
output.innerHTML = cached;
|
||||
}
|
||||
else {
|
||||
ajaxRequest(autocomplete_url+"/"+start, function(data) {set_completions(start, data);});
|
||||
}
|
||||
}
|
||||
function set_completions(start, data) {
|
||||
// completion_cache[start] = data;
|
||||
output.innerHTML = data;
|
||||
}
|
||||
|
||||
if(input) {
|
||||
input.onkeyup = function() {
|
||||
if(input.value.length < 3) {
|
||||
output.innerHTML = "";
|
||||
}
|
||||
else {
|
||||
get_completions(input.value);
|
||||
}
|
||||
};
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Name: Flash File Handler
|
||||
* Author: Shish <webmaster@shishnet.org>
|
||||
* Description: Handle Flash files
|
||||
*/
|
||||
|
||||
class FlashFileHandler extends Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("handle_flash", "FlashFileHandlerTheme");
|
||||
|
||||
if(is_a($event, 'DataUploadEvent') && $event->type == "swf" && $this->check_contents($event->tmpname)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
if(!copy($event->tmpname, "images/$ha/$hash")) {
|
||||
$event->veto("Flash Handler failed to move file from uploads to archive");
|
||||
return;
|
||||
}
|
||||
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
|
||||
$image = $this->create_image_from_data("images/$ha/$hash", $event->metadata);
|
||||
if(is_null($image)) {
|
||||
$event->veto("Flash Handler failed to create image object from data");
|
||||
return;
|
||||
}
|
||||
send_event(new ImageAdditionEvent($event->user, $image));
|
||||
}
|
||||
|
||||
if(is_a($event, 'ThumbnailGenerationEvent') && $event->type == "swf") {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
// FIXME: scale image, as not all boards use 192x192
|
||||
copy("ext/handle_flash/thumb.jpg", "thumbs/$ha/$hash");
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent') && $event->image->ext == "swf") {
|
||||
$this->theme->display_image($event->page, $event->image);
|
||||
}
|
||||
}
|
||||
|
||||
private function create_image_from_data($filename, $metadata) {
|
||||
global $config;
|
||||
|
||||
$image = new Image();
|
||||
|
||||
// FIXME: need more flash format specs :|
|
||||
$image->width = 0;
|
||||
$image->height = 0;
|
||||
|
||||
$image->filesize = $metadata['size'];
|
||||
$image->hash = $metadata['hash'];
|
||||
$image->filename = $metadata['filename'];
|
||||
$image->ext = $metadata['extension'];
|
||||
$image->tag_array = tag_explode($metadata['tags']);
|
||||
$image->source = $metadata['source'];
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
private function check_contents($file) {
|
||||
// FIXME: flash magic header?
|
||||
return (file_exists($file));
|
||||
}
|
||||
}
|
||||
add_event_listener(new FlashFileHandler());
|
||||
?>
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
class FlashFileHandlerTheme extends Themelet {
|
||||
public function display_image($page, $image) {
|
||||
$ilink = $image->get_image_link();
|
||||
// FIXME: object and embed have "height" and "width"
|
||||
$html = "
|
||||
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
|
||||
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0'>
|
||||
<param name='movie' value='$ilink'/>
|
||||
<param name='quality' value='high' />
|
||||
<embed src='$ilink' quality='high'
|
||||
pluginspage='http://www.macromedia.com/go/getflashplayer'
|
||||
type='application/x-shockwave-flash'></embed>
|
||||
</object>";
|
||||
$page->add_block(new Block("Image", $html, "main", 0));
|
||||
}
|
||||
}
|
||||
?>
|
Binary file not shown.
Before Width: | Height: | Size: 7.1 KiB |
@ -1,67 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Name: MP3 File Handler
|
||||
* Author: Shish <webmaster@shishnet.org>
|
||||
* Description: Handle MP3 files
|
||||
*/
|
||||
|
||||
class MP3FileHandler extends Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("handle_mp3", "MP3FileHandlerTheme");
|
||||
|
||||
if(is_a($event, 'DataUploadEvent') && $event->type == "mp3" && $this->check_contents($event->tmpname)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
if(!copy($event->tmpname, "images/$ha/$hash")) {
|
||||
$event->veto("MP3 Handler failed to move file from uploads to archive");
|
||||
return;
|
||||
}
|
||||
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
|
||||
$image = $this->create_image_from_data("images/$ha/$hash", $event->metadata);
|
||||
if(is_null($image)) {
|
||||
$event->veto("MP3 Handler failed to create image object from data");
|
||||
return;
|
||||
}
|
||||
send_event(new ImageAdditionEvent($event->user, $image));
|
||||
}
|
||||
|
||||
if(is_a($event, 'ThumbnailGenerationEvent') && $event->type == "mp3") {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
// FIXME: scale image, as not all boards use 192x192
|
||||
copy("ext/handle_mp3/thumb.jpg", "thumbs/$ha/$hash");
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent') && $event->image->ext == "mp3") {
|
||||
$this->theme->display_image($event->page, $event->image);
|
||||
}
|
||||
}
|
||||
|
||||
private function create_image_from_data($filename, $metadata) {
|
||||
global $config;
|
||||
|
||||
$image = new Image();
|
||||
|
||||
// FIXME: need more flash format specs :|
|
||||
$image->width = 0;
|
||||
$image->height = 0;
|
||||
|
||||
$image->filesize = $metadata['size'];
|
||||
$image->hash = $metadata['hash'];
|
||||
$image->filename = $metadata['filename'];
|
||||
$image->ext = $metadata['extension'];
|
||||
$image->tag_array = tag_explode($metadata['tags']);
|
||||
$image->source = $metadata['source'];
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
private function check_contents($file) {
|
||||
// FIXME: mp3 magic header?
|
||||
return (file_exists($file));
|
||||
}
|
||||
}
|
||||
add_event_listener(new MP3FileHandler());
|
||||
?>
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
class MP3FileHandlerTheme extends Themelet {
|
||||
public function display_image($page, $image) {
|
||||
$data_href = get_base_href();
|
||||
$ilink = $image->get_image_link();
|
||||
$html = "
|
||||
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
|
||||
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0'
|
||||
width='400' height='170'>
|
||||
<param name='movie' value='$data_href/ext/handle_mp3/xspf_player.swf?song_url=$ilink'/>
|
||||
<param name='quality' value='high' />
|
||||
<embed src='$data_href/ext/handle_mp3/xspf_player.swf?song_url=$ilink' quality='high'
|
||||
pluginspage='http://www.macromedia.com/go/getflashplayer'
|
||||
width='400' height='170'
|
||||
type='application/x-shockwave-flash'></embed>
|
||||
</object>
|
||||
<p><a href='$ilink'>Download</a>";
|
||||
$page->add_block(new Block("Music", $html, "main", 0));
|
||||
}
|
||||
}
|
||||
?>
|
Binary file not shown.
Before Width: | Height: | Size: 5.6 KiB |
@ -1,448 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2005, Fabricio Zuardi
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
stop();
|
||||
//autoplay=true
|
||||
//repeat_playlist = true;
|
||||
//playlist_size = 3;
|
||||
//player_title = "customizeable title test"
|
||||
//song_url = "http://downloads.betterpropaganda.com/music/Imperial_Teen-Ivanka_128.mp3";
|
||||
//playlist_url = "http://cchits.ning.com/recent/xspf/?xn_auth=no";
|
||||
//playlist_url = "http://hideout.com.br/shows/radio-test.xspf";
|
||||
//radio_mode = true;
|
||||
//song_title = "Imperial Teen - Ivanka";
|
||||
autoload=true;
|
||||
//info_button_text = "Add to Cart"
|
||||
//playlist_url = "http%3A%2F%2Fwebjay%2Eorg%2Fby%2Flucas%5Fgonze%2Flaconic%2Exspf"
|
||||
//playlist_url= "http://hideout.com.br/tests/hideout2325.xspf"
|
||||
//constants
|
||||
DEFAULT_PLAYLIST_URL = "http://hideout.com.br/shows/allshows.xspf";
|
||||
DEFAULT_WELCOME_MSG = "Hideout XSPF Music Player - by Fabricio Zuardi";
|
||||
LOADING_PLAYLIST_MSG = "Loading Playlist...";
|
||||
DEFAULT_LOADED_PLAYLIST_MSG = "- click to start"
|
||||
DEFAULT_INFOBUTTON_TXT = "Info"
|
||||
//playlists has priority over songs, if a playlist_url parameter is found the song_url is ignored
|
||||
//default playlist if none is passed through query string
|
||||
if(!playlist_url){
|
||||
if(!song_url){
|
||||
playlist_url = DEFAULT_PLAYLIST_URL;
|
||||
}else{
|
||||
single_music_playlist = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><playlist version=\"1\" xmlns = \"http://xspf.org/ns/0/\"><trackList>";
|
||||
single_music_playlist += "<track><location>"+song_url+"</location><annotation>"+song_title+"</annotation></track>"
|
||||
single_music_playlist += "</trackList></playlist>"
|
||||
}
|
||||
}
|
||||
info_mc._visible=false;
|
||||
if(!info_button_text){
|
||||
info_button_text = DEFAULT_INFOBUTTON_TXT;
|
||||
}
|
||||
info_mc.display_txt.text = info_button_text;
|
||||
|
||||
//variables initialization
|
||||
playlist_array = [];
|
||||
track_index = 0;
|
||||
playlist_mc.track_count = 0;
|
||||
pause_position = 0;
|
||||
volume_level = 100;
|
||||
playlist_xml = new XML();
|
||||
playlist_xml.ignoreWhite = true;
|
||||
playlist_xml.onLoad = playlistLoaded;
|
||||
mysound = new Sound(this);
|
||||
playlist_listener = new Object();
|
||||
playlist_list.addEventListener("change", playlist_listener)
|
||||
//play_btn.onPress = playTrack;
|
||||
//functions
|
||||
//xml parser
|
||||
function playlistLoaded (success){
|
||||
if(success){
|
||||
var root_node = this.firstChild;
|
||||
for(var node = root_node.firstChild; node != null; node = node.nextSibling){
|
||||
if(node.nodeName == "title"){
|
||||
playlist_title = node.firstChild.nodeValue;
|
||||
}
|
||||
if(node.nodeName == "trackList"){
|
||||
//tracks
|
||||
var tracks_array = [];
|
||||
for(var track_node = node.firstChild; track_node != null; track_node = track_node.nextSibling){
|
||||
var track_obj = new Object()
|
||||
//track attributes
|
||||
for(var track_child = track_node.firstChild; track_child != null; track_child = track_child.nextSibling){
|
||||
if(track_child.nodeName=="location"){
|
||||
track_obj.location = track_child.firstChild.nodeValue
|
||||
}
|
||||
if(track_child.nodeName=="image"){
|
||||
track_obj.image = track_child.firstChild.nodeValue
|
||||
}
|
||||
if(track_child.nodeName=="title"){
|
||||
track_obj.title = track_child.firstChild.nodeValue
|
||||
}
|
||||
if(track_child.nodeName=="creator"){
|
||||
track_obj.creator = track_child.firstChild.nodeValue
|
||||
}
|
||||
if(track_child.nodeName=="annotation"){
|
||||
track_obj.annotation = track_child.firstChild.nodeValue
|
||||
}
|
||||
if(track_child.nodeName=="info"){
|
||||
track_obj.info = track_child.firstChild.nodeValue
|
||||
}
|
||||
}
|
||||
track_obj.label = (tracks_array.length+1) +". ";
|
||||
if(track_obj.title) {
|
||||
if(track_obj.creator) {
|
||||
track_obj.label += track_obj.creator+' - ';
|
||||
}
|
||||
track_obj.label += track_obj.title;
|
||||
} else {
|
||||
track_obj.label += track_obj.annotation;
|
||||
}
|
||||
tracks_array.push(track_obj)
|
||||
addTrack(track_obj.label);
|
||||
}
|
||||
}
|
||||
}
|
||||
playlist_array = tracks_array;
|
||||
if(!playlist_size) playlist_size = playlist_array.length;
|
||||
playlist_mc.tracks_mc["track_"+track_index+"_mc"].bg_mc.gotoAndStop(2)
|
||||
if(autoplay){
|
||||
loadTrack()
|
||||
}else{
|
||||
start_btn_mc.start_btn.onPress = loadTrack;
|
||||
track_display_mc.display_txt.text = playlist_title+" "+DEFAULT_LOADED_PLAYLIST_MSG;
|
||||
if(track_display_mc.display_txt._width>track_display_mc.mask_mc._width){
|
||||
track_display_mc.onEnterFrame = scrollTitle;
|
||||
}else{
|
||||
track_display_mc.onEnterFrame = null;
|
||||
track_display_mc.display_txt._x = 0;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
annotation_txt.text = "Error opening "+playlist_url;
|
||||
}
|
||||
}
|
||||
|
||||
playlist_listener.change = function(eventObject){
|
||||
annotation_txt.text = playlist_list.selectedItem.annotation;
|
||||
location_txt.text = playlist_list.selectedItem.location;
|
||||
}
|
||||
|
||||
function loadTrack(){
|
||||
|
||||
//Radio Mode feature by nosferathoo, more info in: https://sourceforge.net/tracker/index.php?func=detail&aid=1341940&group_id=128363&atid=711474
|
||||
if (radio_mode && track_index==playlist_size-1) {
|
||||
playlist_url=playlist_array[track_index].location;
|
||||
for (i=0;i<playlist_mc.track_count;++i) {
|
||||
removeMovieClip(playlist_mc.tracks_mc["track_"+i+"_mc"]);
|
||||
}
|
||||
playlist_mc.track_count=0;
|
||||
playlist_size=0;
|
||||
track_index=0;
|
||||
autoload=true;
|
||||
autoplay=true;
|
||||
loadPlaylist();
|
||||
return(0);
|
||||
}
|
||||
|
||||
start_btn_mc.start_btn._visible = false;
|
||||
track_display_mc.display_txt.text = playlist_array[track_index].label;
|
||||
if(track_display_mc.display_txt._width>track_display_mc.mask_mc._width){
|
||||
track_display_mc.onEnterFrame = scrollTitle;
|
||||
}else{
|
||||
track_display_mc.onEnterFrame = null;
|
||||
track_display_mc.display_txt._x = 0;
|
||||
}
|
||||
cover_mc.content_mc["photo"+last_track_index].removeMovieClip();
|
||||
mysound.loadSound(playlist_array[track_index].location,true);
|
||||
play_mc.gotoAndStop(2)
|
||||
|
||||
//image from playlist
|
||||
if(playlist_array[track_index].image!=undefined){
|
||||
cover_mc.content_mc.createEmptyMovieClip("photo"+track_index,track_index)
|
||||
cover_mc.content_mc["photo"+track_index].loadMovie(playlist_array[track_index].image)
|
||||
}else{
|
||||
}
|
||||
//info button
|
||||
if(playlist_array[track_index].info!=undefined){
|
||||
info_mc._visible = true;
|
||||
info_mc.info_btn.onPress = function(){
|
||||
getURL(playlist_array[track_index].info,"_blank")
|
||||
}
|
||||
}else{
|
||||
info_mc._visible = false;
|
||||
}
|
||||
_root.onEnterFrame=function(){
|
||||
//HACK doesnt need to set the volume at every enterframe
|
||||
mysound.setVolume(this.volume_level)
|
||||
var sound_load_percent = (mysound.getBytesLoaded()/mysound.getBytesTotal())*100
|
||||
track_display_mc.loader_mc.load_bar_mc._xscale = sound_load_percent;
|
||||
var image_load_percent = (cover_mc.content_mc["photo"+track_index].getBytesLoaded()/cover_mc.content_mc["photo"+track_index].getBytesTotal())*100
|
||||
cover_mc.load_bar_mc._xscale = image_load_percent;
|
||||
if((cover_mc.content_mc["photo"+track_index].getBytesLoaded()>4)&&(image_load_percent==100)){
|
||||
//image loaded
|
||||
//make image fit
|
||||
cover_mc.content_mc["photo"+track_index]._width = cover_mc.load_bar_mc._width
|
||||
cover_mc.content_mc["photo"+track_index]._height = cover_mc.load_bar_mc._height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stop_btn.onRelease = stopTrack;
|
||||
play_mc.play_btn.onRelease = playTrack
|
||||
next_btn.onRelease = nextTrack
|
||||
prev_btn.onRelease = prevTrack
|
||||
mysound.onSoundComplete = nextTrack;
|
||||
volume_mc.volume_btn.onPress = volumeChange;
|
||||
volume_mc.volume_btn.onRelease = volume_mc.volume_btn.onReleaseOutside = function(){
|
||||
this._parent.onMouseMove = this._parent.onMouseDown = null;
|
||||
}
|
||||
|
||||
function volumeChange(){
|
||||
this._parent.onMouseMove = this._parent.onMouseDown = function(){
|
||||
var percent = (this._xmouse/this._width)*100
|
||||
if(percent>100)percent=100;
|
||||
if(percent<0)percent=0;
|
||||
this.volume_bar_mc._xscale = percent
|
||||
this._parent.volume_level = percent;
|
||||
mysound.setVolume(percent)
|
||||
}
|
||||
}
|
||||
|
||||
function stopTrack() {
|
||||
mysound.stop();
|
||||
play_mc.gotoAndStop(1)
|
||||
mysound.stop();
|
||||
mysound.start();
|
||||
mysound.stop();
|
||||
_root.pause_position = 0;
|
||||
|
||||
};
|
||||
function playTrack() {
|
||||
if(play_mc._currentframe==1){ //play
|
||||
seekTrack(_root.pause_position)
|
||||
play_mc.gotoAndStop(2)
|
||||
}else if(play_mc._currentframe==2){
|
||||
_root.pause_position = mysound.position;
|
||||
mysound.stop();
|
||||
play_mc.gotoAndStop(1)
|
||||
}
|
||||
|
||||
};
|
||||
function seekTrack(p_offset:Number){
|
||||
mysound.stop()
|
||||
mysound.start(int((p_offset)/1000),1)
|
||||
}
|
||||
function nextTrack(){
|
||||
if(track_index<playlist_size-1){
|
||||
last_track_index = track_index;
|
||||
track_index ++;
|
||||
loadTrack();
|
||||
}else{
|
||||
if(repeat_playlist){
|
||||
last_track_index = track_index;
|
||||
track_index = 0;
|
||||
loadTrack()
|
||||
}
|
||||
}
|
||||
playlist_mc.tracks_mc["track_"+last_track_index+"_mc"].bg_mc.gotoAndStop(1)
|
||||
playlist_mc.tracks_mc["track_"+track_index+"_mc"].bg_mc.gotoAndStop(2)
|
||||
}
|
||||
|
||||
function prevTrack(){
|
||||
if(track_index>0){
|
||||
last_track_index = track_index;
|
||||
track_index --;
|
||||
loadTrack();
|
||||
}
|
||||
playlist_mc.tracks_mc["track_"+last_track_index+"_mc"].bg_mc.gotoAndStop(1)
|
||||
playlist_mc.tracks_mc["track_"+track_index+"_mc"].bg_mc.gotoAndStop(2)
|
||||
}
|
||||
|
||||
function scrollTitle(){
|
||||
track_display_mc.display_txt._x -= 5;
|
||||
if (track_display_mc.display_txt._x+track_display_mc.display_txt._width<0){
|
||||
track_display_mc.display_txt._x = track_display_mc.mask_mc._width;
|
||||
}
|
||||
}
|
||||
|
||||
function resizeUI(){
|
||||
bg_mc._width = Stage.width;
|
||||
track_display_mc.loader_mc._width = Stage.width - track_display_mc._x - 2;
|
||||
track_display_mc.mask_mc._width = track_display_mc.loader_mc._width-3;
|
||||
if(track_display_mc.display_txt._width>track_display_mc.mask_mc._width){
|
||||
track_display_mc.onEnterFrame = scrollTitle;
|
||||
}else{
|
||||
track_display_mc.onEnterFrame = null;
|
||||
track_display_mc.display_txt._x = 0;
|
||||
}
|
||||
volume_mc._x = Stage.width - 22;
|
||||
start_btn_mc._xscale = Stage.width;
|
||||
//playlist area tinnier that the album cover
|
||||
if(Stage.width<2.5*cover_mc._width){
|
||||
//
|
||||
if (Stage.height>2.5*cover_mc._height){
|
||||
//send album cover to bottom
|
||||
cover_mc._y = Stage.height - cover_mc._height -2- info_mc._height -2;
|
||||
info_mc._y = Stage.height - info_mc._height -2;
|
||||
var covervisible =1;
|
||||
}else{
|
||||
var covervisible =0;
|
||||
//hide album cover
|
||||
cover_mc._y = Stage.height;
|
||||
}
|
||||
//send playlist to left
|
||||
playlist_mc._x = cover_mc._x;
|
||||
scrollbar_mc.bg_mc._height = Stage.height - (19+(cover_mc._height+info_mc._height+4)*covervisible);
|
||||
playlist_mc.bg_mc._height = Stage.height - (19+(cover_mc._height+info_mc._height+4)*covervisible);
|
||||
playlist_mc.mask_mc._height = Stage.height - (23+(cover_mc._height+info_mc._height+4)*covervisible);
|
||||
}else{
|
||||
cover_mc._y = 17;
|
||||
info_mc._y = 153;
|
||||
playlist_mc._x = 138;
|
||||
scrollbar_mc.bg_mc._height = Stage.height -19;
|
||||
playlist_mc.bg_mc._height = Stage.height - 19;
|
||||
playlist_mc.mask_mc._height = Stage.height - 23;
|
||||
}
|
||||
scrollbar_mc._x = Stage.width - 12;
|
||||
playlist_mc.mask_mc._width = Stage.width - (playlist_mc._x + 19);
|
||||
playlist_mc.bg_mc._width = Stage.width - (playlist_mc._x + 14);
|
||||
}
|
||||
function addTrack(track_label){
|
||||
if(playlist_mc.track_count>0) {
|
||||
playlist_mc.tracks_mc.track_0_mc.duplicateMovieClip("track_"+playlist_mc.track_count+"_mc",playlist_mc.track_count);
|
||||
}
|
||||
playlist_mc.tracks_mc["track_"+playlist_mc.track_count+"_mc"]._y += playlist_mc.track_count*14;
|
||||
playlist_mc.tracks_mc["track_"+playlist_mc.track_count+"_mc"].display_txt.autoSize = "left";
|
||||
playlist_mc.tracks_mc["track_"+playlist_mc.track_count+"_mc"].display_txt.text = track_label;
|
||||
playlist_mc.tracks_mc["track_"+playlist_mc.track_count+"_mc"].bg_mc.index = playlist_mc.track_count;
|
||||
playlist_mc.tracks_mc["track_"+playlist_mc.track_count+"_mc"].bg_mc.select_btn.onPress = function(){
|
||||
last_track_index = track_index;
|
||||
playlist_mc.tracks_mc["track_"+track_index+"_mc"].bg_mc.gotoAndStop(1)
|
||||
track_index = this._parent.index;
|
||||
playlist_mc.tracks_mc["track_"+track_index+"_mc"].bg_mc.gotoAndStop(2)
|
||||
loadTrack();
|
||||
}
|
||||
playlist_mc.track_count ++;
|
||||
}
|
||||
//scroll
|
||||
|
||||
scrollbar_mc.up_btn.onPress = function(){
|
||||
this._parent.v = -1;
|
||||
this._parent.onEnterFrame = scrollTracks;
|
||||
}
|
||||
scrollbar_mc.down_btn.onPress = function(){
|
||||
this._parent.v = 1;
|
||||
this._parent.onEnterFrame = scrollTracks;
|
||||
}
|
||||
scrollbar_mc.up_btn.onRelease = scrollbar_mc.down_btn.onRelease = function(){
|
||||
this._parent.onEnterFrame = null;
|
||||
}
|
||||
scrollbar_mc.handler_mc.drag_btn.onPress = function(){
|
||||
var scroll_top_limit = 19;
|
||||
var scroll_bottom_limit = scrollbar_mc.bg_mc._height - scrollbar_mc.handler_mc._height - 2;
|
||||
this._parent.startDrag(false,this._parent._x,scroll_top_limit,this._parent._x,scroll_bottom_limit)
|
||||
this._parent.isdragging = true;
|
||||
this._parent.onEnterFrame = scrollTracks;
|
||||
}
|
||||
scrollbar_mc.handler_mc.drag_btn.onRelease = scrollbar_mc.handler_mc.drag_btn.onReleaseOutside = function(){
|
||||
stopDrag()
|
||||
this._parent.isdragging = false;
|
||||
this._parent.onEnterFrame = null;
|
||||
}
|
||||
function scrollTracks(){
|
||||
var scroll_top_limit = 19;
|
||||
var scroll_bottom_limit = scrollbar_mc.bg_mc._height - scrollbar_mc.handler_mc._height - 2;
|
||||
var list_bottom_limit = 1;
|
||||
var list_top_limit = (1-Math.round(playlist_mc.tracks_mc._height))+Math.floor(playlist_mc.mask_mc._height/14)*14
|
||||
if(playlist_mc.tracks_mc._height>playlist_mc.mask_mc._height){
|
||||
if(scrollbar_mc.handler_mc.isdragging){
|
||||
var percent = (scrollbar_mc.handler_mc._y-scroll_top_limit)/(scroll_bottom_limit-scroll_top_limit)
|
||||
playlist_mc.tracks_mc._y = (list_top_limit-list_bottom_limit)*percent+list_bottom_limit;
|
||||
}else{
|
||||
if(scrollbar_mc.v==-1){
|
||||
if(playlist_mc.tracks_mc._y+14<list_bottom_limit){
|
||||
playlist_mc.tracks_mc._y += 14;
|
||||
}else{
|
||||
playlist_mc.tracks_mc._y = list_bottom_limit;
|
||||
}
|
||||
var percent = (playlist_mc.tracks_mc._y-1)/(list_top_limit-1)
|
||||
scrollbar_mc.handler_mc._y = percent*(scroll_bottom_limit - scroll_top_limit)+scroll_top_limit;
|
||||
}else if(scrollbar_mc.v==1){
|
||||
if(playlist_mc.tracks_mc._y-14>list_top_limit){
|
||||
playlist_mc.tracks_mc._y -= 14;
|
||||
}else{
|
||||
playlist_mc.tracks_mc._y = list_top_limit;
|
||||
}
|
||||
var percent = (playlist_mc.tracks_mc._y-1)/(list_top_limit-1)
|
||||
scrollbar_mc.handler_mc._y = percent*(scroll_bottom_limit - scroll_top_limit)+scroll_top_limit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function loadPlaylist(){
|
||||
track_display_mc.display_txt.text = LOADING_PLAYLIST_MSG;
|
||||
if(track_display_mc.display_txt._width>track_display_mc.mask_mc._width){
|
||||
track_display_mc.onEnterFrame = scrollTitle;
|
||||
}else{
|
||||
track_display_mc.onEnterFrame = null;
|
||||
track_display_mc.display_txt._x = 0;
|
||||
}
|
||||
|
||||
//playlist
|
||||
if(playlist_url){
|
||||
playlist_xml.load(unescape(playlist_url))
|
||||
}else{
|
||||
//single track
|
||||
playlist_xml.parseXML(single_music_playlist)
|
||||
playlist_xml.onLoad(true);
|
||||
}
|
||||
}
|
||||
|
||||
//first click - load playlist
|
||||
start_btn_mc.start_btn.onPress = function(){
|
||||
autoplay = true;
|
||||
loadPlaylist();
|
||||
}
|
||||
|
||||
|
||||
//main
|
||||
Stage.scaleMode = "noScale"
|
||||
Stage.align = "LT";
|
||||
this.onResize = resizeUI;
|
||||
Stage.addListener(this);
|
||||
if(!player_title) player_title = DEFAULT_WELCOME_MSG;
|
||||
track_display_mc.display_txt.autoSize = "left";
|
||||
track_display_mc.display_txt.text = player_title;
|
||||
if(track_display_mc.display_txt._width>track_display_mc.mask_mc._width){
|
||||
track_display_mc.onEnterFrame = scrollTitle;
|
||||
}else{
|
||||
track_display_mc.onEnterFrame = null;
|
||||
track_display_mc.display_txt._x = 0;
|
||||
}
|
||||
//start to play automatically if parameter autoplay is present
|
||||
if(autoplay){
|
||||
start_btn_mc.start_btn.onPress();
|
||||
} else if (autoload){
|
||||
loadPlaylist()
|
||||
}
|
||||
//customized menu
|
||||
var my_cm:ContextMenu = new ContextMenu();
|
||||
my_cm.customItems.push(new ContextMenuItem("Stop", stopTrack));
|
||||
my_cm.customItems.push(new ContextMenuItem("Play!", playTrack));
|
||||
my_cm.customItems.push(new ContextMenuItem("Next", nextTrack));
|
||||
my_cm.customItems.push(new ContextMenuItem("Previous", prevTrack));
|
||||
my_cm.customItems.push(new ContextMenuItem("Download this song", function(){getURL(playlist_array[track_index].location,"_blank")},true));
|
||||
my_cm.customItems.push(new ContextMenuItem("Add song to Webjay playlist", function(){getURL("http://webjay.org/poster?media="+escape(playlist_array[track_index].location),"_blank")}));
|
||||
my_cm.customItems.push(new ContextMenuItem("About Hideout", function(){getURL("http://www.hideout.com.br","_blank")},true));
|
||||
//my_cm.customItems.push(new ContextMenuItem("Crossfade", function(){}));
|
||||
//my_cm.customItems.push(new ContextMenuItem("Mando Diao - Paralyzed", function(){}));
|
||||
my_cm.hideBuiltInItems();
|
||||
this.menu = my_cm;
|
||||
resizeUI();
|
Binary file not shown.
Binary file not shown.
@ -1,10 +0,0 @@
|
||||
Copyright (c) 2005, Fabricio Zuardi
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Name: SVG File Handler
|
||||
* Author: Shish <webmaster@shishnet.org>
|
||||
* Description: Handle SVG files
|
||||
*/
|
||||
|
||||
class SVGFileHandler extends Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("handle_svg", "SVGFileHandlerTheme");
|
||||
|
||||
if(is_a($event, 'DataUploadEvent') && $event->type == "svg" && $this->check_contents($event->tmpname)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
if(!copy($event->tmpname, "images/$ha/$hash")) {
|
||||
$event->veto("SVG Handler failed to move file from uploads to archive");
|
||||
return;
|
||||
}
|
||||
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
|
||||
$image = $this->create_image_from_data("images/$ha/$hash", $event->metadata);
|
||||
if(is_null($image)) {
|
||||
$event->veto("SVG Handler failed to create image object from data");
|
||||
return;
|
||||
}
|
||||
send_event(new ImageAdditionEvent($event->user, $image));
|
||||
}
|
||||
|
||||
if(is_a($event, 'ThumbnailGenerationEvent') && $event->type == "svg") {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
|
||||
global $config;
|
||||
|
||||
// if($config->get_string("thumb_engine") == "convert") {
|
||||
// $w = $config->get_int("thumb_width");
|
||||
// $h = $config->get_int("thumb_height");
|
||||
// $q = $config->get_int("thumb_quality");
|
||||
// $mem = $config->get_int("thumb_max_memory") / 1024 / 1024; // IM takes memory in MB
|
||||
//
|
||||
// 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", "thumbs/$ha/$hash");
|
||||
// }
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent') && $event->image->ext == "svg") {
|
||||
$this->theme->display_image($event->page, $event->image);
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "get_svg")) {
|
||||
global $database;
|
||||
$id = int_escape($event->get_arg(0));
|
||||
$image = $database->get_image($id);
|
||||
$hash = $image->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
|
||||
$event->page->set_type("image/svg+xml");
|
||||
$event->page->set_mode("data");
|
||||
$event->page->set_data(file_get_contents("images/$ha/$hash"));
|
||||
}
|
||||
}
|
||||
|
||||
private function create_image_from_data($filename, $metadata) {
|
||||
global $config;
|
||||
|
||||
$image = new Image();
|
||||
|
||||
// FIXME: ugh, xml parsing :|
|
||||
$image->width = 0;
|
||||
$image->height = 0;
|
||||
|
||||
$image->filesize = $metadata['size'];
|
||||
$image->hash = $metadata['hash'];
|
||||
$image->filename = $metadata['filename'];
|
||||
$image->ext = $metadata['extension'];
|
||||
$image->tag_array = tag_explode($metadata['tags']);
|
||||
$image->source = $metadata['source'];
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
private function check_contents($file) {
|
||||
// FIXME: magic header?
|
||||
return (file_exists($file));
|
||||
}
|
||||
}
|
||||
add_event_listener(new SVGFileHandler());
|
||||
?>
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
class SVGFileHandlerTheme extends Themelet {
|
||||
public function display_image($page, $image) {
|
||||
$link = make_link("get_svg/{$image->id}/{$image->id}.svg");
|
||||
$ilink = $image->get_image_link();
|
||||
// FIXME: object and embed have "height" and "width"
|
||||
$html = "
|
||||
<object data='$ilink' type='image/svg+xml' width='300' height='300'>
|
||||
<embed src='$ilink' type='image/svg+xml' width='300' height='300' />
|
||||
</object>
|
||||
";
|
||||
$page->add_block(new Block("Image", $html, "main", 0));
|
||||
}
|
||||
}
|
||||
?>
|
Binary file not shown.
Before Width: | Height: | Size: 5.5 KiB |
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Name: Image Notes
|
||||
* Author: Shish <webmaster@shishnet.org>
|
||||
* Link: http://trac.shishnet.org/shimmie2/
|
||||
* License: GPLv2
|
||||
* Description: Adds notes overlaid on the images
|
||||
*/
|
||||
|
||||
class Notes extends Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("notes", "NotesTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
global $config;
|
||||
if($config->get_int("ext_notes_version") < 1) {
|
||||
$this->install();
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent')) {
|
||||
global $database;
|
||||
$notes = $database->get_all("SELECT * FROM image_notes WHERE image_id = ?", array($event->image->id));
|
||||
$this->theme->display_notes($event->page, $notes);
|
||||
}
|
||||
}
|
||||
|
||||
protected function install() {
|
||||
global $database;
|
||||
global $config;
|
||||
$database->Execute("CREATE TABLE image_notes (
|
||||
id int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
image_id int(11) NOT NULL,
|
||||
user_id int(11) NOT NULL,
|
||||
owner_ip char(15) NOT NULL,
|
||||
created_at datetime NOT NULL,
|
||||
updated_at datetime NOT NULL,
|
||||
version int(11) DEFAULT 1 NOT NULL,
|
||||
is_active enum('Y', 'N') DEFAULT 'Y' NOT NULL,
|
||||
x int(11) NOT NULL,
|
||||
y int(11) NOT NULL,
|
||||
w int(11) NOT NULL,
|
||||
h int(11) NOT NULL,
|
||||
body text NOT NULL
|
||||
)");
|
||||
$config->set_int("ext_notes_version", 1);
|
||||
}
|
||||
}
|
||||
add_event_listener(new Notes());
|
||||
?>
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
class NotesTheme extends Themelet {
|
||||
public function display_notes($page, $notes) {
|
||||
$html = <<<EOD
|
||||
<script type="text/javascript">
|
||||
img = byId("main_image");
|
||||
</script>
|
||||
EOD;
|
||||
$page->add_block(new Block(null, $html));
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,106 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Name: Image Ratings
|
||||
* Author: Shish <webmaster@shishnet.org>
|
||||
* Link: http://trac.shishnet.org/shimmie2/
|
||||
* License: GPLv2
|
||||
* Description: Allow users to rate images
|
||||
*/
|
||||
|
||||
class RatingSetEvent extends Event {
|
||||
var $image_id, $user, $rating;
|
||||
|
||||
public function RatingSetEvent($image_id, $user, $rating) {
|
||||
$this->image_id = $image_id;
|
||||
$this->user = $user;
|
||||
$this->rating = $rating;
|
||||
}
|
||||
}
|
||||
|
||||
class Ratings extends Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("rating", "RatingsTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
global $config;
|
||||
if($config->get_int("ext_ratings2_version") < 2) {
|
||||
$this->install();
|
||||
}
|
||||
|
||||
global $config;
|
||||
$config->set_default_string("ext_rating_anon_privs", 'sq');
|
||||
$config->set_default_string("ext_rating_user_privs", 'sq');
|
||||
}
|
||||
|
||||
if(is_a($event, 'RatingSetEvent')) {
|
||||
$this->set_rating($event->image_id, $event->rating);
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageInfoBoxBuildingEvent')) {
|
||||
global $user;
|
||||
if($user->is_admin()) {
|
||||
$event->add_part($this->theme->get_rater_html($event->image->id, $event->image->rating), 80);
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageInfoSetEvent')) {
|
||||
global $user;
|
||||
if($user->is_admin()) {
|
||||
send_event(new RatingSetEvent($event->image_id, $user, $_POST['rating']));
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
$privs = array();
|
||||
$privs['Safe Only'] = 's';
|
||||
$privs['Safe and Questionable'] = 'sq';
|
||||
$privs['All'] = 'sqe';
|
||||
|
||||
$sb = new SetupBlock("Image Ratings");
|
||||
$sb->add_choice_option("ext_rating_anon_privs", $privs, "Anonymous: ");
|
||||
$sb->add_choice_option("ext_rating_user_privs", $privs, "<br>Logged in: ");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
if(is_a($event, 'ParseLinkTemplateEvent')) {
|
||||
$event->replace('$rating', $this->theme->rating_to_name($event->image->rating));
|
||||
}
|
||||
|
||||
if(is_a($event, 'SearchTermParseEvent')) {
|
||||
$matches = array();
|
||||
if(preg_match("/rating=([sqe]+)/", $event->term, $matches)) {
|
||||
$sqes = $matches[1];
|
||||
$arr = array();
|
||||
for($i=0; $i<strlen($sqes); $i++) {
|
||||
$arr[] = "'" . $sqes[$i] . "'";
|
||||
}
|
||||
$set = join(', ', $arr);
|
||||
$event->set_querylet(new Querylet("AND (rating IN ($set))"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function install() {
|
||||
global $database;
|
||||
global $config;
|
||||
|
||||
if($config->get_int("ext_ratings2_version") < 1) {
|
||||
$database->Execute("ALTER TABLE images ADD COLUMN rating ENUM('s', 'q', 'e') NOT NULL DEFAULT 'q'");
|
||||
$config->set_int("ext_ratings2_version", 1);
|
||||
}
|
||||
|
||||
if($config->get_int("ext_ratings2_version") < 2) {
|
||||
$database->Execute("CREATE INDEX images__rating ON images(rating)");
|
||||
$config->set_int("ext_ratings2_version", 2);
|
||||
}
|
||||
}
|
||||
|
||||
private function set_rating($image_id, $rating) {
|
||||
global $database;
|
||||
$database->Execute("UPDATE images SET rating=? WHERE id=?", array($rating, $image_id));
|
||||
}
|
||||
}
|
||||
add_event_listener(new Ratings());
|
||||
?>
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
class RatingsTheme extends Themelet {
|
||||
public function get_rater_html($image_id, $rating) {
|
||||
$i_image_id = int_escape($image_id);
|
||||
$s_checked = $rating == 's' ? " checked" : "";
|
||||
$q_checked = $rating == 'q' ? " checked" : "";
|
||||
$e_checked = $rating == 'e' ? " checked" : "";
|
||||
$html = "
|
||||
<input type='hidden' name='image_id' value='$i_image_id' />
|
||||
<input type='radio' name='rating' value='s' id='s'$s_checked><label for='s'>Safe</label>
|
||||
<input type='radio' name='rating' value='q' id='q'$q_checked><label for='q'>Questionable</label>
|
||||
<input type='radio' name='rating' value='e' id='e'$e_checked><label for='e'>Explicit</label>
|
||||
";
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function rating_to_name($rating) {
|
||||
switch($rating) {
|
||||
case 's': return "Safe";
|
||||
case 'q': return "Questionable";
|
||||
case 'e': return "Explicit";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,79 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Name: Subversion Updater
|
||||
* Author: Shish <webmaster@shishnet.org>
|
||||
* Link: http://trac.shishnet.org/shimmie2/
|
||||
* License: GPLv2
|
||||
* Description: Provides a button to check for updates
|
||||
*/
|
||||
|
||||
class SVNUpdate extends Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("svn_update", "SVNUpdateTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "update")) {
|
||||
if($event->user->is_admin()) {
|
||||
if($event->get_arg(0) == "view_changes") {
|
||||
$this->theme->display_update_todo($event->page,
|
||||
$this->get_update_log(),
|
||||
$this->get_branches());
|
||||
}
|
||||
if($event->get_arg(0) == "update") {
|
||||
$this->theme->display_update_log($event->page, $this->run_update());
|
||||
}
|
||||
if($event->get_arg(0) == "dump") {
|
||||
$this->theme->display_update_log($event->page, $this->run_dump());
|
||||
}
|
||||
//if($event->get_arg(0) == "switch") {
|
||||
// $this->theme->display_update_log($event->page, $this->run_update());
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'AdminBuildingEvent')) {
|
||||
global $page;
|
||||
$this->theme->display_form($page);
|
||||
}
|
||||
}
|
||||
|
||||
private function get_update_log() {
|
||||
return shell_exec("svn log -r HEAD:BASE .");
|
||||
}
|
||||
private function run_update() {
|
||||
return shell_exec("svn update");
|
||||
}
|
||||
private function run_dump() {
|
||||
global $database_dsn;
|
||||
$matches = array();
|
||||
|
||||
// FIXME: MySQL specific
|
||||
if(preg_match("#^mysql://([^:]+):([^@]+)@([^/]+)/([^\?]+)#", $database_dsn, $matches)) {
|
||||
$date = date("Ymd");
|
||||
return
|
||||
shell_exec("mysqldump -uUSER -pPASS -hHOST DATABASE | gzip > db-$date.sql.gz") .
|
||||
"\n\nDatabase dump should now be sitting in db-$date.sql.gz in the shimmie folder";
|
||||
}
|
||||
else {
|
||||
return "Couldn't parse database connection string";
|
||||
}
|
||||
}
|
||||
private function get_branches() {
|
||||
$data = shell_exec("svn ls http://svn.shishnet.org/shimmie2/branches/");
|
||||
$list = array();
|
||||
foreach(split("\n", $data) as $line) {
|
||||
$matches = array();
|
||||
if(preg_match("/branch_(\d.\d+)/", $line, $matches)) {
|
||||
$ver = $matches[1];
|
||||
$list["branch_$ver"] = "Stable ($ver.X)";
|
||||
}
|
||||
}
|
||||
ksort($list);
|
||||
$list = array_reverse($list, true);
|
||||
$list["trunk"] = "Unstable (Trunk)";
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
add_event_listener(new SVNUpdate());
|
||||
?>
|
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
class SVNUpdateTheme extends Themelet {
|
||||
public function display_form($page) {
|
||||
$html = "
|
||||
<a href='".make_link("update/view_changes")."'>Check for Updates</a>
|
||||
";
|
||||
$page->add_block(new Block("Update", $html));
|
||||
}
|
||||
|
||||
public function display_update_todo($page, $log, $branches) {
|
||||
$h_log = html_escape($log);
|
||||
$updates = "
|
||||
<textarea rows='20' cols='80'>$h_log</textarea>
|
||||
<br/>
|
||||
<form action='".make_link("update/update")."' method='POST'>
|
||||
<input type='submit' value='Install Updates'>
|
||||
</form>
|
||||
";
|
||||
$options = "";
|
||||
foreach($branches as $name => $nice) {
|
||||
$options .= "<option value='$name'>$nice</option>";
|
||||
}
|
||||
$branches = "
|
||||
<form action='".make_link("update/switch")."' method='POST'>
|
||||
<select name='branch'>
|
||||
$options
|
||||
</select>
|
||||
<input type='submit' value='Change Branch'>
|
||||
</form>
|
||||
";
|
||||
|
||||
$page->set_title("Updates Available");
|
||||
$page->set_heading("Updates Available");
|
||||
$page->add_block(new NavBlock());
|
||||
$page->add_block(new Block("Updates For Current Branch", $updates));
|
||||
$page->add_block(new Block("Available Branches", $branches));
|
||||
}
|
||||
|
||||
public function display_update_log($page, $log) {
|
||||
$h_log = html_escape($log);
|
||||
$html = "
|
||||
<textarea rows='20' cols='80'>$h_log</textarea>
|
||||
";
|
||||
|
||||
$page->set_title("Update Log");
|
||||
$page->set_heading("Update Log");
|
||||
$page->add_block(new NavBlock());
|
||||
$page->add_block(new Block("Update Log", $html));
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user