<?
//v1.8 www.exoops.info 2006/03
// 
// ------------------------------------------------------------------------- //
//               E-Xoops: Content Management for the Masses                  //
//                       < http://www.e-xoops.com >                          //
// ------------------------------------------------------------------------- //
// Original Author: Pascal Le Boustouller
// Author Website : http://www.perso-search.com/e-xoopsien/
// Licence Type   : GPL
// ------------------------------------------------------------------------- //
include("admin_header.php");
include(XOOPS_ROOT_PATH."/modules/MyAnnonces/cache/config.php");
include_once(XOOPS_ROOT_PATH."/class/xoopsform/formdhtmltextarea.php");
function Conf() {
global $xoopsUser, $bcoosConfig, $xoopsModule, $myts;
global $annoadd, $justuser, $nb_affichage, $monnaie, $newclassifieds, $moderated, $photomax, $claday, $affichebloc, $countday, $ynprice, $souscat, $classm, $nbsouscat, $newann, $affichnbann;
xoops_cp_header();
    OpenTable();
	
	
	            
echo "<b>"._CLA_CONFMYA."</b><br><br>";
echo "<FORM ACTION=\"pref.php?pa=ConfOk\" METHOD=POST>";
echo "<table width = \"100%\" BORDER=0 CELLPADDING=3 CELLSPACING=1 class=bg2><tr class=bg1>
<td width = \"250\">"._CLA_ANNOCANPOST." </td>
<td><input type=\"radio\" class=\"radio\" name=\"annoaddS\" value=\"1\""; if ($annoadd == "1") echo "checked"; 
echo ">"._YES."&nbsp;&nbsp; <input type=\"radio\" class=\"radio\" name=\"annoaddS\" value=\"0\""; if ($annoadd == "0") echo "checked"; echo ">"._NO."</td>
</tr><tr class=bg1>
<td>"._CLA_PERPAGE." </td>
<td><select name=nb_affichageS class=\"select\">
<option value=$nb_affichage selected>$nb_affichage</option>
<option value=10>10</option>
<option value=15>15</option>
<option value=20>20</option>
<option value=25>25</option>
<option value=30>30</option>
<option value=50>50</option>
</select></td>
</tr><tr class=bg1>
<td>"._CLA_MONEY." </td>
<td><input type=\"text\" class=\"text\" name=\"monnaieS\" value=\"$monnaie\" size=\"3\" maxlength=\"2\"></td>
</tr><tr class=bg1>
<td>"._CLA_VIEWNEWCLASS." </td>
<td><input type=\"radio\" class=\"radio\" name=\"newannS\" value=\"1\""; if ($newann == "1") echo "checked"; 
echo ">"._YES."&nbsp;&nbsp; <input type=\"radio\" class=\"radio\" name=\"newannS\" value=\"0\""; if ($newann == "0") echo "checked"; echo ">"._NO." ("._CLA_ONHOME.")</td>
</tr><tr class=bg1>
<td>"._CLA_NUMNEW." </td>
<td><select name=newclassifiedsS class=\"select\">
<option value=$newclassifieds>$newclassifieds</option>
<option value=5>5</option>
<option value=10>10</option>
<option value=15>15</option>
<option value=20>20</option>
<option value=25>25</option>
<option value=30>30</option>
<option value=50>50</option>
</select> ("._CLA_ONHOME.")</td>
</tr><tr class=bg1>
<td>"._CLA_MODERAT." </td>
<td><input type=\"radio\" class=\"radio\" name=\"moderatedS\" value=\"1\""; if ($moderated == "1") echo "checked"; 
echo ">"._YES."&nbsp;&nbsp; <input type=\"radio\" class=\"radio\" name=\"moderatedS\" value=\"0\""; if ($moderated == "0") echo "checked"; echo ">"._NO."</td>
</tr><tr class=bg1>
<td>"._CAL_MAXIIMGS." </td>
<td><input type=\"text\" class=\"text\" name=\"photomaxS\" value=\"$photomax\" size=\"10\"> ("._CLA_INOCTET.")</td>
</tr><tr class=bg1>
<td>"._CLA_TIMEANN." </td>
<td><input type=\"text\" class=\"text\" name=\"cladayS\" value=\"$claday\" size=\"4\" maxlength=\"4\"> ("._CLA_INDAYS.")</td>
</tr><tr class=bg1>
<td>"._CLA_TYPEBLOC." </td>
<td><SELECT NAME=\"afficheblocS\" class=\"select\">
	<OPTION VALUE=\"1\""; if ($affichebloc == "1") echo " selected";
	echo "> "._CLA_LASTTEN."
	<OPTION VALUE=\"2\""; if ($affichebloc == "2") echo " selected";
	echo "> "._CLA_ANNRAND."
</SELECT></td>
</tr><tr class=bg1>
<td>"._CLA_NEWTIME." </td>
<td><select name=countdayS class=\"select\">
<option value=$countday>$countday</option>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8>8</option>
<option value=9>9</option>
<option value=10>10</option>
</select> ("._CLA_INDAYS.")</td>
</tr><tr class=bg1>
<td>"._CLA_DISPLPRICE." </td>
<td><input type=\"radio\" class=\"radio\" name=\"ynpriceS\" value=\"1\""; if ($ynprice == "1") echo "checked"; 
echo ">"._YES."&nbsp;&nbsp; <input type=\"radio\" class=\"radio\" name=\"ynpriceS\" value=\"0\""; if ($ynprice == "0") echo "checked"; echo ">"._NO."</td>
</tr><tr class=bg1>
<td>"._CLA_DISPLSUBCAT." </td>
<td><input type=\"radio\" class=\"radio\" name=\"souscatS\" value=\"1\""; if ($souscat == "1") echo "checked"; 
echo ">"._YES."&nbsp;&nbsp; <input type=\"radio\" class=\"radio\" name=\"souscatS\" value=\"0\""; if ($souscat == "0") echo "checked"; echo ">"._NO." ("._CLA_ONHOME.")</td>
</tr><tr class=bg1>
<td>"._CLA_NBDISPLSUBCAT." </td>
<td><input type=\"text\" class=\"text\" name=\"nbsouscatS\" value=\"$nbsouscat\" size=\"4\" maxlength=\"4\"> ("._CLA_IF." \""._CLA_DISPLSUBCAT."\" "._CLA_ISAT." \""._YES."\")</td>
</tr><tr class=bg1>
<td>"._CLA_ORDRECLASS." </td>
<td><select name=classmS class=\"select\">
<option value=title";
if ($classm == "title") echo " selected"; 
echo ">"._CLA_ORDREALPHA."</option>
<option value=ordre";
if ($classm == "ordre") echo " selected";
echo ">"._CLA_ORDREPERSO."</option>
</select></td>
</tr><tr class=bg1>
<td>"._CLA_AFFNBANN." </td>
<td><SELECT NAME=\"affichnbannS\" class=\"select\">
	<OPTION VALUE=\"1\""; if ($affichnbann == "1") echo " selected";
	echo "> "._CLA_AFFNBANN1."
	<OPTION VALUE=\"0\""; if ($affichnbann == "0") echo " selected";
	echo "> "._CLA_AFFNBANN2."
</SELECT> "._CLA_AFFNBANNTEXT."</td>
</tr>
<TR CLASS=\"bg1\">
      <TD COLSPAN=\"2\">&nbsp;</TD>
    </TR>
	<TR CLASS=\"bg1\">
      <TD>"._CLA_INTRO."</TD>
      <TD>";
	$intro = join('', file("../cache/intro.txt"));
	$intro = $myts->makeTboxData4PreviewInForm($intro);
	$desc       = new XoopsFormDhtmlTextArea('', 'intro', $intro, 10, 50);
	echo $desc->render();
	  echo "</TD>
    </TR>
		<TR CLASS=\"bg1\">
      <TD>"._CLA_CONDITION."</TD>
      <TD>";
	$condition = join('', file("../cache/condition.php"));
	$condition = $myts->makeTboxData4PreviewInForm($condition);
	$cond       = new XoopsFormDhtmlTextArea('', 'condition', $condition, 10, 50);
	echo $cond->render();
	  echo "</TD>
    </TR>
</table><br />
<input type=\"submit\" value=\""._CLA_SAVMOD."\" class=\"button\">
</form>";
CloseTable();
xoops_cp_footer();
}
function ConfOK($annoaddS, $justuserS, $nb_affichageS, $monnaieS, $newclassifiedsS, $moderatedS, $photomaxS, $cladayS, $afficheblocS, $countdayS, $ynpriceS, $souscatS, $classmS, $nbsouscatS, $newannS, $affichnbannS, $_POST) {
global $myts;
   
  $content = "<?\n";
  $content .= "// \n";
  $content .= "// ------------------------------------------------------------------------- //\n";
  $content .= "//               E-Xoops: Content Management for the Masses                  //\n";
  $content .= "//                       < http://www.e-xoops.com >                          //\n";
  $content .= "// ------------------------------------------------------------------------- //\n";
  $content .= "// Original Author: Pascal Le Boustouller\n";
  $content .= "// Author Website : http://www.perso-search.com/e-xoopsien/\n";
  $content .= "// Licence Type   : GPL\n";
  $content .= "// ------------------------------------------------------------------------- //\n";
  $content .= "\$annoadd = $annoaddS;\n\n";
  $content .= "\$nb_affichage = $nb_affichageS;\n\n";
  $content .= "\$monnaie = \"$monnaieS\";\n\n";
  $content .= "\$newclassifieds = $newclassifiedsS;\n\n";
  $content .= "\$moderated = $moderatedS;\n\n";
  $content .= "\$photomax = $photomaxS;\n\n";
  $content .= "\$claday = $cladayS;\n\n";
  $content .= "\$affichebloc = $afficheblocS;\n\n";
  $content .= "\$countday = $countdayS;\n\n";
  $content .= "\$ynprice = $ynpriceS;\n\n";
  $content .= "\$souscat = $souscatS;\n\n";
  $content .= "\$nbsouscat = \"$nbsouscatS\";\n\n";
  $content .= "\$classm = \"$classmS\";\n\n";
  $content .= "\$newann = \"$newannS\";\n\n";
  $content .= "\$affichnbann = \"$affichnbannS\";\n\n";
  $content .= "?>";
    $filename = XOOPS_ROOT_PATH."/modules/MyAnnonces/cache/config.php";
if ( $file = fopen($filename, "w") ) {
	fwrite($file, $content);
	fclose($file);
	} else {
		redirect_header("pref.php", 1, _CLA_NOTUPDATED);
		exit();
	}
	$filename = XOOPS_ROOT_PATH."/modules/MyAnnonces/cache/intro.txt";
if ( $file = fopen($filename, "wb") ) {
	$intro = $myts->oopsStripSlashesGPC($_POST['intro']);
	fwrite($file, $intro);
	fclose($file);
	} else {
		redirect_header("pref.php", 1, _CLA_NOTUPDATED1);
		exit();
	}
	
	$filename = XOOPS_ROOT_PATH."/modules/MyAnnonces/cache/condition.php";
if ( $file = fopen($filename, "w") ) {
	$condition = $myts->oopsStripSlashesGPC($_POST['condition']);
	fwrite($file, $condition);
	fclose($file);
	} else {
		redirect_header("pref.php", 1, _CLA_NOTUPDATED2);
		exit();
	}
	
		redirect_header("pref.php",1,_CLA_CONFSAVE);
	exit();
}
switch($pa){
	case "ConfOk":
		ConfOk($annoaddS, $justuserS, $nb_affichageS, $monnaieS, $newclassifiedsS, $moderatedS, $photomaxS, $cladayS, $afficheblocS, $countdayS, $ynpriceS, $souscatS, $classmS, $nbsouscatS, $newannS, $affichnbannS, $_POST);
	break;
		
	default:
		Conf();
	break;
}
?>