Location: PHPKode > projects > ZompLog > admin/settings.php
<?php
/* Written by Gerben Schmidt, http://scripts.zomp.nl */

ob_start();
include_once("functions.php");
include('config.php');
include("session.php");
// this setting activates tinyMCE for all textareas in the page
$set_mce = 1;
include("header.php");

$user = loadUser($_SESSION['login'],$link,$table_users);
if(!$_SESSION["loggedIn"] || !$user['admin']){ echo "You don't have enough privileges to view this page."; exit; }
else
{

if($_POST['Submit']){

if(!$_POST[date])
{
$messages[]="$lang_message019";
}

if(!$_POST['max'])
{
$messages[]="$lang_message020";
}

if(!$_POST[scroll])
{
$messages[]="$lang_message021";
}

if(!$_POST[max_upload])
{
$messages[]="$lang_message022";
}

if(empty($messages)) {

	$query="UPDATE $table_settings SET weblog_title = '$_POST[weblog_title]', comments = '$_POST[comments]', pages_admin = '$_POST[pages_admin]', language = '$_POST[language]', max = '$_POST[max]', scroll = '$_POST[scroll]', use_upload = '$_POST[use_upload]', max_upload = '$_POST[max_upload]', date = '$_POST[date]', use_mediafile = '$_POST[use_mediafile]', admin_welcome = '$_POST[admin_welcome]', site_welcome = '$_POST[site_welcome]', use_join = '$_POST[use_join]', img_width = '$_POST[img_width]', img_fullwidth = '$_POST[img_fullwidth]', use_tinymce = '$_POST[use_tinymce]', weblog_subtitle = '$_POST[weblog_subtitle]', rss_description = '$_POST[rss_description]',  rss_category = '$_POST[rss_category]', rss_language = '$_POST[rss_language]', rss_email = '$_POST[rss_email]', rss_url = '$_POST[rss_url]'";
	
	$result=mysql_query($query, $link) or die("Died inserting data into db.  Error returned if any: ".mysql_error());

header("Location: settings.php?message=5");
ob_end_flush();

	}


}
?>

<div id="submenu"><a href="settings.php" class="sub"><?php echo "$lang_settings"; ?></a> | <a href="settings_menu.php" class="sub"><?php echo "$lang_menu_settings"; ?></a></div>


<div id="side">
<div class="title">&nbsp;</div>
<div class="box"><?php
if(!empty($messages)){
	displayErrors($messages);
}

elseif($_GET[message] && empty($messages)){
displayMessage($_GET[message]);
  }

else{
echo "$lang_message009";
}  
  
?>
</div></div>


<div id="main">
<?php


if(!$_POST['Submit']){

?>


<form name="myform" method="post" enctype="multipart/form-data">
<table width="100%"  border="0" cellspacing="0" cellpadding="0" class="text">
        <tr>
          <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><h1><?php echo "$lang_system_settings"; ?></h1>
</td>
          <td><input type="submit" name="Submit" value="<?php echo "$lang_submit"; ?>" id="button" /></td>
        </tr>
      </table></td>
        </tr>
        <tr>
          <td colspan="2"><fieldset id="titlediv">
      <legend><?php echo "$lang_main_config"; ?></legend>	 <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="text">

            <tr>
              <td width="47%"><?php echo "$lang_weblog_title"; ?></td>
              <td width="53%"><input name="weblog_title" type="text" id="weblog_title" value="<?php echo "$settings[weblog_title]" ?>" /></td>
            </tr>
            <tr>
              <td><?php echo "$lang_weblog_subtitle"; ?></td>
              <td><input name="weblog_subtitle" type="text" id="weblog_subtitle" value="<?php echo "$settings[weblog_subtitle]" ?>" /></td>
            </tr>
            <tr>
              <td><?php echo "$lang_choose_language"; ?></td>
              <td><select name="language" onchange="setOptions(document.myform.language.options[document.myform.language.selectedIndex].value);">
                  <option value="<?php echo "$settings[language]"; ?>" selected="selected"><?php echo "$settings[language]"; ?></option>
                  <?php
$path = "../language/";
$files = preg_find("/\.php$/", '../language/', PREG_FIND_RECURSIVE);
foreach ($files as $filename){
$file = basename($filename, ".php");
if($file == $settings[language]){
// do nothing
}
else
{
echo '<option value="'.$file.'">'.$file.'</option>';
	}
 }
	?>
              </select></td>
            </tr>
            <tr>
              <td><?php echo "$lang_posts_per_page"; ?></td>
              <td><input name="max" type="text" id="max" value="<?php echo "$settings[max]" ?>" size="3" /></td>
            </tr>
            <tr>
              <td><?php echo "$lang_scroll"; ?></td>
              <td><input name="scroll" type="text" id="scroll" value="<?php echo "$settings[scroll]" ?>" size="3" />              </td>
            </tr>
            <tr>
              <td><?php echo "$lang_date_time_format"; ?></td>
              <td><select name="date">
                  <option value="<?php echo "$settings[date]"; ?>">
                    <?php $today = date("$settings[date]"); echo "$today"; ?>
                    </option>
                  <option value="F j, Y">
                    <?php $today = date("F j, Y"); echo "$today"; ?>
                    </option>
                  <option value="F j, Y, g:i a">
                    <?php $today = date("F j, Y, g:i a"); echo "$today"; ?>
                    </option>
                  <option value="F j, Y, G:i">
                    <?php $today = date("F j, Y, G:i"); echo "$today"; ?>
                    </option>
                  <option value="D M j Y">
                    <?php $today = date("D M j Y"); echo "$today"; ?>
                    </option>
                  <option value="D M j Y G:i:s">
                    <?php $today = date("D M j Y G:i:s"); echo "$today"; ?>
                    </option>
                  <option value="m d Y">
                    <?php $today = date("m d Y"); echo "$today"; ?>
                    </option>
                  <option value="d m Y">
                    <?php $today = date("d m Y"); echo "$today"; ?>
                    </option>
                   <option value="d-m-Y">
                    <?php $today = date("d-m-Y"); echo "$today"; ?>
                    </option>
                 <option value="m d Y, G:i">
                    <?php $today = date("m d Y, G:i"); echo "$today"; ?>
                    </option>
                  <option value="d m Y, G:i">
                    <?php $today = date("d m Y, G:i"); echo "$today"; ?>
                    </option>
                  <option value="d-m-Y, G:i">
                    <?php $today = date("d-m-Y, G:i"); echo "$today"; ?>
                    </option>
              </select></td>
            </tr>
          </table>
          </fieldset></td>
          </tr>
        <tr>
          <td>&nbsp;</td>
          <td width="53%">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2"><fieldset id="titlediv">
      <legend><?php echo "$lang_activate_site_parts"; ?></legend>	<table width="100%"  border="0" cellpadding="0" cellspacing="0" class="text">
            
            <tr>
              <td width="47%"><?php echo "$lang_comments_on"; ?></td>
              <td width="53%"><?php if($settings[comments]){
	?>
                  <input name="comments" type="checkbox" id="comments" value="1" checked="checked" />
                  <?php
	}
	else
	{
	?>
                  <input name="comments" type="checkbox" id="comments" value="1" />
              <?php
	}
	?></td>
            </tr>
            <tr>
              <td><?php echo "$lang_upload_on"; ?></td>
              <td><?php if($settings[use_upload]){
	?>
                  <input name="use_upload" type="checkbox" id="use_upload" value="1" checked="checked" />
                  <?php
	}
	else
	{
	?>
                  <input name="use_upload" type="checkbox" id="use_upload" value="1" />
                  <?php
	}
	?></td>
            </tr>
            <tr>
              <td><?php echo "$lang_use_WYSIWYG_editor"; ?></td>
              <td><?php if($settings[use_tinymce]){
	?>
                  <input name="use_tinymce" type="checkbox" id="pages" value="1" checked="checked" />
                  <?php
	}
	else
	{
	?>
                  <input name="use_tinymce" type="checkbox" id="pages" value="1" />
                  <?php
	}
	?>              </td>
            </tr>
            <tr>
              <td><?php echo "$lang_pages_admin"; ?></td>
              <td><?php if($settings[pages_admin]){
	?>
                  <input name="pages_admin" type="checkbox" id="pages" value="1" checked="checked" />
                  <?php
	}
	else
	{
	?>
                  <input name="pages_admin" type="checkbox" id="pages" value="1" />
                  <?php
	}
	?>
                  <?php echo "$lang_pages_admin_only"; ?></td>
            </tr>
          </table>
          </fieldset></td>
          </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2"><fieldset id="titlediv">
      <legend><?php echo "$lang_upload_image"; ?></legend><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="text">
            
            <tr>
              <td width="47%"><?php echo "$lang_max_upload"; ?></td>
              <td width="53%"><input name="max_upload" type="text" id="max_upload" value="<?php echo "$settings[max_upload]" ?>" size="8" />
              (102400 = 100 kb) </td>
            </tr>
            <tr>
              <td><?php echo "$lang_thumbnail_width"; ?></td>
              <td><input name="img_width" type="text" id="img_width" value="<?php echo "$settings[img_width]" ?>" size="8" /></td>
            </tr>
            <tr>
              <td><?php echo "$lang_thumbnail_fullwidth"; ?></td>
              <td><input name="img_fullwidth" type="text" id="img_fullwidth" value="<?php echo "$settings[img_fullwidth]" ?>" size="8" /></td>
            </tr>
          </table>
          </fieldset></td>
          </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2"><fieldset id="titlediv">
      <legend><?php echo "$lang_messages"; ?></legend><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="text">
            
            <tr>
              <td width="50%" valign="top"><?php echo "$lang_admin_welcome_message"; ?></td>
              <td width="50%">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="2" valign="top"><textarea name="admin_welcome" cols="65" rows="7" id="admin_welcome"><?php echo "$settings[admin_welcome]" ?></textarea></td>
              </tr>
			  <tr>
			    <td colspan="2">&nbsp;</td>
		    </tr>
			  <tr>
          <td colspan="2"><?php echo "$lang_site_welcome_message"; ?></td>
        </tr>
        <tr>
          <td colspan="2"><textarea name="site_welcome" cols="65" rows="7"><?php echo "$settings[site_welcome]" ?></textarea></td>
          </table>
          </fieldset></td>
          </tr>
		          <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
     <tr>
          <td colspan="2"><fieldset id="titlediv">
      <legend><?php echo "$lang_rssfeed"; ?></legend><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="text">
            
            <tr>
              <td width="47%" valign="top"><?php echo "$lang_site_desc"; ?></td>
              <td width="53%">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="2" valign="top"><textarea name="rss_description" cols="65" rows="7" id="rss_description"><?php echo "$settings[rss_description]" ?></textarea></td>
              </tr>
		           <tr>
              <td><?php echo "$lang_feed_cat"; ?></td>
              <td><input name="rss_category" type="text" value="<?php echo "$settings[rss_category]" ?>" size="25" /></td>
            </tr>
			       <tr>
              <td><?php echo "$lang_language"; ?></td>
			  <?php $stored = $settings[rss_language]; ?> 
<!--              <td><input name="rss_language" type="text" value="<?php echo "$settings[rss_language]" ?>" size="5" /></td> -->
				<td><?php selectLanguage($stored); ?></td>
            </tr>
			       <tr>
              <td><?php echo "$lang_email_webmaster"; ?></td>
              <td><input name="rss_email" type="text" value="<?php echo "$settings[rss_email]" ?>" size="25" /></td>
            </tr>
			       <tr>
              <td><?php echo "$lang_your_zomp"; ?></td>
              <td><input name="rss_url" type="text" value="<?php echo "$settings[rss_url]" ?>" size="25" /></td>
            </tr>
          </table>
          </fieldset></td>
          </tr>
        
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2"><input type="submit" name="Submit" value="<?php echo "$lang_submit"; ?>" id="submit"></td>
          </tr>
      </table>
</form>
</div>

<?php
}
}
include('footer.php');
?>
Return current item: ZompLog