Cleanup, fix typos, fix phpdoc, fix translations, fix missing translations, remove unneeded translations

This commit is contained in:
MacWarrior 2016-10-17 22:04:04 +02:00
parent b4d936d81e
commit e5869a65df
6 changed files with 218 additions and 211 deletions

View file

@ -525,7 +525,7 @@ class ClipBucket
$this->head_menu[] = array('name' => lang("photos"), 'icon' => '<i class="fa fa-camera"></i>','link' => cblink(array('name' => 'photos')), "this" => "photos");
$this->head_menu[] = array('name' => lang("menu_channels"),'icon' => '<i class="fa fa-desktop"></i>', 'link' => cblink(array('name' => 'channels')), "this" => "channels", "section" => "channels");
$this->head_menu[] = array('name' => lang("collections"), 'icon' => '<i class="fa fa-bars"></i>', 'link' => cblink(array('name' => 'collections')), "this" => "collections", "section" => "collections");
$this->head_menu[] = array('name' => lang("Groups"), 'icon' => '<i class="fa fa-users"></i>', 'link' => cblink(array('name' => 'groups')), "this" => "groups", "section" => "groups");
$this->head_menu[] = array('name' => lang("groups"), 'icon' => '<i class="fa fa-users"></i>', 'link' => cblink(array('name' => 'groups')), "this" => "groups", "section" => "groups");
/* Calling custom functions for headMenu. This can be used to add new tabs */
//cb_call_functions('headMenu');

View file

@ -46,11 +46,11 @@ class Collections extends CBCategory
$this->section_tbl = "collections";
$this->types = array();
if (isSectionEnabled('videos')) {
$this->types['videos'] = lang("Videos");
$this->types['videos'] = lang("videos");
}
if (isSectionEnabled('photos')) {
$this->types['photos'] = lang("Photos");
$this->types['photos'] = lang("photos");
}
ksort($this->types);
@ -89,10 +89,10 @@ class Collections extends CBCategory
// Adding My Account Links
if(isSectionEnabled('collections'))
$userquery->user_account[lang('collections')] = array(
lang('add_new_collection') => cblink(array('name'=>'manage_collections','extra_params'=>'mode=add_new')),
lang('manage_collections') => cblink(array('name'=>'manage_collections')),
lang('manage_favorite_collections') => cblink(array('name'=>'manage_collections','extra_params'=>'mode=favorite'))
);
lang('add_new_collection') => cblink(array('name'=>'manage_collections','extra_params'=>'mode=add_new')),
lang('manage_collections') => cblink(array('name'=>'manage_collections')),
lang('manage_favorite_collections') => cblink(array('name'=>'manage_collections','extra_params'=>'mode=favorite'))
);
// Adding Search Type
//if(isSectionEnabled('collections'))
@ -101,22 +101,30 @@ class Collections extends CBCategory
// Adding Collection links in Admin Area
if($per['collection_moderation'] == "yes")
$Cbucket->AdminMenu['Collections'] = array(
lang('Manage Collections')=>'collection_manager.php',
lang('Manage Categories')=>'collection_category.php',
lang('Flagged Collections')=>'flagged_collections.php');
lang('manage_collections') =>'collection_manager.php',
lang('manage_categories') =>'collection_category.php',
lang('flagged_collections') =>'flagged_collections.php'
);
// Adding Collection links in Cbucket Class
$Cbucket->links['collections'] = array('collections.php','collections/');
$Cbucket->links['manage_collections'] = array('manage_collections.php','manage_collections.php');
$Cbucket->links['edit_collection'] = array('manage_collections.php?mode=edit_collection&amp;cid=',
'manage_collections.php?mode=edit_collection&amp;cid=');
$Cbucket->links['manage_items'] = array('manage_collections.php?mode=manage_items&amp;cid=%s&amp;type=%s',
'manage_collections.php?mode=manage_items&amp;cid=%s&amp;type=%s');
$Cbucket->links['user_collections'] = array('user_collections.php?mode=uploaded&user=','user_collections.php?mode=uploaded&user=');
$Cbucket->links['user_fav_collections'] = array('user_collections.php?mode=favorite&user=','user_collections.php?mode=favorite&user=');
$Cbucket->links['collections'] = array('collections.php','collections/');
$Cbucket->links['manage_collections'] = array('manage_collections.php','manage_collections.php');
$Cbucket->links['edit_collection'] = array(
'manage_collections.php?mode=edit_collection&amp;cid=',
'manage_collections.php?mode=edit_collection&amp;cid='
);
$Cbucket->links['manage_items'] = array(
'manage_collections.php?mode=manage_items&amp;cid=%s&amp;type=%s',
'manage_collections.php?mode=manage_items&amp;cid=%s&amp;type=%s'
);
$Cbucket->links['user_collections'] = array(
'user_collections.php?mode=uploaded&user=',
'user_collections.php?mode=uploaded&user='
);
$Cbucket->links['user_fav_collections'] = array(
'user_collections.php?mode=favorite&user=',
'user_collections.php?mode=favorite&user='
);
}
/**
@ -137,19 +145,19 @@ class Collections extends CBCategory
$this->search->template_var = 'collection';
$this->search->has_user_id = true;
$sorting = array(
'date_added'=> lang("date_added"),
'views' => lang("views"),
'total_comments' => lang("comments"),
'total_objects' => lang("Items")
);
$sorting = array(
'date_added' => lang("date_added"),
'views' => lang("views"),
'total_comments'=> lang("comments"),
'total_objects' => lang("Items")
);
$this->search->sorting = array(
'date_added'=> " date_added DESC",
'views' => " views DESC",
'total_comments' => " total_comments DESC ",
'total_objects' => " total_objects DESC"
);
'date_added' => " date_added DESC",
'views' => " views DESC",
'total_comments'=> " total_comments DESC ",
'total_objects' => " total_objects DESC"
);
$default = $_GET;
if(is_array($default['category']))
@ -161,36 +169,36 @@ class Collections extends CBCategory
$this->search->results_per_page = config('videos_items_search_page');
$fields = array(
'query' => array(
'title'=> lang('keywords'),
'type'=> 'textfield',
'name'=> 'query',
'id'=> 'query',
'value'=>cleanForm($default['query'])
),
'category' => array(
'title' => lang('category'),
'type' => 'checkbox',
'name' => 'category[]',
'id' => 'category',
'value' => array('category',$cat_array),
'category_type' => 'collections'
),
'uploaded' => array(
'title' => lang('uploaded'),
'type' => 'dropdown',
'name' => 'datemargin',
'id' => 'datemargin',
'value' => $this->search->date_margins(),
'checked' => $uploaded,
),
'sort' => array(
'title' => lang('sort_by'),
'type' => 'dropdown',
'name' => 'sort',
'value' => $sorting,
'checked' => $sort
)
'query' => array(
'title'=> lang('keywords'),
'type'=> 'textfield',
'name'=> 'query',
'id'=> 'query',
'value'=>cleanForm($default['query'])
),
'category' => array(
'title' => lang('category'),
'type' => 'checkbox',
'name' => 'category[]',
'id' => 'category',
'value' => array('category',$cat_array),
'category_type' => 'collections'
),
'uploaded' => array(
'title' => lang('uploaded'),
'type' => 'dropdown',
'name' => 'datemargin',
'id' => 'datemargin',
'value' => $this->search->date_margins(),
'checked' => $uploaded,
),
'sort' => array(
'title' => lang('sort_by'),
'type' => 'dropdown',
'name' => 'sort',
'value' => $sorting,
'checked' => $sort
)
);
$this->search->search_type['collections']['fields'] = $fields;
@ -222,8 +230,7 @@ class Collections extends CBCategory
$result = $db->count(tbl($this->section_tbl),"collection_id"," collection_id = $id");
if($result)
return true;
else
return false;
return false;
}
/**
@ -252,8 +259,7 @@ class Collections extends CBCategory
//pex($result,true);
if($result)
return $result[0];
else
return false;
return false;
}
function is_viewable($cid)
@ -269,16 +275,14 @@ class Collections extends CBCategory
e(lang('collection_not_active'));
if(!has_access('admin_access',TRUE))
return false;
else
return true;
return true;
} elseif($c['broadcast'] == 'private' && !$userquery->is_confirmed_friend($c['userid'],userid())
&& $c['userid']!=userid() && !has_access('admin_access',TRUE))
{
e(lang('collection_is_private'));
return false;
} else {
return true;
}
return true;
}
/**
@ -353,7 +357,6 @@ class Collections extends CBCategory
$cond .= " AND ";
$cond .= " ".tbl('collections.type')." = '".$p['type']."'";
}
if($p['user'])
{
@ -364,8 +367,7 @@ class Collections extends CBCategory
$cond .= " ".tbl('collections.userid')." = '".$p['user']."'";
//$cond .=')';
}
if($p['featured'])
{
if($cond != '')
@ -382,7 +384,6 @@ class Collections extends CBCategory
$cond .= " ".tbl('collections.public_upload')." = '".$p['public_upload']."'";
if($brace)
$cond.=")";
}
if($p['exclude'])
@ -455,9 +456,8 @@ class Collections extends CBCategory
$result = $db->select(tbl("collections,users"),
tbl("collections.*,users.userid,users.username"),
$cond.tbl("collections.userid")." = ".tbl("users.userid"),$limit,$order);
//echo $db->db_query;
//echo $db->db_query;
}
@ -484,8 +484,7 @@ class Collections extends CBCategory
$result = $db->select(tbl($this->items),"*"," collection_id = $id",$limit,$order);
if($result)
return $result;
else
return false;
return false;
}
/**
@ -545,9 +544,7 @@ class Collections extends CBCategory
//echo $db->db_query;
if($result)
return $result;
else
return false;
return false;
}
/**
@ -582,11 +579,8 @@ class Collections extends CBCategory
}
if($result)
{
return $result;
}
else
return false;
return $result;
return false;
}
/**
@ -599,8 +593,7 @@ class Collections extends CBCategory
$result = $db->select(tbl($this->items),$fields," object_id = $objID AND collection_id = $cid");
if($result)
return $result;
else
return false;
return false;
}
/**
@ -971,8 +964,7 @@ class Collections extends CBCategory
$result = $db->select(tbl($this->section_tbl.",users"),tbl($this->section_tbl).".*,$user_tbl.userid,$user_tbl.username"," collection_id = $cid AND ".tbl($this->section_tbl).".userid = $user_tbl.userid");
if($db->num_rows > 0)
return $result[0]['userid'];
else
return false;
return false;
}
/**
@ -1073,8 +1065,7 @@ class Collections extends CBCategory
if($details['userid'] == $userid)
return true;
else
return false;
return false;
}
/**
@ -1124,7 +1115,7 @@ class Collections extends CBCategory
{
global $db;
$cid = mysql_clean($cid);
$collection = $this->get_collection($id);
$collection = $this->get_collection($cid);
if(!$collection)
e(lang("collection_not_exists"));
elseif($collection['userid'] != userid() && !has_access('admin_access',true))
@ -1175,8 +1166,7 @@ class Collections extends CBCategory
$count = $db->count($this->items,"ci_id"," collection_id = $cid");
if($count)
return $count;
else
return 0;
return 0;
}
/**
@ -1403,15 +1393,13 @@ class Collections extends CBCategory
if($thumb)
return $thumb;
else
foreach($exts as $ext)
{
foreach($exts as $ext)
{
if($size=="small")
$s = "-small";
if(file_exists(COLLECT_THUMBS_DIR."/".$cid.$s.".".$ext))
return COLLECT_THUMBS_URL."/".$cid.$s.".".$ext;
}
if($size=="small")
$s = "-small";
if(file_exists(COLLECT_THUMBS_DIR."/".$cid.$s.".".$ext))
return COLLECT_THUMBS_URL."/".$cid.$s.".".$ext;
}
}

View file

@ -8,7 +8,7 @@ class EH extends ClipBucket
var $error_list = array();
var $message_list = array();
var $warning_list = array();
/**
* A CONSTRUCTOR
*/
@ -16,29 +16,24 @@ class EH extends ClipBucket
/**
* Function used to add new Error
*
* @param null $message
* @param null $id
*/
function add_error($message=NULL, $id=NULL)
function add_error($message=NULL,$id=NULL)
{
global $ignore_cb_errors;
//if id is set, error will be generated from error message list
if(!$ignore_cb_errors)
$this->error_list[] = $message;
$this->error_list[] = $message;
}
/**
* Function usd to add new warning
*
* @param null $message
* @param null $id
*/
function add_warning($message=NULL, $id=NULL)
function add_warning($message=NULL,$id=NULL)
{
$this->warning_list[] = $message;
}
/**
* Function used to get error list
*/
@ -46,29 +41,26 @@ class EH extends ClipBucket
{
return $this->error_list;
}
/**
* Function used to flush errors
*/
function flush_error()
{
$this->error_list = '';
$this->error_list = '';
}
/**
* Function used to add message_list
*
* @param null $message
* @param null $id
* Functio nused to add message_list
*/
function add_message($message=NULL, $id=NULL)
function add_message($message=NULL,$id=NULL)
{
global $ignore_cb_errors;
//if id is set, error will be generated from error message list
if(!$ignore_cb_errors)
$this->message_list[] = $message;
$this->message_list[] = $message;
}
/**
* Function used to get message list
*/
@ -107,14 +99,11 @@ class EH extends ClipBucket
* Function used to add error or either message using simple
* and small object
*
* @param null $message
* @param string $type
* @param null $id
* @param : message, @param :type,@param:id
*
* @return null
* @internal param $ : message, @param :type,@param:id
*/
function e($message=NULL, $type='e', $id=NULL)
function e($message=NULL,$type='e',$id=NULL)
{
switch($type)
{
@ -124,24 +113,21 @@ class EH extends ClipBucket
case 'message':
$this->add_message($message,$id);
break;
case 'e':
case 'err':
case 'error':
default:
$this->add_error($message,$id);
break;
case 'w':
case 2:
case 'war':
case 'warning':
$this->add_warning($message,$id);
break;
default:
$this->error_list($message,$id);
break;
}
return $message;
}
}
}

View file

@ -47,7 +47,7 @@ if(config('closed') && THIS_PAGE!='ajax' && !$in_bg_cron && THIS_PAGE!='cb_insta
template("message.html");
exit();
}else{
e(lang("ATTENTION: THIS WEBSITE IS IN OFFLINE MODE"),"w");
e(lang("website_offline"),"w");
}
}

View file

@ -202,7 +202,7 @@
$content = wrap_email_content($content);
}
}
$message = $content;
$message .= $content;
//ClipBucket uses PHPMailer for sending emails
include_once("classes/phpmailer/class.phpmailer.php");
@ -1729,14 +1729,23 @@
}
}
}
if($LANG != null && !isset($LANG[$var]))
{
error_log('[LANG] Missing translation for "'.$var.'"');
error_log(print_r(debug_backtrace(), TRUE));
}
return $phrase;
}
/**
* Fetch lang value from smarty using lang code
* @param : { array } { $param } { array of parameters }
* @uses : { function lang() }
*/
* Fetch lang value from smarty using lang code
*
* @param : { array } { $param } { array of parameters }
*
* @uses : { function lang() }
* @return mixed|string
*/
function smarty_lang($param) {
if(getArrayValue($param, 'assign')=='') {
@ -2523,8 +2532,8 @@
return lang('no_date_provided');
}
$periods = array(lang("second"), lang("minute"), lang("hour"), lang("day"), lang("week"), lang("month"), lang("year"), lang("decade"));
$lengths = array(lang("60"),lang("60"),lang("24"),lang("7"),lang("4.35"),lang("12"),lang("10"));
$now = time();
$lengths = array(60,60,24,7,4.35,12,10);
$now = time();
if(!$istime) {
$unix_date = strtotime($date);
} else {
@ -4993,24 +5002,24 @@
if(!isset($_GET['time']))
$_GET['time'] = 'all_time';
$array = array
('view_all' => lang('All'),
'most_recent' => lang('recent'),
'most_viewed' => lang('viewed'),
'featured' => lang('featured'),
'top_rated' => lang('top_rated'),
'most_commented' => lang('commented')
);
$array = array(
'view_all' => lang('all'),
'most_recent' => lang('recent'),
'most_viewed' => lang('viewed'),
'featured' => lang('featured'),
'top_rated' => lang('top_rated'),
'most_commented'=> lang('commented')
);
return $array;
}
/**
* Function used for building time links that are used
* on main pages such as videos.php, photos.php etc
*
* @param : { none }
* @return : { array } { $array } { an array with all possible time sorts }
*/
* Function used for building time links that are used
* on main pages such as videos.php, photos.php etc
* @return array : { array } { $array } { an array with all possible time sorts }
* { $array } { an array with all possible time sorts }
* @internal param $ : { none }
*/
function time_links() {
$array = array
@ -5028,14 +5037,20 @@
}
/**
* Fetch videos from video collections
*
* @param : { integer } { $id } { id of collection from which to fetch videos }
* @param : { string } { $order } { sorting of videos }
* @param : { integer } { $limit } { number of videos to fetch }
* @param : { boolean } { $count_only } { false by default, if true, returns videos count only }
* @return { array } { $items } { an array with videos data }
*/
* Fetch videos from video collections
*
* @param $id
* @param $order
* @param $limit
* @param bool $count_only
*
* @return array { array } { $items } { an array with videos data }
* { $items } { an array with videos data }
* @internal param $ : { integer } { $id } { id of collection from which to fetch videos } { $id } { id of collection from which to fetch videos }
* @internal param $ : { string } { $order } { sorting of videos } { $order } { sorting of videos }
* @internal param $ : { integer } { $limit } { number of videos to fetch } { $limit } { number of videos to fetch }
* @internal param $ : { boolean } { $count_only } { false by default, if true, returns videos count only } { $count_only } { false by default, if true, returns videos count only }
*/
function get_videos_of_collection($id,$order,$limit,$count_only=false) {
global $cbvideo;
@ -5078,20 +5093,24 @@
}
/**
* function uses to parse certain string from bulk string
* @author : Awais Tariq
* @param : {string} {$needle_start} { string from where the parse starts}
* @param : {string} {$needle_end} { string from where the parse end}
*@param : {string} {$results} { total string in which we search}
*
* @todo {.....}
*
*
* @return {bool/string/int} {true/$return_arr}
*/
/**
* function uses to parse certain string from bulk string
* @author : Awais Tariq
*
* @param $needle_start
* @param $needle_end
* @param $results
*
* @return array|bool {bool/string/int} {true/$return_arr}
* {true/$return_arr}
* @internal param $ : {string} {$needle_start} { string from where the parse starts} {$needle_start} { string from where the parse starts}
* @internal param $ : {string} {$needle_end} { string from where the parse end} {$needle_end} { string from where the parse end}
* @internal param $ : {string} {$results} { total string in which we search} {$results} { total string in which we search}
*
* @todo {.....}
*
*
*/
function find_string($needle_start,$needle_end,$results) {
if(empty($results)||empty($needle_start)||empty($needle_end)) {
@ -5137,13 +5156,16 @@
}
/**
* Pulls subscribers ids for given userid
* @param : { integer } { $userid } { id of user to get subscribers for }
* @param : { integer / boolean } { false by default, number of subscribers to get }
* @return : { array } { $ids } { ids of subscribers }
* @author : Saqib Razzaq
* @since : ClipBucket 2.8.1
*/
* Pulls subscribers ids for given userid
*
* @param : { integer } { $userid } { id of user to get subscribers for }
* @param bool $limit
*
* @return array : { array } { $ids } { ids of subscribers }
* { $ids } { ids of subscribers }
* @author : Saqib Razzaq
* @since : ClipBucket 2.8.1
*/
function get_user_subscibers($userid, $limit = false) {
global $db;
@ -5178,12 +5200,16 @@
}
/**
* Check where a function is being called from
* @param : { boolean } { $file } { false by default, returns file path if true }
* @param : { boolean } { $pex } { false by default, exists after pr() if true }
* @since : 2nd March, 2016 ClipBucket 2.8.1
* @author : Saqib Razzaq
*/
* Check where a function is being called from
*
* @param bool $file
* @param bool $pex
*
* @internal param $ : { boolean } { $file } { false by default, returns file path if true } { $file } { false by default, returns file path if true }
* @internal param $ : { boolean } { $pex } { false by default, exists after pr() if true } { $pex } { false by default, exists after pr() if true }
* @since : 2nd March, 2016 ClipBucket 2.8.1
* @author : Saqib Razzaq
*/
function trace_func($file = false, $pex = false) {
if (!$file) {
@ -5200,14 +5226,16 @@
}
}
/**
* Display an image or build image tag
*
* @param : { string } { $src } { link to image file }
* @param : { boolean } { $return } { false by default, returns img tag if true }
* @since : 2nd March, 2016 ClipBucket 2.8.1
* @author : Saqib Razzaq
*/
/**
* Display an image or build image tag
*
* @param : { string } { $src } { link to image file }
* @param bool $return
*
* @return string
* @since : 2nd March, 2016 ClipBucket 2.8.1
* @author : Saqib Razzaq
*/
function view_image($src, $return = false) {
if (!empty($src)) {
@ -5220,15 +5248,20 @@
}
/**
* Get part of a string between two characters
*
* @param : { string } { $str } { string to read }
* @param : { string } { $from } { character to start cutting }
* @param : { string } { $to } { character to stop cutting }
* @return : { string } { requested part of stirng }
* @since : 3rd March, 2016 ClipBucket 2.8.1
* @author : Saqib Razzaq
*/
* Get part of a string between two characters
*
* @param $str
* @param $from
* @param $to
*
* @return string : { string } { requested part of stirng }
* { requested part of stirng }
* @internal param $ : { string } { $str } { string to read } { $str } { string to read }
* @internal param $ : { string } { $from } { character to start cutting } { $from } { character to start cutting }
* @internal param $ : { string } { $to } { character to stop cutting } { $to } { character to stop cutting }
* @since : 3rd March, 2016 ClipBucket 2.8.1
* @author : Saqib Razzaq
*/
function getStringBetween($str,$from,$to) {
$sub = substr($str, strpos($str,$from)+strlen($from),strlen($str));

File diff suppressed because one or more lines are too long