Initial commit
[2ch-be.git] / zwitch / index.php
blob6c5adf6d8c04773d4158ac29858117da566c0d0d
1 <?php
2 include 'config.php';
3 include 'include/header.php';
5 function array_sort($array, $on, $order=SORT_ASC) {
6 $new_array = array();
7 $sortable_array = array();
8 if (count($array) > 0) {
9 foreach ($array as $k => $v) {
10 if (is_array($v)) {
11 foreach ($v as $k2 => $v2) {
12 if ($k2 == $on) {
13 $sortable_array[$k] = $v2;
16 } else {
17 $sortable_array[$k] = $v;
21 switch ($order) {
22 case SORT_ASC:
23 asort($sortable_array);
24 break;
25 case SORT_DESC:
26 arsort($sortable_array);
27 break;
30 foreach ($sortable_array as $k => $v) {
31 $new_array[$k] = $array[$k];
35 return $new_array;
38 <body>
39 <div class="container margintopandbottom">
40 <?php include 'menu.php'; ?>
41 <div class="col-md-12">
42 <div class="panel panel-default"><h1 class="centertext">Be Messaging Monitoring System</h1></div>
43 <?php
44 $inbox = new Message;
47 $dir = file(DB_PATH."idlist.log");
48 foreach($dir as $key){
49 $array[0] = explode("<><>", $key);
50 $worldofArray['directory'] = $inbox->loggedEmail($array[0][1], MDB_PATH);
51 $worldofArray['id'] = $array[0][0];
52 if(is_dir($worldofArray['directory'])){
53 $count = 0;
54 $hi = explode("/", $worldofArray['directory']);
55 $strReplaced = $array[0][1];
57 foreach (glob($worldofArray['directory']."*.dat") as $filename){
58 $count++;
59 $h = explode("/", $filename);
61 if($count>0){
62 $arrayContainer[] = array('directory' => $worldofArray['directory'], 'id' => $worldofArray['id'], 'conversation_count' => $count, 'email' => $strReplaced );
66 $arrayContainer = array_sort($arrayContainer, 'conversation_count', SORT_DESC);
67 $returned = array_values($arrayContainer);
68 // print_r($returned);
70 <table class="table table-bordered table-striped table-responsive">
71 <thead>
72 <td><strong>ID</strong></td>
73 <td><strong>Email</strong></td>
74 <td><strong>Number of Conversation</strong></td>
75 </thead>
76 <?php
77 $count = count($arrayContainer)/10;
78 if(strpos($count,".")>0)
79 $count = $count+1;
80 $p = (isset($_GET['p'])&&is_numeric($_GET['p']))?($_GET['p']*10):10;
81 $s = (isset($_GET['p'])&&is_numeric($_GET['p']))?$p-10:0;
83 for ($i=$s; $i < $p; $i++) {
84 if(isset($returned[$i]))
85 echo "<tr><td>{$returned[$i]['id']}</td><td><a href=\"conversation.php?em={$returned[$i]['email']}\">{$returned[$i]['email']}</a></td><td>{$returned[$i]['conversation_count']}</td></tr>";
87 echo "<ul class=\"pagination\" id='page'>";
88 for ($i=1; $i <= $count; $i++){
89 $active = ($_GET['p']==$i) ? 'class="active"' : '';
90 echo "<li {$active}><a href='{$livesitePath}index.php?p={$i}'>{$i}</a></li>";
92 echo "</ul>";
94 </table>
95 </div>
97 </div>
98 </body>
99 </html>