From 47a278636bdaa5a0924ad2225e292a392fe529ab Mon Sep 17 00:00:00 2001 From: Quitta Date: Sat, 29 Jun 2013 06:46:10 +0200 Subject: [PATCH] added libuserlist page, that shows entire list of users in the lib db, admins can remove entry of it and perform manual syncing. Still needs some work though --- .../ryzom_ams/ams_lib/translations/en.ini | 2 + .../tools/server/ryzom_ams/www/config.php | 2 +- .../ryzom_ams/www/html/inc/libuserlist.php | 50 +++++++++++++++++++ .../www/html/templates/libuserlist.tpl | 26 ++++++++++ 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/inc/libuserlist.php create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/templates/libuserlist.tpl diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini index c60e5a621..71bcdb9fe 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini @@ -3,6 +3,8 @@ [home] +[libuserlist] + [userlist] userlist_info = "welcome to the userlist" diff --git a/code/ryzom/tools/server/ryzom_ams/www/config.php b/code/ryzom/tools/server/ryzom_ams/www/config.php index b896879a9..5141359cc 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/config.php +++ b/code/ryzom/tools/server/ryzom_ams/www/config.php @@ -19,7 +19,7 @@ $cfg['db']['lib']['name'] = 'ryzom_ams_lib'; $cfg['db']['lib']['user'] = 'root'; $cfg['db']['lib']['pass'] = 'lol123'; -$cfg['db']['shard']['host'] = 'localhost'; +$cfg['db']['shard']['host'] = 'localhosti'; $cfg['db']['shard']['port'] = '3306'; $cfg['db']['shard']['name'] = 'nel'; $cfg['db']['shard']['user'] = 'shard'; diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/libuserlist.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/libuserlist.php new file mode 100644 index 000000000..5d6128f09 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/libuserlist.php @@ -0,0 +1,50 @@ +executeWithoutParams("SELECT * FROM ams_querycache")->rowCount(); + +//This is the number of results displayed per page +$page_rows = 2; + +//This tells us the page number of our last page +$last = ceil($rows/$page_rows); + +//this makes sure the page number isn't below one, or more than our maximum pages +if ($pagenum < 1) +{ + $pagenum = 1; +}else if ($pagenum > $last) { + $pagenum = $last; +} + +//This sets the range to display in our query +$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; + +//This is your query again, the same one... the only difference is we add $max into it +$data = $dbl->executeWithoutParams("SELECT * FROM ams_querycache $max"); + +//This is where we put the results in a resultArray to be sent to smarty + +$pageResult['liblist'] = Array(); +$i = 0; +while($row = $data->fetch(PDO::FETCH_ASSOC)){ + $decode = json_decode($row['query']); + $pageResult['liblist'][$i]['id'] = $row['SID']; + $pageResult['liblist'][$i]['type'] = $row['type']; + $pageResult['liblist'][$i]['name'] = $decode[0]; + $pageResult['liblist'][$i]['mail'] = $decode[2]; + $i++; +} +$pageResult['permission'] = 1; +$pageResult['no_visible_elements'] = 'FALSE'; +helpers :: loadtemplate( 'libuserlist', $pageResult); +exit(); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/libuserlist.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/libuserlist.tpl new file mode 100644 index 000000000..4cf8f99a4 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/libuserlist.tpl @@ -0,0 +1,26 @@ +{block name=content} + +
+
+
+

The users in the libDB

+
+ + + + +
+
+
+ + + {foreach from=$liblist item=element} + + {/foreach} +
IDtypeuseremailremove
{$element.id}{$element.type}{$element.name}{$element.mail}Delete
+
+
+
+
+{/block} +