function getSubGraph($params) { global $dbTiki, $base_url; $userlib = new UsersLib; $nodeName = $params->getParam(0); $nodeName = $nodeName->scalarVal(); $depth = $params->getParam(1); $depth = $depth->scalarVal(); $nodes = array(); $passed = array($nodeName => true); $queue = array($nodeName); $i = 0; $neighbours = array(); while ($i <= $depth && count($queue) > 0) { $nextQueue = array(); foreach ($queue as $nodeName) { $similar = $userlib->related_users($nodeName, 5); if (isset($neighbours[$nodeName])) { $myNeighbours = $neighbours[$nodeName]; } else { $myNeighbours = array(); } foreach ($similar as $user) { $myNeighbours[] = $user['login']; $neighbours[$user['login']][] = $nodeName; } $temp_max = count($myNeighbours); for ($j = 0; $j < $temp_max; $j++) { if (!isset($passed[$myNeighbours[$j]])) { $nextQueue[] = $myNeighbours[$j]; $passed[$myNeighbours[$j]] = true; } $myNeighbours[$j] = new XML_RPC_Value($myNeighbours[$j]); } $node = array(); $actionUrl = "javascript:listObjects('$nodeName');"; $color = '#0000FF'; $node['neighbours'] = new XML_RPC_Value($myNeighbours, "array"); if (!empty($color)) { $node['color'] = new XML_RPC_Value($color, "string"); } $node['actionUrl'] = new XML_RPC_Value($actionUrl, "string"); $nodes[$nodeName] = new XML_RPC_Value($node, "struct"); } $i++; $queue = $nextQueue; } $response = array("graph" => new XML_RPC_Value($nodes, "struct")); return new XML_RPC_Response(new XML_RPC_Value($response, "struct")); }
private function removeUsers(array $users, $page = false, $trackerIds = [], $files = false) { global $user; foreach ($users as $deleteuser) { if ($deleteuser != 'admin') { // remove the user's objects, wiki page first if ($page) { global $prefs; $page = $prefs['feature_wiki_userpage_prefix'] . $deleteuser; Services_Exception_Denied::checkObject('remove', 'wiki page', $page); $tikilib = TikiLib::lib('tiki'); $res = $tikilib->remove_all_versions($page); if ($res !== true) { throw new Services_Exception_NotFound(tr('An error occurred. User %0 could not be deleted', $deleteuser)); } } // then tracker items "owner" by the user if (!empty($trackerIds)) { $trklib = TikiLib::lib('trk'); $items = $trklib->get_user_items($deleteuser, false); foreach ($items as $item) { if (in_array($item['trackerId'], $trackerIds)) { $trklib->remove_tracker_item($item['itemId'], true); } } } // then tracker items "owner" by the user if ($files) { $filegallib = TikiLib::lib('filegal'); $galleryId = $filegallib->get_user_file_gallery($deleteuser); if ($galleryId) { $filegallib->remove_file_gallery($galleryId); } } // and finally remove the actual user (and other associated data) $res = $this->lib->remove_user($deleteuser); if ($res === true) { $logslib = TikiLib::lib('logs'); $logslib->add_log('adminusers', sprintf(tra('Deleted account %s'), $deleteuser), $user); } else { throw new Services_Exception_NotFound(tr('An error occurred. User %0 could not be deleted', $deleteuser)); } } } return true; }
// Moved here from tiki-setup.php because smarty use a copy of session if ($prefs['feature_fullscreen'] == 'y') { require_once ('lib/setup/fullscreen.php'); } // Retrieve all preferences require_once ('lib/setup/prefs.php'); // Smarty needs session since 2.6.25 global $smarty; require_once ('lib/init/smarty.php'); // Define the special maxRecords global variable $maxRecords = $prefs['maxRecords']; $smarty->assignByRef('maxRecords', $maxRecords); require_once ('lib/userslib.php'); global $userlib; $userlib = new UsersLib; require_once ('lib/tikiaccesslib.php'); $access = new TikiAccessLib; require_once ('lib/breadcrumblib.php'); // ------------------------------------------------------ // DEAL WITH XSS-TYPE ATTACKS AND OTHER REQUEST ISSUES function remove_gpc(&$var) { if (is_array($var)) { foreach ($var as $key => $val) { remove_gpc($var[$key]); } } else { $var = stripslashes($var); } }
$_SESSION["install-logged-{$multi}"] = 'y'; } $smarty->assign('dbdone', 'n'); $smarty->assign('logged', $logged); // Installation steps if (isset($dbTiki) && is_object($dbTiki) && isset($_SESSION["install-logged-{$multi}"]) && $_SESSION["install-logged-{$multi}"] == 'y') { $smarty->assign('logged', 'y'); if (isset($_REQUEST['scratch'])) { $installer->cleanInstall(); $smarty->assign('installer', $installer); $smarty->assign('dbdone', 'y'); $install_type = 'scratch'; require_once 'lib/tikilib.php'; $tikilib = new TikiLib(); require_once 'lib/userslib.php'; $userlib = new UsersLib(); require_once 'lib/tikidate.php'; $tikidate = new TikiDate(); } if (isset($_REQUEST['update'])) { $installer->update(); $smarty->assign('installer', $installer); $smarty->assign('dbdone', 'y'); $install_type = 'update'; } // Try to activate Apache htaccess file by making a symlink or copying _htaccess into .htaccess // Do nothing (but warn the user to do it manually) if: // - there is no _htaccess file, // - there is already an existing .htaccess (that is not necessarily the one that comes from Tiki), // - the copy does not work (e.g. due to filesystem permissions) //
unset($dbs_tiki); ini_set('session.save_handler', 'user'); include_once 'lib/adodb/session/adodb-session.php'; } // Only accept PHP's session ID in URL when the request comes from the tiki server itself // This is used by features that need to query the server to retrieve tiki's generated html and images (e.g. pdf export) if (isset($_GET['PHPSESSID']) && $_SERVER['REMOTE_ADDR'] == '127.0.0.1') { $_COOKIE['PHPSESSID'] = $_GET['PHPSESSID']; session_id($_GET['PHPSESSID']); } if ($sessions_silent == 'disabled' or !empty($_COOKIE)) { // enabing silent sessions mean a session is only started when a cookie is presented session_start(); } require_once "lib/userslib.php"; $userlib = new UsersLib($dbTiki); require_once "lib/tikiaccesslib.php"; $access = new TikiAccessLib(); require_once "lib/breadcrumblib.php"; //require_once("lib/tikihelplib.php"); // ------------------------------------------------------ // DEAL WITH XSS-TYPE ATTACKS AND OTHER REQUEST ISSUES require_once 'lib/setup/sanitization.php'; function make_clean(&$var, $gpc = false) { if (is_array($var)) { foreach ($var as $key => $val) { make_clean($var[$key], $gpc); } } else { if ($gpc) {
function _init_cas_client() { global $prefs; // just make sure we're supposed to be here if ($prefs['auth_method'] != 'cas') { return false; } if (self::$cas_initialized === false) { // initialize phpCAS phpCAS::client($prefs['cas_version'], '' . $prefs['cas_hostname'], (int) $prefs['cas_port'], '' . $prefs['cas_path'], false); self::$cas_initialized = true; } return true; }
$tikiPath = '/var/www/pubeduc/'; $csvFile = '/home/rodrigo/devel/pubeduc/docs/lista_see.csv'; chdir($tikiPath); set_include_path(get_include_path() . PATH_SEPARATOR . $tikiPath); require_once $tikiPath . 'tiki-setup.php'; require_once $tikiPath . 'lib/userslib.php'; if (($handle = fopen($csvFile, 'r')) !== FALSE) { // numero de usuarios criados $j = 0; // numero de grupos criados $l = 0; for ($i = 0; ($data = fgetcsv($handle)) !== FALSE; $i++) { if ($i == 0) { continue; } $userslib = new UsersLib(); $result = $userlib->fetchAll('SELECT groupName FROM users_groups'); $existentGroups = array(); foreach ($result as $array) { $existentGroups[] = $array['groupName']; } if ($userslib->add_user($data[0], $data[1], $data[0], $data[1], true)) { $j++; $groups = split(',', $data[2]); foreach ($groups as $group) { if (!in_array($group, $existentGroups)) { $userlib->add_group($group); echo 'Grupo ' . $group . ' não existia e foi criado' . "\n"; $l++; } if (!$userlib->assign_user_to_group($data[0], $group)) {
public static function LoadImage($photo, $company_id) { $photo = trim($photo); $temp_path = "./cp/{$company_id}/temp_img/"; $p1_p_title = $company_id; $p2_p_title = rand(1, 99999); $p3_p_title = time(); $p_title = $p1_p_title . '_' . $p2_p_title . '_' . $p3_p_title . '.jpg'; if (preg_match('/^http\\:\\/\\//', $photo)) { $Image = new HandlingImage(); if ($Image->load($photo)) { if ($Image->getHeight() > $Image->getWidth()) { $Image->resizeToWidth(800); } else { $Image->resizeToHeight(800); } $Image->save($temp_path . $p_title); return $p_title; } else { return false; } } else { $photo = UsersLib::SeoTranslit($photo, 150); if (file_exists($temp_path . $photo . ".jpg")) { if (rename($temp_path . $photo . ".jpg", $temp_path . $p_title)) { return $p_title; } else { return false; } } else { return false; } } }
<?php // (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project // // All Rights Reserved. See copyright.txt for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. // $Id: sync.php 44444 2013-01-05 21:24:24Z changi67 $ ini_set('include_path', '/home/multitiki:/home/multitiki/lib/pear:/home/multitiki/lib/adodb'); include_once "lib/init/initlib.php"; $file_local_php = "/home/multitiki/db/tikiwiki.org/local.php"; $file_local_php_multi = ""; $tikidomain = "tikiwiki.org"; $tikidomain2 = "cc.tikiwiki.org"; require_once "db/tiki-db.php"; require_once "lib/tikilib.php"; require_once "lib/userslib.php"; $tikilib = new TikiLib(); $userlib = new UsersLib(); $users = $userlib->get_group_users('CC'); foreach ($users as $user) { $res = $userlib->get_user_info($user); echo "replace into users_users set userId='" . $res['userId'] . "', pass_due='" . (time() + 60 * 60 * 24 * 999) . "', email='" . $res['email'] . "', hash='" . $res['hash'] . "', login='******'login'] . "';\n"; echo "insert ignore into users_usergroups set userId='" . $res['userId'] . "', groupName='Registered';\n"; }