Exemplo n.º 1
1
 /**
  * sVerifierLevel function returns the current verification level of member
  * @IdMember (optional) the Id of the member to obtaon verification level, if not provided current member in session will be use
  * returns : a string with the member level
  * a member can be a "Normal" member (one who was not veridied)
  *                   "VerifiedByNormal" member (if he was verified by a normal member)
  *                   "VerifiedByVerified" member (if he was verified by an approved verifier)
  *                   "VerifiedByApproved" member (if he has right to be a verifier)
  *
  */
 public function sVerifierLevel($member_id = -1)
 {
     $member_id = (int) $member_id;
     $sRet = "Normal";
     if ($member_id > 0) {
         // everything is cool
     } else {
         if (isset($_SESSION["IdMember"])) {
             // use the member who is currently logged in.
             $member_id = $_SESSION["IdMember"];
         } else {
             // can't help it, so we return false.
             return false;
         }
     }
     $rr = $this->SingleLookup("\nSELECT  max(Type) AS Type\nFROM    verifiedmembers\nWHERE   IdVerified = {$member_id}\n            ");
     if ($rr) {
         if ("Buggy" == $rr->Type) {
             // problem
             throw new PException('Buggy Value in verifiedmembers for IdMember=".$IdMember." !');
         } else {
             if (!empty($rr->Type)) {
                 $sRet = $rr->Type;
             }
         }
     }
     // if the member is a verifier and has ApprovedVerifier scope, this information will supersed all others
     // comment by lemon-head: Better do this in the controller?
     if (MOD_right::get()->hasRight("Verifier", "ApprovedVerifier")) {
         // TODO: HasRight does only check the currently logged-in user, not the given argument!
         $sRet = "VerifiedByApproved";
     }
     return $sRet;
 }
Exemplo n.º 2
0
 /**
  * Returns the number of people due to be checked to problems or what.
  * The number depends on the scope of the person logged on.
  *
  * $_GroupScope="" is an optional value for group Scope which can be used for performance if it was already fetched from database
  * @return integer indicating the number of people wiche need to be accepted 
  * in a Group if the current member has right to accept them
  */
 public function getNumberPersonsToAcceptInGroup($_GroupScope = "")
 {
     $R = MOD_right::get();
     if ($_GroupScope != "") {
         $GroupScope = $_GroupScope;
     } else {
         $GroupScope = $R->RightScope('Group');
     }
     if ($GroupScope == "") {
         return 0;
     }
     if ($R->hasRight('Group', 'All')) {
         $where = "";
     } else {
         $tt = explode(",", $GroupScope);
         $where = "(";
         foreach ($tt as $Scope) {
             if ($where != "(") {
                 $where .= ",";
             }
             $where = $where . $Scope;
         }
         $where = " and `groups`.`Name` in " . $where . ")";
     }
     $query = 'SELECT SQL_CACHE COUNT(*) AS cnt FROM `membersgroups`,`groups` where `membersgroups`.`Status`="WantToBeIn" and `groups`.`id`=`membersgroups`.`IdGroup`' . $where;
     //   die($query) ;
     $result = $this->dao->query($query);
     $record = $result->fetch(PDB::FETCH_OBJ);
     if (isset($record->cnt)) {
         return $record->cnt;
     } else {
         return 0;
     }
 }
Exemplo n.º 3
0
 /**
  * Get donations (max. 25, all if user has Treasurer rights)
  *
  * @param recent Get only the results since the start of the current campaign
  * @return array List of donations as objects with string properties
  *
  * TODO: Add parameter for limit and do permission check elsewhere
  */
 public function getDonations($recent = false)
 {
     $rights = MOD_right::get();
     $where = "";
     list($dummy, $campaignStart) = $this->getCampaignValues();
     if ($rights->hasRight('Treasurer')) {
         $limitClause = "";
         if ($recent) {
             $where = "WHERE created >= '" . $campaignStart . "'";
         }
     } else {
         $limitClause = "LIMIT 25";
     }
     $query = "\r\n            SELECT\r\n                *\r\n            FROM\r\n                donations\r\n            " . $where . "\r\n            ORDER BY\r\n                created DESC\r\n            {$limitClause}\r\n            ";
     $result = $this->dao->query($query);
     $donations = array();
     while ($row = $result->fetch(PDB::FETCH_OBJ)) {
         if ($row->IdCountry == 0) {
             $countryName = "Unknown country";
         } else {
             $idCountry = intval($row->IdCountry);
             $resultcountry = $this->dao->query("\r\n                    SELECT\r\n                        name\r\n                    FROM\r\n                        geonames_cache\r\n                    WHERE\r\n                        geonameId = {$idCountry}\r\n                    ");
             $country = $resultcountry->fetch(PDB::FETCH_OBJ);
             $countryName = $country->name;
         }
         $row->CountryName = $countryName;
         array_push($donations, $row);
     }
     return $donations;
 }
Exemplo n.º 4
0
 public function render()
 {
     $this->_init();
     $this->_model = new VolunteerbarModel();
     if (empty($_SESSION['IdMember'])) {
         return;
         // Do nothing if user is not identified (thi cannot be a volunteer)
     }
     $R = MOD_right::get();
     $mayViewBar = $R->hasRightAny();
     if ($mayViewBar) {
         $numberPersonsToBeAccepted = 0;
         $numberPersonsToBeChecked = 0;
         if ($R->hasRight("Accepter")) {
             $numberPersonsToBeAccepted = $this->_model->getNumberPersonsToBeAccepted();
             $AccepterScope = $R->rightScope('Accepter');
             $numberPersonsToBeChecked = $this->_model->getNumberPersonsToBeChecked($AccepterScope);
         }
         $numberPersonsToAcceptInGroup = 0;
         if ($R->hasRight("Group")) {
             $numberPersonsToAcceptInGroup = $this->_model->getNumberPersonsToAcceptInGroup($R->rightScope('Group'));
         }
         $numberMessagesToBeChecked = 0;
         $numberSpamToBeChecked = 0;
         if ($R->hasRight("Checker")) {
             $numberMessagesToBeChecked = $this->_model->getNumberMessagesToBeChecked();
             $numberSpamToBeChecked = $this->_model->getNumberSpamToBeChecked();
         }
         require $this->getTemplatePath();
     }
 }
Exemplo n.º 5
0
 function index($args = false)
 {
     $request = $args->request;
     if (!MOD_right::get()->hasRight('Debug')) {
         return new PublicStartpage();
     } else {
         switch (isset($request[0]) ? $request[0] : false) {
             case 'sqltest':
                 $page = new SqltestPage();
                 $page->model = new SqltestModel();
                 return $page;
             case 'debug':
             default:
                 switch (isset($request[1]) ? $request[1] : false) {
                     case 'inicache':
                         return new DebugInicachePage();
                     case 'sqltest':
                         $page = new SqltestPage();
                         $page->model = new SqltestModel();
                         return $page;
                     case 'dbsummary':
                         $page = new DatabaseSummaryPage();
                         $page->model = new DatabaseSummaryModel();
                         foreach (@$args->get as $key => $value) {
                             // set filters
                             $page->{$key} = $value;
                         }
                         return $page;
                     default:
                         return new DebugPage();
                 }
         }
     }
 }
 /**
  * configure the teaser (the content of the orange bar)
  */
 protected function teaserHeadline()
 {
     $words = $this->getWords();
     if (MOD_right::get()->hasRight("Verifier", "ApprovedVerifier")) {
         echo $words->getFormatted("verifymembers_approvedverifier");
     } else {
         echo $words->getFormatted("verifymembers_teaser");
     }
 }
 /**
  * configure the page title (what appears in your browser's title bar)
  * @return string the page title
  */
 protected function getPageTitle()
 {
     $words = new MOD_words();
     if (MOD_right::get()->hasRight("Verifier", "ApprovedVerifier")) {
         echo $words->getFormatted("verifymembers_approvedverifier");
     } else {
         echo $words->getFormatted("verifymembers_teaser");
     }
 }
Exemplo n.º 8
0
 public function __construct()
 {
     parent::__construct();
     $this->_model = new Forums();
     $this->_view = new ForumsView($this->_model);
     //                $this->_view->page=new RoxGenericPage();
     $this->BW_Right = MOD_right::get();
     $this->BW_Flag = MOD_flag::get();
     $this->request = PRequest::get()->request;
     $this->forums_uri = $this->get_forums_uri();
     $this->_model->forums_uri = $this->forums_uri;
 }
Exemplo n.º 9
0
function getShowCondition($com, $login)
{
    // show comment when marked as display in public (default situation)
    if ($com->DisplayInPublic == 1) {
        return 1;
    }
    // show comment to Safety team
    if (MOD_right::get()->HasRight('Comments')) {
        return 2;
    }
    // show comment to writer
    if ($com->UsernameFromMember == $login) {
        return 3;
    }
    // do not show comment
    return false;
}
Exemplo n.º 10
0
 public function GetGuests()
 {
     global $_SYSHCVOL;
     $Rights = MOD_right::get();
     $TGuest = array();
     // Case of members who can see additional information about members last activity
     if ($Rights->hasRight("Debug", "ShowLastActivity")) {
         $query = "select appearance,lastactivity,now()-updated as NbSec from guestsonline where guestsonline.updated>DATE_SUB(now(),interval " . $_SYSHCVOL['WhoIsOnlineDelayInMinutes'] . " minute) order by guestsonline.updated  desc";
         $s = $this->dao->query($query);
         if (!$s) {
             throw new PException('Failed to get online guests!');
         }
         while ($row = $s->fetch(PDB::FETCH_OBJ)) {
             array_push($TGuest, $row);
         }
     }
     return $TGuest;
 }
Exemplo n.º 11
0
 /**
  * Delete several selfuploaded pictures as loggedin owner or with gallery rights
  *
  * @access public
  * @param Object $image Image to be deleted
  * @return boolean
  */
 public function deleteMultiple($images)
 {
     if (!($member = $this->getLoggedInMember())) {
         return false;
     }
     $R = MOD_right::get();
     $GalleryRight = $R->hasRight('Gallery');
     foreach ($images as $image) {
         if (!$image) {
             return false;
         }
         if ($member->get_userid() == $this->imageGalleryOwner('image', $image) || $GalleryRight > 1) {
             $image = $this->imageData($image);
             // Log the deletion to prevent admin abuse
             MOD_log::get()->write("Deleting multiple gallery items #" . $image->id . " filename: " . $image->file . " belonging to user: "******"Gallery");
             $this->deleteThisImage($image);
         } else {
             return false;
         }
     }
 }
Exemplo n.º 12
0
 /**
  * This method is called when a translator says "rox/trmode/.."
  * TODO: Better do this in a model class 
  *
  * @param string $tr_mode
  */
 private function _switchTrMode($tr_mode)
 {
     if (!MOD_right::get()->hasRight('Words')) {
         $_SESSION['tr_mode'] = 'browse';
         return;
     }
     switch ($tr_mode) {
         case 'browse':
         case 'translate':
         case 'edit':
             $_SESSION['tr_mode'] = $tr_mode;
             break;
         default:
             // don't change tr mode
     }
 }
Exemplo n.º 13
0
 <a style="display:inline" href="http://trac.bewelcome.org/">BW Rox</a> rev. <a href="http://github.com/BeWelcome/rox/commit/<?php 
echo $versionInfo;
?>
"><?php 
echo $versionInfo;
?>
</a>
     (<span title="<?php 
echo $deploymentDateTime;
?>
"><?php 
echo $deploymentDate;
?>
</span>)</em></p>

<?php 
// List of DB queries with execution time
if (PVars::get()->debug) {
    $R = MOD_right::get();
    if ($R->HasRight("Debug", "DB_QUERY")) {
        ?>
<p>
<a style="cursor:pointer;" onclick="$('query_list').toggle();">DB queries</a>
</p>
<div id='query_list' style="display:none;">
<?php 
        foreach ($query_list as $key => $query) {
            echo $key + 1 . ": {$query}<br />\n";
        }
    }
}
<?php

$words = new MOD_words();
$request = PRequest::get()->request;
$gallery_ctrl = new GalleryController();
$image = $this->image;
if ($member = $this->model->getLoggedInMember()) {
    $callbackId = $gallery_ctrl->editProcess($image);
    $vars =& PPostHandler::getVars($callbackId);
}
$GalleryRight = MOD_right::get()->hasRight('Gallery');
$d = $image;
$d->user_handle = MOD_member::getUserHandle($d->user_id_foreign);
$canEdit = $member && $member->Username == $d->user_handle ? true : false;
if (!isset($vars['errors'])) {
    $vars['errors'] = array();
}
Exemplo n.º 15
0
 public function editCodeFormCheck($form)
 {
     $errors = array();
     $rights = MOD_right::get();
     $wordLevel = $rights->hasRight('Words');
     switch ($form['DOACTION']) {
         case 'Submit':
             if ($wordLevel >= 10) {
                 $errors = $this->createCodeFormCheck($form);
             }
             if (empty($form['changetype'])) {
                 $errors[] = 'AdminWordErrorChangeTypeEmpty';
             }
             break;
         case 'Back':
             break;
     }
     return $errors;
 }
Exemplo n.º 16
0
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
BW Rox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/> or 
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
Boston, MA  02111-1307, USA.
*/
/** 
 * @author Matthias Heß <globetrotter_tt>
 */
$words = new MOD_words();
$userRights = MOD_right::get();
$scope = $userRights->RightScope('Comments');
?>

<h3><?php 
echo $words->get('Action');
?>
</h3>
<ul class="linklist">
    <li><a href="<?php 
echo $this->router->url('admin_comments_list_subset', array('subset' => 'negative'));
?>
">Negative comments</a></li>
    <?php 
if ($scope == "AdminAbuser" || $scope == '"All"') {
    ?>
Exemplo n.º 17
0
 /**
  * configure the sidebar
  */
 protected function leftSidebar()
 {
     if (MOD_right::get()->hasRight('Debug')) {
         require 'templates/adminbar.php';
     }
 }
Exemplo n.º 18
0
 /**
  * configure the sidebar
  */
 protected function leftSidebar()
 {
     $words = $this->getWords();
     echo '<ul class="linklist">';
     echo '<li><a href="http://www.bevolunteer.org/wiki/How_pollsworks">Wiki Doc</a></li>';
     echo '<li><a href="polls/listall">', $words->getFormatted("polls_listlink"), '</a></li>';
     if (MOD_right::get()->HasRight("Poll", "create")) {
         echo '<li><a href="polls/create">', $words->getFormatted("polls_createlink"), '</a></li>';
     }
     echo "</ul>";
 }
Exemplo n.º 19
0
 /**
  * looks up a word keycode in the DB, and returns an object of type LookedUpWord.
  * If a translation in the intended language is not found, it uses the English version.
  * If no English definition exists, the keycode itself is used.
  *
  * @param unknown_type $code the key code for the db lookup
  * @return LookedUpWord information that is created from the word lookup
  */
 private function _lookup($code, $args, $lang = false, $get_raw = false)
 {
     if ($lang == false) {
         $lang = $this->_lang;
     }
     $row = $this->_lookup_row($code, $lang);
     // select the English wordcode only if not archived
     $row_en = $this->_lookup_row($code, 'en', 'AND (isarchived=0 or isarchived is null)');
     $R = MOD_right::get();
     if (!$this->_offerTranslationLink) {
         // for normal people no translation stuff
         if (!$row_en) {
             // if English doesn't exist, show code
             $lookup_result = $code;
         } elseif (!$row || $row->updated < $row_en->majorupdate) {
             // if no translation or translation is outdated, show English
             $lookup_result = $this->_modified_sentence_from_row($row_en, $args, $get_raw);
         } else {
             // if up-to-date translation present, show translation
             $lookup_result = $this->_modified_sentence_from_row($row, $args, $get_raw);
         }
         return new LookedUpWord($code, $lang, $lookup_result);
     } else {
         // for translators, the LookedUpWord object needs more info
         $tr_quality = LookedUpWord::FINE;
         if (!$row_en) {
             // there is no English text: show the wordcode
             // show as missing if user has enough rights
             if ($R->hasRight("Words") < 10) {
                 $tr_success = LookedUpWord::NO_TR_LINK;
             } else {
                 $tr_success = LookedUpWord::MISSING_WORD;
             }
             $lookup_result = $code;
         } elseif (!$row) {
             // there is no translation: show the English text and as missing
             $tr_success = LookedUpWord::MISSING_TR;
             $lookup_result = $this->_modified_sentence_from_row($row_en, $args, $get_raw);
         } elseif (!($row_en->updated > $row->updated)) {
             // the English text has not been updated at all after the translation: show translation normally
             $tr_success = LookedUpWord::SUCCESSFUL;
             $lookup_result = $this->_modified_sentence_from_row($row, $args, $get_raw);
         } elseif (!($row_en->majorupdate > $row->updated)) {
             // the English text did not have a major update after the translation: show translation and as obsolete
             $tr_success = LookedUpWord::OBSOLETE;
             $lookup_result = $this->_modified_sentence_from_row($row, $args, $get_raw);
         } else {
             // the English text did have a major update after the translation: show English text and as obsolete
             $tr_success = LookedUpWord::OBSOLETE;
             $lookup_result = $this->_modified_sentence_from_row($row_en, $args, $get_raw);
         }
         if (!$row_en) {
         } else {
             if ($row_en->donottranslate == 'yes') {
                 // text is dnt: show normally
                 $tr_success = LookedUpWord::NO_TR_LINK;
                 if (!$row || $row->updated < $row_en->majorupdate) {
                     $lookup_result = $this->_modified_sentence_from_row($row_en, $args, $get_raw);
                 } else {
                     $lookup_result = $this->_modified_sentence_from_row($row, $args, $get_raw);
                 }
             }
         }
         switch ($this->_trMode) {
             case 'browse':
                 $tr_success = LookedUpWord::NO_TR_LINK;
                 break;
             case 'proofread':
                 // does not yet exist.
                 break;
             case 'translate':
                 if ($tr_success == LookedUpWord::SUCCESSFUL) {
                     $tr_success = LookedUpWord::NO_TR_LINK;
                 }
                 break;
             case 'edit':
                 // no need to do anything
                 break;
         }
         return new LookedUpWord($code, $lang, $lookup_result, $tr_success, $tr_quality);
     }
 }
Exemplo n.º 20
0
 public function __construct(&$dao, $boardname, $link, $navichain = false, $tags = false, $continent = false, $countrycode = false, $admincode = false, $geonameid = false, $board_description = false, $IdGroup = false, $no_forumsgroup = false)
 {
     $this->THREADS_PER_PAGE = Forums::CV_THREADS_PER_PAGE;
     //Variable because it can change wether the user is logged or no
     $this->POSTS_PER_PAGE = Forums::CV_POSTS_PER_PAGE;
     //Variable because it can change wether the user is logged or no
     $this->BW_Right = MOD_right::get();
     if (!isset($_SESSION['IdMember'])) {
         $this->THREADS_PER_PAGE = 100;
         // Variable because it can change wether the user is logged or no
         $this->POSTS_PER_PAGE = 200;
         // Variable because it can change wether the user is logged or no
     }
     $this->dao =& $dao;
     $this->boardname = $boardname;
     $this->board_description = $board_description;
     $this->link = $link;
     $this->continent = $continent;
     $this->countrycode = $countrycode;
     $this->admincode = $admincode;
     $this->geonameid = $geonameid;
     $this->navichain = $navichain;
     $this->IdGroup = $IdGroup;
     $this->tags = $tags;
     //	Decide if it is an active LoggeMember or not
     if (empty($_SESSION["IdMember"]) or empty($_SESSION["MemberStatus"]) or $_SESSION["MemberStatus"] == 'Pending' or $_SESSION["MemberStatus"] == 'NeedMore') {
         $this->PublicThreadVisibility = " (ThreadVisibility='NoRestriction') and (ThreadDeleted!='Deleted')";
         $this->PublicPostVisibility = " (PostVisibility='NoRestriction') and (PostDeleted!='Deleted')";
         if ($no_forumsgroup) {
             $this->ThreadGroupsRestriction = " (IdGroup != 0 and ThreadVisibility ='NoRestriction')";
             $this->PostGroupsRestriction = " (IdGroup != 0 and PostVisibility='NoRestriction')";
         } else {
             $this->ThreadGroupsRestriction = " (IdGroup=0 or ThreadVisibility ='NoRestriction')";
             $this->PostGroupsRestriction = " (IdGroup=0 or PostVisibility='NoRestriction')";
         }
     } else {
         $this->PublicThreadVisibility = "(ThreadVisibility!='ModeratorOnly') and (ThreadDeleted!='Deleted')";
         $this->PublicPostVisibility = " (PostDeleted!='Deleted')";
         //if the member prefers to see only posts to his/her groups
         $roxmodel = new RoxModelBase();
         $member = $roxmodel->getLoggedInMember();
         $owngroupsonly = $member->getPreference("ShowMyGroupsTopicsOnly", $default = "No");
         $this->owngroupsonly = $owngroupsonly;
         if ($owngroupsonly == "Yes" && ($this->IdGroup === false || !isset($this->IdGroup))) {
             // 0 is the group id for topics without an explicit group, we don't want them in this case. Lazy hack to avoid changing more than necessary: replace 0 with -1
             $this->PostGroupsRestriction = " (((IdGroup IN (-1";
             $this->ThreadGroupsRestriction = " (((IdGroup IN (-1";
         } else {
             $this->PostGroupsRestriction = " ((PostVisibility IN ('MembersOnly','NoRestriction') or (PostVisibility = 'GroupOnly' AND IdGroup IN (0";
             $this->ThreadGroupsRestriction = " ((ThreadVisibility IN ('MembersOnly','NoRestriction') OR (ThreadVisibility = 'GroupOnly' AND IdGroup IN (0";
         }
         $qry = $this->dao->query("SELECT IdGroup FROM membersgroups WHERE IdMember=" . $_SESSION["IdMember"] . " AND Status = 'In'");
         if (!$qry) {
             throw new PException('Failed to retrieve groups for member id =#' . $_SESSION["IdMember"] . ' !');
         }
         while ($rr = $qry->fetch(PDB::FETCH_OBJ)) {
             $this->PostGroupsRestriction = $this->PostGroupsRestriction . "," . $rr->IdGroup;
             $this->ThreadGroupsRestriction = $this->ThreadGroupsRestriction . "," . $rr->IdGroup;
         }
         if ($no_forumsgroup) {
             $this->PostGroupsRestriction = $this->PostGroupsRestriction . "))) and IdGroup != 0)";
             $this->ThreadGroupsRestriction = $this->ThreadGroupsRestriction . "))) and IdGroup != 0)";
         } else {
             $this->PostGroupsRestriction = $this->PostGroupsRestriction . "))))";
             $this->ThreadGroupsRestriction = $this->ThreadGroupsRestriction . "))))";
         }
     }
     // Prepares additional visibility options for moderator
     if ($this->BW_Right->HasRight("ForumModerator")) {
         $this->PublicPostVisibility = " PostVisibility IN ('NoRestriction', 'MembersOnly','GroupOnly','ModeratorOnly')";
         $this->PublicThreadVisibility = " ThreadVisibility IN ('NoRestriction', 'MembersOnly','GroupOnly','ModeratorOnly')";
         if ($this->BW_Right->HasRight("ForumModerator", "AllGroups") or $this->BW_Right->HasRight("ForumModerator", "All")) {
             if ($no_forumsgroup) {
                 $this->PostGroupsRestriction = " (IdGroup != 0)";
                 $this->ThreadGroupsRestriction = " (IdGroup != 0)";
             } else {
                 $this->PostGroupsRestriction = " (1=1)";
                 $this->ThreadGroupsRestriction = " (1=1)";
             }
         }
     }
 }
Exemplo n.º 21
0
    if (!$region) {
        echo ' &raquo; ' . $country->name;
    } else {
        echo ' &raquo; <a href="places/' . $countrycode . '">' . $country->name . '</a>';
        if (!$city) {
            echo ' &raquo; ' . $region;
        } else {
            echo ' &raquo; <a href="places/' . $countrycode . '/' . $region . '">' . $region . '</a>';
            echo ' &raquo; ' . $city;
        }
    }
    echo '</span>';
}
?>
</h1> 
<?php 
if (isset($title)) {
    if (MOD_right::get()->HasRight('Debug')) {
        ?>
        <h2>
        <?php 
        echo $title;
        // This is only visible to people with debug rights
        echo " <a href=\"geo/displaylocation/" . $countryinfo->IdCountry . "\" title=\" specific debug right view database records\">view geo record #" . $countryinfo->IdCountry . "</a>";
        ?>
</h2>
        <?php 
    }
}
?>
</div>
Exemplo n.º 22
0
 /**
  * this function load the list of the polls with a certain status
  * @PollStatus is the statuis which allow to filter for the status of some poll
  **/
 function LoadList($PollStatus = "")
 {
     $words = new MOD_words();
     if (empty($PollStatus)) {
         $where = "";
     } else {
         $where = " where polls.Status='" . $PollStatus . "'";
     }
     $sQuery = "select polls.*,members.Username as 'CreatorUsername' from (polls) ";
     $sQuery .= " left join members on members.id=polls.IdCreator ";
     $sQuery .= " left join groups on groups.id=polls.IdGroupCreator ";
     $sQuery = $sQuery . $where . " order by polls.created desc";
     $tt = array();
     $qry = $this->dao->query($sQuery);
     if (!$qry) {
         throw new PException('polls::LLoadList Could not retrieve the polls!');
     }
     if (isset($_SESSION["IdMember"])) {
         $IdMember = $_SESSION["IdMember"];
     } else {
         $IdMember = 0;
     }
     // for all the records
     while ($rr = $qry->fetch(PDB::FETCH_OBJ)) {
         // If there is a group list, test if the current member is in the group list
         if (!$this->IsMemberAllowed($rr)) {
             continue;
             // Skip this record
         }
         if (!empty($rr->IdGroupCreator)) {
             // In case the polls is created by a group find back the name of this group
             $rGroup = $this->singleLookup("select * from groups where id=" . $rr->IdGroupCreator);
             $rr->GroupCreatorName = $words->getFormatted("Group_" . $rGroup->Name);
         }
         $rContrib = $this->singleLookup("select count(*) as cnt from polls_contributions where IdPoll=" . $rr->id);
         $rr->NbContributors = $rContrib->cnt;
         // This is the logic for the possible action (may be this could be better in the controller)
         $rr->PossibleActions = "<ul>";
         // Only owner of admin with proper right can update the poll
         if (isset($_SESSION["IdMember"]) and $rr->IdCreator == $_SESSION["IdMember"] and $rr->Status == "Projet" or MOD_right::get()->HasRight("Poll", "update")) {
             $rr->PossibleActions = $rr->PossibleActions . "<li><a href=\"polls/update/" . $rr->id . "\">" . $words->getFormatted("polls_adminlink") . "</a></li>";
         }
         if ($this->HasAlreadyContributed($rr->id, "", $_SESSION["IdMember"])) {
             $rr->PossibleActions = $words->getFormatted("polls_youhavealreadyvoted");
             if ($rr->CanChangeVote == "Yes" and $rr->Status == "Open") {
                 $rr->PossibleActions .= "<li<a href=\"polls/cancelvote/" . $rr->id . "\">" . $words->getFormatted("polls_remove_vote") . "</a></li>";
             }
             if ($rr->ResultsVisibility == "VisibleAfterVisit" and $rr->Status != "Closed") {
                 $rr->PossibleActions = $rr->PossibleActions . "<li><a href=\"polls/seeresults/" . $rr->id . "\">" . $words->getFormatted("polls_seeresults") . "</li>";
             }
         }
         if ($this->CanUserContribute($rr->id, "", $_SESSION["IdMember"])) {
             $rr->PossibleActions = $rr->PossibleActions . "<li><a href=\"polls/contribute/" . $rr->id . "\">" . $words->getFormatted("polls_contribute") . "</li>";
         }
         if ($rr->Status == "Closed") {
             $rr->PossibleActions .= "<li><a href=\"polls/results/" . $rr->id . "\">" . $words->getFormatted("polls_seeresults") . "</li>";
         }
         $rr->PossibleActions .= "</ul>";
         array_push($tt, $rr);
     }
     return $tt;
 }
Exemplo n.º 23
0
 /**
  * Index function
  *
  * Currently the index consists of following possible requests:
  * register    - registration form to page content
  * confirm   - confirmation redirect to signup
  *
  * @param void
  */
 public function index($args = false)
 {
     // In case Signup is closed
     if (isset($_SESSION['Param']->FeatureSignupClose) && $_SESSION['Param']->FeatureSignupClose == "Yes") {
         return new SignupClosedPage();
     }
     /*
              * Enable to check against DNS Blocklists
     if (MOD_dnsblock::get()->checkRemoteIp()) {
                 return new SignupDNSBlockPage();
             }
     */
     $request = $args->request;
     $model = new SignupModel();
     if (isset($_SESSION['IdMember']) && !MOD_right::get()->hasRight('words')) {
         if (!isset($_SESSION['Username'])) {
             unset($_SESSION['IdMember']);
             $page = new SignupProblemPage();
         } else {
             $this->redirect('members/' . $_SESSION['Username']);
         }
     } else {
         switch (isset($request[1]) ? $request[1] : '') {
             // copied from TB:
             // checks e-mail address for validity and availability
             case 'checkemail':
                 // ignore current request, so we can use the last request
                 PRequest::ignoreCurrentRequest();
                 if (!isset($_GET['email'])) {
                     echo '0';
                     PPHP::PExit();
                 }
                 if (!PFunctions::isEmailAddress($_GET['email'])) {
                     echo '0';
                     PPHP::PExit();
                 }
                 $users = $model->takeCareForNonUniqueEmailAddress($_GET['email']);
                 if ($users == '') {
                     echo "1";
                 } else {
                     echo "0";
                 }
                 PPHP::PExit();
                 break;
                 // copied from TB: rewiewed by JeanYves
                 // checks Username for validity and availability
             // copied from TB: rewiewed by JeanYves
             // checks Username for validity and availability
             case 'checkhandle':
                 // ignore current request, so we can use the last request
                 PRequest::ignoreCurrentRequest();
                 if (!isset($request[2])) {
                     echo '0';
                     PPHP::PExit();
                 }
                 if (!preg_match(User::HANDLE_PREGEXP, $request[2])) {
                     echo '0';
                     PPHP::PExit();
                 }
                 if (strpos($request[2], 'xn--') !== false) {
                     // Don't allow IDN-Prefixes
                     echo '0';
                     PPHP::PExit();
                 }
                 echo (bool) (!$model->UsernameInUse($request[2]));
                 PPHP::PExit();
                 break;
             case 'getRegions':
                 // ignore current request, so we can use the last request
                 PRequest::ignoreCurrentRequest();
                 if (!isset($request[2])) {
                     PPHP::PExit();
                 }
             case 'terms':
                 MOD_log::get()->write("Viewing terms", "Signup");
                 // the termsandconditions popup
                 $page = new SignupTermsPopup();
                 break;
             case 'privacy':
                 MOD_log::get()->write("Viewing privacy", "Signup");
                 $page = new SignupPrivacyPopup();
                 break;
             case 'confirm':
                 // or give it a different name?
                 // this happens when you click the link in the confirmation email
                 if (!isset($request[2]) || !isset($request[3]) || !preg_match(User::HANDLE_PREGEXP, $request[2]) || !$model->UsernameInUse($request[2]) || !preg_match('/^[a-f0-9]{16}$/', $request[3])) {
                     $error = 'InvalidLink';
                 } else {
                     $error = $model->confirmSignup($request[2], $request[3]);
                 }
                 $page = new SignupMailConfirmPage();
                 $page->error = $error;
                 break;
             case 'resendmail':
                 // shown when clicking on the link in the MailToConfirm error message
                 $error = '';
                 if (!isset($request[2])) {
                     $error = 'InvalidLink';
                 } else {
                     $resent = $model->resendConfirmationMail($request[2]);
                     if ($resent !== true) {
                         $error = $resent;
                     }
                 }
                 $page = new SignupResentMailPage();
                 $page->error = $error;
                 break;
             case 'finish':
                 $page = new SignupFinishPage();
                 break;
             default:
                 $page = new SignupPage();
                 $page->step = isset($request[1]) && $request[1] ? $request[1] : '1';
                 $StrLog = "Entering Signup step: #" . $page->step;
                 MOD_log::get()->write($StrLog, "Signup");
                 $page->model = $model;
         }
     }
     return $page;
 }
Exemplo n.º 24
0
    protected function column_col3()
    {
        $page_url = PVars::getObj('env')->baseuri . implode('/', PRequest::get()->request);
        $from = $_SESSION['Username'];
        $to = "";
        $limit = 50;
        if (!empty($this->Data->from)) {
            // For the case the display results comes from adn URL an not from a form
            $mem_redirect = $this->Data;
        } else {
            $mem_redirect = $this->layoutkit->formkit->getMemFromRedirect();
        }
        if ($mem_redirect) {
            if ($mem_redirect->strerror != "") {
                echo "<p><font color=red><b>" . $mem_redirect->strerror . "</b></font></p>";
            }
            if ($mem_redirect->from != "") {
                $from = $mem_redirect->from;
            }
            if ($mem_redirect->to != "") {
                $to = $mem_redirect->to;
            }
            if ($mem_redirect->limit != "") {
                $limit = $mem_redirect->limit;
            }
        }
        echo '
			<p>
			First rough draft for a friends system<br>
			show friends: list friends for a given username / id and a given distance<br>
			show links: show one or more links between two given members<br>
			update links: flush the link database and create new entries
			<p>
			
			<p>
			So far data from comments and special relations is taken into consideration.
			<p>
			
			<p>
			if you don\'t want your username to be display among the results of these links, you can choose to disable the tree link in your preferences
			<p>
		';
        if (empty($this->Data)) {
            // For the case the display results comes from adn URL an not from a form
            echo '<p><form method="POST" action="' . $page_url . '">';
            echo $this->layoutkit->formkit->setPostCallback('LinkController', 'LinkShowCallback');
            echo 'From: <input name="from" value="' . $from . '"/> To: <input name="to" value="' . $to . '"/> Limit: <input name="limit"  value="' . $limit . '"/>';
            echo '<input type="submit" value="send"/></form></p>';
        }
        if ($mem_redirect) {
            // result from calculation
            echo '
			<p>
			Your Query: Show ' . $mem_redirect->limit . ' shortest connections between: ' . $mem_redirect->from . ' and: ' . $mem_redirect->to . '
			</p>
           ';
            $model = new LinkModel();
            $linksIds = $mem_redirect->links;
            if ($linksIds) {
                if (MOD_right::get()->hasRight('Debug')) {
                    echo "<p>(Debug Right)";
                    foreach ($linksIds as $key => $value) {
                        foreach ($value as $id) {
                            echo $id . " >";
                        }
                        echo "<br>";
                    }
                    echo "</p>";
                }
            }
            $linksData = $mem_redirect->linksFull;
            if ($linksData) {
                require 'templates/linkshowlinkpage_people.php';
            } else {
                echo "no link";
            }
        }
    }
Exemplo n.º 25
0
 public function procActivitylogs($vars, $level = 0)
 {
     $where = '';
     $username = $vars["username"];
     $cid = $this->_idMember($username);
     if ($level <= 1) {
         $cid = $_SESSION["IdMember"];
         // Member with level 1 can only see his own rights
     }
     if ($cid != 0) {
         $where .= " AND IdMember=" . $cid;
     }
     $R = MOD_right::get();
     $level = $R->hasRight('Logs');
     $limitcount = $vars["limitcount"];
     // Number of records per page
     $start_rec = $vars["start_rec"];
     // Number of records per page
     $andS1 = $vars["andS1"];
     if ($andS1 != "") {
         $where .= " AND Str LIKE '%" . $andS1 . "%'";
     }
     $andS2 = $vars["andS2"];
     if ($andS2 != "") {
         $where .= " AND Str LIKE '%" . $andS2 . "%'";
     }
     $notAndS1 = $vars["notAndS1"];
     if ($notAndS1 != "") {
         $where .= " AND Str NOT LIKE '%" . $notAndS1 . "%'";
     }
     $notAndS2 = $vars["notAndS2"];
     if ($notAndS2 != "") {
         $where .= " AND Str NOT LIKE '%" . $notAndS2 . "%'";
     }
     $ip = $vars["ip"];
     if ($ip != "") {
         $where .= " AND IpAddress=" . ip2long($ip) . "";
     }
     $type = $vars["type"];
     if ($type != "") {
         $where .= " AND Type='" . $type . "'";
     }
     // If there is a Scope limit logs to the type in this Scope (unless it his own logs)
     if (!$R->hasRight('Logs', "\"All\"")) {
         $scope = RightScope("Logs");
         str_replace($scope, "\"", "'");
         $where .= " AND (Type IN (" . $scope . ") OR IdMember=" . $_SESSION["IdMember"] . ") ";
     }
     $tData = array();
     $db = "";
     if (!empty($_SYSHCVOL['ARCH_DB'])) {
         $db = $_SYSHCVOL['ARCH_DB'] . ".";
     }
     // not using: SQL_CALC_FOUND_ROWS and FOUND_ROWS()
     $query = "SELECT logs.*, Username " . "FROM " . $db . ".logs LEFT JOIN members ON members.id=logs.IdMember " . "WHERE 1=1 " . $where . " " . "ORDER BY created DESC LIMIT {$start_rec}," . $limitcount;
     $resultRecords = $this->dao->query($query);
     $query = "SELECT COUNT(*) AS n " . "FROM " . $db . ".logs LEFT JOIN members ON members.id=logs.IdMember " . "WHERE 1=1 " . $where;
     $result = $this->dao->query($query);
     $altogether = $result->fetch(PDB::FETCH_OBJ);
     return array($altogether->n => $resultRecords);
 }
Exemplo n.º 26
0
 /**
  * Returns an array with the mist of X latest donations (all donation in case the current user has Treasurer rights)
  *
  */
 public function getDonations()
 {
     $TDonations = array();
     $R = MOD_right::get();
     $hasRight = $R->hasRight('Treasurer');
     if ($hasRight) {
         $query = "SELECT * FROM donations ORDER BY created DESC";
     } else {
         $query = "SELECT * FROM donations ORDER BY created DESC LIMIT 10";
     }
     $result = $this->dao->query($query);
     while ($row = $result->fetch(PDB::FETCH_OBJ)) {
         array_push($TDonations, $row);
     }
     return $TDonations;
 }
Exemplo n.º 27
0
 /**
  */
 public function index()
 {
     $vw = new ViewWrap($this->_view);
     $P = PVars::getObj('page');
     // First check if the feature is closed
     if ($_SESSION["Param"]->FeatureSearchPageIsClosed != 'No') {
         $P->content = $this->_view->showFeatureIsClosed();
         return;
     }
     // end of test "if feature is closed"
     if (PPostHandler::isHandling()) {
         return;
     }
     $request = PRequest::get()->request;
     if (!isset($request[1])) {
         $request[1] = '';
     }
     // Route quicksearch
     if ($request[0] == 'quicksearch') {
         $error = false;
         // static pages
         switch ($request[1]) {
             case '':
                 $searchtext = isset($_GET["vars"]) ? $_GET['vars'] : '';
                 // Because of old way to use the QuickSearch with a get
                 break;
             default:
                 $searchtext = $request[1];
                 break;
         }
         $TReturn = $this->_model->quicksearch($searchtext);
         if (count($TReturn->TMembers) == 1 and count($TReturn->TPlaces) == 0 and count($TReturn->TForumTags) == 0) {
             $loc = "members/" . $TReturn->TMembers[0]->Username;
             header('Location: ' . $loc);
             PPHP::PExit();
         } else {
             if (count($TReturn->TMembers) == 0 and count($TReturn->TPlaces) == 1 and count($TReturn->TForumTags) == 0) {
                 $loc = $TReturn->TPlaces[0]->link;
                 header('Location: ' . $loc);
                 PPHP::PExit();
             } else {
                 if (count($TReturn->TMembers) == 0 and count($TReturn->TPlaces) == 0 and count($TReturn->TForumTags) == 1) {
                     $loc = "forums/t" . $TReturn->TForumTags[0]->IdTag;
                     header('Location: ' . $loc);
                     PPHP::PExit();
                 }
             }
         }
         $P->content .= $vw->quicksearch_results($TReturn);
         return $P;
     }
     if ($request[0] != 'searchmembers') {
         header('Location: searchmembers');
         PPHP::PExit();
     }
     // fix a problem with Opera javascript, which sends a 'searchmembers/searchmembers/ajax' request
     if ($request[1] === 'searchmembers') {
         $request = array_slice($request, 1);
     }
     // default mapstyle:
     $mapstyle = 'mapon';
     $queries = '';
     $varsOnLoad = '';
     $varsGet = '';
     if (isset($request[1])) {
         switch ($request[1]) {
             case 'mapoff':
                 $mapstyle = "mapoff";
                 $_SESSION['SearchMembersTList'] = array();
                 break;
             case 'mapon':
                 $mapstyle = "mapon";
                 $_SESSION['SearchMembersTList'] = array();
                 break;
             case 'queries':
                 if (PVars::get()->debug) {
                     $R = MOD_right::get();
                     if ($R->HasRight("Debug", "DB_QUERY")) {
                         $queries = true;
                         $mapstyle = "mapoff";
                     }
                 }
                 break;
             default:
                 if (isset($_SESSION['SearchMapStyle']) and $_SESSION['SearchMapStyle']) {
                     $mapstyle = $_SESSION['SearchMapStyle'];
                 }
                 break;
         }
     }
     // Store the MapStyle in session
     $_SESSION['SearchMapStyle'] = $mapstyle;
     // Check wether there are latest search results and variables from the session
     if (!$queries && isset($_SESSION['SearchMembersTList'])) {
         if ($_SESSION['SearchMembersTList'] && $_SESSION['SearchMembersVars']) {
             $varsOnLoad = $_SESSION['SearchMembersVars'];
         }
     }
     switch ($request[1]) {
         case 'ajax':
             if (isset($request[2]) and $request[2] == "varsonload") {
                 $vars['varsOnLoad'] = true;
                 // Read the latest search results and variables from the session
                 if (!empty($_SESSION['SearchMembersTList'])) {
                     $TList = $_SESSION['SearchMembersTList'];
                 }
                 if (!empty($_SESSION['SearchMembersVars'])) {
                     $vars = $_SESSION['SearchMembersVars'];
                 }
                 if (isset($request[3])) {
                     $vars['OrderBy'] = $request[3];
                     $TList = $this->_model->search($vars);
                 }
             } else {
                 $vars = isset($_GET) ? $_GET : array();
                 if (isset($request[2]) && $request[2] == "queries") {
                     $vars['queries'] = true;
                 }
                 if (!isset($TList)) {
                     $TList = $this->_model->search($vars);
                 }
             }
             $this->_view->searchmembers_ajax($TList, $vars, $mapstyle);
             // Store latest search results and variables in session
             $_SESSION['SearchMembersTList'] = $TList;
             $_SESSION['SearchMembersVars'] = $vars;
             PPHP::PExit();
             break;
             /* quicksearch shouldn't go through this route
                         case 'quicksearch':
                             $mapstyle = "mapoff"; 
                             // First check if the QuickSearch feature is closed
                             if ($_SESSION["Param"]->FeatureQuickSearchIsClosed!='No') {
                                 $this->_view->showFeatureIsClosed();
                                 PPHP::PExit();
                                 break ;
                             } // end of test "if QuickSearch feature is closed" 
                             if (isset($request[2])) { // The parameter to search for can be for the form searchmember/quicksearch/ value
                                 $searchtext=$request[2] ;
                             }
             
                             if (isset($_GET['searchtext'])) { // The parameter can come from the main menu
                                 $searchtext = $_GET['searchtext'];
                             }
                             if (isset($_POST['searchtext'])) { // The parameter can come from the quicksearch form
                                 $searchtext = $_POST['searchtext'];
                             }               
                             
             //              die('here searchtext={'.$searchtext.'}') ;
                             if (!empty($searchtext)) {
                                 $TReturn=$this->_model->quicksearch($searchtext) ;
                                 if ((count($TReturn->TMembers)==1) and  (count($TReturn->TPlaces)==0)  and  (count($TReturn->TForumTags)==0)) {
                                     $loc="members/".$TReturn->TMembers[0]->Username ;
                                     header('Location: '.$loc);
                                     PPHP::PExit();
                                 }
                                 else if ((count($TReturn->TMembers)==0) and  (count($TReturn->TPlaces)==1)  and  (count($TReturn->TForumTags)==0)) {
                                     $loc=$TReturn->TPlaces[0]->link ;
                                     header('Location: '.$loc);
                                     PPHP::PExit();
                                 }
                                 else if ((count($TReturn->TMembers)==0) and  (count($TReturn->TPlaces)==0)  and  (count($TReturn->TForumTags)==1)) {
                                     $loc="forums/t".$TReturn->TForumTags[0]->IdTag ;
                                     header('Location: '.$loc);
                                     PPHP::PExit();
                                 }
                                 $P->content .= $vw->quicksearch_results($TReturn);
                             }
                             else {
             
                                 $vars = PPostHandler::getVars('quicksearch_callbackId');
                                 PPostHandler::clearVars('quicksearch_callbackId');
             
                                 // first include the col2-stylesheet
                                 $P->addStyles .= $this->_view->customStyles($mapstyle,$quicksearch=1);
                             
                                 // now the teaser content
                                 $P->teaserBar .= $vw->teaserquicksearch($mapstyle);
                             
                                 $P->content .= $vw->quicksearch_form();
                             }
                             break;
                             
                         // Backwards compatibility
                         case 'index':
                             $loc = PVars::getObj('env')->baseuri;
                             $loc .= 'searchmembers';
                             if(isset($request[2])) {$loc .= '/'.$request[2];}
                             elseif(isset($request[3])) {$loc .= '/'.$request[3];}
                             header('Location: '.$loc);
                             PPHP::PExit();
                             break;
             */
         /* quicksearch shouldn't go through this route
                     case 'quicksearch':
                         $mapstyle = "mapoff"; 
                         // First check if the QuickSearch feature is closed
                         if ($_SESSION["Param"]->FeatureQuickSearchIsClosed!='No') {
                             $this->_view->showFeatureIsClosed();
                             PPHP::PExit();
                             break ;
                         } // end of test "if QuickSearch feature is closed" 
                         if (isset($request[2])) { // The parameter to search for can be for the form searchmember/quicksearch/ value
                             $searchtext=$request[2] ;
                         }
         
                         if (isset($_GET['searchtext'])) { // The parameter can come from the main menu
                             $searchtext = $_GET['searchtext'];
                         }
                         if (isset($_POST['searchtext'])) { // The parameter can come from the quicksearch form
                             $searchtext = $_POST['searchtext'];
                         }               
                         
         //              die('here searchtext={'.$searchtext.'}') ;
                         if (!empty($searchtext)) {
                             $TReturn=$this->_model->quicksearch($searchtext) ;
                             if ((count($TReturn->TMembers)==1) and  (count($TReturn->TPlaces)==0)  and  (count($TReturn->TForumTags)==0)) {
                                 $loc="members/".$TReturn->TMembers[0]->Username ;
                                 header('Location: '.$loc);
                                 PPHP::PExit();
                             }
                             else if ((count($TReturn->TMembers)==0) and  (count($TReturn->TPlaces)==1)  and  (count($TReturn->TForumTags)==0)) {
                                 $loc=$TReturn->TPlaces[0]->link ;
                                 header('Location: '.$loc);
                                 PPHP::PExit();
                             }
                             else if ((count($TReturn->TMembers)==0) and  (count($TReturn->TPlaces)==0)  and  (count($TReturn->TForumTags)==1)) {
                                 $loc="forums/t".$TReturn->TForumTags[0]->IdTag ;
                                 header('Location: '.$loc);
                                 PPHP::PExit();
                             }
                             $P->content .= $vw->quicksearch_results($TReturn);
                         }
                         else {
         
                             $vars = PPostHandler::getVars('quicksearch_callbackId');
                             PPostHandler::clearVars('quicksearch_callbackId');
         
                             // first include the col2-stylesheet
                             $P->addStyles .= $this->_view->customStyles($mapstyle,$quicksearch=1);
                         
                             // now the teaser content
                             $P->teaserBar .= $vw->teaserquicksearch($mapstyle);
                         
                             $P->content .= $vw->quicksearch_form();
                         }
                         break;
                         
                     // Backwards compatibility
                     case 'index':
                         $loc = PVars::getObj('env')->baseuri;
                         $loc .= 'searchmembers';
                         if(isset($request[2])) {$loc .= '/'.$request[2];}
                         elseif(isset($request[3])) {$loc .= '/'.$request[3];}
                         header('Location: '.$loc);
                         PPHP::PExit();
                         break;
         */
         default:
             $words = new MOD_words();
             $P->addStyles = $this->_view->customStyles($mapstyle);
             $google_conf = PVars::getObj('config_google');
             $P->title = $words->getBuffered('searchmembersTitle') . " - BeWelcome";
             $P->currentTab = 'searchmembers';
             $P->currentSubTab = 'searchmembers';
             $subTab = 'index';
             // prepare sort order for both the filters and the userbar
             $sortorder = $this->_model->get_sort_order();
             $P->teaserBar = $vw->teaser($mapstyle, $sortorder, $varsOnLoad);
             $P->teaserBar .= $vw->searchmembersFilters($this->_model->sql_get_groups(), $this->_model->sql_get_set("members", "Accomodation"), $this->_model->sql_get_set("members", "TypicOffer"), $sortorder);
             $P->content = $vw->search_column_col3($sortorder, $queries, $mapstyle, $varsOnLoad, $varsGet, $this->_model->sql_get_set("members", "Accomodation"));
             /*$P->content = $vw->memberlist($mapstyle,$sortorder);
               
               $P->content .= $vw->searchmembers(
                   $queries,
                   $mapstyle,
                   $varsOnLoad,
                   $varsGet,
                   $this->_model->sql_get_set("members", "Accomodation")
               );
               */
             $P->show_volunteerbar = false;
             break;
     }
 }
Exemplo n.º 28
0
 protected function editMyProfileFormPrepare($member)
 {
     $member->setEditMode(true);
     $Rights = MOD_right::get();
     $lang = $this->model->get_profile_language();
     $profile_language = $lang->id;
     $profile_language_code = $lang->ShortCode;
     $profile_language_name = $lang->Name;
     $all_spoken_languages = $this->sortLanguages($member->get_all_spoken_languages());
     $all_signed_languages = $this->sortLanguages($member->get_all_signed_languages());
     $layoutkit = $this->layoutkit;
     $formkit = $layoutkit->formkit;
     $ReadCrypted = 'MemberReadCrypted';
     if ($this->adminedit) {
         $ReadCrypted = 'AdminReadCrypted';
     }
     $vars = array();
     // Prepare $vars
     $vars['ProfileSummary'] = $member->ProfileSummary > 0 ? $member->get_trad('ProfileSummary', $profile_language) : '';
     $vars['BirthDate'] = $member->BirthDate;
     list($vars['BirthYear'], $vars['BirthMonth'], $vars['BirthDay']) = explode('-', $member->BirthDate);
     $vars['HideBirthDate'] = $member->HideBirthDate;
     $vars['Occupation'] = $member->Occupation > 0 ? $member->get_trad('Occupation', $profile_language) : '';
     $vars['Gender'] = $member->Gender;
     $vars['HideGender'] = $member->HideGender;
     if ($vars['Gender'] == 'IDontTell') {
         $vars['Gender'] = 'other';
         $vars['HideGender'] = true;
     }
     $vars['language_levels'] = $member->language_levels;
     $vars['languages_all_spoken'] = $all_spoken_languages;
     $vars['languages_all_signed'] = $all_signed_languages;
     $vars['languages_selected'] = $member->languages_spoken;
     $vars['FirstName'] = $member->get_firstname();
     $vars['SecondName'] = $member->get_secondname();
     $vars['LastName'] = $member->get_lastname();
     $vars['HouseNumber'] = $member->get_housenumber();
     $vars['Street'] = $member->get_street();
     $vars['Zip'] = $member->get_zip();
     $vars['IsHidden_FirstName'] = MOD_crypt::IsCrypted($member->FirstName);
     $vars['IsHidden_SecondName'] = MOD_crypt::IsCrypted($member->SecondName);
     $vars['IsHidden_LastName'] = MOD_crypt::IsCrypted($member->LastName);
     $vars['IsHidden_Address'] = MOD_crypt::IsCrypted($member->address->StreetName);
     $vars['IsHidden_Zip'] = MOD_crypt::IsCrypted($member->address->Zip);
     $vars['IsHidden_HomePhoneNumber'] = MOD_crypt::IsCrypted($member->HomePhoneNumber);
     $vars['IsHidden_CellPhoneNumber'] = MOD_crypt::IsCrypted($member->CellPhoneNumber);
     $vars['IsHidden_WorkPhoneNumber'] = MOD_crypt::IsCrypted($member->WorkPhoneNumber);
     $vars['HomePhoneNumber'] = $member->HomePhoneNumber > 0 ? MOD_crypt::$ReadCrypted($member->HomePhoneNumber) : '';
     $vars['CellPhoneNumber'] = $member->CellPhoneNumber > 0 ? MOD_crypt::$ReadCrypted($member->CellPhoneNumber) : '';
     $vars['WorkPhoneNumber'] = $member->WorkPhoneNumber > 0 ? MOD_crypt::$ReadCrypted($member->WorkPhoneNumber) : '';
     $vars['Email'] = $member->Email > 0 ? MOD_crypt::$ReadCrypted($member->Email) : '';
     $vars['WebSite'] = $member->WebSite;
     $vars['messengers'] = $member->messengers();
     $vars['Accomodation'] = $member->Accomodation;
     $vars['MaxGuest'] = $member->MaxGuest;
     $vars['MaxLenghtOfStay'] = $member->get_trad("MaxLenghtOfStay", $profile_language);
     $vars['ILiveWith'] = $member->get_trad("ILiveWith", $profile_language);
     $vars['PleaseBring'] = $member->get_trad("PleaseBring", $profile_language);
     $vars['OfferGuests'] = $member->get_trad("OfferGuests", $profile_language);
     $vars['OfferHosts'] = $member->get_trad("OfferHosts", $profile_language);
     $vars['TabTypicOffer'] = $member->TabTypicOffer;
     $vars['PublicTransport'] = $member->get_trad("PublicTransport", $profile_language);
     $vars['TabRestrictions'] = $member->TabRestrictions;
     $vars['OtherRestrictions'] = $member->get_trad("OtherRestrictions", $profile_language);
     $vars['AdditionalAccomodationInfo'] = $member->get_trad("AdditionalAccomodationInfo", $profile_language);
     $vars['OfferHosts'] = $member->get_trad("OfferHosts", $profile_language);
     $vars['Hobbies'] = $member->get_trad("Hobbies", $profile_language);
     $vars['Books'] = $member->get_trad("Books", $profile_language);
     $vars['Music'] = $member->get_trad("Music", $profile_language);
     $vars['Movies'] = $member->get_trad("Movies", $profile_language);
     $vars['Organizations'] = $member->get_trad("Organizations", $profile_language);
     $vars['PastTrips'] = $member->get_trad("PastTrips", $profile_language);
     $vars['PlannedTrips'] = $member->get_trad("PlannedTrips", $profile_language);
     $vars['Relations'] = $member->get_all_relations();
     $vars['Groups'] = $member->getGroups();
     if (!($memory = $formkit->getMemFromRedirect())) {
         // no memory
         // echo 'no memory';
     } else {
         // from previous form
         if ($memory->post) {
             $post = $memory->post;
             foreach ($post as $key => $value) {
                 $vars[$key] = $value;
             }
             // update $vars for messengers
             if (isset($vars['messengers'])) {
                 $ii = 0;
                 foreach ($vars['messengers'] as $me) {
                     $val = 'chat_' . $me['network_raw'];
                     $vars['messengers'][$ii++]['address'] = $vars[$val];
                 }
             }
             // update $vars for $languages
             if (!isset($vars['languages_selected'])) {
                 $vars['languages_selected'] = array();
             }
             $ii = 0;
             $ii2 = 0;
             $lang_used = array();
             foreach ($vars['memberslanguages'] as $lang) {
                 if (ctype_digit($lang) and !in_array($lang, $lang_used)) {
                     // check $lang is numeric, hence a legal IdLanguage
                     $vars['languages_selected'][$ii]->IdLanguage = $lang;
                     $vars['languages_selected'][$ii]->Level = $vars['memberslanguageslevel'][$ii2];
                     array_push($lang_used, $vars['languages_selected'][$ii]->IdLanguage);
                     $ii++;
                 }
                 $ii2++;
             }
         }
         // problems from previous form
         if (is_array($memory->problems)) {
             require_once 'edit_warning.php';
         }
     }
     // var_dump($vars);
     return $vars;
 }
Exemplo n.º 29
0
    protected function column_col3()
    {
        $page_url = PVars::getObj('env')->baseuri . implode('/', PRequest::get()->request);
        $from = $_SESSION['Username'];
        $degree = 1;
        $limit = 50;
        if ($mem_redirect = $this->layoutkit->formkit->getMemFromRedirect()) {
            if ($mem_redirect->strerror != "") {
                echo "<p><font color=red><b>" . $mem_redirect->strerror . "</b></font></p>";
            }
            if ($mem_redirect->from != "") {
                $from = $mem_redirect->from;
            }
            if ($mem_redirect->degree != "") {
                $degree = $mem_redirect->degree;
            }
            if ($mem_redirect->limit != "") {
                $limit = $mem_redirect->limit;
            }
        }
        echo '
			<p>
			First rough draft for a friends system<br>
			show friends: list friends for a given username / id and a given distance<br>
			show links: show one or more links between two given members<br>
			update links: flush the link database and create new entries
			<p>
			
			<p>
			So far data from comments and special relations is taken into consideration.
			<p>
			
			<p>
			Stuff like Preference setting to hide/disable oneself from the link system and more is still needed
			<p>
			';
        echo '
			<p>
			<form method="POST" action="' . $page_url . '">
			' . $this->layoutkit->formkit->setPostCallback('LinkController', 'LinkShowFriendsCallback') . '
			From: <input name="from" value="' . $from . '"/> Degree: <input name="degree" value="' . $degree . '"/> Max Number : <input name="limit" value="' . $limit . '"/>
			<input type="submit" value="send"/>
			</form>
			</p>
        ';
        if ($mem_redirect) {
            // result from calculation
            echo '
			<p>
			Your Query: Show ' . $mem_redirect->limit . ' Friends of:' . $mem_redirect->from . ' with a distance of: ' . $mem_redirect->degree . '
			</p>
           ';
            $model = new LinkModel();
            if (MOD_right::get()->hasRight('Debug')) {
                echo "<p>(Debug Right) The IDs for the Friends (retrieved by getFriends): ";
                foreach ($mem_redirect->friendsIDs as $value) {
                    echo $value . " / ";
                }
                echo "</p>";
            }
            // ENd if debug right
            $friendsData = $mem_redirect->friendsFull;
            //var_dump($friendsData);
            require 'templates/linkshowfriendspage_people.php';
        }
    }
Exemplo n.º 30
0
    protected function translator_block()
    {
        if (MOD_right::get()->hasRight("Words", PVars::get()->lang)) {
            ?>
<div id="translator" class="float_right"><?php 
            $request_string = implode('/', PVars::get()->request);
            $rox_tr = PVars::getObj("env")->baseuri . "rox/tr_mode";
            $words = new MOD_words();
            switch ($words->getTrMode()) {
                case 'translate':
                    ?>
                <a href="<?php 
                    echo $rox_tr;
                    ?>
/browse/<?php 
                    echo $request_string;
                    ?>
">browse</a>
                <strong>translate</strong>
                <a href="<?php 
                    echo $rox_tr;
                    ?>
/edit/<?php 
                    echo $request_string;
                    ?>
">edit</a>
                <?php 
                    break;
                case 'edit':
                    ?>
                <a href="<?php 
                    echo $rox_tr;
                    ?>
/browse/<?php 
                    echo $request_string;
                    ?>
">browse</a>
                <a href="<?php 
                    echo $rox_tr;
                    ?>
/translate/<?php 
                    echo $request_string;
                    ?>
">translate</a>
                <strong>edit</strong>
                <?php 
                    break;
                default:
                case 'browse':
                    ?>
                <strong>browse</strong>
                <a href="<?php 
                    echo $rox_tr;
                    ?>
/translate/<?php 
                    echo $request_string;
                    ?>
">translate</a>
                <a href="<?php 
                    echo $rox_tr;
                    ?>
/edit/<?php 
                    echo $request_string;
                    ?>
">edit</a>
                <?php 
                    break;
            }
            ?>
</div><?php 
        }
    }