Esempio n. 1
0
/** Query search */
if (isset($log_search_query) && !empty($log_search_query)) {
    $search_sql .= "AND log_data LIKE '%" . sanitize($log_search_query) . "%' ";
}
$query = "SELECT * FROM fm_logs WHERE account_id IN (0,{$_SESSION['user']['account_id']}) {$search_sql} ORDER BY log_timestamp DESC";
$fmdb->query($query);
$log_count = $fmdb->num_rows;
$total_pages = ceil($log_count / $_SESSION['user']['record_count']);
if ($page > $total_pages) {
    $page = $total_pages;
}
$pagination = displayPagination($page, $total_pages);
$log_search_module = isset($log_search_module) ? $log_search_module : _('All Modules');
$log_search_user = isset($log_search_user) ? $log_search_user : 0;
$module_list = buildSelect('log_search_module', 1, buildModuleList(), $log_search_module, 4, null, true);
$user_list = buildSelect('log_search_user', 1, buildUserList(), $log_search_user, 4, null, true);
$table_info = array('class' => 'display_results');
$title_array = array(_('Timestamp'), _('Module'), _('User'), array('title' => _('Message'), 'style' => 'width: 50%;'));
$header = displayTableHeader($table_info, $title_array);
echo printPageHeader($response);
printf('<form class="search-form" id="date-range" action="" method="post">
		<table class="log_search_form" align="center">
			<tbody>
				<tr>
					<td>%s</td>
					<td>%s</td>
					<td><input name="log_search_date_b" value="%s" type="text" class="datepicker" placeholder="%s" /></td>
					<td><input name="log_search_date_e" value="%s" type="text" class="datepicker" placeholder="%s" /></td>
					<td><input type="text" name="log_search_query" value="%s" placeholder="%s" /></td>
					<td><input value="%s" type="submit" class="button" /></td>
				</tr>
Esempio n. 2
0
function copyAvatarsToMasthead() {
	global $wgExternalSharedDB, $wgExternalDatawareDB, $wgWikiaLocalSettingsPath ;
	global $wgStylePath, $IP;
	global $USER_FROM, $USER_TO, $USER_TEST;

	$allUsers = array();
	$answersWikis = loadAnswersToCheck();
	$allAnswersWikis = loadAnswersToCheck(1);
	$nycodeWikis = loadWikisToCheck();
	
	buildUserList($allAnswersWikis, $allUsers);
	buildUserList(array_keys($nycodeWikis), $allUsers);

/*	$cnt = 1;
	if ( !empty($allUsers) ) {
		foreach ( $allUsers as $user_id => $listAvatars ) {
			if ( count($listAvatars) > 1 ) {
				$avatar = Masthead::newFromUserID($user_id);
				$path = $avatar->getFullPath();
				$city_id = 0;
				$pathny = $uploaded = false;
				if ( !file_exists( $path ) ) {
					$oUser = User::newFromId($user_id);
					if ( !$oUser instanceof User ) {
						continue;
					}
					__log( $oUser->getName() . " ($user_id): " . implode(", ", $listAvatars ) );
					$cnt++;
				}
			}
		}
	}
	__log ("$cnt users to check \n");
	exit;*/
	
	__log( "Found: " . count($allUsers) );
	if ( !empty($allUsers) ) {
		foreach ( $allUsers as $user_id => $listAvatars ) {
			__log("Processing: ".$user_id . ")");

			# make user 
			$oUser = User::newFromId($user_id);
			if ( !$oUser instanceof User ) {
				__log("Invalid user: $user_id");
				continue;
			}

			# check lang
			$lang = $oUser->getOption('language', 'en');

			$avatar = Masthead::newFromUserID($user_id);
			$path = $avatar->getFullPath();
			$city_id = 0;
			$pathny = $uploaded = false;
			if ( !file_exists( $path ) ) {
				list($pathny, $city_id) = getAnswersAvatar($answersWikis, $user_id, $lang);

				if ( $pathny !== false && $city_id > 0 ) {
					__log("Move Answers Avatar $pathny to $path");
					$uploaded = uploadAvatar($avatar, $oUser, $pathny, $city_id);
					__log("Done with code: " . intval($uploaded));
				} else {
					if ( !empty($nycodeWikis) ) {
						list($pathny, $city_id) = getNYWikisAvatar($nycodeWikis, $user_id);
						if ( $pathny !== false && $city_id > 0 ) {
							__log("Move Wikia NY code Avatar $pathny to $path");
							$uploaded = uploadAvatar($avatar, $oUser, $pathny, $city_id);
						} else {
							if ( !empty($allAnswersWikis) ) {
								list($pathny, $city_id) = getNYWikisAvatar($allAnswersWikis, $user_id);
								if ( $pathny !== false && $city_id > 0 ) {
									__log("Move Avatar (from rest answers pages) $pathny to $path");
									$uploaded = uploadAvatar($avatar, $oUser, $pathny, $city_id);
								} 
							}
						}
					}
				}
				
			} else {
				__log("Avatar: $path exists");
			}
		}
	}
	unset($allUsers);
}