![]() |
Cale.cc |
|
To contribute your own pictures to our gallery you need to login. If you're not already a member - you can register for free!
join us!
'."\n"; return $vOutput; } /*====================================================================================================================================================================*/ /** * @return array Uploaded image details * @param pPath string the FULL path to the gallery upload dir * @param pPrefix string a prefix (if any) to prepend to image filenames * @desc Validate a gallery image upload */ function doGalleryImageUpload($pPath, $pPrefix=''){ $vResult = array(); if(($_FILES['filename']['error'] == 0) and ($_FILES['filename']['name'] <> '')){ $vResult['origname'] = $_FILES['filename']['name']; switch($_FILES['filename']['type']){ case 'image/jpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/gif' : $vResult['filename'] = uniqid($pPrefix.'-').'.gif'; $vResult['valid'] = true; break; case 'image/pjpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/png' : $vResult['filename'] = uniqid($pPrefix.'-').'.png'; $vResult['valid'] = true; break; default : $vResult['valid']=false; $vResult['errors'] = 'Only image files are permitted '."\n"; $vResult['errors'] = $_FILES['filename']['type'].' is not a valid type '."\n"; } }else{ $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; } if ($vResult['valid']) { if (!move_uploaded_file($_FILES['filename']['tmp_name'],$pPath.'/'.$vResult['filename'])) { $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; }else{ if (ImageMaxSize($pPath.'/'.$vResult['filename'],getSiteOption('image.max.width'), getSiteOption('image.max.height'),80)){//Shrink main image if necessary $vResult['messages'] = 'Image was resized to maximum 600×800 pixels'; } MakeThumbnail($pPath.'/'.$vResult['filename'], getSiteOption('image.thumb.width'), getSiteOption('image.thumb.height'), 60); } } return $vResult; } /*====================================================================================================================================================================*/ /** * @return integer the id of the album being created/replaced * @desc Update/Create an Album in the Database */ function replaceGalleryAlbum($pAlbum){ global $ppbDatabase; $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pAlbum['id'].', '; $vSQL.= $pAlbum['pid'].', '; $vSQL.= $pAlbum['cid'].', '; $vSQL.= $pAlbum['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pAlbum['title']).'\','; $vSQL.= '\''.dbClean($pAlbum['description']).'\','; $vSQL.= '\''.dbClean($pAlbum['keywords']).'\','; $vSQL.= $pAlbum['views'].', '; $vSQL.= '\''.$pAlbum['image'].'\','; $vSQL.= $pAlbum['closed'].', '; $vSQL.= '\''.$pAlbum['origname'].'\', '; $vSQL.= '\''.$pAlbum['sortkey'].'\', '; $vSQL.= '\''.$pAlbum['sorttype'].'\' '; $vSQL.= ')'; //print $vSQL; if(!mysql_query($vSQL)){ myError('Album Update Failed'); return 0; }else{ if($pAlbum['id']>0){ return $pAlbum['id']; }else{ return mysql_insert_id(); } } } /*====================================================================================================================================================================*/ /** * @return integer the id of the item being created/replaced * @param pGallery array a complete gallery post array * @desc Update/Create an item in the passed Album in the Database */ function replaceGalleryItem($pGallery){ global $ppbDatabase; if($pGallery['pid'] > 0){ $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pGallery['id'].', '; $vSQL.= $pGallery['pid'].', '; $vSQL.= $pGallery['cid'].', '; $vSQL.= $pGallery['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pGallery['title']).'\','; $vSQL.= '\''.dbClean($pGallery['description']).'\','; $vSQL.= '\''.dbClean($pGallery['keywords']).'\','; $vSQL.= $pGallery['views'].', '; $vSQL.= '\''.$pGallery['image'].'\','; $vSQL.= '0,'; $vSQL.= '\''.$pGallery['origname'].'\', '; $vSQL.= '\''.$pGallery['sortkey'].'\', '; $vSQL.= '0 '; $vSQL.= ')'; if(!mysql_query($vSQL)){ myError('Gallery Item Update Failed'); return 0; }else{ if($pGallery['id']>0){ return $pGallery['id']; }else{ return mysql_insert_id(); } } }else{ myError('No Album specified'); return 0; } } /*====================================================================================================================================================================*/ /** * @return void * @param pGallery array a gallery item array (may be empty) * @param pAdmin boolean true to show admin controls * @desc Display the form for adding/modifying an album */ function formGalleryItem($pGallery, $pAdmin=false){ $vAlbum=getGalleryPost($pGallery['pid']); ?> |
||||||||||||||||||||||||||||||||||
'."\n"; return $vOutput; } /*====================================================================================================================================================================*/ /** * @return array Uploaded image details * @param pPath string the FULL path to the gallery upload dir * @param pPrefix string a prefix (if any) to prepend to image filenames * @desc Validate a gallery image upload */ function doGalleryImageUpload($pPath, $pPrefix=''){ $vResult = array(); if(($_FILES['filename']['error'] == 0) and ($_FILES['filename']['name'] <> '')){ $vResult['origname'] = $_FILES['filename']['name']; switch($_FILES['filename']['type']){ case 'image/jpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/gif' : $vResult['filename'] = uniqid($pPrefix.'-').'.gif'; $vResult['valid'] = true; break; case 'image/pjpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/png' : $vResult['filename'] = uniqid($pPrefix.'-').'.png'; $vResult['valid'] = true; break; default : $vResult['valid']=false; $vResult['errors'] = 'Only image files are permitted '."\n"; $vResult['errors'] = $_FILES['filename']['type'].' is not a valid type '."\n"; } }else{ $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; } if ($vResult['valid']) { if (!move_uploaded_file($_FILES['filename']['tmp_name'],$pPath.'/'.$vResult['filename'])) { $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; }else{ if (ImageMaxSize($pPath.'/'.$vResult['filename'],getSiteOption('image.max.width'), getSiteOption('image.max.height'),80)){//Shrink main image if necessary $vResult['messages'] = 'Image was resized to maximum 600×800 pixels'; } MakeThumbnail($pPath.'/'.$vResult['filename'], getSiteOption('image.thumb.width'), getSiteOption('image.thumb.height'), 60); } } return $vResult; } /*====================================================================================================================================================================*/ /** * @return integer the id of the album being created/replaced * @desc Update/Create an Album in the Database */ function replaceGalleryAlbum($pAlbum){ global $ppbDatabase; $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pAlbum['id'].', '; $vSQL.= $pAlbum['pid'].', '; $vSQL.= $pAlbum['cid'].', '; $vSQL.= $pAlbum['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pAlbum['title']).'\','; $vSQL.= '\''.dbClean($pAlbum['description']).'\','; $vSQL.= '\''.dbClean($pAlbum['keywords']).'\','; $vSQL.= $pAlbum['views'].', '; $vSQL.= '\''.$pAlbum['image'].'\','; $vSQL.= $pAlbum['closed'].', '; $vSQL.= '\''.$pAlbum['origname'].'\', '; $vSQL.= '\''.$pAlbum['sortkey'].'\', '; $vSQL.= '\''.$pAlbum['sorttype'].'\' '; $vSQL.= ')'; //print $vSQL; if(!mysql_query($vSQL)){ myError('Album Update Failed'); return 0; }else{ if($pAlbum['id']>0){ return $pAlbum['id']; }else{ return mysql_insert_id(); } } } /*====================================================================================================================================================================*/ /** * @return integer the id of the item being created/replaced * @param pGallery array a complete gallery post array * @desc Update/Create an item in the passed Album in the Database */ function replaceGalleryItem($pGallery){ global $ppbDatabase; if($pGallery['pid'] > 0){ $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pGallery['id'].', '; $vSQL.= $pGallery['pid'].', '; $vSQL.= $pGallery['cid'].', '; $vSQL.= $pGallery['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pGallery['title']).'\','; $vSQL.= '\''.dbClean($pGallery['description']).'\','; $vSQL.= '\''.dbClean($pGallery['keywords']).'\','; $vSQL.= $pGallery['views'].', '; $vSQL.= '\''.$pGallery['image'].'\','; $vSQL.= '0,'; $vSQL.= '\''.$pGallery['origname'].'\', '; $vSQL.= '\''.$pGallery['sortkey'].'\', '; $vSQL.= '0 '; $vSQL.= ')'; if(!mysql_query($vSQL)){ myError('Gallery Item Update Failed'); return 0; }else{ if($pGallery['id']>0){ return $pGallery['id']; }else{ return mysql_insert_id(); } } }else{ myError('No Album specified'); return 0; } } /*====================================================================================================================================================================*/ /** * @return void * @param pGallery array a gallery item array (may be empty) * @param pAdmin boolean true to show admin controls * @desc Display the form for adding/modifying an album */ function formGalleryItem($pGallery, $pAdmin=false){ $vAlbum=getGalleryPost($pGallery['pid']); ?> |
'."\n"; return $vOutput; } /*====================================================================================================================================================================*/ /** * @return array Uploaded image details * @param pPath string the FULL path to the gallery upload dir * @param pPrefix string a prefix (if any) to prepend to image filenames * @desc Validate a gallery image upload */ function doGalleryImageUpload($pPath, $pPrefix=''){ $vResult = array(); if(($_FILES['filename']['error'] == 0) and ($_FILES['filename']['name'] <> '')){ $vResult['origname'] = $_FILES['filename']['name']; switch($_FILES['filename']['type']){ case 'image/jpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/gif' : $vResult['filename'] = uniqid($pPrefix.'-').'.gif'; $vResult['valid'] = true; break; case 'image/pjpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/png' : $vResult['filename'] = uniqid($pPrefix.'-').'.png'; $vResult['valid'] = true; break; default : $vResult['valid']=false; $vResult['errors'] = 'Only image files are permitted '."\n"; $vResult['errors'] = $_FILES['filename']['type'].' is not a valid type '."\n"; } }else{ $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; } if ($vResult['valid']) { if (!move_uploaded_file($_FILES['filename']['tmp_name'],$pPath.'/'.$vResult['filename'])) { $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; }else{ if (ImageMaxSize($pPath.'/'.$vResult['filename'],getSiteOption('image.max.width'), getSiteOption('image.max.height'),80)){//Shrink main image if necessary $vResult['messages'] = 'Image was resized to maximum 600×800 pixels'; } MakeThumbnail($pPath.'/'.$vResult['filename'], getSiteOption('image.thumb.width'), getSiteOption('image.thumb.height'), 60); } } return $vResult; } /*====================================================================================================================================================================*/ /** * @return integer the id of the album being created/replaced * @desc Update/Create an Album in the Database */ function replaceGalleryAlbum($pAlbum){ global $ppbDatabase; $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pAlbum['id'].', '; $vSQL.= $pAlbum['pid'].', '; $vSQL.= $pAlbum['cid'].', '; $vSQL.= $pAlbum['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pAlbum['title']).'\','; $vSQL.= '\''.dbClean($pAlbum['description']).'\','; $vSQL.= '\''.dbClean($pAlbum['keywords']).'\','; $vSQL.= $pAlbum['views'].', '; $vSQL.= '\''.$pAlbum['image'].'\','; $vSQL.= $pAlbum['closed'].', '; $vSQL.= '\''.$pAlbum['origname'].'\', '; $vSQL.= '\''.$pAlbum['sortkey'].'\', '; $vSQL.= '\''.$pAlbum['sorttype'].'\' '; $vSQL.= ')'; //print $vSQL; if(!mysql_query($vSQL)){ myError('Album Update Failed'); return 0; }else{ if($pAlbum['id']>0){ return $pAlbum['id']; }else{ return mysql_insert_id(); } } } /*====================================================================================================================================================================*/ /** * @return integer the id of the item being created/replaced * @param pGallery array a complete gallery post array * @desc Update/Create an item in the passed Album in the Database */ function replaceGalleryItem($pGallery){ global $ppbDatabase; if($pGallery['pid'] > 0){ $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pGallery['id'].', '; $vSQL.= $pGallery['pid'].', '; $vSQL.= $pGallery['cid'].', '; $vSQL.= $pGallery['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pGallery['title']).'\','; $vSQL.= '\''.dbClean($pGallery['description']).'\','; $vSQL.= '\''.dbClean($pGallery['keywords']).'\','; $vSQL.= $pGallery['views'].', '; $vSQL.= '\''.$pGallery['image'].'\','; $vSQL.= '0,'; $vSQL.= '\''.$pGallery['origname'].'\', '; $vSQL.= '\''.$pGallery['sortkey'].'\', '; $vSQL.= '0 '; $vSQL.= ')'; if(!mysql_query($vSQL)){ myError('Gallery Item Update Failed'); return 0; }else{ if($pGallery['id']>0){ return $pGallery['id']; }else{ return mysql_insert_id(); } } }else{ myError('No Album specified'); return 0; } } /*====================================================================================================================================================================*/ /** * @return void * @param pGallery array a gallery item array (may be empty) * @param pAdmin boolean true to show admin controls * @desc Display the form for adding/modifying an album */ function formGalleryItem($pGallery, $pAdmin=false){ $vAlbum=getGalleryPost($pGallery['pid']); ?> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
'."\n"; return $vOutput; } /*====================================================================================================================================================================*/ /** * @return array Uploaded image details * @param pPath string the FULL path to the gallery upload dir * @param pPrefix string a prefix (if any) to prepend to image filenames * @desc Validate a gallery image upload */ function doGalleryImageUpload($pPath, $pPrefix=''){ $vResult = array(); if(($_FILES['filename']['error'] == 0) and ($_FILES['filename']['name'] <> '')){ $vResult['origname'] = $_FILES['filename']['name']; switch($_FILES['filename']['type']){ case 'image/jpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/gif' : $vResult['filename'] = uniqid($pPrefix.'-').'.gif'; $vResult['valid'] = true; break; case 'image/pjpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/png' : $vResult['filename'] = uniqid($pPrefix.'-').'.png'; $vResult['valid'] = true; break; default : $vResult['valid']=false; $vResult['errors'] = 'Only image files are permitted '."\n"; $vResult['errors'] = $_FILES['filename']['type'].' is not a valid type '."\n"; } }else{ $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; } if ($vResult['valid']) { if (!move_uploaded_file($_FILES['filename']['tmp_name'],$pPath.'/'.$vResult['filename'])) { $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; }else{ if (ImageMaxSize($pPath.'/'.$vResult['filename'],getSiteOption('image.max.width'), getSiteOption('image.max.height'),80)){//Shrink main image if necessary $vResult['messages'] = 'Image was resized to maximum 600×800 pixels'; } MakeThumbnail($pPath.'/'.$vResult['filename'], getSiteOption('image.thumb.width'), getSiteOption('image.thumb.height'), 60); } } return $vResult; } /*====================================================================================================================================================================*/ /** * @return integer the id of the album being created/replaced * @desc Update/Create an Album in the Database */ function replaceGalleryAlbum($pAlbum){ global $ppbDatabase; $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pAlbum['id'].', '; $vSQL.= $pAlbum['pid'].', '; $vSQL.= $pAlbum['cid'].', '; $vSQL.= $pAlbum['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pAlbum['title']).'\','; $vSQL.= '\''.dbClean($pAlbum['description']).'\','; $vSQL.= '\''.dbClean($pAlbum['keywords']).'\','; $vSQL.= $pAlbum['views'].', '; $vSQL.= '\''.$pAlbum['image'].'\','; $vSQL.= $pAlbum['closed'].', '; $vSQL.= '\''.$pAlbum['origname'].'\', '; $vSQL.= '\''.$pAlbum['sortkey'].'\', '; $vSQL.= '\''.$pAlbum['sorttype'].'\' '; $vSQL.= ')'; //print $vSQL; if(!mysql_query($vSQL)){ myError('Album Update Failed'); return 0; }else{ if($pAlbum['id']>0){ return $pAlbum['id']; }else{ return mysql_insert_id(); } } } /*====================================================================================================================================================================*/ /** * @return integer the id of the item being created/replaced * @param pGallery array a complete gallery post array * @desc Update/Create an item in the passed Album in the Database */ function replaceGalleryItem($pGallery){ global $ppbDatabase; if($pGallery['pid'] > 0){ $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pGallery['id'].', '; $vSQL.= $pGallery['pid'].', '; $vSQL.= $pGallery['cid'].', '; $vSQL.= $pGallery['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pGallery['title']).'\','; $vSQL.= '\''.dbClean($pGallery['description']).'\','; $vSQL.= '\''.dbClean($pGallery['keywords']).'\','; $vSQL.= $pGallery['views'].', '; $vSQL.= '\''.$pGallery['image'].'\','; $vSQL.= '0,'; $vSQL.= '\''.$pGallery['origname'].'\', '; $vSQL.= '\''.$pGallery['sortkey'].'\', '; $vSQL.= '0 '; $vSQL.= ')'; if(!mysql_query($vSQL)){ myError('Gallery Item Update Failed'); return 0; }else{ if($pGallery['id']>0){ return $pGallery['id']; }else{ return mysql_insert_id(); } } }else{ myError('No Album specified'); return 0; } } /*====================================================================================================================================================================*/ /** * @return void * @param pGallery array a gallery item array (may be empty) * @param pAdmin boolean true to show admin controls * @desc Display the form for adding/modifying an album */ function formGalleryItem($pGallery, $pAdmin=false){ $vAlbum=getGalleryPost($pGallery['pid']); ?> |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
'."\n"; return $vOutput; } /*====================================================================================================================================================================*/ /** * @return array Uploaded image details * @param pPath string the FULL path to the gallery upload dir * @param pPrefix string a prefix (if any) to prepend to image filenames * @desc Validate a gallery image upload */ function doGalleryImageUpload($pPath, $pPrefix=''){ $vResult = array(); if(($_FILES['filename']['error'] == 0) and ($_FILES['filename']['name'] <> '')){ $vResult['origname'] = $_FILES['filename']['name']; switch($_FILES['filename']['type']){ case 'image/jpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/gif' : $vResult['filename'] = uniqid($pPrefix.'-').'.gif'; $vResult['valid'] = true; break; case 'image/pjpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/png' : $vResult['filename'] = uniqid($pPrefix.'-').'.png'; $vResult['valid'] = true; break; default : $vResult['valid']=false; $vResult['errors'] = 'Only image files are permitted '."\n"; $vResult['errors'] = $_FILES['filename']['type'].' is not a valid type '."\n"; } }else{ $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; } if ($vResult['valid']) { if (!move_uploaded_file($_FILES['filename']['tmp_name'],$pPath.'/'.$vResult['filename'])) { $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; }else{ if (ImageMaxSize($pPath.'/'.$vResult['filename'],getSiteOption('image.max.width'), getSiteOption('image.max.height'),80)){//Shrink main image if necessary $vResult['messages'] = 'Image was resized to maximum 600×800 pixels'; } MakeThumbnail($pPath.'/'.$vResult['filename'], getSiteOption('image.thumb.width'), getSiteOption('image.thumb.height'), 60); } } return $vResult; } /*====================================================================================================================================================================*/ /** * @return integer the id of the album being created/replaced * @desc Update/Create an Album in the Database */ function replaceGalleryAlbum($pAlbum){ global $ppbDatabase; $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pAlbum['id'].', '; $vSQL.= $pAlbum['pid'].', '; $vSQL.= $pAlbum['cid'].', '; $vSQL.= $pAlbum['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pAlbum['title']).'\','; $vSQL.= '\''.dbClean($pAlbum['description']).'\','; $vSQL.= '\''.dbClean($pAlbum['keywords']).'\','; $vSQL.= $pAlbum['views'].', '; $vSQL.= '\''.$pAlbum['image'].'\','; $vSQL.= $pAlbum['closed'].', '; $vSQL.= '\''.$pAlbum['origname'].'\', '; $vSQL.= '\''.$pAlbum['sortkey'].'\', '; $vSQL.= '\''.$pAlbum['sorttype'].'\' '; $vSQL.= ')'; //print $vSQL; if(!mysql_query($vSQL)){ myError('Album Update Failed'); return 0; }else{ if($pAlbum['id']>0){ return $pAlbum['id']; }else{ return mysql_insert_id(); } } } /*====================================================================================================================================================================*/ /** * @return integer the id of the item being created/replaced * @param pGallery array a complete gallery post array * @desc Update/Create an item in the passed Album in the Database */ function replaceGalleryItem($pGallery){ global $ppbDatabase; if($pGallery['pid'] > 0){ $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pGallery['id'].', '; $vSQL.= $pGallery['pid'].', '; $vSQL.= $pGallery['cid'].', '; $vSQL.= $pGallery['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pGallery['title']).'\','; $vSQL.= '\''.dbClean($pGallery['description']).'\','; $vSQL.= '\''.dbClean($pGallery['keywords']).'\','; $vSQL.= $pGallery['views'].', '; $vSQL.= '\''.$pGallery['image'].'\','; $vSQL.= '0,'; $vSQL.= '\''.$pGallery['origname'].'\', '; $vSQL.= '\''.$pGallery['sortkey'].'\', '; $vSQL.= '0 '; $vSQL.= ')'; if(!mysql_query($vSQL)){ myError('Gallery Item Update Failed'); return 0; }else{ if($pGallery['id']>0){ return $pGallery['id']; }else{ return mysql_insert_id(); } } }else{ myError('No Album specified'); return 0; } } /*====================================================================================================================================================================*/ /** * @return void * @param pGallery array a gallery item array (may be empty) * @param pAdmin boolean true to show admin controls * @desc Display the form for adding/modifying an album */ function formGalleryItem($pGallery, $pAdmin=false){ $vAlbum=getGalleryPost($pGallery['pid']); ?> |
'."\n"; return $vOutput; } /*====================================================================================================================================================================*/ /** * @return array Uploaded image details * @param pPath string the FULL path to the gallery upload dir * @param pPrefix string a prefix (if any) to prepend to image filenames * @desc Validate a gallery image upload */ function doGalleryImageUpload($pPath, $pPrefix=''){ $vResult = array(); if(($_FILES['filename']['error'] == 0) and ($_FILES['filename']['name'] <> '')){ $vResult['origname'] = $_FILES['filename']['name']; switch($_FILES['filename']['type']){ case 'image/jpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/gif' : $vResult['filename'] = uniqid($pPrefix.'-').'.gif'; $vResult['valid'] = true; break; case 'image/pjpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/png' : $vResult['filename'] = uniqid($pPrefix.'-').'.png'; $vResult['valid'] = true; break; default : $vResult['valid']=false; $vResult['errors'] = 'Only image files are permitted '."\n"; $vResult['errors'] = $_FILES['filename']['type'].' is not a valid type '."\n"; } }else{ $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; } if ($vResult['valid']) { if (!move_uploaded_file($_FILES['filename']['tmp_name'],$pPath.'/'.$vResult['filename'])) { $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; }else{ if (ImageMaxSize($pPath.'/'.$vResult['filename'],getSiteOption('image.max.width'), getSiteOption('image.max.height'),80)){//Shrink main image if necessary $vResult['messages'] = 'Image was resized to maximum 600×800 pixels'; } MakeThumbnail($pPath.'/'.$vResult['filename'], getSiteOption('image.thumb.width'), getSiteOption('image.thumb.height'), 60); } } return $vResult; } /*====================================================================================================================================================================*/ /** * @return integer the id of the album being created/replaced * @desc Update/Create an Album in the Database */ function replaceGalleryAlbum($pAlbum){ global $ppbDatabase; $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pAlbum['id'].', '; $vSQL.= $pAlbum['pid'].', '; $vSQL.= $pAlbum['cid'].', '; $vSQL.= $pAlbum['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pAlbum['title']).'\','; $vSQL.= '\''.dbClean($pAlbum['description']).'\','; $vSQL.= '\''.dbClean($pAlbum['keywords']).'\','; $vSQL.= $pAlbum['views'].', '; $vSQL.= '\''.$pAlbum['image'].'\','; $vSQL.= $pAlbum['closed'].', '; $vSQL.= '\''.$pAlbum['origname'].'\', '; $vSQL.= '\''.$pAlbum['sortkey'].'\', '; $vSQL.= '\''.$pAlbum['sorttype'].'\' '; $vSQL.= ')'; //print $vSQL; if(!mysql_query($vSQL)){ myError('Album Update Failed'); return 0; }else{ if($pAlbum['id']>0){ return $pAlbum['id']; }else{ return mysql_insert_id(); } } } /*====================================================================================================================================================================*/ /** * @return integer the id of the item being created/replaced * @param pGallery array a complete gallery post array * @desc Update/Create an item in the passed Album in the Database */ function replaceGalleryItem($pGallery){ global $ppbDatabase; if($pGallery['pid'] > 0){ $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pGallery['id'].', '; $vSQL.= $pGallery['pid'].', '; $vSQL.= $pGallery['cid'].', '; $vSQL.= $pGallery['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pGallery['title']).'\','; $vSQL.= '\''.dbClean($pGallery['description']).'\','; $vSQL.= '\''.dbClean($pGallery['keywords']).'\','; $vSQL.= $pGallery['views'].', '; $vSQL.= '\''.$pGallery['image'].'\','; $vSQL.= '0,'; $vSQL.= '\''.$pGallery['origname'].'\', '; $vSQL.= '\''.$pGallery['sortkey'].'\', '; $vSQL.= '0 '; $vSQL.= ')'; if(!mysql_query($vSQL)){ myError('Gallery Item Update Failed'); return 0; }else{ if($pGallery['id']>0){ return $pGallery['id']; }else{ return mysql_insert_id(); } } }else{ myError('No Album specified'); return 0; } } /*====================================================================================================================================================================*/ /** * @return void * @param pGallery array a gallery item array (may be empty) * @param pAdmin boolean true to show admin controls * @desc Display the form for adding/modifying an album */ function formGalleryItem($pGallery, $pAdmin=false){ $vAlbum=getGalleryPost($pGallery['pid']); ?> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
'."\n"; return $vOutput; } /*====================================================================================================================================================================*/ /** * @return array Uploaded image details * @param pPath string the FULL path to the gallery upload dir * @param pPrefix string a prefix (if any) to prepend to image filenames * @desc Validate a gallery image upload */ function doGalleryImageUpload($pPath, $pPrefix=''){ $vResult = array(); if(($_FILES['filename']['error'] == 0) and ($_FILES['filename']['name'] <> '')){ $vResult['origname'] = $_FILES['filename']['name']; switch($_FILES['filename']['type']){ case 'image/jpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/gif' : $vResult['filename'] = uniqid($pPrefix.'-').'.gif'; $vResult['valid'] = true; break; case 'image/pjpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/png' : $vResult['filename'] = uniqid($pPrefix.'-').'.png'; $vResult['valid'] = true; break; default : $vResult['valid']=false; $vResult['errors'] = 'Only image files are permitted '."\n"; $vResult['errors'] = $_FILES['filename']['type'].' is not a valid type '."\n"; } }else{ $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; } if ($vResult['valid']) { if (!move_uploaded_file($_FILES['filename']['tmp_name'],$pPath.'/'.$vResult['filename'])) { $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; }else{ if (ImageMaxSize($pPath.'/'.$vResult['filename'],getSiteOption('image.max.width'), getSiteOption('image.max.height'),80)){//Shrink main image if necessary $vResult['messages'] = 'Image was resized to maximum 600×800 pixels'; } MakeThumbnail($pPath.'/'.$vResult['filename'], getSiteOption('image.thumb.width'), getSiteOption('image.thumb.height'), 60); } } return $vResult; } /*====================================================================================================================================================================*/ /** * @return integer the id of the album being created/replaced * @desc Update/Create an Album in the Database */ function replaceGalleryAlbum($pAlbum){ global $ppbDatabase; $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pAlbum['id'].', '; $vSQL.= $pAlbum['pid'].', '; $vSQL.= $pAlbum['cid'].', '; $vSQL.= $pAlbum['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pAlbum['title']).'\','; $vSQL.= '\''.dbClean($pAlbum['description']).'\','; $vSQL.= '\''.dbClean($pAlbum['keywords']).'\','; $vSQL.= $pAlbum['views'].', '; $vSQL.= '\''.$pAlbum['image'].'\','; $vSQL.= $pAlbum['closed'].', '; $vSQL.= '\''.$pAlbum['origname'].'\', '; $vSQL.= '\''.$pAlbum['sortkey'].'\', '; $vSQL.= '\''.$pAlbum['sorttype'].'\' '; $vSQL.= ')'; //print $vSQL; if(!mysql_query($vSQL)){ myError('Album Update Failed'); return 0; }else{ if($pAlbum['id']>0){ return $pAlbum['id']; }else{ return mysql_insert_id(); } } } /*====================================================================================================================================================================*/ /** * @return integer the id of the item being created/replaced * @param pGallery array a complete gallery post array * @desc Update/Create an item in the passed Album in the Database */ function replaceGalleryItem($pGallery){ global $ppbDatabase; if($pGallery['pid'] > 0){ $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pGallery['id'].', '; $vSQL.= $pGallery['pid'].', '; $vSQL.= $pGallery['cid'].', '; $vSQL.= $pGallery['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pGallery['title']).'\','; $vSQL.= '\''.dbClean($pGallery['description']).'\','; $vSQL.= '\''.dbClean($pGallery['keywords']).'\','; $vSQL.= $pGallery['views'].', '; $vSQL.= '\''.$pGallery['image'].'\','; $vSQL.= '0,'; $vSQL.= '\''.$pGallery['origname'].'\', '; $vSQL.= '\''.$pGallery['sortkey'].'\', '; $vSQL.= '0 '; $vSQL.= ')'; if(!mysql_query($vSQL)){ myError('Gallery Item Update Failed'); return 0; }else{ if($pGallery['id']>0){ return $pGallery['id']; }else{ return mysql_insert_id(); } } }else{ myError('No Album specified'); return 0; } } /*====================================================================================================================================================================*/ /** * @return void * @param pGallery array a gallery item array (may be empty) * @param pAdmin boolean true to show admin controls * @desc Display the form for adding/modifying an album */ function formGalleryItem($pGallery, $pAdmin=false){ $vAlbum=getGalleryPost($pGallery['pid']); ?> |
'."\n"; return $vOutput; } /*====================================================================================================================================================================*/ /** * @return array Uploaded image details * @param pPath string the FULL path to the gallery upload dir * @param pPrefix string a prefix (if any) to prepend to image filenames * @desc Validate a gallery image upload */ function doGalleryImageUpload($pPath, $pPrefix=''){ $vResult = array(); if(($_FILES['filename']['error'] == 0) and ($_FILES['filename']['name'] <> '')){ $vResult['origname'] = $_FILES['filename']['name']; switch($_FILES['filename']['type']){ case 'image/jpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/gif' : $vResult['filename'] = uniqid($pPrefix.'-').'.gif'; $vResult['valid'] = true; break; case 'image/pjpeg' : $vResult['filename'] = uniqid($pPrefix.'-').'.jpg'; $vResult['valid'] = true; break; case 'image/png' : $vResult['filename'] = uniqid($pPrefix.'-').'.png'; $vResult['valid'] = true; break; default : $vResult['valid']=false; $vResult['errors'] = 'Only image files are permitted '."\n"; $vResult['errors'] = $_FILES['filename']['type'].' is not a valid type '."\n"; } }else{ $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; } if ($vResult['valid']) { if (!move_uploaded_file($_FILES['filename']['tmp_name'],$pPath.'/'.$vResult['filename'])) { $vResult['valid'] = false; $vResult['filename'] = ''; $vResult['errors'] = 'File did not upload successfully'."\n"; }else{ if (ImageMaxSize($pPath.'/'.$vResult['filename'],getSiteOption('image.max.width'), getSiteOption('image.max.height'),80)){//Shrink main image if necessary $vResult['messages'] = 'Image was resized to maximum 600×800 pixels'; } MakeThumbnail($pPath.'/'.$vResult['filename'], getSiteOption('image.thumb.width'), getSiteOption('image.thumb.height'), 60); } } return $vResult; } /*====================================================================================================================================================================*/ /** * @return integer the id of the album being created/replaced * @desc Update/Create an Album in the Database */ function replaceGalleryAlbum($pAlbum){ global $ppbDatabase; $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pAlbum['id'].', '; $vSQL.= $pAlbum['pid'].', '; $vSQL.= $pAlbum['cid'].', '; $vSQL.= $pAlbum['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pAlbum['title']).'\','; $vSQL.= '\''.dbClean($pAlbum['description']).'\','; $vSQL.= '\''.dbClean($pAlbum['keywords']).'\','; $vSQL.= $pAlbum['views'].', '; $vSQL.= '\''.$pAlbum['image'].'\','; $vSQL.= $pAlbum['closed'].', '; $vSQL.= '\''.$pAlbum['origname'].'\', '; $vSQL.= '\''.$pAlbum['sortkey'].'\', '; $vSQL.= '\''.$pAlbum['sorttype'].'\' '; $vSQL.= ')'; //print $vSQL; if(!mysql_query($vSQL)){ myError('Album Update Failed'); return 0; }else{ if($pAlbum['id']>0){ return $pAlbum['id']; }else{ return mysql_insert_id(); } } } /*====================================================================================================================================================================*/ /** * @return integer the id of the item being created/replaced * @param pGallery array a complete gallery post array * @desc Update/Create an item in the passed Album in the Database */ function replaceGalleryItem($pGallery){ global $ppbDatabase; if($pGallery['pid'] > 0){ $vSQL = 'REPLACE INTO '.$ppbDatabase['gallery'].' VALUES ('; $vSQL.= $pGallery['id'].', '; $vSQL.= $pGallery['pid'].', '; $vSQL.= $pGallery['cid'].', '; $vSQL.= $pGallery['uid'].', '; $vSQL.= 'CURRENT_TIMESTAMP,'; $vSQL.= '\''.dbClean($pGallery['title']).'\','; $vSQL.= '\''.dbClean($pGallery['description']).'\','; $vSQL.= '\''.dbClean($pGallery['keywords']).'\','; $vSQL.= $pGallery['views'].', '; $vSQL.= '\''.$pGallery['image'].'\','; $vSQL.= '0,'; $vSQL.= '\''.$pGallery['origname'].'\', '; $vSQL.= '\''.$pGallery['sortkey'].'\', '; $vSQL.= '0 '; $vSQL.= ')'; if(!mysql_query($vSQL)){ myError('Gallery Item Update Failed'); return 0; }else{ if($pGallery['id']>0){ return $pGallery['id']; }else{ return mysql_insert_id(); } } }else{ myError('No Album specified'); return 0; } } /*====================================================================================================================================================================*/ /** * @return void * @param pGallery array a gallery item array (may be empty) * @param pAdmin boolean true to show admin controls * @desc Display the form for adding/modifying an album */ function formGalleryItem($pGallery, $pAdmin=false){ $vAlbum=getGalleryPost($pGallery['pid']); ?> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
the administrators reserve the right to edit and/or delete content deemed inappropriate