<td><?php 
    echo $m->country;
    ?>
<br/><?php 
    echo $m->city;
    ?>
</td>
        <td>
            <?php 
    echo $words->getFormatted("MemberSinceColumn", MOD_layoutbits::ago(strtotime($m->created)));
    ?>
        </td>
        <td>
            <a href="members/<?php 
    echo $m->Username;
    ?>
/comments"><?php 
    echo $words->getFormatted("ViewComments") . "(" . $m->NbComments . ")";
    ?>
</a><br/>
            <?php 
    echo $purifier->purify(stripslashes($words->mInTrad($m->ProfileSummary, $language_id = 0, true)));
    ?>
        </td>
    </tr>
    <?php 
}
?>
</table>

Example #2
0
 /**
  * Update Member's Profile
  *
  * @param unknown_type $vars
  * @return unknown
  */
 public function updateProfile(&$vars)
 {
     $IdMember = (int) $vars['memberid'];
     $words = new MOD_words();
     $rights = new MOD_right();
     $m = $vars['member'];
     // fantastic ... love the implementation. Fake
     $CanTranslate = false;
     // $CanTranslate = CanTranslate($vars["memberid"], $_SESSION['IdMember']);
     $ReadCrypted = "MemberReadCrypted";
     // This might be changed in the future
     if ($rights->hasRight('Admin') || $rights->hasRight('SafetyTeam')) {
         // admin or CanTranslate can alter other profiles
         $ReadCrypted = "AdminReadCrypted";
         // In this case the AdminReadCrypted will be used
     }
     $m->removeLanguages();
     foreach ($vars['languages_selected'] as $lang) {
         if ($language = $this->createEntity('Language')->findById($lang->IdLanguage)) {
             $ml = $this->createEntity('MemberLanguage');
             $ml->setSpokenLanguage($m, $language, $lang->Level);
         }
     }
     // Set the language that ReplaceinMTrad uses for writing
     $words->setlangWrite($vars['profile_language']);
     // refactoring to use member entity
     //        $m->LastLogin = '******' ? 'Never' : $layoutbits->ago(strtotime($TM->LastLogin)); // Members lastlogin is no to be updated here
     if (isset($vars['Status']) && !empty($vars['Status'])) {
         // this can only happen when an admin or the safety team edits a profile
         $m->Status = $vars['Status'];
     }
     $m->Gender = $vars['gender'];
     $m->HideGender = $vars['HideGender'];
     $m->BirthDate = $vars['BirthYear'] . '-' . $vars['BirthMonth'] . '-' . $vars['BirthDay'];
     $m->bday = $vars['BirthDay'];
     $m->bmonth = $vars['BirthMonth'];
     $m->byear = $vars['BirthYear'];
     $m->HideBirthDate = $vars['HideBirthDate'];
     $m->HideGender = $vars['HideGender'];
     $m->ProfileSummary = $words->ReplaceInMTrad($vars['ProfileSummary'], "members.ProfileSummary", $IdMember, $m->ProfileSummary, $IdMember);
     $m->WebSite = strip_tags($vars['WebSite']);
     $m->Accomodation = $vars['Accomodation'];
     $m->Organizations = $words->ReplaceInMTrad($vars['Organizations'], "members.Organizations", $IdMember, $m->Organizations, $IdMember);
     $m->Occupation = $words->ReplaceInMTrad(strip_tags($vars['Occupation']), "members.Occupation", $IdMember, $m->Occupation, $IdMember);
     $m->ILiveWith = $words->ReplaceInMTrad($vars['ILiveWith'], "members.ILiveWith", $IdMember, $m->ILiveWith, $IdMember);
     $m->MaxGuest = strip_tags($vars['MaxGuest']);
     $m->MaxLenghtOfStay = $words->ReplaceInMTrad($vars['MaxLenghtOfStay'], "members.MaxLenghtOfStay", $IdMember, $m->MaxLenghtOfStay, $IdMember);
     $m->AdditionalAccomodationInfo = $words->ReplaceInMTrad($vars['AdditionalAccomodationInfo'], "members.AdditionalAccomodationInfo", $IdMember, $m->AdditionalAccomodationInfo, $IdMember);
     $m->TypicOffer = strip_tags($vars['TypicOffer']);
     $m->Restrictions = strip_tags($vars['Restrictions']);
     $m->OtherRestrictions = $words->ReplaceInMTrad($vars['OtherRestrictions'], "members.OtherRestrictions", $IdMember, $m->OtherRestrictions, $IdMember);
     $m->Hobbies = $words->ReplaceInMTrad($vars['Hobbies'], "members.Hobbies", $IdMember, $m->Hobbies, $IdMember);
     $m->Books = $words->ReplaceInMTrad($vars['Books'], "members.Books", $IdMember, $m->Books, $IdMember);
     $m->Music = $words->ReplaceInMTrad($vars['Music'], "members.Music", $IdMember, $m->Music, $IdMember);
     $m->Movies = $words->ReplaceInMTrad($vars['Movies'], "members.Movies", $IdMember, $m->Movies, $IdMember);
     $m->PastTrips = $words->ReplaceInMTrad($vars['PastTrips'], "members.PastTrips", $IdMember, $m->PastTrips, $IdMember);
     $m->PlannedTrips = $words->ReplaceInMTrad($vars['PlannedTrips'], "members.PlannedTrips", $IdMember, $m->PlannedTrips, $IdMember);
     $m->PleaseBring = $words->ReplaceInMTrad($vars['PleaseBring'], "members.PleaseBring", $IdMember, $m->PleaseBring, $IdMember);
     $m->OfferGuests = $words->ReplaceInMTrad($vars['OfferGuests'], "members.OfferGuests", $IdMember, $m->OfferGuests, $IdMember);
     $m->OfferHosts = $words->ReplaceInMTrad($vars['OfferHosts'], "members.OfferHosts", $IdMember, $m->OfferHosts, $IdMember);
     $m->PublicTransport = $words->ReplaceInMTrad($vars['PublicTransport'], "members.PublicTransport", $IdMember, $m->PublicTransport, $IdMember);
     // as $CanTranslate is set explicitly above, this is disabled
     // if (!$CanTranslate) { // a volunteer translator will not be allowed to update crypted data
     if ($vars["HouseNumber"] != $m->get_housenumber()) {
         $this->logWrite("Housenumber updated", "Address Update");
     }
     if ($vars["Street"] != $m->get_street()) {
         $this->logWrite("Street updated", "Address Update");
     }
     if ($vars["Zip"] != $m->get_zip()) {
         $this->logWrite("Zip updated", "Address Update");
     }
     if ($vars["Email"] == "cryptedhidden") {
         $this->logWrite("members.model updateprofile email keeps previous value (cryptedhidden detected)", "Debug");
     } else {
         if ($vars["Email"] != $m->email) {
             $this->logWrite("Email updated (previous was " . $m->email . ")", "Email Update");
             // Sticking to old BW, the previous email is stored in logs,
             // this might be discussed, but if the member fills a bad email,
             // there is no more way to retrieve him
             // Todo : get rid with this, but implement a confimmation mail
             $m->Email = MOD_crypt::NewReplaceInCrypted(strip_tags($vars['Email']), "members.Email", $IdMember, $m->Email, $IdMember, $this->ShallICrypt($vars, "Email"));
         }
     }
     if ($vars["HomePhoneNumber"] != "cryptedhidden") {
         $m->HomePhoneNumber = MOD_crypt::NewReplaceInCrypted(addslashes(strip_tags($vars['HomePhoneNumber'])), "members.HomePhoneNumber", $IdMember, $m->HomePhoneNumber, $IdMember, $this->ShallICrypt($vars, "HomePhoneNumber"));
     }
     if ($vars["CellPhoneNumber"] != "cryptedhidden") {
         $m->CellPhoneNumber = MOD_crypt::NewReplaceInCrypted(addslashes(strip_tags($vars['CellPhoneNumber'])), "members.CellPhoneNumber", $IdMember, $m->CellPhoneNumber, $IdMember, $this->ShallICrypt($vars, "CellPhoneNumber"));
     }
     if ($vars["WorkPhoneNumber"] != "cryptedhidden") {
         $m->WorkPhoneNumber = MOD_crypt::NewReplaceInCrypted(addslashes(strip_tags($vars['WorkPhoneNumber'])), "members.WorkPhoneNumber", $IdMember, $m->WorkPhoneNumber, $IdMember, $this->ShallICrypt($vars, "WorkPhoneNumber"));
     }
     if ($vars["chat_SKYPE"] != "cryptedhidden") {
         $m->chat_SKYPE = MOD_crypt::NewReplaceInCrypted(addslashes(strip_tags($vars['chat_SKYPE'])), "members.chat_SKYPE", $IdMember, $m->chat_SKYPE, $IdMember, $this->ShallICrypt($vars, "chat_SKYPE"));
     }
     if ($vars["chat_AOL"] != "cryptedhidden") {
         $m->chat_AOL = MOD_crypt::NewReplaceInCrypted(addslashes(strip_tags($vars['chat_AOL'])), "members.chat_AOL", $IdMember, $m->chat_AOL, $IdMember, $this->ShallICrypt($vars, "chat_AOL"));
     }
     if ($vars["chat_YAHOO"] != "cryptedhidden") {
         $m->chat_YAHOO = MOD_crypt::NewReplaceInCrypted(addslashes(strip_tags($vars['chat_YAHOO'])), "members.chat_YAHOO", $IdMember, $m->chat_YAHOO, $IdMember, $this->ShallICrypt($vars, "chat_YAHOO"));
     }
     if ($vars["chat_ICQ"] != "cryptedhidden") {
         $m->chat_ICQ = MOD_crypt::NewReplaceInCrypted(addslashes(strip_tags($vars['chat_ICQ'])), "members.chat_ICQ", $IdMember, $m->chat_ICQ, $IdMember, $this->ShallICrypt($vars, "chat_ICQ"));
     }
     if ($vars["chat_Others"] != "cryptedhidden") {
         $m->chat_Others = MOD_crypt::NewReplaceInCrypted(addslashes(strip_tags($vars['chat_Others'])), "members.chat_Others", $IdMember, $m->chat_Others, $IdMember, $this->ShallICrypt($vars, "chat_Others"));
     }
     if ($vars["chat_GOOGLE"] != "cryptedhidden") {
         $m->chat_GOOGLE = MOD_crypt::NewReplaceInCrypted(addslashes(strip_tags($vars['chat_GOOGLE'])), "members.chat_GOOGLE", $IdMember, $m->chat_GOOGLE, $IdMember, $this->ShallICrypt($vars, "chat_GOOGLE"));
     }
     $firstname = MOD_crypt::AdminReadCrypted($m->FirstName);
     $secondname = MOD_crypt::AdminReadCrypted($m->SecondName);
     $lastname = MOD_crypt::AdminReadCrypted($m->LastName);
     if ($firstname != strip_tags($vars['FirstName']) || $secondname != strip_tags($vars['SecondName']) || $lastname != strip_tags($vars['LastName'])) {
         $this->logWrite("{$m->Username} changed name. Firstname: {$firstname} -> " . strip_tags($vars['FirstName']) . ", second name: {$secondname} -> " . strip_tags($vars['SecondName']) . ", second name: {$lastname} -> " . strip_tags($vars['LastName']), 'Profile update');
     }
     if ($vars["FirstName"] != "cryptedhidden") {
         MOD_crypt::NewReplaceInCrypted($this->dao->escape(strip_tags($vars['FirstName'])), "members.FirstName", $IdMember, $m->FirstName, $IdMember, $this->ShallICrypt($vars, "FirstName"));
     }
     if ($vars["SecondName"] != "cryptedhidden") {
         $cryptId = MOD_crypt::NewReplaceInCrypted($this->dao->escape(strip_tags($vars['SecondName'])), "members.SecondName", $IdMember, $m->SecondName, $IdMember, $this->ShallICrypt($vars, "SecondName"));
         // Update member if a new crypted SecondName value was added
         if ($cryptId != $m->SecondName) {
             $m->SecondName = $cryptId;
         }
     }
     if ($vars["LastName"] != "cryptedhidden") {
         MOD_crypt::NewReplaceInCrypted($this->dao->escape(strip_tags($vars['LastName'])), "members.LastName", $IdMember, $m->LastName, $IdMember, $this->ShallICrypt($vars, "LastName"));
     }
     if ($vars["Zip"] != "cryptedhidden") {
         $this->logWrite("in members.model updateprofile() Before Zip update addresss.Zip=" . $m->address->Zip, "Debug");
         $cryptId = MOD_crypt::NewReplaceInCrypted($this->dao->escape(strip_tags($vars['Zip'])), "addresses.Zip", $m->IdAddress, $m->address->Zip, $IdMember, $this->ShallICrypt($vars, "Zip"));
         // Update addresses table if a new crypted zip value was added
         if ($cryptId != $m->address->Zip) {
             $m->setCryptedZip($cryptId);
         }
         $this->logWrite("in members.model updateprofile() After Zip update addresss.Zip=" . $m->address->Zip . " \$cryptId=" . $cryptId, "Debug");
     }
     if ($vars["HouseNumber"] != "cryptedhidden") {
         $cryptId = MOD_crypt::NewReplaceInCrypted($this->dao->escape(strip_tags($vars['HouseNumber'])), "addresses.HouseNumber", $m->IdAddress, $m->address->HouseNumber, $IdMember, $this->ShallICrypt($vars, "Address"));
         // Update addresses table if a new crypted HouseNumber value was added
         if ($cryptId != $m->address->HouseNumber) {
             $m->setCryptedHouseNumber($cryptId);
         }
     }
     if ($vars["Street"] != "cryptedhidden") {
         $cryptId = MOD_crypt::NewReplaceInCrypted($this->dao->escape(strip_tags($vars['Street'])), "addresses.StreetName", $m->IdAddress, $m->address->StreetName, $IdMember, $this->ShallICrypt($vars, "Address"));
         // Update addresses table if a new crypted StreetName value was added
         if ($cryptId != $m->address->StreetName) {
             $m->setCryptedStreetName($cryptId);
         }
     }
     // Check relations, and update them if they have changed
     $Relations = $m->get_all_relations();
     foreach ($Relations as $Relation) {
         if ($words->mInTrad($Relation->Comment, $vars['profile_language']) != $vars["RelationComment_" . $Relation->id] and !empty($vars["RelationComment_" . $Relation->id])) {
             //              echo "Relation #".$Relation->id,"<br />", $words->mInTrad($Relation->Comment,$vars['profile_language']),"<br />",$vars['RelationComment_'.$Relation->id],"<br />" ;
             $IdTrad = $words->ReplaceInMTrad(strip_tags($vars["RelationComment_" . $Relation->id]), "specialrelations.Comment", $Relation->id, $Relation->Comment, $IdMember);
             // Empty comments have trad id 0. Causing ReplaceInMTrad to create
             // a new trad id and returning the new number.
             if ($IdTrad != $Relation->id) {
                 $m->update_relation($Relation->id, $IdTrad);
             }
             $this->logWrite("updating relation #" . $Relation->id . " Relation Confirmed=" . $Relation->Confirmed, "Profile update");
         }
     }
     // Check groups membership description, and update them if they have changed
     // Tod od with Peter: check if there is other feature to update a group membership (a groupmembership model for example, or entity)
     /* group membership should not be present here, disabled for now
        $Groups=$m->getGroups() ;
        for ($i = 0; $i < count($Groups) ; $i++) {
            $group=$Groups[$i] ;
            $group_id = $group->getPKValue() ;
            $group_name_translated = $words->get("Group_".$group->Name);
            $group_comment_translated = htmlspecialchars($words->mInTrad($m->getGroupMembership($group)->Comment,$vars['profile_language']), ENT_QUOTES);
            $IdMemberShip=$m->getGroupMembership($group)->id ;
            if (($words->mInTrad($m->getGroupMembership($group)->Comment,$vars['profile_language'])!=$vars["GroupMembership_".$IdMemberShip])
                and (!empty($vars["GroupMembership_".$IdMemberShip])))  {
                echo "Group #".$group_id,"<br />",$words->mInTrad($m->getGroupMembership($group)->Comment,$vars['profile_language']),"<br />",$vars["GroupMembership_".$IdMemberShip],"<br />" ;
                $words->ReplaceInMTrad(strip_tags($vars["GroupMembership_".$IdMemberShip]),"membersgroups.Comment", $IdMemberShip, $m->getGroupMembership($group)->Comment, $IdMember);
                $this->logWrite("updating membership description in group #".$group_id." Group name=".$group->name, "Profil update");
            }
        }
        */
     // if a member with status NeedMore updates her/his profile, moving them back to pending
     if ($m->Status == 'NeedMore') {
         $m->Status = 'Pending';
     }
     $status = $m->update();
     if (!empty($_FILES['profile_picture']) && !empty($_FILES['profile_picture']['tmp_name'])) {
         if (isset($_FILES['profile_picture']) && $_FILES['profile_picture']['error'] == 0) {
             $this->avatarMake($vars['memberid'], $_FILES['profile_picture']['tmp_name']);
         }
     }
     if ($IdMember == $_SESSION['IdMember']) {
         $this->logWrite("Profile update by member himself [Status={$m->Status}]", "Profile update");
     } else {
         $this->logWrite("update of another profile <b>" . $m->Username . "</b>", "Profile update");
         // It can be an admin update or a delegated translation update
     }
     return $status;
 }
Example #3
0
    protected function column_col3()
    {
        $words = new MOD_words();
        $member = $this->member;
        $layoutkit = $this->layoutkit;
        $formkit = $layoutkit->formkit;
        $callback_tag = $formkit->setPostCallback('MembersController', 'RelationCallback');
        $page_url = PVars::getObj('env')->baseuri . implode('/', PRequest::get()->request);
        $TabRelationsType = $member->get_TabRelationsType();
        $relation = $this->model->get_relation_between_members($member->id);
        if (isset($relation['member']->Confirmed) && $relation['member']->Confirmed == 'No') {
            $action = 'confirm';
        } elseif (isset($relation['myself']->id)) {
            $action = 'update';
        } else {
            $action = 'add';
        }
        ?>
         <?php 
        if ($action == 'update' && isset($relation['member']->Confirmed)) {
            ?>
            <p class="note"><?php 
            echo $words->get('RelationIsConfirmed', $member->Username);
            ?>
</p>
         <?php 
        } elseif ($action == 'update') {
            ?>
            <p class="note"><?php 
            echo $words->get('RelationWaitConfirmed', $member->Username);
            ?>
</p>
         <?php 
        }
        ?>
        <form method="post" action="<?php 
        echo $page_url;
        ?>
" name="relation" id="relation" enctype="multipart/form-data">
        <fieldset>
            <input type="hidden"  name="IdRelation"  value="<?php 
        echo $member->id;
        ?>
" />
            <input type="hidden"  name="IdOwner"  value="<?php 
        echo $_SESSION['IdMember'];
        ?>
" />
            <?php 
        echo $callback_tag;
        ?>
            <legend><?php 
        echo $words->get($action . 'Relation');
        ?>
</legend>
            <p><?php 
        echo $words->get('MyRelationListExplanation', $member->Username, $member->Username);
        ?>
</p>
            <?php 
        if (count($relation['member']) <= 0) {
            ?>
            <div class="row">
            <label class="grey"><?php 
            echo $words->get('RelationListCategory');
            ?>
</label><br />
            <?php 
            $tt = $TabRelationsType;
            $max = count($tt);
            for ($ii = 0; $ii < $max; $ii++) {
                echo "<input type=checkbox name=\"Type_" . $tt[$ii] . "\"";
                if (count($relation['myself']) > 0 && strpos(" " . $relation['myself']->Type, $tt[$ii]) != 0) {
                    echo " checked ";
                }
                echo "> " . $words->get("Relation_Type_" . $tt[$ii]) . "<br />";
            }
            ?>
            <p class="desc"><?php 
            echo $words->get('RelationListExplanation');
            ?>
</p>
            </div>
            <?php 
        } else {
            ?>
            <div class="row">
            <?php 
            echo $words->get('RelationType');
            ?>
: <strong><?php 
            echo $words->get("Relation_Type_" . $relation['member']->Type);
            ?>
</strong>
            </div>
            <?php 
        }
        ?>
            <div class="row">
                <label class="grey"><?php 
        echo $words->get("RelationText", $member->Username);
        ?>
:</label><br />
                <textarea rows="4" cols="60" name="Comment"><?php 
        if (isset($relation['myself']->Comment)) {
            $lang = $this->model->get_profile_language();
            $comment = $words->mInTrad($relation['myself']->IdTradComment, $lang->id);
            // Hack to filter out accidental '0' or '123456' comments that were saved
            // by users while relation comment update form was buggy (see #1580)
            if (is_numeric($comment)) {
                $comment = '';
            }
            echo $comment;
        }
        ?>
</textarea>
            </div>
            <?php 
        if ($action == 'confirm') {
            echo '<input type="hidden" name="Type" value="' . $relation['member']->Type . '">';
            echo '<input type="hidden" name="RelationId" value="' . $relation['member']->id . '">';
            echo '<input type="hidden" name="action" value="confirm">';
        } elseif ($action == 'update') {
            echo '<input type="hidden" name="RelationId" value="' . $relation['myself']->id . '">';
            echo '<input type="hidden" name="action" value="update">';
        } else {
            echo '<input type="hidden" name="action" value="add">';
        }
        ?>
            <br />
            <input type="submit" name="submit" value="<?php 
        echo $words->getSilent($action . 'Relation');
        ?>
" /><?php 
        echo $words->flushBuffer();
        ?>
            <br />
        </fieldset>
        </form>
        <?php 
    }
<?php

$words = new MOD_words();
$purifier = MOD_htmlpure::getBasicHtmlPurifier();
$member = $this->member;
$relations = $member->relations;
$username = $member->Username;
$myself = $this->myself;
$lang = $this->model->get_profile_language();
$profile_language = $lang->id;
?>
<h3><?php 
echo $words->get('MyRelations');
?>
</h3>

<ul class="linklist">
<?php 
foreach ($relations as $rel) {
    $comment = $words->mInTrad($rel->IdTradComment, $profile_language, true);
    // Hack to filter out accidental '0' or '123456' comments that were saved
    // by users while relation comment update form was buggy (see #1580)
    if (is_numeric($comment)) {
        $comment = '';
    }
    $rel->Comment = $purifier->purify($comment);
    require 'relation_item.php';
}
?>
</ul>