Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/mm/ada/icdp/
Upload File :
Current File : /var/www/html/mmishra/mm/ada/icdp/webpages.php.bak

<?php
checkadmin($role);
?>
Edit content of webpages here. Familiarity with HTML tags is must to work at this advance level of content administration. Admin/user pages will be accessible after proper authentication. <br><br>
<?php
$rowid = $_REQUEST['rowid'];
$hypertext = $_POST['hypertext'];
$parentid = $_REQUEST['parentid'];
if (!$parentid) $parentid = 0; //top level link
$pagetitle = $_POST['pagetitle'];
$pageaccess = $_POST['pageaccess'];
$pagetype = $_POST['pagetype'];
if (!$pagetype) $pagetype = 'html'; //static webpage
$pagecontent = $_POST['pagecontent'];
if ($pagecontent) $pagecontent = str_replace("\"", "'", $pagecontent);
$keywords = $_POST['keywords'];
$dateexpiry = $_POST['dateexpiry'];
if (!$dateexpiry || $dateexpiry == '0000-00-00 00:00:00') $dateexpiry = date('Y-m-d');
$status = $_POST['status'];
$submit = $_POST['submit'];

$tbl = 'webpages';

$contentcategories = array(0 => 'Homepage',99995=>'Format',99996=>'Tender',99997 =>'Profile',99998=>'Advertisement',99999=>'Announcement');
$pagetypes = array('html','php','url','file');
$pageaccesses = array('public','user','admin');
$statuss = array('online','offline');

switch ($submit) {
case "SAVE":
        if (mysql_num_rows(mysql_query("select * from $tbl where rowid=$rowid"))) {
                mysql_query("update $tbl set hypertext='$hypertext',parentid=$parentid,
		pagetitle='$pagetitle',pagetype='$pagetype',pageaccess='$pageaccess',pagecontent='$pagecontent',
		keywords='$keywords',status='$status',dateupdation=now(),dateexpiry='$dateexpiry',dateaccess=now() 
		where rowid=$rowid");
        } else {
                mysql_query("insert into $tbl
		(webid,hypertext,parentid,pagetitle,pagetype,pageaccess,pagecontent,keywords,datecreation,dateupdation,dateexpiry,dateaccess,status) 
		values('$webid','$hypertext',$parentid,'$pagetitle','$pagetype','$pageaccess','$pagecontent','$keywords',now(),now(),'$dateexpiry',now(),'$status')");
        }
        break;

case "DELETE":
        mysql_query("delete from $tbl where rowid=$rowid");
	$hypertext = ''; $parentid = 0; $pagetitle = ''; $pagetype = 'html'; 
	$pageaccess = 'public'; $pagecontent = ''; $keywords = ''; 
	$rowid = 0;
        break;
}
if ($rowid > 0 && !$parentid) {
	$rs = mysql_query("select * from $tbl where rowid=$rowid");
	if ($rs) {
		$o = mysql_fetch_object($rs);
        	$parentid = $o->parentid;
	}
}
//get the rowid of page under updation

echo "<table><tr>
<td>Under<br><select name='parentid' style='width: 200px' onchange=\"document.location.href='$PHP_SELF?conf=$conf&parentid='+this.value\">";
foreach ($contentcategories as $key => $cc) {
        echo "<option value='$key'";
        if ($parentid == $key) echo ' selected';
        echo ">$cc</option>";
}
echo "<option=''></option>";
$rs = mysql_query("select rowid,hypertext from $tbl where webid='$webid' and pagecontent='' and status='online' order by parentid,hypertext");
while ($o = mysql_fetch_object($rs)) {
        echo "<option value='$o->rowid'";
        if ($parentid == $o->rowid) echo " selected";
        echo ">$o->hypertext</option>";
}
echo "</select></td>
<td>Web Link<br>
<select name='rowid' style='width: 200px' onchange=\"document.location.href='$PHP_SELF?conf=$conf&parentid=$parentid&rowid='+this.value\">
<option value='0'>New page</option>";

$rs = mysql_query("select * from $tbl where webid='$webid' and parentid=$parentid order by rowid");
while ($o = mysql_fetch_object($rs)) {
        echo "<option value='$o->rowid'";
	if ($o->rowid == $rowid) {
		echo " selected";
		$hypertext = $o->hypertext;
		$parentid = $o->parentid;
		$pagetitle = $o->pagetitle;
        	$pagetype = $o->pagetype;
        	$pageaccess = $o->pageaccess;
                $pagecontent = $o->pagecontent;
                $keywords = $o->keywords;
                $status = $o->status;
                $dateexpiry = $o->dateexpiry;
        }
	$star = '';
	if ($o->pagetype == 'html' && !$o->pagecontent) $star = '*';
	if ($o->pageaccess == 'admin') $star = '(admin)';
        echo ">$o->hypertext $star</option>";
}
echo "</select></td>
<td>Access Scope<br> <select name='pageaccess' style='width: 100px'>";
foreach ($pageaccesses as $pa) {
        echo "<option value='$pa'";
        if ($pageaccess == $pa) echo ' selected';
        echo ">$pa</option>";
}
echo "</select></td>
<td>Content Type<br> <select name='pagetype' style='width: 100px'>";
foreach ($pagetypes as $pt) {
        echo "<option value='$pt'";
        if ($pagetype == $pt) echo ' selected';
        echo ">" . strtoupper($pt) . "</option>";
}
echo "</select></td>
<td>Expiry Date<br>";
//datepicker class
require_once('classes/tc_calendar.php');

$yr = date("Y",strtotime($dateexpiry));
$mth = date("m",strtotime($dateexpiry));
$dt = date("d",strtotime($dateexpiry));

//instantiate class and set properties
$myCalendar = new tc_calendar("dateexpiry", true, false);
$myCalendar->setIcon("images/calendar.gif");
$myCalendar->setDate($dt, $mth, $yr);
$myCalendar->setPath("classes/");
$myCalendar->setYearInterval(2010, 2025);
$myCalendar->dateAllow('2010-01-01', '2025-12-31');
$myCalendar->setDateFormat('j F Y');
//output the calendar
$myCalendar->writeScript();

echo "</td></tr>
</table><table>
<tr><td>Link Text</td><td><input type='text' name='hypertext' size='60' value='$hypertext'>
Text to appear as link under menu</td></tr>

<tr><td>Page Title</td><td><input type='text' name='pagetitle' size='60' value='$pagetitle'>
Appears at top of page, may be same as hypertext</td></tr>

<tr valign='top'><td>Content</td><td>";

if ($pagetype == 'html') 
	echo "<textarea id='content' name='pagecontent' style='width: 100%'>$pagecontent</textarea>";
else
	echo "<input type='text' id='content' name='pagecontent' size='60' value='$pagecontent)'>";

echo "</td></tr>

<tr><td>Keywords</td><td><input type='text' name='keywords' size='60' value='$keywords'>
Used for indexing content for better search</td></tr>

<tr><td>Status</td><td><select name='status' style='width: 200px'>";
foreach ($statuss as $st) {
        echo "<option value='$st'";
        if ($status == $st) echo ' selected';
        echo ">$st</option>";
}
echo "</select> Offline pages will not be visible to users</td></tr>
<tr><td></td><td><input type='submit' name='submit' value='SAVE' style='width: 80px'> ";
if ($rowid) echo "<input type='submit' name='submit' value='DELETE' style='width: 80px'>";
echo "</td></tr></table>";

?>
These pages are stored in the database and is accessible through click of some menu link.
To be used in identification and filtering of obsolete content by delivery platform.