Beispiel #1
0
function EditAvatarNow($aAvatar)
{
    global $CFG, $dbConn, $aAvatars;
    // Grab the avatar ID.
    $iAvatarID = $aAvatar['id'];
    unset($aAvatar['id']);
    // Validate avatar's information.
    list($aAvatar, $aError) = ValidateAvatar($aAvatar);
    // Did we get any errors?
    if ($aError) {
        return $aError;
    }
    // Replace the obsolete avatar information with the new information.
    $aAvatars[$iAvatarID] = $aAvatar;
    // Update the avatars.
    $strAvatars = $dbConn->sanitize(serialize($aAvatars));
    $dbConn->query("UPDATE configuration SET content='{$strAvatars}' WHERE name='avatars'");
    // Let the user know it was a success.
    Msg("<b>Avatar successfully updated.</b><br /><br /><span class=\"smaller\">You should be redirected to the Admin Control Panel momentarily. Click <a href=\"admincp.php?section=avatars\">here</a><br />if you do not want to wait any longer or if you are not redirected.</span>", 'admincp.php?section=avatars');
}
Beispiel #2
0
function EditAvatar()
{
    global $CFG, $dbConn, $aAvatars;
    // Are they submitting information?
    if (isset($_REQUEST['submit'])) {
        // Yup, so try and validate it; submit it to the database if everything's okay.
        $aError = ValidateAvatar();
    }
    // Get the avatar information.
    $dbConn->query("SELECT filename, datum FROM avatar WHERE id={$_SESSION['userid']}");
    list($strFilename, $strAvatarData) = $dbConn->getresult();
    if ($strFilename == NULL) {
        $iAvatarID = $strAvatarData;
    } else {
        unset($strAvatarData);
    }
    // Template
    require "./skins/{$CFG['skin']}/usercp/avatar.tpl.php";
    // Send the page.
    exit;
}