function TranslationEngine($lang = "english") { global $GlobalDatabase; _filter_var($lang); if (is_language_supported($lang)) { $this->Language = $lang; $this->LanguageTable = "lang_{$this->Language}"; } else { $this->Language = "english"; $this->LanguageTable = ""; } /** * no need to create database connection for English * because it won't be used... */ if ($this->Language != 'english') { if (!isset($GlobalDatabase)) { include 'configs/globals.php'; $dsn = array('phptype' => $db_type, 'username' => $db_username, 'password' => $db_password, 'hostspec' => $db_host, 'database' => $db_name); $options = array('debug' => 2, 'portability' => DB_PORTABILITY_ALL); $this->Database =& DB::connect($dsn, $options); if (PEAR::isError($this->Database)) { die($this->Database->getMessage()); } $q =& $this->Database->query("SET NAMES utf8;"); if (PEAR::isError($q)) { die($q->getMessage()); } } else { $this->Database = $GlobalDatabase; } } }
/** * The constructor of the generic module * class, ModulePage (Page.Module.class.php) * <br> * Takes global variables like TrEng and GlobalDatabase * and sets the variables that will be used throughout * the class * @access public * @param string $group * @param string $modulecode * @return ModulePage */ function ModulePage($modulecode) { global $GlobalDatabase; global $treng; _filter_var($group); if (isset($GlobalDatabase)) { $this->Database = $GlobalDatabase; } else { include 'configs/globals.php'; $dsn = array('phptype' => $db_type, 'username' => $db_username, 'password' => $db_password, 'hostspec' => $db_host, 'database' => $db_name); $options = array('debug' => 2, 'portability' => DB_PORTABILITY_ALL); $this->Database =& DB::connect($dsn, $options); if (PEAR::isError($this->Database)) { die($this->Database->getMessage()); } $q =& $this->Database->query("SET NAMES utf8;"); if (PEAR::isError($q)) { die($q->getMessage()); } } if (isset($treng)) { $this->TrEng = $treng; } else { $this->TrEng = new TranslationEngine(); } $this->ModuleCode = $modulecode; }
function rejectMembershipRequest($mid) { //$this->_makeAdminControl(); _filter_var($mid); $res =& $this->Database->query("DELETE FROM membership_requests WHERE member_id='{$mid}'"); if (PEAR::isError($res)) { die($res->getMessage()); } return $res; }
function getPeopleOptions($uname) { global $access_isGroupMember; _filter_var($uname); $res = ""; if (isset($_SESSION['valid_user']) && $access_isGroupMember) { if ($uname != $_SESSION['valid_user']) { $u = new User($_SESSION['valid_user']); $uid = _getMemberID($uname); if (!$u->isWatching($uid)) { $res .= "<img align=\"absbottom\" src=\"http://grou.ps/images/eye.gif\" alt=\"" . $this->_("Add to Your Watchlist") . "\" width=\"16\" height=\"16\" border=\"0\" /> "; $res .= "<a href=\"javascript:void(add_watchlist('{$uname}'))\">" . $this->_("Add to Your Watchlist") . "</a>"; } else { $res .= "<img align=\"absbottom\" src=\"http://grou.ps/images/bell.gif\" alt=\"" . $this->_("In Your Watchlist") . "\" width=\"16\" height=\"16\" border=\"0\" /> "; $res .= $this->_("In Your Watchlist"); } } } return $res; }
function groupInvitationAttempt($user, $msg, $emails) { $clientIP = $this->_getIP(); _filter_var($user); _filter_var($group); _filter_var($msg); if (strlen($msg) > 247) { $msg = substr($msg, 0, 247); } $msgobj = "msg=\"{$msg}\""; $toobj1 = "to1=\""; $toobj2 = "to2=\""; $toobj3 = "to3=\""; $tolength = 0; foreach ($emails as $email) { _filter_var($email); $curlength = $tolength + strlen($email); if ($curlength < 246) { $toobj1 .= $email . ";"; } elseif ($curlength < 2 * 246) { $toobj2 .= $email . ";"; } elseif ($curlength < 3 * 246) { $toobj3 .= $email . ";"; } else { break; } $tolength = $curlength; } $toobj1 .= "\""; $toobj2 .= "\""; $toobj3 .= "\""; $sql = 'INSERT INTO `analytics` (`analysis_id`, `type`, `member_name`, `client_ip`, `opt_obj_1`, `opt_obj_2`, `opt_obj_3`, `opt_obj_4`, `opt_obj_5`, `opt_obj_6`, `opt_obj_7`, `opt_obj_8`, `opt_obj_9`, `opt_obj_10`, `date`) VALUES (\'\', \'GroupInvitation\', \'' . $user . '\', \'' . $clientIP . '\', \'' . $toobj1 . '\', \'' . $toobj2 . '\', \'' . $toobj3 . '\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', NOW());'; $q =& $this->Database->query($sql); if (PEAR::isError($q)) { die($q->getMessage()); } }
function isLoginRecoverable($email, $serial) { _filter_var($email); _filter_var($serial); $db = AccessDB(); $time_3daysago = time() - 60 * 60 * 24 * 3; $passcheck = $db->getOne("SELECT COUNT(recovery_id) FROM password_recovery WHERE email='{$email}' AND serial='{$serial}' AND recovered='N' AND date >= '{$time_3daysago}'"); if (PEAR::isError($username)) { //die($username->getMessage()); return false; } if ($passcheck != 0) { return true; } else { return false; } }
function notifyMailGroup($mailgroup, $subj, $text, $mailid) { _filter_var($mailgroup); _filter_var($subj); _filter_var($text); _filter_var($mailid); $this->Subject = $subj; $this->Body = $text; $this->AddAddress($mailgroup); $this->From = $this->to_email; $this->FromName = $this->to_name; $this->AddCustomHeader("Message-ID: {$mailid}"); // TODO: Add logging features if (!$this->Send()) { $this->ClearAddresses(); return false; // an error has occurred } else { $this->ClearAddresses(); return true; } }
/** * Get username by membership_id * * @access protected * @param int $membership_id * @return string username */ function _getUsernameByMembershipID($membership_id) { _filter_var($membership_id); $sql = "SELECT member_id FROM memberships WHERE membership_id='{$membership_id}';"; $member_id = $this->Database->getOne($sql); if (PEAR::isError($member_id)) { die($member_id->getMessage()); } $sql = "SELECT member_login FROM members WHERE member_id='{$member_id}';"; $username = $this->Database->getOne($sql); if (PEAR::isError($username)) { die($username->getMessage()); } return $username; }
function setLayout($layout) { _filter_var($layout); $this->layout = $layout; }