Skip to content

Commit

Permalink
Refatoring code...
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonmoura committed Jan 18, 2023
1 parent 18f3b41 commit 00a9812
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 27 deletions.
1 change: 0 additions & 1 deletion client/api/MyDocuments.php
Expand Up @@ -13,7 +13,6 @@
$params["count"] = -1;

$docs = DocsCollection::listPublicDocs( base64_encode($userID), null, $params );
$docs = Generic::unique_list_docs($docs, 'docID');

if ( count($docs) ) {
if ( $source && 'e-blueinfo' == $source ) {
Expand Down
1 change: 1 addition & 0 deletions client/business/authentication.php
Expand Up @@ -148,6 +148,7 @@
$_SESSION["userMail"] = $result["userMail"];
$_SESSION["source"] = $result["source"];
$_SESSION["avatar"] = $result["avatar"];
$_SESSION["gender"] = $result["gender"];
}

if ( $_SESSION['data'] ) {
Expand Down
8 changes: 2 additions & 6 deletions client/business/mydocuments.php
Expand Up @@ -50,9 +50,7 @@
$responseListDirs["status"] = true;
}

$res = Generic::unique_list_docs($result, 'docID');

$response["values"] = $res;
$response["values"] = $result;
$directoryName = $result[0]["name"];
$responseListDirs["values"] = $resultListDirs;

Expand Down Expand Up @@ -150,9 +148,7 @@
$responseListDirs["status"] = true;
}

$res = Generic::unique_list_docs($result, 'docID');

$response["values"] = $res;
$response["values"] = $result;
$directoryName = $result[0]["name"];
$responseListDirs["values"] = $resultListDirs;

Expand Down
1 change: 0 additions & 1 deletion client/business/widgets.php
Expand Up @@ -36,7 +36,6 @@

// My Collections widget
$collections = DocsCollection::listDocs( $_SESSION['userTK'], null, $params );
$collections = Generic::unique_list_docs($collections, 'docID');
$totalCollections = DocsCollection::getTotalDocs( $_SESSION["userTK"], null, true );

// Profile Documents widget
Expand Down
1 change: 1 addition & 0 deletions client/images/default/female.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
10 changes: 7 additions & 3 deletions client/templates/default/more.tpl.php
Expand Up @@ -18,10 +18,14 @@
<a href="#"><img class="circle" src="<?php echo $_SESSION['fb_data']['picture']['data']['url']; ?>" alt="avatar"></a>
<?php elseif ( $_SESSION['google_data']['picture'] ) : ?>
<a href="#"><img class="circle" src="<?php echo $_SESSION['google_data']['picture']; ?>" alt="avatar"></a>
<?php elseif ( $_SESSION['avatar'] && !in_array($_SESSION['source'], array('google','facebook')) ) : ?>
<a href="#"><img class="circle" src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/uploads/<?php echo $_SESSION['avatar']; ?>" alt="avatar"></a>
<!-- <?php elseif ( $_SESSION['avatar'] && !in_array($_SESSION['source'], array('google','facebook')) ) : ?> -->
<!-- <a href="#"><img class="circle" src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/uploads/<?php echo $_SESSION['avatar']; ?>" alt="avatar"></a> -->
<?php else : ?>
<a href="#"><img class="circle" src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/user.svg" alt="avatar"></a>
<?php if ($_SESSION["gender"] == "M") : ?>
<a href="#"><img class="circle" src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/male.svg" alt="avatar"></a>
<?php else : ?>
<a href="#"><img class="circle" src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/female.svg" alt="avatar"></a>
<?php endif; ?>
<?php endif; ?>
<a href="#name"><span class="white-text name"><?php echo $_SESSION["userFirstName"] . ' ' . $_SESSION["userLastName"]; ?></span></a>
<a href="#email"><span class="white-text email"><?php echo $_SESSION["userID"]; ?></span></a>
Expand Down
12 changes: 3 additions & 9 deletions server/classes/Tools.php
Expand Up @@ -248,6 +248,7 @@ public static function mysql_escape_mimic($unescaped) {
'"' => '\"',
"\x1a" => '\x1a'
);

return strtr($unescaped,$replacements);
}
}
Expand Down Expand Up @@ -389,19 +390,12 @@ public static function avatar_upload($userID, $file){

//path were our avatar image will be stored
$avatar_path = $uploads_path.$filename;
/*

// Check if file already exists
if (file_exists($avatar_path)) {
echo "Sorry, file already exists.";
return false;
unlink($avatar_path);
}

// Check file size
if ($file["size"] > 500000) {
echo "Sorry, your file is too large.";
return false;
}
*/
//make sure the file type is image
if (preg_match("!image!",$file['type']))
{
Expand Down
6 changes: 5 additions & 1 deletion server/pub/profile.php
Expand Up @@ -47,7 +47,11 @@
<input type="hidden" name="source" value="<?php echo ($isUser) ? trim($usr->getSource()) : 'ldap'; ?>" />
<input type="hidden" name="autoconn" value="" />
<div class="input-field col s12 center-align">
<img src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/user.svg" alt="Avatar User" class="circle" width="150">
<?php if ($usr->getGender() == "M") : ?>
<img src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/male.svg" alt="Avatar User" class="circle" width="150">
<?php else : ?>
<img src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/female.svg" alt="Avatar User" class="circle" width="150">
<?php endif; ?>
</div>
<div class="form-group">
<div class="input-field col s12 m6">
Expand Down
3 changes: 2 additions & 1 deletion server/pub/register.php
Expand Up @@ -35,7 +35,8 @@
<input type="hidden" name="autoconn" value="" />

<div class="input-field col s12 center-align">
<img src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/user.svg" alt="Avatar User" class="circle" width="150">
<img src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/male.svg" alt="Avatar User" class="circle" width="150">
<img src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/female.svg" alt="Avatar User" class="circle" width="150">
</div>
<div class="input-field col s12 m6">
<input id="firstName" name="firstName" type="text" class="bgInputs" autocomplete="off" required="">
Expand Down
3 changes: 1 addition & 2 deletions server/pub/userData.php
Expand Up @@ -58,14 +58,13 @@
$ut = !empty($_REQUEST['ut']) ? $_REQUEST['ut'] : false;
$theme = !empty($_REQUEST['theme']) ? $_REQUEST['theme'] : false;
$msg = null; /* system messages */
$birthday = false;

$avatar = ( $_FILES['avatar']['name'] ) ? UserData::avatar_upload($userID, $_FILES['avatar']) : false;

if ( $avatar ) {
$_SESSION['avatar'] = $avatar;
}

$birthday = false;
if ( !empty($_REQUEST['birthday']) ) {
$birthday = str_replace('/', '-', $_REQUEST['birthday']);
$birthday = date("Y-m-d", strtotime($birthday));
Expand Down
10 changes: 7 additions & 3 deletions server/templates/default/more.tpl.php
Expand Up @@ -24,10 +24,14 @@
<a href="#"><img class="circle" src="<?php echo $_SESSION['fb_data']['picture']['data']['url']; ?>" alt="avatar"></a>
<?php elseif ( $_SESSION['google_data']['picture'] ) : ?>
<a href="#"><img class="circle" src="<?php echo $_SESSION['google_data']['picture']; ?>" alt="avatar"></a>
<?php elseif ( $_SESSION['avatar'] && !in_array($_SESSION['source'], array('google','facebook')) ) : ?>
<a href="#"><img class="circle" src="<?=RELATIVE_PATH; ?>/images/<?=$_SESSION["skin"]?>/uploads/<?=$_SESSION['avatar']?>" alt="avatar"></a>
<?php // elseif ( $_SESSION['avatar'] && !in_array($_SESSION['source'], array('google','facebook')) ) : ?>
<!-- <a href="#"><img class="circle" src="<?=RELATIVE_PATH; ?>/images/<?=$_SESSION["skin"]?>/uploads/<?=$_SESSION['avatar']?>" alt="avatar"></a> -->
<?php else : ?>
<a href="#"><img class="circle" src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/user.svg" alt="avatar"></a>
<?php if ($_SESSION["gender"] == "M") : ?>
<a href="#"><img class="circle" src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/male.svg" alt="avatar"></a>
<?php else : ?>
<a href="#"><img class="circle" src="<?php echo RELATIVE_PATH; ?>/images/<?php echo $_SESSION["skin"]; ?>/female.svg" alt="avatar"></a>
<?php endif; ?>
<?php endif; ?>
<a href="#name"><span class="white-text name"><?php echo $_SESSION["userFirstName"] . ' ' . $_SESSION["userLastName"]; ?></span></a>
<a href="#email"><span class="white-text email"><?php echo $_SESSION["userID"]; ?></span></a>
Expand Down
1 change: 1 addition & 0 deletions server/webservices/Authentication.php
Expand Up @@ -118,6 +118,7 @@ function getUserData($userTK){
$retValue['avatar']=$objUser->getAvatar();
$retValue['agreement_date']=$objUser->getAgreementDate();
$retValue['professional_area']=$objUser->getProfessionalArea();
$retValue['gender']=$objUser->getGender();
}
}
return $retValue;
Expand Down

0 comments on commit 00a9812

Please sign in to comment.