add wiki script
This commit is contained in:
parent
0e87f62558
commit
adb0989b22
3 changed files with 65 additions and 17 deletions
|
@ -4,15 +4,8 @@
|
|||
position: relative;
|
||||
}
|
||||
.header img {
|
||||
transition: 1s;
|
||||
margin-right: 1em;
|
||||
}
|
||||
.header img:hover {
|
||||
transition: 1s;
|
||||
position: absolute;
|
||||
height: 400px;
|
||||
z-index: 999;
|
||||
}
|
||||
.entete {
|
||||
background-color: rgb(33, 36, 32);
|
||||
color: rgb(240, 233, 233);
|
||||
|
|
|
@ -194,16 +194,6 @@
|
|||
<div>
|
||||
<div>Les dernières pages modifiées</div>
|
||||
<ul>
|
||||
<li><a href="">#general</a></li>
|
||||
<li><a href="">#general</a></li>
|
||||
<li><a href="">#general</a></li>
|
||||
<li><a href="">#general</a></li>
|
||||
<li><a href="">#general</a></li>
|
||||
<li><a href="">#general</a></li>
|
||||
<li><a href="">#general</a></li>
|
||||
<li><a href="">#general</a></li>
|
||||
<li><a href="">#general</a></li>
|
||||
<li><a href="">#general</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
|
|
65
tools/wiki/stats.php
Normal file
65
tools/wiki/stats.php
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
# copy this at the root of tiki
|
||||
|
||||
require 'db/local.php';
|
||||
|
||||
$db = new mysqli('localhost', $user_tiki, $pass_tiki, $dbs_tiki);
|
||||
|
||||
if ($db->connect_errno) {
|
||||
echo mysqli_connect_error();
|
||||
exit;
|
||||
}
|
||||
|
||||
$db->set_charset("utf8");
|
||||
|
||||
function getone($query) {
|
||||
global $db;
|
||||
$result = $db->query($query);
|
||||
return $result->fetch_row()[0];
|
||||
}
|
||||
function getlist($query) {
|
||||
global $db;
|
||||
$result = $db->query($query);
|
||||
$back = array();
|
||||
while ($row = $result->fetch_row()) {
|
||||
$back[$row[0]] = $row[1];
|
||||
}
|
||||
return $back;
|
||||
}
|
||||
|
||||
$interval = "unix_timestamp(date_sub(current_date(), interval 30 day))";
|
||||
|
||||
$data = array(
|
||||
'crapauds' => array(
|
||||
'total' => 0,
|
||||
'recent' => 0
|
||||
),
|
||||
'pages' => array(
|
||||
'total' => 0,
|
||||
'recent' => 0,
|
||||
'liste' => array()
|
||||
),
|
||||
'photos' => array(
|
||||
'total' => 0,
|
||||
'recent' => 0
|
||||
)
|
||||
);
|
||||
|
||||
$data['crapauds']['total'] = getone("select count(*) from users_users");
|
||||
$data['crapauds']['recent'] = getone("select count(*) from users_users where currentLogin > $interval");
|
||||
|
||||
$data['pages']['total'] = getone("select count(*) from tiki_pages");
|
||||
$data['pages']['recent'] = getone("select count(*) from tiki_pages where lastModif > $interval");
|
||||
$data['pages']['liste'] = getlist("select pageSlug, pageName from tiki_pages order by lastModif desc limit 10");
|
||||
|
||||
$data['photos']['total'] = getone("select count(*) from tiki_files");
|
||||
$data['photos']['recent'] = getone("select count(*) from tiki_files where created > $interval");
|
||||
|
||||
header('Content-Type: application/json');
|
||||
$json = json_encode( (object) $data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|
||||
|
||||
if ($json === false) {
|
||||
$json = json_encode(array("jsonError", json_last_error_msg()));
|
||||
}
|
||||
|
||||
echo $json;
|
Loading…
Reference in a new issue