Ejemplo n.º 1
0
function last_contact($date, $show_only_date, $user_ID)
{
    //global $show_only_date;
    if ($show_only_date) {
        $data = mysql2localedate($date);
    } else {
        $data = mysql2localedatetime($date);
    }
    $login = user_login($user_ID, false);
    if ($login != '') {
        $threads_url = get_dispctrl_url('threads', 'colselect_submit=Filter+list&u=' . $login);
        $data = '<a href="' . $threads_url . '">' . $data . '</a>';
    }
    return $data;
}
<?php

/**
 * This file implements the Item history details view
 *
 * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}.
 * See also {@link https://github.com/b2evolution/b2evolution}.
 *
 * @license GNU GPL v2 - {@link http://b2evolution.net/about/gnu-gpl-license}
 *
 * @copyright (c)2003-2015 by Francois Planque - {@link http://fplanque.com/}.
 *
 * @package admin
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
global $edited_Item, $Revision;
$post_statuses = get_visibility_statuses();
$Form = new Form(NULL, 'history', 'post', 'compact');
$Form->global_icon(T_('Cancel viewing!'), 'close', regenerate_url('action', 'action=history'));
$Form->begin_form('fform', sprintf(T_('Revision #%s for: %s'), $Revision->iver_ID == 0 ? '(' . T_('Current version') . ')' : $Revision->iver_ID, $edited_Item->get_title()));
$Form->info(T_('Date'), mysql2localedatetime($Revision->iver_edit_datetime, 'Y-m-d', 'H:i:s'));
$iver_editor_user_link = get_user_identity_link(NULL, $Revision->iver_edit_user_ID);
$Form->info(T_('User'), empty($iver_editor_user_link) ? T_('(deleted user)') : $iver_editor_user_link);
$Form->info(T_('Status'), $post_statuses[$Revision->iver_status]);
$Form->info(T_('Note'), $Revision->iver_ID > 0 ? T_('Archived version') : T_('Current version'));
$Form->info(T_('Title'), $Revision->iver_title);
$Form->info(T_('Content'), $Revision->iver_content);
$Form->end_form();
Ejemplo n.º 3
0
}
if ($cjob_repeat_after_hours = floor($cjob_row->ctsk_repeat_after % 86400 / 3600)) {
    $cjob_repeat_after .= $cjob_repeat_after_hours . ' ' . T_('hours') . ' ';
}
if ($cjob_repeat_after_minutes = floor($cjob_row->ctsk_repeat_after % 3600 / 60)) {
    $cjob_repeat_after .= $cjob_repeat_after_minutes . ' ' . T_('minutes');
}
$Form->info(T_('Repeat every'), $cjob_repeat_after);
$Form->end_fieldset();
$Form->begin_fieldset(T_('Execution details') . get_manual_link('scheduled-job-execution-details'));
if (empty($cjob_row->clog_status)) {
    $Form->info(T_('Status'), 'pending');
} else {
    $Form->info(T_('Status'), '<span class="cron_' . $cjob_row->clog_status . '">' . $cjob_row->clog_status . '</span>');
    $Form->info(T_('Real start time'), mysql2localedatetime($cjob_row->clog_realstart_datetime));
    $Form->info(T_('Real stop time'), mysql2localedatetime($cjob_row->clog_realstop_datetime));
    $Form->info(T_('Duration'), seconds_to_period(strtotime($cjob_row->clog_realstop_datetime) - strtotime($cjob_row->clog_realstart_datetime)));
    $cron_messages_data = @unserialize($cjob_row->clog_messages);
    if (!is_array($cron_messages_data)) {
        // Simple messages
        $Form->info(T_('Messages'), str_replace("\n", "<br />\n", $cjob_row->clog_messages));
    } else {
        // Serialized data
        if (isset($cron_messages_data['message'])) {
            // Display message
            $Form->info(T_('Messages'), str_replace("\n", "<br />\n", $cron_messages_data['message']));
        }
        if (isset($cron_messages_data['table_cols'], $cron_messages_data['table_data']) && !empty($cron_messages_data['table_data'])) {
            // Display table with report
            $Table = new Table(NULL, 'cron_');
            $Table->cols = array();
echo T_('View this revision');
?>
"><?php 
echo T_('View');
?>
</a>)
			</p>
			<div class="center"><small><?php 
echo T_('Status') . ': ' . $post_statuses[$Revision_1->iver_status];
?>
</small></div>
		</td>
		<td colspan="2" class="diff-ntitle">
			<p><?php 
$iver_editor_user_link = get_user_identity_link(NULL, $Revision_2->iver_edit_user_ID);
printf(T_('Revision #%s as of %s by %s'), $Revision_2->iver_ID == 0 ? '(<b>' . T_('Current version') . '</b>)' : $Revision_2->iver_ID, mysql2localedatetime($Revision_2->iver_edit_datetime, 'Y-m-d', 'H:i:s'), empty($iver_editor_user_link) ? T_('(deleted user)') : $iver_editor_user_link);
?>
			(<a href="<?php 
echo url_add_param($admin_url, 'ctrl=items&amp;action=history_details&amp;p=' . $edited_Item->ID . '&amp;r=' . $Revision_2->iver_ID);
?>
" title="<?php 
echo T_('View this revision');
?>
"><?php 
echo T_('View');
?>
</a>)
			</p>
			<div class="center"><small<?php 
echo $Revision_1->iver_status != $Revision_2->iver_status ? ' style="color:#F00;font-weight:bold"' : '';
?>
Ejemplo n.º 5
0
/**
 * Return the given date in the correct date format
 *
 * @param string Date
 * @param boolean TRUE to show only date
 * @return string Date
*/
function col_thread_date($date, $show_only_date)
{
    if ($show_only_date) {
        return mysql2localedate($date);
    }
    return mysql2localedatetime($date);
}
Ejemplo n.º 6
0
/**
 * Display user report form
 *
 * @param array Params
 */
function user_report_form($params = array())
{
    global $current_User;
    $params = array_merge(array('Form' => NULL, 'user_ID' => 0, 'crumb_name' => '', 'cancel_url' => ''), $params);
    if (!is_logged_in() || $current_User->ID == $params['user_ID'] || !$current_User->check_status('can_report_user')) {
        // Current user must be logged in, cannot report own account, and must has a permission to report
        return;
    }
    $Form =& $params['Form'];
    $Form->add_crumb($params['crumb_name']);
    $Form->hidden('user_ID', $params['user_ID']);
    $report_options = array_merge(array('none' => ''), get_report_statuses());
    $Form->custom_content('<p><strong>' . get_icon('warning_yellow') . ' ' . T_('If you have an issue with this user, you can report it here:') . '</strong></p>');
    // get current User report from edited User
    $current_report = get_report_from($params['user_ID']);
    if ($current_report == NULL) {
        // currentUser didn't add any report from this user yet
        $report_content = '<select id="report_user_status" name="report_user_status">';
        foreach ($report_options as $option => $option_label) {
            // add select option, none must be selected
            $report_content .= '<option ' . ($option == 'none' ? 'selected="selected" ' : '') . 'value="' . $option . '">' . $option_label . '</option>';
        }
        $report_content .= '</select><div id="report_info" style="width:100%;"></div>';
        $info_content = '<div><span>' . T_('You can provide additional information below') . ':</span></div>';
        $info_content .= '<table style="width:100%;"><td style="width:99%;background-color:inherit;"><textarea id="report_info_content" name="report_info_content" class="form_textarea_input" style="width:100%;" rows="2" maxlength="240"></textarea></td>';
        $info_content .= '<td style="vertical-align:top;background-color:inherit;"><input type="submit" class="SaveButton" style="color:red;margin-left:2px;" value="' . T_('Report this user now!') . '" name="actionArray[report_user]" /></td></table>';
        $report_content .= '<script type="text/javascript">
			var info_content = \'' . $info_content . '\';
			jQuery("#report_user_status").change( function() {
				var report_info = jQuery("#report_info");
				var value = jQuery(this).val();
				if( value == "none" )
				{
					report_info.html("");
				}
				else if( report_info.is(":empty") )
				{
					report_info.html( info_content );
				}
			});
			</script>';
        $report_content .= '<noscript>' . $info_content . '</noscript>';
        $Form->info(T_('Report NOW'), $report_content);
    } else {
        $report_content = T_('You have reported this user on %s as "%s" with the additional info "%s" - <a %s>Cancel report</a>');
        $report_content = sprintf($report_content, mysql2localedatetime($current_report['date']), $report_options[$current_report['status']], $current_report['info'], 'href="' . $params['cancel_url'] . '"');
        $Form->info(T_('Already reported'), $report_content);
    }
}
global $secure_htsrv_url, $dummy_fields;
// Default params:
$params = array_merge(array('user_count' => '', 'request_id' => '', 'blog_param' => ''), $params);
$UserCache =& get_UserCache();
$message_content = '';
// Iterate through the User Cache
while (($iterator_User =& $UserCache->get_next()) != NULL) {
    $message_content .= "\n" . T_('Login:'******' ' . $iterator_User->dget('login') . "\n";
    if ($params['user_count'] > 1) {
        // exists more account with the given email address, display last used date for each
        $user_lastseen_ts = $iterator_User->get('lastseen_ts');
        if (empty($user_lastseen_ts)) {
            // user has never logged in
            $message_content .= T_('Never used.') . "\n";
        } else {
            $message_content .= T_('Last used on') . ': ' . format_to_output(mysql2localedatetime($user_lastseen_ts), 'text') . "\n";
        }
    }
    $message_content .= T_('Link to change your password:'******'$secret_content_start$' . $secure_htsrv_url . 'login.php?action=changepwd' . '&' . $dummy_fields['login'] . '=' . rawurlencode($iterator_User->login) . '&reqID=' . $params['request_id'] . '&sessID=' . $Session->ID . $params['blog_param'] . '$secret_content_end$' . "\n";
}
if ($params['user_count'] > 1) {
    // exists more account with the given email address
    $message_content = "\n" . T_('It seems you have multiple accounts associated to this email address. Choose the one you want to use below:') . "\n" . $message_content;
    $message_note = T_('For security reasons the links are only valid for your current session (by means of your session cookie).');
} else {
    $message_note = T_('For security reasons the link is only valid for your current session (by means of your session cookie).');
}
echo T_('Somebody (presumably you) has requested a password change for your account.');
echo "\n";
echo $message_content;
echo "\n-- \n";
$params = array_merge(array('user_count' => '', 'request_id' => '', 'blog_param' => ''), $params);
$UserCache =& get_UserCache();
$message_content = '';
// Iterate through the User Cache
while (($iterator_User =& $UserCache->get_next()) != NULL) {
    // Note: we don't want to display the avatar in this specific case.
    if ($params['user_count'] > 1) {
        // Several accounts with the given email address, display last used date for each
        $message_content .= '<div style="margin: 1em 0; border: 1px solid #ccc; border-radius: 4px; padding: 1em 1em 1ex;">';
        $message_content .= '<p' . emailskin_style('.p') . '>' . T_('Login:'******' ' . $iterator_User->get_colored_login(array('mask' => '$login$')) . "</p>\n";
        $user_lastseen_ts = $iterator_User->get('lastseen_ts');
        if (empty($user_lastseen_ts)) {
            // user has never logged in
            $message_content .= T_('Never used.') . "\n";
        } else {
            $message_content .= T_('Last used on') . ': <b>' . format_to_output(mysql2localedatetime($user_lastseen_ts)) . "</b>\n";
        }
    } else {
        $message_content .= '<p' . emailskin_style('.p') . '>' . T_('Login:'******' ' . $iterator_User->get_colored_login(array('mask' => '$login$')) . "</p>\n";
    }
    $url_change_password = $secure_htsrv_url . 'login.php?action=changepwd' . '&' . $dummy_fields['login'] . '=' . rawurlencode($iterator_User->login) . '&reqID=' . $params['request_id'] . '&sessID=' . $Session->ID . $params['blog_param'];
    // Restrict the password change url to be saved in the email logs
    $url_change_password = '******' . $url_change_password . '$secret_content_end$';
    // Buttons:
    $message_content .= '<div' . emailskin_style('div.buttons') . '>' . "\n";
    $message_content .= get_link_tag($url_change_password, T_('Change your password NOW'), 'div.buttons a+a.button_yellow') . "\n";
    $message_content .= "</div>\n";
    if ($params['user_count'] > 1) {
        // Several accounts with the given email address, display last used date for each
        $message_content .= '</div>';
    }
Ejemplo n.º 9
0
// Number of sent and received private messages
$messages_sent = $edited_User->get_num_messages('sent');
if ($messages_sent > 0) {
    $messages_sent .= ' - <a href="' . $activity_tab_url . '#threads_result" class="roundbutton middle" title="' . format_to_output(T_('Go to user activity'), 'htmlattr') . '">' . get_icon('magnifier', 'imgtag', array('title' => T_('Go to user activity'))) . '</a>';
    if ($current_User->check_perm('perm_messaging', 'abuse')) {
        $messages_sent .= ' - <a href="' . $admin_url . '?ctrl=abuse&amp;colselect_submit=Filter+list&amp;u=' . $edited_User->login . '">' . T_('Go to abuse management') . ' &raquo;</a>';
    }
}
$Form->info_field(T_('# of private messages sent'), $messages_sent);
$messages_received = $edited_User->get_num_messages('received');
if ($messages_received > 0 && $current_User->check_perm('perm_messaging', 'abuse')) {
    $messages_received .= ' - <a href="' . $admin_url . '?ctrl=abuse&amp;colselect_submit=Filter+list&amp;u=' . $edited_User->login . '" class="roundbutton middle" title="' . format_to_output(T_('Go to abuse management'), 'htmlattr') . '">' . get_icon('magnifier', 'imgtag', array('title' => T_('Go to abuse management'))) . '</a>';
}
$Form->info_field(T_('# of private messages received'), $messages_received);
$edited_user_lastseen = $edited_User->get('lastseen_ts');
$Form->info_field(T_('Last seen on'), empty($edited_user_lastseen) ? '' : mysql2localedatetime($edited_user_lastseen));
$Form->info_field(T_('On IP'), $edited_User->get_last_session_param('ipaddress'));
$Form->end_fieldset();
$from_country = '';
if (!empty($edited_User->reg_ctry_ID)) {
    // Get country that was defined by GeoIP Plugin on registration
    load_class('regional/model/_country.class.php', 'Country');
    load_funcs('regional/model/_regional.funcs.php');
    $CountryCache =& get_CountryCache();
    $Country = $CountryCache->get_by_ID($edited_User->reg_ctry_ID);
    $from_country = country_flag($Country->get('code'), $Country->get_name(), 'w16px', 'flag', '', false, true, 'margin-bottom:3px;vertical-align:middle;') . ' ' . $Country->get_name();
}
// Get field suffix for a field 'From Country' from the Plugins
$user_from_country_suffix = '';
$Plugins->restart();
while ($loop_Plugin =& $Plugins->get_next()) {
Ejemplo n.º 10
0
/**
 * Display user report form
 *
 * @param array Params
 */
function user_report_form($params = array())
{
    global $current_User, $display_mode;
    $params = array_merge(array('Form' => NULL, 'user_ID' => 0, 'crumb_name' => '', 'cancel_url' => ''), $params);
    if (!is_logged_in() || $current_User->ID == $params['user_ID'] || !$current_User->check_status('can_report_user')) {
        // Current user must be logged in, cannot report own account, and must has a permission to report
        return;
    }
    $Form =& $params['Form'];
    $Form->add_crumb($params['crumb_name']);
    $Form->hidden('user_ID', $params['user_ID']);
    $report_options = array_merge(array('none' => ''), get_report_statuses());
    // Use JS to show/hide textarea only for normal view
    $use_js = !(isset($display_mode) && $display_mode == 'js');
    // get current User report from edited User
    $current_report = get_report_from($params['user_ID']);
    if ($current_report == NULL) {
        // currentUser didn't add any report from this user yet
        $Form->custom_content('<p class="alert alert-warning"><strong>' . get_icon('warning_yellow') . ' ' . T_('If you have an issue with this user, you can report it here:') . '</strong></p>');
        $report_content = '<select id="report_user_status" name="report_user_status" class="form-control" style="width:auto">';
        foreach ($report_options as $option => $option_label) {
            // add select option, none must be selected
            $report_content .= '<option ' . ($option == 'none' ? 'selected="selected" ' : '') . 'value="' . $option . '">' . $option_label . '</option>';
        }
        $report_content .= '</select><div id="report_info" style="width:100%;">$report_info_content$</div>';
        $info_content = '<br />' . T_('You can provide additional information below') . ':';
        $info_content .= '<textarea id="report_info_content" name="report_info_content" class="form_textarea_input form-control" rows="2" maxlength="240"></textarea>';
        $info_content .= '<br /><input type="submit" class="SaveButton btn btn-danger" value="' . T_('Report this user now!') . '" name="actionArray[report_user]" />';
        if ($use_js) {
            $report_content = str_replace('$report_info_content$', '', $report_content);
            $report_content .= '<script type="text/javascript">
				var info_content = \'' . $info_content . '\';
				jQuery("#report_user_status").change( function() {
					var report_info = jQuery("#report_info");
					var value = jQuery(this).val();
					if( value == "none" )
					{
						report_info.html("");
					}
					else if( report_info.is(":empty") )
					{
						report_info.html( info_content );
					}
				});
				</script>';
            $report_content .= '<noscript>' . $info_content . '</noscript>';
        } else {
            $report_content = str_replace('$report_info_content$', $info_content, $report_content);
        }
        $Form->info(T_('Reason'), $report_content);
    } else {
        echo '<div id="current_modal_title" style="display:none">' . T_('Already Reported User') . '</div>';
        printf(T_('You have reported this user on %s<br />as "%s"<br />with the additional info "%s"'), mysql2localedatetime($current_report['date']), $report_options[$current_report['status']], nl2br($current_report['info']));
        echo '<p><a href="' . $params['cancel_url'] . '" class="btn btn-warning">' . T_('Cancel Report') . '</a></p>';
    }
}