Initial commit
[2ch-be.git] / dev-test / old_dev / zwitch / termc.php
blobf98409d29c3d938ef98047d2be1489b07274d14b
1 <?php
2 include 'config.php';
4 function array_sort($array, $on, $order=SORT_ASC) {
5 $new_array = array();
6 $sortable_array = array();
7 if (count($array) > 0) {
8 foreach ($array as $k => $v) {
9 if (is_array($v)) {
10 foreach ($v as $k2 => $v2) {
11 if ($k2 == $on) {
12 $sortable_array[$k] = $v2;
15 } else {
16 $sortable_array[$k] = $v;
20 switch ($order) {
21 case SORT_ASC:
22 asort($sortable_array);
23 break;
24 case SORT_DESC:
25 arsort($sortable_array);
26 break;
29 foreach ($sortable_array as $k => $v) {
30 $new_array[$k] = $array[$k];
34 return $new_array;
38 echo "Be Messaging Monitoring System".PHP_EOL;
40 $inbox= new Message;
41 $dir = file(DB_PATH."idlist.log");
42 foreach($dir as $key){
43 $array[0] = explode("<><>", $key);
44 $worldofArray['directory'] = $inbox->loggedEmail($array[0][1], MDB_PATH);
45 $worldofArray['id'] = $array[0][0];
46 if(is_dir($worldofArray['directory'])){
47 $count = 0;
48 $hi = explode("/", $worldofArray['directory']);
49 $strReplaced = trim($array[0][1]);
51 foreach (glob($worldofArray['directory']."*.dat") as $filename){
52 $count++;
54 $arrayContainer[] = array('directory' => $worldofArray['directory'], 'id' => $worldofArray['id'], 'conversation_count' => $count, 'email' => $strReplaced );
57 $arrayContainer= array_sort($arrayContainer, 'conversation_count', SORT_DESC);
58 $returned = array_values($arrayContainer);
59 for ($i=0; $i < 10; $i++) {
60 if(isset($returned[$i]))
61 echo "{$returned[$i]['id']}|| {$returned[$i]['email']} || {$returned[$i]['conversation_count']}".PHP_EOL;