Update of /cvsroot/phpslash/phpslash-dev/include/modules/infolog
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13201/phpslash-dev/include/modules/infolog
Added Files:
Infolog.class admin.php
Log Message:
removed classes that already had been moved to module directories. moved Infolog and slashAuth to module directories.
--- NEW FILE: Infolog.class ---
<?php
/*
* Class: Infolog
*
* Layer: Admin
* Desc.:
*
* NOTES/TO-DO:
*
*/
class Infolog {
var $templ, $db, $psl, $message;
/*
* CONSTRUCTORS
*/
function Infolog () {
global $_PSL;
$this->psl = $_PSL;
$this->message = '';
/* Start a db */
$this->db = pslNew("slashDB");
/* Templates */
$this->templ = pslNew("slashTemplate",$this->psl['templatedir']);
$this->templ->debug = 0;
$this->templ->set_file(array(
infolog => "infolog.tpl"
));
}
/*
* METHODS
*/
function pageOut() {
$this->templ->set_block("infolog","row","rows");
$this->db->query("SELECT * FROM psl_infolog");
while ($this->db->next_record()) {
$this->templ->set_var(array(
'ACTION_URL' => $this->psl['phpself'],
'INFOLOG_ID' => $this->db->Record['id'],
'INFOLOG_TIME' => psl_dateTimeShort($this->db->Record['date_created']),
'INFOLOG_DESC' => $this->db->Record['description'],
'INFOLOG_DATA' => $this->db->Record['data']
));
$this->templ->parse("rows","row",true);
}
$this->templ->set_var(array(
ACTION_URL => $this->psl['phpself']
));
return $this->templ->parse(OUT,array("infolog"));
// $this->templ->p(OUT);
}
function deleteAllLogs() {
$this->message .= pslgetText('Deleting all log entries....');
$this->db->query("DELETE FROM psl_infolog");
$this->message .= pslgetText("Done!")."<br>\n";
return true;
}
function deleteLogByKeyword($keyword) {
$keyword = clean($keyword);
$this->db->query("DELETE from psl_infolog
WHERE description RLIKE '($keyword.*)'");
$this->message .= 'Deleted ' . $this->db->affected_rows() . " log entries with keyword the keyword \"$keyword\".<br>\n";
logwrite("Infolog Record Delete", "Keyword: $keyword ($this->db->affected_rows() matched and deleted)");
return true;
}
function deleteLogByID($id) {
while( list( $key, $val) = each( $id )) {
$this->message .= pslgetText("Deleting log entry ")."$val...";
$this->db->query("DELETE FROM psl_infolog WHERE id='$val'");
$this->message .= pslgetText("Done!")."<br>\n";
}
logwrite("Infolog Record Delete", $id);
return true;
}
/**
* getMessage - returns message text
*
* simply returns the contents of the message variable
*
* @access public
*/
function getMessage() {
return pslgetText($this->message);
}
} /* end Infolog.class */
?>
--- NEW FILE: admin.php ---
<?php
// $Id: admin.php,v 1.1 2004/09/15 23:31:47 joestewart Exp $
global $_PSL, $sess, $auth, $perm;
AddClassRequirement("infolog",$_PSL['moduledir'] ."/infolog/Infolog.class");
// Header title
$pagetitle = pslgetText("Administration");
// Defines The META TAG Page Type
$xsiteobject = pslgetText("Administration");
/*****************************
START OF PAGE
*****************************/
$auth->login_if(!$perm->have_perm('infologList'));
$log = pslNew("Infolog");
/* START DEBUG */
// debug( "HTTP_POST_VARS" , $HTTP_POST_VARS);
// debug( "HTTP_GET_VARS" , $HTTP_GET_VARS);
/* END DEBUG */
$content = '';
if ($perm->have_perm("infologList")) {
switch ($HTTP_POST_VARS['submit']) {
case "IdDelete":
// debug("loginfoadmin::infolog_ary", $infolog_ary);
if($log->deleteLogByID(clean($HTTP_POST_VARS["infolog_ary"]))) {
$content .= getMessage($log->getMessage());
}
$content .= $log->pageOut();
break;
case "keyDelete":
if($log->deleteLogByKeyword(clean($HTTP_POST_VARS["infolog_delete_key"]))) {
$content .= getMessage($log->getMessage());
}
$content .= $log->pageOut();
break;
case "allDelete":
if($log->deleteAllLogs()) {
$content .= getMessage($log->getMessage());
}
$content .= $log->pageOut();
break;
default:
$content .= $log->pageOut();
}
} else {
$content = getTitlebar("100%","Error! Invalid Privileges");
$content .= "Sorry. You do not have the necessary privilege to view this page.";
}
return $content;
?>
|