This file is indexed.

/usr/share/letodms/op/op.UsrMgr.php is in letodms 3.3.11+dfsg.1-2ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<?php
//    MyDMS. Document Management System
//    Copyright (C) 2002-2005  Markus Westphal
//    Copyright (C) 2006-2008 Malcolm Cowe
//    Copyright (C) 2010 Matteo Lucarelli
//    Copyright (C) 2010-2012 Uwe Steinmann
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

include("../inc/inc.Settings.php");
include("../inc/inc.LogInit.php");
include("../inc/inc.Utils.php");
include("../inc/inc.DBInit.php");
include("../inc/inc.Language.php");
include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php");

if (!$user->isAdmin()) {
	UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}

if (isset($_POST["action"])) $action=$_POST["action"];
else $action=NULL;

//Neuen Benutzer anlegen --------------------------------------------------------------------------
if ($action == "adduser") {
	
	/* Check if the form data comes for a trusted request */
	if(!checkFormKey('adduser')) {
		UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
	}

	$login   = $_POST["login"];
	$name    = $_POST["name"];
	$email   = $_POST["email"];
	$comment = $_POST["comment"];
	$role    = preg_replace('/[^0-2]+/', '', $_POST["role"]);
	$isHidden = (isset($_POST["ishidden"]) && $_POST["ishidden"]==1 ? 1 : 0);

	if (is_object($dms->getUserByLogin($login))) {
		UI::exitError(getMLText("admin_tools"),getMLText("user_exists"));
	}

	$newUser = $dms->addUser($login, md5($_POST["pwd"]), $name, $email, $settings->_language, $settings->_theme, $comment, $role, $isHidden);
	if ($newUser) {

		if (isset($_FILES["userfile"]) && is_uploaded_file($_FILES["userfile"]["tmp_name"]) && $_FILES["userfile"]["size"] > 0 && $_FILES['userfile']['error']==0)
		{
			$userfiletype = $_FILES["userfile"]["type"];
			$userfilename = $_FILES["userfile"]["name"];
			$lastDotIndex = strrpos(basename($userfilename), ".");
			$fileType = substr($userfilename, $lastDotIndex);
			if ($fileType != ".jpg" && $filetype != ".jpeg")
			{
				UI::exitError(getMLText("admin_tools"),getMLText("only_jpg_user_images"));
			}
			else
			{
				resizeImage($_FILES["userfile"]["tmp_name"]);
				$newUser->setImage($_FILES["userfile"]["tmp_name"], $userfiletype);
			}
		}
	}
	else UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
	
	if (isset($_POST["usrReviewers"])){
		foreach ($_POST["usrReviewers"] as $revID) 
			$newUser->setMandatoryReviewer($revID,false);
	}
	
	if (isset($_POST["grpReviewers"])){
		foreach ($_POST["grpReviewers"] as $revID) 
			$newUser->setMandatoryReviewer($revID,true);
	}
		
	if (isset($_POST["usrApprovers"])){
		foreach ($_POST["usrApprovers"] as $appID) 
			$newUser->setMandatoryApprover($appID,false);
	}
			
	if (isset($_POST["grpApprovers"])){
		foreach ($_POST["grpApprovers"] as $appID) 
			$newUser->setMandatoryApprover($appID,true);
	}
	
	$userid=$newUser->getID();
	
	add_log_line(".php&action=adduser&login=".$login);
}

//Benutzer löschen --------------------------------------------------------------------------------
else if ($action == "removeuser") {

	/* Check if the form data comes for a trusted request */
	if(!checkFormKey('removeuser')) {
		UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
	}

	if (isset($_POST["userid"])) {
		$userid = $_POST["userid"];
	}

	if (!isset($userid) || !is_numeric($userid) || intval($userid)<1) {
		UI::exitError(getMLText("admin_tools"),getMLText("invalid_user_id"));
	}

	/* This used to be a check if an admin is deleted. Now it checks if one
	 * wants to delete herself.
	 */
	if ($userid==$user->getID()) {
		UI::exitError(getMLText("admin_tools"),getMLText("cannot_delete_yourself"));
	}

	$userToRemove = $dms->getUser($userid);
	if (!is_object($userToRemove)) {
		UI::exitError(getMLText("admin_tools"),getMLText("invalid_user_id"));
	}

	$userToAssign = $dms->getUser($_POST["assignTo"]);
	if (!$userToRemove->remove($user, $userToAssign)) {
		UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
	}
		
	add_log_line(".php&action=removeuser&userid=".$userid);
	
	$userid=-1;
}

//Benutzer bearbeiten -----------------------------------------------------------------------------
else if ($action == "edituser") {

	/* Check if the form data comes for a trusted request */
	if(!checkFormKey('edituser')) {
		UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
	}

	if (!isset($_POST["userid"]) || !is_numeric($_POST["userid"]) || intval($_POST["userid"])<1) {
		UI::exitError(getMLText("admin_tools"),getMLText("invalid_user_id"));
	}
	
	$userid=$_POST["userid"];
	$editedUser = $dms->getUser($userid);
	
	if (!is_object($editedUser)) {
		UI::exitError(getMLText("admin_tools"),getMLText("invalid_user_id"));
	}
	
	$login   = $_POST["login"];
	$pwd     = $_POST["pwd"];
	$name    = $_POST["name"];
	$email   = $_POST["email"];
	$comment = $_POST["comment"];
	$role    = preg_replace('/[^0-2]+/', '', $_POST["role"]);
	$isHidden = (isset($_POST["ishidden"]) && $_POST["ishidden"]==1 ? 1 : 0);
	
	if ($editedUser->getLogin() != $login)
		$editedUser->setLogin($login);
	if (isset($pwd) && ($pwd != ""))
		$editedUser->setPwd(md5($pwd));
	if ($editedUser->getFullName() != $name)
		$editedUser->setFullName($name);
	if ($editedUser->getEmail() != $email)
		$editedUser->setEmail($email);
	if ($editedUser->getComment() != $comment)
		$editedUser->setComment($comment);
	if ($editedUser->getRole() != $role)
		$editedUser->setRole($role);
	if ($editedUser->isHidden() != $isHidden)
		$editedUser->setHidden($isHidden);

	if (isset($_FILES['userfile']) && is_uploaded_file($_FILES["userfile"]["tmp_name"]) && $_FILES["userfile"]["size"] > 0 && $_FILES['userfile']['error']==0)
	{
		$userfiletype = $_FILES["userfile"]["type"];
		$userfilename = $_FILES["userfile"]["name"];
		$lastDotIndex = strrpos(basename($userfilename), ".");
		$fileType = substr($userfilename, $lastDotIndex);
		if ($fileType != ".jpg" && $filetype != ".jpeg") {
			UI::exitError(getMLText("admin_tools"),getMLText("only_jpg_user_images"));
		}
		else {
			resizeImage($_FILES["userfile"]["tmp_name"]);
			$editedUser->setImage($_FILES["userfile"]["tmp_name"], $userfiletype);
		}
	}
	
	$editedUser->delMandatoryReviewers();
	
	if (isset($_POST["usrReviewers"])) foreach ($_POST["usrReviewers"] as $revID) 
		$editedUser->setMandatoryReviewer($revID,false);
			
	if (isset($_POST["grpReviewers"])) foreach ($_POST["grpReviewers"] as $revID) 
		$editedUser->setMandatoryReviewer($revID,true);

	$editedUser->delMandatoryApprovers();
	
	if (isset($_POST["usrApprovers"])) foreach ($_POST["usrApprovers"] as $appID) 
		$editedUser->setMandatoryApprover($appID,false);
			
	if (isset($_POST["grpApprovers"])) foreach ($_POST["grpApprovers"] as $appID) 
		$editedUser->setMandatoryApprover($appID,true);
	
	add_log_line(".php&action=edituser&userid=".$userid);

}
else UI::exitError(getMLText("admin_tools"),getMLText("unknown_command"));


function resizeImage($imageFile) {

	// Not perfect. Creates a new image even if the old one is acceptable,
	// and the output quality is low. Now uses the function imagecreatetruecolor(),
	// though, so at least the pictures are in colour.
	
	// Originalbild einlesen
	$origImg = imagecreatefromjpeg($imageFile);
	$width = imagesx($origImg);
	$height = imagesy($origImg);
	// Thumbnail im Speicher erzeugen
	$newHeight = 150;
	$newWidth = ($width/$height) * $newHeight;
	$newImg = imagecreatetruecolor($newWidth, $newHeight);
	// Verkleinern
	imagecopyresized($newImg, $origImg, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
	// In File speichern 
	imagejpeg($newImg, $imageFile);
	// Aufräumen
	imagedestroy($origImg);
	imagedestroy($newImg);
	
	return true;
}

header("Location:../out/out.UsrMgr.php?userid=".$userid);

?>