Example #1
0
    }
} else {
    if (isset($_GET['logon']) && strlen(trim($_GET['logon'])) > 0) {
        $logon = trim($_GET['logon']);
        if (($user_array = user_get_by_logon($logon)) !== false) {
            $uid = $user_array['UID'];
        }
    }
}
if (!isset($uid)) {
    html_draw_error(gettext("No user specified."));
}
// Get the Profile Sections.
$profile_sections = profile_sections_get();
// Get the user's profile data.
$user_profile = user_get_profile($uid);
// User relationship.
$peer_relationship = user_get_relationship($uid, $_SESSION['UID']);
// Popup title.
$page_title = format_user_name($user_profile['LOGON'], $user_profile['NICKNAME']);
html_draw_top(array('title' => $page_title, 'js' => array('js/user_profile.js'), 'base_target' => '_blank', 'pm_popup_disabled' => true, 'class' => 'window_title'));
echo "<div align=\"center\">\n";
echo "  <table width=\"600\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "    <tr>\n";
echo "      <td align=\"left\">\n";
echo "        <table class=\"box\" width=\"100%\">\n";
echo "          <tr>\n";
echo "            <td align=\"center\" class=\"posthead\">\n";
echo "              <table class=\"profile_header\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "                <tr>\n";
echo "                  <td align=\"center\" width=\"95%\">\n";
    CPGPluginAPI::load();
}
// Set UDB_INTEGRATION if enabled in admin
if ($CONFIG['bridge_enable'] == 1 && !defined('BRIDGEMGR_PHP')) {
    $BRIDGE = cpg_get_bridge_db_values();
} else {
    $BRIDGE['short_name'] = 'coppermine';
    $BRIDGE['recovery_logon_failures'] = 0;
    $BRIDGE['use_post_based_groups'] = false;
}
define('UDB_INTEGRATION', $BRIDGE['short_name']);
require_once 'bridge/' . UDB_INTEGRATION . '.inc.php';
// Start output buffering
ob_start('cpg_filter_page_html');
// Parse cookie stored user profile
user_get_profile();
// Authenticate
$cpg_udb->authenticate();
// Test if admin mode
$USER['am'] = isset($USER['am']) ? (int) $USER['am'] : 0;
define('GALLERY_ADMIN_MODE', USER_IS_ADMIN && $USER['am']);
define('USER_ADMIN_MODE', USER_ID && USER_CAN_CREATE_ALBUMS && !GALLERY_ADMIN_MODE);
// Set error logging level
// Maze's new error report system
if (!USER_IS_ADMIN) {
    if (!$CONFIG['debug_mode']) {
        $cpgdebugger->stop();
        // useless to run debugger because there's no output
    }
    error_reporting(0);
    // hide all errors for visitors
 public function act_edit_user()
 {
     include_once 'lib_user.inc';
     $this->user = user_get_selected();
     $this->userProfile = user_get_profile($this->user);
     $this->user_form = user_get_form();
     include_once APPROOT . 'inc/lib_validate.inc';
     include_once APPROOT . 'inc//security/lib_auth.inc';
     if (isset($_POST['save'])) {
         $valide = true;
         $firstName = $_POST['first_name'];
         $lastName = $_POST['last_name'];
         $organization = $_POST['organization'];
         $designation = $_POST['designation'];
         $email = $_POST['email'];
         $address = $_POST['address'];
         $role = $_POST['role'];
         $status = $_POST['status'];
         $locale = $_POST['locale'];
         if ($email != '' && !shn_valid_email($email)) {
             //email not valide
             $this->user_form['email']['extra_opts'] = array();
             $this->user_form['email']['extra_opts']['error'] = array();
             $this->user_form['email']['extra_opts']['error'][] = _t("INVALID_EMAIL_ADDRESS");
             $valide = false;
         }
         if ($valide == true) {
             $user = $this->user;
             $userProfile = $this->userProfile;
             $username = $this->user->getUserName();
             acl_change_user_roles($username, $role);
             $user->status = $status;
             $cfg = array();
             if (!empty($user->config)) {
                 $cfg = @json_decode($user->config, true);
             }
             $cfg['locale'] = $locale;
             $user->config = json_encode($cfg);
             $user->Save();
             $userProfile->username = $username;
             $userProfile->first_name = $firstName;
             $userProfile->last_name = $lastName;
             $userProfile->organization = $organization;
             $userProfile->designation = $designation;
             $userProfile->email = $email;
             $userProfile->address = $address;
             $userProfile->Save();
             set_redirect_header('admin', 'user_management');
         }
     }
     $this->user_form = user_get_populated_form($this->user, $this->userProfile, $this->user_form);
 }