Location: PHPKode > projects > PhpGiggle > phpGiggle/phpgiggle-admin.php
<?
include("phpgiggle-validate.inc.php");

/**
    * Copyright (C) 2004 Tony Bierman
    * 
    * This program is free software; you can redistribute it and/or
    * modify it under the terms of the GNU General Public License
    * as published by the Free Software Foundation; either version 2
    * of the License, or (at your option) any later version.
    * This program is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * GNU General Public License for more details.
    * You should have received a copy of the GNU General Public License
    * along with this program; if not, write to the Free Software
    * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    *
*/

/*
    
    see README.html for complete documentation
*/

/*
    USAGE: http://setup.php?strCfgFile=FILE_TO_EDIT
    Example: http://setup.php?strCfgFile=sample.inc.php

if(!ISSET($fname)) {
echo 'You did not specify any file to edit.<br>';
echo 'Please call this page like setup.php?strCfgFile=YOUR_FILE';
exit();
}
*/

define('phpGiggle_ABSPATH', dirname(__FILE__).'/');
require_once(phpGiggle_ABSPATH.'includes/configreader.class.php');
require_once(phpGiggle_ABSPATH.'phpgiggle-config.inc.php');
require_once(phpGiggle_ABSPATH.'includes/phpgiggle-functions.inc.php');
require_once(phpGiggle_ABSPATH.'includes/phpgiggle-admin-functions.inc.php');
//$phpgiggle_errors = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php echo '<link rel="stylesheet" type="text/css" media="screen" href="'.phpgiggle_url.'phpgiggle-layout.css" />'."\n"; ?>
<title>phpGiggle Administration</title>
</head>
<body>
<div id="rap">
<h1 id="header">phpGiggle admin</h1>
<div id="menu">
<div id="logo" align="center">
<br/><br/><a href="http://www.biermana.org"><img align="center" src="<?php echo phpgiggle_url.'images/phpgiggle_logo.png';?>" alt="phpGiggle"/></a>
</div>
<ul>
<li id="options">Admin Options:
	<ul>
		<li><a href="<?php echo $PHP_SELF; ?>?admin_option=add">Add a keyword</a></li>
		<li><a href="<?php echo $PHP_SELF; ?>?admin_option=update">Update a keyword</a></li>
		<li><a href="<?php echo $PHP_SELF; ?>?admin_option=delete">Delete a keyword</a></li>
		<li><a href="<?php echo $PHP_SELF; ?>?admin_option=clicks">Clicks report</a></li>
	</ul>
	<hr width="60%"/>
	<ul>
		<li><a href="<?php echo $PHP_SELF; ?>?admin_option=validate">Validate configuration</a></li>
	</ul>
	<hr width="60%"/>
	<ul>
		<li><a href="<?php echo $PHP_SELF; ?>?admin_option=support">Support</a></li>
		<li><a href="<?php echo $PHP_SELF; ?>?admin_option=bug">Send bug report</a></li>
	</ul>
	<hr width="60%"/>
	<ul>
		<li><a href="<?php echo $PHP_SELF; ?>?admin_option=about">About phpGiggle</a></li>
		<br />
		<li>[ <a href="phpgiggle-logout.php">Logout</a> ]</li>
	</ul>
</li>
</ul>
<br/>
</div>
<?
$phpgiggle_errors=0;
if($admin_option != "validate" )
{
    /*
	validate words folder
    */
    $words_folder = phpGiggle_ABSPATH.'words';
    if(!file_exists($words_folder) )
    {
	echo '<div id="content" width="80%">'."\n";
	print_error("Words folder ".$words_folder." could not be found");
	$phpgiggle_errors++;
	echo "</div>\n";   
    }
    if(!is_writable($words_folder) && ($phpgiggle_errors==0) )
    {
	echo '<div id="content" width="80%">'."\n";
	print_error("Words folder ".$words_folder." is not writable");
	$phpgiggle_errors++;
	echo "</div>\n";
    }
    
    /*
      validate words file
    */
    if(!file_exists(phpgiggle_wordsfile) && ($phpgiggle_errors==0) )
    {
	echo '<div id="content" width="80%">'."\n";
	print_error("Words file ".phpgiggle_wordsfile." could not be found");
	echo "</div>\n";
	$phpgiggle_errors++;
    }
    if(!is_writable(phpgiggle_wordsfile) && ($phpgiggle_errors==0) )
    {
	echo '<div id="content" width="80%">'."\n";
	print_error("Words file ".phpgiggle_wordsfile." is not writable");
	echo "</div>\n";
	$phpgiggle_errors++;
    }
}

if(!$phpgiggle_errors)
{ 
    //while(list($key, $val) = each ($_POST)) print $key . " = " . $val . "<br>";
    if($admin_option == "add" )
    {
        require_once(phpGiggle_ABSPATH.'includes/phpgiggle-add.inc.php');
    }
    elseif($DoChanges == "Add Keyword" )
    {
        require_once(phpGiggle_ABSPATH.'includes/phpgiggle-add.inc.php');
    }
    elseif($admin_option == "update" )
    {
        require_once(phpGiggle_ABSPATH.'includes/phpgiggle-edit.inc.php');
    }
    elseif($DoChanges == "Update Keyword" )
    {
        require_once(phpGiggle_ABSPATH.'includes/phpgiggle-edit.inc.php');
    }
    elseif($admin_option == "delete" )
    {
        require_once(phpGiggle_ABSPATH.'includes/phpgiggle-delete.inc.php');
    }
    elseif($DoChanges == "Delete Keyword" )
    {
        require_once(phpGiggle_ABSPATH.'includes/phpgiggle-delete.inc.php');
    }
    elseif($admin_option == "clicks" )
    {
        require_once(phpGiggle_ABSPATH.'includes/phpgiggle-clicks.inc.php');
    }
    elseif($admin_option == "support" )
    {
        require_once(phpGiggle_ABSPATH.'includes/phpgiggle-support.inc.php');
    }
    elseif($admin_option == "bug" )
    {
        require_once(phpGiggle_ABSPATH.'includes/phpgiggle-bug.inc.php');
    }
    elseif($admin_option == "validate"  )
    {
        require_once(phpGiggle_ABSPATH.'includes/phpgiggle-validate.inc.php');
    }
    elseif($admin_option == "about"  )
    {
        require_once(phpGiggle_ABSPATH.'includes/phpgiggle-about.inc.php');
    }
    else {?>
    <div id="content" width="80%">
    <h2>Please select a choice from the admin options menu</h2> 
    </div>
<? } } ?>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<p class="credit"><cite>Powered by <a href="http://biermana.org" title="Powered by phpGiggle"><strong>phpGiggle</strong></a></cite><? echo " ".phpgiggle_version; ?></p>
</div>
</body>
</html>
Return current item: PhpGiggle