PHP Classes

File: manager.php

Recommend this page to a friend!
  Classes of Rodrigo Moraes   EMail Logger   manager.php   Download  
File: manager.php
Role: Example script
Content type: text/plain
Description: admin
Class: EMail Logger
Store e-mail messages information in log files
Author: By
Last change: new version changes
Date: 14 years ago
Size: 1,555 bytes
 

Contents

Class file image Download
<?php

/**
 * EMail_Log Manager
 *
 * @category Final User Manager
 * @package WSA/Email/
 * @version 1.2
 * @author Rodrigo Moraes Orph <rodrigo.orph@gmail.com>
 * @license Copyright http://www.overflow.biz/
 *
 */
 
require_once("email_log.php");

if (isset(
$_REQUEST["d"]) && !empty($_REQUEST["d"])) {
   
$_lr = array();
   
$el = new EMail_Log(isset($email_log_base_path) ? $email_log_base_path : "");
   
$x = json_decode(base64_decode($_REQUEST['d']),true);
   
    if (isset(
$x["q"])) {
        switch (
$x["q"]) {
            case
"list":
               
$_lr["r"] = $el->list_entries(isset($x["page"]) ? $x["page"] : 0);
                break;
            case
"list_date":
               
$_lr["r"] = $el->list_date($x["date"], isset($x["page"]) ? $x["page"] : 0);
                break;
            case
"read":
               
$r = $el->read($x["line"], $x["date"]);
                if (
$r !== false) {
                   
$r = explode("|", $r);
                   
$_lr["r"] = array(
                       
"from" => $r[0],
                       
"to" => $r[1],
                       
"subject" => base64_encode(utf8_encode(base64_decode($r[2]))),
                       
"body" => base64_encode(nl2br(utf8_encode(base64_decode($r[3])))),
                       
"time" => isset($r[4]) && !empty($r[4]) ? $r[4] : base64_encode("00:00:00"),
                       
"read" => isset($r[5]) && !empty($r[5]) ? $r[5] : base64_encode("1")
                    );
                } else {
                   
$_lr["error"] = "Invalid entry";
                }
                break;
            default:
               
$_lr["error"] = "Invalid function";
        }
    } else {
       
$_lr["error"] = "Invalid function";
    }
   
   
$el->json_output($_lr);
} else {
// show admin
   
echo file_get_contents("templates/email_log.html");
}