$_SESSION['s_password'] = $editedUser->user['password'];
     }
     if ($currentUser->user['login'] == $editedUser->user['login'] && $_SESSION['s_language'] != $editedUser->user['languages_NAME']) {
         $_SESSION['s_language'] = $editedUser->user['languages_NAME'];
     }
 }
 if (!in_array('file_upload', $constrainAccess) && $constrainAccess != 'all') {
     $avatarDirectory = G_UPLOADPATH . $editedUser->user['login'] . '/avatars';
     is_dir($avatarDirectory) or mkdir($avatarDirectory, 0755);
     try {
         $filesystem = new FileSystemTree($avatarDirectory);
         $uploadedFile = $filesystem->uploadFile('file_upload', $avatarDirectory);
         if (strpos($uploadedFile['mime_type'], 'image') === false) {
             throw new EfrontFileException(_NOTANIMAGEFILE, EfrontFileException::NOT_APPROPRIATE_TYPE);
         }
         eF_normalizeImage($avatarDirectory . "/" . $uploadedFile['name'], $uploadedFile['extension'], 150, 100);
         // Normalize avatar picture to 150xDimY or DimX x 100
         $editedUser->user['avatar'] = $uploadedFile['id'];
         //pr($editedUser -> user['avatar']);exit;
     } catch (Exception $e) {
         //pr($e);	exit;
         if ($e->getCode() == EfrontFileException::NOT_APPROPRIATE_TYPE) {
             $uploadedFile->delete();
         }
         if ($e->getCode() != UPLOAD_ERR_NO_FILE) {
             throw $e;
         }
         if ($form->exportValue('system_avatar') == "none") {
             $selectedAvatar = 'unknown_small.png';
         } else {
             if ($form->exportValue('system_avatar') != "") {
Esempio n. 2
0
                if (strpos($logoFile['mime_type'], 'image') === false) {
                    throw new EfrontFileException(_NOTANIMAGEFILE, EfrontFileException::NOT_APPROPRIATE_TYPE);
                }
                EfrontConfiguration::setValue('site_logo', $logoFile['id']);
            } catch (EfrontFileException $e) {
                if ($e->getCode() != UPLOAD_ERR_NO_FILE) {
                    throw $e;
                }
                //Don't halt if no file was uploaded (errcode = 4). Otherwise, throw the exception
            }
            if (empty($logoFile)) {
                $logoFile = new EfrontFile(EfrontSystem::setLogoFile($currentTheme));
            }
            // Normalize avatar picture to the dimensions set in the System Configuration menu. NOTE: the picture will be modified to match existing settings. Future higher settings will be disregarded, while lower ones might affect the quality of the displayed image
            if ($values["normalize_dimensions"] == 1) {
                eF_normalizeImage(G_LOGOPATH . $logoFile['name'], $logoFile['extension'], $values["logo_max_width"], $values["logo_max_height"]);
            } else {
                list($width, $height) = getimagesize(G_LOGOPATH . $logoFile['name']);
                eF_createImage(G_LOGOPATH . $logoFile['name'], $logoFile['extension'], $width, $height, $values["logo_max_width"], $values["logo_max_height"]);
            }
            EfrontConfiguration::setValue('logo_timestamp', time());
            // to avoid browser caching when changing logo dimensions
            EfrontCache::getInstance()->deleteCache('logo');
            eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=appearance&tab=logo&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success");
        } catch (Exception $e) {
            handleNormalFlowExceptions($e);
        }
    }
}
$smarty->assign("T_APPEARANCE_LOGO_FORM", $appearanceLogoForm->toArray());
$appearanceFaviconForm = new Html_QuickForm("appearance_favicon_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=appearance&tab=favicon", "", null, true);