<?php
include('header.php');
echo $h;

$action = $_GET['action'];
if(!isset($action)) $action = "add";

IF ($action=="add"){
?>
<form name="vbform" method="post" action="blocks_cp.php?action=insert">

<table class='xtable' width='100%' id='AutoNumber15'>
    <tr>
      <td width="100%" colspan="2" class='xtx' align="center"><?php echo $LANGAUGE_CP[132]; ?></td>
    </tr>

    <tr>
      <td width="100%" colspan="2" class='xtr' align="center"><a href="blocks_cp.php?action=code"><?php echo $LANGAUGE_CP[685]; ?></a></td>
    </tr>

    <tr>
      <td width="25%" class='xtr'><?php echo $LANGAUGE_CP[133]; ?></td>
      <td width="75%" class='xtd'><input size="70" name="title" /></td>
    </tr>

    <tr>
      <td width="25%" class='xtr'><?php echo $LANGAUGE_CP[134]; ?></td>
      <td width="75%" class='xtd'>
<select size="1" name="rightorleft">
<OPTION value='1' selected="selected"><?php echo $LANGAUGE_CP[135]; ?></OPTION>
<OPTION value='0'><?php echo $LANGAUGE_CP[136]; ?></OPTION>
<OPTION value='2'><?php echo $LANGAUGE_CP[137]; ?></OPTION>
</select>
      </td>
    </tr>
    <tr>
      <td width="25%" class='xtr'><?php echo $LANGAUGE_CP[138]; ?></td>
      <td width="75%" class='xtd'>
<select size="1" name="active">
<OPTION value='1' selected="selected"><?php echo $LANGAUGE_CP[139]; ?></OPTION>
<OPTION value='0'><?php echo $LANGAUGE_CP[140]; ?></OPTION>
</select>
      </td>
      </tr>

      <tr>
      <td width="25%" class='xtr'><?php echo $LANGAUGE_CP[141]; ?></td>
      <td width="75%" class='xtd'>
<select size="1" name="textbox">
  <option value="1" selected="selected"><?php echo $LANGAUGE_CP[142]; ?></option>
  <option value="0"><?php echo $LANGAUGE_CP[143]; ?></option>
</select>
</td>
    </tr>

    <tr>
      <td width="25%" class='xtr'><?php echo $LANGAUGE_CP[144]; ?></td>
      <td width="75%" class='xtd'><input size="10" name="orderblock" /></td>
    </tr>

    <tr>
      <td width="25%" class='xtr'><?php echo $LANGAUGE_CP[145]; ?></td>
      <td width="75%" class='xtd'>
<select size="1" name="codeblock">
<option value='' selected="selected">- - -</option>
<option value='{poll}'><?php echo $LANGAUGE_CP[640]; ?></option>
<!-- <option value='{search}'><?php echo $LANGAUGE_CP[641]; ?></option> -->
<option value='{stats}'><?php echo $LANGAUGE_CP[642]; ?></option>
<option value='{menu}'><?php echo $LANGAUGE_CP[643]; ?></option>
<option value='{list}'><?php echo $LANGAUGE_CP[644]; ?></option>
<option value='{catnews}'><?php echo $LANGAUGE_CP[645]; ?></option>
<option value='{catquran}'><?php echo $LANGAUGE_CP[646]; ?></option>
<option value='{catsound}'><?php echo $LANGAUGE_CP[647]; ?></option>
<option value='{videocats}'><?php echo $LANGAUGE_CP[648]; ?></option>
<option value='{catanashed}'><?php echo $LANGAUGE_CP[649]; ?></option>
<option value='{catftawa}'><?php echo $LANGAUGE_CP[650]; ?></option>
<option value='{catbook}'><?php echo $LANGAUGE_CP[651]; ?></option>
<option value='{catflash}'><?php echo $LANGAUGE_CP[652]; ?></option>
<option value='{catlinks}'><?php echo $LANGAUGE_CP[653]; ?></option>
<option value='{catimage}'><?php echo $LANGAUGE_CP[654]; ?></option>
<option value='{catstory}'><?php echo $LANGAUGE_CP[655]; ?></option>
<option value='{catdownload}'><?php echo $LANGAUGE_CP[656]; ?></option>
<option value='{youtubecats}'><?php echo $LANGAUGE_CP[657]; ?></option>
<option value='{textcats}'><?php echo $LANGAUGE_CP[658]; ?></option>
<option value='{lastnews}'><?php echo $LANGAUGE_CP[659]; ?></option>
<option value='{lastquran}'><?php echo $LANGAUGE_CP[660]; ?></option>
<option value='{lastsound}'><?php echo $LANGAUGE_CP[661]; ?></option>
<option value='{lastanasheed}'><?php echo $LANGAUGE_CP[662]; ?></option>
<option value='{lastfatawa}'><?php echo $LANGAUGE_CP[663]; ?></option>
<option value='{lastbook}'><?php echo $LANGAUGE_CP[664]; ?></option>
<option value='{lastlinks}'><?php echo $LANGAUGE_CP[665]; ?></option>
<option value='{lastflash}'><?php echo $LANGAUGE_CP[666]; ?></option>
<option value='{lastdownload}'><?php echo $LANGAUGE_CP[667]; ?></option>
<option value='{laststory}'><?php echo $LANGAUGE_CP[668]; ?></option>
<option value='{lastyoutube}'><?php echo $LANGAUGE_CP[669]; ?></option>
<option value='{lastvideo}'><?php echo $LANGAUGE_CP[670]; ?></option>
<option value='{lasttext}'><?php echo $LANGAUGE_CP[671]; ?></option>
<option value='{topnews}'><?php echo $LANGAUGE_CP[672]; ?></option>
<option value='{topquran}'><?php echo $LANGAUGE_CP[673]; ?></option>
<option value='{topsound}'><?php echo $LANGAUGE_CP[674]; ?></option>
<option value='{topanasheed}'><?php echo $LANGAUGE_CP[675]; ?></option>
<option value='{topfatawa}'><?php echo $LANGAUGE_CP[676]; ?></option>
<option value='{topbook}'><?php echo $LANGAUGE_CP[677]; ?></option>
<option value='{toplinks}'><?php echo $LANGAUGE_CP[678]; ?></option>
<option value='{topflash}'><?php echo $LANGAUGE_CP[679]; ?></option>
<option value='{topdownload}'><?php echo $LANGAUGE_CP[680]; ?></option>
<option value='{topstory}'><?php echo $LANGAUGE_CP[671]; ?></option>
<option value='{topyoutube}'><?php echo $LANGAUGE_CP[672]; ?></option>
<option value='{topvideo}'><?php echo $LANGAUGE_CP[673]; ?></option>
<option value='{toptext}'><?php echo $LANGAUGE_CP[674]; ?></option>
</select>
      </td>
      </tr>

<tr>
      <td width="100%" colspan="2" class='xtd' align="center">
<?php
if(intval($_GET['box'])==1){
$tbox = "textarea1";
$ebox = "<small><a href='blocks_cp.php?action=add'>".$LANGAUGE_CP[146]."</a></small>";
}else{
$tbox = "textarea";
$ebox = "<small><a href='blocks_cp.php?box=1'>".$LANGAUGE_CP[147]."</a></small>";
}
?>
<label for="textarea"><?php echo $LANGAUGE_CP[148]; ?></label> <?php echo $ebox; ?><br /><br />
<textarea id="<?php echo $tbox; ?>" name="text" rows="15" cols="120"></textarea></td>
</tr>

    </tr>
     <tr>
      <td width="100%" colspan="2" class='xtr' align="center">
      <input type="submit" value=" <?php echo $LANGAUGE_CP[18]; ?> " name="cmdAdd" /></td>
    </tr>
  </table>
</form>
<?php

$query = mysql_query("SELECT * FROM blocks order by id desc");
$xx = mysql_num_rows($query);
if($xx == 0){
echo "";
}else{

echo "<form name='xxx1' action='blocks_cp.php?action=opp' method='post'>
<table class='xtable' width='100%' id='Auto4Number15'>
    <tr>
<td width='100%' colspan='7' class='xtt' align='center'>".$LANGAUGE_CP[97]."</td>
</tr>
    <tr>
      <td width='50%' align='center' class='xtr'>".$LANGAUGE_CP[149]."</td>
      <td width='15%' align='center' class='xtr'>".$LANGAUGE_CP[150]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[151]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[152]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[28]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[26]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[27]."</td>
    </tr>";
while($cat = mysql_fetch_array($query))
{
$cat['title'] = stripslashes($cat['title']);
$cat['title'] = htmlspecialchars($cat['title']);

if($cat['active'] == 1){
$im = "images/on.gif";
$li = "blocks_cp.php?action=actx&id=$cat[id]&act=0";
$te = $LANGAUGE_CP[72];
}else{
$im = "images/off.gif";
$li = "blocks_cp.php?action=actx&id=$cat[id]&act=1";
$te = $LANGAUGE_CP[73];
}

if($cat['rightorleft'] == 1){
$ddd = $LANGAUGE_CP[135];
}elseif($cat['rightorleft'] == 0){
$ddd = $LANGAUGE_CP[136];
}elseif($cat['rightorleft'] == 2){
$ddd = $LANGAUGE_CP[137];
}

if($cat['codeblock'] == ""){
$ddx = "- - -";
}else{
$ddx = $cat['codeblock'];
}

echo "<input type='hidden' name='idx[]' value='".$cat['id']."' />
<tr>
      <td width='50%' class='xtd'>» ".$cat['title']."</td>
      <td width='15%' align='center' class='xtd'>".$ddx."</td>
      <td width='7%' align='center' class='xtd'>".$ddd."</td>
      <td width='7%' align='center' class='xtd'><input style='text-align:center;' size='2' name='order[]' value='".$cat['orderblock']."' /></td>
      <td width='7%' class='xtd' align='center'><a href='$li'><img border='0' src='$im' alt='$te ".$cat['title']."' /></a></td>
      <td width='7%' align='center' class='xtd'><a href='blocks_cp.php?action=edit&id=$cat[id]'><img border='0' src='images/edit.gif' alt='".$cat['title']."' /></a></td>
      <td width='7%' align='center' class='xtd'><a href='blocks_cp.php?action=delete&id=$cat[id]'><img border='0' src='images/delete.gif' alt='".$cat['title']."' /></a></td>
    </tr>";
}
echo "<tr>
<td colspan='7' align='center' class='xtr'><input class='buttonx' name='activ' type='submit' id='activ' value=' ".$LANGAUGE_CP[152]." ' />
</td>
</tr>
</table></form>";
}


}ELSEIF ($action=="actx"){
$id = intval($_GET['id']);
$act = intval($_GET['act']);
if ($act == 0){
$query =  mysql_query("UPDATE blocks SET active='$act' where id='$id'");
echo $LANGAUGE_CP[61];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=blocks_cp.php?action=add' />";


}ELSEif ($act == 1){
$query =  mysql_query("UPDATE blocks SET active='$act' where id='$id'");
echo $LANGAUGE_CP[62];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=blocks_cp.php?action=add' />";
}else{
echo $LANGAUGE_CP[63];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=blocks_cp.php?action=add' />";
}


}ELSEIF ($action=="insert"){

$title = addslashes($_POST['title']);
$title = trim($title);
$text  = addslashes($_POST['text']);
$text = trim($text);
$rightorleft = intval($_POST['rightorleft']);
$active = intval($_POST['active']);
$orderblock = intval($_POST['orderblock']);
$codeblock  = addslashes($_POST['codeblock']);
$textbox = addslashes($_POST['textbox']);

if (empty($title)){
echo $LANGAUGE_CP[153];
}else{
$query =  mysql_query ("INSERT INTO blocks (title,text,rightorleft,active,orderblock,codeblock,textbox) VALUES ('$title','$text','$rightorleft','$active','$orderblock','$codeblock','$textbox')") or die ("error");
print $LANGAUGE_CP[21];
echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL=blocks_cp.php?action=add' />";
}

}ELSEIF ($action=="opp"){
if(isset($_POST['activ'])){

$number = count($_POST['idx']);

for($i=0;$i<$number;$i++){
$id = $_POST['idx'][$i];
$orders = $_POST['order'][$i];
$sqld = mysql_query("UPDATE blocks SET orderblock='".$orders."' WHERE id=$id");
}
echo $LANGAUGE_CP[34];
echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL=blocks_cp.php' />";
}else{
echo $LANGAUGE_CP[63];
echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL=blocks_cp.php' />";
}

}ELSEIF ($action=="edit"){
$id = intval($_GET['id']);
$query = mysql_query("SELECT * FROM blocks where id='$id'");
$p_cats = mysql_fetch_array($query);

$p_cats['title'] = stripslashes($p_cats['title']);
$p_cats['title'] = htmlspecialchars($p_cats['title']);

$p_cats['text'] = stripslashes($p_cats['text']);
$p_cats['text'] = htmlspecialchars($p_cats['text']);

$p_cats['codeblock'] = stripslashes($p_cats['codeblock']);
$p_cats['codeblock'] = htmlspecialchars($p_cats['codeblock']);

if($p_cats['codeblock']=="{poll}"){
$selected_1 = "selected='selected'";
}elseif($p_cats['codeblock']=="{search}"){
$selected_2 = "selected='selected'";
}elseif($p_cats['codeblock']=="{stats}"){
$selected_3 = "selected='selected'";
}elseif($p_cats['codeblock']=="{menu}"){
$selected_4 = "selected='selected'";
}elseif($p_cats['codeblock']=="{catnews}"){
$selected_5 = "selected='selected'";
}elseif($p_cats['codeblock']=="{catquran}"){
$selected_6 = "selected='selected'";
}elseif($p_cats['codeblock']=="{catsound}"){
$selected_7 = "selected='selected'";
}elseif($p_cats['codeblock']=="{catanashed}"){
$selected_8 = "selected='selected'";
}elseif($p_cats['codeblock']=="{catftawa}"){
$selected_9 = "selected='selected'";
}elseif($p_cats['codeblock']=="{catbook}"){
$selected_10 = "selected='selected'";
}elseif($p_cats['codeblock']=="{catflash}"){
$selected_11 = "selected='selected'";
}elseif($p_cats['codeblock']=="{catlinks}"){
$selected_12 = "selected='selected'";
}elseif($p_cats['codeblock']=="{catimage}"){
$selected_13 = "selected='selected'";
}elseif($p_cats['codeblock']=="{catstory}"){
$selected_14 = "selected='selected'";
}elseif($p_cats['codeblock']=="{catdownload}"){
$selected_15 = "selected='selected'";
}elseif($p_cats['codeblock']=="{lastnews}"){
$selected_16 = "selected='selected'";
}elseif($p_cats['codeblock']=="{lastquran}"){
$selected_17 = "selected='selected'";
}elseif($p_cats['codeblock']=="{lastsound}"){
$selected_18 = "selected='selected'";
}elseif($p_cats['codeblock']=="{lastanasheed}"){
$selected_19 = "selected='selected'";
}elseif($p_cats['codeblock']=="{lastfatawa}"){
$selected_20 = "selected='selected'";
}elseif($p_cats['codeblock']=="{lastbook}"){
$selected_21 = "selected='selected'";
}elseif($p_cats['codeblock']=="{lastlinks}"){
$selected_22 = "selected='selected'";
}elseif($p_cats['codeblock']=="{lastflash}"){
$selected_23 = "selected='selected'";
}elseif($p_cats['codeblock']=="{lastdownload}"){
$selected_24 = "selected='selected'";
}elseif($p_cats['codeblock']=="{laststory}"){
$selected_25 = "selected='selected'";
}elseif($p_cats['codeblock']=="{topnews}"){
$selected_26 = "selected='selected'";
}elseif($p_cats['codeblock']=="{topquran}"){
$selected_27 = "selected='selected'";
}elseif($p_cats['codeblock']=="{topsound}"){
$selected_28 = "selected='selected'";
}elseif($p_cats['codeblock']=="{topanasheed}"){
$selected_29 = "selected='selected'";
}elseif($p_cats['codeblock']=="{topfatawa}"){
$selected_30 = "selected='selected'";
}elseif($p_cats['codeblock']=="{topbook}"){
$selected_31 = "selected='selected'";
}elseif($p_cats['codeblock']=="{toplinks}"){
$selected_32 = "selected='selected'";
}elseif($p_cats['codeblock']=="{topflash}"){
$selected_33 = "selected='selected'";
}elseif($p_cats['codeblock']=="{topdownload}"){
$selected_34 = "selected='selected'";
}elseif($p_cats['codeblock']=="{topstory}"){
$selected_35 = "selected='selected'";
}elseif($p_cats['codeblock']=="{youtubecats}"){
$selected_36 = "selected='selected'";
}elseif($p_cats['codeblock']=="{videocats}"){
$selected_37 = "selected='selected'";
}elseif($p_cats['codeblock']=="{textcats}"){
$selected_38 = "selected='selected'";
}elseif($p_cats['codeblock']=="{list}"){
$selected_39 = "selected='selected'";

}elseif($p_cats['codeblock']=="{lastyoutube}"){
$selected_40 = "selected='selected'";
}elseif($p_cats['codeblock']=="{lastvideo}"){
$selected_41 = "selected='selected'";
}elseif($p_cats['codeblock']=="{lasttext}"){
$selected_42 = "selected='selected'";
}elseif($p_cats['codeblock']=="{topyoutube}"){
$selected_43 = "selected='selected'";
}elseif($p_cats['codeblock']=="{topvideo}"){
$selected_44 = "selected='selected'";
}elseif($p_cats['codeblock']=="{toptext}"){
$selected_45 = "selected='selected'";
}

if(intval($_GET['box'])==1){
$tbox = "textarea1";
$ebox = "<small><a href='blocks_cp.php?action=edit&id=$id&box=0'>".$LANGAUGE_CP[146]."</a></small>";
}else{
$tbox = "textarea";
$ebox = "<small><a href='blocks_cp.php?action=edit&id=$id&box=1'>".$LANGAUGE_CP[147]."</a></small>";
}

echo "<form name='vbform' method='POST' action='blocks_cp.php?action=editok'>
<input type='hidden' name='id' value='$p_cats[id]' />

<table class='xtable' width='100%' id='AutoNumber15'>

<tr>
<td width='100%' colspan='2' class='xtx' align='center'>".$LANGAUGE_CP[32]."</td>
</tr>

<tr>
<td width='25%' class='xtr'>".$LANGAUGE_CP[133]."</td>
<td width='75%' class='xtd'><input name='title' size='70' value='".$p_cats['title']."' /></td>
</tr>

<tr>
<td width='25%' class='xtr'>".$LANGAUGE_CP[144]."</td>
<td width='75%' class='xtd'><input name='orderblock' size='10' value='$p_cats[orderblock]'></td>
</tr>

<tr>
<td width='25%' class='xtr'>".$LANGAUGE_CP[134]."</td>
<td width='75%' class='xtd'>";
if($p_cats['rightorleft'] == 1){
echo "<select size='1' name='rightorleft'>
<OPTION value='1' selected='selected'>".$LANGAUGE_CP[135]."</OPTION>
<OPTION value='0'>".$LANGAUGE_CP[136]."</OPTION>
<OPTION value='2'>".$LANGAUGE_CP[137]."</OPTION>
</select>";
}elseif($p_cats['rightorleft'] == 0){
echo "<select size='1' name='rightorleft'>
<OPTION value='0' selected='selected'>".$LANGAUGE_CP[136]."</OPTION>
<OPTION value='1'>".$LANGAUGE_CP[135]."</OPTION>
<OPTION value='2'>".$LANGAUGE_CP[137]."</OPTION>
</select>";
}elseif($p_cats['rightorleft'] == 2){
echo "<select size='1' name='rightorleft'>
<OPTION value='0'>".$LANGAUGE_CP[136]."</OPTION>
<OPTION value='1'>".$LANGAUGE_CP[135]."</OPTION>
<OPTION value='2' selected='selected'>".$LANGAUGE_CP[137]."</OPTION>
</select>";
}
echo "</td>
</tr>

<tr>
<td width='25%' class='xtr'>".$LANGAUGE_CP[138]."</td>
<td width='75%' class='xtd'>";
if($p_cats['active'] == 1){
echo "<select size='1' name='active'>
<OPTION value='1' selected='selected'>".$LANGAUGE_CP[139]."</OPTION>
<OPTION value='0'>".$LANGAUGE_CP[140]."</OPTION>
</select>";
}else{
echo "<select size='1' name='active'>
<OPTION value='0' selected='selected'>".$LANGAUGE_CP[140]."</OPTION>
<OPTION value='1'>".$LANGAUGE_CP[139]."</OPTION>
</select>";
}
echo "</td>
</tr>

<tr>
<td width='25%' class='xtr'>".$LANGAUGE_CP[141]."</td>
<td width='75%' class='xtd'><select size='1' name='textbox'>";

if($p_cats['textbox'] == 1){
echo "<option value='1' selected='selected'>".$LANGAUGE_CP[142]."</option>
  <option value='0'>".$LANGAUGE_CP[143]."</option>";
}else{
echo "<option value='1'>".$LANGAUGE_CP[142]."</option>
  <option value='0' selected='selected'>".$LANGAUGE_CP[143]."</option>";
}

echo "</select></td>
</tr>

<tr>
      <td width='25%' class='xtr'>".$LANGAUGE_CP[145]."</td>
      <td width='75%' class='xtd'>
<select size='1' name='codeblock'>
<option value=''>- - -</option>
<option value='{poll}' ".$selected_1.">".$LANGAUGE_CP[640]."</option>
<!-- <option value='{search}' ".$selected_2.">".$LANGAUGE_CP[641]."</option> -->
<option value='{stats}' ".$selected_3.">".$LANGAUGE_CP[642]."</option>
<option value='{menu}' ".$selected_4.">".$LANGAUGE_CP[643]."</option>
<option value='{list}' ".$selected_39.">".$LANGAUGE_CP[644]."</option>
<option value='{catnews}' ".$selected_5.">".$LANGAUGE_CP[645]."</option>
<option value='{catquran}' ".$selected_6.">".$LANGAUGE_CP[646]."</option>
<option value='{catsound}' ".$selected_7.">".$LANGAUGE_CP[647]."</option>
<option value='{videocats}' ".$selected_37.">".$LANGAUGE_CP[648]."</option>
<option value='{catanashed}' ".$selected_8.">".$LANGAUGE_CP[649]."</option>
<option value='{catftawa}' ".$selected_9.">".$LANGAUGE_CP[650]."</option>
<option value='{catbook}' ".$selected_10.">".$LANGAUGE_CP[651]."</option>
<option value='{catflash}' ".$selected_11.">".$LANGAUGE_CP[652]."</option>
<option value='{catlinks}' ".$selected_12.">".$LANGAUGE_CP[653]."</option>
<option value='{catimage}' ".$selected_13.">".$LANGAUGE_CP[654]."</option>
<option value='{catstory}' ".$selected_14.">".$LANGAUGE_CP[655]."</option>
<option value='{catdownload}' ".$selected_15.">".$LANGAUGE_CP[656]."</option>
<option value='{youtubecats}' ".$selected_36.">".$LANGAUGE_CP[657]."</option>
<option value='{textcats}' ".$selected_38.">".$LANGAUGE_CP[658]."</option>

<option value='{lastnews}' ".$selected_16.">".$LANGAUGE_CP[659]."</option>
<option value='{lastquran}' ".$selected_17.">".$LANGAUGE_CP[660]."</option>
<option value='{lastsound}' ".$selected_18.">".$LANGAUGE_CP[661]."</option>
<option value='{lastanasheed}' ".$selected_19.">".$LANGAUGE_CP[662]."</option>
<option value='{lastfatawa}' ".$selected_20.">".$LANGAUGE_CP[663]."</option>
<option value='{lastbook}' ".$selected_21.">".$LANGAUGE_CP[664]."</option>
<option value='{lastlinks}' ".$selected_22.">".$LANGAUGE_CP[665]."</option>
<option value='{lastflash}' ".$selected_23.">".$LANGAUGE_CP[666]."</option>
<option value='{lastdownload}' ".$selected_24.">".$LANGAUGE_CP[667]."</option>
<option value='{laststory}' ".$selected_25.">".$LANGAUGE_CP[668]."</option>
<option value='{lastyoutube}' ".$selected_40.">".$LANGAUGE_CP[669]."</option>
<option value='{lastvideo}' ".$selected_41.">".$LANGAUGE_CP[670]."</option>
<option value='{lasttext}' ".$selected_42.">".$LANGAUGE_CP[671]."</option>

<option value='{topnews}' ".$selected_26.">".$LANGAUGE_CP[672]."</option>
<option value='{topquran}' ".$selected_27.">".$LANGAUGE_CP[673]."</option>
<option value='{topsound}' ".$selected_28.">".$LANGAUGE_CP[674]."</option>
<option value='{topanasheed}' ".$selected_29.">".$LANGAUGE_CP[675]."</option>
<option value='{topfatawa}' ".$selected_30.">".$LANGAUGE_CP[676]."</option>
<option value='{topbook}' ".$selected_31.">".$LANGAUGE_CP[677]."</option>
<option value='{toplinks}' ".$selected_32.">".$LANGAUGE_CP[678]."</option>
<option value='{topflash}' ".$selected_33.">".$LANGAUGE_CP[679]."</option>
<option value='{topdownload}' ".$selected_34.">".$LANGAUGE_CP[680]."</option>
<option value='{topstory}' ".$selected_35.">".$LANGAUGE_CP[681]."</option>
<option value='{topyoutube}' ".$selected_43.">".$LANGAUGE_CP[682]."</option>
<option value='{topvideo}' ".$selected_44.">".$LANGAUGE_CP[683]."</option>
<option value='{toptext}' ".$selected_45.">".$LANGAUGE_CP[684]."</option>
</select>
      </td>
      </tr>

<tr>
<td width='100%' class='xtd' colspan='2' align='center'>
<label for='textarea'>".$LANGAUGE_CP[148]."</label> $ebox<br /><br />
<textarea id='$tbox' name='text' rows='15' cols='120'>".$p_cats['text']."</textarea></td>
</tr>

<tr>
<td width='100%' colspan='2' align='center' class='xtr'><input type='submit' value=' ".$LANGAUGE_CP[32]." ' name='B1' /> <input type='submit' value=' ".$LANGAUGE_CP[154]." ' name='re' /></td>
</tr>

</table>
</form>";

}ELSEIF ($action=="editok"){

$id    = intval($_POST['id']);
$title = addslashes($_POST['title']);
$title = trim($title);
$text  = addslashes($_POST['text']);
$text = trim($text);
$rightorleft = intval($_POST['rightorleft']);
$active = intval($_POST['active']);
$orderblock = intval($_POST['orderblock']);
$codeblock  = addslashes($_POST['codeblock']);
$textbox = addslashes($_POST['textbox']);

if (empty($title)){
echo $LANGAUGE_CP[153];
}else{
$query =  mysql_query("UPDATE blocks SET title='$title', text='$text', rightorleft='$rightorleft', active='$active', orderblock='$orderblock',codeblock='$codeblock',textbox='$textbox' where id='$id'");
echo $LANGAUGE_CP[34];
if(isset($_POST['re'])){
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=blocks_cp.php?action=edit&id=$id' />";
}else{
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=blocks_cp.php?action=add' />";
}
}
}ELSEIF ($action=="delete"){
$id = intval($_GET['id']);
$query =  mysql_query("DELETE FROM blocks WHERE id='$id'");
echo $LANGAUGE_CP[35];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=blocks_cp.php?action=add'>";
}ELSEIF ($action=="code"){
echo $LANGAUGE_CP['blockcode'];
}
echo $f;
?>