Initial commit
[2ch-be.git] / dev-test / zwitch / index.php
blobaa78234f11039df49c0193d6577d8ade8b242a66
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 // print_r($arrayContainer);
67 $arrayContainer = array_sort($arrayContainer, 'conversation_count', SORT_DESC);
68 $returned = array_values($arrayContainer);
69 // print_r($returned);
71 <table class="table table-bordered table-striped table-responsive">
72 <thead>
73 <td><strong>ID</strong></td>
74 <td><strong>Email</strong></td>
75 <td><strong>Number of Conversation</strong></td>
76 </thead>
77 <?php
78 $count = count($arrayContainer)/10;
79 if(strpos($count,".")>0)
80 $count = $count+1;
81 $p = (isset($_GET['p'])&&is_numeric($_GET['p']))?($_GET['p']*10):10;
82 $s = (isset($_GET['p'])&&is_numeric($_GET['p']))?$p-10:0;
84 for ($i=$s; $i < $p; $i++) {
85 if(isset($returned[$i]))
86 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>";
88 echo "<ul class=\"pagination\" id='page'>";
89 for ($i=1; $i <= $count; $i++){
90 $active = ($_GET['p']==$i) ? 'class="active"' : '';
91 echo "<li {$active}><a href='{$livesitePath}index.php?p={$i}'>{$i}</a></li>";
93 echo "</ul>";
95 </table>
96 </div>
98 </div>
99 </body>
100 </html>