Fixed : Rating own collection fixed

This commit is contained in:
Fawaz 2011-05-25 07:54:25 +00:00
parent 56c5346c75
commit 1c7723e764
2 changed files with 27 additions and 5 deletions

View file

@ -1361,7 +1361,7 @@ class Collections extends CBCategory
if(!userid()) if(!userid())
e(lang("please_login_to_rate")); e(lang("please_login_to_rate"));
elseif(userid()==$c_rating['userid']) elseif(userid()==$c_rating['userid'] && !config('own_collection_rating'))
e(lang("you_cannot_rate_own_collection")); e(lang("you_cannot_rate_own_collection"));
elseif(!empty($already_voted)) elseif(!empty($already_voted))
e(lang("you_hv_already_rated_photo")); e(lang("you_hv_already_rated_photo"));

View file

@ -235,13 +235,15 @@ class Upload{
* Function used to get available name for video thumb * Function used to get available name for video thumb
* @param FILE_Name * @param FILE_Name
*/ */
function get_available_file_num($file_name) function get_available_file_num($file_name,$big=false)
{ {
//Starting from 1 //Starting from 1
$code = 1; $code = 1;
if($big)
$big = "big-";
while(1) while(1)
{ {
$path = THUMBS_DIR.'/'.$file_name.'-'.$code.'.'; $path = THUMBS_DIR.'/'.$file_name.'-'.$big.$code.'.';
if(!file_exists($path.'jpg') && !file_exists($path.'png') && !file_exists($path.'gif')) if(!file_exists($path.'jpg') && !file_exists($path.'png') && !file_exists($path.'gif'))
break; break;
else else
@ -1124,5 +1126,25 @@ class Upload{
return $fields; return $fields;
} }
function isTime($time)
{
preg_match("/(([0-9]?[0-9]{1}):)?([0-5]{1}[0-9]{1}):([0-5]{1}[0-9]{1})/",$time,$match);
if(!empty($match[0]))
return ($match[0]);
else
return false;
}
function time_to_sec($time) {
if(!$this->isTime($time))
e(lang("Format of time is not right."));
else
{
$hours = substr($time, 0, -6);
$minutes = substr($time, -5, 2);
$seconds = substr($time, -2);
return $hours * 3600 + $minutes * 60 + $seconds;
}
}
} }
?> ?>