usertype ) == 'editor' || strtolower( $my->usertype ) == 'administrator' || strtolower( $my->usertype ) == 'super administrator'); $is_user=(strtolower( $my->usertype ) <> ''); ?>
"; echo ""; ?> "; return; } function bb_decode ( $text ) { $text=nl2br( $text ); static $bbcode_tpl = array(); static $patterns = array(); static $replacements = array(); // First: If there isn't a "[" and a "]" in the message, don't bother. if ( (strpos( $text, "[" ) === false || strpos( $text, "]" ) === false) ) { return $text; } // [b] and [/b] for bolding text. $text=str_replace( "[b]", '', $text ); $text=str_replace( "[/b]", '', $text ); // [u] and [/u] for underlining text. $text=str_replace( "[u]", '', $text ); $text=str_replace( "[/u]", '', $text ); // [i] and [/i] for italicizing text. $text=str_replace( "[i]", '', $text ); $text=str_replace( "[/i]", '', $text ); if ( !count( $bbcode_tpl ) ) { // We do URLs in several different ways.. $bbcode_tpl['url']='{DESCRIPTION}'; $bbcode_tpl['email']='{EMAIL}'; $bbcode_tpl['url1']=str_replace( '{URL}', '\\1\\2', $bbcode_tpl['url'] ); $bbcode_tpl['url1']=str_replace( '{DESCRIPTION}', '\\1\\2', $bbcode_tpl['url1'] ); $bbcode_tpl['url2']=str_replace( '{URL}', 'http://\\1', $bbcode_tpl['url'] ); $bbcode_tpl['url2']=str_replace( '{DESCRIPTION}', '\\1', $bbcode_tpl['url2'] ); $bbcode_tpl['url3']=str_replace( '{URL}', '\\1\\2', $bbcode_tpl['url'] ); $bbcode_tpl['url3']=str_replace( '{DESCRIPTION}', '\\3', $bbcode_tpl['url3'] ); $bbcode_tpl['url4']=str_replace( '{URL}', 'http://\\1', $bbcode_tpl['url'] ); $bbcode_tpl['url4']=str_replace( '{DESCRIPTION}', '\\2', $bbcode_tpl['url4'] ); $bbcode_tpl['email']=str_replace( '{EMAIL}', '\\1', $bbcode_tpl['email'] ); // [url]xxxx://www.phpbb.com[/url] code.. $patterns[1]="#\[url\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#si"; $replacements[1]=$bbcode_tpl['url1']; // [url]www.phpbb.com[/url] code.. (no xxxx:// prefix). $patterns[2]="#\[url\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#si"; $replacements[2]=$bbcode_tpl['url2']; // [url=xxxx://www.phpbb.com]phpBB[/url] code.. $patterns[3]="#\[url=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#si"; $replacements[3]=$bbcode_tpl['url3']; // [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix). $patterns[4]="#\[url=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#si"; $replacements[4]=$bbcode_tpl['url4']; // [email]user@domain.tld[/email] code.. $patterns[5]="#\[email\]([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si"; $replacements[5]=$bbcode_tpl['email']; } $text=preg_replace( $patterns, $replacements, $text ); return $text; } ############################################################## switch ( $func ) { case 'special': include( 'components/com_ponygallery/sub_viewspecial.php' ); break; case 'detail': include( 'components/com_ponygallery/sub_viewdetails.php' ); break; case 'votepic': include( 'components/com_ponygallery/sub_votepic.php' ); break; case 'editpic': if ( !$my->username ) { mosRedirect( "index.php?option=com_ponygallery", _PONYGALLERY_YOU_NOT_LOGED); die(); } GalleryHeader(); editPic( $uid, $option, $thumbnailpath ); break; case 'savepic': if ( !$my->username ) { mosRedirect( "index.php?option=com_ponygallery", _PONYGALLERY_YOU_NOT_LOGED ); die(); } savePic( $option ); break; case 'deletepic': if ( !$my->username ) { mosRedirect( "index.php?option=com_ponygallery", _PONYGALLERY_YOU_NOT_LOGED ); die(); } deletePic( $uid, $option ); break; case 'commentpic': include( 'components/com_ponygallery/sub_commentpic.php' ); break; case 'deletecomment': GalleryHeader(); include( 'components/com_ponygallery/sub_deletecomment.php' ); break; case 'viewcategory': GalleryHeader(); $database->setQuery( "SELECT count(cid) FROM #__ponygallery_catg" . "\n WHERE cid = '" . $catid . "'" . "\n AND access<='$gid'" ); $is_allowed=$database->loadResult(); if ( $is_allowed < 1 ) { mosRedirect( sefRelToAbs( "index.php?option=com_ponygallery" ), _PONYGALLERY_NOT_ACCESS_THIS_DIRECTORY ); die(); } echo dmoz( $catid, $Itemid ); # Feststellen der Anzahl der verfügbaren Datensätze $database->setQuery( "SELECT count(id) FROM #__ponygallery as a " . "\n left join #__ponygallery_catg as c on c.cid=a.catid" . "\n WHERE a.published = '1' AND a.catid = '" . $catid . "'" . " AND a.approved = 1" . "\n AND c.access<='$gid'" ); $count=$database->loadResult(); # Berechnen der Gesamtseiten $gesamtseiten=floor( $count / $ag_perpage ); $seitenrest=$count % $ag_perpage; if ( $seitenrest > 0 ) { $gesamtseiten++; } # Feststellen der aktuellen Seite if ( isset( $startpage ) ) { if ( $startpage > $gesamtseiten ) { $startpage=$gesamtseiten; } else if ( $startpage < 1 ) { $startpage=1; } } else { $startpage=1; } echo "

"._PONYGALLERY_THERE_ARE." $count "._PONYGALLERY_PICTURES_IN_CATEGORY."
"; echo "Pages: "; # Ausgeben der Seite zurueck Funktion $seiterueck=$startpage - 1; if ( $seiterueck > 0 ) { echo "« "; } #Ausgeben der einzelnen Seiten for ( $i=1; $i <= $gesamtseiten; $i++ ) { if ( $i == $startpage ) { echo "$i "; } else { echo "$i "; } } # Ausgeben der Seite vorwärts Funktion $seitevor=$startpage + 1; if ( $seitevor <= $gesamtseiten ) { echo "» "; } # Limit und Seite Vor- & Rueckfunktionen $start=($startpage - 1) * $ag_perpage; echo "

"; $database->setQuery( "SELECT name FROM #__ponygallery_catg WHERE cid = '" . $catid . "' " . "\n ORDER BY name" ); $catname=$database->loadResult(); echo "
"; echo ""; echo "
'' ) { //echo " :: " . ShowCategoryPathLink( $catid ); echo ShowCategoryPathLink( $catid ); } else if ( $id ) { $database->setQuery( "SELECT a.*, cc.name AS category" . "\nFROM #__ponygallery AS a, #__ponygallery_catg AS cc" . "\nWHERE a.catid=cc.cid AND a.id=$id" . "\n AND cc.access<='$gid'" ); $rows=$database->loadObjectList(); $row =& $rows[0]; echo ShowCategoryPathLink( $row->catid ); } echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""._PONYGALLERY_USER_PANEL." - "; echo ""._PONYGALLERY_MOST_VIEWED.""; if ( $ag_showrating ) echo " - "._PONYGALLERY_TOP_RATED.""; echo " - "._PONYGALLERY_LAST_ADDED.""; if ( $ag_showcomment ) echo " - "._PONYGALLERY_LAST_COMMENTED.""; echo "
"; return; } function GalleryFooter() { global $ag_suppresscredits; echo "
[RM]: "._PONYGALLERY_REG_MEMBERS." Directory
[SM]: "._PONYGALLERY_SPECIAL_MEMBERS." Directory
"; echo 'Powered by: PonyGallery
'; echo ''; } ?>
"; echo ""; $database->setQuery( "SELECT * FROM #__ponygallery as a " . "\n left join #__ponygallery_catg as c on c.cid=a.catid" . "\n WHERE a.published = '1' AND a.catid = '" . $catid . "'" . " AND a.approved = 1" . "\n AND c.access<='$gid'" . "\n ORDER BY a.id DESC LIMIT " . $start . "," . $ag_perpage ); //$database->setQuery($query1); $rows=$database->loadObjectList(); echo ""; $rowcounter=0; foreach ( $rows as $row1 ) { if ( ($rowcounter % 3 == 0) AND ($rowcounter <> 0) ) echo ""; echo ""; $rowcounter++; } if ( $rowcounter % 3 <> 0 ) { for ( $i=1; $i <= (3 - ($rowcounter % 3)); $i++ ) { echo ""; } } echo "
$catname
"; echo "
"; echo "$row1->imgtitle"; if ( $ag_showdetail ) echo "
"._PONYGALLERY_HITS.": $row1->imgcounter"; if ( $ag_showrating ) { if ( $row1->imgvotes > 0 ) { $fimgvotesum=number_format( $row1->imgvotesum / $row1->imgvotes, 2, ",", "." ); $frating="$fimgvotesum ($row1->imgvotes Votes)"; } else { $frating=_PONYGALLERY_NO_VOTES; } echo "
"._PONYGALLERY_RATING.": $frating"; } if ( $ag_showcomment ) { # Check how many comments exist $database->setQuery( "SELECT cmtid FROM #__ponygallery_comments WHERE cmtpic='$row1->id'" ); $comments_result=$database->query(); $comments=mysql_num_rows( $comments_result ); echo "
"._PONYGALLERY_COMMENT.": $comments"; } echo "
"; break; ######################################################################################### case "showupload": if ( !$my->username ) { mosRedirect( "index.php?option=com_ponygallery", _PONYGALLERY_YOU_NOT_LOGED ); die(); } GalleryHeader(); showUpload( $option, $batchul ); break; case "uploadhandler": if ( !$my->username ) { mosRedirect( "index.php?option=com_ponygallery", _PONYGALLERY_YOU_NOT_LOGED ); die(); } require_once( $mosConfig_absolute_path . "/administrator/components/com_ponygallery/config.ponygallery.php" ); echo "

"; $tag=ereg_replace( ".*\.([^\.]*)$", "\\1", $screenshot_name ); $tag=strtolower( $tag ); if ( $_FILES["screenshot"]["size"] > $ag_maxfilesize ) { mosRedirect( "index.php?option=com_ponygallery&func=userpannel", "Error : Max allowed file size is " . $ag_maxfilesize . " bytes" ); die(); } //Check for right format if ( ($tag == "jpeg") || ($tag == "jpg") || ($tag == "gif") || ($tag == "png") ) { if ( file_exists( $mosConfig_absolute_path . $ag_pathimages . "/$screenshot_name" ) ) { mosRedirect( "index.php?option=com_ponygallery&func=showupload", _PONYGALLERY_SITVUD ); die(); } if ( strlen( $screenshot ) > 0 and $screenshot != "none" ) move_uploaded_file( $screenshot, $mosConfig_absolute_path . $ag_pathimages . "/$screenshot_name" ); echo "
"; $img_info=getimagesize( $mosConfig_absolute_path . $ag_pathimages . "/$screenshot_name" ); if ( $img_info[0] > $ag_maxwidth or $img_info[1] > $ag_maxheight ) { unlink( $mosConfig_absolute_path . $ag_pathimages . "/$screenshot_name" ); mosRedirect( "index.php?option=com_ponygallery&func=showupload", _PONYGALLERY_MAX_WIGHT_HIGHT . ':' . $ag_maxwidth . 'x ' . $ag_maxheight ); } if ( $thumbcreation ) resize_image( $mosConfig_absolute_path . $ag_pathimages . "/$screenshot_name", $mosConfig_absolute_path . $ag_paththumbs . "/tn_$screenshot_name", "$ag_thumbwidth", "$ag_thumbcreation", "$ag_thumbquality" ); echo _PONYGALLERY_THUMBNAIL_COMP . '
'; $row = new mosponygallery( $database ); if ( !$row->bind( $_POST, _PONYGALLERY_APPROVED_OWNER_PUBLISH ) ) { echo "\n"; exit(); } $row->imgdate = mktime(); $row->owner = $my->username; $row->published = 1; if ( $ag_approve ) { $row->approved = 0; } else { $row->approved = 1; } $row->imgfilename = $screenshot_name; $row->imgthumbname = "tn_" . $screenshot_name; $row->useruploaded = 1; if ( !$row->store() ) { echo "\n"; exit(); } else { // messaging for new items require_once( "$mosConfig_absolute_path/components/com_messages/messages.class.php" ); $database->setQuery( "SELECT id FROM #__users WHERE sendEmail='1'" ); $users = $database->loadResultArray(); foreach ( $users as $user_id ) { $msg=new mosMessage( $database ); $msg->send( $my->id, $user_id, "New Picture Uploaded", sprintf( _PONYGALLERY_NEW_CONTENT_SUBMITED . " %s " . _PONYGALLERY_TITLED ." %s.", $my->username, $row->imgtitle ) ); } } mosRedirect( "index.php?option=com_ponygallery&func=userpannel", _PONYGALLERY_PIC_SUCCESSFULLY_ADD ); } else { mosRedirect( "index.php?option=com_ponygallery&func=showupload", _PONYGALLERY_INVALID_IMG_TYPE ); } break; case "userpannel": if ( !$my->username ) { mosRedirect( "index.php?option=com_ponygallery&func=showupload", _PONYGALLERY_YOU_NOT_LOGED ); die(); } GalleryHeader(); ; userPannel(); break; ######################################################################################### case "send2friend": $send2friendname=mosGetParam( $_POST, "send2friendname", '' ); $send2friendemail=mosGetParam( $_POST, "send2friendemail", '' ); $from2friendname=mosGetParam( $_POST, "from2friendname", '' ); $from2friendemail=mosGetParam( $_POST, "from2friendemail", '' ); $id=intval( mosGetParam( $_POST, "id", '' ) ); $text=$from2friendname . " (" . $from2friendemail . ")" . " "._PONYGALLERY_INVITE_VIEW_PIC."\r \n"; $text.=$mosConfig_live_site . "/index.php?option=com_ponygallery&func=detail&id=$id \r \n"; $subject=$mosConfig_sitename . ' - ' . _PONYGALLERY_RECCOMEND_PIC_FROM_FREND; $headers.=_PONYGALLERY_ODDDOD.": " . $from2friendname . " <" . $from2friendemail . ">\r\n"; $headers.=_PONYGALLERY_ODGOVV.": <" . $from2friendemail . ">\r\n"; $headers.="X-Priority: 3\r\n"; $headers.="X-MSMail-Priority: Low\r\n"; $headers.="X-Mailer: Mambo Open Source 4.5\r\n"; @mail( $send2friendemail, $subject, $text, $headers ); ?> "; echo ""._PONYGALLERY_CATEGORIES.""; $query1 ="SELECT * FROM #__ponygallery_catg WHERE published = '1' and parent = 0 \n ORDER BY ordering"; // ORDER BY ordering ASC"; $database->setQuery( $query1 ); $rows=$database->loadObjectList(); $line=1; foreach ( $rows as $row1 ) { $linecolor=($line % 2) + 1; echo ""; if ( $row1->image <> "" ) { echo "cid>"; echo "(" . GetNumberOfLinks( $row1->cid ) . " "._PONYGALLERY_PICTURES.")"; } echo "cid>$row1->name (" . GetNumberOfLinks( $row1->cid ) . " "._PONYGALLERY_PICTURES.")"; if ( $row1->access > 1 ) { echo ' '._PONYGALLERY_SM.''; } else if ( $row1->access > 0 ) { echo ' '._PONYGALLERY_RM.''; } echo "
"; echo "$row1->description

"; $database->setQuery( "SELECT count(id) FROM #__ponygallery WHERE published = '1' AND catid = '" . $row1->cid . "'" . " AND approved = 1" ); $count=$database->loadResult(); echo ""; $line++; } echo ""; break; } GalleryFooter(); function showUpload ( $option, $batchul ) { global $my, $database, $ag_maxuserimage, $ag_category; $database->setQuery( "select count(id) from #__ponygallery where owner = '$my->username'" ); $count_pic=$database->loadResult(); if ( $count_pic >= $ag_maxuserimage ) { mosRedirect( "index.php?option=com_ponygallery&func=userpannel", ""._PONYGALLERY_MAY_ADD_MAX_OFF." " . $ag_maxuserimage . " "._PONYGALLERY_PICTURES."" ); die(); } $clist=ShowDropDownCategoryList( $ag_category, "catid", ' size="1"' ); ?>

:
:
:
: username; ?>
:
load( $uid ); if ( $row->owner !== $my->username ) { mosRedirect( "index.php?option=com_ponygallery&func=userpannel", _PONYGALLERY_NOT_ALOWED_EDIT_PIC); die(); } $clist=ShowDropDownCategoryList( $row->catid, "catid", ' size="1"' ); ?>

:
: */ ?>
:
: username; ?>
: <?php echo _PONYGALLERY_THUMB_PREVIEW;?>
'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF', 8 => 'TIFF', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF' ); $imginfo=getimagesize( $src_file ); if ( $imginfo == null ) die( "ERROR: Source file not found!" ); $imginfo[2]=$imagetype[$imginfo[2]]; // GD can only handle JPG & PNG images if ( $imginfo[2] != 'JPG' && $imginfo[2] != 'PNG' && $imginfo[2] != 'GIF' && ($method == 'gd1' || $method == 'gd2') ) die( "ERROR: GD can only handle JPG and PNG files!" ); // height/width $srcWidth=$imginfo[0]; $srcHeight=$imginfo[1]; echo "Creating thumbnail from $imginfo[2], $imginfo[0] x $imginfo[1]...
"; $ratio=max( $srcWidth, $srcHeight ) / $new_size; $ratio=max( $ratio, 1.0 ); $destWidth=(int)($srcWidth / $ratio); $destHeight=(int)($srcHeight / $ratio); // Method for thumbnails creation switch ( $method ) { case "gd1": if ( !function_exists( 'imagecreatefromjpeg' ) ) { die( 'GD image library not installed!' ); } if ( $imginfo[2] == 'JPG' ) $src_img=imagecreatefromjpeg( $src_file ); else if ( $imginfo[2] == 'JPG' ) $src_img=imagecreatefromjpeg( $src_file ); else $src_img=imagecreatefromgif( $src_file ); if ( !$src_img ) { $ERROR=$lang_errors['invalid_image']; return false; } $dst_img=imagecreate( $destWidth, $destHeight ); imagecopyresized( $dst_img, $src_img, 0, 0, 0, 0, $destWidth, (int)$destHeight, $srcWidth, $srcHeight ); imagejpeg( $dst_img, $dest_file, $dest_qual ); imagedestroy( $src_img ); imagedestroy( $dst_img ); break; case "gd2": if ( !function_exists( 'imagecreatefromjpeg' ) ) { die( 'GD image library not installed!' ); } if ( !function_exists( 'imagecreatetruecolor' ) ) { die( 'GD2 image library does not support truecolor thumbnailing!' ); } if ( $imginfo[2] == 'JPG' ) { $src_img=imagecreatefromjpeg( $src_file ); } else if ( $imginfo[2] == 'PNG' ) { $src_img=imagecreatefrompng( $src_file ); } else { $src_img=imagecreatefromgif( $src_file ); } if ( !$src_img ) { $ERROR=$lang_errors['invalid_image']; return false; } $dst_img=imagecreatetruecolor( $destWidth, $destHeight ); imagecopyresampled( $dst_img, $src_img, 0, 0, 0, 0, $destWidth, (int)$destHeight, $srcWidth, $srcHeight ); imagejpeg( $dst_img, $dest_file, $dest_qual ); imagedestroy( $src_img ); imagedestroy( $dst_img ); break; } // Set mode of uploaded picture chmod( $dest_file, octdec( '755' ) ); // We check that the image is valid $imginfo=getimagesize( $dest_file ); if ( $imginfo == null ) { return false; } else { return true; } } /**************************************************\ Start Functions \**************************************************/ function userPannel ( ) { global $database, $my, $ag_approve; ?> setQuery( "select * from #__ponygallery where owner='$my->username'" ); $rows=$database->loadObjectList(); $k=0; if ( count( $rows ) ) { foreach ( $rows as $row ) { $k=1 - $k; ?> approved ) { $a_pic="tick.png"; } else { $a_pic="publish_x.png"; } ?>
   
imgtitle ?> imgcounter; ?> catid ); ?>

bind( $_POST, "approved owner published imgfilename imgthumbname" ) ) { echo "\n"; exit(); } $row->imgdate=mktime(); $row->owner=$my->username; $row->published=1; if ( $ag_approve ) { $row->approved=0; } else { $row->approved=1; } //$row->imgfilename = $screenshot_name; //$row->imgthumbname = "tn_".$screenshot_name; $row->useruploaded=1; if ( !$row->store() ) { echo "\n"; exit(); } mosRedirect( "index.php?option=com_ponygallery&func=userpannel", _PONYGALLERY_UIC_SUCCESS_IPDATED); } function deletePic ( $uid, $option ) { global $database, $my, $mosConfig_absolute_path, $ag_pathimages, $ag_paththumbs; $database->setQuery( "select owner from #__ponygallery where id=" . intval( $uid ) ); $own=$database->loadResult(); if ( $own !== $my->username ) { mosRedirect( "index.php?option=com_ponygallery&func=userpannel", _PONYGALLERY_NOT_ALOWED_DELETE_PIC); die(); } if ( $uid ) { $row=new mosponygallery( $database ); $row->load( $uid ); if ( unlink( $mosConfig_absolute_path . $ag_pathimages . "/$row->imgfilename" ) ) { //If image is deleted, delete thumb if ( unlink( $mosConfig_absolute_path . $ag_paththumbs . "/$row->imgthumbname" ) ) { $database->setQuery( "DELETE FROM #__ponygallery_comments WHERE cmtpic=$uid" ); if ( !$database->query() ) { echo "\n"; } $database->setQuery( "DELETE FROM #__ponygallery WHERE id=$uid" ); if ( !$database->query() ) { echo "\n"; } } else { die(_PONYGALLERY_NOT_DELETE_THMB_IMAGE_FILE ); } } else { die( _PONYGALLERY_FFFFFFF ); } mosRedirect( "index.php?option=com_ponygallery&func=userpannel", _PONYGALLERY_PIC_COMMENT_DELETED ); } } function ShowDropDownCategoryList ( $cat, $cname = "cat", $extra = null, $flag = 0 ) { global $database, $ag_category, $gid; $arr_cat=explode( ",", $ag_category ); $category=""; return $category; } function dmoz ( $catid, $Itemid ) { global $database, $travelConfig, $task, $gid; $database->setQuery( "SELECT d.*" . "\n FROM #__ponygallery_catg AS d" . "\n WHERE d.parent=$catid and d.published=1 \n" . "\n ORDER BY d.ordering" ); $rows = $database->loadObjectList(); $num_rows=ceil( count( $rows ) / 4 ); $index=0; $output=''; $output.=''; $output.=' '; $output.=' '; $output.=''; for ( $row_count=0; $row_count < $num_rows; $row_count++ ) { $output.=''; for ( $col_count=0; $col_count < 4; $col_count++ ) { $output.=''; } $output.=''; } $output.='
'; $output .=""._PONYGALLERY_POMKAT; $output.='
'; $cur_name=$rows[$index]; if ( trim( $cur_name ) == "" ) { $output.=' '; } else { $output.='cid" ) . '">' . $cur_name->name . ' (' . GetNumberOfLinks( $cur_name->cid ) . ')'; if ( $cur_name->access > 1 ) { $output.=' '._PONYGALLERY_SM.''; } else if ( $cur_name->access > 0 ) { $output.=' '._PONYGALLERY_RM.''; } } $index++; $output.='
' . $cur_name->description . '
'; return $output; } function ShowCategoryPathLink ( $cat ) { global $database, $mosConfig_lang, $gid, $Itemid; $cat=intval( $cat ); $parent_id=1000; while ( $parent_id ) { $query="select * from #__ponygallery_catg where cid=$cat and published=1 \n AND access<='" . $gid . "'"; $database->setQuery( $query ); $result=$database->query(); $parent_id=@mysql_result( $result, 0, 'parent' ); $cid=@mysql_result( $result, 0, 'cid' ); $name="" . @mysql_result( $result,0,'name' ) . ""; // write path if ( empty( $path ) ) { $path=$name; } else { $path=$name . ' » ' . $path; } // next looping $cat=$parent_id; } $home="". _PONYGALLERY_HOME.""; $pathName=$home . ' » ' . $path . " "; return $pathName; } function GetNumberOfLinks ( $cat ) { global $database, $gid; $queue[]=intval($cat); while ( list( $key, $cat )=each( $queue ) ) { // get children $query="select cid from #__ponygallery_catg where parent=$cat and published=1"; $database->setQuery( $query ); $result=$database->query(); $total=mysql_num_rows( $result ); // put them in queue $j=0; while ( $j < $total ) { $val=mysql_fetch_row( $result ); $queue[]=$val[0]; $j++; } } reset( $queue ); $query="SELECT count(id) as count FROM #__ponygallery where ( 0!=0"; while ( list( $key, $cat )=each( $queue ) ) { $query.=" or catid = $cat"; } $query=$query . " ) and published=1 AND approved = 1"; $database->setQuery( $query ); $result=$database->query(); $val=mysql_fetch_row( $result ); return $val[0]; } function ShowCategoryPath ( $cat ) { global $database, $mosConfig_lang, $gid; $cat=intval( $cat ); $parent_id=1000; while ( $parent_id ) { // read name and parent_id $query="select * from #__ponygallery_catg where cid=$cat \n AND access<='" . $gid . "'"; $database->setQuery( $query ); $result=$database->query(); $parent_id=@mysql_result( $result, 0, 'parent' ); $name=@mysql_result( $result, 0, 'name' ); // write path if ( empty( $path ) ) { $path=$name; } else { $path=$name . ' » ' . $path; } // next looping $cat=$parent_id; } return $path . " "; } /**************************************************\ End \**************************************************/ ?>