Location: PHPKode > projects > PHPEcho CMS > modules/admin/modules/global.php
<?php
/*  +--------------------------------------------
*   |
*   |     Product:       PHPEchoCMS
*   |     Author:        Tigran Abrahamyan
*   |     License:       GPL
*   |     Last updated:  26.03.07
*   |     For version:   2.0  
*   |     Desc:          Module for working with global settings.
*   |        
*   +--------------------------------------------
*/

if( !ADMIN_LOAD )
{
    die( "Base not loaded!" );
}

$mlang = $core->getlang("admin_global");

if ( @$_POST['submit'] )
{
    query ("UPDATE ".PREFIX."settings SET `sitename` = '".addslashes($_POST['sitename'])."', `defaultmodule` = '".addslashes($_POST['defmod'])."', keywords = '".addslashes($_POST['keywords'])."', min_pass = '".addslashes($_POST['minpass'])."', default_theme = '".addslashes($_POST['deftheme'])."', default_lang = '".addslashes($_POST['deflang'])."', numnews = '".addslashes($_POST['numnews'])."', numthreads = '".addslashes($_POST['numthreads'])."', `lastnews` = '".addslashes($_POST['lastnews'])."'", 1);
    echo "<font color='green'>".$mlang['001']."</font>";
}

$settings = query ( "SELECT * FROM ".PREFIX."settings" , 4 );

echo "<br>
<form action='index.php?module=admin&act=global' method='post'>
<table width='100%'>
   <tr>
      <td width='25%'>
         ".$mlang['002']."
      </td>
      <td width='75%'>
         <input type='text' name='sitename' value='".$settings['sitename']."'>
      </td>
   </tr>
   <tr>
      <td>
         ".$mlang['003']."
      </td>
      <td>
         <input type='text' name='keywords' value='".$settings['keywords']."'>
      </td>
   </tr>
   <tr>
      <td>
         ".$mlang['004']."
      </td>
      <td>
         <input type='text' name='minpass' value='".$settings['min_pass']."'>
      </td>
   </tr>
   <tr>
      <td>
         ".$mlang['010']."
      </td>
      <td>";
	$modules = query("select `id` from `".PREFIX."modules` where `show_menu`=1", 1);
	$dmod = $settings['defaultmodule'];
	$mlang2 = $core->getlang("navigation");
        echo "<select name='defmod'>";
	while ($mod = mysql_fetch_array($modules))
		if ($mod['id'] == $dmod)
			echo "<option value='".$mod['id']."' selected='selected'>".$mlang2[$mod['id']]."</option>";
		else
			echo "<option value='".$mod['id']."'>".$mlang2[$mod['id']]."</option>";
	echo "</select>";
        echo "</td>
   </tr>
   <tr>
      <td>
         ".$mlang['005']."
      </td>
      <td>
           <select name='deftheme'>";
	   $dtheme = query ("select * from `".PREFIX."themes` where `tdir`='".$settings['default_theme']."'", 4);
	   if ($dtheme['tdir']) 
		  echo "<option value=".$dtheme['tdir'].">".$dtheme['tname']."</option>";
	   $themes = query ("select * from `".PREFIX."themes`", 1);
	   if (mysql_num_rows($themes)>0)
		 while ($th = mysql_fetch_array($themes))
		 {
			if ($th['tdir'] != $settings['default_theme'])
				 echo "<option value=".$th['tdir'].">".$th['tname']."</option>";
		 }
	   else
			 echo "<option value='default'>Default</option>";
echo "
	</select>
      </td>
   </tr>
   <tr>
      <td>
         ".$mlang['006']."
      </td>
      <td>
         <select name='deflang'>";
	 $dlang = query ("select * from `".PREFIX."languages` where `lang_dir`='".$settings['default_lang']."'", 4);
	 echo "<option value=".$dlang['lang_dir'].">".$dlang['lang_name']."</option>";
	 $languages = query ("select * from `".PREFIX."languages`", 1);
	 while ($lan = mysql_fetch_array($languages))
		if ($lan['lang_dir'] != $settings['default_lang'])
			echo "<option value=".$lan['lang_dir'].">".$lan['lang_name']."</option>";
echo "
	</select>
      </td>
   </tr>
   <tr>
      <td>
         ".$mlang['007']."
      </td>
      <td>
         <input type='text' name='numnews' value='".$settings['numnews']."'>
      </td>
   </tr>
   <tr>
      <td>
         ".$mlang['008']."
      </td>
      <td>
         <input type='text' name='numthreads' value='".$settings['numthreads']."'>
      </td>
   </tr>
   <tr>
      <td>
         ".$mlang['011']."
      </td>
      <td>
         <input type='text' name='lastnews' value='".$settings['lastnews']."'>
      </td>
   </tr>
</table>
<input name='submit' type='submit' value='".$mlang['009']."'>
</form><br>
";
?>
Return current item: PHPEcho CMS