'.__('You don\'t have enough privileges to view this section').''); } // log data save action if (isset($_POST['saveLogs']) AND $can_write AND $_SESSION['uid'] == 1) { $logs = $dbs->query('SELECT log_date, log_location, log_msg FROM system_log ORDER BY log_date DESC'); header('Content-Type: text/plain'); header('Content-Disposition: attachment; filename="system_logs_'.date('Ymd').'.log"'); echo 'SENAYAN system logs record'."\n"; while ($logs_d = $logs->fetch_row()) { echo '['.$logs_d[0].']---'.$logs_d[1].'---'.$logs_d[2]."\n"; } exit(); } // log data clearance action if (isset($_POST['clearLogs']) AND $can_write AND $_SESSION['uid'] == 1) { $dbs->query('TRUNCATE TABLE system_log'); utility::jsAlert(__('System Log data completely cleared!')); echo ''; exit(); } /* search form */ ?> setSQLColumn( 'sl.log_date AS \''.__('Time').'\'', 'sl.log_location AS \''.__('Location').'\'', 'sl.log_msg AS \''.__('Message').'\''); $datagrid->setSQLorder('sl.log_date DESC'); // is there any search if (isset($_GET['keywords']) AND $_GET['keywords']) { $keyword = $dbs->escape_string(trim($_GET['keywords'])); $words = explode(' ', $keyword); if (count($words) > 1) { $concat_sql = ' ('; foreach ($words as $word) { $concat_sql .= " (sl.log_date LIKE '%$word%' OR sl.log_msg LIKE '%$word%') AND"; } // remove the last AND $concat_sql = substr_replace($concat_sql, '', -3); $concat_sql .= ') '; $datagrid->setSQLCriteria($concat_sql); } else { $datagrid->setSQLCriteria("sl.log_date LIKE '%$keyword%' OR sl.log_msg LIKE '%$keyword%'"); } } // set table and table header attributes $datagrid->table_attr = 'align="center" id="dataList" cellpadding="5" cellspacing="0"'; $datagrid->table_header_attr = 'class="dataListHeader" style="font-weight: bold;"'; // set delete proccess URL $datagrid->delete_URL = $_SERVER['PHP_SELF']; $datagrid->column_width = array('18%', '10%', '72%'); $datagrid->disableSort('Message'); // put the result into variables $datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 50, false); if (isset($_GET['keywords']) AND $_GET['keywords']) { $msg = str_replace('{result->num_rows}', $datagrid->num_rows, __('Found {result->num_rows} from your keywords')); //mfc echo '
'.$msg.' : "'.$_GET['keywords'].'"
'; } echo $datagrid_result; /* main content end */