session_start();
include('userloginchecker.php');
include_once("../classes/mySqlDB.class.php");
include_once("../classes/news.class.php");
include_once("../classes/image_resize.php");
include_once("../js/FCKeditor/fckeditor.php" );
include_once("../classes/commonDB.class.php");
include_once("../connect.php");
$newsObj = new news();
$comobj = new commonDB();
//$con = mysql_connect("10.0.0.6", "gleaner", "Kong2022#");
$re = $newsObj->getimgById($id);
$id = safe($_GET['id']);
$filePath = PROFILE_IMG_PATH_IMAGE;
$filePdf = PROFILE_IMG_PATH_PDF;
$fileAudio = PROFILE_IMG_PATH_AUDIO;
$btnTxt = (empty($id))? "Add" : "Save";
$userid = $_SESSION['useradmin']['userid'];
$request = http_build_query($_POST);
//echo $request;
$sized = strlen($request);
//echo "the size ".$sized;
if(!isset($industy_id))
{
$industrylist = $comobj->getHtmlListControlData( "industry", "name", "indus_id", "name", "ASC" ); // Get list from database to popul select option
}
if($_POST['user_add_post'])
{
/*
$rs = $_POST;
$title = trim($_POST['title']);
$intro_text = trim($_POST['intro_text']);
$detail = trim($_POST['detail']);
$industry = trim($_POST['industy_id']);
$cap1 = trim($_POST['image_caption1']);
$cap2 = trim($_POST['image_caption2']);
$cap3 = trim($_POST['image_caption3']);
$rel_date = $_POST['example1']; // realease date
$_POST['pressimage1'] = $profileImage;
$_POST['pressimage2'] = $_FILES['press_image2']['name'];
$_POST['pressimage3'] = $_FILES['press_image3']['name'];
$_POST['userid'] = $userid;
*/
if($_FILES)
{
$filepath = $_FILES['press_image1']['tmp_name'];
$filepath2 = $_FILES['press_image2']['tmp_name'];
$filepath3 = $_FILES['press_image3']['tmp_name'];
$filepath4 = $_FILES['audiofile']['tmp_name'];
$filepath5 = $_FILES['pdffile']['tmp_name'];
//===============================================================================
$filename = $_FILES['press_image1']['name'];
$filename2 = $_FILES['press_image2']['name'];
$filename3 = $_FILES['press_image3']['name'];
$filename4 = $_FILES['audiofile']['name'];
$filename5 = $_FILES['pdffile']['name'];
//global $profileImage4;
$profileImage = $comobj->uploadFile( $filename, $filepath, $filePath, array('jpeg', 'jpg', 'gif') );
$profileImage2 = $comobj->uploadFile( $filename2, $filepath2, $filePath, array('jpeg', 'jpg', 'gif') );
$profileImage3 = $comobj->uploadFile( $filename3, $filepath3, $filePath, array('jpeg', 'jpg', 'gif') );
$profileImage4 = $comobj->uploadFile( $filename4, $filepath4, $fileAudio, array('wma', 'mp3') ); // AUDIO FILE
$profileImage5 = $comobj->uploadFile( $filename5, $filepath5, $filePdf , array('pdf') ); // PDF FILE
if(!empty($profileImage))
{
$img['image'] = $profileImage;
@$tn1 = new thumbNail( $img, $filePath, $filePath, 500 );
@$tn2 = new thumbNail( $img, $filePath, $filePath, 250 );
@unlink($filePath.$profileImage);
}
if(!empty($profileImage2))
{
$img['image'] = $profileImage2;
@$tn1 = new thumbNail( $img, $filePath, $filePath, 500 );
@$tn2 = new thumbNail( $img, $filePath, $filePath, 250 );
@unlink($filePath.$profileImage2);
}
if(!empty($profileImage3))
{
$img['image'] = $profileImage3;
@$tn1 = new thumbNail( $img, $filePath, $filePath, 500 );
@$tn2 = new thumbNail( $img, $filePath, $filePath, 250 );
@unlink($filePath.$profileImage3);
}
//$_POST['news_image'] = $profileImage;
}
$error = "";
/*
if(empty($title))
{
$error .= "Title is required.
";
unset($_POST);
}
if(empty($intro_text))
{
$error .= "Intro text is required.
";
unset($_POST);
}
if(empty($detail))
{
$error .= "Press Release detail is required.
";
unset($_POST);
}
*/
/*if(empty($_POST['news_image']))
{
$error .= "News image is required.
";
unset($_POST);
}*/
echo "