Commit 39540863 authored by lphuberdeau's avatar lphuberdeau

[ENH] Converting logslib

parent f1d0e263
......@@ -23,6 +23,9 @@
<service id="tiki.lib.filegal" class="FileGalLib">
<file>%kernel.root_dir%/lib/filegals/filegallib.php</file>
</service>
<service id="tiki.lib.logs" class="LogsLib">
<file>%kernel.root_dir%/lib/logs/logslib.php</file>
</service>
<service id="tiki.lib.memcache" class="Memcachelib">
<file>%kernel.root_dir%/lib/cache/memcachelib.php</file>
</service>
......
......@@ -11,7 +11,7 @@ if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
exit;
}
require_once ('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
/**
* Basic functions used by the accounting feature
......
......@@ -355,7 +355,7 @@ class AdminLib extends TikiLib
$query = "delete from `tiki_tags` where `tagName`=?";
$result = $this->query($query, array($tagname));
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_log('dump', "removed tag: $tagname");
return true;
}
......@@ -417,7 +417,7 @@ class AdminLib extends TikiLib
);
}
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_log('dump', "created tag: $tagname");
return true;
}
......@@ -459,7 +459,7 @@ class AdminLib extends TikiLib
);
}
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_log('dump', "recovered tag: $tagname");
return true;
}
......@@ -509,7 +509,7 @@ class AdminLib extends TikiLib
$tar->toTar("$dump_path/new.tar", FALSE);
unset ($tar);
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_log('dump', 'dump created');
}
......
......@@ -59,10 +59,10 @@ class TikiLdapLib
public function __construct($options)
{
// debug setting
global $logslib;
$logslib = TikiLib::lib('logs');
if (isset($options['debug']) && ($options['debug']===true || $options['debug']=='y' )&& ($logslib instanceof LogsLib)) {
$this->options['debug'] = true;
$this->logslib = &$logslib;
$this->logslib = $logslib;
}
// Configure the connection
......
......@@ -777,7 +777,7 @@ class BlogLib extends TikiDb_Bridge
}
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Posted', $blogId, 'blog', "blogId=$blogId&amp;postId=$id&amp;add=" . strlen($data) . "#postId$id", '', '', '', '', $contributions);
}
......@@ -818,7 +818,7 @@ class BlogLib extends TikiDb_Bridge
*/
function remove_post($postId)
{
global $tikilib;
$tikilib = TikiLib::lib('tiki');
$objectlib = TikiLib::lib('object');
$query = "select `blogId`, `data` from `tiki_blog_posts` where `postId`=?";
......@@ -831,7 +831,7 @@ class BlogLib extends TikiDb_Bridge
global $prefs;
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$param = "blogId=$blogId&amp;postId=$postId";
if ($blogId)
$param .= "&amp;del=" . strlen($res['data']);
......@@ -986,7 +986,7 @@ class BlogLib extends TikiDb_Bridge
$result = $this->query($query, array($blogId, $data, $excerpt, $user, $title, $priv, $wysiwyg, $postId));
}
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Updated', $blogId, 'blog', "blogId=$blogId&amp;postId=$postId#postId$postId", '', '', '', '', $contributions);
}
......
......@@ -78,7 +78,9 @@ class Cachelib
*/
function empty_cache( $dir_names = array('all'), $log_section = 'system' )
{
global $tikidomain, $logslib, $tikilib, $prefs;
global $tikidomain, $prefs;
$logslib = TikiLib::lib('logs');
$tikilib = TikiLib::lib('tiki');
if (!is_array($dir_names)) {
$dir_names = array($dir_names);
......@@ -271,7 +273,8 @@ class Cachelib
function cache_templates($path,$newlang)
{
global $prefs, $smarty, $tikidomain;
global $prefs, $tikidomain;
$smarty = TikiLib::lib('smarty');
$oldlang = $prefs['language'];
$prefs['language'] = $newlang;
......
......@@ -2516,11 +2516,12 @@ class Comments extends TikiLib
if ($prefs['feature_actionlog'] == 'y') {
include_once('lib/diff/difflib.php');
$bytes = diff2($comment['data'], $data, 'bytes');
global $logslib; include_once('lib/logs/logslib.php');
if ($comment['objectType'] == 'forum')
$logslib = TikiLib::lib('logs');
if ($comment['objectType'] == 'forum') {
$logslib->add_action('Updated', $comment['object'], $comment['objectType'], "comments_parentId=$threadId&amp;$bytes#threadId$threadId", '', '', '', '', $contributions);
else
} else {
$logslib->add_action('Updated', $comment['object'], 'comment', "type=".$comment['objectType']."&amp;$bytes#threadId$threadId", '', '', '', '', $contributions);
}
}
$comments->update(
array(
......@@ -2729,12 +2730,13 @@ class Comments extends TikiLib
global $prefs;
if ($prefs['feature_actionlog'] == 'y') {
$logslib = TikiLib::lib('logs');
global $tikilib;
if ($parentId == 0)
$tikilib = TikiLib::lib('tiki');
if ($parentId == 0) {
$l = strlen($data);
else
} else {
$l = $tikilib->strlen_quoted($data);
if ($object[0] == 'forum')
}
if ($object[0] == 'forum') {
$logslib->add_action(
($parentId == 0)? 'Posted': 'Replied',
$object[1],
......@@ -2746,7 +2748,7 @@ class Comments extends TikiLib
'',
$contributions
);
else
} else {
$logslib->add_action(
($parentId == 0)? 'Posted': 'Replied',
$object[1],
......@@ -2758,6 +2760,7 @@ class Comments extends TikiLib
'',
$contributions
);
}
}
if ($prefs['feature_contribution'] == 'y') {
......
......@@ -251,8 +251,8 @@ class ContributionLib extends TikiLib
*/
function update($action, $contributions, $delay=15)
{
global $tikilib;
global $logslib; include_once('lib/logs/logslib.php');
$tikilib = TikiLib::lib('tiki');
$logslib = TikiLib::lib('logs');
if ($action['objectType'] == 'wiki page' && $action['action'] != 'Removed') {
// try to find an history
......
......@@ -246,7 +246,7 @@ class FileGalLib extends TikiLib
if ( ! $disable_notifications ) $this->notify($fileInfo['galleryId'], $fileInfo['name'], $fileInfo['filename'], '', 'remove file', $user);
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Removed', $fileId . '/' . $fileInfo['filename'], 'file', '');
}
......@@ -347,7 +347,7 @@ class FileGalLib extends TikiLib
}
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Uploaded', $galleryId, 'file gallery', "fileId=$fileId&amp;add=$size");
}
......@@ -3145,7 +3145,10 @@ class FileGalLib extends TikiLib
// TODO: This does not necessarily handle a file upload. Just edits a file. File replacements are handled somewhere else.
private function _actionHandler_uploadFile( $params )
{
global $user, $prefs, $tikilib, $logslib, $smarty, $tiki_p_admin, $tiki_p_batch_upload_files;
global $user, $prefs, $tiki_p_admin, $tiki_p_batch_upload_files;
$logslib = TikiLib::lib('logs');
$smarty = TikiLib::lib('smarty');
$tikilib = TikiLib::lib('tiki');
$batch_job = false;
$didFileReplace = false;
......
......@@ -1034,7 +1034,7 @@ class ImageGalsLib extends TikiLib
}
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Uploaded', $galleryId, 'image gallery', 'imageId=' . $imageId);
}
......
......@@ -1797,4 +1797,3 @@ class LogsLib extends TikiLib
}
}
$logslib = new LogsLib;
......@@ -1482,7 +1482,7 @@ class TikiSheetDatabaseHandler extends TikiSheetDataHandler
}
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$add = 0;
$del = 0;
foreach( $inserts as $values ) {
......
......@@ -303,7 +303,7 @@ class SheetLib extends TikiLib
$this->remove_related_sheet( $sheetId );
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Removed', $sheetId, 'sheet');
}
}
......@@ -318,7 +318,7 @@ class SheetLib extends TikiLib
$sheetId = $this->getOne( "SELECT MAX(`sheetId`) FROM `tiki_sheets` WHERE `author` = ?", array( $author ) );
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$query = 'select `sheetId` from `tiki_sheets` where `title`=? and `description`= ? and `author`=?';
$id = $this->getOne($query, array($title, $description, $author ) );
$logslib->add_action('Created', $id, 'sheet');
......@@ -444,7 +444,7 @@ class SheetLib extends TikiLib
}
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Spreadsheet-Rollback', $id, 'sheet');
}
......@@ -508,7 +508,7 @@ class SheetLib extends TikiLib
}
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Cloning', $sheetId, 'sheet');
$logslib->add_action('Cloned', $newSheetId, 'sheet');
}
......
......@@ -10,7 +10,7 @@ if (strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !== false) {
header('location: index.php');
exit;
}
require_once ('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
/**
......
......@@ -68,9 +68,6 @@ class TikiLib extends TikiDb_Bridge
case 'smarty':
global $smarty;
return self::$libraries[$name] = $smarty;
case 'logs':
global $logslib; include_once('lib/logs/logslib.php');
return self::$libraries[$name] = $logslib;
case 'logsqry':
global $logsqrylib; include_once('lib/logs/logsquerylib.php');
return self::$libraries[$name] = $logsqrylib;
......
......@@ -232,7 +232,7 @@ class UsersLib extends TikiLib
*/
function user_logout($user, $remote = false, $redir = '')
{
global $prefs, $logslib, $lslib, $user_cookie_site;
global $prefs, $user_cookie_site;
$logslib->add_log('login', 'logged out');
......@@ -260,7 +260,8 @@ class UsersLib extends TikiLib
// go offline in Live Support
if ($prefs['feature_live_support'] == 'y') {
global $access; include_once ('lib/live_support/lslib.php');
$access = TikiLib::lib('access');
global $lslib; include_once ('lib/live_support/lslib.php');
if ($lslib->get_operator_status($user) != 'offline') {
$lslib->set_operator_status($user, 'offline');
}
......@@ -792,7 +793,7 @@ class UsersLib extends TikiLib
// would probably be better do flag the user as not active? How do you do that?
// and it also would be better to check if the user is active first.. :)
$this->invalidate_account($user);
global $logslib;
$logslib = TikiLib::lib('logs');
$logslib->add_log('auth_phpbb', 'NOTICE: Invalidated user ' . $user . ' due to missing phpBB account.');
}
return array(false, $user, ACCOUNT_DISABLED);
......@@ -991,7 +992,7 @@ class UsersLib extends TikiLib
}
global $prefs;
global $logslib;
$logslib = TikiLib::lib('logs');
// First connection on the ldap server in anonymous, now we can search the real name of the $user
// It's required to pass in param the username & password because the username is used to determine the realname (dn)
......@@ -1080,7 +1081,7 @@ class UsersLib extends TikiLib
function ldap_sync_all_users()
{
global $prefs;
global $logslib;
$logslib = TikiLib::lib('logs');
if ($prefs['syncUsersWithDirectory'] != 'y') {
return false;
......@@ -1176,7 +1177,7 @@ class UsersLib extends TikiLib
if ( $user == 'admin' ) return true;
global $prefs;
global $logslib;
$logslib = TikiLib::lib('logs');
$ret = true;
$this->init_ldap($user, $pass);
......@@ -1224,7 +1225,7 @@ class UsersLib extends TikiLib
if ( $user == 'admin' ) return true;
global $prefs;
global $logslib;
$logslib = TikiLib::lib('logs');
static $ldap_group_options = array();
static $ext_dir = null;
$ret = true;
......@@ -1308,7 +1309,7 @@ class UsersLib extends TikiLib
function ldap_sync_group_data($user, $ldapgroups)
{
global $prefs;
global $logslib;
$logslib = TikiLib::lib('logs');
if (!count($ldapgroups)) {
return;
......@@ -6896,7 +6897,7 @@ class UsersLib extends TikiLib
$this->query($query, array('', $tikilib->now, 0, $this->now, $user, $res['provpass']));
if (!empty($GLOBALS['user'])) {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_log('login', 'confirm email '.$user);
}
TikiLib::lib('user')->set_unsuccessful_logins($_REQUEST['user'], 0);
......
......@@ -465,17 +465,10 @@ class Watershed_SoapServer
private function loginBySession( $sessionId )
{
require ('db/local.php');
$watersheddb = mysql_connect($host_tiki, $user_tiki, $pass_tiki);
mysql_select_db($dbs_tiki, $watersheddb);
$query = "SELECT `user` FROM `tiki_user_preferences` WHERE prefName = 'watershed_sessionId' AND value = '$sessionId'";
$result = mysql_query($query, $watersheddb);
if (is_resource($result)) {
while ($res = mysql_fetch_assoc($result)) {
$u = $res['user'];
}
}
if (isset($u)) {
$db = TikiDb::get();
$table = $db->table('tiki_user_preferences');
$u = $this->fetchOne('user', array('prefName' => 'watershed_sessionId', 'value' => $sessionId));
if ($u) {
$this->user = $this->loginUser($u);
} else {
$this->user = '';
......@@ -485,26 +478,8 @@ class Watershed_SoapServer
private function loginUser( $u )
{
require ('db/local.php');
$watersheddb = mysql_connect($host_tiki, $user_tiki, $pass_tiki);
mysql_select_db($dbs_tiki, $watersheddb);
$query = "SELECT `value` FROM `tiki_preferences` WHERE name = 'cookie_name'";
$result = mysql_query($query, $watersheddb);
if (is_resource($result)) {
while ($res = mysql_fetch_assoc($result)) {
$cookie_name = $res['value'];
}
}
if (empty($cookie_name)) {
$cookie_name = 'tikiwiki';
}
$cookie_site = preg_replace('/[^a-zA-Z0-9]/', '', $cookie_name);
$user_cookie_site = 'tiki-user-' . $cookie_site;
TikiLib::lib('login')->activateSession($u);
session_start();
$_SESSION[$user_cookie_site] = $u;
global $user;
$user = $u;
return $u;
......@@ -512,7 +487,7 @@ class Watershed_SoapServer
function initiateEnv()
{
global $prefs, $watershedlib, $tikilib, $smarty;
global $prefs;
require_once ('lib/setup/third_party.php');
require_once ('tiki-setup_base.php');
require_once ('lib/setup/sections.php');
......@@ -562,7 +537,7 @@ class Watershed_SoapServer
$ret->authMessage = tra('No permission to broadcast to any channel');
}
if ($prefs['watershed_log_errors'] == 'y') {
global $logslib;
$logslib = TikiLib::lib('logs');
$logslib->add_log('watershed', $ret->authMessage);
}
return $ret;
......@@ -574,7 +549,7 @@ class Watershed_SoapServer
global $prefs;
if ($prefs['watershed_log_errors'] == 'y') {
global $logslib;
$logslib = TikiLib::lib('logs');
$error = $message->brandId . ': ' . $message->message . ' (' . $message->priority . ')';
$logslib->add_log('watershed', $error);
}
......@@ -613,7 +588,7 @@ class Watershed_SoapServer
$ret->authMessage = tra('Failed to log in mobile broadcaster');
}
if ($prefs['watershed_log_errors'] == 'y') {
global $logslib;
$logslib = TikiLib::lib('logs');
$logslib->add_log('watershed', $ret->authMessage);
}
return $ret;
......@@ -623,7 +598,8 @@ class Watershed_SoapServer
{
// This is used for Flash Media Encoder shared secret authentication only
$this->initiateEnv();
global $prefs, $watershedlib, $tikilib;
global $prefs, $watershedlib;
$tikilib = TikiLib::lib('tiki');
$ret = new Watershed_SoapServer_loginBroadcasterByChannelTokenResponse;
if (isset($prefs['watershed_fme_key']) && $token->channelToken == $prefs['watershed_fme_key']) {
$ret->sessionId = md5('watershedfmeuser' . $tikilib->now . rand(100000, 999999));
......@@ -633,7 +609,7 @@ class Watershed_SoapServer
$ret->authMessage = tra('Failed to log in FME');
}
if ($prefs['watershed_log_errors'] == 'y') {
global $logslib;
$logslib = TikiLib::lib('logs');
$logslib->add_log('watershed', $ret->authMessage);
}
return $ret;
......@@ -644,7 +620,7 @@ class Watershed_SoapServer
$this->initiateEnv();
global $prefs;
if ($prefs['watershed_log_errors'] == 'y') {
global $logslib;
$logslib = TikiLib::lib('logs');
$error = $status->brandId . ': ' . $status->channelCode . ': ' . $status->status;
$logslib->add_log('watershed', $error);
}
......@@ -684,7 +660,7 @@ class Watershed_SoapServer
$ret->authMessage = tra('No permission to view any channel');
}
if ($prefs['watershed_log_errors'] == 'y') {
global $logslib;
$logslib = TikiLib::lib('logs');
$logslib->add_log('watershed', $ret->authMessage);
}
return $ret;
......@@ -702,7 +678,7 @@ class Watershed_SoapServer
}
if ($prefs['watershed_log_errors'] == 'y') {
global $logslib;
$logslib = TikiLib::lib('logs');
$logslib->add_log('watershed', $error);
}
return new Watershed_SoapServer_AcknowledgeResponse;
......
......@@ -543,7 +543,7 @@ function wikiplugin_tracker($data, $params)
}
if (!empty($itemId)) {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Viewed', $itemId, 'trackeritem', $_SERVER['REQUEST_URI']);
}
......@@ -566,7 +566,7 @@ function wikiplugin_tracker($data, $params)
if (!isset($_REQUEST["ok"]) || $_REQUEST["ok"] == "n" || !$thisIsThePlugin || isset($_REQUEST['tr_preview'])) {
$field_errors = array('err_mandatory'=>array(), 'err_value'=>array());
global $notificationlib; include_once('lib/notifications/notificationlib.php');
$notificationlib = TikiLib::lib('notification');
$tracker = $trklib->get_tracker($trackerId);
$tracker = array_merge($tracker, $trklib->get_tracker_options($trackerId));
if ((!empty($tracker['start']) && $tikilib->now < $tracker['start']) || (!empty($tracker['end']) && $tikilib->now > $tracker['end']))
......
......@@ -185,7 +185,7 @@ function wikiplugin_trackeritemfield($data, $params)
$memoTrackerId = $info['trackerId'];
$memoItemObject = $itemObject;
if (isset($_REQUEST['itemId']) && $_REQUEST['itemId'] != $itemId) {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Viewed', $itemId, 'trackeritem', $_SERVER['REQUEST_URI'].'&trackeritemfield');
}
}
......
......@@ -22,7 +22,7 @@ class HistLib extends TikiLib
{
global $prefs;
if ($prefs['feature_contribution'] == 'y') {
global $contributionlib; include_once('lib/contribution/contributionlib.php');
$contributionlib = TikiLib::lib('contribution');
if ($historyId == '') {
$query = 'select `historyId` from `tiki_history` where `pageName`=? and `version`=?';
$historyId = $this->getOne($query, array($page, $version));
......@@ -31,7 +31,7 @@ class HistLib extends TikiLib
}
$query = "delete from `tiki_history` where `pageName`=? and `version`=?";
$result = $this->query($query, array($page,$version));
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action("Removed version", $page, 'wiki page', "version=$version");
//get_strings tra("Removed version $version")
return true;
......@@ -101,7 +101,7 @@ class HistLib extends TikiLib
global $prefs;
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action("Rollback", $page, 'wiki page', "version=$version");
}
//get_strings tra("Changed actual version to $version");
......@@ -231,9 +231,9 @@ class HistLib extends TikiLib
$aux["is_html"] = $res["is_html"];
//$aux["percent"] = levenshtein($res["data"],$actual);
if ($prefs['feature_contribution'] == 'y') {
global $contributionlib; include_once('lib/contribution/contributionlib.php');
$contributionlib = TikiLib::lib('contribution');
$aux['contributions'] = $contributionlib->get_assigned_contributions($res['historyId'], 'history');
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$aux['contributors'] = $logslib->get_wiki_contributors($aux);
}
$ret[] = $aux;
......
......@@ -533,7 +533,7 @@ class WikiLib extends TikiLib
$query = "delete from `tiki_wiki_attachments` where `attId`=?";
$result = $this->query($query, array($attId));
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Removed', $attId, 'wiki page attachment');
}
}
......@@ -564,7 +564,7 @@ class WikiLib extends TikiLib
sendWikiEmailNotification('wiki_file_attached', $page, $user, $comment, '', $name, '', '', false, '', 0, $attId);
}
if ($prefs['feature_actionlog'] == 'y') {
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Created', $attId, 'wiki page attachment', '', $user);
}
return $attId;
......@@ -789,7 +789,7 @@ class WikiLib extends TikiLib
} else {
$this->remove_all_versions($page);
}
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$logslib->add_action('Removed last version', $page, 'wiki page', $comment);
//get_strings tra("Removed last version");
}
......@@ -807,8 +807,8 @@ class WikiLib extends TikiLib
*/
public function get_pages_by_alias($alias)
{
global $prefs, $semanticlib;
require_once 'lib/wiki/semanticlib.php';
global $prefs;
$semanticlib = TikiLib::lib('semantic');
$pages = array();
......
......@@ -47,9 +47,10 @@ function module_last_actions_info()
*/
function module_last_actions($mod_reference, $module_params)
{
global $tiki_p_admin, $user, $smarty;
global $tiki_p_admin, $user;
$smarty = TikiLib::lib('smarty');
if ($user) {
global $logslib; require_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
$results = $logslib->list_actions('', '', $tiki_p_admin == 'y' ? '' : $user, 0, $mod_reference["rows"]);
$actions = $results['data'];
......
......@@ -40,7 +40,7 @@ function lograw($file, $line)
*/
function logit($file, $txt, $user, $code, $from)
{
global $tikilib;
$tikilib = TikiLib::lib('tiki');
$line = $tikilib->get_ip_address() . " - $user - " . date('[m/d/Y:H:i:s]') . " \"$txt\" $code \"$from\"";
lograw($file, $line);
}
......@@ -303,7 +303,10 @@ function get_user_info($params)
*/
function get_registration_prefs($params)
{
global $tikilib, $prefs, $registrationlib, $logslib;
global $prefs;
$logslib = TikiLib::lib('logs');
$tikilib = TikiLib::lib('tiki');
$registrationlib = TikiLib::lib('registration');
$key = $params->getParam(0);
$key = $key->scalarval();
......@@ -323,8 +326,6 @@ function get_registration_prefs($params)
)
return new XML_RPC_Response(0, 101, 'Users are not allowed to register via intertiki on this master.');
require_once 'lib/registration/registrationlib.php';
return new XML_RPC_Response(XML_RPC_encode($registrationlib->merged_prefs));
}
......@@ -334,7 +335,10 @@ function get_registration_prefs($params)
*/
function register_user($params)
{
global $tikilib, $prefs, $registrationlib, $logslib;
global $prefs;
$logslib = TikiLib::lib('logs');
$tikilib = TikiLib::lib('tiki');
$registrationlib = TikiLib::lib('registration');
$key = $params->getParam(0);
$key = $key->scalarval();
......@@ -354,8 +358,6 @@ function register_user($params)
)
return new XML_RPC_Response(0, 101, 'Users are not allowed to register via intertiki on this master.');
require_once 'lib/registration/registrationlib.php';
$result=$registrationlib->register_new_user_from_intertiki(XML_RPC_decode($params->getParam(1)));
return new XML_RPC_Response(XML_RPC_encode($result));
......
......@@ -11,13 +11,13 @@
$section = 'admin';
require_once ('tiki-setup.php');
include_once ('lib/admin/adminlib.php');
$adminlib = TikiLib::lib('admin');
$tikifeedback = array();
$auto_query_args = array('page');
$access->check_permission('tiki_p_admin');
global $logslib; include_once('lib/logs/logslib.php');
$logslib = TikiLib::lib('logs');
/**
* Display feedback on prefs changed
......@@ -51,7 +51,10 @@ function add_feedback( $name, $message, $st, $num = null )
*/
function simple_set_toggle($feature)
{
global $_REQUEST, $tikilib, $smarty, $prefs, $logslib;
global $prefs;
$logslib = TikiLib::lib('logs');
$tikilib = TikiLib::lib('tiki');
$smarty = TikiLib::lib('smarty');
if (isset($_REQUEST[$feature]) && $_REQUEST[$feature] == 'on') {
if ((!isset($prefs[$feature]) || $prefs[$feature] != 'y')) {
// not yet set at all or not set to y
......@@ -84,7 +87,10 @@ function simple_set_toggle($feature)
*/
function simple_set_value($feature, $pref = '', $isMultiple = false)
{
global $_REQUEST, $tikilib, $prefs, $logslib;
global $prefs;
$logslib = TikiLib::lib('logs');