5 Jappix - An open social platform
6 The SVG loader for Jappix statistics
8 -------------------------------------------------
12 Last revision: 28/12/10
17 define('JAPPIX_BASE', '..');
20 require_once('./functions.php');
21 require_once('./functions-manager.php');
23 // Get the configuration
24 require_once('./read-main.php');
25 require_once('./read-hosts.php');
28 require_once('./drawsvgchart.php');
29 require_once('./gettext.php');
31 // Optimize the page rendering
38 // Check if the user is authorized
41 if((isset($_SESSION['jappix_user']) && !empty($_SESSION['jappix_user'])) && (isset($_SESSION['jappix_password']) && !empty($_SESSION['jappix_password']))) {
42 // Get the session values
43 $user = $_SESSION['jappix_user'];
44 $password = $_SESSION['jappix_password'];
46 // Checks the user is admin
47 $is_admin = isAdmin($user, $password);
50 // Not admin? Stop the script!
55 if((isset($_GET['g']) && !empty($_GET['g'])))
61 if((isset($_GET['l']) && !empty($_GET['l'])))
66 // Include the translations
67 includeTranslation($locale, 'main');
69 $drawsvgchart = new DrawSVGChart;
76 if($graph == 'access') {
78 $elements = getMonthlyVisits();
79 $legend = array(array('#5276A9', T_("Visits")));
84 else if($graph == 'share') {
86 $elements = largestShare(shareStats(), 8);
87 $legend = array(array('#5276A9', T_("Size")));
91 else if($graph == 'others') {
93 $elements = otherStats();
94 $legend = array(array('#5276A9', T_("Size")));
98 $svgchart = $drawsvgchart->createChart($elements, $legend, $link, $evolution, $graph);
101 if(!$drawsvgchart->has_errors()) {
102 header('Content-Type: image/svg+xml; charset=utf-8');
103 echo $drawsvgchart->getXMLOutput();