Removed : v3.0 Beta from Trunk since it has been moved to GitHub
This commit is contained in:
parent
f3ab6df419
commit
2ca6204e5b
2004 changed files with 0 additions and 234996 deletions
119
upload/.htaccess
119
upload/.htaccess
|
@ -1,119 +0,0 @@
|
|||
#<IfModule mod_security.c>
|
||||
# secfilterengine off
|
||||
# secfilterscanPOST off
|
||||
#</IfModule>
|
||||
|
||||
Options All -Indexes
|
||||
FileETag MTime Size
|
||||
Options +FollowSymlinks
|
||||
RewriteEngine on
|
||||
|
||||
<FilesMatch "\.(db|inc|tmpl|h|ihtml|sql|ini|configuration|config|class|bin|spd|theme|module|cfg|cpl|tmp|log|err|inc.php|class.php)$">
|
||||
order allow,deny
|
||||
satisfy all
|
||||
</FilesMatch>
|
||||
|
||||
########## Begin - Rewrite rules to block out some common exploits
|
||||
#
|
||||
# Block out any script trying to set a mosConfig value through the URL
|
||||
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
|
||||
# Block out any script trying to base64_encode crap to send via URL
|
||||
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
|
||||
# Block out any script that includes a <script> tag in URL
|
||||
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
|
||||
# Block out any script trying to set a PHP GLOBALS variable via URL
|
||||
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
|
||||
# Block out any script trying to modify a _REQUEST variable via URL
|
||||
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
|
||||
# Send all blocked request to homepage with 403 Forbidden error!
|
||||
#RewriteRule ^(.*)$ index.php [L]
|
||||
RewriteRule ^([^.]*)/?$ index.php [L]
|
||||
#
|
||||
########## End - Rewrite rules to block out some common exploits
|
||||
|
||||
|
||||
RewriteEngine on
|
||||
|
||||
#RewriteBase /
|
||||
#
|
||||
#
|
||||
#
|
||||
#URL Rewriting for Videos
|
||||
RewriteRule ^videos/(.*)/(.*)/(.*)/(.*)/(.*) videos.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
|
||||
RewriteRule ^videos/([0-9]+) videos.php?page=$1 [L]
|
||||
RewriteRule ^videos/?$ videos.php?%{QUERY_STRING} [L]
|
||||
RewriteRule ^video/(.*)/(.*) watch_video.php?v=$1&%{QUERY_STRING} [L]
|
||||
#Alternate watch video links
|
||||
RewriteRule ^(.*)\_v([0-9]+) watch_video.php?v=$2&%{QUERY_STRING} [L]
|
||||
RewriteRule ^video/([0-9]+)_(.*) watch_video.php?v=$1&%{QUERY_STRING} [L]
|
||||
RewriteRule ^video/(.*) watch_video.php?s=$1&%{QUERY_STRING} [L]
|
||||
|
||||
|
||||
|
||||
#
|
||||
#Users, Channel & Management
|
||||
#
|
||||
|
||||
RewriteRule ^channels/(.*)/(.*)/(.*)/(.*)/(.*) channels.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
|
||||
RewriteRule ^channels/([0-9]+) channels.php?page=$1 [L]
|
||||
RewriteRule ^channels/?$ channels.php [L]
|
||||
RewriteRule ^members/?$ channels.php [nc]
|
||||
RewriteRule ^users/?$ channels.php [nc]
|
||||
RewriteRule ^user/(.*) view_channel.php?user=$1 [nc]
|
||||
RewriteRule ^channel/(.*) view_channel.php?user=$1 [nc]
|
||||
|
||||
|
||||
RewriteRule ^my_account myaccount.php [nc]
|
||||
|
||||
|
||||
|
||||
#Pages
|
||||
RewriteRule ^page/([0-9]+)/(.*) view_page.php?pid=$1 [nc]
|
||||
#
|
||||
#Miscellenous
|
||||
RewriteRule ^search/result/?$ search_result.php [nc]
|
||||
RewriteRule ^upload/?$ upload.php [nc]
|
||||
RewriteRule ^contact/?$ contact.php [nc]
|
||||
RewriteRule ^categories/?$ categories.php [nc]
|
||||
|
||||
#Group Section
|
||||
|
||||
RewriteRule ^group/([a-zA-Z0-9_-]+)/?$ view_group.php?url=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteRule ^view_topic/([a-zA-Z0-9].+)_tid_([0-9]+) view_topic.php?tid=$2&%{QUERY_STRING} [L]
|
||||
RewriteRule ^groups/(.*)/(.*)/(.*)/(.*)/(.*) groups.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
|
||||
RewriteRule ^groups/([0-9]+) groups.php?page=$1 [L]
|
||||
RewriteRule ^groups/?$ groups.php [L]
|
||||
RewriteRule ^create_group create_group.php [L]
|
||||
|
||||
#Collection Section
|
||||
RewriteRule ^collections/(.*)/(.*)/(.*)/(.*)/(.*) collections.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
|
||||
RewriteRule ^collections/([0-9]+) collections.php?page=$1 [L]
|
||||
RewriteRule ^collections/?$ collections.php [L]
|
||||
RewriteRule ^photos/(.*)/(.*)/(.*)/(.*)/(.*) photos.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
|
||||
RewriteRule ^photos/([0-9]+) photos.php?page=$1 [L]
|
||||
RewriteRule ^photos/?$ photos.php [L]
|
||||
RewriteRule ^collection/(.*)/(.*)/(.*) view_collection.php?cid=$1&type=$2&%{QUERY_STRING} [L]
|
||||
|
||||
#Photo Section
|
||||
RewriteRule ^item/(.*)/(.*)/(.*)/(.*) view_item.php?item=$3&type=$1&collection=$2 [L]
|
||||
RewriteRule ^photo_upload/(.*) photo_upload.php?collection=$1 [L]
|
||||
RewriteRule ^photo_upload/?$ photo_upload.php [L]
|
||||
#
|
||||
RewriteRule ^sitemap.xml$ sitemap.php
|
||||
RewriteRule ^signup/?$ signup.php
|
||||
|
||||
#Error Pages
|
||||
ErrorDocument 404 /404.php
|
||||
ErrorDocument 403 /403.php
|
||||
|
||||
########## End - Rewrite rules For SEO urls ######################
|
||||
RewriteRule ^rss$ rss.php [nc]
|
||||
RewriteRule ^rss/([a-zA-Z0-9].+)$ rss.php?mode=$1&%{QUERY_STRING} [nc]
|
||||
|
||||
########## End - Rewrite rules For SEO urls ######################
|
||||
|
||||
RewriteCond %{SCRIPT_FILENAME} !-d
|
||||
RewriteCond %{SCRIPT_FILENAME} !-f
|
||||
|
||||
RewriteRule ^([a-zA-Z0-9.]+)\.?([a-zA-Z0-9]+)?/?$ view_channel.php?uid=$1&seo_diret=yes [NC]
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
********************************************************************
|
||||
| Copyright (c) 2007-2009 Clip-Bucket.com. All rights reserved.
|
||||
| @ Author : ArslanHassan
|
||||
| @ Software : ClipBucket , © PHPBucket.com
|
||||
********************************************************************
|
||||
*/
|
||||
|
||||
define("THIS_PAGE",'403');
|
||||
require 'includes/config.inc.php';
|
||||
|
||||
if(file_exists(LAYOUT."/403.html")) {
|
||||
template_files('403.html');
|
||||
} else {
|
||||
$data = "403_error";
|
||||
if(has_access('admin_access'))
|
||||
e(sprintf(lang("err_warning"),"403","http://docs.clip-bucket.com/?p=154"),"w");
|
||||
e(lang($data));
|
||||
|
||||
}
|
||||
|
||||
display_it();
|
||||
?>
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
********************************************************************
|
||||
| Copyright (c) 2007-2009 Clip-Bucket.com. All rights reserved.
|
||||
| @ Author : ArslanHassan
|
||||
| @ Software : ClipBucket , © PHPBucket.com
|
||||
********************************************************************
|
||||
*/
|
||||
|
||||
define("THIS_PAGE",'404');
|
||||
require 'includes/config.inc.php';
|
||||
|
||||
if(file_exists(LAYOUT."/404.html")) {
|
||||
template_files('404.html');
|
||||
} else {
|
||||
$data = "404_error";
|
||||
if(has_access('admin_access'))
|
||||
e(sprintf(lang("err_warning"),"404","http://docs.clip-bucket.com/?p=154"),"w");
|
||||
e(lang($data));
|
||||
}
|
||||
|
||||
display_it();
|
||||
?>
|
|
@ -1,47 +0,0 @@
|
|||
Copyright (c) 2007 - 2010 by Arslan Hassan et al
|
||||
CLIPBUCKET * http://clip-bucket.com
|
||||
"A way to broadcast yourself - free and opensource video sharing website script"
|
||||
|
||||
All Rights Reserved
|
||||
ATTRIBUTION ASSURANCE LICENSE (adapted from the original BSD license)
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the conditions below are met.
|
||||
These conditions require a modest attribution to <AUTHOR> (the
|
||||
"Arslan Hassan"), who hopes that its promotional value may help justify the
|
||||
thousands of dollars in otherwise billable time invested in writing
|
||||
this and other freely available, open-source software.
|
||||
|
||||
1. Redistributions of source code, in whole or part and with or without
|
||||
modification (the "Code"), must prominently display this GPG-signed
|
||||
text in verifiable form.
|
||||
2. Redistributions of the Code in binary form must be accompanied by
|
||||
this GPG-signed text in any documentation and, each time the resulting
|
||||
executable program or a program dependent thereon is launched, a
|
||||
prominent display (e.g., splash screen or banner text) of the Author's
|
||||
attribution information, which includes:
|
||||
(a) Name ("Arslan Hassan"),
|
||||
(b) Professional identification ("ClipBucket"), and
|
||||
(c) URL ("http://clip-bucket.com").
|
||||
3. Neither the name nor any trademark of the Author may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
4. Users are entirely responsible, to the exclusion of the Author and
|
||||
any other persons, for compliance with (1) regulations set by owners or
|
||||
administrators of employed equipment, (2) licensing terms of any other
|
||||
software, and (3) local regulations regarding use, including those
|
||||
regarding import, export, and use of encryption software.
|
||||
|
||||
THIS FREE SOFTWARE IS PROVIDED BY THE AUTHOR "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 AUTHOR OR ANY CONTRIBUTOR BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
EFFECTS OF UNAUTHORIZED OR MALICIOUS NETWORK ACCESS;
|
||||
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,132 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is used to update
|
||||
* Comment
|
||||
* Author : Arslan Hassan
|
||||
* Since : Jan 02 2009
|
||||
*/
|
||||
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
|
||||
$mode = $_POST['mode'];
|
||||
switch($mode)
|
||||
{
|
||||
case 'add_note':
|
||||
{
|
||||
$value = $_POST['note'];
|
||||
$myquery->insert_note($value);
|
||||
$array['note'] = nl2br($value);
|
||||
$array['id'] = $db->insert_id();
|
||||
|
||||
echo json_encode($array);
|
||||
}
|
||||
break;
|
||||
case 'delete_note':
|
||||
{
|
||||
$id = mysql_clean($_POST['id']);
|
||||
$myquery->delete_note($id);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete_comment':
|
||||
{
|
||||
$type = $_POST['type'];
|
||||
switch($type)
|
||||
{
|
||||
case 'v':
|
||||
case 'video':
|
||||
default:
|
||||
{
|
||||
$cid = mysql_clean($_POST['cid']);
|
||||
$type_id = $myquery->delete_comment($cid);
|
||||
$cbvid->update_comments_count($type_id);
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
case 'c':
|
||||
{
|
||||
$cid = mysql_clean($_POST['cid']);
|
||||
$type_id = $myquery->delete_comment($cid);
|
||||
$userquery->update_comments_count($type_id);
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
case 'topic':
|
||||
{
|
||||
$cid = mysql_clean($_POST['cid']);
|
||||
$type_id = $myquery->delete_comment($cid);
|
||||
$cbgroup->update_comments_count($type_id);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
if(msg())
|
||||
{
|
||||
$msg = msg_list();
|
||||
$msg = $msg[0];
|
||||
}
|
||||
if(error())
|
||||
{
|
||||
$err = error_list();
|
||||
$err = $err[0];
|
||||
}
|
||||
|
||||
$ajax['msg'] = $msg;
|
||||
$ajax['err'] = $err;
|
||||
|
||||
echo json_encode($ajax);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'spam_comment':
|
||||
{
|
||||
$cid = mysql_clean($_POST['cid']);
|
||||
|
||||
|
||||
$rating = $myquery->spam_comment($cid);
|
||||
if(msg())
|
||||
{
|
||||
$msg = msg_list();
|
||||
$msg = $msg[0];
|
||||
}
|
||||
if(error())
|
||||
{
|
||||
$err = error_list();
|
||||
$err = $err[0];
|
||||
}
|
||||
|
||||
$ajax['msg'] = $msg;
|
||||
$ajax['err'] = $err;
|
||||
|
||||
echo json_encode($ajax);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'remove_spam':
|
||||
{
|
||||
$cid = mysql_clean($_POST['cid']);
|
||||
|
||||
|
||||
$rating = $myquery->remove_spam($cid);
|
||||
if(msg())
|
||||
{
|
||||
$msg = msg_list();
|
||||
$msg = $msg[0];
|
||||
}
|
||||
if(error())
|
||||
{
|
||||
$err = error_list();
|
||||
$err = $err[0];
|
||||
}
|
||||
|
||||
$ajax['msg'] = $msg;
|
||||
$ajax['err'] = $err;
|
||||
|
||||
echo json_encode($ajax);
|
||||
}
|
||||
break;
|
||||
}
|
||||
?>
|
|
@ -1,20 +0,0 @@
|
|||
#!/usr/bin/php -q
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @name : ClipBucket Cron
|
||||
* @package : ClipBucket
|
||||
*/
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
include("../includes/config.inc.php");
|
||||
|
||||
$interval = 10; //in seconds...
|
||||
|
||||
while(1)
|
||||
{
|
||||
//Clearing Sesssions..
|
||||
sleep($interval);
|
||||
}
|
||||
?>
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is used to update
|
||||
* Comment
|
||||
* Author : Arslan Hassan
|
||||
* Since : 10 Aug, 2009
|
||||
*/
|
||||
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
|
||||
$cid = $_POST['id'];
|
||||
$value = $_POST['value'];
|
||||
|
||||
$myquery->update_comment($cid,$value);
|
||||
|
||||
echo mysql_clean($value);
|
||||
?>
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is used to verify embed form
|
||||
* @author : Arslan Hassan
|
||||
*/
|
||||
|
||||
include("../includes/config.inc.php");
|
||||
|
||||
$mode = $_POST['mode'];
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case "remote_play":
|
||||
{
|
||||
$duration = $_POST['duration'];
|
||||
$thumb_file = $_POST['thumb_file'];
|
||||
$url = $_POST['remote_play_url'];
|
||||
$ext = strtolower(getExt($thumb_file));
|
||||
|
||||
validate_duration($duration);
|
||||
check_remote_play_link($url);
|
||||
|
||||
if(empty($thumb_file) || ( $ext != 'jpg' && $ext != 'png' && $ext !='gif'))
|
||||
e(lang("pelase_select_img_file_for_vdo"));
|
||||
if(count($eh->error_list>0))
|
||||
$array['err'] = $eh->error_list[0];
|
||||
|
||||
echo json_encode($array);
|
||||
}
|
||||
break;
|
||||
|
||||
case "embed":
|
||||
default:
|
||||
{
|
||||
$embed_code = $_POST['embed_code'];
|
||||
$duration = $_POST['duration'];
|
||||
$thumb_file = $_POST['thumb_file'];
|
||||
$ext = strtolower(getExt($thumb_file));
|
||||
|
||||
validate_embed_code($embed_code);
|
||||
validate_duration($duration);
|
||||
|
||||
if(empty($thumb_file) || ( $ext != 'jpg' && $ext != 'png' && $ext !='gif'))
|
||||
e(lang("pelase_select_img_file_for_vdo"));
|
||||
if(count($eh->error_list>0))
|
||||
$array['err'] = $eh->error_list[0];
|
||||
|
||||
echo json_encode($array);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,316 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is used to download files
|
||||
* from one server to our server
|
||||
* in prior version, this file was not so reliable
|
||||
* this time it has complete set of instruction
|
||||
* and proper downloader
|
||||
|
||||
* @Author : Arslan Hassan
|
||||
* @License : Attribution Assurance License -- http://www.opensource.org/licenses/attribution.php
|
||||
* @Since : 01 July 2009
|
||||
*/
|
||||
|
||||
|
||||
include("../includes/config.inc.php");
|
||||
include("../includes/classes/curl/class.curl.php");
|
||||
error_reporting(E_ALL ^E_NOTICE);
|
||||
|
||||
|
||||
|
||||
if(isset($_POST['check_url']))
|
||||
{
|
||||
$url = $_POST['check_url'];
|
||||
|
||||
$types_array = preg_replace('/,/',' ',strtolower(config('allowed_types')));
|
||||
$types_array = explode(' ',$types_array);
|
||||
$file_ext = strtolower(getExt(strtolower($url)));
|
||||
|
||||
if(checkRemoteFile($url) && in_array($file_ext,$types_array) )
|
||||
{
|
||||
echo json_encode(array('ok'=>'yes'));
|
||||
}else
|
||||
echo json_encode(array('err'=>'Invalid remote url'));
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call back function of cURL handlers
|
||||
* when it downloads a file, it works with php >= 5.3.0
|
||||
* @param $download_size total file size of the file
|
||||
* @param $downloaded total file size that has been downloaded
|
||||
* @param $upload_size total file size that has to be uploaded
|
||||
* @param $uploadsed total file size that is uploaded
|
||||
*
|
||||
* Writes the log in file
|
||||
*/
|
||||
|
||||
if(!isCurlInstalled())
|
||||
{
|
||||
exit(json_encode(array("error"=>"Sorry, we do not support remote upload")));
|
||||
}
|
||||
|
||||
//checking if user is logged in or not
|
||||
if(!userid())
|
||||
exit(json_encode(array('error'=>'You are not logged in')));
|
||||
|
||||
if($_POST['youtube'])
|
||||
{
|
||||
$youtube_url = $_POST['file'];
|
||||
$filename = $_POST['file_name'];
|
||||
|
||||
$ParseUrl = parse_url($youtube_url);
|
||||
parse_str($ParseUrl['query'], $youtube_url_prop);
|
||||
$YouTubeId = isset($youtube_url_prop['v']) ? $youtube_url_prop['v'] : '';
|
||||
|
||||
if(!$YouTubeId)
|
||||
{
|
||||
exit(json_encode(array("error"=>"Invalid youtube url")));
|
||||
}
|
||||
|
||||
$content = xml2array('http://gdata.youtube.com/feeds/api/videos/'.$YouTubeId);
|
||||
$content = $content['entry'];
|
||||
/* $match_arr =
|
||||
array
|
||||
(
|
||||
"title"=>"/<meta name=\"title\" content=\"(.*)\">/",
|
||||
"description"=>"/<meta name=\"description\" content=\"(.*)\">/",
|
||||
"tags" =>"/<meta name=\"keywords\" content=\"(.*)\">/",
|
||||
"embed_code" => "/<meta name=\"keywords\" content=\"(.*)\">/",
|
||||
"duration" => "/<span class=\"video-time\">([0-9\:]+)<\/span>/"
|
||||
);
|
||||
|
||||
$vid_array = array();
|
||||
foreach($match_arr as $title=> $match)
|
||||
{
|
||||
preg_match($match,$content,$matches);
|
||||
$vid_array[$title] = $matches[1];
|
||||
}*/
|
||||
|
||||
$vid_array['title'] = $content['media:group']['media:title'];
|
||||
$vid_array['description'] = $content['content'];
|
||||
$vid_array['tags'] = $content['media:group']['media:keywords'];
|
||||
$vid_array['duration'] = $content['media:group']['yt:duration_attr']['seconds'];
|
||||
|
||||
|
||||
|
||||
$vid_array['thumbs'] =
|
||||
array('http://i3.ytimg.com/vi/'.$YouTubeId.'/1.jpg','http://i3.ytimg.com/vi/'.
|
||||
$YouTubeId.'/2.jpg','http://i3.ytimg.com/vi/'.$YouTubeId.'/3.jpg',
|
||||
'big'=>'http://i3.ytimg.com/vi/'.$YouTubeId.'/0.jpg');
|
||||
$vid_array['embed_code'] = '<object width="425" height="344">
|
||||
<param name="movie" value="http://www.youtube.com/v/'.$YouTubeId.'">
|
||||
</param><param name="allowFullScreen" value="true"></param>
|
||||
<param name="allowscriptaccess" value="always"></param>
|
||||
<embed src="http://www.youtube.com/v/'.$YouTubeId.'"
|
||||
type="application/x-shockwave-flash"
|
||||
width="425" height="344"
|
||||
allowscriptaccess="always"
|
||||
allowfullscreen="true">
|
||||
</embed></object>';
|
||||
|
||||
|
||||
$vid_array['category'] = array($cbvid->get_default_cid());
|
||||
$vid_array['file_name'] = $filename;
|
||||
$vid_array['userid'] = userid();
|
||||
|
||||
$duration = $vid_array['duration'];
|
||||
/* $duration = explode(":",$duration);
|
||||
$sep = count($duration);
|
||||
if($sep==3)
|
||||
$duration = ($duration[0]*60*60)+($duration[1]*60)+($duration[2]);
|
||||
else
|
||||
$duration = ($duration[0]*60)+($duration[1]);
|
||||
*/
|
||||
$vid = $Upload->submit_upload($vid_array);
|
||||
|
||||
if(error())
|
||||
{
|
||||
exit(json_encode(array('error'=>error('single'))));
|
||||
}
|
||||
|
||||
if(!function_exists('get_refer_url_from_embed_code'))
|
||||
{
|
||||
exit(json_encode(array('error'=>"Clipbucket embed module is not installed")));
|
||||
}
|
||||
|
||||
$ref_url = get_refer_url_from_embed_code(unhtmlentities(stripslashes($vdetails['embed_code'])));
|
||||
$ref_url = $ref_url['url'];
|
||||
$db->update(tbl("video"),array("status","refer_url","duration"),array('Successful',$ref_url,$duration)," videoid='$vid'");
|
||||
|
||||
//Downloading thumb
|
||||
foreach($vid_array['thumbs'] as $tid => $thumb)
|
||||
{
|
||||
if($tid!='big')
|
||||
$thumbId = $tid+1;
|
||||
else
|
||||
$thumbId = 'big';
|
||||
snatch_it(urlencode($thumb),THUMBS_DIR,$filename."-$thumbId.jpg");
|
||||
}
|
||||
|
||||
exit(json_encode(array('vid'=>$vid,
|
||||
'title'=>$vid_array['title'],'desc'=>$vid_array['description'],
|
||||
'tags'=>$vid_array['tags'])));
|
||||
}
|
||||
|
||||
|
||||
|
||||
function callback($download_size, $downloaded, $upload_size, $uploaded)
|
||||
{
|
||||
global $curl,$log_file,$file_name,$ext;
|
||||
|
||||
$fo = fopen($log_file,'w+');
|
||||
//Elapsed time CURLINFO_TOTAL_TIME
|
||||
|
||||
$info = curl_getinfo($curl->m_handle);
|
||||
|
||||
$download_bytes = $download_size - $downloaded;
|
||||
$cur_speed = $info['speed_download'];
|
||||
if($cur_speed>0)
|
||||
$time_eta = $download_bytes/$cur_speed;
|
||||
else
|
||||
$time_eta = 0;
|
||||
|
||||
$time_took = $info['total_time'];
|
||||
|
||||
$curl_info =
|
||||
array(
|
||||
'total_size' => $download_size,
|
||||
'downloaded' => $downloaded,
|
||||
'speed_download' => $info['speed_download'],
|
||||
'time_eta' => $time_eta,
|
||||
'time_took'=> $time_took,
|
||||
'file_name' => $file_name.'.'.$ext
|
||||
);
|
||||
fwrite($fo,json_encode($curl_info));
|
||||
fclose($fo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$file = $_POST['file'];
|
||||
$file_name = mysql_clean($_POST['file_name']);
|
||||
|
||||
$log_file = TEMP_DIR.'/'.$file_name.'_curl_log.cblog';
|
||||
//For PHP < 5.3.0
|
||||
$dummy_file = TEMP_DIR.'/'.$file_name.'_curl_dummy.cblog';
|
||||
|
||||
$ext = getExt($file);
|
||||
$svfile = TEMP_DIR.'/'.$file_name.'.'.$ext;
|
||||
|
||||
//Checking for the url
|
||||
if(empty($file))
|
||||
{
|
||||
$array['error'] = "Please enter file url";
|
||||
echo json_encode($array);
|
||||
exit();
|
||||
}
|
||||
//Checkinf if extension is wrong
|
||||
$types = strtolower($Cbucket->configs['allowed_types']);
|
||||
$types_array = preg_replace('/,/',' ',$types);
|
||||
$types_array = explode(' ',$types_array);
|
||||
|
||||
$extension_whitelist = $types_array;
|
||||
if(!in_array($ext,$extension_whitelist))
|
||||
{
|
||||
$array['error'] = "This file type is not allowed";
|
||||
echo json_encode($array);
|
||||
exit();
|
||||
}
|
||||
|
||||
$curl = new curl($file);
|
||||
$curl->setopt(CURLOPT_FOLLOWLOCATION, true) ;
|
||||
|
||||
//Checking if file size is not that goood
|
||||
if(!is_numeric($curl->file_size) || $curl->file_size == '')
|
||||
{
|
||||
$array['error'] = "Unknown file size";
|
||||
echo json_encode($array);
|
||||
exit();
|
||||
}
|
||||
|
||||
if(phpversion() < '5.3.0')
|
||||
{
|
||||
//Here we will get file size and write it in a file
|
||||
//called dummy_log
|
||||
$darray = array(
|
||||
'file_size' => $curl->file_size,
|
||||
'file_name' => $file_name.'.'.$ext,
|
||||
'time_started'=>time(),
|
||||
'byte_size' => 0
|
||||
);
|
||||
$do = fopen($dummy_file,'w+');
|
||||
fwrite($do,json_encode($darray));
|
||||
fclose($do);
|
||||
}
|
||||
|
||||
//Opening video file
|
||||
$temp_fo = fopen($svfile,'w+');
|
||||
$curl->setopt(CURLOPT_FILE, $temp_fo);
|
||||
|
||||
// Set up the callback
|
||||
if(phpversion() >= '5.3.0')
|
||||
{
|
||||
$curl->setopt(CURLOPT_NOPROGRESS, false);
|
||||
$curl->setopt(CURLOPT_PROGRESSFUNCTION, 'callback');
|
||||
}
|
||||
|
||||
$curl->exec();
|
||||
|
||||
if ($theError = $curl->hasError())
|
||||
{
|
||||
$array['error'] = $theError ;
|
||||
echo json_encode($array);
|
||||
}
|
||||
|
||||
//Finish Writing File
|
||||
fclose($temp_fo);
|
||||
|
||||
|
||||
sleep(10);
|
||||
$details = file_get_contents($log_file);
|
||||
$details = json_decode($details,true);
|
||||
$Upload->add_conversion_queue($details['file_name']);
|
||||
|
||||
if(file_exists($log_file))
|
||||
unlink($log_file);
|
||||
if(file_exists($dummy_file))
|
||||
unlink($dummy_file);
|
||||
$quick_conv = config('quick_conv');
|
||||
$use_crons = config('use_crons');
|
||||
|
||||
|
||||
//Inserting data
|
||||
$title = urldecode(mysql_clean(getName($file)));
|
||||
$title = $title ? $title : "Untitled";
|
||||
|
||||
$vidDetails = array
|
||||
(
|
||||
'title' => $title,
|
||||
'description' => $title,
|
||||
'tags' => genTags(str_replace(' ',', ',$title)),
|
||||
'category' => array($cbvid->get_default_cid()),
|
||||
'file_name' => $file_name,
|
||||
'userid' => userid(),
|
||||
);
|
||||
|
||||
$vid = $Upload->submit_upload($vidDetails);
|
||||
|
||||
echo json_encode(array('vid'=>$vid));
|
||||
|
||||
if($quick_conv=='yes' || $use_crons=='no')
|
||||
{
|
||||
$targetFileName = $details['file_name'];
|
||||
//exec(php_path()." -q ".BASEDIR."/actions/video_convert.php &> /dev/null &");
|
||||
if (stristr(PHP_OS, 'WIN')) {
|
||||
exec(php_path()." -q ".BASEDIR."/actions/video_convert.php $targetFileName sleep");
|
||||
} else {
|
||||
exec(php_path()." -q ".BASEDIR."/actions/video_convert.php $targetFileName sleep&> /dev/null &");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -1,89 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is used to download files
|
||||
* from one server to our server
|
||||
* in prior version, this file was not so reliable
|
||||
* this time it has complete set of instruction
|
||||
* and proper downloader
|
||||
|
||||
* @Author : Arslan Hassan
|
||||
* @License : Attribution Assurance License -- http://www.opensource.org/licenses/attribution.php
|
||||
* @Since : 01 July 2009
|
||||
*/
|
||||
|
||||
//When we need
|
||||
define(TEMP_DIR,dirname(__FILE__).'/../files/temp');
|
||||
error_reporting(E_ALL ^E_NOTICE);
|
||||
|
||||
$file_name = $_POST['file_name'];
|
||||
$log_file = TEMP_DIR.'/'.$file_name.'_curl_log.cblog';
|
||||
//For PHP < 5.3.0
|
||||
$dummy_file = TEMP_DIR.'/'.$file_name.'_curl_dummy.cblog';
|
||||
|
||||
|
||||
include("include_functions.php");
|
||||
|
||||
|
||||
if(file_exists($dummy_file))
|
||||
{
|
||||
//Read the data
|
||||
$data = file_get_contents($dummy_file);
|
||||
$data = json_decode($data,true);
|
||||
|
||||
$file = $data['file_name'];
|
||||
$started = $data['time_started'];
|
||||
|
||||
//Total File Size
|
||||
$total_size = $data['file_size'];
|
||||
|
||||
$byte_size = $data['byte_size'];
|
||||
|
||||
//Let check whats the file size right now
|
||||
$data['byte_size'] = $now_file_size = filesize(TEMP_DIR.'/'.$file);
|
||||
|
||||
//Bytes Transfered
|
||||
$cur_speed = $now_file_size - $byte_size;
|
||||
|
||||
//Time Eta
|
||||
$download_bytes = $total_size - $now_file_size;
|
||||
if($cur_speed>0)
|
||||
$time_eta = $download_bytes/$cur_speed;
|
||||
else
|
||||
$time_eta = 0;
|
||||
|
||||
//Time Took
|
||||
$time_took = time() - $started;
|
||||
|
||||
$curl_info =
|
||||
array(
|
||||
'total_size' => $total_size,
|
||||
'downloaded' => $now_file_size,
|
||||
'speed_download' => $cur_speed,
|
||||
'time_eta' => $time_eta,
|
||||
'time_took'=> $time_took,
|
||||
'file_name'=> $file
|
||||
);
|
||||
|
||||
$fo = fopen($log_file,'w+');
|
||||
fwrite($fo,json_encode($curl_info));
|
||||
fclose($fo);
|
||||
|
||||
$fo = fopen($dummy_file,'w+');
|
||||
fwrite($fo,json_encode($data));
|
||||
fclose($fo);
|
||||
|
||||
if($total_size==$now_file_size)
|
||||
unlink($dummy_file);
|
||||
}
|
||||
|
||||
if(file_exists($log_file))
|
||||
{
|
||||
$details = file_get_contents($log_file);
|
||||
$details = json_decode($details,true);
|
||||
$details['total_size_fm'] = formatfilesize($details['total_size']);
|
||||
$details['downloaded_fm'] = formatfilesize($details['downloaded']);
|
||||
$details['time_eta_fm'] = SetTime($details['time_eta']);
|
||||
$details['time_took_fm'] = SetTime($details['time_took']);
|
||||
echo json_encode($details);
|
||||
}
|
||||
?>
|
|
@ -1,257 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @Author : Arslan Hassan
|
||||
*/
|
||||
include('../includes/config.inc.php');
|
||||
|
||||
|
||||
|
||||
if (isset($_REQUEST['upload']))
|
||||
$mode = "upload";
|
||||
|
||||
if ($_POST['insertVideo'])
|
||||
$mode = "insert_video";
|
||||
if ($_POST['getForm'])
|
||||
$mode = "get_form";
|
||||
if ($_POST['updateVideo'] == 'yes')
|
||||
$mode = "update_video";
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
|
||||
case "insert_video":
|
||||
{
|
||||
$title = getName($_POST['title']);
|
||||
$file_name = time() . RandomString(5);
|
||||
|
||||
$file_directory = createDataFolders();
|
||||
|
||||
$vidDetails = array
|
||||
(
|
||||
'title' => $title,
|
||||
'description' => $title,
|
||||
'tags' => genTags(str_replace(' ', ', ', $title)),
|
||||
'category' => array($cbvid->get_default_cid()),
|
||||
'file_name' => $file_name,
|
||||
'file_directory' => $file_directory,
|
||||
'userid' => userid(),
|
||||
);
|
||||
|
||||
$vid = $Upload->submit_upload($vidDetails);
|
||||
|
||||
if (error())
|
||||
{
|
||||
echo json_encode(array('err' => error()));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => 'yes',
|
||||
'vid' => $vid, 'file_directory' => $file_directory,
|
||||
'file_name' => $file_name));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "get_form":
|
||||
{
|
||||
$title = getName($_POST['title']);
|
||||
if (!$title)
|
||||
$title = $_POST['title'];
|
||||
$desc = $_POST['desc'];
|
||||
$tags = $_POST['tags'];
|
||||
|
||||
if (!$desc)
|
||||
$desc = $title;
|
||||
if (!$tags)
|
||||
$tags = $title;
|
||||
|
||||
$vidDetails = array
|
||||
(
|
||||
'title' => $title,
|
||||
'description' => $desc,
|
||||
'tags' => $tags,
|
||||
'category' => array($cbvid->get_default_cid()),
|
||||
);
|
||||
|
||||
assign("objId", $_POST['objId']);
|
||||
|
||||
assign('input', $vidDetails);
|
||||
Template('blocks/upload/form.html');
|
||||
}
|
||||
break;
|
||||
|
||||
case "upload":
|
||||
{
|
||||
|
||||
|
||||
|
||||
$status_array = array();
|
||||
|
||||
// HTTP headers for no cache etc
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
//pr($_REQUEST);
|
||||
$targetDir = TEMP_DIR;
|
||||
|
||||
$cleanupTargetDir = true; // Remove old files
|
||||
$maxFileAge = 5 * 3600; // Temp file age in seconds
|
||||
@set_time_limit(5 * 60);
|
||||
|
||||
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
|
||||
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
|
||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||
|
||||
// Clean the fileName for security reasons
|
||||
$fileName = preg_replace('/[^\w\._]+/', '_', $fileName);
|
||||
|
||||
// Make sure the fileName is unique but only if chunking is disabled
|
||||
if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName))
|
||||
{
|
||||
$ext = strrpos($fileName, '.');
|
||||
$fileName_a = substr($fileName, 0, $ext);
|
||||
$fileName_b = substr($fileName, $ext);
|
||||
|
||||
$count = 1;
|
||||
while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName_a . '_' . $count . $fileName_b))
|
||||
$count++;
|
||||
|
||||
$fileName = $fileName_a . '_' . $count . $fileName_b;
|
||||
}
|
||||
|
||||
$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
// Create target dir
|
||||
if (!file_exists($targetDir))
|
||||
@mkdir($targetDir);
|
||||
|
||||
// Remove old temp files
|
||||
if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir)))
|
||||
{
|
||||
while (($file = readdir($dir)) !== false)
|
||||
{
|
||||
$tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
|
||||
|
||||
// Remove temp file if it is older than the max age and is not the current file
|
||||
if (preg_match('/\.part$/', $file) && (filemtime($tmpfilePath) < time() - $maxFileAge) && ($tmpfilePath != "{$filePath}.part"))
|
||||
{
|
||||
@unlink($tmpfilePath);
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dir);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
|
||||
|
||||
|
||||
// Look for the content type header
|
||||
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
|
||||
|
||||
if (isset($_SERVER["CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["CONTENT_TYPE"];
|
||||
|
||||
// Handle non multipart uploads older WebKit versions didn't support multipart in HTML5
|
||||
if (strpos($contentType, "multipart") !== false)
|
||||
{
|
||||
if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name']))
|
||||
{
|
||||
// Open temp file
|
||||
$out = fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
|
||||
if ($out)
|
||||
{
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen($_FILES['file']['tmp_name'], "rb");
|
||||
|
||||
if ($in)
|
||||
{
|
||||
while ($buff = fread($in, 4096))
|
||||
fwrite($out, $buff);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
|
||||
fclose($in);
|
||||
fclose($out);
|
||||
@unlink($_FILES['file']['tmp_name']);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
|
||||
} else
|
||||
{
|
||||
// Open temp file
|
||||
$out = fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
|
||||
if ($out)
|
||||
{
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen("php://input", "rb");
|
||||
|
||||
if ($in)
|
||||
{
|
||||
while ($buff = fread($in, 4096))
|
||||
fwrite($out, $buff);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
|
||||
|
||||
fclose($in);
|
||||
fclose($out);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
|
||||
}
|
||||
|
||||
// Check if file has been uploaded
|
||||
if (!$chunks || $chunk == $chunks - 1)
|
||||
{
|
||||
// Strip the temp .part suffix off
|
||||
rename("{$filePath}.part", $filePath);
|
||||
}
|
||||
|
||||
|
||||
// Return JSON-RPC response
|
||||
//die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
|
||||
//move_uploaded_file($tempFile, $targetFile);
|
||||
$file_name = $_REQUEST['file_name'];
|
||||
$targetFileName = $file_name . '.' . getExt($filePath);
|
||||
$targetFile = TEMP_DIR . "/" . $targetFileName;
|
||||
|
||||
rename($filePath, $targetFile);
|
||||
|
||||
$fileDir = $_REQUEST['file_directory'];
|
||||
$Upload->add_conversion_queue($targetFileName, $fileDir);
|
||||
|
||||
//exec(php_path()." -q ".BASEDIR."/actions/video_convert.php &> /dev/null &");
|
||||
if (stristr(PHP_OS, 'WIN'))
|
||||
{
|
||||
exec(php_path() . " -q " . BASEDIR . "/actions/video_convert.php $targetFileName");
|
||||
}
|
||||
else
|
||||
{
|
||||
$status_array['rickshaw'] = 'videoconvert';
|
||||
exec(php_path() . " -q " . BASEDIR . "/actions/video_convert.php $targetFileName &> /dev/null &");
|
||||
}
|
||||
|
||||
$status_array['success'] = 'yes';
|
||||
$status_array['file_name'] = $file_name;
|
||||
|
||||
echo json_encode($status_array);
|
||||
}
|
||||
break;
|
||||
|
||||
case "update_video":
|
||||
{
|
||||
$Upload->validate_video_upload_form();
|
||||
$_POST['videoid'] = trim($_POST['videoid']);
|
||||
if (empty($eh->error_list))
|
||||
{
|
||||
$cbvid->update_video();
|
||||
}
|
||||
if (error())
|
||||
echo json_encode(array('error' => error('single')));
|
||||
else
|
||||
echo json_encode(array('msg' => msg('single')));
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* this file is used to fetch file size
|
||||
*/
|
||||
include("../includes/config.inc.php");
|
||||
|
||||
$file_name = $_POST['file'];
|
||||
$file = TEMP_DIR.'/'.$file_name;
|
||||
|
||||
|
||||
if(!empty($file_name) && file_exists($file))
|
||||
echo filesize($file);
|
||||
?>
|
|
@ -1,130 +0,0 @@
|
|||
<?php
|
||||
|
||||
function RandomString($length)
|
||||
{
|
||||
// Generate random 32 charecter string
|
||||
$string = md5(microtime());
|
||||
|
||||
// Position Limiting
|
||||
$highest_startpoint = 32-$length;
|
||||
|
||||
// Take a random starting point in the randomly
|
||||
// Generated String, not going any higher then $highest_startpoint
|
||||
$randomString = substr($string,rand(0,$highest_startpoint),$length);
|
||||
|
||||
return $randomString;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function formatfilesize( $data ) {
|
||||
// bytes
|
||||
if( $data < 1024 ) {
|
||||
return $data . " bytes";
|
||||
}
|
||||
// kilobytes
|
||||
else if( $data < 1024000 ) {
|
||||
return round( ( $data / 1024 ), 1 ) . "KB";
|
||||
}
|
||||
// megabytes
|
||||
else if($data < 1024000000){
|
||||
return round( ( $data / 1024000 ), 1 ) . " MB";
|
||||
}else{
|
||||
return round( ( $data / 1024000000 ), 1 ) . " GB";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to get file name
|
||||
*/
|
||||
function GetName($file)
|
||||
{
|
||||
if(!is_string($file))
|
||||
return false;
|
||||
$path = explode('/',$file);
|
||||
if(is_array($path))
|
||||
$file = $path[count($path)-1];
|
||||
$new_name = substr($file, 0, strrpos($file, '.'));
|
||||
return $new_name;
|
||||
}
|
||||
|
||||
function get_elapsed_time($ts,$datetime=1)
|
||||
{
|
||||
if($datetime == 1)
|
||||
{
|
||||
$ts = date('U',strtotime($ts));
|
||||
}
|
||||
$mins = floor((time() - $ts) / 60);
|
||||
$hours = floor($mins / 60);
|
||||
$mins -= $hours * 60;
|
||||
$days = floor($hours / 24);
|
||||
$hours -= $days * 24;
|
||||
$weeks = floor($days / 7);
|
||||
$days -= $weeks * 7;
|
||||
$t = "";
|
||||
if ($weeks > 0)
|
||||
return "$weeks week" . ($weeks > 1 ? "s" : "");
|
||||
if ($days > 0)
|
||||
return "$days day" . ($days > 1 ? "s" : "");
|
||||
if ($hours > 0)
|
||||
return "$hours hour" . ($hours > 1 ? "s" : "");
|
||||
if ($mins > 0)
|
||||
return "$mins min" . ($mins > 1 ? "s" : "");
|
||||
return "< 1 min";
|
||||
}
|
||||
|
||||
//Function Used TO Get Extensio Of File
|
||||
function GetExt($file){
|
||||
return substr($file, strrpos($file,'.') + 1);
|
||||
}
|
||||
|
||||
function old_set_time($temps)
|
||||
{
|
||||
round($temps);
|
||||
$heures = floor($temps / 3600);
|
||||
$minutes = round(floor(($temps - ($heures * 3600)) / 60));
|
||||
if ($minutes < 10)
|
||||
$minutes = "0" . round($minutes);
|
||||
$secondes = round($temps - ($heures * 3600) - ($minutes * 60));
|
||||
if ($secondes < 10)
|
||||
$secondes = "0" . round($secondes);
|
||||
return $minutes . ':' . $secondes;
|
||||
}
|
||||
function SetTime($sec, $padHours = true) {
|
||||
|
||||
if($sec < 3600)
|
||||
return old_set_time($sec);
|
||||
|
||||
$hms = "";
|
||||
|
||||
// there are 3600 seconds in an hour, so if we
|
||||
// divide total seconds by 3600 and throw away
|
||||
// the remainder, we've got the number of hours
|
||||
$hours = intval(intval($sec) / 3600);
|
||||
|
||||
// add to $hms, with a leading 0 if asked for
|
||||
$hms .= ($padHours)
|
||||
? str_pad($hours, 2, "0", STR_PAD_LEFT). ':'
|
||||
: $hours. ':';
|
||||
|
||||
// dividing the total seconds by 60 will give us
|
||||
// the number of minutes, but we're interested in
|
||||
// minutes past the hour: to get that, we need to
|
||||
// divide by 60 again and keep the remainder
|
||||
$minutes = intval(($sec / 60) % 60);
|
||||
|
||||
// then add to $hms (with a leading 0 if needed)
|
||||
$hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ':';
|
||||
|
||||
// seconds are simple - just divide the total
|
||||
// seconds by 60 and keep the remainder
|
||||
$seconds = intval($sec % 60);
|
||||
|
||||
// add to $hms, again with a leading 0 if needed
|
||||
$hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
|
||||
|
||||
return $hms;
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @Author : Fawaz Tahir and Arslan Hassan
|
||||
*/
|
||||
|
||||
include('../includes/config.inc.php');
|
||||
$mode = mysql_clean($_POST['mode']);
|
||||
|
||||
switch ($mode) {
|
||||
case 'a': case 'add': case 'add_tag': case 'addTag': {
|
||||
/* ADDING NEW TAG
|
||||
* First check if user is logged-in or not
|
||||
* Yes, then check if value entered is actually a user or not.
|
||||
* If it is a user then check if this user is a confirmed friend or not
|
||||
* Yes it is confirmed friend, add tag with user profile link and remove link
|
||||
* No it not a confirmed friend, add tag with remove link
|
||||
*
|
||||
* No entered value is not a user, add new tag with remove link
|
||||
*
|
||||
* THINGS TO UPDATE
|
||||
* - IF VALUE IS USER
|
||||
* --- update user column in which photo id's, in json format, reside which shows on what photos this user was tagged: COLUMN|
|
||||
*/
|
||||
if( !userid() ) {
|
||||
echo json_encode( array('error' => true, 'error_message' => lang('You must be login to add photo tags') ) );
|
||||
} else {
|
||||
$clean_post = array();
|
||||
foreach( $_POST as $key => $value ) {
|
||||
if ( $key != 'label' ) {
|
||||
$value = mysql_clean($value);
|
||||
}
|
||||
$clean_post[$key] = ($value);
|
||||
}
|
||||
$tag_id = $cbphoto->add_new_tag( $clean_post );
|
||||
if(!error()) {
|
||||
$tag = $cbphoto->get_tag_with_id( $tag_id , $clean_post['pid'] );
|
||||
$clean_post['success'] = true;
|
||||
$clean_post['id'] = $tag['ptag_id'];
|
||||
$clean_post['canDelete'] = true;
|
||||
if ( $tag['ptag_active'] == 'no' ) {
|
||||
$clean_post['pending'] = true;
|
||||
}
|
||||
if ( $tag['ptag_isuser'] == 1 && $tag['ptag_isfriend'] == 1 ) {
|
||||
$clean_post['link'] = $userquery->profile_link( $tag['ptag_userid'] ) ;
|
||||
}
|
||||
|
||||
if ( $tag['ptag_by_userid'] == $tag['ptag_userid'] && $tag['ptag_userid'] == userid() ) {
|
||||
$clean_post['link'] = $userquery->profile_link( $tag['ptag_userid'] );
|
||||
}
|
||||
echo json_encode( $clean_post );
|
||||
} else {
|
||||
$msg = error_list();
|
||||
$msg = $msg[0];
|
||||
echo json_encode(array('error' => true, 'error_message' => $msg));
|
||||
}
|
||||
//echo json_encode( array('error' => true, 'error_message' => lang('unable_to_tag') ) );
|
||||
}
|
||||
}break;
|
||||
|
||||
case 'r': case 'remove': case 'remove_tag': case 'removeTag':{
|
||||
$tag_id = mysql_clean($_POST['id']);
|
||||
$return = $cbphoto->remove_photo_tag($tag_id);
|
||||
if (!error()) {
|
||||
echo json_encode(array('success' => true));
|
||||
} else {
|
||||
$msg = error_list();
|
||||
$msg = $msg[0];
|
||||
echo json_encode(array('error' => true, 'error_message' => $msg));
|
||||
}
|
||||
}break;
|
||||
|
||||
default:
|
||||
echo json_encode( array('error' => true, 'error_message' => lang('unable_to_tag_due_to_issue') ) );
|
||||
break;
|
||||
}
|
||||
?>
|
|
@ -1,310 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @Author : Fawaz Tahir, Arslan Hassan
|
||||
*/
|
||||
|
||||
include('../includes/config.inc.php');
|
||||
|
||||
//die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
|
||||
|
||||
if ( $_REQUEST['upload'] == 'yes' ) {
|
||||
$mode = 'upload_photo';
|
||||
}
|
||||
|
||||
if($_FILES['photoUpload'])
|
||||
$mode = "uploadPhoto";
|
||||
if($_POST['photoForm'])
|
||||
$mode = "get_photo_form";
|
||||
if($_POST['insertPhoto'])
|
||||
$mode = "insert_photo";
|
||||
if($_POST['updatePhoto'])
|
||||
$mode = "update_photo";
|
||||
if($_POST['test_mode'])
|
||||
$mode = "test_mode";
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case "get_photo_form":
|
||||
{
|
||||
$name = getName($_POST['name']);
|
||||
if(!$name)
|
||||
$name = $_POST['name'];
|
||||
$desc = $name;
|
||||
$tags = $name;
|
||||
$collection = $_POST['collection'];
|
||||
$photoArray = array
|
||||
(
|
||||
"photo_title" => $name,
|
||||
"photo_description" => $name,
|
||||
"photo_tags" => $name,
|
||||
"collection_id" => $collection
|
||||
);
|
||||
assign("uniqueID",$_POST['objID']);
|
||||
assign("photoArray",$photoArray);
|
||||
$form = Fetch("/blocks/upload/photo_form.html");
|
||||
echo json_encode(array("form"=>$form));
|
||||
}
|
||||
break;
|
||||
case "insert_photo":
|
||||
{
|
||||
$_POST['photo_title'] = genTags(str_replace(array('_','-'),' ',$_POST['photo_title']));
|
||||
$_POST['photo_description'] = genTags(str_replace(array('_','-'),' ',$_POST['photo_description']));
|
||||
$_POST['photo_tags'] = genTags(str_replace(array(' ','_','-'),', ',$_POST['photo_tags']));
|
||||
$_POST['server_url'] = mysql_clean($_POST['server_url']);
|
||||
$_POST['folder'] = str_replace('..','',mysql_clean($_POST['folder']));
|
||||
|
||||
$insert_id = $cbphoto->insert_photo();
|
||||
|
||||
if(error())
|
||||
$response['error'] = error('single');
|
||||
if(msg())
|
||||
{
|
||||
$response['success'] = msg('single');
|
||||
$response['photoID'] = $insert_id;
|
||||
|
||||
$details = $cbphoto->get_photo($insert_id);
|
||||
$params = array("details"=>$details,"size"=>"l");
|
||||
$response['photoPreview'] = get_photo($params);
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
case "update_photo":
|
||||
{
|
||||
$_POST['photo_title'] = genTags(str_replace(array('_','-'),' ',$_POST['photo_title']));
|
||||
$_POST['photo_description'] = genTags(str_replace(array('_','-'),' ',$_POST['photo_description']));
|
||||
$_POST['photo_tags'] = genTags(str_replace(array(' ','_','-'),', ',$_POST['photo_tags']));
|
||||
|
||||
$cbphoto->update_photo();
|
||||
|
||||
if(error())
|
||||
$error = error('single');
|
||||
if(msg())
|
||||
$success = msg('single');
|
||||
|
||||
$updateResponse['error'] = $error;
|
||||
$updateResponse['success'] = $success;
|
||||
|
||||
echo json_encode($updateResponse);
|
||||
}
|
||||
break;
|
||||
case "uploadPhoto":
|
||||
{
|
||||
$exts = $cbphoto->exts;
|
||||
$max_size = 1048576; // 2MB in bytes
|
||||
$form = "photoUpload";
|
||||
$path = PHOTOS_DIR."/";
|
||||
|
||||
// These are found in $_FILES. We can access them like $_FILES['file']['error'].
|
||||
$upErrors = array(
|
||||
0 => "There is no error, the file uploaded with success.",
|
||||
1 => "The uploaded file exceeds the upload_max_filesize directive in php.ini.",
|
||||
2 => " The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.",
|
||||
3 => "The uploaded file was only partially uploaded.",
|
||||
4 => "No file was uploaded.",
|
||||
6 => "Missing a temporary folder.",
|
||||
7 => "Failed to write file to disk."
|
||||
);
|
||||
|
||||
// Let's see if everything is working fine by checking $_FILES.
|
||||
if(!isset($_FILES[$form])) {
|
||||
upload_error("No upload found in \$_FILES for " . $form);
|
||||
exit(0);
|
||||
}
|
||||
elseif(isset($_FILES[$form]['error']) && $_FILES[$form]['error'] != 0) {
|
||||
upload_error($upErrors[$_FILES[$form]['error']]);
|
||||
exit(0);
|
||||
}
|
||||
elseif(!isset($_FILES[$form]["tmp_name"]) || !@is_uploaded_file($_FILES[$form]["tmp_name"])) {
|
||||
upload_error("Upload failed is_uploaded_file test.");
|
||||
exit(0);
|
||||
} elseif(empty($_FILES[$form]['name'])) {
|
||||
upload_error("File name is empty");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Time to check if Filesize is according to demands
|
||||
//$filesize = filesize($_FILES[$form]['tmp_name']);
|
||||
//if(!$filesize || $filesize > $max_size)
|
||||
//{
|
||||
// upload_error("File exceeds the maximum allowed size");
|
||||
// exit(0);
|
||||
//}
|
||||
//
|
||||
//if($filesize < 0)
|
||||
//{
|
||||
// upload_error("File size outside allowed lower bound");
|
||||
// exit(0);
|
||||
//}
|
||||
|
||||
//Checking Extension of File
|
||||
$info = pathinfo($_FILES[$form]['name']);
|
||||
$extension = strtolower($info['extension']);
|
||||
$valid_extension = false;
|
||||
|
||||
foreach ($exts as $ext) {
|
||||
if (strcasecmp($extension, $ext) == 0) {
|
||||
$valid_extension = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$valid_extension)
|
||||
{
|
||||
upload_error("Invalid file extension");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$filename = $cbphoto->create_filename();
|
||||
$date_dir = createDateFolder( PHOTOS_DIR ).'/';
|
||||
|
||||
//Now uploading the file
|
||||
if(move_uploaded_file($_FILES[$form]['tmp_name'],$path.$date_dir.$filename.".".$extension))
|
||||
{
|
||||
echo json_encode(array("success"=>"yes","filename"=>$filename,"extension"=>$extension));
|
||||
|
||||
} else {
|
||||
upload_error("File could not be saved.");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'upload_photo': {
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
$targetDir = PHOTOS_DIR;
|
||||
$date_folders = createDataFolders();
|
||||
$targetDir .= '/'.$date_folders;
|
||||
|
||||
$cleanupTargetDir = true; // Remove old files
|
||||
$maxFileAge = 5 * 3600; // Temp file age in seconds
|
||||
@set_time_limit(5 * 60);
|
||||
|
||||
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
|
||||
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
|
||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||
|
||||
// Clean the fileName for security reasons
|
||||
$fileName = preg_replace('/[^\w\._]+/', '_', $fileName);
|
||||
|
||||
// Make sure the fileName is unique but only if chunking is disabled
|
||||
if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
|
||||
$ext = strrpos($fileName, '.');
|
||||
$fileName_a = substr($fileName, 0, $ext);
|
||||
$fileName_b = substr($fileName, $ext);
|
||||
|
||||
$count = 1;
|
||||
while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName_a . '_' . $count . $fileName_b))
|
||||
$count++;
|
||||
|
||||
$fileName = $fileName_a . '_' . $count . $fileName_b;
|
||||
}
|
||||
|
||||
$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
// Create target dir
|
||||
if ( !file_exists( $targetDir ) ) {
|
||||
@mkdir( $targetDir );
|
||||
}
|
||||
|
||||
// Remove old temp files
|
||||
if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
|
||||
while (($file = readdir($dir)) !== false) {
|
||||
$tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
|
||||
|
||||
// Remove temp file if it is older than the max age and is not the current file
|
||||
if (preg_match('/\.part$/', $file) && (filemtime($tmpfilePath) < time() - $maxFileAge) && ($tmpfilePath != "{$filePath}.part")) {
|
||||
@unlink($tmpfilePath);
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dir);
|
||||
} else {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
|
||||
}
|
||||
|
||||
// Look for the content type header
|
||||
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
|
||||
|
||||
if (isset($_SERVER["CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["CONTENT_TYPE"];
|
||||
|
||||
// Handle non multipart uploads older WebKit versions didn't support multipart in HTML5
|
||||
if (strpos($contentType, "multipart") !== false) {
|
||||
if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
|
||||
// Open temp file
|
||||
$out = fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
|
||||
if ($out) {
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen($_FILES['file']['tmp_name'], "rb");
|
||||
|
||||
if ($in) {
|
||||
while ($buff = fread($in, 4096))
|
||||
fwrite($out, $buff);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
|
||||
fclose($in);
|
||||
fclose($out);
|
||||
@unlink($_FILES['file']['tmp_name']);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
|
||||
} else {
|
||||
// Open temp file
|
||||
$out = fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
|
||||
if ($out) {
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen("php://input", "rb");
|
||||
|
||||
if ($in) {
|
||||
while ($buff = fread($in, 4096))
|
||||
fwrite($out, $buff);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
|
||||
|
||||
fclose($in);
|
||||
fclose($out);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
|
||||
}
|
||||
|
||||
// Check if file has been uploaded
|
||||
if (!$chunks || $chunk == $chunks - 1) {
|
||||
// Strip the temp .part suffix off
|
||||
rename("{$filePath}.part", $filePath);
|
||||
}
|
||||
|
||||
$file_name = cb_filename(); $extension = GetExt( $fileName );
|
||||
$filename = $file_name.'.'.$extension;
|
||||
$path = PHOTOS_DIR.'/'.$date_folders.'/'.$filename;
|
||||
|
||||
rename( $filePath, $path );
|
||||
|
||||
echo json_encode( array('success' => 'yes', 'file_directory' => $date_folders, 'filename' => $file_name, 'extension' => $extension ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'test_mode': {
|
||||
pr( $_POST, true );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//function used to display error
|
||||
function upload_error($error)
|
||||
{
|
||||
echo json_encode(array("error"=>$error));
|
||||
}
|
||||
?>
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* File use to process video files
|
||||
*
|
||||
* @Author : Arslan Hassan
|
||||
* @Software : ClipBucket
|
||||
* @License : Attribution Assurance License -- http://www.opensource.org/licenses/attribution.php
|
||||
* @Since : July 3 2009
|
||||
*/
|
||||
|
||||
include(dirname(__FILE__)."/../includes/config.inc.php");
|
||||
|
||||
|
||||
//Get vid
|
||||
$vid = $_SERVER['argv'][1];
|
||||
|
||||
//Check video exists or not
|
||||
|
||||
if($myquery->video_exists($vid))
|
||||
{
|
||||
//Get Video Details
|
||||
//$vdetails = $myquery->get_video_details($vid);
|
||||
$Upload->do_after_video_upload($vid);
|
||||
|
||||
}else{
|
||||
e(lang("class_vdo_del_err"));
|
||||
}
|
||||
?>
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* this file is used to send subscription email
|
||||
* @Author : Arslan Hassan
|
||||
* @Date : 2/24/2011
|
||||
*/
|
||||
|
||||
$in_bg_cron = true;
|
||||
|
||||
include(dirname(dirname(__FILE__))."/includes/config.inc.php");
|
||||
|
||||
$videoid = $argv[1];
|
||||
|
||||
$video = $cbvid->get_video($videoid);
|
||||
|
||||
if($video)
|
||||
{
|
||||
|
||||
if(
|
||||
($video['broadcast']=='public' || $video['broadcast'] =="logged")
|
||||
&& $video['subscription_email']=='pending')
|
||||
|
||||
$userquery->sendSubscriptionEmail($video,true);
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,91 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This class is used to update clipbucket daily stats
|
||||
*/
|
||||
|
||||
$in_bg_cron = true;
|
||||
|
||||
//including config file..
|
||||
include(dirname(__FILE__)."/../includes/config.inc.php");
|
||||
|
||||
//Calling Cron Functions
|
||||
cb_call_functions('update_cb_stats_cron');
|
||||
|
||||
|
||||
//Now Gathering All Data
|
||||
$date = date("Y-m-d");
|
||||
|
||||
//Videos
|
||||
$videos['uploads'] = $cbvid->get_videos(array("count_only"=>true,"date_span"=>"today"),TRUE);
|
||||
$videos['processing'] = $cbvid->get_videos(array("count_only"=>true,"status"=>"Processing","date_span"=>"today"),TRUE);
|
||||
$videos['active'] = $cbvid->get_videos(array("count_only"=>true,"active"=>"yes","date_span"=>"today"),TRUE);
|
||||
//Views
|
||||
$vid_views = $db->select(tbl("video"),"SUM(views) as total_views"," date_added LIKE '%$date%'");
|
||||
$videos['views'] = $vid_views[0]['total_views'];
|
||||
//Total Comments
|
||||
$vid_comments = $db->select(tbl("video"),"SUM(comments_count) as total_comments"," date_added LIKE '%$date%'");
|
||||
$videos['comments'] = $vid_comments[0]['total_comments'];
|
||||
|
||||
|
||||
/**
|
||||
* Testing
|
||||
* * PASSED
|
||||
*/
|
||||
echo json_encode($videos);
|
||||
|
||||
|
||||
//Users
|
||||
$users['signups'] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today"));
|
||||
$users['inactive'] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today","status"=>'ToActivate'));
|
||||
$users['active'] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today","status"=>'Ok'));
|
||||
//Views
|
||||
$user_views = $db->select(tbl("users"),"SUM(profile_hits) as total_views"," doj LIKE '%$date%'");
|
||||
$users['views'] = $user_views[0]['total_views'];
|
||||
//Total Comments
|
||||
$user_comments = $db->select(tbl("users"),"SUM(comments_count) as total_comments"," doj LIKE '%$date%'");
|
||||
$users['comments'] = $user_comments[0]['total_comments'];
|
||||
|
||||
|
||||
/**
|
||||
* Testing
|
||||
* echo json_encode($users);
|
||||
* PASSED
|
||||
*/
|
||||
|
||||
|
||||
//Groups
|
||||
$groups['created'] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"today"));
|
||||
$groups['active'] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"today","active"=>"yes"));
|
||||
//Total Views
|
||||
$group_views = $db->select(tbl("groups"),"SUM(total_views) as the_views"," date_added LIKE '%$date%'");
|
||||
$groups['views'] = $group_views[0]['the_views'];
|
||||
//Total Discussion
|
||||
$group_topics = $db->select(tbl("groups"),"SUM(total_topics) as the_topics"," date_added LIKE '%$date%'");
|
||||
$groups['total_topics'] = $group_topics[0]['the_topics'];
|
||||
//TOtal Comments
|
||||
$group_discussions = $db->select(tbl("group_topics"),"SUM(total_replies) as the_discussions"," date_added LIKE '%$date%'");
|
||||
$groups['total_discussions'] = $group_discussions[0]['the_discussions'];
|
||||
|
||||
/**
|
||||
* TESTING GROUPS
|
||||
* echo json_encode($groups);
|
||||
* PASSED
|
||||
*/
|
||||
|
||||
$fields = array('video_stats','user_stats','group_stats');
|
||||
$values = array('|no_mc|'.json_encode($videos),'|no_mc|'.json_encode($users),'|no_mc|'.json_encode($groups));
|
||||
|
||||
//Checking If there is already a row of the same date, then update it otherwise insert data
|
||||
$result = $db->select(tbl("stats"),"stat_id"," date_added LIKE '%$date%'");
|
||||
if($db->num_rows>0)
|
||||
{
|
||||
$result = $result[0];
|
||||
$db->update(tbl("stats"),$fields,$values," stat_id='".$result['stat_id']."'");
|
||||
}else
|
||||
{
|
||||
$fields[] = 'date_added';
|
||||
$values[] = $date;
|
||||
$db->insert(tbl("stats"),$fields,$values);
|
||||
}
|
||||
?>
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Written by : Arslan Hassan
|
||||
* Software : ClipBucket v2
|
||||
* License : Attribution Assurance License -- http://www.opensource.org/licenses/attribution.php
|
||||
**/
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->login_check('admin_access');
|
||||
|
||||
if($_POST['update_player_size']=='yes')
|
||||
{
|
||||
$height = mysql_clean($_POST['height']);
|
||||
$width = mysql_clean($_POST['width']);
|
||||
$config_name = mysql_clean($_POST['width']);
|
||||
if(!is_numeric($height) || $height <=100)
|
||||
$height = 100;
|
||||
if(!is_numeric($width) || $width <=100)
|
||||
$width = 100;
|
||||
$myquery->Set_Website_Details('player_height',$height);
|
||||
$myquery->Set_Website_Details('player_width',$width);
|
||||
echo "Player size has been updated";
|
||||
}
|
||||
if($_POST['update_channel_player_size']=='yes')
|
||||
{
|
||||
$height = mysql_clean($_POST['height']);
|
||||
$width = mysql_clean($_POST['width']);
|
||||
$config_name = mysql_clean($_POST['width']);
|
||||
if(!is_numeric($height) || $height <=100)
|
||||
$height = 100;
|
||||
if(!is_numeric($width) || $width <=100)
|
||||
$width = 100;
|
||||
$myquery->Set_Website_Details('channel_player_height',$height);
|
||||
$myquery->Set_Website_Details('channel_player_width',$width);
|
||||
echo "Channel Player size has been updated";
|
||||
}
|
||||
?>
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is used to update
|
||||
* language phrases
|
||||
* Author : Arslan Hassan
|
||||
* Since : 10 Aug, 2009
|
||||
*/
|
||||
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
|
||||
$phrase_id = $_POST['id'];
|
||||
$value = $_POST['value'];
|
||||
|
||||
$lang_obj->update_phrase($phrase_id,'|no_mc|'.$value);
|
||||
|
||||
echo ($value);
|
||||
?>
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is used to verify weather video is converted or not
|
||||
* if it is converted then activate it and let it go
|
||||
*/
|
||||
//Sleeping..
|
||||
//sometimes video is inserted after video conversion so in this case, video can get lost
|
||||
//if($argv[2]=='sleep')
|
||||
sleep(10);
|
||||
|
||||
$in_bg_cron = true;
|
||||
|
||||
include(dirname(__FILE__) . "/../includes/config.inc.php");
|
||||
|
||||
cb_call_functions('verify_converted_videos_cron');
|
||||
|
||||
if ($argv[1])
|
||||
$fileName = $argv[1];
|
||||
else
|
||||
$fileName = false;
|
||||
|
||||
$files = get_video_being_processed($fileName);
|
||||
pr($files,true);
|
||||
if (is_array($files))
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$file_details = get_file_details($file['cqueue_name']);
|
||||
//pr($file_details);
|
||||
//Thanks to pandusetiawan @ forums.clip-bucket.com
|
||||
|
||||
if ($file_details['conversion_status'] == 'failed' or strpos($file_details['conversion_log'], 'conversion_status : failed') > 0)
|
||||
{
|
||||
|
||||
$db->update(tbl("conversion_queue"), array("cqueue_conversion"), array("yes"), " cqueue_id = '" . $file['cqueue_id'] . "'");
|
||||
update_processed_video($file, 'Failed', $ffmpeg->failed_reason);
|
||||
|
||||
/**
|
||||
* Calling Functions after converting Video
|
||||
*/
|
||||
if (get_functions('after_convert_functions'))
|
||||
{
|
||||
foreach (get_functions('after_convert_functions') as $func)
|
||||
{
|
||||
if (@function_exists($func))
|
||||
$func($file_details);
|
||||
}
|
||||
}
|
||||
}elseif ($file_details['conversion_status'] == 'completed' or strpos($file_details['conversion_log'], 'conversion_status : completed') > 0)
|
||||
{
|
||||
|
||||
$db->update(tbl("conversion_queue"), array("cqueue_conversion", "time_completed"), array("yes", time()), " cqueue_id = '" . $file['cqueue_id'] . "'");
|
||||
|
||||
|
||||
update_processed_video($file, 'Successful');
|
||||
|
||||
|
||||
/**
|
||||
* Calling Functions after converting Video
|
||||
*/
|
||||
if (get_functions('after_convert_functions'))
|
||||
{
|
||||
foreach (get_functions('after_convert_functions') as $func)
|
||||
{
|
||||
if (@function_exists($func))
|
||||
$func($file_details);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Sending Subscription Emails
|
||||
$videoDetails = $cbvideo->get_video($file['cqueue_name'], true);
|
||||
if ($videoDetails)
|
||||
{
|
||||
if (($videoDetails['broadcast'] == 'public' ||
|
||||
$videoDetails['logged']) &&
|
||||
$videoDetails['active'] == 'yes')
|
||||
{
|
||||
$userquery->sendSubscriptionEmail($videoDetails, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,134 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is used to verify weather video is converted or not
|
||||
* if it is converted then activate it and let it go
|
||||
*/
|
||||
//Sleeping..
|
||||
//sometimes video is inserted after video conversion so in this case, video can get lost
|
||||
//if($argv[2]=='sleep')
|
||||
//sleep(10);
|
||||
|
||||
$in_bg_cron = true;
|
||||
|
||||
include(dirname(__FILE__) . "/../includes/config.inc.php");
|
||||
|
||||
cb_call_functions('verify_converted_videos_cron');
|
||||
|
||||
if ($argv[1])
|
||||
$filename = $argv[1];
|
||||
else if ($_GET['filename'])
|
||||
$filename = $_GET['filename'];
|
||||
else
|
||||
$filename = false;
|
||||
|
||||
$queues = get_video_being_processed($filename);
|
||||
|
||||
foreach ($queues as $video)
|
||||
{
|
||||
$files = $video['files'];
|
||||
$videoid = $video['videoid'];
|
||||
|
||||
|
||||
//Deactivating the queue..in case its completed and active..
|
||||
if($video['queue_status']=='s')
|
||||
{
|
||||
$cbupload->deactivate_queue($video['file_name']);
|
||||
}
|
||||
|
||||
//Checking if video was in processing state then change its status
|
||||
//to something reliable..
|
||||
|
||||
$video_status = $video['status'];
|
||||
|
||||
if ($video_status == 'Processing')
|
||||
{
|
||||
if($files)
|
||||
foreach ($files as $file)
|
||||
{
|
||||
if ($file['status'] == 's' && $file['is_original'] == 'no')
|
||||
{
|
||||
|
||||
$video_status = 'Successful';
|
||||
update_video_status($video['file_name'], $video_status);
|
||||
|
||||
if ($video['duration'] < 1)
|
||||
{
|
||||
$output_results = json_decode($file['output_results'], true);
|
||||
$duration = $output_results['duration'];
|
||||
|
||||
//Update video details..
|
||||
update_video_data($videoid,'duration', $duration);
|
||||
$video['duration'] = $duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Now if video status is still not successful
|
||||
//Let us look if it has failed for some reason...
|
||||
if($files)
|
||||
foreach ($files as $file)
|
||||
{
|
||||
if ($file['status'] == 'f' && $file['is_original'] == 'no')
|
||||
{
|
||||
$video_status = 'Failed';
|
||||
$failed_reason = 'Video failed in conversion';
|
||||
update_video_status($video['file_name'], $video_status, $failed_reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($video_status == 'Successful')
|
||||
{
|
||||
if ($video['subscription_email'] == 'pending')
|
||||
{
|
||||
//Send emails...even queue then in subscription so we can
|
||||
//Send them later..
|
||||
//For now..we will use our old method..
|
||||
exec(php_path() . " -q "
|
||||
. BASEDIR . "/actions/send_subscription_email.php $videoid &> /dev/null &");
|
||||
}
|
||||
|
||||
|
||||
//Just incase...video duration is not updated...
|
||||
if ($video['duration'] < 1)
|
||||
|
||||
if($files)
|
||||
foreach ($files as $file)
|
||||
{
|
||||
if ($file['status'] == 's' && $file['is_original'] == 'no')
|
||||
{
|
||||
|
||||
$video_status = 'Successful';
|
||||
update_video_status($video['file_name'], $video_status);
|
||||
|
||||
$output_results = json_decode($file['output_results'], true);
|
||||
$duration = $output_results['duration'];
|
||||
|
||||
//Update video details..
|
||||
update_video_data($videoid,'duration', $duration);
|
||||
|
||||
if ($duration)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($video_status == 'Failed')
|
||||
{
|
||||
//Send some sad emails to the uploader
|
||||
//That we could not do anything, we are sorry :'(
|
||||
}
|
||||
|
||||
|
||||
if (get_functions('after_convert_functions'))
|
||||
{
|
||||
foreach (get_functions('after_convert_functions') as $func)
|
||||
{
|
||||
if (@function_exists($func))
|
||||
$func($video);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,210 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @Author : Arslan Hassan
|
||||
* @Since : 2012
|
||||
* @version : 3.0
|
||||
*/
|
||||
$in_bg_cron = true;
|
||||
|
||||
|
||||
//Including new conversion kit, called cb kit.
|
||||
include("../includes/config.inc.php");
|
||||
include("../includes/classes/conversion/conversion.class.php");
|
||||
|
||||
//Initializing new conversio kit
|
||||
$cb_converter = new CBConverter();
|
||||
|
||||
$max_processes = 5;
|
||||
|
||||
//Get Vido
|
||||
$queued_files = $cbupload->get_queued_files();
|
||||
|
||||
define('CONV_TEST_MODE', false);
|
||||
|
||||
//Total Running proccesses...
|
||||
$process_running = $cbupload->conversion_count();
|
||||
|
||||
if ($process_running <= $max_processes && $queued_files)
|
||||
{
|
||||
foreach ($queued_files as $queue)
|
||||
{
|
||||
//Creating dated folders
|
||||
$folder = $queue['file_directory'];
|
||||
|
||||
$original_source = ORIGINAL_DIR . '/' . $folder . '/' . $queue['queue_name'] . '.'
|
||||
. $queue['queue_ext'];
|
||||
|
||||
$temp_source = TEMP_DIR . '/' . $queue['queue_name'] . '.' . $queue['queue_tmp_ext'];
|
||||
|
||||
if (!file_exists($original_source))
|
||||
{
|
||||
|
||||
if (CONV_TEST_MODE)
|
||||
copy($temp_source, $original_source);
|
||||
else
|
||||
rename($temp_source, $original_source);
|
||||
|
||||
if (!file_exists($original_source))
|
||||
{
|
||||
echo "Cannot make use of original file...(Err 1)";
|
||||
$cbupload->update_queue_status($queue, 's', 'Cannot make use of original file...(Err 1)');
|
||||
}
|
||||
else
|
||||
{
|
||||
//Get source information using ffmpeg and save it in our
|
||||
//video file database..
|
||||
$video_info = $cb_converter->getInfo($original_source);
|
||||
|
||||
if ($video_info['has_video'] == 'no')
|
||||
{
|
||||
$cbupload->update_queue_status($queue, 'f', 'Invalid video file');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!CONV_TEST_MODE)
|
||||
$cbupload->add_video_file($queue, $video_info, 's');
|
||||
|
||||
$cbupload->update_queue_status($queue, 'started', 'Video info extracted');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($original_source))
|
||||
{
|
||||
|
||||
$video_profiles = $cbvid->get_video_profiles();
|
||||
$convert = false;
|
||||
foreach ($video_profiles as $vid_profile)
|
||||
{
|
||||
if (!$cbupload->video_file_exists($queue['queue_name'], $queue['queue_id'], $vid_profile['profile_id']))
|
||||
{
|
||||
|
||||
$convert = true;
|
||||
|
||||
$output_name = $queue['queue_name'] . $vid_profile['suffix'] . '.' . $vid_profile['ext'];
|
||||
$output_file = VIDEOS_DIR . '/' . $folder . '/' . $output_name;
|
||||
|
||||
$log_file = $folder . '/' . $queue['queue_name'] . $vid_profile['suffix'] . '-' . $vid_profile['ext'] . '.log';
|
||||
|
||||
|
||||
if (!CONV_TEST_MODE)
|
||||
$fid = $cbupload->add_video_file($queue, array('noinfo'), 'p', $vid_profile['profile_id'], $log_file);
|
||||
|
||||
if (!CONV_TEST_MODE)
|
||||
$cbupload->update_queue_status($queue, 'u', 'Started conversion using Profile # ' . $vid_profile['profile_id'], true);
|
||||
|
||||
$log_file = LOGS_DIR . '/' . $log_file;
|
||||
|
||||
/** All of our new conversion code is written here * */
|
||||
$converter = new CBConverter($original_source);
|
||||
//$converter->set_preset_path('D:\usr\local\share\ffmpeg');
|
||||
$converter->set_log($log_file);
|
||||
|
||||
|
||||
/** AS $converter is already being initited, its
|
||||
* good to check for thumbs and if they are not
|
||||
* generated, we should extract them first before
|
||||
* we move on for next step
|
||||
*/
|
||||
if (!hasThumbs($queue))
|
||||
{
|
||||
if (!CONV_TEST_MODE)
|
||||
$cbupload->update_queue_status($queue, 'u', 'Generating thumbs...', false);
|
||||
|
||||
//Generate thumbnails first...then move on..
|
||||
$thumb_sizes = get_thumb_sizes();
|
||||
$thumbs_dir = THUMBS_DIR . '/' . $folder;
|
||||
|
||||
if ($thumb_sizes)
|
||||
{
|
||||
foreach ($thumb_sizes as $thumb_size)
|
||||
{
|
||||
$size = $thumb_size;
|
||||
$suffix = $size;
|
||||
|
||||
$outname = $queue['queue_name'] . '-' . $suffix;
|
||||
|
||||
if (!CONV_TEST_MODE)
|
||||
$cbupload->update_queue_status($queue, 'u', 'Extacting ' . $outname, false);
|
||||
|
||||
//Using Multi Thumb Gen function..
|
||||
//$converter = new CBConverter($original_source);
|
||||
$converter->extractThumb(NULL, array(
|
||||
'size' => $size,
|
||||
'num' => 5,
|
||||
'increment' => true,
|
||||
'outname' => $outname,
|
||||
'outdir' => $thumbs_dir,
|
||||
'resize' => 'fit'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
//Index thumb..
|
||||
$cbvid->index_video_thumbs($queue['queue_name']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @todo : Add Filters for this params
|
||||
*/
|
||||
$twoPass = false;
|
||||
if ($vid_profile['2pass'] == 'yes')
|
||||
$twoPass = true;
|
||||
|
||||
|
||||
$params = array(
|
||||
'format' => $vid_profile['format'],
|
||||
'output_file' => $output_file,
|
||||
'preset' => $vid_profile['preset'],
|
||||
'height' => $vid_profile['height'],
|
||||
'width' => $vid_profile['width'],
|
||||
'resize' => $vid_profile['resize'],
|
||||
'bitrate' => $vid_profile['video_bitrate'],
|
||||
'aspect_ratio' => $vid_profile['aspect_ratio'],
|
||||
'arate' => $vid_profile['audio_rate'],
|
||||
'fps' => $vid_profile['video_rate'],
|
||||
'abitrate' => $vid_profile['audio_bitrate'],
|
||||
'2pass' => $twoPass,
|
||||
);
|
||||
|
||||
|
||||
$converter->convert($params);
|
||||
$output_details = $converter->getInfo($output_file);
|
||||
$time_finished = time();
|
||||
$log = $converter->log();
|
||||
|
||||
$fields = array(
|
||||
'log' => json_encode($log),
|
||||
'status' => 's',
|
||||
'output_results' => json_encode($output_details),
|
||||
'date_completed' => $time_finished,
|
||||
);
|
||||
|
||||
|
||||
|
||||
$cbupload->update_video_file($fid, $fields);
|
||||
|
||||
unset($converter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$file_name = $queue['queue_name'];
|
||||
|
||||
if($file_name)
|
||||
exec(php_path() . " -q " . BASEDIR . "/actions/verify_videos.php $file_name &> /dev/null &");
|
||||
|
||||
|
||||
if (!$convert)
|
||||
{
|
||||
$cbupload->update_queue_status($queue, 's', 'File removed from queue');
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
**************************************************************
|
||||
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.
|
||||
| @ Author : ArslanHassan
|
||||
| @ Software : ClipBucket , © PHPBucket.com
|
||||
****************************************************************
|
||||
*/
|
||||
|
||||
define("THIS_PAGE","activation");
|
||||
define("PARENT_PAGE",'signup');
|
||||
|
||||
|
||||
require 'includes/config.inc.php';
|
||||
|
||||
if($userquery->udetails['usr_status']=='Ok'){
|
||||
redirect_to(BASEURL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Activating user account
|
||||
*/
|
||||
if(isset($_REQUEST['av_username']) || isset($_POST['activate_user']))
|
||||
{
|
||||
$user = mysql_clean($_REQUEST['av_username']);
|
||||
$avcode = mysql_clean($_REQUEST['avcode']);
|
||||
$userquery->activate_user_with_avcode($user,$avcode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Requesting Activation Code
|
||||
*/
|
||||
|
||||
if(isset($_POST['request_avcode']))
|
||||
{
|
||||
$email = mysql_clean($_POST['av_email']);
|
||||
$userquery->send_activation_code($email);
|
||||
}
|
||||
|
||||
|
||||
template_files('activation.html');
|
||||
display_it();
|
||||
?>
|
|
@ -1,83 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
****************************************************************************
|
||||
| Copyright (c) 2007-2012 Clip-Bucket.com. All rights reserved.
|
||||
| @ Author : ArslanHassan
|
||||
| @ Software : ClipBucket , <EFBFBD> PHPBucket.com
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
define("THIS_PAGE","add_group_videos");
|
||||
define("PARENT_PAGE","groups");
|
||||
|
||||
require 'includes/config.inc.php';
|
||||
$pages->page_redir();
|
||||
|
||||
$url = mysql_clean($_GET['url']);
|
||||
|
||||
$details = $cbgroup->group_details_url($url);
|
||||
|
||||
//Group links
|
||||
$group_links = $cbgroup->group_links($details);
|
||||
assign('group_links',$group_links);
|
||||
|
||||
assign('group',$details);
|
||||
|
||||
|
||||
if(!$details)
|
||||
e(lang("grp_exist_error"));
|
||||
elseif(!$cbgroup->is_viewable($details))
|
||||
$Cbucket->show_page = false;
|
||||
elseif(!$cbgroup->is_member(userid(),$details['group_id']))
|
||||
e(lang("you_not_allowed_add_grp_vids"));
|
||||
else
|
||||
{
|
||||
|
||||
$add_group_videos = 24;
|
||||
$add_group_videos = apply_filters($add_group_videos, 'add_group_videos_limit');
|
||||
///Getting User Videos
|
||||
$page = mysql_clean($_GET['page']);
|
||||
$get_limit = create_query_limit($page,$add_group_videos);
|
||||
|
||||
$array = array('user'=>userid(),'limit'=>$get_limit);
|
||||
$usr_vids = get_videos($array);
|
||||
//echo $db->db_query;
|
||||
assign('usr_vids',$usr_vids);
|
||||
assign('videos',$usr_vids);
|
||||
|
||||
$array['count_only'] = true;
|
||||
$total_rows = get_videos($array);
|
||||
$total_pages = count_pages($total_rows,$add_group_videos);
|
||||
//Pagination
|
||||
$pages->paginate($total_pages,$page);
|
||||
|
||||
|
||||
//Adding videos to group
|
||||
if(isset($_POST['add_videos']))
|
||||
{
|
||||
$total = count($usr_vids);
|
||||
for($i=0;$i<$total;$i++)
|
||||
{
|
||||
$videoid = $usr_vids[$i]['videoid'];
|
||||
if($_POST['check_video_'.$videoid]=='yes')
|
||||
$cbgroup->add_group_video($videoid,$details['group_id'],false);
|
||||
else
|
||||
$cbgroup->remove_group_video($videoid,$details['group_id'],false);
|
||||
}
|
||||
//Update Group Total Videos
|
||||
$cbgroup->update_group_videos_count($details['group_id']);
|
||||
|
||||
$eh->flush_msg();
|
||||
e(lang("sel_vids_updated"),"m");
|
||||
}
|
||||
|
||||
|
||||
|
||||
assign('group',$details);
|
||||
|
||||
subtitle($details['group_name']);
|
||||
}
|
||||
|
||||
template_files('add_group_videos.html');
|
||||
display_it();
|
||||
?>
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
****************************************************************************************************
|
||||
| Copyright (c) 2007-2008 Clip-Bucket.com. All rights reserved. |
|
||||
| @ Author : ArslanHassan |
|
||||
| @ Software : ClipBucket , © PHPBucket.com |
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$pages->page_redir();
|
||||
|
||||
|
||||
//Adding Permission
|
||||
if(isset($_POST['add_permission']))
|
||||
{
|
||||
$userquery->add_new_permission($_POST);
|
||||
}
|
||||
//Deleting Permission
|
||||
if(!empty($_GET['perm_del']))
|
||||
{
|
||||
$userquery->remove_permission($_GET['perm_del']);
|
||||
}
|
||||
|
||||
template_files('_permission.html');
|
||||
display_it();
|
||||
|
||||
|
||||
?>
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
****************************************************************************************************
|
||||
| Copyright (c) 2007-2008 Clip-Bucket.com. All rights reserved. |
|
||||
| @ Author : ArslanHassan |
|
||||
| @ Software : ClipBucket , © PHPBucket.com |
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$pages->page_redir();
|
||||
|
||||
|
||||
if(isset($_POST['add_field']))
|
||||
{
|
||||
$array = $_POST;
|
||||
$array['add_field'] = '';
|
||||
add_custom_field($array);
|
||||
}
|
||||
|
||||
|
||||
Assign('msg',@$msg);
|
||||
Template('header.html');
|
||||
Template('leftmenu.html');
|
||||
Template('message.html');
|
||||
Template('add_custom_fields.html');
|
||||
Template('footer.html');
|
||||
|
||||
?>
|
|
@ -1,6 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
header("location:".cblink(array("name"=>"create_group")));
|
||||
?>
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @Software : ClipBucket
|
||||
* @Author : Arslan Hassan
|
||||
* @Since : Jan 5 2009
|
||||
* @Function : Add Member
|
||||
* @License : Attribution Assurance License -- http://www.opensource.org/licenses/attribution.php
|
||||
*/
|
||||
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$userquery->login_check('member_moderation');
|
||||
$pages->page_redir();
|
||||
|
||||
if(isset($_POST['add_member']))
|
||||
{
|
||||
if($userquery->signup_user($_POST))
|
||||
{
|
||||
e(lang("new_mem_added"),"m");
|
||||
$_POST = '';
|
||||
}
|
||||
}
|
||||
|
||||
subtitle("Add New Member");
|
||||
template_files('add_members.html');
|
||||
display_it();
|
||||
|
||||
?>
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
****************************************************************************************************
|
||||
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved. |
|
||||
| @ Author : ArslanHassan |
|
||||
| @ Software : ClipBucket , © PHPBucket.com |
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$userquery->login_check('web_config_access');
|
||||
$pages->page_redir();
|
||||
|
||||
if(isset($_POST['add_phrase']))
|
||||
{
|
||||
$name = mysql_clean($_POST['name']);
|
||||
$text = mysql_real_escape_string($_POST['text']);
|
||||
$lang_code = mysql_clean($_POST['lang_code']);
|
||||
$lang_obj->add_phrase($name,$text,$lang_code);
|
||||
}
|
||||
|
||||
|
||||
subtitle("Add Language Phrase");
|
||||
template_files('add_phrase.html');
|
||||
display_it();
|
||||
?>
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
****************************************************************************************************
|
||||
| Copyright (c) 2007-2008 Clip-Bucket.com. All rights reserved. |
|
||||
| @ Author : ArslanHassan |
|
||||
| @ Software : ClipBucket , © PHPBucket.com |
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$pages->page_redir();
|
||||
$userquery->perm_check('ad_manager_access',true);
|
||||
|
||||
//Removing Placement
|
||||
if(isset($_GET['remove'])){
|
||||
$placement = mysql_clean($_GET['remove']);
|
||||
$msg =$ads_query->RemovePlacement($placement);
|
||||
}
|
||||
|
||||
//Adding Placement
|
||||
if(isset($_POST['AddPlacement'])){
|
||||
$placement_name = mysql_clean($_POST['placement_name']);
|
||||
$placement_code = mysql_clean($_POST['placement_code']);
|
||||
$array = array($placement_name,$placement_code);
|
||||
$msg = $ads_query->AddPlacement($array);
|
||||
}
|
||||
|
||||
//Getting List Of Placement
|
||||
$sql = "SELECT * FROM ".tbl("ads_placements");
|
||||
$ads_exec = $db->Execute($sql);
|
||||
$ads_placements = $ads_exec->getrows();
|
||||
$total_placements = $ads_exec->recordcount() + 0;
|
||||
//Getting total Ads in each placement
|
||||
for($id=0;$id<=$total_placements;$id++)
|
||||
{
|
||||
$ads_placements[$id]['total_ads'] = $adsObj->count_ads_in_placement($ads_placements[$id]['placement']);
|
||||
}
|
||||
|
||||
Assign('ads_placements',$ads_placements);
|
||||
|
||||
|
||||
subtitle("Add Advertisment Placement");
|
||||
template_files('ads_add_placements.html');
|
||||
display_it();
|
||||
|
||||
?>
|
|
@ -1,81 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* **************************************************************
|
||||
| Copyright (c) 2007-2012 Clip-Bucket.com. All rights reserved.
|
||||
| @ Author : ArslanHassan
|
||||
| @ Software : ClipBucket , <EFBFBD> PHPBucket.com
|
||||
* **************************************************************
|
||||
*/
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$pages->page_redir();
|
||||
$userquery->perm_check('ad_manager_access', true);
|
||||
//Adding
|
||||
if (isset($_POST['add'])) {
|
||||
$adsObj->AddAd();
|
||||
}
|
||||
|
||||
//Updating
|
||||
if (isset($_POST['update'])) {
|
||||
$ad_id = mysql_clean($_POST['ad_id']);
|
||||
$array = $_POST;
|
||||
$array['ad_id'] = $ad_id;
|
||||
$adsObj->EditAd($array);
|
||||
}
|
||||
//Deleting
|
||||
if (isset($_GET['delete'])) {
|
||||
$adsObj->DeleteAd($_GET['delete']);
|
||||
}
|
||||
|
||||
//Chaing Ad Status
|
||||
if (isset($_GET['activate'])) {
|
||||
$adid = mysql_clean($_GET['activate']);
|
||||
$adsObj->ChangeAdStatus(1, $adid);
|
||||
}
|
||||
if (isset($_GET['deactivate'])) {
|
||||
$adid = mysql_clean($_GET['deactivate']);
|
||||
$adsObj->ChangeAdStatus(0, $adid);
|
||||
}
|
||||
|
||||
|
||||
//Multi active/deactive and delete
|
||||
if ($_POST['action-mode'] == 'activate') {
|
||||
for ($i = 0; $i < count($_POST['check_ad']); $i++) {
|
||||
$adsObj->ChangeAdStatus(1, $_POST['check_ad'][$i]);
|
||||
}
|
||||
$eh->flush();
|
||||
e(lang('Selected ads have been activated'), 'm');
|
||||
}
|
||||
|
||||
if ($_POST['action-mode'] == 'deactivate') {
|
||||
for ($i = 0; $i < count($_POST['check_ad']); $i++) {
|
||||
$adsObj->ChangeAdStatus(0, $_POST['check_ad'][$i]);
|
||||
}
|
||||
$eh->flush();
|
||||
e(lang('Selected ads have been deactivated'), 'm');
|
||||
}
|
||||
|
||||
if ($_POST['action-mode'] == 'delete') {
|
||||
for ($i = 0; $i < count($_POST['check_ad']); $i++) {
|
||||
$adsObj->DeleteAd($_POST['check_ad'][$i]);
|
||||
}
|
||||
$eh->flush();
|
||||
e(lang('Selected ads have been deleted'), 'm');
|
||||
}
|
||||
|
||||
//Editing Ad
|
||||
if (isset($_GET['ad_id'])) {
|
||||
$ad_id = mysql_clean($_GET['ad_id']);
|
||||
$ad_data = $adsObj->get_ad_details($ad_id);
|
||||
if (!$ad_data)
|
||||
e(lang("ad_exists_error1"));
|
||||
else
|
||||
assign('ad_data', $ad_data);
|
||||
}
|
||||
|
||||
subtitle("Advertisments Manager");
|
||||
template_files('ads_manager.html');
|
||||
display_it();
|
||||
?>
|
|
@ -1,128 +0,0 @@
|
|||
<?php
|
||||
|
||||
include("../../includes/admin_config.php");
|
||||
//Ajax categories...
|
||||
|
||||
$mode = post('mode');
|
||||
|
||||
$type = $_POST['type'];
|
||||
assign('type',$type);
|
||||
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case "video":case "videos":case "vid":default:
|
||||
$obj = $cbvid;
|
||||
break;
|
||||
case "user":case "users":case "channel":case "u":
|
||||
$obj = $userquery;
|
||||
break;
|
||||
case "group": case "groups":case "g":
|
||||
$obj = $cbgroup;
|
||||
break;
|
||||
case "collection": case "c":
|
||||
$obj = $cbcollection;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case "add_category":
|
||||
{
|
||||
|
||||
$cid = $obj->add_category($_POST);
|
||||
//$cid = 18;
|
||||
if(error())
|
||||
{
|
||||
echo json_encode(array('err'=>error()));
|
||||
}else{
|
||||
$category = $obj->get_category($cid);
|
||||
assign('category',$category);
|
||||
|
||||
$category_template = Fetch('blocks/category.html');
|
||||
|
||||
echo json_encode(array('success'=>'yes','data'=>$category_template,'cid'=>$cid));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "delete_category":
|
||||
{
|
||||
$cid = mysql_clean(post('cid'));
|
||||
|
||||
$obj->delete_category($cid);
|
||||
|
||||
if(error())
|
||||
{
|
||||
echo json_encode(array('err'=>error()));
|
||||
}else
|
||||
echo json_encodE(array('success'=>'yes'));
|
||||
}
|
||||
break;
|
||||
|
||||
case "make_default":
|
||||
{
|
||||
$cid = mysql_clean(post('cid'));
|
||||
$obj->make_default_category($cid);
|
||||
$name = post('name');
|
||||
if(error())
|
||||
{
|
||||
echo json_encode(array('err'=>error()));
|
||||
}else
|
||||
echo json_encodE(array('success'=>'yes',"msg"=>array("<strong>$name</strong> has been set as default")));
|
||||
}
|
||||
break;
|
||||
|
||||
case "edit_category":
|
||||
{
|
||||
|
||||
$cid = mysql_clean(post('cid'));
|
||||
$category = $obj->get_category($cid);
|
||||
|
||||
if($category)
|
||||
{
|
||||
assign('c',$category);
|
||||
$template = Fetch('blocks/edit-category.html');
|
||||
echo json_encode(array('success'=>'yes','template'=>$template,
|
||||
'title'=> loading_pointer(array('place'=>'save-category')).' '.$category['category_name']
|
||||
));
|
||||
|
||||
}else{
|
||||
echo json_encode(array('err'=>array('Unable to fetch category details')));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "save_category":
|
||||
{
|
||||
$type = $_POST['type'];
|
||||
assign('type',$type);
|
||||
|
||||
$category = $obj->update_category($_POST);
|
||||
|
||||
if(error())
|
||||
{
|
||||
echo json_encode(array('err'=>error('single')));
|
||||
}else
|
||||
{
|
||||
echo json_encode(array('success'=>'yes','msg'=>array('Category has been updated successfully')));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "update_order":
|
||||
{
|
||||
$cid = mysql_clean(post('cid'));
|
||||
$order = mysql_clean(post('order'));
|
||||
|
||||
$obj->update_cat_order($cid,$order);
|
||||
|
||||
if(error())
|
||||
echo json_encode (array('err'=>erro()));
|
||||
else
|
||||
echo json_encode(array('success'=>'yes'));
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* All ajax related stuff for Admin Area
|
||||
* @Author Arslan Hassan
|
||||
* @package ClipBucket Admin
|
||||
*/
|
||||
|
||||
include("../../includes/admin_config.php");
|
||||
|
||||
$mode = post('mode');
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case "add-note":
|
||||
case "add_note":
|
||||
{
|
||||
$array = array();
|
||||
$note = mysql_clean($_POST['note']);
|
||||
if(!$note) e(lang("Please enter something for note"));
|
||||
|
||||
if(error()){
|
||||
exit(json_encode(array('err'=>error())));
|
||||
}
|
||||
$myquery->insert_note($note);
|
||||
$array['note'] = nl2br($note);
|
||||
$array['id'] = $db->insert_id();
|
||||
|
||||
echo json_encode($array);
|
||||
}
|
||||
break;
|
||||
|
||||
case "delete-note":
|
||||
case "delete_note":
|
||||
{
|
||||
$id = mysql_clean($_POST['id']);
|
||||
$myquery->delete_note($id);
|
||||
|
||||
echo json_encode(array('success'=>'ok'));
|
||||
}
|
||||
break;
|
||||
|
||||
case "update-home-block-order":
|
||||
{
|
||||
$blocks = $Cbucket->admin_blocks;
|
||||
|
||||
$config = array();
|
||||
|
||||
$order = 1;
|
||||
$orders = array();
|
||||
// rsort($_POST['block_order']);
|
||||
|
||||
foreach($_POST['block_order'] as $block_order)
|
||||
{
|
||||
|
||||
$orders[$block_order] = $order;
|
||||
$order++;
|
||||
}
|
||||
|
||||
foreach($blocks as $id => $block)
|
||||
{
|
||||
$config[$id] = array('order'=>$orders[$id],'container'=> post($id.'-container'));
|
||||
}
|
||||
|
||||
config('admin-block-orders', json_encode($config));
|
||||
|
||||
echo json_encode(array('success'=>'ok'));
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
|
||||
include("../../includes/admin_config.php");
|
||||
//Ajax categories...
|
||||
|
||||
$mode = post('mode');
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case "add_profile":
|
||||
{
|
||||
$profile_id = $cbvid->add_video_profile($_POST);
|
||||
|
||||
//$cid = 18;
|
||||
if (error())
|
||||
{
|
||||
echo json_encode(array('err' => error(), 'rel' => get_rel_list()));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => 'yes', 'profile_id' => $profile_id, 'rel' => ''));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "update_profile":
|
||||
{
|
||||
$profile_id = $cbvid->update_video_profile($_POST);
|
||||
|
||||
//$cid = 18;
|
||||
if (error())
|
||||
{
|
||||
echo json_encode(array('err' => error(), 'rel' => get_rel_list()));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => 'yes', 'profile_id' => $profile_id, 'rel' => ''));
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case "activate_video":
|
||||
{
|
||||
$videoid = $_POST['videoid'];
|
||||
$cbvid->action('activate', $videoid);
|
||||
|
||||
echo json_encode(array('success' => 'yes'));
|
||||
}
|
||||
break;
|
||||
case "deactivate_video":
|
||||
{
|
||||
$videoid = $_POST['videoid'];
|
||||
$cbvid->action('deactivate', $videoid);
|
||||
|
||||
echo json_encode(array('success' => 'yes'));
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,113 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* All ajax related stuff for widgets
|
||||
* @Author Arslan Hassan
|
||||
* @package ClipBucket Admin
|
||||
*/
|
||||
|
||||
include("../../includes/admin_config.php");
|
||||
|
||||
$mode = post('mode');
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case 'update-sidebar':
|
||||
{
|
||||
$sideBarId = mysql_clean(post('sidebar_id'));
|
||||
$widgets = post('widgets');
|
||||
|
||||
//Create widgets array.
|
||||
$themeConfigs = config($Cbucket->template.'-options');
|
||||
$themeConfigs = json_decode($themeConfigs,true);
|
||||
$themeWidgets = $themeConfigs['widgets'];
|
||||
|
||||
|
||||
if($themeWidgets)
|
||||
{
|
||||
$sideBarWidgets = $themeWidgets[$sideBarId];
|
||||
}else
|
||||
{
|
||||
$themeWidgets = array();
|
||||
$sideBarWidgets = array();
|
||||
}
|
||||
|
||||
|
||||
$newSidebar = array();
|
||||
|
||||
foreach($widgets as $widget)
|
||||
{
|
||||
//Creating Widgets
|
||||
if($widget['id']){
|
||||
$theWidget = array(
|
||||
'id' => $widget,
|
||||
'configs' => $sideBarWidgets[$widget]['configs']
|
||||
);
|
||||
|
||||
$newSidebar[$widget] = $theWidget;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($sideBarId)
|
||||
$themeWidgets[$sideBarId] = $newSidebar;
|
||||
|
||||
$themeConfigs['widgets'] = $themeWidgets;
|
||||
|
||||
$themeConfigs = json_encode($themeConfigs);
|
||||
|
||||
config($Cbucket->template.'-options', $themeConfigs);
|
||||
|
||||
|
||||
if(post('fetch-widget'))
|
||||
{
|
||||
assign('sidebar', has_sidebar($sideBarId));
|
||||
assign('widget', get_widget_details(post('fetch-widget'),$sideBarId));
|
||||
$template = fetch('/blocks/widget-form.html',LAYOUT);
|
||||
echo json_encode(array('status'=>'success','data'=>$template));
|
||||
}else
|
||||
echo json_encode(array('status'=>'success','data'=>'sidebar-saved'));
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case "update-widget":
|
||||
{
|
||||
$sideBarId = mysql_clean(post('sidebar_id'));
|
||||
$widgetId = mysql_clean(post('widget_id'));
|
||||
|
||||
if(!$sideBarId || !$widgetId) exit(json_encode(array('error'=>'yes','data'=>'invalid widget')));
|
||||
|
||||
$themeConfigs = config($Cbucket->template.'-options');
|
||||
$themeConfigs = json_decode($themeConfigs,true);
|
||||
$themeWidgets = $themeConfigs['widgets'];
|
||||
|
||||
|
||||
$configs = post('configs');
|
||||
|
||||
$themeWidgets[$sideBarId][$widgetId]['configs'] = $configs;
|
||||
$themeConfigs['widgets'] = $themeWidgets;
|
||||
|
||||
|
||||
$themeConfigs = json_encode($themeConfigs);
|
||||
|
||||
|
||||
config($Cbucket->template.'-options', $themeConfigs);
|
||||
|
||||
echo json_encode(array('status'=>'success','data'=>array('a'=>'b')));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'fetch-widget-form':
|
||||
{
|
||||
$widgetId = post('widget_id');
|
||||
$sideBarId = post('sidebar_id');
|
||||
|
||||
assign('widget',get_widget_details($widgetId,$sideBarId));
|
||||
assign('sidebar', has_sidebar($sideBarId));
|
||||
|
||||
echo Fetch(LAYOUT.'/blocks/widget-form.html');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,83 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*******************************************
|
||||
| Copyright (c) 2007-2010 Clip-Bucket.com & (Arslan Hassan). All rights reserved.
|
||||
| @ Author : ArslanHassan
|
||||
| @ Software : ClipBucket , © PHPBucket.com
|
||||
*******************************************
|
||||
*/
|
||||
|
||||
require_once '../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$userquery->login_check('video_moderation');
|
||||
$pages->page_redir();
|
||||
|
||||
|
||||
//Form Processing
|
||||
if(isset($_POST['add_cateogry'])){
|
||||
$cbvid->add_category($_POST);
|
||||
}
|
||||
|
||||
//Making Categoyr as Default
|
||||
if(isset($_GET['make_default']))
|
||||
{
|
||||
$cid = mysql_clean($_GET['make_default']);
|
||||
$cbvid->make_default_category($cid);
|
||||
}
|
||||
|
||||
//Edit Categoty
|
||||
if(isset($_GET['category'])){
|
||||
assign("edit_category","show");
|
||||
if(isset($_POST['update_category']))
|
||||
{
|
||||
$cbvid->update_category($_POST);
|
||||
}
|
||||
assign('cat_details',$cbvid->get_category($_GET['category']));
|
||||
}
|
||||
|
||||
//Delete Category
|
||||
if(isset($_GET['delete_category'])){
|
||||
$cbvid->delete_category($_GET['delete_category']);
|
||||
}
|
||||
|
||||
|
||||
$cats = getCategoryList(array('type'=>'v'));
|
||||
|
||||
if($pid)
|
||||
$selected = $pid;
|
||||
|
||||
$parent_cats = $cbvid->admin_area_cats($selected);
|
||||
|
||||
|
||||
//Updating Category Order
|
||||
if(isset($_POST['update_order']))
|
||||
{
|
||||
foreach($cats as $cat)
|
||||
{
|
||||
if(!empty($cat['category_id']))
|
||||
{
|
||||
$order = $_POST['category_order_'.$cat['category_id']];
|
||||
$cbvid->update_cat_order($cat['category_id'],$order);
|
||||
}
|
||||
}
|
||||
|
||||
$cats = getCategoryList(array('type'=>'v'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
assign('manage_categories_title','Manage video categories');
|
||||
assign('type','video');
|
||||
$Smarty->assign_by_ref('obj',$cbvid);
|
||||
|
||||
//Assing Category Values
|
||||
assign('categories',$cats);
|
||||
assign('parent_cats',$parent_cats);
|
||||
assign('total',$cbvid->total_categories());
|
||||
|
||||
subtitle("Video Category Manager");
|
||||
Assign('msg',@$msg);
|
||||
template_files('category.html');
|
||||
display_it();
|
||||
|
||||
?>
|
|
@ -1,64 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
***************************************************************
|
||||
| Copyright (c) 2007-2008 Clip-Bucket.com. All rights reserved.
|
||||
| @ Author : ArslanHassan
|
||||
| @ Software : ClipBucket , © PHPBucket.com
|
||||
****************************************************************
|
||||
*/
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$pages->page_redir();
|
||||
|
||||
|
||||
if($_GET['delete_lock'])
|
||||
{
|
||||
if(conv_lock_exists())
|
||||
{
|
||||
unlink(TEMP_DIR.'/conv_lock.loc');
|
||||
e("Conversion lock has been deleted","m");
|
||||
}else
|
||||
e("There is no conversion lock");
|
||||
}
|
||||
if(isset($_POST['delete_selected']))
|
||||
{
|
||||
$total = count($_POST['check_queue']);
|
||||
for($i=0;$i<=$total;$i++)
|
||||
{
|
||||
$myquery->queue_action("delete",$_POST['check_queue'][$i]);
|
||||
}
|
||||
e("Selected items have been deleted","m");
|
||||
}
|
||||
if(isset($_POST['processed']))
|
||||
{
|
||||
$total = count($_POST['check_queue']);
|
||||
for($i=0;$i<=$total;$i++)
|
||||
{
|
||||
$myquery->queue_action("processed",$_POST['check_queue'][$i]);
|
||||
}
|
||||
e("Selected items have been set changed to processed","m");
|
||||
}
|
||||
if(isset($_POST['pending']))
|
||||
{
|
||||
$total = count($_POST['check_queue']);
|
||||
for($i=0;$i<=$total;$i++)
|
||||
{
|
||||
$myquery->queue_action("pending",$_POST['check_queue'][$i]);
|
||||
}
|
||||
e("Selected items have been set changed to processed","m");
|
||||
}
|
||||
|
||||
|
||||
//Getting List of Conversion Queue
|
||||
$page = mysql_clean($_GET['page']);
|
||||
$get_limit = create_query_limit($page,RESULTS);
|
||||
$queue_list = $myquery->get_conversion_queue(NULL,$get_limit);
|
||||
assign('queues',$queue_list);
|
||||
$total_rows = get_videos($vcount);
|
||||
$total_pages = count_pages($db->count(tbl('conversion_queue'),"cqueue_id"),RESULTS);
|
||||
$pages->paginate($total_pages,$page);
|
||||
|
||||
subtitle("Conversion Queue Manager");
|
||||
template_files("cb_conversion_queue.html");
|
||||
display_it();
|
||||
?>
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
***************************************************************
|
||||
| Copyright (c) 2007-2008 Clip-Bucket.com. All rights reserved.
|
||||
| @ Author : ArslanHassan
|
||||
| @ Software : ClipBucket , © PHPBucket.com
|
||||
****************************************************************
|
||||
*/
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$pages->page_redir();
|
||||
|
||||
|
||||
subtitle("ClipBucket Server Module Checker");
|
||||
template_files("cb_mod_check.html");
|
||||
display_it();
|
||||
?>
|
|
@ -1,111 +0,0 @@
|
|||
<?php
|
||||
include '../../includes/admin_config.php';
|
||||
include 'ofc-library/open-flash-chart.php';
|
||||
|
||||
$days = 10;
|
||||
$last_week = time()-86400*$days + 86400;
|
||||
$the_last_week = date('M d', $last_week);
|
||||
$title = new title("ClipBucket Daily Activity ".$the_last_week." - ".date("M d"));
|
||||
$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
|
||||
|
||||
$vid_stats = $data['video_stats'];
|
||||
$vid_stats = json_decode($vid_stats);
|
||||
|
||||
|
||||
$year = array();
|
||||
|
||||
//Getting This Weeks Data
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i<$days-1)
|
||||
{
|
||||
$date_pattern = date("Y-m-d",$last_week+($i*86400));
|
||||
|
||||
//echo "date_added LIKE '%$date_pattern%'";
|
||||
$data = $db->select(tbl("stats"),"*"," date_added LIKE '%$date_pattern%' ",1);
|
||||
$data = $data[0];
|
||||
$datas[] = $data;
|
||||
}
|
||||
|
||||
$year[] = date("M d",$last_week+($i*86400));
|
||||
}
|
||||
|
||||
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
$day[$i]['video'] = json_decode($datas[$i]['video_stats']);
|
||||
$day[$i]['users'] = json_decode($datas[$i]['user_stats']);
|
||||
$day[$i]['groups'] = json_decode($datas[$i]['group_stats']);
|
||||
|
||||
}
|
||||
$max = 1;
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i==$days-1)
|
||||
{
|
||||
$vid_uploads[] = $cbvid->get_videos(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
$user_signups[] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
$groups_added[] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
}else{
|
||||
$vid_uploads[] =$day[$i]['video']->uploads+0;
|
||||
$user_signups[] =$day[$i]['users']->signups+0;
|
||||
$groups_added[] =$day[$i]['groups']->created+0;
|
||||
}
|
||||
$max = max($max,$vid_uploads[$i],$user_signups[$i],$groups_added[$i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$vid_line = new line();
|
||||
$vid_line->set_values($vid_uploads);
|
||||
$vid_line->colour( '#336600');
|
||||
$vid_line->set_key('Videos', 14);
|
||||
|
||||
|
||||
$user_line = new line();
|
||||
$user_line->set_values($user_signups);
|
||||
$user_line->colour( '#0099cc');
|
||||
$user_line->set_key('User', 14);
|
||||
|
||||
|
||||
$grp_line = new line();
|
||||
$grp_line->set_values($groups_added);
|
||||
$grp_line->colour( '#990000');
|
||||
$grp_line->set_key('Groups', 14);
|
||||
|
||||
|
||||
$max = $max;
|
||||
$steps = round($max/5,0.49);
|
||||
$y = new y_axis();
|
||||
$y->set_range( 0, $max, $steps);
|
||||
|
||||
|
||||
$chart = new open_flash_chart();
|
||||
$chart->set_title( $title );
|
||||
$chart->add_element( $vid_line );
|
||||
$chart->add_element( $user_line );
|
||||
$chart->add_element( $grp_line );
|
||||
|
||||
$x_labels = new x_axis_labels();
|
||||
$x_labels->set_steps( 1 );
|
||||
$x_labels->set_vertical();
|
||||
$x_labels->set_colour( '#A2ACBA' );
|
||||
$x_labels->set_labels( $year );
|
||||
|
||||
$x = new x_axis();
|
||||
$x->set_colour( '#A2ACBA' );
|
||||
$x->set_grid_colour( '#D7E4A3' );
|
||||
$x->set_offset( false );
|
||||
$x->set_steps(4);
|
||||
// Add the X Axis Labels to the X Axis
|
||||
$x->set_labels( $x_labels );
|
||||
|
||||
$chart->set_x_axis( $x );
|
||||
|
||||
|
||||
$chart->set_y_axis( $y );
|
||||
|
||||
echo $chart->toString();
|
||||
|
||||
?>
|
|
@ -1,109 +0,0 @@
|
|||
<?php
|
||||
include '../../includes/admin_config.php';
|
||||
include 'ofc-library/open-flash-chart.php';
|
||||
|
||||
$days = 7;
|
||||
$last_week = time()-86400*$days + 86400;
|
||||
$the_last_week = date('M d', $last_week);
|
||||
$title = new title("Groups Stats ".$the_last_week." - ".date("M d"));
|
||||
$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
|
||||
|
||||
$vid_stats = $data['video_stats'];
|
||||
$vid_stats = json_decode($vid_stats);
|
||||
|
||||
|
||||
$year = array();
|
||||
|
||||
//Getting This Weeks Data
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i<$days-1)
|
||||
{
|
||||
$date_pattern = date("Y-m-d",$last_week+($i*86400));
|
||||
$data = $db->select(tbl("stats"),"*"," date_added LIKE '%$date_pattern%' ",1);
|
||||
$data = $data[0];
|
||||
$datas[] = $data;
|
||||
}
|
||||
|
||||
$year[] = date("M d",$last_week+($i*86400));
|
||||
}
|
||||
|
||||
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
$day[$i]['video'] = json_decode($datas[$i]['video_stats'],true);
|
||||
$day[$i]['users'] = json_decode($datas[$i]['user_stats'],true);
|
||||
$day[$i]['groups'] = json_decode($datas[$i]['group_stats'],true);
|
||||
|
||||
}
|
||||
$max = 1;
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i==$days-1)
|
||||
{
|
||||
$groups[] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
$active[] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"today","active"=>'yes'))+0;
|
||||
$tota_topics = $db->select(tbl("groups"),"SUM(total_topics) as the_topics"," date_added LIKE '%$date%'");
|
||||
$topics_bar_data[] = $tota_topics['the_topics']+0;
|
||||
}else{
|
||||
$groups[] =$day[$i]['groups']->created+0;
|
||||
$active[] =$day[$i]['groups']->active+0;
|
||||
$topics_bar_data[] =$day[$i]['groups']->total_topics+0;
|
||||
}
|
||||
$max = max($max,$groups[$i],$active[$i],$topics_bar_data[$i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$total_bars = new bar_cylinder();
|
||||
$total_bars->set_values($groups);
|
||||
$total_bars->colour( '#0066ff');
|
||||
$total_bars->key('Total', 14);
|
||||
|
||||
$active_bars = new bar_cylinder();
|
||||
$active_bars->set_values($active);
|
||||
$active_bars->colour( '#99cc00');
|
||||
$active_bars->key('Active', 14);
|
||||
|
||||
$topics_bar = new bar_cylinder();
|
||||
$topics_bar->set_values($topics_bar_data);
|
||||
$topics_bar->colour( '#BF3B69');
|
||||
$topics_bar->key('Topics', 14);
|
||||
|
||||
|
||||
|
||||
|
||||
//$max = $max+(round($max/2,0.49));
|
||||
$steps = round($max/5,0.49);
|
||||
$y = new y_axis();
|
||||
$y->set_range( 0, $max, $steps);
|
||||
|
||||
|
||||
$chart = new open_flash_chart();
|
||||
$chart->set_title( $title );
|
||||
$chart->add_element( $total_bars );
|
||||
$chart->add_element( $active_bars );
|
||||
$chart->add_element( $topics_bar );
|
||||
|
||||
$x_labels = new x_axis_labels();
|
||||
$x_labels->set_steps( 1 );
|
||||
$x_labels->set_colour( '#A2ACBA' );
|
||||
$x_labels->set_labels( $year );
|
||||
|
||||
$x = new x_axis();
|
||||
$x->set_colour( '#A2ACBA' );
|
||||
$x->set_grid_colour( '#D7E4A3' );
|
||||
$x->set_offset( true );
|
||||
$x->set_steps(4);
|
||||
// Add the X Axis Labels to the X Axis
|
||||
$x->set_labels( $x_labels );
|
||||
|
||||
$chart->set_x_axis( $x );
|
||||
$chart->set_bg_colour('#ffffff');
|
||||
|
||||
$chart->set_y_axis( $y );
|
||||
|
||||
echo $chart->toString();
|
||||
|
||||
?>
|
|
@ -1,806 +0,0 @@
|
|||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* JSON (JavaScript Object Notation) is a lightweight data-interchange
|
||||
* format. It is easy for humans to read and write. It is easy for machines
|
||||
* to parse and generate. It is based on a subset of the JavaScript
|
||||
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
|
||||
* This feature can also be found in Python. JSON is a text format that is
|
||||
* completely language independent but uses conventions that are familiar
|
||||
* to programmers of the C-family of languages, including C, C++, C#, Java,
|
||||
* JavaScript, Perl, TCL, and many others. These properties make JSON an
|
||||
* ideal data-interchange language.
|
||||
*
|
||||
* This package provides a simple encoder and decoder for JSON notation. It
|
||||
* is intended for use with client-side Javascript applications that make
|
||||
* use of HTTPRequest to perform server communication functions - data can
|
||||
* be encoded into JSON notation for use in a client-side javascript, or
|
||||
* decoded from incoming Javascript requests. JSON format is native to
|
||||
* Javascript, and can be directly eval()'ed with no further parsing
|
||||
* overhead
|
||||
*
|
||||
* All strings should be in ASCII or UTF-8 format!
|
||||
*
|
||||
* LICENSE: 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``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 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.
|
||||
*
|
||||
* @category
|
||||
* @package Services_JSON
|
||||
* @author Michal Migurski <mike-json@teczno.com>
|
||||
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
|
||||
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
|
||||
* @copyright 2005 Michal Migurski
|
||||
* @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_SLICE', 1);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_STR', 2);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_ARR', 3);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_OBJ', 4);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_CMT', 5);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_LOOSE_TYPE', 16);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* Brief example of use:
|
||||
*
|
||||
* <code>
|
||||
* // create a new instance of Services_JSON
|
||||
* $json = new Services_JSON();
|
||||
*
|
||||
* // convert a complexe value to JSON notation, and send it to the browser
|
||||
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
|
||||
* $output = $json->encode($value);
|
||||
*
|
||||
* print($output);
|
||||
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
|
||||
*
|
||||
* // accept incoming POST data, assumed to be in JSON notation
|
||||
* $input = file_get_contents('php://input', 1000000);
|
||||
* $value = $json->decode($input);
|
||||
* </code>
|
||||
*/
|
||||
class Services_JSON
|
||||
{
|
||||
/**
|
||||
* constructs a new JSON instance
|
||||
*
|
||||
* @param int $use object behavior flags; combine with boolean-OR
|
||||
*
|
||||
* possible values:
|
||||
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
|
||||
* "{...}" syntax creates associative arrays
|
||||
* instead of objects in decode().
|
||||
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
|
||||
* Values which can't be encoded (e.g. resources)
|
||||
* appear as NULL instead of throwing errors.
|
||||
* By default, a deeply-nested resource will
|
||||
* bubble up with an error, so all return values
|
||||
* from encode() should be checked with isError()
|
||||
*/
|
||||
function Services_JSON($use = 0)
|
||||
{
|
||||
$this->use = $use;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-16 char to one UTF-8 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf16 UTF-16 character
|
||||
* @return string UTF-8 character
|
||||
* @access private
|
||||
*/
|
||||
function utf162utf8($utf16)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
||||
}
|
||||
|
||||
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
|
||||
|
||||
switch(true) {
|
||||
case ((0x7F & $bytes) == $bytes):
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x7F & $bytes);
|
||||
|
||||
case (0x07FF & $bytes) == $bytes:
|
||||
// return a 2-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xC0 | (($bytes >> 6) & 0x1F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
|
||||
case (0xFFFF & $bytes) == $bytes:
|
||||
// return a 3-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xE0 | (($bytes >> 12) & 0x0F))
|
||||
. chr(0x80 | (($bytes >> 6) & 0x3F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-8 char to one UTF-16 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf8 UTF-8 character
|
||||
* @return string UTF-16 character
|
||||
* @access private
|
||||
*/
|
||||
function utf82utf16($utf8)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||
}
|
||||
|
||||
switch(strlen($utf8)) {
|
||||
case 1:
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return $utf8;
|
||||
|
||||
case 2:
|
||||
// return a UTF-16 character from a 2-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x07 & (ord($utf8{0}) >> 2))
|
||||
. chr((0xC0 & (ord($utf8{0}) << 6))
|
||||
| (0x3F & ord($utf8{1})));
|
||||
|
||||
case 3:
|
||||
// return a UTF-16 character from a 3-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr((0xF0 & (ord($utf8{0}) << 4))
|
||||
| (0x0F & (ord($utf8{1}) >> 2)))
|
||||
. chr((0xC0 & (ord($utf8{1}) << 6))
|
||||
| (0x7F & ord($utf8{2})));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* encodes an arbitrary variable into JSON format
|
||||
*
|
||||
* @param mixed $var any number, boolean, string, array, or object to be encoded.
|
||||
* see argument 1 to Services_JSON() above for array-parsing behavior.
|
||||
* if var is a strng, note that encode() always expects it
|
||||
* to be in ASCII or UTF-8 format!
|
||||
*
|
||||
* @return mixed JSON string representation of input var or an error if a problem occurs
|
||||
* @access public
|
||||
*/
|
||||
function encode($var)
|
||||
{
|
||||
switch (gettype($var)) {
|
||||
case 'boolean':
|
||||
return $var ? 'true' : 'false';
|
||||
|
||||
case 'NULL':
|
||||
return 'null';
|
||||
|
||||
case 'integer':
|
||||
return (int) $var;
|
||||
|
||||
case 'double':
|
||||
case 'float':
|
||||
return (float) $var;
|
||||
|
||||
case 'string':
|
||||
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
|
||||
$ascii = '';
|
||||
$strlen_var = strlen($var);
|
||||
|
||||
/*
|
||||
* Iterate over every character in the string,
|
||||
* escaping with a slash or encoding to UTF-8 where necessary
|
||||
*/
|
||||
for ($c = 0; $c < $strlen_var; ++$c) {
|
||||
|
||||
$ord_var_c = ord($var{$c});
|
||||
|
||||
switch (true) {
|
||||
case $ord_var_c == 0x08:
|
||||
$ascii .= '\b';
|
||||
break;
|
||||
case $ord_var_c == 0x09:
|
||||
$ascii .= '\t';
|
||||
break;
|
||||
case $ord_var_c == 0x0A:
|
||||
$ascii .= '\n';
|
||||
break;
|
||||
case $ord_var_c == 0x0C:
|
||||
$ascii .= '\f';
|
||||
break;
|
||||
case $ord_var_c == 0x0D:
|
||||
$ascii .= '\r';
|
||||
break;
|
||||
|
||||
case $ord_var_c == 0x22:
|
||||
case $ord_var_c == 0x2F:
|
||||
case $ord_var_c == 0x5C:
|
||||
// double quote, slash, slosh
|
||||
$ascii .= '\\'.$var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
||||
// characters U-00000000 - U-0000007F (same as ASCII)
|
||||
$ascii .= $var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xE0) == 0xC0):
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
|
||||
$c += 1;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF0) == 0xE0):
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}));
|
||||
$c += 2;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF8) == 0xF0):
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}));
|
||||
$c += 3;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFC) == 0xF8):
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}));
|
||||
$c += 4;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFE) == 0xFC):
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}),
|
||||
ord($var{$c + 5}));
|
||||
$c += 5;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return '"'.$ascii.'"';
|
||||
|
||||
case 'array':
|
||||
/*
|
||||
* As per JSON spec if any array key is not an integer
|
||||
* we must treat the the whole array as an object. We
|
||||
* also try to catch a sparsely populated associative
|
||||
* array with numeric keys here because some JS engines
|
||||
* will create an array with empty indexes up to
|
||||
* max_index which can cause memory issues and because
|
||||
* the keys, which may be relevant, will be remapped
|
||||
* otherwise.
|
||||
*
|
||||
* As per the ECMA and JSON specification an object may
|
||||
* have any string as a property. Unfortunately due to
|
||||
* a hole in the ECMA specification if the key is a
|
||||
* ECMA reserved word or starts with a digit the
|
||||
* parameter is only accessible using ECMAScript's
|
||||
* bracket notation.
|
||||
*/
|
||||
|
||||
// treat as a JSON object
|
||||
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($var),
|
||||
array_values($var));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
}
|
||||
|
||||
// treat it like a regular array
|
||||
$elements = array_map(array($this, 'encode'), $var);
|
||||
|
||||
foreach($elements as $element) {
|
||||
if(Services_JSON::isError($element)) {
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
|
||||
return '[' . join(',', $elements) . ']';
|
||||
|
||||
case 'object':
|
||||
$vars = get_object_vars($var);
|
||||
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($vars),
|
||||
array_values($vars));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
|
||||
default:
|
||||
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
||||
? 'null'
|
||||
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* array-walking function for use in generating JSON-formatted name-value pairs
|
||||
*
|
||||
* @param string $name name of key to use
|
||||
* @param mixed $value reference to an array element to be encoded
|
||||
*
|
||||
* @return string JSON-formatted name-value pair, like '"name":value'
|
||||
* @access private
|
||||
*/
|
||||
function name_value($name, $value)
|
||||
{
|
||||
$encoded_value = $this->encode($value);
|
||||
|
||||
if(Services_JSON::isError($encoded_value)) {
|
||||
return $encoded_value;
|
||||
}
|
||||
|
||||
return $this->encode(strval($name)) . ':' . $encoded_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* reduce a string by removing leading and trailing comments and whitespace
|
||||
*
|
||||
* @param $str string string value to strip of comments and whitespace
|
||||
*
|
||||
* @return string string value stripped of comments and whitespace
|
||||
* @access private
|
||||
*/
|
||||
function reduce_string($str)
|
||||
{
|
||||
$str = preg_replace(array(
|
||||
|
||||
// eliminate single line comments in '// ...' form
|
||||
'#^\s*//(.+)$#m',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at start of string
|
||||
'#^\s*/\*(.+)\*/#Us',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at end of string
|
||||
'#/\*(.+)\*/\s*$#Us'
|
||||
|
||||
), '', $str);
|
||||
|
||||
// eliminate extraneous space
|
||||
return trim($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* decodes a JSON string into appropriate variable
|
||||
*
|
||||
* @param string $str JSON-formatted string
|
||||
*
|
||||
* @return mixed number, boolean, string, array, or object
|
||||
* corresponding to given JSON input string.
|
||||
* See argument 1 to Services_JSON() above for object-output behavior.
|
||||
* Note that decode() always returns strings
|
||||
* in ASCII or UTF-8 format!
|
||||
* @access public
|
||||
*/
|
||||
function decode($str)
|
||||
{
|
||||
$str = $this->reduce_string($str);
|
||||
|
||||
switch (strtolower($str)) {
|
||||
case 'true':
|
||||
return true;
|
||||
|
||||
case 'false':
|
||||
return false;
|
||||
|
||||
case 'null':
|
||||
return null;
|
||||
|
||||
default:
|
||||
$m = array();
|
||||
|
||||
if (is_numeric($str)) {
|
||||
// Lookie-loo, it's a number
|
||||
|
||||
// This would work on its own, but I'm trying to be
|
||||
// good about returning integers where appropriate:
|
||||
// return (float)$str;
|
||||
|
||||
// Return float or int, as appropriate
|
||||
return ((float)$str == (integer)$str)
|
||||
? (integer)$str
|
||||
: (float)$str;
|
||||
|
||||
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
||||
// STRINGS RETURNED IN UTF-8 FORMAT
|
||||
$delim = substr($str, 0, 1);
|
||||
$chrs = substr($str, 1, -1);
|
||||
$utf8 = '';
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c < $strlen_chrs; ++$c) {
|
||||
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
$ord_chrs_c = ord($chrs{$c});
|
||||
|
||||
switch (true) {
|
||||
case $substr_chrs_c_2 == '\b':
|
||||
$utf8 .= chr(0x08);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\t':
|
||||
$utf8 .= chr(0x09);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\n':
|
||||
$utf8 .= chr(0x0A);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\f':
|
||||
$utf8 .= chr(0x0C);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\r':
|
||||
$utf8 .= chr(0x0D);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case $substr_chrs_c_2 == '\\"':
|
||||
case $substr_chrs_c_2 == '\\\'':
|
||||
case $substr_chrs_c_2 == '\\\\':
|
||||
case $substr_chrs_c_2 == '\\/':
|
||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
||||
$utf8 .= $chrs{++$c};
|
||||
}
|
||||
break;
|
||||
|
||||
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
|
||||
// single, escaped unicode character
|
||||
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
|
||||
. chr(hexdec(substr($chrs, ($c + 4), 2)));
|
||||
$utf8 .= $this->utf162utf8($utf16);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
|
||||
$utf8 .= $chrs{$c};
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xE0) == 0xC0:
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 2);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF0) == 0xE0:
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 3);
|
||||
$c += 2;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF8) == 0xF0:
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 4);
|
||||
$c += 3;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFC) == 0xF8:
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 5);
|
||||
$c += 4;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFE) == 0xFC:
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 6);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $utf8;
|
||||
|
||||
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
|
||||
// array, or object notation
|
||||
|
||||
if ($str{0} == '[') {
|
||||
$stk = array(SERVICES_JSON_IN_ARR);
|
||||
$arr = array();
|
||||
} else {
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = array();
|
||||
} else {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE,
|
||||
'where' => 0,
|
||||
'delim' => false));
|
||||
|
||||
$chrs = substr($str, 1, -1);
|
||||
$chrs = $this->reduce_string($chrs);
|
||||
|
||||
if ($chrs == '') {
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} else {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//print("\nparsing {$chrs}\n");
|
||||
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c <= $strlen_chrs; ++$c) {
|
||||
|
||||
$top = end($stk);
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
|
||||
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
|
||||
// found a comma that is not inside a string, array, etc.,
|
||||
// OR we've reached the end of the character list
|
||||
$slice = substr($chrs, $top['where'], ($c - $top['where']));
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
|
||||
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
// we are in an array, so just push an element onto the stack
|
||||
array_push($arr, $this->decode($slice));
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
// we are in an object, so figure
|
||||
// out the property name and set an
|
||||
// element in an associative array,
|
||||
// for now
|
||||
$parts = array();
|
||||
|
||||
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// "name":value pair
|
||||
$key = $this->decode($parts[1]);
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// name:value pair, where name is unquoted
|
||||
$key = $parts[1];
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
|
||||
// found a quote, and we are not inside a string
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
|
||||
//print("Found start of string at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == $top['delim']) &&
|
||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
||||
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
|
||||
// found a quote, we're in a string, and it's not escaped
|
||||
// we know that it's not escaped becase there is _not_ an
|
||||
// odd number of backslashes at the end of the string so far
|
||||
array_pop($stk);
|
||||
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '[') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-bracket, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of array at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
|
||||
// found a right-bracket, and we're in an array
|
||||
array_pop($stk);
|
||||
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '{') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-brace, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of object at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
|
||||
// found a right-brace, and we're in an object
|
||||
array_pop($stk);
|
||||
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '/*') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a comment start, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
||||
$c++;
|
||||
//print("Found start of comment at {$c}\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
|
||||
// found a comment end, and we're in one now
|
||||
array_pop($stk);
|
||||
$c++;
|
||||
|
||||
for ($i = $top['where']; $i <= $c; ++$i)
|
||||
$chrs = substr_replace($chrs, ' ', $i, 1);
|
||||
|
||||
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this should just call PEAR::isError()
|
||||
*/
|
||||
function isError($data, $code = null)
|
||||
{
|
||||
if (class_exists('pear')) {
|
||||
return PEAR::isError($data, $code);
|
||||
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
|
||||
is_subclass_of($data, 'services_json_error'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists('PEAR_Error')) {
|
||||
|
||||
class Services_JSON_Error extends PEAR_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this class shall be descended from PEAR_Error
|
||||
*/
|
||||
class Services_JSON_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,231 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* A private class. All the other line-dots inherit from this.
|
||||
* Gives them all some common methods.
|
||||
*/
|
||||
class dot_base
|
||||
{
|
||||
/**
|
||||
* @param $type string
|
||||
* @param $value integer
|
||||
*/
|
||||
function dot_base($type, $value=null)
|
||||
{
|
||||
$this->type = $type;
|
||||
if( isset( $value ) )
|
||||
$this->value( $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* For line charts that only require a Y position
|
||||
* for each point.
|
||||
* @param $value as integer, the Y position
|
||||
*/
|
||||
function value( $value )
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* For scatter charts that require an X and Y position for
|
||||
* each point.
|
||||
*
|
||||
* @param $x as integer
|
||||
* @param $y as integer
|
||||
*/
|
||||
function position( $x, $y )
|
||||
{
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $colour is a string, HEX colour, e.g. '#FF0000' red
|
||||
*/
|
||||
function colour($colour)
|
||||
{
|
||||
$this->colour = $colour;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The tooltip for this dot.
|
||||
*/
|
||||
function tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $size is an integer. Size of the dot.
|
||||
*/
|
||||
function size($size)
|
||||
{
|
||||
$tmp = 'dot-size';
|
||||
$this->$tmp = $size;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* a private method
|
||||
*/
|
||||
function type( $type )
|
||||
{
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $size is an integer. The size of the hollow 'halo' around the dot that masks the line.
|
||||
*/
|
||||
function halo_size( $size )
|
||||
{
|
||||
$tmp = 'halo-size';
|
||||
$this->$tmp = $size;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $do as string. One of three options (examples):
|
||||
* - "http://example.com" - browse to this URL
|
||||
* - "https://example.com" - browse to this URL
|
||||
* - "trace:message" - print this message in the FlashDevelop debug pane
|
||||
* - all other strings will be called as Javascript functions, so a string "hello_world"
|
||||
* will call the JS function "hello_world(index)". It passes in the index of the
|
||||
* point.
|
||||
*/
|
||||
function on_click( $do )
|
||||
{
|
||||
$tmp = 'on-click';
|
||||
$this->$tmp = $do;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a hollow dot
|
||||
*/
|
||||
class hollow_dot extends dot_base
|
||||
{
|
||||
function hollow_dot($value=null)
|
||||
{
|
||||
parent::dot_base( 'hollow-dot', $value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a star
|
||||
*/
|
||||
class star extends dot_base
|
||||
{
|
||||
/**
|
||||
* The constructor, takes an optional $value
|
||||
*/
|
||||
function star($value=null)
|
||||
{
|
||||
parent::dot_base( 'star', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $angle is an integer.
|
||||
*/
|
||||
function rotation($angle)
|
||||
{
|
||||
$this->rotation = $angle;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $is_hollow is a boolean.
|
||||
*/
|
||||
function hollow($is_hollow)
|
||||
{
|
||||
$this->hollow = $is_hollow;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a 'bow tie' shape.
|
||||
*/
|
||||
class bow extends dot_base
|
||||
{
|
||||
/**
|
||||
* The constructor, takes an optional $value
|
||||
*/
|
||||
function bow($value=null)
|
||||
{
|
||||
parent::dot_base( 'bow', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate the anchor object.
|
||||
* @param $angle is an integer.
|
||||
*/
|
||||
function rotation($angle)
|
||||
{
|
||||
$this->rotation = $angle;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An <i><b>n</b></i> sided shape.
|
||||
*/
|
||||
class anchor extends dot_base
|
||||
{
|
||||
/**
|
||||
* The constructor, takes an optional $value
|
||||
*/
|
||||
function anchor($value=null)
|
||||
{
|
||||
parent::dot_base( 'anchor', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate the anchor object.
|
||||
* @param $angle is an integer.
|
||||
*/
|
||||
function rotation($angle)
|
||||
{
|
||||
$this->rotation = $angle;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sides is an integer. Number of sides this shape has.
|
||||
*/
|
||||
function sides($sides)
|
||||
{
|
||||
$this->sides = $sides;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple dot
|
||||
*/
|
||||
class dot extends dot_base
|
||||
{
|
||||
/**
|
||||
* The constructor, takes an optional $value
|
||||
*/
|
||||
function dot($value=null)
|
||||
{
|
||||
parent::dot_base( 'dot', $value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple dot
|
||||
*/
|
||||
class solid_dot extends dot_base
|
||||
{
|
||||
/**
|
||||
* The constructor, takes an optional $value
|
||||
*/
|
||||
function solid_dot($value=null)
|
||||
{
|
||||
parent::dot_base( 'solid-dot', $value );
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
<?php
|
||||
|
||||
// Pretty print some JSON
|
||||
function json_format($json)
|
||||
{
|
||||
$tab = " ";
|
||||
$new_json = "";
|
||||
$indent_level = 0;
|
||||
$in_string = false;
|
||||
|
||||
/*
|
||||
commented out by monk.e.boy 22nd May '08
|
||||
because my web server is PHP4, and
|
||||
json_* are PHP5 functions...
|
||||
|
||||
$json_obj = json_decode($json);
|
||||
|
||||
if($json_obj === false)
|
||||
return false;
|
||||
|
||||
$json = json_encode($json_obj);
|
||||
*/
|
||||
$len = strlen($json);
|
||||
|
||||
for($c = 0; $c < $len; $c++)
|
||||
{
|
||||
$char = $json[$c];
|
||||
switch($char)
|
||||
{
|
||||
case '{':
|
||||
case '[':
|
||||
if(!$in_string)
|
||||
{
|
||||
$new_json .= $char . "\n" . str_repeat($tab, $indent_level+1);
|
||||
$indent_level++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_json .= $char;
|
||||
}
|
||||
break;
|
||||
case '}':
|
||||
case ']':
|
||||
if(!$in_string)
|
||||
{
|
||||
$indent_level--;
|
||||
$new_json .= "\n" . str_repeat($tab, $indent_level) . $char;
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_json .= $char;
|
||||
}
|
||||
break;
|
||||
case ',':
|
||||
if(!$in_string)
|
||||
{
|
||||
$new_json .= ",\n" . str_repeat($tab, $indent_level);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_json .= $char;
|
||||
}
|
||||
break;
|
||||
case ':':
|
||||
if(!$in_string)
|
||||
{
|
||||
$new_json .= ": ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_json .= $char;
|
||||
}
|
||||
break;
|
||||
case '"':
|
||||
if($c > 0 && $json[$c-1] != '\\')
|
||||
{
|
||||
$in_string = !$in_string;
|
||||
}
|
||||
default:
|
||||
$new_json .= $char;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $new_json;
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* inherits from line
|
||||
*/
|
||||
class area extends line
|
||||
{
|
||||
function area()
|
||||
{
|
||||
$this->type = "area";
|
||||
}
|
||||
|
||||
/**
|
||||
* the fill colour
|
||||
*/
|
||||
function set_fill_colour( $colour )
|
||||
{
|
||||
$this->fill = $colour;
|
||||
}
|
||||
|
||||
/**
|
||||
* sugar: see set_fill_colour
|
||||
*/
|
||||
function fill_colour( $colour )
|
||||
{
|
||||
$this->set_fill_colour( $colour );
|
||||
return $this;
|
||||
}
|
||||
|
||||
function set_fill_alpha( $alpha )
|
||||
{
|
||||
$tmp = "fill-alpha";
|
||||
$this->$tmp = $alpha;
|
||||
}
|
||||
|
||||
function set_loop()
|
||||
{
|
||||
$this->loop = true;
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
class area_hollow extends area_base
|
||||
{
|
||||
function area_hollow()
|
||||
{
|
||||
$this->type = "area_hollow";
|
||||
parent::area_base();
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
class area_line extends area_base
|
||||
{
|
||||
function area_line()
|
||||
{
|
||||
$this->type = "area_line";
|
||||
parent::area_base();
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
class ofc_arrow
|
||||
{
|
||||
/**
|
||||
*@param $x as number. Start x position
|
||||
*@param $y as number. Start y position
|
||||
*@param $a as number. End x position
|
||||
*@param $b as number. End y position
|
||||
*@param $colour as string.
|
||||
*@param $barb_length as number. Length of the barbs in pixels.
|
||||
*/
|
||||
function ofc_arrow($x, $y, $a, $b, $colour, $barb_length=10)
|
||||
{
|
||||
$this->type = "arrow";
|
||||
$this->start = array("x"=>$x, "y"=>$y);
|
||||
$this->end = array("x"=>$a, "y"=>$b);
|
||||
$this->colour($colour);
|
||||
$this->{"barb-length"} = $barb_length;
|
||||
}
|
||||
|
||||
function colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once 'ofc_bar_base.php';
|
||||
|
||||
class bar_value
|
||||
{
|
||||
function bar_value( $top, $bottom=null )
|
||||
{
|
||||
$this->top = $top;
|
||||
|
||||
if( isset( $bottom ) )
|
||||
$this->bottom = $bottom;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
}
|
||||
|
||||
class bar extends bar_base
|
||||
{
|
||||
function bar()
|
||||
{
|
||||
$this->type = "bar";
|
||||
parent::bar_base();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once 'ofc_bar_base.php';
|
||||
|
||||
class bar_3d_value
|
||||
{
|
||||
function bar_3d_value( $top )
|
||||
{
|
||||
$this->top = $top;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* this is a base class */
|
||||
|
||||
class bar_base
|
||||
{
|
||||
function bar_base(){}
|
||||
|
||||
/**
|
||||
* @param $text as string the key text
|
||||
* @param $size as integer, size in pixels
|
||||
*/
|
||||
function set_key( $text, $size )
|
||||
{
|
||||
$this->text = $text;
|
||||
$tmp = 'font-size';
|
||||
$this->$tmp = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* syntatical sugar.
|
||||
*/
|
||||
function key( $text, $size )
|
||||
{
|
||||
$this->set_key( $text, $size );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $v as an array, a mix of:
|
||||
* - a bar_value class. You can use this to customise the paramters of each bar.
|
||||
* - integer. This is the Y position of the top of the bar.
|
||||
*/
|
||||
function set_values( $v )
|
||||
{
|
||||
$this->values = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* see set_values
|
||||
*/
|
||||
function append_value( $v )
|
||||
{
|
||||
$this->values[] = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $colour as string, a HEX colour, e.g. '#ff0000' red
|
||||
*/
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
/**
|
||||
*syntatical sugar
|
||||
*/
|
||||
function colour( $colour )
|
||||
{
|
||||
$this->set_colour( $colour );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $alpha as real number (range 0 to 1), e.g. 0.5 is half transparent
|
||||
*/
|
||||
function set_alpha( $alpha )
|
||||
{
|
||||
$this->alpha = $alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $tip as string, the tip to show. May contain various magic variables.
|
||||
*/
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
|
||||
/**
|
||||
*@param $on_show as line_on_show object
|
||||
*/
|
||||
function set_on_show($on_show)
|
||||
{
|
||||
$this->{'on-show'} = $on_show;
|
||||
}
|
||||
|
||||
function set_on_click( $text )
|
||||
{
|
||||
$tmp = 'on-click';
|
||||
$this->$tmp = $text;
|
||||
}
|
||||
|
||||
function attach_to_right_y_axis()
|
||||
{
|
||||
$this->axis = 'right';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once 'ofc_bar_base.php';
|
||||
|
||||
class bar_filled_value extends bar_value
|
||||
{
|
||||
function bar_filled_value( $top, $bottom=null )
|
||||
{
|
||||
parent::bar_value( $top, $bottom );
|
||||
}
|
||||
|
||||
function set_outline_colour( $outline_colour )
|
||||
{
|
||||
$tmp = 'outline-colour';
|
||||
$this->$tmp = $outline_colour;
|
||||
}
|
||||
}
|
||||
|
||||
class bar_filled extends bar_base
|
||||
{
|
||||
function bar_filled( $colour=null, $outline_colour=null )
|
||||
{
|
||||
$this->type = "bar_filled";
|
||||
parent::bar_base();
|
||||
|
||||
if( isset( $colour ) )
|
||||
$this->set_colour( $colour );
|
||||
|
||||
if( isset( $outline_colour ) )
|
||||
$this->set_outline_colour( $outline_colour );
|
||||
}
|
||||
|
||||
function set_outline_colour( $outline_colour )
|
||||
{
|
||||
$tmp = 'outline-colour';
|
||||
$this->$tmp = $outline_colour;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once 'ofc_bar_base.php';
|
||||
|
||||
class bar_on_show
|
||||
{
|
||||
/**
|
||||
*@param $type as string. Can be any one of:
|
||||
* - 'pop-up'
|
||||
* - 'drop'
|
||||
* - 'fade-in'
|
||||
* - 'grow-up'
|
||||
* - 'grow-down'
|
||||
* - 'pop'
|
||||
*
|
||||
* @param $cascade as float. Cascade in seconds
|
||||
* @param $delay as float. Delay before animation starts in seconds.
|
||||
*/
|
||||
function __construct($type, $cascade, $delay)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->cascade = (float)$cascade;
|
||||
$this->delay = (float)$delay;
|
||||
}
|
||||
}
|
||||
|
||||
class bar_value
|
||||
{
|
||||
/**
|
||||
* @param $top as integer. The Y value of the top of the bar
|
||||
* @param OPTIONAL $bottom as integer. The Y value of the bottom of the bar, defaults to Y min.
|
||||
*/
|
||||
function bar_value( $top, $bottom=null )
|
||||
{
|
||||
$this->top = $top;
|
||||
|
||||
if( isset( $bottom ) )
|
||||
$this->bottom = $bottom;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
}
|
||||
|
||||
class bar extends bar_base
|
||||
{
|
||||
function bar()
|
||||
{
|
||||
$this->type = "bar";
|
||||
parent::bar_base();
|
||||
}
|
||||
}
|
||||
|
||||
class bar_glass extends bar_base
|
||||
{
|
||||
function bar_glass()
|
||||
{
|
||||
$this->type = "bar_glass";
|
||||
parent::bar_base();
|
||||
}
|
||||
}
|
||||
|
||||
class bar_cylinder extends bar_base
|
||||
{
|
||||
function bar_cylinder()
|
||||
{
|
||||
$this->type = "bar_cylinder";
|
||||
parent::bar_base();
|
||||
}
|
||||
}
|
||||
|
||||
class bar_cylinder_outline extends bar_base
|
||||
{
|
||||
function bar_cylinder_outline()
|
||||
{
|
||||
$this->type = "bar_cylinder_outline";
|
||||
parent::bar_base();
|
||||
}
|
||||
}
|
||||
|
||||
class bar_rounded_glass extends bar_base
|
||||
{
|
||||
function bar_rounded_glass()
|
||||
{
|
||||
$this->type = "bar_round_glass";
|
||||
parent::bar_base();
|
||||
}
|
||||
}
|
||||
|
||||
class bar_round extends bar_base
|
||||
{
|
||||
function bar_round()
|
||||
{
|
||||
$this->type = "bar_round";
|
||||
parent::bar_base();
|
||||
}
|
||||
}
|
||||
|
||||
class bar_dome extends bar_base
|
||||
{
|
||||
function bar_dome()
|
||||
{
|
||||
$this->type = "bar_dome";
|
||||
parent::bar_base();
|
||||
}
|
||||
}
|
||||
|
||||
class bar_round3d extends bar_base
|
||||
{
|
||||
function bar_round3d()
|
||||
{
|
||||
$this->type = "bar_round3d";
|
||||
parent::bar_base();
|
||||
}
|
||||
}
|
||||
|
||||
class bar_3d extends bar_base
|
||||
{
|
||||
function bar_3d()
|
||||
{
|
||||
$this->type = "bar_3d";
|
||||
parent::bar_base();
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once 'ofc_bar_base.php';
|
||||
|
||||
class bar_sketch extends bar_base
|
||||
{
|
||||
/**
|
||||
* @param $colour as string, HEX colour e.g. '#00ff00'
|
||||
* @param $outline_colour as string, HEX colour e.g. '#ff0000'
|
||||
* @param $fun_factor as integer, range 0 to 10. 0,1 and 2 are pretty boring.
|
||||
* 4 to 6 is a bit fun, 7 and above is lots of fun.
|
||||
*/
|
||||
function bar_sketch( $colour, $outline_colour, $fun_factor )
|
||||
{
|
||||
$this->type = "bar_sketch";
|
||||
parent::bar_base();
|
||||
|
||||
$this->set_colour( $colour );
|
||||
$this->set_outline_colour( $outline_colour );
|
||||
$this->offset = $fun_factor;
|
||||
}
|
||||
|
||||
function set_outline_colour( $outline_colour )
|
||||
{
|
||||
$tmp = 'outline-colour';
|
||||
$this->$tmp = $outline_colour;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once 'ofc_bar_base.php';
|
||||
|
||||
class bar_stack extends bar_base
|
||||
{
|
||||
function bar_stack()
|
||||
{
|
||||
$this->type = "bar_stack";
|
||||
parent::bar_base();
|
||||
}
|
||||
|
||||
function append_stack( $v )
|
||||
{
|
||||
$this->append_value( $v );
|
||||
}
|
||||
|
||||
// an array of HEX colours strings
|
||||
// e.g. array( '#ff0000', '#00ff00' );
|
||||
function set_colours( $colours )
|
||||
{
|
||||
$this->colours = $colours;
|
||||
}
|
||||
|
||||
// an array of bar_stack_value
|
||||
function set_keys( $keys )
|
||||
{
|
||||
$this->keys = $keys;
|
||||
}
|
||||
}
|
||||
|
||||
class bar_stack_value
|
||||
{
|
||||
function bar_stack_value( $val, $colour )
|
||||
{
|
||||
$this->val = $val;
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
}
|
||||
|
||||
class bar_stack_key
|
||||
{
|
||||
function bar_stack_key( $colour, $text, $font_size )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
$this->text = $text;
|
||||
$tmp = 'font-size';
|
||||
$this->$tmp = $font_size;
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once 'ofc_bar_base.php';
|
||||
|
||||
class candle_value
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function candle_value( $high, $open, $close, $low )
|
||||
{
|
||||
$this->high = $high;
|
||||
$this->top = $open;
|
||||
$this->bottom = $close;
|
||||
$this->low = $low;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
}
|
||||
|
||||
class candle extends bar_base
|
||||
{
|
||||
function candle($colour, $negative_colour=null)
|
||||
{
|
||||
$this->type = "candle";
|
||||
parent::bar_base();
|
||||
|
||||
$this->set_colour( $colour );
|
||||
if(!is_null($negative_colour))
|
||||
$this->{'negative-colour'} = $negative_colour;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
<?php
|
||||
|
||||
class hbar_value
|
||||
{
|
||||
function hbar_value( $left, $right=null )
|
||||
{
|
||||
if( isset( $right ) )
|
||||
{
|
||||
$this->left = $left;
|
||||
$this->right = $right;
|
||||
}
|
||||
else
|
||||
$this->right = $left;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
}
|
||||
|
||||
class hbar
|
||||
{
|
||||
function hbar( $colour )
|
||||
{
|
||||
$this->type = "hbar";
|
||||
$this->values = array();
|
||||
$this->set_colour( $colour );
|
||||
}
|
||||
|
||||
function append_value( $v )
|
||||
{
|
||||
$this->values[] = $v;
|
||||
}
|
||||
|
||||
function set_values( $v )
|
||||
{
|
||||
foreach( $v as $val )
|
||||
$this->append_value( new hbar_value( $val ) );
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_key( $text, $size )
|
||||
{
|
||||
$this->text = $text;
|
||||
$tmp = 'font-size';
|
||||
$this->$tmp = $size;
|
||||
}
|
||||
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
<?php
|
||||
|
||||
class line_on_show
|
||||
{
|
||||
/**
|
||||
*@param $type as string. Can be any one of:
|
||||
* - 'pop-up'
|
||||
* - 'explode'
|
||||
* - 'mid-slide'
|
||||
* - 'drop'
|
||||
* - 'fade-in'
|
||||
* - 'shrink-in'
|
||||
*
|
||||
* @param $cascade as float. Cascade in seconds
|
||||
* @param $delay as float. Delay before animation starts in seconds.
|
||||
*/
|
||||
function __construct($type, $cascade, $delay)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->cascade = (float)$cascade;
|
||||
$this->delay = (float)$delay;
|
||||
}
|
||||
}
|
||||
|
||||
class line
|
||||
{
|
||||
function line()
|
||||
{
|
||||
$this->type = "line";
|
||||
$this->values = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default dot that all the real
|
||||
* dots inherit their properties from. If you set the
|
||||
* default dot to be red, all values in your chart that
|
||||
* do not specify a colour will be red. Same for all the
|
||||
* other attributes such as tooltip, on-click, size etc...
|
||||
*
|
||||
* @param $style as any class that inherits base_dot
|
||||
*/
|
||||
function set_default_dot_style( $style )
|
||||
{
|
||||
$tmp = 'dot-style';
|
||||
$this->$tmp = $style;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $v as array, can contain any combination of:
|
||||
* - integer, Y position of the point
|
||||
* - any class that inherits from dot_base
|
||||
* - <b>null</b>
|
||||
*/
|
||||
function set_values( $v )
|
||||
{
|
||||
$this->values = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a value to the line.
|
||||
*
|
||||
* @param mixed $v
|
||||
*/
|
||||
function append_value($v)
|
||||
{
|
||||
$this->values[] = $v;
|
||||
}
|
||||
|
||||
function set_width( $width )
|
||||
{
|
||||
$this->width = $width;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
/**
|
||||
* sytnatical sugar for set_colour
|
||||
*/
|
||||
function colour( $colour )
|
||||
{
|
||||
$this->set_colour( $colour );
|
||||
return $this;
|
||||
}
|
||||
|
||||
function set_halo_size( $size )
|
||||
{
|
||||
$tmp = 'halo-size';
|
||||
$this->$tmp = $size;
|
||||
}
|
||||
|
||||
function set_key( $text, $font_size )
|
||||
{
|
||||
$this->text = $text;
|
||||
$tmp = 'font-size';
|
||||
$this->$tmp = $font_size;
|
||||
}
|
||||
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $text as string. A javascript function name as a string. The chart will
|
||||
* try to call this function, it will pass the chart id as the only parameter into
|
||||
* this function. E.g:
|
||||
*
|
||||
*/
|
||||
function set_on_click( $text )
|
||||
{
|
||||
$tmp = 'on-click';
|
||||
$this->$tmp = $text;
|
||||
}
|
||||
|
||||
function loop()
|
||||
{
|
||||
$this->loop = true;
|
||||
}
|
||||
|
||||
function line_style( $s )
|
||||
{
|
||||
$tmp = "line-style";
|
||||
$this->$tmp = $s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text for the line.
|
||||
*
|
||||
* @param string $text
|
||||
*/
|
||||
function set_text($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
function attach_to_right_y_axis()
|
||||
{
|
||||
$this->axis = 'right';
|
||||
}
|
||||
|
||||
/**
|
||||
*@param $on_show as line_on_show object
|
||||
*/
|
||||
function set_on_show($on_show)
|
||||
{
|
||||
$this->{'on-show'} = $on_show;
|
||||
}
|
||||
|
||||
function on_show($on_show)
|
||||
{
|
||||
$this->set_on_show($on_show);
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
<?php
|
||||
|
||||
class line_base
|
||||
{
|
||||
function line_base()
|
||||
{
|
||||
$this->type = "line";
|
||||
$this->text = "Page views";
|
||||
$tmp = 'font-size';
|
||||
$this->$tmp = 10;
|
||||
|
||||
$this->values = array();
|
||||
}
|
||||
|
||||
function set_values( $v )
|
||||
{
|
||||
$this->values = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a value to the line.
|
||||
*
|
||||
* @param mixed $v
|
||||
*/
|
||||
function append_value($v)
|
||||
{
|
||||
$this->values[] = $v;
|
||||
}
|
||||
|
||||
function set_width( $width )
|
||||
{
|
||||
$this->width = $width;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_dot_size( $size )
|
||||
{
|
||||
$tmp = 'dot-size';
|
||||
$this->$tmp = $size;
|
||||
}
|
||||
|
||||
function set_halo_size( $size )
|
||||
{
|
||||
$tmp = 'halo-size';
|
||||
$this->$tmp = $size;
|
||||
}
|
||||
|
||||
function set_key( $text, $font_size )
|
||||
{
|
||||
$this->text = $text;
|
||||
$tmp = 'font-size';
|
||||
$this->$tmp = $font_size;
|
||||
}
|
||||
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
|
||||
function set_on_click( $text )
|
||||
{
|
||||
$tmp = 'on-click';
|
||||
$this->$tmp = $text;
|
||||
}
|
||||
|
||||
function loop()
|
||||
{
|
||||
$this->loop = true;
|
||||
}
|
||||
|
||||
function line_style( $s )
|
||||
{
|
||||
$tmp = "line-style";
|
||||
$this->$tmp = $s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text for the line.
|
||||
*
|
||||
* @param string $text
|
||||
*/
|
||||
function set_text($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
class dot_value
|
||||
{
|
||||
function dot_value( $value, $colour )
|
||||
{
|
||||
$this->value = $value;
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_size( $size )
|
||||
{
|
||||
$this->size = $size;
|
||||
}
|
||||
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
}
|
||||
|
||||
class line_dot extends line_base
|
||||
{
|
||||
function line_dot()
|
||||
{
|
||||
$this->type = "line_dot";
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
|
||||
class line_hollow extends line_base
|
||||
{
|
||||
function line_hollow()
|
||||
{
|
||||
$this->type = "line_hollow";
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
class line_style
|
||||
{
|
||||
function line_style($on, $off)
|
||||
{
|
||||
$this->style = "dash";
|
||||
$this->on = $on;
|
||||
$this->off = $off;
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
|
||||
class ofc_menu_item
|
||||
{
|
||||
/**
|
||||
* @param $text as string. The menu item text.
|
||||
* @param $javascript_function_name as string. The javascript function name, the
|
||||
* js function takes one parameter, the chart ID. See ofc_menu_item_camera for
|
||||
* some example code.
|
||||
*/
|
||||
function ofc_menu_item($text, $javascript_function_name)
|
||||
{
|
||||
$this->type = "text";
|
||||
$this->text = $text;
|
||||
$tmp = 'javascript-function';
|
||||
$this->$tmp = $javascript_function_name;
|
||||
}
|
||||
}
|
||||
|
||||
class ofc_menu_item_camera
|
||||
{
|
||||
/**
|
||||
* @param $text as string. The menu item text.
|
||||
* @param $javascript_function_name as string. The javascript function name, the
|
||||
* js function takes one parameter, the chart ID. So for example, our js function
|
||||
* could look like this:
|
||||
*
|
||||
* function save_image( chart_id )
|
||||
* {
|
||||
* alert( chart_id );
|
||||
* }
|
||||
*
|
||||
* to make a menu item call this: ofc_menu_item_camera('Save chart', 'save_image');
|
||||
*/
|
||||
function ofc_menu_item_camera($text, $javascript_function_name)
|
||||
{
|
||||
$this->type = "camera-icon";
|
||||
$this->text = $text;
|
||||
$tmp = 'javascript-function';
|
||||
$this->$tmp = $javascript_function_name;
|
||||
}
|
||||
}
|
||||
|
||||
class ofc_menu
|
||||
{
|
||||
function ofc_menu($colour, $outline_colour)
|
||||
{
|
||||
$this->colour = $colour;
|
||||
$this->outline_colour = $outline_colour;
|
||||
}
|
||||
|
||||
function values($values)
|
||||
{
|
||||
$this->values = $values;
|
||||
}
|
||||
}
|
|
@ -1,257 +0,0 @@
|
|||
<?php
|
||||
|
||||
class pie_value
|
||||
{
|
||||
function pie_value( $value, $label )
|
||||
{
|
||||
$this->value = $value;
|
||||
$this->label = $label;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_label( $label, $label_colour, $font_size )
|
||||
{
|
||||
$this->label = $label;
|
||||
|
||||
$tmp = 'label-colour';
|
||||
$this->$tmp = $label_colour;
|
||||
|
||||
$tmp = 'font-size';
|
||||
$this->$tmp = $font_size;
|
||||
|
||||
}
|
||||
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
|
||||
function on_click( $event )
|
||||
{
|
||||
$tmp = 'on-click';
|
||||
$this->$tmp = $event;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* An object that inherits from base_pie_animation
|
||||
*/
|
||||
function add_animation( $animation )
|
||||
{
|
||||
if( !isset( $this->animate ) )
|
||||
$this->animate = array();
|
||||
|
||||
$this->animate[] = $animation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
class base_pie_animation{}
|
||||
|
||||
/**
|
||||
* fade the pie slice from $alpha (pie set_alpha) to 100% opaque.
|
||||
*/
|
||||
class pie_fade extends base_pie_animation
|
||||
{
|
||||
function pie_fade()
|
||||
{
|
||||
$this->type="fade";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bounce the pie slice out a little
|
||||
*/
|
||||
class pie_bounce extends base_pie_animation
|
||||
{
|
||||
/**
|
||||
* @param $distance as integer, distance to bounce in pixels
|
||||
*/
|
||||
function pie_bounce( $distance )
|
||||
{
|
||||
$this->type="bounce";
|
||||
$this->distance = $distance;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a pie chart and fill it with pie slices
|
||||
*/
|
||||
class pie
|
||||
{
|
||||
function pie()
|
||||
{
|
||||
$this->type = 'pie';
|
||||
}
|
||||
|
||||
function set_colours( $colours )
|
||||
{
|
||||
$this->colours = $colours;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sugar wrapped around set_colours
|
||||
*/
|
||||
function colours( $colours )
|
||||
{
|
||||
$this->set_colours( $colours );
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $alpha as float (0-1) 0.75 = 3/4 visible
|
||||
*/
|
||||
function set_alpha( $alpha )
|
||||
{
|
||||
$this->alpha = $alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
*sugar wrapped set_alpha
|
||||
**/
|
||||
function alpha( $alpha )
|
||||
{
|
||||
$this->set_alpha( $alpha );
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $v as array containing one of
|
||||
* - null
|
||||
* - real or integer number
|
||||
* - a pie_value object
|
||||
*/
|
||||
function set_values( $v )
|
||||
{
|
||||
$this->values = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* sugar for set_values
|
||||
*/
|
||||
function values( $v )
|
||||
{
|
||||
$this->set_values( $v );
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* HACK to keep old code working.
|
||||
*/
|
||||
function set_animate( $bool )
|
||||
{
|
||||
if( $bool )
|
||||
$this->add_animation( new pie_fade() );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* An object that inherits from base_pie_animation
|
||||
*/
|
||||
function add_animation( $animation )
|
||||
{
|
||||
if( !isset( $this->animate ) )
|
||||
$this->animate = array();
|
||||
|
||||
$this->animate[] = $animation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $angle as real number
|
||||
*/
|
||||
function set_start_angle( $angle )
|
||||
{
|
||||
$tmp = 'start-angle';
|
||||
$this->$tmp = $angle;
|
||||
}
|
||||
|
||||
/**
|
||||
* sugar for set_start_angle
|
||||
*/
|
||||
function start_angle($angle)
|
||||
{
|
||||
$this->set_start_angle( $angle );
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $tip as string. The tooltip text. May contain magic varibles
|
||||
*/
|
||||
function set_tooltip( $tip )
|
||||
{
|
||||
$this->tip = $tip;
|
||||
}
|
||||
|
||||
/**
|
||||
* sugar for set_tooltip
|
||||
*/
|
||||
function tooltip( $tip )
|
||||
{
|
||||
$this->set_tooltip( $tip );
|
||||
return $this;
|
||||
}
|
||||
|
||||
function set_gradient_fill()
|
||||
{
|
||||
$tmp = 'gradient-fill';
|
||||
$this->$tmp = true;
|
||||
}
|
||||
|
||||
function gradient_fill()
|
||||
{
|
||||
$this->set_gradient_fill();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* By default each label is the same colour as the slice,
|
||||
* but you can ovveride that behaviour using this method.
|
||||
*
|
||||
* @param $label_colour as string HEX colour;
|
||||
*/
|
||||
function set_label_colour( $label_colour )
|
||||
{
|
||||
$tmp = 'label-colour';
|
||||
$this->$tmp = $label_colour;
|
||||
}
|
||||
|
||||
function label_colour( $label_colour )
|
||||
{
|
||||
$this->set_label_colour( $label_colour );
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn off the labels
|
||||
*/
|
||||
function set_no_labels()
|
||||
{
|
||||
$tmp = 'no-labels';
|
||||
$this->$tmp = true;
|
||||
}
|
||||
|
||||
function on_click( $event )
|
||||
{
|
||||
$tmp = 'on-click';
|
||||
$this->$tmp = $event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix the radius of the pie chart. Take a look at the magic variable #radius#
|
||||
* for helping figure out what radius to set it to.
|
||||
*
|
||||
* @param $radius as number
|
||||
*/
|
||||
function radius( $radius )
|
||||
{
|
||||
$this->radius = $radius;
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
|
||||
class radar_axis
|
||||
{
|
||||
function radar_axis( $max )
|
||||
{
|
||||
$this->set_max( $max );
|
||||
}
|
||||
|
||||
function set_max( $max )
|
||||
{
|
||||
$this->max = $max;
|
||||
}
|
||||
|
||||
function set_steps( $steps )
|
||||
{
|
||||
$this->steps = $steps;
|
||||
}
|
||||
|
||||
function set_stroke( $s )
|
||||
{
|
||||
$this->stroke = $s;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_grid_colour( $colour )
|
||||
{
|
||||
$tmp = 'grid-colour';
|
||||
$this->$tmp = $colour;
|
||||
}
|
||||
|
||||
function set_labels( $labels )
|
||||
{
|
||||
$this->labels = $labels;
|
||||
}
|
||||
|
||||
function set_spoke_labels( $labels )
|
||||
{
|
||||
$tmp = 'spoke-labels';
|
||||
$this->$tmp = $labels;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
|
||||
class radar_axis_labels
|
||||
{
|
||||
// $labels : array
|
||||
function radar_axis_labels( $labels )
|
||||
{
|
||||
$this->labels = $labels;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
|
||||
class radar_spoke_labels
|
||||
{
|
||||
// $labels : array
|
||||
function radar_spoke_labels( $labels )
|
||||
{
|
||||
$this->labels = $labels;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
|
||||
class scatter_value
|
||||
{
|
||||
function scatter_value( $x, $y, $dot_size=-1 )
|
||||
{
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
|
||||
if( $dot_size > 0 )
|
||||
{
|
||||
$tmp = 'dot-size';
|
||||
$this->$tmp = $dot_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class scatter
|
||||
{
|
||||
function scatter( $colour )
|
||||
{
|
||||
$this->type = "scatter";
|
||||
$this->set_colour( $colour );
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_default_dot_style( $style )
|
||||
{
|
||||
$tmp = 'dot-style';
|
||||
$this->$tmp = $style;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $v as array, can contain any combination of:
|
||||
* - integer, Y position of the point
|
||||
* - any class that inherits from scatter_value
|
||||
* - <b>null</b>
|
||||
*/
|
||||
function set_values( $values )
|
||||
{
|
||||
$this->values = $values;
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
|
||||
class scatter_line
|
||||
{
|
||||
function scatter_line( $colour, $width )
|
||||
{
|
||||
$this->type = "scatter_line";
|
||||
$this->set_colour( $colour );
|
||||
$this->set_width( $width );
|
||||
}
|
||||
|
||||
function set_default_dot_style( $style )
|
||||
{
|
||||
$tmp = 'dot-style';
|
||||
$this->$tmp = $style;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_width( $width )
|
||||
{
|
||||
$this->width = $width;
|
||||
}
|
||||
|
||||
function set_values( $values )
|
||||
{
|
||||
$this->values = $values;
|
||||
}
|
||||
|
||||
function set_step_horizontal()
|
||||
{
|
||||
$this->stepgraph = 'horizontal';
|
||||
}
|
||||
|
||||
function set_step_vertical()
|
||||
{
|
||||
$this->stepgraph = 'vertical';
|
||||
}
|
||||
|
||||
function set_key( $text, $font_size )
|
||||
{
|
||||
$this->text = $text;
|
||||
$tmp = 'font-size';
|
||||
$this->$tmp = $font_size;
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
class shape_point
|
||||
{
|
||||
function shape_point( $x, $y )
|
||||
{
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
}
|
||||
}
|
||||
|
||||
class shape
|
||||
{
|
||||
function shape( $colour )
|
||||
{
|
||||
$this->type = "shape";
|
||||
$this->colour = $colour;
|
||||
$this->values = array();
|
||||
}
|
||||
|
||||
function append_value( $p )
|
||||
{
|
||||
$this->values[] = $p;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Sugar: to make stars easier sometimes
|
||||
*/
|
||||
class s_star extends star
|
||||
{
|
||||
/**
|
||||
* I use this wrapper for default dot types,
|
||||
* it just makes the code easier to read.
|
||||
*/
|
||||
function s_star($colour, $size)
|
||||
{
|
||||
parent::star();
|
||||
$this->colour($colour)->size($size);
|
||||
}
|
||||
}
|
||||
|
||||
class s_box extends anchor
|
||||
{
|
||||
/**
|
||||
* I use this wrapper for default dot types,
|
||||
* it just makes the code easier to read.
|
||||
*/
|
||||
function s_box($colour, $size)
|
||||
{
|
||||
parent::anchor();
|
||||
$this->colour($colour)->size($size)->rotation(45)->sides(4);
|
||||
}
|
||||
}
|
||||
|
||||
class s_hollow_dot extends hollow_dot
|
||||
{
|
||||
/**
|
||||
* I use this wrapper for default dot types,
|
||||
* it just makes the code easier to read.
|
||||
*/
|
||||
function s_hollow_dot($colour, $size)
|
||||
{
|
||||
parent::hollow_dot();
|
||||
$this->colour($colour)->size($size);
|
||||
}
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
<?php
|
||||
|
||||
class ofc_tags
|
||||
{
|
||||
function ofc_tags()
|
||||
{
|
||||
$this->type = "tags";
|
||||
$this->values = array();
|
||||
}
|
||||
|
||||
function colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*@param $font as string. e.g. "Verdana"
|
||||
*@param $size as integer. Size in px
|
||||
*/
|
||||
function font($font, $size)
|
||||
{
|
||||
$this->font = $font;
|
||||
$this->{'font-size'} = $size;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*@param $x as integer. Size of x padding in px
|
||||
*@param $y as integer. Size of y padding in px
|
||||
*/
|
||||
function padding($x, $y)
|
||||
{
|
||||
$this->{"pad-x"} = $x;
|
||||
$this->{"pad-y"} = $y;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function rotate($angle)
|
||||
{
|
||||
$this->rotate($angle);
|
||||
return $this;
|
||||
}
|
||||
|
||||
function align_x_center()
|
||||
{
|
||||
$this->{"align-x"} = "center";
|
||||
return $this;
|
||||
}
|
||||
|
||||
function align_x_left()
|
||||
{
|
||||
$this->{"align-x"} = "left";
|
||||
return $this;
|
||||
}
|
||||
|
||||
function align_x_right()
|
||||
{
|
||||
$this->{"align-x"} = "right";
|
||||
return $this;
|
||||
}
|
||||
|
||||
function align_y_above()
|
||||
{
|
||||
$this->{"align-y"} = "above";
|
||||
return $this;
|
||||
}
|
||||
|
||||
function align_y_below()
|
||||
{
|
||||
$this->{"align-y"} = "below";
|
||||
return $this;
|
||||
}
|
||||
|
||||
function align_y_center()
|
||||
{
|
||||
$this->{"align-y"} = "center";
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This can contain some HTML, e.g:
|
||||
* - "More <a href="javascript:alert(12);">info</a>"
|
||||
* - "<a href="http://teethgrinder.co.uk">ofc</a>"
|
||||
*/
|
||||
function text($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This works, but to get the mouse pointer to change
|
||||
* to a little hand you need to use "<a href="">stuff</a>"-- see text()
|
||||
*/
|
||||
function on_click($on_click)
|
||||
{
|
||||
$this->{'on-click'} = $on_click;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*@param $bold boolean.
|
||||
*@param $underline boolean.
|
||||
*@param $border boolean.
|
||||
*@prarm $alpha real (0 to 1.0)
|
||||
*/
|
||||
function style($bold, $underline, $border, $alpha )
|
||||
{
|
||||
$this->bold = $bold;
|
||||
$this->border = $underline;
|
||||
$this->underline = $border;
|
||||
$this->alpha = $alpha;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*@param $tag as ofc_tag
|
||||
*/
|
||||
function append_tag($tag)
|
||||
{
|
||||
$this->values[] = $tag;
|
||||
}
|
||||
}
|
||||
|
||||
class ofc_tag extends ofc_tags
|
||||
{
|
||||
function ofc_tag($x, $y)
|
||||
{
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Set the title of a chart, make one of these and pass it into
|
||||
* open_flash_chart set_title
|
||||
*/
|
||||
class title
|
||||
{
|
||||
function title( $text='' )
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* A css string. Can optionally contain:
|
||||
* - font-size
|
||||
* - font-family
|
||||
* - font-weight
|
||||
* - color
|
||||
* - background-color
|
||||
* - text-align
|
||||
* - margin
|
||||
* - margin-left
|
||||
* - margin-right
|
||||
* - margin-top
|
||||
* - margin-bottom
|
||||
* - padding
|
||||
* - padding-left
|
||||
* - padding-right
|
||||
* - padding-top
|
||||
* - padding-bottom
|
||||
* just like the css we use all the time :-)
|
||||
*/
|
||||
function set_style( $css )
|
||||
{
|
||||
$this->style = $css;
|
||||
//"{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}";
|
||||
}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once 'ofc_bar_base.php';
|
||||
|
||||
class tooltip
|
||||
{
|
||||
function tooltip(){}
|
||||
|
||||
/**
|
||||
* @param $shadow as boolean. Enable drop shadow.
|
||||
*/
|
||||
function set_shadow( $shadow )
|
||||
{
|
||||
$this->shadow = $shadow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $stroke as integer, border width in pixels (e.g. 5 )
|
||||
*/
|
||||
function set_stroke( $stroke )
|
||||
{
|
||||
$this->stroke = $stroke;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $colour as string, HEX colour e.g. '#0000ff'
|
||||
*/
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $bg as string, HEX colour e.g. '#0000ff'
|
||||
*/
|
||||
function set_background_colour( $bg )
|
||||
{
|
||||
$this->background = $bg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $style as string. A css style.
|
||||
*/
|
||||
function set_title_style( $style )
|
||||
{
|
||||
$this->title = $style;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $style as string. A css style.
|
||||
*/
|
||||
function set_body_style( $style )
|
||||
{
|
||||
$this->body = $style;
|
||||
}
|
||||
|
||||
function set_proximity()
|
||||
{
|
||||
$this->mouse = 1;
|
||||
}
|
||||
|
||||
function set_hover()
|
||||
{
|
||||
$this->mouse = 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,140 +0,0 @@
|
|||
<?php
|
||||
|
||||
class x_axis
|
||||
{
|
||||
function x_axis(){}
|
||||
|
||||
/**
|
||||
* @param $stroke as integer, with of the line and ticks
|
||||
*/
|
||||
function set_stroke( $stroke )
|
||||
{
|
||||
$this->stroke = $stroke;
|
||||
}
|
||||
|
||||
function stroke( $stroke )
|
||||
{
|
||||
$this->set_stroke( $stroke );
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*@param $colour as string HEX colour
|
||||
*@param $grid_colour as string HEX colour
|
||||
*/
|
||||
function set_colours( $colour, $grid_colour )
|
||||
{
|
||||
$this->set_colour( $colour );
|
||||
$this->set_grid_colour( $grid_colour );
|
||||
}
|
||||
|
||||
/**
|
||||
*@param $colour as string HEX colour
|
||||
*/
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function colour( $colour )
|
||||
{
|
||||
$this->set_colour($colour);
|
||||
return $this;
|
||||
}
|
||||
|
||||
function set_tick_height( $height )
|
||||
{
|
||||
$tmp = 'tick-height';
|
||||
$this->$tmp = $height;
|
||||
}
|
||||
|
||||
function tick_height( $height )
|
||||
{
|
||||
$this->set_tick_height($height);
|
||||
return $this;
|
||||
}
|
||||
|
||||
function set_grid_colour( $colour )
|
||||
{
|
||||
$tmp = 'grid-colour';
|
||||
$this->$tmp = $colour;
|
||||
}
|
||||
|
||||
function grid_colour( $colour )
|
||||
{
|
||||
$this->set_grid_colour($colour);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $o is a boolean. If true, the X axis start half a step in
|
||||
* This defaults to True
|
||||
*/
|
||||
function set_offset( $o )
|
||||
{
|
||||
$this->offset = $o?true:false;
|
||||
}
|
||||
|
||||
function offset( $o )
|
||||
{
|
||||
$this->set_offset($o);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $steps as integer. Which grid lines and ticks are visible.
|
||||
*/
|
||||
function set_steps( $steps )
|
||||
{
|
||||
$this->steps = $steps;
|
||||
}
|
||||
|
||||
function steps( $steps )
|
||||
{
|
||||
$this->set_steps($steps);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $val as an integer, the height in pixels of the 3D bar. Mostly
|
||||
* used for the 3D bar chart.
|
||||
*/
|
||||
function set_3d( $val )
|
||||
{
|
||||
$tmp = '3d';
|
||||
$this->$tmp = $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $x_axis_labels as an x_axis_labels object
|
||||
* Use this to customize the labels (colour, font, etc...)
|
||||
*/
|
||||
function set_labels( $x_axis_labels )
|
||||
{
|
||||
//$this->labels = $v;
|
||||
$this->labels = $x_axis_labels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sugar syntax: helper function to make the examples simpler.
|
||||
* @param $a is an array of labels
|
||||
*/
|
||||
function set_labels_from_array( $a )
|
||||
{
|
||||
$x_axis_labels = new x_axis_labels();
|
||||
$x_axis_labels->set_labels( $a );
|
||||
$this->labels = $x_axis_labels;
|
||||
|
||||
if( isset( $this->steps ) )
|
||||
$x_axis_labels->set_steps( $this->steps );
|
||||
}
|
||||
|
||||
/**
|
||||
* min and max.
|
||||
*/
|
||||
function set_range( $min, $max )
|
||||
{
|
||||
$this->min = $min;
|
||||
$this->max = $max;
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* x_axis_label see x_axis_labels
|
||||
*/
|
||||
class x_axis_label
|
||||
{
|
||||
function x_axis_label( $text, $colour, $size, $rotate )
|
||||
{
|
||||
$this->set_text( $text );
|
||||
$this->set_colour( $colour );
|
||||
$this->set_size( $size );
|
||||
$this->set_rotate( $rotate );
|
||||
}
|
||||
|
||||
function set_text( $text )
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_size( $size )
|
||||
{
|
||||
$this->size = $size;
|
||||
}
|
||||
|
||||
function set_rotate( $rotate )
|
||||
{
|
||||
$this->rotate = $rotate;
|
||||
}
|
||||
|
||||
function set_vertical()
|
||||
{
|
||||
$this->rotate = "vertical";
|
||||
}
|
||||
|
||||
function set_visible()
|
||||
{
|
||||
$this->visible = true;
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
<?php
|
||||
|
||||
class x_axis_labels
|
||||
{
|
||||
function x_axis_labels(){}
|
||||
|
||||
/**
|
||||
* @param $steps which labels are generated
|
||||
*/
|
||||
function set_steps( $steps )
|
||||
{
|
||||
$this->steps = $steps;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $steps as integer which labels are visible
|
||||
*/
|
||||
function visible_steps( $steps )
|
||||
{
|
||||
$this->{"visible-steps"} = $steps;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $labels as an array of [x_axis_label or string]
|
||||
*/
|
||||
function set_labels( $labels )
|
||||
{
|
||||
$this->labels = $labels;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
/**
|
||||
* font size in pixels
|
||||
*/
|
||||
function set_size( $size )
|
||||
{
|
||||
$this->size = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* rotate labels
|
||||
*/
|
||||
function set_vertical()
|
||||
{
|
||||
$this->rotate = 270;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param @angle as real. The angle of the text.
|
||||
*/
|
||||
function rotate( $angle )
|
||||
{
|
||||
$this->rotate = $angle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $text as string. Replace and magic variables with actual x axis position.
|
||||
*/
|
||||
function text( $text )
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
|
||||
class x_legend
|
||||
{
|
||||
function x_legend( $text='' )
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
function set_style( $css )
|
||||
{
|
||||
$this->style = $css;
|
||||
//"{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}";
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
class y_axis extends y_axis_base
|
||||
{
|
||||
function y_axis(){}
|
||||
|
||||
/**
|
||||
* @param $colour as string. The grid are the lines inside the chart.
|
||||
* HEX colour, e.g. '#ff0000'
|
||||
*/
|
||||
function set_grid_colour( $colour )
|
||||
{
|
||||
$tmp = 'grid-colour';
|
||||
$this->$tmp = $colour;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
<?php
|
||||
|
||||
class y_axis_base
|
||||
{
|
||||
function y_axis_base(){}
|
||||
|
||||
/**
|
||||
* @param $s as integer, thickness of the Y axis line
|
||||
*/
|
||||
function set_stroke( $s )
|
||||
{
|
||||
$this->stroke = $s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $val as integer. The length of the ticks in pixels
|
||||
*/
|
||||
function set_tick_length( $val )
|
||||
{
|
||||
$tmp = 'tick-length';
|
||||
$this->$tmp = $val;
|
||||
}
|
||||
|
||||
function set_colours( $colour, $grid_colour )
|
||||
{
|
||||
$this->set_colour( $colour );
|
||||
$this->set_grid_colour( $grid_colour );
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_grid_colour( $colour )
|
||||
{
|
||||
$tmp = 'grid-colour';
|
||||
$this->$tmp = $colour;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set min and max values, also (optionally) set the steps value.
|
||||
* You can reverse the chart by setting min larger than max, e.g. min = 10
|
||||
* and max = 0.
|
||||
*
|
||||
* @param $min as integer
|
||||
* @param $max as integer
|
||||
* @param $steps as integer.
|
||||
*/
|
||||
function set_range( $min, $max, $steps=1 )
|
||||
{
|
||||
$this->min = $min;
|
||||
$this->max = $max;
|
||||
$this->set_steps( $steps );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sugar for set_range
|
||||
*/
|
||||
function range( $min, $max, $steps=1 )
|
||||
{
|
||||
$this->set_range( $min, $max, $steps );
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $off as Boolean. If true the Y axis is nudged up half a step.
|
||||
*/
|
||||
function set_offset( $off )
|
||||
{
|
||||
$this->offset = $off?1:0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $y_axis_labels as an y_axis_labels object
|
||||
* Use this to customize the labels (colour, font, etc...)
|
||||
*/
|
||||
function set_labels( $y_axis_labels )
|
||||
{
|
||||
$this->labels = $y_axis_labels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass in some text for each label. This can contain magic variables "#val#" which
|
||||
* will get replaced with the value for that Y axis label. Useful for:
|
||||
* - "£#val#"
|
||||
* - "#val#%"
|
||||
* - "#val# million"
|
||||
*
|
||||
* @param $text as string.
|
||||
*/
|
||||
function set_label_text( $text )
|
||||
{
|
||||
$tmp = new y_axis_labels();
|
||||
$tmp->set_text( $text );
|
||||
$this->labels = $tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $steps as integer.
|
||||
*
|
||||
* Only show every $steps label, e.g. every 10th
|
||||
*/
|
||||
function set_steps( $steps )
|
||||
{
|
||||
$this->steps = $steps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the labels show vertical
|
||||
*/
|
||||
function set_vertical()
|
||||
{
|
||||
$this->rotate = "vertical";
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* y_axis_label see y_axis_labels
|
||||
*/
|
||||
class y_axis_label
|
||||
{
|
||||
function y_axis_label( $y, $text)
|
||||
{
|
||||
$this->y = $y;
|
||||
$this->set_text( $text );
|
||||
}
|
||||
|
||||
function set_text( $text )
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
function set_size( $size )
|
||||
{
|
||||
$this->size = $size;
|
||||
}
|
||||
|
||||
function set_rotate( $rotate )
|
||||
{
|
||||
$this->rotate = $rotate;
|
||||
}
|
||||
|
||||
function set_vertical()
|
||||
{
|
||||
$this->rotate = "vertical";
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
class y_axis_labels
|
||||
{
|
||||
function y_axis_labels(){}
|
||||
|
||||
/**
|
||||
* @param $steps which labels are generated
|
||||
*/
|
||||
function set_steps( $steps )
|
||||
{
|
||||
$this->steps = $steps;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $labels as an array of [y_axis_label or string]
|
||||
*/
|
||||
function set_labels( $labels )
|
||||
{
|
||||
$this->labels = $labels;
|
||||
}
|
||||
|
||||
function set_colour( $colour )
|
||||
{
|
||||
$this->colour = $colour;
|
||||
}
|
||||
|
||||
/**
|
||||
* font size in pixels
|
||||
*/
|
||||
function set_size( $size )
|
||||
{
|
||||
$this->size = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* rotate labels
|
||||
*/
|
||||
function set_vertical()
|
||||
{
|
||||
$this->rotate = 270;
|
||||
}
|
||||
|
||||
function rotate( $angle )
|
||||
{
|
||||
$this->rotate = $angle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $text default text that all labels inherit
|
||||
*/
|
||||
function set_text( $text )
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
<?php
|
||||
|
||||
class y_axis_right extends y_axis_base
|
||||
{
|
||||
function y_axis_right(){}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
|
||||
class y_legend
|
||||
{
|
||||
function y_legend( $text='' )
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
function set_style( $css )
|
||||
{
|
||||
$this->style = $css;
|
||||
//"{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}";
|
||||
}
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
<?php
|
||||
|
||||
function open_flash_chart_object_str( $width, $height, $url, $use_swfobject=true, $base='' )
|
||||
{
|
||||
//
|
||||
// return the HTML as a string
|
||||
//
|
||||
return _ofc( $width, $height, $url, $use_swfobject, $base );
|
||||
}
|
||||
|
||||
function open_flash_chart_object( $width, $height, $url, $use_swfobject=true, $base='' )
|
||||
{
|
||||
//
|
||||
// stream the HTML into the page
|
||||
//
|
||||
echo _ofc( $width, $height, $url, $use_swfobject, $base );
|
||||
}
|
||||
|
||||
function _ofc( $width, $height, $url, $use_swfobject, $base )
|
||||
{
|
||||
//
|
||||
// I think we may use swfobject for all browsers,
|
||||
// not JUST for IE...
|
||||
//
|
||||
//$ie = strstr(getenv('HTTP_USER_AGENT'), 'MSIE');
|
||||
|
||||
//
|
||||
// escape the & and stuff:
|
||||
//
|
||||
$url = urlencode($url);
|
||||
|
||||
//
|
||||
// output buffer
|
||||
//
|
||||
$out = array();
|
||||
|
||||
//
|
||||
// check for http or https:
|
||||
//
|
||||
if (isset ($_SERVER['HTTPS']))
|
||||
{
|
||||
if (strtoupper ($_SERVER['HTTPS']) == 'ON')
|
||||
{
|
||||
$protocol = 'https';
|
||||
}
|
||||
else
|
||||
{
|
||||
$protocol = 'http';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$protocol = 'http';
|
||||
}
|
||||
|
||||
//
|
||||
// if there are more than one charts on the
|
||||
// page, give each a different ID
|
||||
//
|
||||
global $open_flash_chart_seqno;
|
||||
$obj_id = 'chart';
|
||||
$div_name = 'flashcontent';
|
||||
|
||||
//$out[] = '<script type="text/javascript" src="'. $base .'js/ofc.js"></script>';
|
||||
|
||||
if( !isset( $open_flash_chart_seqno ) )
|
||||
{
|
||||
$open_flash_chart_seqno = 1;
|
||||
$out[] = '<script type="text/javascript" src="'. $base .'js/swfobject.js"></script>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$open_flash_chart_seqno++;
|
||||
$obj_id .= '_'. $open_flash_chart_seqno;
|
||||
$div_name .= '_'. $open_flash_chart_seqno;
|
||||
}
|
||||
|
||||
if( $use_swfobject )
|
||||
{
|
||||
// Using library for auto-enabling Flash object on IE, disabled-Javascript proof
|
||||
$out[] = '<div id="'. $div_name .'"></div>';
|
||||
$out[] = '<script type="text/javascript">';
|
||||
$out[] = 'var so = new SWFObject("'. $base .'open-flash-chart.swf", "'. $obj_id .'", "'. $width . '", "' . $height . '", "9", "#FFFFFF");';
|
||||
|
||||
$out[] = 'so.addVariable("data-file", "'. $url . '");';
|
||||
|
||||
$out[] = 'so.addParam("allowScriptAccess", "always" );//"sameDomain");';
|
||||
$out[] = 'so.write("'. $div_name .'");';
|
||||
$out[] = '</script>';
|
||||
$out[] = '<noscript>';
|
||||
}
|
||||
|
||||
$out[] = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="' . $protocol . '://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
|
||||
$out[] = 'width="' . $width . '" height="' . $height . '" id="ie_'. $obj_id .'" align="middle">';
|
||||
$out[] = '<param name="allowScriptAccess" value="sameDomain" />';
|
||||
$out[] = '<param name="movie" value="'. $base .'open-flash-chart.swf?data='. $url .'" />';
|
||||
$out[] = '<param name="quality" value="high" />';
|
||||
$out[] = '<param name="bgcolor" value="#FFFFFF" />';
|
||||
$out[] = '<embed src="'. $base .'open-flash-chart.swf?data=' . $url .'" quality="high" bgcolor="#FFFFFF" width="'. $width .'" height="'. $height .'" name="'. $obj_id .'" align="middle" allowScriptAccess="sameDomain" ';
|
||||
$out[] = 'type="application/x-shockwave-flash" pluginspage="' . $protocol . '://www.macromedia.com/go/getflashplayer" id="'. $obj_id .'"/>';
|
||||
$out[] = '</object>';
|
||||
|
||||
if ( $use_swfobject ) {
|
||||
$out[] = '</noscript>';
|
||||
}
|
||||
|
||||
return implode("\n",$out);
|
||||
}
|
||||
?>
|
|
@ -1,178 +0,0 @@
|
|||
<?php
|
||||
|
||||
// var_dump(debug_backtrace());
|
||||
|
||||
//
|
||||
// Omar Kilani's php C extension for encoding JSON has been incorporated in stock PHP since 5.2.0
|
||||
// http://www.aurore.net/projects/php-json/
|
||||
//
|
||||
// -- Marcus Engene
|
||||
//
|
||||
if (! function_exists('json_encode'))
|
||||
{
|
||||
include_once 'JSON.php';
|
||||
}
|
||||
|
||||
include_once 'json_format.php';
|
||||
|
||||
// ofc classes
|
||||
include_once 'ofc_title.php';
|
||||
include_once 'ofc_y_axis_base.php';
|
||||
include_once 'ofc_y_axis.php';
|
||||
include_once 'ofc_y_axis_right.php';
|
||||
include_once 'ofc_y_axis_labels.php';
|
||||
include_once 'ofc_y_axis_label.php';
|
||||
include_once 'ofc_x_axis.php';
|
||||
|
||||
|
||||
include_once 'ofc_pie.php';
|
||||
//include_once 'ofc_bar.php';
|
||||
include_once 'ofc_bar_glass.php';
|
||||
include_once 'ofc_bar_filled.php';
|
||||
include_once 'ofc_bar_stack.php';
|
||||
//include_once 'ofc_bar_3d.php';
|
||||
include_once 'ofc_hbar.php';
|
||||
include_once 'ofc_line_base.php';
|
||||
include_once 'ofc_line.php';
|
||||
//include_once 'ofc_line_dot.php';
|
||||
//include_once 'ofc_line_hollow.php';
|
||||
include_once 'ofc_candle.php';
|
||||
include_once 'ofc_area_base.php';
|
||||
include_once 'ofc_tags.php';
|
||||
include_once 'ofc_arrow.php';
|
||||
//include_once 'ofc_area_hollow.php';
|
||||
//include_once 'ofc_area_line.php';
|
||||
|
||||
include_once 'ofc_x_legend.php';
|
||||
include_once 'ofc_y_legend.php';
|
||||
include_once 'ofc_bar_sketch.php';
|
||||
include_once 'ofc_scatter.php';
|
||||
include_once 'ofc_scatter_line.php';
|
||||
include_once 'ofc_x_axis_labels.php';
|
||||
include_once 'ofc_x_axis_label.php';
|
||||
include_once 'ofc_tooltip.php';
|
||||
include_once 'ofc_shape.php';
|
||||
include_once 'ofc_radar_axis.php';
|
||||
include_once 'ofc_radar_axis_labels.php';
|
||||
include_once 'ofc_radar_spoke_labels.php';
|
||||
include_once 'ofc_line_style.php';
|
||||
|
||||
include_once 'dot_base.php';
|
||||
include_once 'ofc_menu.php';
|
||||
|
||||
class open_flash_chart
|
||||
{
|
||||
function open_flash_chart()
|
||||
{
|
||||
//$this->title = new title( "Many data lines" );
|
||||
$this->elements = array();
|
||||
}
|
||||
|
||||
function set_title( $t )
|
||||
{
|
||||
$this->title = $t;
|
||||
}
|
||||
|
||||
function set_x_axis( $x )
|
||||
{
|
||||
$this->x_axis = $x;
|
||||
}
|
||||
|
||||
function set_y_axis( $y )
|
||||
{
|
||||
$this->y_axis = $y;
|
||||
}
|
||||
|
||||
function add_y_axis( $y )
|
||||
{
|
||||
$this->y_axis = $y;
|
||||
}
|
||||
|
||||
function set_y_axis_right( $y )
|
||||
{
|
||||
$this->y_axis_right = $y;
|
||||
}
|
||||
|
||||
function add_element( $e )
|
||||
{
|
||||
$this->elements[] = $e;
|
||||
}
|
||||
|
||||
function set_x_legend( $x )
|
||||
{
|
||||
$this->x_legend = $x;
|
||||
}
|
||||
|
||||
function set_y_legend( $y )
|
||||
{
|
||||
$this->y_legend = $y;
|
||||
}
|
||||
|
||||
function set_bg_colour( $colour )
|
||||
{
|
||||
$this->bg_colour = $colour;
|
||||
}
|
||||
|
||||
function set_radar_axis( $radar )
|
||||
{
|
||||
$this->radar_axis = $radar;
|
||||
}
|
||||
|
||||
function set_tooltip( $tooltip )
|
||||
{
|
||||
$this->tooltip = $tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a bit funky :(
|
||||
*
|
||||
* @param $num_decimals as integer. Truncate the decimals to $num_decimals, e.g. set it
|
||||
* to 5 and 3.333333333 will display as 3.33333. 2.0 will display as 2 (or 2.00000 - see below)
|
||||
* @param $is_fixed_num_decimals_forced as boolean. If true it will pad the decimals.
|
||||
* @param $is_decimal_separator_comma as boolean
|
||||
* @param $is_thousand_separator_disabled as boolean
|
||||
*
|
||||
* This needs a bit of love and attention
|
||||
*/
|
||||
function set_number_format($num_decimals, $is_fixed_num_decimals_forced, $is_decimal_separator_comma, $is_thousand_separator_disabled )
|
||||
{
|
||||
$this->num_decimals = $num_decimals;
|
||||
$this->is_fixed_num_decimals_forced = $is_fixed_num_decimals_forced;
|
||||
$this->is_decimal_separator_comma = $is_decimal_separator_comma;
|
||||
$this->is_thousand_separator_disabled = $is_thousand_separator_disabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is experimental and will change as we make it work
|
||||
*
|
||||
* @param $m as ofc_menu
|
||||
*/
|
||||
function set_menu($m)
|
||||
{
|
||||
$this->menu = $m;
|
||||
}
|
||||
|
||||
function toString()
|
||||
{
|
||||
if (function_exists('json_encode'))
|
||||
{
|
||||
return json_encode($this);
|
||||
}
|
||||
else
|
||||
{
|
||||
$json = new Services_JSON();
|
||||
return $json->encode( $this );
|
||||
}
|
||||
}
|
||||
|
||||
function toPrettyString()
|
||||
{
|
||||
return json_format( $this->toString() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// there is no PHP end tag so we don't mess the headers up!
|
||||
//
|
|
@ -1,108 +0,0 @@
|
|||
<?php
|
||||
include '../../includes/admin_config.php';
|
||||
include 'ofc-library/open-flash-chart.php';
|
||||
|
||||
$days = 7;
|
||||
$last_week = time()-86400*$days + 86400;
|
||||
$the_last_week = date('M d', $last_week);
|
||||
$title = new title("User Stats ".$the_last_week." - ".date("M d"));
|
||||
$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
|
||||
|
||||
$vid_stats = $data['video_stats'];
|
||||
$vid_stats = json_decode($vid_stats);
|
||||
|
||||
|
||||
$year = array();
|
||||
|
||||
//Getting This Weeks Data
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i<$days-1)
|
||||
{
|
||||
$date_pattern = date("Y-m-d",$last_week+($i*86400));
|
||||
$data = $db->select(tbl("stats"),"*"," date_added LIKE '%$date_pattern%' ",1);
|
||||
$data = $data[0];
|
||||
$datas[] = $data;
|
||||
}
|
||||
|
||||
$year[] = date("M d",$last_week+($i*86400));
|
||||
}
|
||||
|
||||
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
$day[$i]['video'] = json_decode($datas[$i]['video_stats'],true);
|
||||
$day[$i]['users'] = json_decode($datas[$i]['user_stats'],true);
|
||||
$day[$i]['groups'] = json_decode($datas[$i]['group_stats'],true);
|
||||
|
||||
}
|
||||
$max = 1;
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i==$days-1)
|
||||
{
|
||||
$signups[] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
$active[] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today","status"=>'Ok'))+0;
|
||||
$inactive[] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today","status"=>'ToActivate'))+0;
|
||||
}else{
|
||||
$signups[] =$day[$i]['users']->signups+0;
|
||||
$active[] =$day[$i]['users']->active+0;
|
||||
$inactive[] =$day[$i]['users']->inactive+0;
|
||||
}
|
||||
$max = max($max,$uploads[$i],$inactive[$i],$active[$i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$signups_bars = new bar_cylinder();
|
||||
$signups_bars->set_values($signups);
|
||||
$signups_bars->colour( '#0066ff');
|
||||
$signups_bars->key('Signups', 14);
|
||||
|
||||
$active_bars = new bar_cylinder();
|
||||
$active_bars->set_values($active);
|
||||
$active_bars->colour( '#99cc00');
|
||||
$active_bars->key('Active', 14);
|
||||
|
||||
$inactivebar = new bar_cylinder();
|
||||
$inactivebar->set_values($inactive);
|
||||
$inactivebar->colour( '#BF3B69');
|
||||
$inactivebar->key('Inactive', 14);
|
||||
|
||||
|
||||
|
||||
|
||||
$max = $max+(round($max/2,0.49));
|
||||
$steps = round($max/5,0.49);
|
||||
$y = new y_axis();
|
||||
$y->set_range( 0, $max, $steps);
|
||||
|
||||
|
||||
$chart = new open_flash_chart();
|
||||
$chart->set_title( $title );
|
||||
$chart->add_element( $signups_bars );
|
||||
$chart->add_element( $active_bars );
|
||||
$chart->add_element( $inactivebar );
|
||||
|
||||
$x_labels = new x_axis_labels();
|
||||
$x_labels->set_steps( 1 );
|
||||
$x_labels->set_colour( '#A2ACBA' );
|
||||
$x_labels->set_labels( $year );
|
||||
|
||||
$x = new x_axis();
|
||||
$x->set_colour( '#A2ACBA' );
|
||||
$x->set_grid_colour( '#D7E4A3' );
|
||||
$x->set_offset( true );
|
||||
$x->set_steps(4);
|
||||
// Add the X Axis Labels to the X Axis
|
||||
$x->set_labels( $x_labels );
|
||||
|
||||
$chart->set_x_axis( $x );
|
||||
$chart->set_bg_colour('#ffffff');
|
||||
|
||||
$chart->set_y_axis( $y );
|
||||
|
||||
echo $chart->toString();
|
||||
|
||||
?>
|
|
@ -1,108 +0,0 @@
|
|||
<?php
|
||||
include '../../includes/admin_config.php';
|
||||
include 'ofc-library/open-flash-chart.php';
|
||||
|
||||
$days = 7;
|
||||
$last_week = time()-86400*$days + 86400;
|
||||
$the_last_week = date('M d', $last_week);
|
||||
$title = new title("Video Stats ".$the_last_week." - ".date("M d"));
|
||||
$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
|
||||
|
||||
$vid_stats = $data['video_stats'];
|
||||
$vid_stats = json_decode($vid_stats);
|
||||
|
||||
|
||||
$year = array();
|
||||
|
||||
//Getting This Weeks Data
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i<$days-1)
|
||||
{
|
||||
$date_pattern = date("Y-m-d",$last_week+($i*86400));
|
||||
$data = $db->select(tbl("stats"),"*"," date_added LIKE '%$date_pattern%' ",1);
|
||||
$data = $data[0];
|
||||
$datas[] = $data;
|
||||
}
|
||||
|
||||
$year[] = date("M d",$last_week+($i*86400));
|
||||
}
|
||||
|
||||
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
$day[$i]['video'] = json_decode($datas[$i]['video_stats'],true);
|
||||
$day[$i]['users'] = json_decode($datas[$i]['user_stats'],true);
|
||||
$day[$i]['groups'] = json_decode($datas[$i]['group_stats'],true);
|
||||
|
||||
}
|
||||
$max = 1;
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i==$days-1)
|
||||
{
|
||||
$uploads[] = $cbvid->get_videos(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
$active[] = $cbvid->get_videos(array("count_only"=>true,"date_span"=>"today","active"=>'yes',"status"=>'Successful'))+0;
|
||||
$processing[] = $cbvid->get_videos(array("count_only"=>true,"date_span"=>"today","status"=>'Processing'))+0;
|
||||
}else{
|
||||
$uploads[] =$day[$i]['video']->uploads+0;
|
||||
$active[] =$day[$i]['video']->active+0;
|
||||
$processing[] =$day[$i]['video']->processing+0;
|
||||
}
|
||||
$max = max($max,$uploads[$i],$active[$i],$processing[$i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$total_bars = new bar_cylinder();
|
||||
$total_bars->set_values($uploads);
|
||||
$total_bars->colour( '#0066ff');
|
||||
$total_bars->key('Total', 14);
|
||||
|
||||
$active_bars = new bar_cylinder();
|
||||
$active_bars->set_values($active);
|
||||
$active_bars->colour( '#99cc00');
|
||||
$active_bars->key('Active', 14);
|
||||
|
||||
$processing_bar = new bar_cylinder();
|
||||
$processing_bar->set_values($processing);
|
||||
$processing_bar->colour( '#BF3B69');
|
||||
$processing_bar->key('Processing', 14);
|
||||
|
||||
|
||||
|
||||
|
||||
//$max = $max+(round($max/2,0.49));
|
||||
$steps = round($max/5,0.49);
|
||||
$y = new y_axis();
|
||||
$y->set_range( 0, $max, $steps);
|
||||
|
||||
|
||||
$chart = new open_flash_chart();
|
||||
$chart->set_title( $title );
|
||||
$chart->add_element( $total_bars );
|
||||
$chart->add_element( $active_bars );
|
||||
$chart->add_element( $processing_bar );
|
||||
|
||||
$x_labels = new x_axis_labels();
|
||||
$x_labels->set_steps( 1 );
|
||||
$x_labels->set_colour( '#A2ACBA' );
|
||||
$x_labels->set_labels( $year );
|
||||
|
||||
$x = new x_axis();
|
||||
$x->set_colour( '#A2ACBA' );
|
||||
$x->set_grid_colour( '#D7E4A3' );
|
||||
$x->set_offset( true );
|
||||
$x->set_steps(4);
|
||||
// Add the X Axis Labels to the X Axis
|
||||
$x->set_labels( $x_labels );
|
||||
|
||||
$chart->set_x_axis( $x );
|
||||
$chart->set_bg_colour('#ffffff');
|
||||
|
||||
$chart->set_y_axis( $y );
|
||||
|
||||
echo $chart->toString();
|
||||
|
||||
?>
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*******************************************
|
||||
| Copyright (c) 2007-2010 Clip-Bucket.com & (Arslan Hassan). All rights reserved.
|
||||
| @ Author : ArslanHassan
|
||||
| @ Software : ClipBucket , © PHPBucket.com
|
||||
*******************************************
|
||||
*/
|
||||
|
||||
require_once '../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$userquery->login_check('video_moderation');
|
||||
$pages->page_redir();
|
||||
|
||||
|
||||
//Form Processing
|
||||
if(isset($_POST['add_cateogry'])){
|
||||
$cbcollection->add_category($_POST);
|
||||
}
|
||||
|
||||
//Making Categoyr as Default
|
||||
if(isset($_GET['make_default']))
|
||||
{
|
||||
$cid = mysql_clean($_GET['make_default']);
|
||||
$cbcollection->make_default_category($cid);
|
||||
}
|
||||
|
||||
//Edit Categoty
|
||||
if(isset($_GET['category'])){
|
||||
assign("edit_category","show");
|
||||
if(isset($_POST['update_category']))
|
||||
{
|
||||
$cbcollection->update_category($_POST);
|
||||
}
|
||||
assign('cat_details',$cbcollection->get_category($_GET['category']));
|
||||
}
|
||||
|
||||
//Delete Category
|
||||
if(isset($_GET['delete_category'])){
|
||||
$cbcollection->delete_category($_GET['delete_category']);
|
||||
}
|
||||
|
||||
|
||||
//$cats = $cbcollection->get_categories();
|
||||
//$pid = $cbcollection->get_category_field($_GET['category'],'parent_id');
|
||||
$cats = getCategoryList(array('type'=>'collection'));
|
||||
if($pid)
|
||||
$selected = $pid;
|
||||
|
||||
//$parent_cats = $cbcollection->admin_area_cats($selected);
|
||||
|
||||
|
||||
//Updating Category Order
|
||||
if(isset($_POST['update_order']))
|
||||
{
|
||||
foreach($cats as $cat)
|
||||
{
|
||||
if(!empty($cat['category_id']))
|
||||
{
|
||||
$order = $_POST['category_order_'.$cat['category_id']];
|
||||
$cbcollection->update_cat_order($cat['category_id'],$order);
|
||||
}
|
||||
}
|
||||
|
||||
$cats = getCategoryList(array('type'=>'collection'));
|
||||
|
||||
}
|
||||
|
||||
assign('manage_categories_title','Manage collection categories');
|
||||
assign('type','collection');
|
||||
$Smarty->assign_by_ref('obj',$cbcollection);
|
||||
|
||||
//Assing Category Values
|
||||
assign('category',$cats);
|
||||
assign('categories',$cats);
|
||||
|
||||
//Assing Category Values
|
||||
assign('total',$cbcollection->total_categories());
|
||||
|
||||
subtitle("Collection Category Manager");
|
||||
Assign('msg',@$msg);
|
||||
template_files('category.html');
|
||||
display_it();
|
||||
|
||||
?>
|
|
@ -1,155 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
**************************************************************
|
||||
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.
|
||||
| @ Author : ArslanHassan
|
||||
| @ Software : ClipBucket , © PHPBucket.com
|
||||
***************************************************************
|
||||
*/
|
||||
|
||||
require_once '../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$userquery->login_check('video_moderation');
|
||||
$pages->page_redir();
|
||||
|
||||
if(isset($_GET['make_feature']))
|
||||
{
|
||||
$id = mysql_clean($_GET['make_feature']);
|
||||
$cbcollection->collection_actions('mcf',$id);
|
||||
}
|
||||
|
||||
if(isset($_GET['make_unfeature']))
|
||||
{
|
||||
$id = mysql_clean($_GET['make_unfeature']);
|
||||
$cbcollection->collection_actions('mcuf',$id);
|
||||
}
|
||||
|
||||
if(isset($_GET['activate']))
|
||||
{
|
||||
$id = mysql_clean($_GET['activate']);
|
||||
$cbcollection->collection_actions('ac',$id);
|
||||
}
|
||||
|
||||
if(isset($_GET['deactivate']))
|
||||
{
|
||||
$id = mysql_clean($_GET['deactivate']);
|
||||
$cbcollection->collection_actions('dac',$id);
|
||||
}
|
||||
|
||||
if(isset($_GET['delete_collection']))
|
||||
{
|
||||
$id = mysql_clean($_GET['delete_collection']);
|
||||
$cbcollection->delete_collection($id);
|
||||
}
|
||||
//pr($cbcollection->collection_delete_functions,TRUE);
|
||||
|
||||
/* ACTIONS ON MULTI ITEMS */
|
||||
if(isset($_POST['activate_selected']))
|
||||
{
|
||||
$total = count($_POST['check_collection']);
|
||||
for($i=0;$i<$total;$i++)
|
||||
{
|
||||
$cbcollection->collection_actions('ac',$_POST['check_collection'][$i]);
|
||||
}
|
||||
$eh->flush();
|
||||
e($total." collections has been activated","m");
|
||||
}
|
||||
|
||||
if(isset($_POST['deactivate_selected']))
|
||||
{
|
||||
$total = count($_POST['check_collection']);
|
||||
for($i=0;$i<$total;$i++)
|
||||
{
|
||||
$cbcollection->collection_actions('dac',$_POST['check_collection'][$i]);
|
||||
}
|
||||
$eh->flush();
|
||||
e($total." collections has been deactivated","m");
|
||||
}
|
||||
|
||||
if(isset($_POST['make_featured_selected']))
|
||||
{
|
||||
$total = count($_POST['check_collection']);
|
||||
for($i=0;$i<$total;$i++)
|
||||
{
|
||||
$cbcollection->collection_actions('mcf',$_POST['check_collection'][$i]);
|
||||
}
|
||||
$eh->flush();
|
||||
e($total." collections has been marked as <strong>Featured</strong>","m");
|
||||
}
|
||||
|
||||
if(isset($_POST['make_unfeatured_selected']))
|
||||
{
|
||||
$total = count($_POST['check_collection']);
|
||||
for($i=0;$i<$total;$i++)
|
||||
{
|
||||
$cbcollection->collection_actions('mcuf',$_POST['check_collection'][$i]);
|
||||
}
|
||||
$eh->flush();
|
||||
e($total." collections has been marked as <strong>Unfeatured</strong>","m");
|
||||
}
|
||||
|
||||
if(isset($_POST['make_unfeatured_selected']))
|
||||
{
|
||||
$total = count($_POST['check_collection']);
|
||||
for($i=0;$i<$total;$i++)
|
||||
{
|
||||
$cbcollection->collection_actions('mcuf',$_POST['check_collection'][$i]);
|
||||
}
|
||||
$eh->flush();
|
||||
e($total." collections has been marked as <strong>Unfeatured</strong>","m");
|
||||
}
|
||||
|
||||
if(isset($_POST['delete_selected']))
|
||||
{
|
||||
$total = count($_POST['check_collection']);
|
||||
for($i=0;$i<$total;$i++)
|
||||
{
|
||||
$cbcollection->delete_collection($_POST['check_collection'][$i]);
|
||||
}
|
||||
$eh->flush();
|
||||
e($total." collection(s) has been deleted successfully","m");
|
||||
}
|
||||
|
||||
/* IF SEARCH EXISTS */
|
||||
if($_GET['search'])
|
||||
{
|
||||
$array = array(
|
||||
'name' => $_GET['title'],
|
||||
'tags' => $_GET['tags'],
|
||||
'cid' => $_GET['collectionid'],
|
||||
'type' => $_GET['collection_type'],
|
||||
'user' => $_GET['userid'],
|
||||
'order' => $_GET['order'],
|
||||
'orderby' => $_GET['orderby'],
|
||||
'broadcast' => $_GET['broadcast'],
|
||||
'featured' => $_GET['featured'],
|
||||
'active' => $_GET['active']
|
||||
);
|
||||
}
|
||||
|
||||
$array['order'] = $array['order'] ? $array['order'] : 'date_added';
|
||||
$array['orderby'] = $array['orderby'] ? $array['orderby'] : 'desc';
|
||||
$array['order'] = tbl('collections.'.$array['order'].' '.$array['orderby']);
|
||||
|
||||
$carray = $array;
|
||||
|
||||
/* CREATING LIMIT */
|
||||
$page = mysql_clean($_GET['page']);
|
||||
$get_limit = create_query_limit($page,RESULTS);
|
||||
|
||||
$carray['limit'] = $get_limit;
|
||||
|
||||
$collections = $cbcollection->get_collections($carray);
|
||||
assign('c',$collections);
|
||||
|
||||
/* COUNTING ALL COLLECTIONS */
|
||||
$ccount = $carray;
|
||||
$ccount['count_only'] = TRUE;
|
||||
$total_rows = $cbcollection->get_collections($ccount);
|
||||
$total_pages = count_pages($total_rows,RESULTS);
|
||||
$pages->paginate($total_pages,$page);
|
||||
|
||||
subtitle("Collection Manager");
|
||||
template_files('collection_manager.html');
|
||||
display_it();
|
||||
?>
|
|
@ -1,71 +0,0 @@
|
|||
<?php
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$pages->page_redir();
|
||||
|
||||
if(empty($_GET['type']))
|
||||
$type = "v";
|
||||
else
|
||||
$type = $_GET['type'];
|
||||
$comment_cond = array();
|
||||
$comment_cond['order'] = " comment_id DESC";
|
||||
|
||||
$page = mysql_clean($_GET['page']);
|
||||
$get_limit = create_query_limit($page,RESULTS);
|
||||
$comment_cond['limit'] = $get_limit;
|
||||
assign('type',$type);
|
||||
switch($type)
|
||||
{
|
||||
case "v":
|
||||
default:
|
||||
{
|
||||
$comment_cond['type'] = "v";
|
||||
$comment_cond['type_id'] = "videoid";
|
||||
$comment_cond['sectionTable'] = "video";
|
||||
}
|
||||
break;
|
||||
|
||||
case "c":
|
||||
{
|
||||
$comment_cond['type'] = "c";
|
||||
$comment_cond['type_id'] = "userid";
|
||||
$comment_cond['sectionTable'] = "users";
|
||||
}
|
||||
break;
|
||||
|
||||
case "t":
|
||||
{
|
||||
$comment_cond['type'] = "t";
|
||||
$comment_cond['type_id'] = "topic_id";
|
||||
$comment_cond['sectionTable'] = "group_topics";
|
||||
}
|
||||
break;
|
||||
|
||||
case "cl":
|
||||
{
|
||||
$comment_cond['type'] = "cl";
|
||||
$comment_cond['type_id'] = "collection_id";
|
||||
$comment_cond['sectionTable'] = "collections";
|
||||
}
|
||||
break;
|
||||
|
||||
case "p":
|
||||
{
|
||||
$comment_cond['type'] = "p";
|
||||
$comment_cond['type_id'] = "photo_id";
|
||||
$comment_cond['sectionTable'] = "photos";
|
||||
}
|
||||
break;
|
||||
}
|
||||
$comments = getComments($comment_cond);
|
||||
assign("comments",$comments);
|
||||
|
||||
$comment_cond['count_only'] = TRUE;
|
||||
$total_rows = getComments($comment_cond);
|
||||
$total_pages = count_pages($total_rows,RESULTS);
|
||||
$pages->paginate($total_pages,$page);
|
||||
|
||||
subtitle("Comments");
|
||||
template_files('comments.html');
|
||||
display_it();
|
||||
?>
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* View User Details
|
||||
* @author:Arslan
|
||||
* @Since : Oct 16 09
|
||||
*/
|
||||
require'../includes/admin_config.php';
|
||||
|
||||
|
||||
//Getting list of available testing videos
|
||||
$testVidsDir = ADMINBASEDIR.'/lab_resources/testing_videos';
|
||||
$vidFiles = glob($testVidsDir.'/*');
|
||||
$vdoFiles = array();
|
||||
foreach($vidFiles as $vidFile)
|
||||
{
|
||||
$vdoFiles[] = array('path'=>$vidFile,'name'=>getName($vidFile).'.'.getExt($vidFile));
|
||||
}
|
||||
|
||||
assign('vdoFiles',$vdoFiles);
|
||||
|
||||
|
||||
subtitle("Conversion lab for ClipBucket conversion testing");
|
||||
template_files("conversion_lab.html");
|
||||
display_it();
|
||||
?>
|
|
@ -1,140 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @Author Arslan Hassan
|
||||
* @Since 3.0
|
||||
*
|
||||
* Newly added Conversion Settings for new conversion kit
|
||||
*/
|
||||
|
||||
require_once '../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$userquery->login_check('web_config_access');
|
||||
|
||||
if(isset($_POST['profile_id']))
|
||||
{
|
||||
//checking if there is watermark file..
|
||||
$file = $_FILES['watermark_file'];
|
||||
if($file['tmp_name'])
|
||||
{
|
||||
if(GetExt($file['name'])!='png')
|
||||
{
|
||||
e(lang('Please upload png file only for watermark.'));
|
||||
}else
|
||||
{
|
||||
$waterMarkFile = WATERMARK_DIR.'/'.$_POST['profile_id'].'.png';
|
||||
|
||||
if(file_exists($waterMarkFile))
|
||||
unlink($waterMarkFile);
|
||||
if(move_uploaded_file($file['tmp_name'], $waterMarkFile))
|
||||
{
|
||||
//show success watermark msg
|
||||
|
||||
}else
|
||||
{
|
||||
e(lang("Unable to upload watermark file"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!$_POST['updated_profile'])
|
||||
e(lang("Profile has been created"),"m");
|
||||
else
|
||||
e(lang("Profile has been updated"),"m");
|
||||
}
|
||||
|
||||
/** Update order **/
|
||||
if($_POST['mode']=='update')
|
||||
{
|
||||
if($cbvid->update_video_profile_order($_POST['profile_order']))
|
||||
{
|
||||
e(lang("Profile order has been updated"),"m");
|
||||
}
|
||||
}
|
||||
|
||||
/** Delete profile **/
|
||||
if($_POST['delete_profile'])
|
||||
{
|
||||
$pid = $_POST['delete_profile'];
|
||||
if($cbvid->delete_video_profile($pid))
|
||||
e(lang("Video profile has been removed"),"m");
|
||||
else {
|
||||
e(lang("Unable to delete video profile"));
|
||||
}
|
||||
}
|
||||
|
||||
/** Delete profiles **/
|
||||
if($_POST['mode']=='delete')
|
||||
{
|
||||
$profile_ids = $_POST['profile_ids'];
|
||||
if($profile_ids)
|
||||
foreach($profile_ids as $profile_id)
|
||||
$cbvid->delete_video_profile($profile_id);
|
||||
|
||||
if(count($profile_ids)>0)
|
||||
e(lang("Profiles have been demoved"),"m");
|
||||
else
|
||||
e(lang("Please select profiles you want to delete"));
|
||||
}
|
||||
|
||||
/** Activate/Deactivate Profiles */
|
||||
if($_POST['activate'])
|
||||
{
|
||||
$pid = mysql_clean($_POST['profile_id']);
|
||||
if($_POST['activate']=='yes')
|
||||
$cbvid->action($pid,'activate');
|
||||
else
|
||||
$cbvid->action($pid,'deactivate');
|
||||
}
|
||||
|
||||
/** Activate/deactivate profiles */
|
||||
if($_POST['mode']=='activate' || $_POST['mode']=='deactivate')
|
||||
{
|
||||
|
||||
$profile_ids = $_POST['profile_ids'];
|
||||
if($profile_ids)
|
||||
foreach($profile_ids as $profile_id)
|
||||
{
|
||||
if($_POST['mode']=='activate')
|
||||
{
|
||||
$cbvid->profile_action($profile_id,'activate');
|
||||
|
||||
}else
|
||||
$cbvid->profile_action($profile_id,'deactivate');
|
||||
}
|
||||
|
||||
|
||||
if(count($profile_ids)>0)
|
||||
{
|
||||
if($_POST['mode']=='activate')
|
||||
e(lang('Profiles have been activated'),'m');
|
||||
else
|
||||
e(lang('Profiles have been deactivated'),'m');
|
||||
}else
|
||||
e(lang("Please select profiles you want to activate or deactivate"));
|
||||
}
|
||||
|
||||
$formats = array('flv','mp4','webm','f4v','m4v');
|
||||
$vcodecs = array(''=>'none','libx264'=>'X264 - libx264','libvpx' => 'Webm - libvpx','flv'=>'FLV - flv','mpeg4'=>'Mpeg4 - mpeg4');
|
||||
$acodecs = array(''=>'none','libfaac'=>'FAAC - libfaac','libmp3lame' => 'MP3 - libmp3lame ','libvorbis'=>'Vorbis - libvorbis');;
|
||||
$resizes = array(''=>'none','max'=>'Max','fit'=>'Fit','wxh'=>'WxH');
|
||||
$presets = array(''=>'none','low'=>'low - 240','normal'=>'normal - 480','hq'=>'hq - 720','max'=>'max - 1080');
|
||||
|
||||
assign('formats',$formats);
|
||||
assign('vcodecs', $vcodecs);
|
||||
assign('acodecs',$acodecs);
|
||||
assign('resizes',$resizes);
|
||||
assign('presets',$presets);
|
||||
|
||||
/**
|
||||
* Get list of profiles...
|
||||
*/
|
||||
$profiles = $cbvid->get_video_profiles(array('order'=>' profile_order ASC '));
|
||||
assign('profiles',$profiles);
|
||||
|
||||
|
||||
subtitle('Conversion Settings');
|
||||
template_files('conversion_settings.html');
|
||||
display_it();
|
||||
?>
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* @since : 2009
|
||||
* @author : Arslan Hassan
|
||||
*/
|
||||
require_once '../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$userquery->login_check('admin_access');
|
||||
$pages->page_redir();
|
||||
|
||||
if(isset($_POST['update']))
|
||||
{
|
||||
$text = mysql_clean($_POST['text']);
|
||||
update_announcement($text);
|
||||
$msg = e("Announcement has been updated",'m');
|
||||
}
|
||||
|
||||
subtitle("Annoucment Manager");
|
||||
template_files('edit_announcemnent.html');
|
||||
display_it();
|
||||
|
||||
?>
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
****************************************************************************************************
|
||||
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved. |
|
||||
| @ Author : ArslanHassan |
|
||||
| @ Software : ClipBucket , © PHPBucket.com |
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$userquery->login_check('video_moderation');
|
||||
$pages->page_redir();
|
||||
|
||||
$id = mysql_clean($_GET['collection']);
|
||||
|
||||
if(isset($_POST['update_collection']))
|
||||
{
|
||||
$cbcollection->update_collection();
|
||||
}
|
||||
|
||||
if(isset($_POST['delete_preview']))
|
||||
{
|
||||
$id = mysql_clean($_POST['delete_preview']);
|
||||
$cbcollection->delete_thumbs($id);
|
||||
}
|
||||
|
||||
//Performing Actions
|
||||
if($_GET['mode']!='')
|
||||
{
|
||||
$cbcollection->collection_actions($_GET['mode'],$id);
|
||||
}
|
||||
|
||||
$c = $cbcollection->get_collection($id);
|
||||
switch($c['type'])
|
||||
{
|
||||
case "videos":
|
||||
case "v":
|
||||
{
|
||||
$items = $cbvideo->collection->get_collection_items_with_details($c['collection_id'],NULL,4);
|
||||
}
|
||||
break;
|
||||
|
||||
case "photos":
|
||||
case "p":
|
||||
{
|
||||
$items = $cbphoto->collection->get_collection_items_with_details($c['collection_id'],NULL,4);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(!empty($items))
|
||||
assign('objects',$items);
|
||||
assign('data',$c);
|
||||
|
||||
subtitle("Edit Collection");
|
||||
template_files('edit_collection.html');
|
||||
display_it();
|
||||
?>
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
****************************************************************
|
||||
| Copyright (c) 2007-2008 Clip-Bucket.com. All rights reserved.
|
||||
| @ Author : ArslanHassan
|
||||
| @ Software : ClipBucket , <EFBFBD> PHPBucket.com
|
||||
****************************************************************
|
||||
*/
|
||||
|
||||
require_once '../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
|
||||
$gpid = mysql_clean($_GET['group_id']);
|
||||
|
||||
$gp = $cbgroup->group_exists($gpid);
|
||||
|
||||
if($gp)
|
||||
{
|
||||
$mode = $_GET['mode'];
|
||||
if ( $mode ) {
|
||||
switch ( $mode ) {
|
||||
case 'feature': {
|
||||
$cbgroup->grp_actions('feature',mysql_clean($_GET['group_id']));
|
||||
}break;
|
||||
|
||||
case 'unfeature': {
|
||||
$cbgroup->grp_actions('unfeature',mysql_clean($_GET['group_id']));
|
||||
}break;
|
||||
|
||||
case 'activate': {
|
||||
$cbgroup->grp_actions('activate',mysql_clean($_GET['group_id']));
|
||||
}break;
|
||||
|
||||
case 'deactivate': {
|
||||
$cbgroup->grp_actions('deactivate',mysql_clean($_GET['group_id']));
|
||||
}break;
|
||||
|
||||
default: {
|
||||
e(lang('No or unsupported action provided'));
|
||||
}break;
|
||||
}
|
||||
}
|
||||
if(isset($_POST['update_group']))
|
||||
{
|
||||
$_POST['group_id'] = $gpid;
|
||||
$cbgroup->update_group();
|
||||
//$group = $cbgroup->get_group_details($gpid);
|
||||
|
||||
}
|
||||
$group = $cbgroup->get_details($gpid);
|
||||
assign('group',$group );
|
||||
}else
|
||||
e("Group does not exist");
|
||||
|
||||
|
||||
subtitle("Edit Group");
|
||||
template_files('edit_group.html');
|
||||
display_it();
|
||||
|
||||
?>
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
****************************************************************************************************
|
||||
| Copyright (c) 2007-2008 Clip-Bucket.com. All rights reserved. |
|
||||
| @ Author : ArslanHassan |
|
||||
| @ Software : ClipBucket , © PHPBucket.com |
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
header('location:view_user.php?uid='.$_GET['uid']);
|
||||
|
||||
?>
|
|
@ -1,126 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
****************************************************************************************************
|
||||
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved. |
|
||||
| @ Author : ArslanHassan |
|
||||
| @ Software : ClipBucket , © PHPBucket.com |
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$userquery->login_check('video_moderation');
|
||||
$pages->page_redir();
|
||||
//register_filter('photo_manager_links','cb_some_photo_plugin_links');
|
||||
$id = mysql_clean($_GET['photo']);
|
||||
|
||||
|
||||
if(isset($_POST['update']))
|
||||
{
|
||||
$cbphoto->update_photo();
|
||||
}
|
||||
|
||||
//Performing Actions
|
||||
if($_GET['mode']!='')
|
||||
{
|
||||
$cbphoto->photo_actions($_GET['mode'],$id);
|
||||
}
|
||||
$p = $cbphoto->get_photo($id, true);
|
||||
|
||||
if ( isset($_GET['view']) ) {
|
||||
$view = trim($_GET['view']);
|
||||
switch( $view ) {
|
||||
case "tags": case "ptags": {
|
||||
assign('view','tags');
|
||||
|
||||
if ( isset($_GET['delete_tag']) ) {
|
||||
$tag_id = mysql_clean( $_GET['delete_tag'] );
|
||||
if ( $cbphoto->remove_photo_tag( $tag_id ) ) {
|
||||
e(lang('Photo tag has been deleted successfully'),'m');
|
||||
}
|
||||
}
|
||||
|
||||
$action = mysql_clean( $_POST['action'] );
|
||||
|
||||
switch( $action ) {
|
||||
case 'delete_selected': {
|
||||
$tags = $_POST['check_tag'];
|
||||
$total_tags = count( $tags );
|
||||
if ( $total_tags > 0 ) {
|
||||
foreach( $tags as $tag_id ) {
|
||||
$tag_id = mysql_clean($tag_id);
|
||||
$cbphoto->remove_photo_tag( $tag_id );
|
||||
}
|
||||
$eh->flush_msg();
|
||||
e( lang('Selected photo tags have been deleted successfully'), 'm' );
|
||||
} else {
|
||||
e( lang('Please select tags you want to delete') );
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
$array = array();
|
||||
$array['pid'] = $id;
|
||||
if( isset($_GET['search']) ) {
|
||||
$array['tag'] = $_GET['tag'];
|
||||
$array['order'] = $_GET['order'];
|
||||
$array['tagger'] = $_GET['tagger'];
|
||||
$array['tagged'] = $_GET['tagged'];
|
||||
$array['orderby'] = $_GET['orderby'];
|
||||
$array['user_tagged_only'] = $_GET['only_user'];
|
||||
}
|
||||
|
||||
$array['order'] = $array['order'] ? $array['order'] : 'date_added';
|
||||
$array['orderby'] = $array['orderby'] ? $array['orderby'] : 'desc';
|
||||
$array['order'] = tbl('photo_tags.'.$array['order'].' '.$array['orderby']);
|
||||
|
||||
$tags = $cbphoto->get_photo_tags( $array );
|
||||
if ( $tags ) {
|
||||
assign('tags',$tags);
|
||||
}
|
||||
//pr( $tags, true );
|
||||
subtitle("Photo Tags");
|
||||
}
|
||||
break;
|
||||
|
||||
case "exif": case "exif_data": {
|
||||
assign('view','exif');
|
||||
$exif = get_photo_meta_value( $id, 'exif_data');
|
||||
if ( $exif ) {
|
||||
$exif = json_decode( $exif, true );
|
||||
|
||||
$template_ready_data = ready_exif_data( $exif, $p );
|
||||
|
||||
assign( 'photo', $photo );
|
||||
assign('exif', $template_ready_data );
|
||||
|
||||
subtitle( 'Exif Data' );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Add photo actions links
|
||||
add_photo_manager_link(lang('Recreate Photo'), 'recreate_thumbs.php?mode=single&photo='.$p['photo_id'] );
|
||||
if ( $p['collection_id'] != 0 ) {
|
||||
add_photo_manager_link( lang('Edit Collection ('. $p['collection_name'].')'), 'edit_collection.php?collection='.$p['collection_id'] );
|
||||
} else {
|
||||
add_photo_manager_link(lang('Photo is orphan'),'javascript:void(0)');
|
||||
}
|
||||
|
||||
photo_manager_link_callbacks();
|
||||
|
||||
$p['user'] = $p['userid'];
|
||||
|
||||
assign('data',$p);
|
||||
|
||||
$requiredFields = $cbphoto->load_required_forms($p);
|
||||
$otherFields = $cbphoto->load_other_forms($p);
|
||||
assign('requiredFields',$requiredFields);
|
||||
assign('otherFields',$otherFields);
|
||||
|
||||
subtitle("Edit Photo");
|
||||
template_files('edit_photo.html');
|
||||
display_it();
|
||||
?>
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
****************************************************************************************************
|
||||
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved. |
|
||||
| @ Author : ArslanHassan |
|
||||
| @ Software : ClipBucket , © PHPBucket.com |
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$userquery->login_check('video_moderation');
|
||||
$pages->page_redir();
|
||||
|
||||
if(@$_GET['msg']){
|
||||
$msg[] = clean($_GET['msg']);
|
||||
}
|
||||
|
||||
|
||||
$video = mysql_clean($_GET['video']);
|
||||
|
||||
//Updating Video Details
|
||||
if(isset($_POST['update'])){
|
||||
$Upload->validate_video_upload_form();
|
||||
if(empty($eh->error_list))
|
||||
{
|
||||
$myquery->update_video();
|
||||
$myquery->set_default_thumb($video,$_POST['default_thumb']);
|
||||
}
|
||||
}
|
||||
|
||||
//Performing Video Acttions
|
||||
if($_GET['mode']!='')
|
||||
{
|
||||
$cbvid->action($_GET['mode'],$video);
|
||||
}
|
||||
|
||||
//Check Video Exists or Not
|
||||
if($myquery->VideoExists($video)){
|
||||
|
||||
//Deleting Comment
|
||||
$cid = mysql_clean($_GET['delete_comment']);
|
||||
if(!empty($cid))
|
||||
{
|
||||
$myquery->delete_comment($cid);
|
||||
}
|
||||
|
||||
|
||||
$data = get_video_details($video);
|
||||
Assign('udata',$userquery->get_user_details($data['userid']));
|
||||
Assign('data',$data);
|
||||
}else{
|
||||
$msg[] = lang('class_vdo_del_err');
|
||||
}
|
||||
|
||||
subtitle("Edit Video");
|
||||
template_files('edit_video.html');
|
||||
display_it();
|
||||
|
||||
?>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue