PHP Classes

File: admin.php

Recommend this page to a friend!
  Classes of Dmitry Sheiko   Multi-User Tag Cloud   admin.php   Download  
File: admin.php
Role: Application script
Content type: text/plain
Description: administrative panel
Class: Multi-User Tag Cloud
Manage clouds of tags added by multiple users
Author: By
Last change:
Date: 17 years ago
Size: 4,322 bytes
 

Contents

Class file image Download
<?PHP
/*
* Tag Cloud Administrative Panel
*
* @package Tag Cloud
* @author $Author: sheiko $
* @version $Id: admin.php, v 1.0 sheiko Exp $
* @since v.1.0
* @copyright (c) Dmitry Sheiko http://www.cmsdevelopment.com
*/

include("config.inc.php");
include(
"tagcloud.lib.php");

session_start();
header("Content-type: text/html; charset=".DEFAULT_CHARSET);
if(!isset(
$dbconnect)) die("Config.inc.php is corrupted");

$tc = new TagCloud();
$tc->DBConnect($dbconnect);
$tc->Controller();

/**
 * Use TagCloud API to synchronize tags DB and blog DB:
 * $tc->updateRecord( $link, $title, $user ) - to add/update a record
 * $tc->deleteRecod( $link, $user ) - to delete a record
 * $tc->deleteAllRecords($user) - todelete all records
 **/


print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
    <title>Tag Cloud Administration</title>
    <meta http-equiv="Content-Type" content="text/html; '
.DEFAULT_CHARSET.'">
    <script language="JavaScript" type="text/javascript" src="tagcloud.js"></script>
    <style>
    body, td { font-size: 12px; font-family: Arial, Tahoma; }
   
        .global_error {
          z-index: 20000;
          display: none;
          position: absolute; top: 40%; left: 35%; border: solid 1px #C7D9E7; width: 300px; background: #EDF4F9 url(/webroot/admin/pic/message_bg.gif) repeat-x;
          font-family : Arial, Helvetica, sans-serif;
          color: #000000;
          font-size: 12px;
        }
        .global_error .message { padding: 15px;}
        fieldset { border: 1px solid #AAAAAA; padding: 5px; }
        .tc_auth { width: 200px; }
   
    </style>
    <script>
   
    function SaveValue(url, tags) {
        initGlobalMessageWindow(\''
.lang("Executing...").'\');
        serverRequest("admin.php", "action=update&url="+url+"&tags="+tags, ShowResultMessage);
    }
    function makeAction(action) {
        initGlobalMessageWindow(\''
.lang("Executing...").'\');
        if(action=="importRSS")
            serverRequest("admin.php", "action="+action, RedirectAndShowResultMessage);
        else
            serverRequest("admin.php", "action="+action, ShowResultMessage);
    }
    function authorizate(login, password) {
        initGlobalMessageWindow(\''
.lang("Executing...").'\');
        serverRequest("admin.php", "action=authorizate&login="+login+"&password="+password, AuthorizationController);
    }
   
    </script>
</head>
<body>
'
;

if(isset(
$_GET["logout"])) unset($_SESSION);

// User needs to pass authorization
if(!isset($_SESSION["user"])) {
       print
"<form name=\"thelist\">
    <fieldset class=\"tc_auth\">
    <legend> <b>"
.lang("Authorization")."</b> </legend>
    Login: <br />
    <input class=\"tc_auth\" type=\"text\" name=\"login\" /><br />
    Password: <br />
    <input class=\"tc_auth\" type=\"password\" name=\"password\" /><br />
    <input class=\"tc_auth\" type=\"button\" onclick=\"return authorizate(document.thelist.login.value, document.thelist.password.value);\" value=\"OK\" /><br />
    </fieldset>
    <div class=\"global_error\" id=\"GlobalMessage\">
    <div class=\"message\" id=\"GlobalMessageContent\"></div>
    </div>
    </body>
    </html>"
;
       exit;
}

   
// Show record list
   
$result = mysql_query("SELECT * FROM ".TITLES_TABLE." WHERE user='".ADMIN_USERID."'");
   
$counter = 0;
       print
"<form name=\"thelist\">
    <input type=\"button\" onclick=\"makeAction('importRSS')\" value=\""
.lang("Import RSS")."\" title=\"".RSS_URL."\" />&nbsp;&nbsp;
    <input type=\"button\" onclick=\"document.location.href='admin.php?logout=on';\" value=\""
.lang("Logout")."\" />
    <br /><br />
    <fieldset>
    <legend> <b>"
.ADMIN_USERID." : ".lang("Record list")."</b> </legend>
       <table>\n"
;
       while (
$line = mysql_fetch_array($result, MYSQL_ASSOC)) {
          
$line["tags"] = preg_replace("/,$/is", "", $line["tags"]);
          
$line["tags"] = preg_replace("/^,/is", "", $line["tags"]);
       print
"\t<tr>\n
       \t\t<td><a href=\"
{$line["url"]}\" target=\"_blank\">{$line["title"]}</a></td>\n
        \t\t<td><input type=\"text\" name=\"obj_
{$counter}\" value=\"{$line["tags"]}\">&nbsp;
        <input type=\"button\" onclick=\"SaveValue('
{$line["url"]}', thelist.obj_{$counter}.value)\" value=\"".lang("Change")."\" /> </td>\n
       "
;
       print
"\t</tr>\n";
      
$counter++;
   }
   print
"</table>\n</fieldset></form>";
  
?>
<div class="global_error" id="GlobalMessage">
    <div class="message" id="GlobalMessageContent"></div>
</div>
</body>
</html>