( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
require("./NewsSql.inc.php");
$db = new NewsSQL($dbname);
page_protect();
error_reporting(E_ALL ^ E_NOTICE);
$PicturePath = "../photo/";
if (empty($page)){
$page = 0;
}
$record = 20;
if ($Delheader==$admin_yes) {
$db->delheader($newsid,$PicturePath);
}
if (!empty($addheader)) {
$tempuserfile = $_FILES['userfile']['tmp_name'];
$tempuserfile_name = $_FILES['userfile']['name'];
if ((!empty($tempuserfile)) && (!empty($tempuserfile_name))) {
$pathinfo = pathinfo($tempuserfile_name, PATHINFO_EXTENSION);
if(!in_array(strtolower($pathinfo), array('jpg')))
{
header('Location: headerimage.php?msg=Invalid File Type!<br>') ;
}
$userfile = $tempuserfile;
$userfile_name = $tempuserfile_name;
}
$newsid = $db->addheader($catalogid,$video,$thumb,$isdisplay);
if ((!empty($userfile)) && (!empty($userfile_name))) {
$videouser = $_SESSION['euserid'];
$userfile_name = preg_replace('/[\ ]/', '-', $userfile_name);
$userfile_name = $videouser.$userfile_name;
$dest1 = $PicturePath.$userfile_name;
copy($userfile, $dest1);
/*
$starting_image = imagecreatefromjpeg("$PicturePath$userfile_name");
$width = imagesx($starting_image);
$height = imagesy($starting_image);
$thumb_width = 860;
$thumb_height =300;
$thumb_image = imagecreatetruecolor($thumb_width, $thumb_height);
imagecopyresampled($thumb_image, $starting_image, 0, 0, 0, 0, $thumb_width, $thumb_height, $width, $height);
imagejpeg($thumb_image, "$PicturePath$userfile_name");*/
$db->add_headerPicture($newsid,$userfile_name,$PicturePath);
}
}
if (!empty($editheader)) {
$tempuserfile = $_FILES['userfile']['tmp_name'];
$tempuserfile_name = $_FILES['userfile']['name'];
if ((!empty($tempuserfile)) && (!empty($tempuserfile_name))) {
$pathinfo = pathinfo($tempuserfile_name, PATHINFO_EXTENSION);
if(!in_array(strtolower($pathinfo), array('jpg')))
{
header('Location: headerimage.php?msg=Invalid File Type!<br>') ;
}
$userfile = $tempuserfile;
$userfile_name = $tempuserfile_name;
}
if ((!empty($userfile)) && (!empty($userfile_name))) {
$videouser = $_SESSION['euserid'];
$userfile_name = preg_replace('/[\ ]/', '-', $userfile_name);
$userfile_name = $videouser.$userfile_name;
$dest1 = $PicturePath.$userfile_name;
copy($userfile, $dest1);
/*
$starting_image = imagecreatefromjpeg("$PicturePath$userfile_name");
$width = imagesx($starting_image);
$height = imagesy($starting_image);
$thumb_width = 420;
$thumb_height = 265;
$thumb_image = imagecreatetruecolor($thumb_width, $thumb_height);
imagecopyresampled($thumb_image, $starting_image, 0, 0, 0, 0, $thumb_width, $thumb_height, $width, $height);
imagejpeg($thumb_image, "$PicturePath$userfile_name");
*/
$db->add_headerPicture($newsid,$userfile_name,$PicturePath);
}
$db->editheader($catalogid,$title,$description,$isdisplay,$newsid);
}
if (!empty($DP1)) {
$db->del_headerPicture($newsid,$PicturePath);
}
$result = $db->getallheader($page,$record);
?>
<html>
<head>
<title><?php print "$admin_newsadmin"; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php print "$admin_charset"; ?>">
<link href="styles.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {font-size: 11px}
.style3 {font-size: 11px; font-weight: bold; }
-->
</style>
</head>
<body>
<?php
include 'header.php';
?>
<table width="1000" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="300" valign="top"><?php
include 'navigation.php';
?>
<p> </p>
<p> </p>
<p> </p>
<p> </p></td>
<td width="700" valign="top"> <div class="graycellv3" style="width:800px;"> <br><span id="buttoned2" style="margin-top:10px">Splash Image </span><br>
<br>
<br>
<?php
if (!empty($result)) {
foreach ($result as $key => $val) {
$newsid = stripslashes($val["newsid"]);
$catalogid = stripslashes($val["catalogid"]);
$title = stripslashes($val["title"]);
$picture = stripslashes($val["picture"]);
$description = stripslashes($val["description"]);
$cataname = $db->getslidenamebyid($catalogid);
?>
<table width="700" border="0" cellspacing="1" cellpadding="2">
<tr>
<td width="108"><span class="style1"><strong>Header Picture</strong></span></td>
<td width="101"><span class="style1"><strong>URL </strong></span></td>
<td width="81"><span class="style1"><strong>Alt Text</strong></span></td>
<td width="173"><span class="style3">Template</span></td>
<td colspan="2"><span class="style1"><strong>Modify</strong></span></td>
</tr>
<tr>
<td><span class="style1"><img src="<?php print "$PicturePath$picture"; ?>" width="89" height="39" hspace="5"></span></td>
<td><span class="style1"><?php print "$description"; ?></span></td>
<td><span class="style1"><?php print "$title"; ?></span></td>
<td><span class="style1"><?php print "$newsid"; ?></span></td>
<td width="65"><a href="editheader.php?newsid=<?php print "$newsid"; ?>" class="en_b style1"><?php print "$admin_edit"; ?></a></td>
<td width="41"><a href="delheader.php?newsid=<?php print "$newsid"; ?>" class="en_b style1"><?php print "$admin_del"; ?></a></td>
</tr>
</table>
<?php
}
}
?>
<p align="right"> </p>
<br>
<br>
<br>
<?php
$result = $db->getheadercount($page,$record);
if (!empty($result)) {
foreach ($result as $key => $val) {
$mycount = stripslashes($val["mycount"]);
if ($mycount < 1) {?>
<form action="<?php print "$PHP_SELF"; ?>" method="POST" ENCTYPE="multipart/form-data">
<table width="700" border="0" cellspacing="1" cellpadding="4">
<tr>
<td width="130"><span class="style1 style1 style1"> Splash Image </span></td>
<td width="643"><input name="userfile" type="file" class="style1 style1" size="50"></td>
</tr>
<tr>
<td class="style1">URL (link)</td>
<td class="style1"><input name="title" type="text" value="" size="60"></td>
</tr>
<tr>
<td class="style1">Alternative Text :</td>
<td class="style1"><input name="description" type="text" value="" size="60"></td>
</tr>
<tr>
<td class="style1"><span class="style6 style6"><?php print "Display?"; ?> :</span></td>
<td class="style1"><span class="style6 style6">
<select name="isdisplay">
<option selected value="1"><?php print "$admin_yes"; ?></option>
<option value="0"><?php print "$admin_no"; ?></option>
</select>
</span> </td>
</tr>
<tr>
<td> </td>
<td>
<input name="catalogid" type="hidden" class="style1 style1" value="<? echo $_SESSION['euserid'];?>"> </td>
</tr>
<tr>
<td> </td>
<td><input name="addheader" type="submit" class="style1 style1" value="Add Splash Image"></td>
</tr>
</table>
</p>
</form>
<? } ?>
<?php
}
}
?>
</div>
</td>
<td width="114" valign="top"> </td>
</tr>
<tr></tr>
</table>
</body>
</html>