corrade-http-templates – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 eva 1 <?php
2  
3 ###########################################################################
4 ## Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 ##
5 ###########################################################################
6 ## This is a script that retrieves the past conversations with avatars ##
7 ## from the chat store directory as an JSON encoded object. ##
8 ###########################################################################
9  
10 ###########################################################################
11 ## CONFIGURATION ##
12 ###########################################################################
13  
14 require_once('config.php');
15  
16 ###########################################################################
17 ## INTERNALS ##
18 ###########################################################################
19  
20 ####
21 # I. Initialize an array to hold the data.
22 $data = array();
23  
24 ####
25 # I. Walk through the chat directory and create the array.
26 array_walk(
27 array_diff(
28 scandir(
29 $CHAT_DIRECTORY
30 ),
31 array(
32 '.',
33 '..'
34 )
35 ), function($value) use(&$data) {
36 $fileName = explode('.', $value);
37 $fullName = explode(' ', $fileName[0]);
38 if(count($fullName) != 2) return;
39 array_push(
40 $data,
41 array(
42 "firstname" => $fullName[0],
43 "lastname" => $fullName[1]
44 )
45 );
46 }
47 );
48  
49 ####
50 # III. Dump the JSON data.
51 echo json_encode($data);
52  
53 ?>