2009-08-25 12:16:42 +00:00
< ? php
/**
2009-10-14 21:09:54 +00:00
###################################################################
2010-03-29 00:28:58 +00:00
# Copyright (c) 2008 - 2010 ClipBucket / PHPBucket
# URL: [url]http://clip-bucket.com[/url]
2009-08-25 12:16:42 +00:00
# Function: Various
# Author: Arslan Hassan
# Language: PHP
2010-03-29 00:28:58 +00:00
# License: Attribution Assurance License
# [url]http://www.opensource.org/licenses/attribution.php[/url]
# Version: $Id$
# Last Modified: $Date$
2009-08-25 12:16:42 +00:00
# Notice: Please maintain this section
2009-10-14 21:09:54 +00:00
####################################################################
2009-08-25 12:16:42 +00:00
*/
2009-11-04 10:27:40 +00:00
define ( " SHOW_COUNTRY_FLAG " , TRUE );
2009-08-25 12:16:42 +00:00
require 'define_php_links.php' ;
include_once 'upload_forms.php' ;
2010-02-06 13:38:16 +00:00
2009-08-25 12:16:42 +00:00
//This Funtion is use to get CURRENT PAGE DIRECT URL
2010-02-06 13:38:16 +00:00
function curPageURL ()
{
2009-08-25 12:16:42 +00:00
$pageURL = 'http' ;
if ( @ $_SERVER [ " HTTPS " ] == " on " ) {
$pageURL .= " s " ;
}
$pageURL .= " :// " ;
$pageURL .= $_SERVER [ 'SERVER_NAME' ];
$pageURL .= $_SERVER [ 'PHP_SELF' ];
$query_string = $_SERVER [ 'QUERY_STRING' ];
if ( ! empty ( $query_string )){
$pageURL .= '?' . $query_string ;
}
return $pageURL ;
}
//QuotesReplace
function Replacer ( $string )
{
//Wp-Magic Quotes
$string = preg_replace ( " /'s/ " , '’s' , $string );
$string = preg_replace ( " /'( \ d \ d(?:’|')?s)/ " , " ’ $ 1 " , $string );
$string = preg_replace ( '/(\s|\A|")\'/' , '$1‘' , $string );
$string = preg_replace ( '/(\d+)"/' , '$1″' , $string );
$string = preg_replace ( " /( \ d+)'/ " , '$1′' , $string );
$string = preg_replace ( " /( \ S)'([^' \ s])/ " , " $ 1’ $ 2 " , $string );
$string = preg_replace ( '/(\s|\A)"(?!\s)/' , '$1“$2' , $string );
$string = preg_replace ( '/"(\s|\S|\Z)/' , '”$1' , $string );
$string = preg_replace ( " /'([ \ s.]| \ Z)/ " , '’$1' , $string );
$string = preg_replace ( " / \ (tm \ )/i " , ' ™' , $string );
$string = str_replace ( " '' " , '”' , $string );
$array = array ( '/& /' );
$replace = array ( '& ' ) ;
return $string = preg_replace ( $array , $replace , $string );
}
//This Funtion is used to clean a String
function clean ( $string , $allow_html = false ) {
2010-03-23 08:33:20 +00:00
//$string = $string;
2009-08-25 12:16:42 +00:00
//$string = htmlentities($string);
if ( $allow_html == false ){
2010-07-19 07:17:24 +00:00
$string = strip_tags ( $string );
$string = Replacer ( $string );
2009-08-25 12:16:42 +00:00
}
2010-07-19 07:17:24 +00:00
// $string = utf8_encode($string);
2009-08-25 12:16:42 +00:00
return $string ;
}
2010-03-03 14:44:33 +00:00
function cb_clean ( $string , $array = array ( 'no_html' => true , 'mysql_clean' => false ))
{
if ( $array [ 'no_html' ])
$string = htmlentities ( $string );
if ( $array [ 'special_html' ])
$string = htmlspecialchars ( $string );
if ( $array [ 'mysql_clean' ])
$string = mysql_real_escape_string ( $string );
if ( $array [ 'nl2br' ])
$string = nl2br ( $string );
return $string ;
}
2009-08-25 12:16:42 +00:00
//This Fucntion is for Securing Password, you may change its combination for security reason but make sure dont not rechange once you made your script run
function pass_code ( $string ) {
$password = md5 ( md5 ( sha1 ( sha1 ( md5 ( $string )))));
return $password ;
}
//Mysql Clean Queries
2010-03-25 12:14:58 +00:00
function sql_free ( $id )
{
if ( ! get_magic_quotes_gpc ())
{
$id = addslashes ( $id );
}
return $id ;
}
2009-08-25 12:16:42 +00:00
2011-02-10 14:49:53 +00:00
2010-03-24 13:00:09 +00:00
function mysql_clean ( $id , $replacer = true ){
2010-03-23 08:33:20 +00:00
//$id = clean($id);
2010-03-24 13:00:09 +00:00
2009-08-25 12:16:42 +00:00
if ( get_magic_quotes_gpc ())
{
2010-03-23 08:33:20 +00:00
$id = stripslashes ( $id );
2009-08-25 12:16:42 +00:00
}
2011-08-09 10:20:09 +00:00
$id = htmlspecialchars ( mysql_real_escape_string ( $id ));
2010-03-24 13:00:09 +00:00
if ( $replacer )
$id = Replacer ( $id );
2010-03-23 08:33:20 +00:00
return $id ;
2009-08-25 12:16:42 +00:00
}
2011-02-10 14:49:53 +00:00
function escape_gpc ( $in )
{
if ( get_magic_quotes_gpc ())
{
$in = stripslashes ( $in );
}
return $in ;
}
2009-08-25 12:16:42 +00:00
//Redirect Using JAVASCRIPT
function redirect_to ( $url ){
echo ' < script type = " text/javascript " >
window . location = " '. $url .' "
</ script > ' ;
2009-09-28 05:23:50 +00:00
exit ( " Javascript is turned off, <a href=' $url '>click here to go to requested page</a> " );
2009-08-25 12:16:42 +00:00
}
2010-12-14 13:53:51 +00:00
//Test function to return template file
function Fetch ( $name , $inside = FALSE )
{
if ( $inside )
2011-11-22 10:56:45 +00:00
$file = CBTemplate :: fetch ( $inside . $name );
2010-12-14 13:53:51 +00:00
else
$file = CBTemplate :: fetch ( LAYOUT . '/' . $name );
return $file ;
}
2009-08-25 12:16:42 +00:00
//Simple Template Displaying Function
function Template ( $template , $layout = true ){
global $admin_area ;
if ( $layout )
2009-09-28 05:23:50 +00:00
CBTemplate :: display ( LAYOUT . '/' . $template );
2009-08-25 12:16:42 +00:00
else
2009-09-28 05:23:50 +00:00
CBTemplate :: display ( $template );
2009-08-25 12:16:42 +00:00
if ( $template == 'footer.html' && $admin_area != TRUE ){
2009-09-28 05:23:50 +00:00
CBTemplate :: display ( BASEDIR . '/includes/templatelib/' . $template );
2009-08-25 12:16:42 +00:00
}
if ( $template == 'header.html' ){
2009-09-28 05:23:50 +00:00
CBTemplate :: display ( BASEDIR . '/includes/templatelib/' . $template );
2009-08-25 12:16:42 +00:00
}
}
2009-12-09 13:43:19 +00:00
function Assign ( $name , $value )
{
2009-11-04 10:27:40 +00:00
CBTemplate :: assign ( $name , $value );
2009-08-25 12:16:42 +00:00
}
//Funtion of Random String
function RandomString ( $length )
{
2010-12-21 11:31:21 +00:00
$string = md5 ( microtime ());
$highest_startpoint = 32 - $length ;
$randomString = substr ( $string , rand ( 0 , $highest_startpoint ), $length );
return $randomString ;
}
2009-08-25 12:16:42 +00:00
//This Function Is Used To Display Tags Cloud
function TagClouds ( $cloudquery )
{
$tags = array ();
$cloud = array ();
$query = mysql_query ( $cloudquery );
while ( $t = mysql_fetch_array ( $query ))
{
$db = explode ( ' ' , $t [ 0 ]);
while ( list ( $key , $value ) = each ( $db ))
{
@ $keyword [ $value ] += 1 ;
}
}
if ( is_array ( @ $keyword ))
{
$minFont = 11 ;
$maxFont = 22 ;
$min = min ( array_values ( $keyword ));
$max = max ( array_values ( $keyword ));
$fix = ( $max - $min == 0 ) ? 1 : $max - $min ;
// Display the tags
foreach ( $keyword as $tag => $count )
{
$size = $minFont + ( $count - $min ) * ( $maxFont - $minFont ) / $fix ;
$cloud [] = '<a class=cloudtags style="font-size: ' . floor ( $size ) . 'px;" href="' . BASEURL . search_result . '?query=' . $tag . '" title="Tags: ' . ucfirst ( $tag ) . ' was used ' . $count . ' times"><span>' . mysql_clean ( $tag ) . '</span></a>' ;
}
$shown = join ( " \n " , $cloud ) . " \n " ;
return $shown ;
}
}
2009-10-10 14:25:07 +00:00
/**
* Function used to send emails
2009-12-21 21:11:54 +00:00
* @ Author : Arslan Hassan
2009-10-10 14:25:07 +00:00
* this is a very basic email function
* you can extend or replace this function easily
* read our docs . clip - bucket . com
*/
function cbmail ( $array )
{
$func_array = get_functions ( 'email_functions' );
if ( is_array ( $func_array ))
{
foreach ( $func_array as $func )
{
if ( function_exists ( $func ))
{
return $func ( $array );
}
}
2009-08-25 12:16:42 +00:00
}
2009-10-10 14:25:07 +00:00
2011-02-10 14:49:53 +00:00
$content = escape_gpc ( $array [ 'content' ]);
$subject = escape_gpc ( $array [ 'subject' ]);
2009-10-10 14:25:07 +00:00
$to = $array [ 'to' ];
$from = $array [ 'from' ];
2010-07-19 19:44:56 +00:00
$to_name = $array [ 'to_name' ];
$from_name = $array [ 'from_name' ];
2009-10-10 14:25:07 +00:00
2009-11-04 10:27:40 +00:00
if ( $array [ 'nl2br' ])
$content = nl2br ( $content );
2009-10-10 14:25:07 +00:00
# CHecking Content
if ( preg_match ( '/<html>/' , $content , $matches ))
{
2009-11-04 10:27:40 +00:00
if ( empty ( $matches [ 1 ]))
2009-10-10 14:25:07 +00:00
{
$content = wrap_email_content ( $content );
}
}
$message .= $content ;
2010-07-19 19:44:56 +00:00
//ClipBucket uses PHPMailer for sending emails
2010-08-25 07:35:09 +00:00
include_once ( " classes/phpmailer/class.phpmailer.php " );
include_once ( " classes/phpmailer/class.smtp.php " );
2010-07-19 19:44:56 +00:00
$mail = new PHPMailer (); // defaults to using php "mail()"
$mail_type = config ( 'mail_type' );
//---Setting SMTP ---
if ( $mail_type == 'smtp' )
2009-11-04 10:27:40 +00:00
{
2010-07-19 19:44:56 +00:00
$mail -> IsSMTP (); // telling the class to use SMTP
$mail -> Host = config ( 'smtp_host' ); // SMTP server
if ( config ( 'smtp_auth' ) == 'yes' )
$mail -> SMTPAuth = true ; // enable SMTP authentication
$mail -> Port = config ( 'smtp_port' ); // set the SMTP port for the GMAIL server
$mail -> Username = config ( 'smtp_user' ); // SMTP account username
$mail -> Password = config ( 'smtp_pass' ); // SMTP account password
2009-11-04 10:27:40 +00:00
}
2010-07-19 19:44:56 +00:00
//--- Ending Smtp Settings
2010-09-22 06:53:24 +00:00
$mail -> SetFrom ( $from , $from_name );
if ( is_array ( $to ))
{
foreach ( $to as $name )
{
2011-09-22 12:00:05 +00:00
$mail -> AddAddress ( strtolower ( $name ), $to_name );
2010-09-22 06:53:24 +00:00
}
} else {
2011-09-22 12:00:05 +00:00
$mail -> AddAddress ( strtolower ( $to ), $to_name );
2010-09-22 06:53:24 +00:00
}
2010-07-19 19:44:56 +00:00
$mail -> Subject = $subject ;
$mail -> MsgHTML ( $message );
if ( ! $mail -> Send ())
{
e ( " Mailer Error: " . $mail -> ErrorInfo );
return false ;
} else
2009-10-10 14:25:07 +00:00
return true ;
}
function send_email ( $from , $to , $subj , $message )
{
return cbmail ( array ( 'from' => $from , 'to' => $to , 'subject' => $subj , 'content' => $message ));
}
/**
* Function used to wrap email content in
* HTML AND BODY TAGS
*/
function wrap_email_content ( $content )
{
return '<html><body>' . $content . '</body></html>' ;
}
2009-08-25 12:16:42 +00:00
/**
* Function used to get file name
*/
2010-02-08 18:04:07 +00:00
function GetName ( $file )
{
if ( ! is_string ( $file ))
return false ;
2009-08-25 12:16:42 +00:00
$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 );
}
2009-10-03 10:38:28 +00:00
2009-08-25 12:16:42 +00:00
//Simple Validation
function isValidText ( $text ){
$pattern = " ^^[_a-z0-9-]+ $ " ;
if ( eregi ( $pattern , $text )){
return true ;
} else {
return false ;
}
2010-12-14 13:53:51 +00:00
}
//Simple Width Fetcher
function getWidth ( $file )
{
$sizes = getimagesize ( $file );
if ( $sizes )
return $sizes [ 0 ];
}
//Simple Height Fetcher
function getHeight ( $file )
{
$sizes = getimagesize ( $file );
if ( $sizes )
return $sizes [ 1 ];
}
2010-12-28 13:56:44 +00:00
//Load Photo Upload Form
function loadPhotoUploadForm ( $params )
{
global $cbphoto ;
return $cbphoto -> loadUploadForm ( $params );
}
2010-12-14 13:53:51 +00:00
//Photo File Fetcher
function get_photo ( $params )
{
global $cbphoto ;
2011-01-13 13:58:58 +00:00
return $cbphoto -> getFileSmarty ( $params );
2010-12-14 13:53:51 +00:00
}
//Photo Upload BUtton
function upload_photo_button ( $params )
{
global $cbphoto ;
2011-03-26 13:57:39 +00:00
return $cbphoto -> upload_photo_button ( $params );
2010-12-14 13:53:51 +00:00
}
//Photo Embed Cides
function photo_embed_codes ( $params )
{
global $cbphoto ;
2011-03-26 13:57:39 +00:00
return $cbphoto -> photo_embed_codes ( $params );
2010-12-14 13:53:51 +00:00
}
2009-08-25 12:16:42 +00:00
2010-12-23 16:56:33 +00:00
//Create download button
2011-09-29 09:00:07 +00:00
2010-12-23 16:56:33 +00:00
function photo_download_button ( $params )
{
global $cbphoto ;
2011-03-26 13:57:39 +00:00
return $cbphoto -> download_button ( $params );
2010-12-23 16:56:33 +00:00
}
2009-08-25 12:16:42 +00:00
//Function Used To Validate Email
function isValidEmail ( $email ){
2011-09-13 07:41:46 +00:00
$pattern = " /[_a-z0-9-]+( \ .[_a-z0-9-]+)*@[a-z0-9-]+( \ .[a-z0-9-]+)*( \ .[a-z] { 2,3}) $ /i " ;
2009-11-04 10:27:40 +00:00
preg_match ( $pattern , $email , $matches );
if ( $matches [ 0 ] != '' ){
2009-08-25 12:16:42 +00:00
return true ;
}
else {
2009-12-09 13:43:19 +00:00
if ( ! DEVELOPMENT_MODE )
return false ;
else
return true ;
2009-08-25 12:16:42 +00:00
}
}
// THIS FUNCTION SETS HTMLSPECIALCHARS_DECODE IF FUNCTION DOESN'T EXIST
// INPUT: $text REPRESENTING THE TEXT TO DECODE
// $ent_quotes (OPTIONAL) REPRESENTING WHETHER TO REPLACE DOUBLE QUOTES, ETC
// OUTPUT: A STRING WITH HTML CHARACTERS DECODED
if ( ! function_exists ( 'htmlspecialchars_decode' )) {
function htmlspecialchars_decode ( $text , $ent_quotes = " " ) {
$text = str_replace ( " " " , " \" " , $text );
$text = str_replace ( " ' " , " ' " , $text );
$text = str_replace ( " < " , " < " , $text );
$text = str_replace ( " > " , " > " , $text );
$text = str_replace ( " & " , " & " , $text );
return $text ;
}
} // END htmlspecialchars() FUNCTION
//THIS FUNCTION IS USED TO LIST FILE TYPES IN FLASH UPLOAD
//INPUT FILE TYPES
//OUTPUT FILE TYPE IN PROPER FORMAT
function ListFileTypes ( $types ){
$types_array = preg_replace ( '/,/' , ' ' , $types );
$types_array = explode ( ' ' , $types_array );
$list = 'Video,' ;
for ( $i = 0 ; $i <= count ( $types_array ); $i ++ ){
if ( $types_array [ $i ] != '' ){
$list .= '*.' . $types_array [ $i ];
if ( $i != count ( $types_array )) $list .= ';' ;
}
}
return $list ;
}
2010-01-23 13:16:19 +00:00
/**
2010-06-24 07:05:52 +00:00
* Get Directory Size - get_video_file ( $vdata , $no_video , false );
2010-01-23 13:16:19 +00:00
*/
function get_directory_size ( $path )
{
$totalsize = 0 ;
$totalcount = 0 ;
$dircount = 0 ;
if ( $handle = opendir ( $path ))
{
while ( false !== ( $file = readdir ( $handle )))
{
$nextpath = $path . '/' . $file ;
if ( $file != '.' && $file != '..' && ! is_link ( $nextpath ))
{
if ( is_dir ( $nextpath ))
{
$dircount ++ ;
$result = get_directory_size ( $nextpath );
$totalsize += $result [ 'size' ];
$totalcount += $result [ 'count' ];
$dircount += $result [ 'dircount' ];
}
elseif ( is_file ( $nextpath ))
{
$totalsize += filesize ( $nextpath );
$totalcount ++ ;
}
}
}
}
closedir ( $handle );
$total [ 'size' ] = $totalsize ;
$total [ 'count' ] = $totalcount ;
$total [ 'dircount' ] = $dircount ;
return $total ;
}
2009-08-25 12:16:42 +00:00
//FUNCTION USED TO FORMAT FILE SIZE
//INPUT BYTES
//OUTPT MB , Kib
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 " ;
}
}
2009-11-04 10:27:40 +00:00
2011-11-24 12:23:55 +00:00
2009-08-25 12:16:42 +00:00
function GetThumb ( $vdetails , $num = 'default' , $multi = false , $count = false )
{
return get_thumb ( $vdetails , $num , $multi , $count );
}
2011-11-24 12:23:55 +00:00
//Function That will use in creating SEO urls
function VideoLink ( $vdetails , $type = NULL )
2010-04-26 10:18:23 +00:00
{
2011-11-24 12:23:55 +00:00
return video_link ( $vdetails , $type );
}
2009-08-25 12:16:42 +00:00
2011-11-24 12:23:55 +00:00
2009-09-14 02:57:19 +00:00
2009-08-25 12:16:42 +00:00
//TEST EXCEC FUNCTION
function test_exec ( $cmd )
{
echo '<div border="1px">' ;
echo '<h1>' . htmlentities ( $cmd ) . '</h1>' ;
if ( stristr ( PHP_OS , 'WIN' )) {
$cmd = $cmd ;
} else {
$cmd = " PATH= \$ PATH:/bin:/usr/bin:/usr/local/bin bash -c \" $cmd\ " " ;
}
$data = shell_exec ( $cmd );
if ( $data === false )
echo " <p>FAILED: $cmd </p></div> " ;
echo '<p><pre>' . htmlentities ( $data ) . '</pre></p></div>' ;
}
2010-01-12 14:14:29 +00:00
/**
* Function used to get shell output
*/
function shell_output ( $cmd )
{
if ( stristr ( PHP_OS , 'WIN' )) {
$cmd = $cmd ;
} else {
2010-03-24 11:53:11 +00:00
$cmd = " PATH= \$ PATH:/bin:/usr/bin:/usr/local/bin bash -c \" $cmd\ " 2 >& 1 " ;
2010-01-12 14:14:29 +00:00
}
$data = shell_exec ( $cmd );
return $data ;
}
2009-08-25 12:16:42 +00:00
2011-11-24 12:23:55 +00:00
2009-08-25 12:16:42 +00:00
2010-01-13 09:53:21 +00:00
/**
* Function used to tell ClipBucket that it has closed the script
*/
function the_end ()
{
2011-01-06 15:09:06 +00:00
if ( ! $isWorthyBuddy )
2010-01-13 09:53:21 +00:00
{
2011-11-24 12:23:55 +00:00
echo 'Nothing to do here anymore' ;
2010-01-13 09:53:21 +00:00
}
}
2011-11-24 12:23:55 +00:00
2009-08-25 12:16:42 +00:00
2009-12-21 21:11:54 +00:00
/**
* Group Link
*/
function group_link ( $params )
{
$grp = $params [ 'details' ];
$id = $grp [ 'group_id' ];
$name = $grp [ 'group_name' ];
$url = $grp [ 'group_url' ];
if ( $params [ 'type' ] == '' || $params [ 'type' ] == 'group' )
{
if ( SEO == yes )
return BASEURL . '/group/' . $url ;
else
return BASEURL . '/view_group.php?url=' . $url ;
}
if ( $params [ 'type' ] == 'view_members' )
{
return BASEURL . '/view_group_members.php?url=' . $url ;
if ( SEO == yes )
return BASEURL . '/group_members/' . $url ;
else
return BASEURL . '/view_group_members.php?url=' . $url ;
}
if ( $params [ 'type' ] == 'view_videos' )
{
return BASEURL . '/view_group_videos.php?url=' . $url ;
if ( SEO == yes )
return BASEURL . '/group_videos/' . $url ;
else
return BASEURL . '/view_group_videos.php?url=' . $url ;
}
2011-02-28 16:29:38 +00:00
if ( $params [ 'type' ] == 'view_topics' )
{
if ( SEO == " yes " )
return BASEURL . " /group/ " . $url . " ?mode=view_topics " ;
else
return BASEURL . " /view_group.php?url= " . $url . " &mode=view_topics " ;
}
if ( $params [ 'type' ] == 'view_report_form' )
{
if ( SEO == " yes " )
return BASEURL . " /group/ " . $url . " ?mode=view_report_form " ;
else
return BASEURL . " /view_group.php?url= " . $url . " &mode=view_report_form " ;
}
2009-12-21 21:11:54 +00:00
}
2011-01-06 11:19:01 +00:00
/**
* FUNCTION USED TO GET COMMENTS
* @ param : array ();
*/
function getComments ( $params = NULL )
{
global $db ;
$order = $params [ 'order' ];
$limit = $params [ 'limit' ];
$type = $params [ 'type' ];
$cond = '' ;
if ( empty ( $type ))
$type = " v " ;
$cond .= tbl ( " comments.type " ) . " = ' " . $type . " ' " ;
2011-02-12 07:52:37 +00:00
2011-01-06 11:19:01 +00:00
if ( $params [ 'type_id' ] && $params [ 'sectionTable' ])
{
if ( $cond != " " )
$cond .= " AND " ;
$cond .= tbl ( " comments.type_id " ) . " = " . tbl ( $params [ 'sectionTable' ] . " . " . $params [ 'type_id' ]);
}
if ( $params [ 'cond' ])
{
if ( $cond != " " )
$cond .= " AND " ;
$cond .= $params [ 'cond' ];
}
if ( ! $params [ 'count_only' ])
$result = $db -> select ( tbl ( " comments " . ( $params [ 'sectionTable' ] ? " , " . $params [ 'sectionTable' ] : NULL )), " * " , $cond , $limit , $order );
//echo $db->db_query;
if ( $params [ 'count_only' ])
$result = $db -> count ( tbl ( " comments " ), " * " , $cond );
if ( $result )
return $result ;
else
return false ;
}
2009-08-25 12:16:42 +00:00
2011-11-24 12:23:55 +00:00
function out ( $link )
2009-08-25 12:16:42 +00:00
{
2011-11-24 12:23:55 +00:00
return BASEURL . '/out.php?l=' . urlencode ( $link );
2009-08-25 12:16:42 +00:00
}
2010-06-24 07:05:52 +00:00
2011-11-24 12:23:55 +00:00
//Including videos functions
include ( " functions_videos.php " );
2010-07-30 07:59:46 +00:00
2011-11-24 12:23:55 +00:00
include ( " functions1.php " );
include ( " functions2.php " );
include ( " functions3.php " );
2009-08-25 12:16:42 +00:00
?>