". $check_res[CHECK_ACTION_MESSAGE] ."
\n"; $_page['name_index'] = 0; $_page_cont[0]['page_main_code'] = $ret; PageCode(); exit(); } $iPhotoCount = (int)db_value("SELECT COUNT(*) FROM `sharePhotoFiles` WHERE `medProfId`='{$member['ID']}'"); if ($iPhotoCount < (int)getParam("shPhotoLimit")) { $sStatus = ''; if (isset($_POST['upload']) && isset($_POST['medProfId'])) { $sStatus = '
'._t("_File was uploaded").'
'; $iUser = (int)$_POST['medProfId']; $sFile = htmlspecialchars_adv($_POST['title']); $sDesc = isset($_POST['description']) && strlen($_POST['description']) ? process_db_input(htmlspecialchars_adv($_POST['description'])) : ''; $sTags = isset($_POST['tags']) && strlen($_POST['tags']) ? process_db_input(htmlspecialchars_adv($_POST['tags'])) : ''; $sStatus = uploadFile($sFile, $sDesc, $sTags, $iUser); } } else { $sCode = MsgBox( _t( '_Photo gallery limit was reached' ) ); $_page['name_index'] = 0; $_page_cont[0]['page_main_code'] = $sCode; PageCode(); exit(); } $_page_cont[$_ni]['page_main_code'] = $sStatus.PageMainCode($site['url'], $member['ID']); PageCode(); function PageMainCode($sSiteUrl, $iUser = 0) { if ($iUser == 0) return ''; ob_start(); ?>
" onclick="document.getElementById('uploadShareMain').style.display = 'block'; document.getElementById('agreement').style.display = 'none';"">
'._t("_File upload error").''; else { $aFileInfo = getimagesize( $_FILES['uploadFile']['tmp_name'] ); if (!$aFileInfo) $sCode = '
'._t("_You uploaded not image file").'
'; else { $ext = false; switch( $aFileInfo['mime'] ) { case 'image/jpeg': $ext = 'jpg'; break; case 'image/gif': $ext = 'gif'; break; case 'image/png': $ext = 'png'; break; default: $ext = false; } if (!$ext) $sCode = '
'._t("_You uploaded not JPEG, GIF or PNG file").'
'; else { $sCode = '
'._t("_Upload successful").'
'; $sActive = getParam("enable_shPhotoActivation") == 'on' ? 'true' : 'false' ; $sPhotoUri = uriGenerate($sFile, 'sharePhotoFiles', 'medUri'); $sQuery = "INSERT INTO `sharePhotoFiles` (`medProfId`,`medTitle`,`medUri`,`medExt`,`medDesc`,`medTags`,`medDate`,`Approved`) VALUES('$iUser','$sFile','$sPhotoUri','$ext','$sDesc','$sTags',".time().",'$sActive')"; db_res($sQuery); $iNew = mysql_insert_id(); reparseObjTags( 'photo', $iNew ); $sNewFileName = $dir['sharingImages'] . $iNew.'.'.$ext; $sNewMainName = $dir['sharingImages'] . $iNew.'_m.'.$ext; $sNewThumbName = $dir['sharingImages'] . $iNew.'_t.'.$ext; $iUpload = (int)preg_replace('/\D/', '', ini_get('upload_max_filesize')); $iPost = (int)preg_replace('/\D/', '', ini_get('post_max_size')); $iMin = $iUpload > $iPost ? $iPost : $iUpload; if ($_FILES['uploadFile']['size'] && $_FILES['uploadFile']['size'] > $iMin*1024*1024) $sCode = '
'._t("_SIZE_TOO_BIG").'
'; else { if (!move_uploaded_file( $_FILES['uploadFile']['tmp_name'], $sNewFileName)) $sCode = '
'._t("_Couldn\'t move file").'
'; else { chmod( $sNewFileName, 0644 ); $iWidth = (int)getParam("max_photo_width"); $iHeight = (int)getParam("max_photo_height"); $iThumbW = (int)getParam("max_thumb_width"); $iThumbH = (int)getParam("max_thumb_height"); if (imageResize( $sNewFileName, $sNewMainName, $iWidth, $iHeight ) != IMAGE_ERROR_SUCCESS) $sCode = '
'._t("_Upload failed").'
'; else { imageResize( $sNewMainName, $sNewThumbName, $iThumbW, $iThumbH ); $bPermalink = getParam('permalinks_gallery_photos') == 'on' ? true : false; $sFileLink = getFileUrl($iNew, rawurlencode($sPhotoUri), 'photo', $bPermalink); header("Location:".$sFileLink); exit; } } } $sqlDelete = "DELETE FROM `sharePhotoFiles` WHERE `medID`='$iNew'"; db_res($sqlDelete); } } } return $sCode; } ?>