Cheetah
emaillog.php
Go to the documentation of this file.
1 <?php
2 
8 require_once( '../inc/header.inc.php' );
9 require_once( CH_DIRECTORY_PATH_INC . 'design.inc.php' );
10 require_once( CH_DIRECTORY_PATH_INC . 'admin_design.inc.php' );
11 require_once( CH_DIRECTORY_PATH_INC . 'admin.inc.php' );
12 
13 ch_import('ChWsbPaginate');
14 ch_import('ChWsbAdminIpBlockList');
15 ch_import('ChWsbCacheUtilities');
16 
17 $logged['admin'] = member_auth(1, true, true);
18 
19 
21 $_page = array(
22  'name_index' => $iNameIndex,
23  'css_name' => array(),
24  'js_name' => array(),
25  'header' => _t('_adm_txt_emaillog'),
26  'header_text' => _t('_adm_txt_emaillog'),
27 );
28 
29 if (!isset($_GET['mode']))
30  $sMode = '';
31 else
32  $sMode = $_GET['mode'];
33 
34 $aTopItems = array();
35 $aTopItems['log'] = array(
36  'href' => 'emaillog.php',
37  'title' => _t('_adm_txt_emaillog_log'),
38  'active' => '' == $sMode ? 1 : 0
39 );
40 $aTopItems['settings'] = array(
41  'href' => 'emaillog.php?mode=settings',
42  'title' => _t('_adm_txt_emaillog_settings'),
43  'active' => 'settings' == $sMode ? 1 : 0
44 );
45 
46 //$_page['css_name'] = 'cache.css';
47 $_page_cont[$iNameIndex]['page_main_code'] = mainFunc();
48 
50 
51 function mainFunc()
52 {
53 
55 
56  if($sMode == 'settings') {
57  $s = getSettings();
58  } else {
59  $s = getLog();
60  }
61 
62  return DesignBoxAdmin(_t('_adm_txt_emaillog'), $s, $aTopItems, '', 11);
63 }
64 
65 function getLog() {
66 
68 
69  if('on' == getParam('email_log_emabled')) {
70  $sQuery = "SELECT * FROM `sys_email_log` ORDER BY `timestamp` DESC";
71  $aEmailLog = $GLOBALS['MySQL']->getAll($sQuery);
72 
73  if($aEmailLog) {
74  foreach($aEmailLog as $id => $value) {
75  $time = strtotime($value['timestamp']);
76  $myFormatForView = getLocaleDate($time, CH_WSB_LOCALE_DATE);
77  $aEmailLog[$id]['phptime'] = $myFormatForView;
78  if($value['html'] == 'text') {
79  $aEmailLog[$id]['body'] = '<div style="padding: 20px;">' . nl2br($value['body']) . '</div>';
80  }
81  $aEmailLog[$id]['params'] = '<div style="padding: 20px;"><pre>' . print_r(unserialize($value['params']), true) . '</pre></div>';
82  $aEmailLog[$id]['recipientinfo'] = '<div style="padding: 20px;"><pre>' . print_r(unserialize($value['recipientinfo']), true) . '</pre></div>';
83  $aEmailLog[$id]['debug'] = '<div style="padding: 20px;"><pre>' . print_r(unserialize($value['debug']), true) . '</pre></div>';
84  }
85  $r = $oAdmTemplate->parseHtmlByName('emaillog.html', array(
86  'ch_repeat:emaillog' => $aEmailLog,
87  //'emailto' => $aEmailLog['email'],
88  ));
89  } else {
90  $r = MsgBox(_t('_Empty'));
91  }
92  } else {
93  $r = MsgBox(_t('_adm_txt_emaillog_not_enabled'));
94  }
95 
96  return $r;
97 }
98 
99 function getSettings() {
100  ch_import('ChWsbAdminSettings');
101  $oSettings = new ChWsbAdminSettings(28);
102 
103  $sResults = false;
104  if (isset($_POST['save']) && isset($_POST['cat']))
105  $sResult = $oSettings->saveChanges($_POST);
106 
107  $s = $oSettings->getForm();
108  if ($sResult)
109  $s = $sResult . $s;
110 
111  return DesignBoxAdmin(_t('_adm_txt_emaillog'), $s, '', '', 0);
112 
113 
114  $r = 'Settings';
115  return $r;
116 }
$_page
$_page
Definition: emaillog.php:21
CH_WSB_LOCALE_DATE
const CH_WSB_LOCALE_DATE
Definition: utils.inc.php:16
$oSettings
$oSettings
Definition: advanced_settings.php:20
$oAdmTemplate
$oAdmTemplate
Definition: admin_design.inc.php:18
$_page_cont
$_page_cont[$iNameIndex]['page_main_code']
Definition: emaillog.php:47
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
$logged
$logged['admin']
Definition: emaillog.php:17
$sResult
$sResult
Definition: advanced_settings.php:26
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
php
DesignBoxAdmin
DesignBoxAdmin($sTitle, $sContent, $mixedTopItems='', $sBottomItems='', $iIndex=1)
Definition: admin_design.inc.php:50
$sMode
else $sMode
Definition: emaillog.php:32
$_GET
$_GET['debug']
Definition: index.php:67
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
getSettings
getSettings()
Definition: emaillog.php:99
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
PageCodeAdmin
PageCodeAdmin($oTemplate=null)
Definition: admin_design.inc.php:45
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
member_auth
member_auth($member=0, $error_handle=true, $bAjx=false)
Definition: admin.inc.php:262
mainFunc
mainFunc()
Definition: emaillog.php:51
ChWsbAdminSettings
Definition: ChWsbAdminSettings.php:35
$s
$s
Definition: embed.php:13
$iNameIndex
$iNameIndex
Definition: emaillog.php:20
$aTopItems
$aTopItems
Definition: emaillog.php:34
getLocaleDate
getLocaleDate($sTimestamp='', $iCode=CH_WSB_LOCALE_DATE_SHORT)
Definition: utils.inc.php:70
getLog
getLog()
Definition: emaillog.php:65
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10