/** * page code function */ function ThisPageMainCode() { global $logged; $ret = ""; $member['ID'] = (int) $_COOKIE['memberID']; $owner = $_REQUEST['owner'] ? (int) $_REQUEST['owner'] : (int) $_COOKIE['memberID']; // Check if membership allows this action $check_res = checkAction($member['ID'], ACTION_ID_VIEW_GUESTBOOK); if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED && !$logged['admin'] && $member['ID'] != $owner) { $ret .= "<br />\r\n\t\t\t<table width=\"100%\" cellpadding=1 cellspacing=1 border=0>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=text align=center>\r\n\t\t\t\t\t\t<br />" . $check_res[CHECK_ACTION_MESSAGE] . "<br />\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>\n"; return $ret; } $check_res = checkAction($owner, ACTION_ID_USE_GUESTBOOK); if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED && !$logged['admin']) { $ret .= $member['ID'] == $owner ? $check_res[CHECK_ACTION_MESSAGE] : _t_err("_This guestbook disabled by it's owner"); return $ret; } if ($_GET['action'] == 'show_add' && $_GET['owner']) { $ret .= ShowAddRecord(); return $ret; } if ($_POST['action'] == 'new' && $_POST['owner'] && strlen($_POST['newrecord'])) { $ret .= AddRecord(); } if ($_GET['action'] == 'delete' && $_GET['owner'] && (int) $_GET['delete_id'] != 0) { $ret .= DeleteRecord(); } $ret .= PrintGuestbook(); return $ret; }
/** * page code function */ function PageCompMainCode() { global $oTemplConfig; global $logged; $iId = (int) $_COOKIE['memberID']; if ($iId > 0) { $sPassword = getPassword($iId); $bEnableRay = getParam('enable_ray') == 'on'; $check_res = checkAction($iId, ACTION_ID_USE_RAY_CHAT); if ($bEnableRay && $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) { $ret .= getApplicationContent('chat', 'user', array('id' => $iId, 'password' => $sPassword)); } else { // $ret .= ' // <center> // <table width=100% height=100% cellpadding=0 cellspacing=0> // <td align=center valign=center> // <table width="90%" height="70" cellpadding="5" cellspacing="1" class="table"> // <tr> // <td class="panel" width="100%" align="center" valign="middle"> // <div align="center" class="small">' . $check_res[CHECK_ACTION_MESSAGE] . '</div> // </td> // </tr> // </table> // </td> // </table> // </center>'; $ret .= MsgBox($check_res[CHECK_ACTION_MESSAGE]); } return DesignBoxContent(_t("_RAY_CHAT"), $ret, $oTemplConfig->PageCompThird_db_num); } else { return DesignBoxContent(_t('_LOGIN_ERROR'), MsgBox(_t('_Please login before using Ray chat')), 1); } }
function getPageMainCode() { global $oTemplConfig; $ret = ''; $aPhotoConf = array(); $aPhotoConf['profileID'] = (int) $_REQUEST['ID']; $aPhotoConf['visitorID'] = (int) $_COOKIE['memberID']; $aPhotoConf['isOwner'] = $aPhotoConf['profileID'] == $aPhotoConf['visitorID'] ? true : false; $check_res = checkAction($aPhotoConf['visitorID'], ACTION_ID_USE_GALLERY); if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) { $ret = ' <table width="100%" cellpadding="4" cellspacing="4" border="0"> <tr> <td align="center">' . $check_res[CHECK_ACTION_MESSAGE] . '</td> </tr> </table>'; return $ret; } $oMedia = new BxDolMedia(); $oMedia->iProfileID = $aPhotoConf['profileID']; $oMedia->sMediaType = isset($_REQUEST['show']) ? $_REQUEST['show'] : 'video'; $oMedia->BxDolMedia(); $oMedia->getActiveMediaArray(); $ret .= ProfileDetails($oMedia->iProfileID); $ret .= '<div class="clear_both"></div>'; if ($oTemplConfig->customize['media_gallery']['showMediaTabs']) { $ret .= '<div class="choiseBlock">'; $ret .= getMediaTabs($oMedia->sMediaType, $oMedia->aMediaConfig); $ret .= '</div>'; } //print_r( $oMedia -> aMedia); $i = 1; foreach ($oMedia->aMedia as $aValue) { $ret .= '<div class="mediaBlock">'; $ret .= '<div class="mediaTitleVA">'; $ret .= process_line_output($aValue['med_title']); $ret .= '</div>' . "\n"; $ret .= '<div class="mediaActions">'; $ret .= '<span>'; $ret .= '<a href="' . $oMedia->getMediaLink($aValue) . '">'; $ret .= _t('_download'); $ret .= '</a>'; $ret .= '</span>'; /* $ret .= '<span>'; $ret .= '<a href="' . $_SERVER['PHP_SELF'] . '?show=' . $oMedia -> sMediaType . '&action=delete&mediaID=' . $aValue['med_id'] . '">'; $ret .= _t('_delete'); $ret .= '</a>'; $ret .= '</span>'; */ $ret .= '</div>' . "\n"; $ret .= '</div>' . "\n"; if ($i >= $oMedia->aMediaConfig['max'][$oMedia->sMediaType]) { break; } $i++; } $ret .= ''; return $ret; }
function isModuleAvailable($sModuleName, $sUserId = "", $sAction = "") { $bResult = BxDolInstallerUtils::isModuleInstalled($sModuleName); if ($bResult && !empty($sUserId) && !empty($sAction)) { $aResult = checkAction($sUserId, $sAction); $bResult = $aResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED; } return $bResult; }
function PageCompPageMainCode() { global $site; global $oTemplConfig; $aPhoto = getVotingItem(); $check_res = checkAction($_COOKIE['memberID'], ACTION_ID_RATE_PHOTOS); if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) { $ret = ' <table width="100%" cellpadding="4" cellspacing="4" border="0"> <tr> <td align="center">' . $check_res[CHECK_ACTION_MESSAGE] . '</td> </tr> </table>'; return $ret; } $ret = ''; if ($_GET['prev_id']) { $ret .= showPreviousRated((int) $_GET['prev_id']); } if ($oTemplConfig->customize['rate']['showSexSelector']) { $ret .= '<div class="rate_sex_form">'; $ret .= '<form method="post" name="FormVote" action="' . $_SERVER['PHP_SELF'] . '">'; $ret .= '<span>'; $ret .= _t("_Show me"); $ret .= '</span>'; $ret .= '<span>'; $ret .= '<select name="showme" onchange="document.forms[\'FormVote\'].submit()">' . "\n"; $selected_all = $_REQUEST['showme'] == 'all' || strlen(trim($_REQUEST['showme'])) == 0 ? ' selected="selected" ' : ''; $ret .= '<option value="all"' . $selected_all . '>' . _t("_all") . '</option>'; $ret .= SelectOptions('Sex', $_REQUEST['showme']); $ret .= '</select>'; $ret .= '</span>'; $ret .= '</form>'; $ret .= '</div>'; } if (empty($aPhoto)) { $ret .= _t_action('_there_is_no_photo_that_you_can_rate'); } else { if ($oTemplConfig->customize['rate']['showProfileInfo']) { $ret .= '<div class="clear_both"></div>'; $ret .= ProfileDetails($aPhoto['med_prof_id']); $ret .= '<div class="clear_both"></div>'; } $ret .= getRatingPhoto($aPhoto); $oVotingView = new BxTemplVotingView('media', (int) $aPhoto['med_id']); if ($oVotingView->isEnabled()) { $sUrlAdd = ''; if ($_REQUEST['showme']) { $sUrlAdd .= 'showme=' . $_REQUEST['showme'] . '&'; } $ret .= "\r\n\t\t\t\t<script>\r\n\t\t\t\t\tBxDolVoting.prototype.onvote = function (fRate, iCount)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdocument.location = '{$site['url']}rate.php?{$sUrlAdd}prev_id=' + this._iObjId;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tBxDolVoting.prototype.onvotefail = function ()\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdocument.location = '{$site['url']}rate.php?{$sUrlAdd}prev_id=' + this._iObjId;\r\n\t\t\t\t\t}\r\n\t\t\t\t</script>"; $ret .= '<div style="margin-left:55px">' . $oVotingView->getBigVoting() . '</div>'; } } return $ret; }
function getContent($iId) { $sPassword = $iId > 0 ? $_COOKIE['memberPassword'] : ""; $aResult = checkAction($iId, ACTION_ID_USE_CHAT, true); if ($aResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) { $sResult = getApplicationContent('chat', 'user', array('id' => $iId, 'password' => $sPassword), true); } else { $sResult = MsgBox($aResult[CHECK_ACTION_MESSAGE]); } $sResult = DesignBoxContent(_t('_chat_box_caption'), $sResult, 11); return $sResult; }
function isAllowedDownload(&$aFile, $isPerformAction = false) { if ($this->isAdmin($this->_iProfileId) || $aFile['medProfId'] == $this->_iProfileId) { return true; } if (!$this->oPrivacy->check('download', $aFile['medID'], $this->_iProfileId)) { return false; } $this->_defineActions(); $aCheck = checkAction($this->_iProfileId, BX_FILES_DOWNLOAD, $isPerformAction); if ($aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) { return false; } return true; }
function getContent($iId, $iSavedId = 0) { if ($iId > 0) { $sPassword = $_COOKIE['memberPassword']; $aResult = checkAction($iId, ACTION_ID_USE_BOARD, true); if ($aResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) { $sResult = getApplicationContent('board', 'user', array('id' => $iId, 'password' => $sPassword, 'saved' => $iSavedId), true); } else { $sResult = MsgBox($aResult[CHECK_ACTION_MESSAGE]); } $sResult = DesignBoxContent(_t('_board_box_caption'), $sResult, 11); } else { $sResult = DesignBoxContent(_t('_board_box_caption'), MsgBox(_t('_board_err_not_logged_in')), 11); } return $sResult; }
/** * page code function */ function PageCompMainCode() { global $oTemplConfig; global $logged; $iId = (int) $_COOKIE['memberID']; if ($iId > 0) { $sPassword = getPassword($iId); $bEnableRay = getParam('enable_ray') == 'on'; $check_res = checkAction($iId, ACTION_ID_USE_RAY_CHAT); if ($bEnableRay && $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) { $ret .= getApplicationContent('chat', 'user', array('id' => $iId, 'password' => $sPassword), true); } else { $ret .= MsgBox($check_res[CHECK_ACTION_MESSAGE]); } return DesignBoxContent(_t("_RAY_CHAT"), $ret, $oTemplConfig->PageCompThird_db_num); } else { return DesignBoxContent(_t('_LOGIN_ERROR'), MsgBox(_t('_Please login before using Ray chat')), 1); } }
function getBlockCode_RateObject() { $sMainPrefix = $this->oConfig->getMainPrefix(); $this->oMedia->oModule->_defineActions(); $aCheck = checkAction($this->iViewer, $this->oMedia->oModule->_defineActionName('view')); if ($aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) { $sCode = MsgBox(_t('_' . $sMainPrefix . '_forbidden')); } else { $aData = $this->getRateObject(); if (count($aData) > 0) { $oVotingView = new BxTemplVotingView($this->sType, $aData[0]['id']); $aUnit = array('url' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'rate', 'fileBody' => $this->getRateFile($aData), 'ratePart' => $oVotingView->isEnabled() ? $oVotingView->getBigVoting() : '', 'fileTitle' => $aData[0]['title'], 'fileUri' => $this->oMedia->getCurrentUrl('file', $aData[0]['id'], $aData[0]['uri']), 'fileWhen' => defineTimeInterval($aData[0]['date']), 'fileFrom' => getNickName($aData[0]['ownerId']), 'fileFromLink' => getProfileLink($aData[0]['ownerId'])); $sCode = $this->oMedia->oTemplate->parseHtmlByName('rate_object.html', $aUnit); checkAction($this->iViewer, $this->oMedia->oModule->_defineActionName('view'), true); } else { $sCode = MsgBox(_t('_' . $sMainPrefix . '_no_file_for_rate')); } } return array($sCode, array(), array(), false); }
function getPageMainCode() { $aPhotoConf = array(); $aPhotoConf['profileID'] = (int) $_REQUEST['ID']; $aPhotoConf['visitorID'] = (int) $_COOKIE['memberID']; $aPhotoConf['isOwner'] = $aPhotoConf['profileID'] == $aPhotoConf['visitorID'] ? true : false; if ($aPhotoConf['isOwner']) { header("Location:upload_media.php?show=photos"); exit; } $check_res = checkAction($aPhotoConf['visitorID'], ACTION_ID_VIEW_PHOTOS); if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) { $ret = ' <table width="100%" cellpadding="4" cellspacing="4" border="0"> <tr> <td align="center">' . $check_res[CHECK_ACTION_MESSAGE] . '</td> </tr> </table>'; return $ret; } $oPhotos = new ProfilePhotos($aPhotoConf['profileID']); $oPhotos->getActiveMediaArray(); $ret = ''; if ($_REQUEST['voteSubmit'] && $_REQUEST['photoID']) { $oPhotos->setVoting(); header('Location:' . $_SERVER['PHP_SELF'] . '?ID=' . $oPhotos->iProfileID . '&photoID=' . $_REQUEST['photoID']); } if (!$aPhotoConf['isOwner']) { $ret .= ProfileDetails($oPhotos->iProfileID); $ret .= '<div class="clear_both"></div>'; } if (0 < $_REQUEST['photoID']) { $iPhotoID = $_REQUEST['photoID']; $ret .= $oPhotos->getMediaPage($iPhotoID); } else { $ret .= $oPhotos->getMediaPage(); } return $ret; }
function getBlockCode_RateObject() { $this->oMedia->oModule->_defineActions(); $aCheck = checkAction($this->iViewer, $this->oMedia->oModule->_defineActionName('view')); if ($aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) { $sCode = MsgBox(_t('_' . $this->sType . '_forbidden')); } else { $aData = $this->getRateObject(); if (count($aData) > 0) { $oFile =& $this->oMedia->oModule; $oFile->_oTemplate->addCss('rate_object.css'); $iInfoWidth = (int) getParam($this->sType . '_file_width'); $oVotingView = new BxTemplVotingView($this->sType, $aData[0]['id']); $aUnit = array('url' => BX_DOL_URL_ROOT . $oFile->_oConfig->getBaseUri() . 'rate', 'fileBody' => $this->oMedia->oTemplate->getFileConcept($aData[0]['id']), 'ratePart' => $oVotingView->isEnabled() ? $oVotingView->getBigVoting() : '', 'fileTitle' => $aData[0]['title'], 'fileUri' => $this->oMedia->getCurrentUrl('file', $aData[0]['id'], $aData[0]['uri']), 'fileWhen' => defineTimeInterval($aData[0]['date']), 'fileFrom' => $aData[0]['ownerName'], 'fileFromLink' => getProfileLink($aData[0]['ownerId']), 'infoWidth' => $iInfoWidth > 0 ? $iInfoWidth + 2 : ''); $sCode = $this->oMedia->oTemplate->parseHtmlByName('rate_object.html', $aUnit); checkAction($this->iViewer, $this->oMedia->oModule->_defineActionName('view'), true); } else { $sCode = MsgBox(_t('_bx_sounds_no_file_for_rate')); } } return $sCode; }
function getUserInfo($sUser, $sPwd, $sNick, $sLang) { $iIdProfile = BxDolXMLRPCUtil::getIdByNickname($sNick); if (!$iIdProfile || !($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) { return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct")); } BxDolXMLRPCUtil::setLanguage($sLang); if ($iIdProfile != $iId) { // privacy bx_import('BxDolPrivacy'); $oPrivacy = new BxDolPrivacy('Profiles', 'ID', 'ID'); if ($iIdProfile != $iId && !$oPrivacy->check('view', $iIdProfile, $iId)) { return new xmlrpcval('-1'); } // membership $aCheckRes = checkAction($iId, ACTION_ID_VIEW_PROFILES, true, $iIdProfile); if ($aCheckRes[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) { return new xmlrpcval($aCheckRes[CHECK_ACTION_MESSAGE]); } } $aRet = BxDolXMLRPCUtil::getUserInfo($iIdProfile); return new xmlrpcval($aRet, "struct"); }
function _checkUserPrivacy($iId, $iIdProfile) { $mixedAccessDenied = false; if ($iIdProfile != $iId) { // membership $aCheckRes = checkAction($iId, ACTION_ID_VIEW_PROFILES, true, $iIdProfile); if ($aCheckRes[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) { $mixedAccessDenied = strip_tags($aCheckRes[CHECK_ACTION_MESSAGE]); } // privacy if (false === $mixedAccessDenied) { bx_import('BxDolPrivacy'); $oPrivacy = new BxDolPrivacy('Profiles', 'ID', 'ID'); if ($iIdProfile != $iId && !$oPrivacy->check('view', $iIdProfile, $iId)) { $mixedAccessDenied = '-1'; } } } bx_import('BxDolAlerts'); $oZ = new BxDolAlerts('mobile', 'view_profile', $iIdProfile, $iId, array('access_denied' => &$mixedAccessDenied)); $oZ->alert(); if (false !== $mixedAccessDenied) { return new xmlrpcval($mixedAccessDenied); } return true; }
function getProfileViewActions($iProfileId, $bDynamic = false) { global $oTemplConfig; $iProfileId = (int) $iProfileId; if (!$iProfileId) { return ''; } $aProfileInfo = getProfileInfo($iProfileId); if (empty($aProfileInfo)) { return ''; } $iViewerId = getLoggedId(); // prepare all needed keys $aConfig = array('url' => BX_DOL_URL_ROOT, 'anonym_mode' => '', 'member_id' => $iViewerId, 'member_pass' => getPassword($iViewerId)); $aMainKeys = array('cpt_edit', 'cpt_send_letter', 'cpt_fave', 'cpt_befriend', 'cpt_remove_friend', 'cpt_get_mail', 'cpt_share', 'cpt_report', 'cpt_block', 'cpt_unblock', 'cpt_activate', 'cpt_ban', 'cpt_delete', 'cpt_delete_spam', 'cpt_feature', 'act_activate', 'act_ban', 'act_feature'); $aMain = array_fill_keys($aMainKeys, ''); if (isMember($iViewerId)) { $aMain['cpt_edit'] = _t('_EditProfile'); $aMain['cpt_send_letter'] = _t('_SendLetter'); $aMain['cpt_fave'] = _t('_Fave'); $aMain['cpt_remove_fave'] = _t('_Remove Fave'); $aMain['cpt_befriend'] = _t('_Befriend'); $aMain['cpt_remove_friend'] = _t('_Remove friend'); $aMain['cpt_get_mail'] = _t('_Get E-mail'); $aMain['cpt_share'] = $this->isAllowedShare($this->_aProfile) ? _t('_Share') : ''; $aMain['cpt_report'] = _t('_Report Spam'); $aMain['cpt_block'] = _t('_Block'); $aMain['cpt_unblock'] = _t('_Unblock'); } if (isAdmin($iViewerId) || isModerator($iViewerId) and $iViewerId != $iProfileId) { $sMsgKeyStart = '_adm_btn_mp_'; // delete $aMain['cpt_delete'] = _t($sMsgKeyStart . 'delete'); // delete spam $aMain['cpt_delete_spam'] = _t($sMsgKeyStart . 'delete_spammer'); // activate / deactivate $sTypeActiv = 'activate'; if ($aProfileInfo['Status'] == 'Active') { $sTypeActiv = 'de' . $sTypeActiv; } $aMain['cpt_activate'] = _t($sMsgKeyStart . $sTypeActiv); $aMain['act_activate'] = $sTypeActiv; // ban / unban $sTypeBan = 'ban'; if (isLoggedBanned($aProfileInfo['ID'])) { $sTypeBan = 'un' . $sTypeBan; } $aMain['cpt_ban'] = _t($sMsgKeyStart . $sTypeBan); $aMain['act_ban'] = $sTypeBan; // feature / unfeature $sTypeFeat = 'featured'; $aMain['cpt_feature'] = _t('_Feature it'); if ((int) $aProfileInfo['Featured']) { $sTypeFeat = 'un' . $sTypeFeat; $aMain['cpt_feature'] = _t('_De-Feature it'); } $aMain['act_feature'] = $sTypeFeat; } //--- Subscription integration ---// $oSubscription = BxDolSubscription::getInstance(); $sAddon = $oSubscription->getData($bDynamic); $aButton = $oSubscription->getButton($iViewerId, 'profile', '', $iProfileId); $aMain['sbs_profile_title'] = $aButton['title']; $aMain['sbs_profile_script'] = $aButton['script']; //--- Subscription integration ---// $aCheckGreet = checkAction(getLoggedId(), ACTION_ID_SEND_VKISS); $aMain['cpt_greet'] = $aCheckGreet[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED ? _t('_Greet') : ''; $aMain = array_merge($aProfileInfo, $aConfig, $aMain); return $sAddon . $this->genObjectsActions($aMain, 'Profile'); }
function _isDeleteAllowed($iAuthorId = 0, $bPerform = false) { if (!isLogged()) { return false; } if (isAdmin()) { return true; } $iUserId = getLoggedId(); if ($iAuthorId != 0 && $iAuthorId == $iUserId) { return true; } $aCheckResult = checkAction($iUserId, ACTION_ID_FEEDBACK_DELETE, $bPerform); return $aCheckResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED; }
switch ($moduleType) { case 'forum': $check_res = checkAction($memberID, ACTION_ID_USE_FORUM); if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) { showError($check_res[CHECK_ACTION_MESSAGE]); exit; } checkAction($memberID, ACTION_ID_USE_FORUM, true); break; case 'chat': $check_res = checkAction($memberID, ACTION_ID_USE_CHAT); if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) { showError($check_res[CHECK_ACTION_MESSAGE]); exit; } checkAction($memberID, ACTION_ID_USE_CHAT, true); break; default: showError(_t('_Unknown module type selected') . ": '" . $moduleType . "'"); } modules_login($memberID, $moduleName, 0); } else { // If not a member and not an admin, so merely redirect to a module index page if (is_array($mods) && array_key_exists($moduleName, $mods) && is_array($mods[$moduleName]) && array_key_exists('ModuleDirectory', $mods[$moduleName])) { Redirect($site['url'] . $mods[$moduleName]['ModuleDirectory']); } else { showError(_t('_Module directory was not set. Module must be re-configurated')); } } } } else {
function isAllowedDelete(&$aDataEntry, $isPerformAction = false) { if ($this->isAdmin() || $GLOBALS['logged']['member'] && $aDataEntry['author_id'] == $this->_iProfileId) { return true; } $this->_defineActions(); $aCheck = checkAction($this->_iProfileId, BX_AVATAR_DELETE_ANY, $isPerformAction); return $aCheck[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED; }
function checkMemAction($iFileOwner, $sAction = 'view') { $iFileOwner = (int) $iFileOwner; $sAction = clear_xss($sAction); if ($this->oModule->isAdmin($this->oModule->_iProfileId) || $iFileOwner == $this->oModule->_iProfileId) { return true; } $this->oModule->_defineActions(); $aCheck = checkAction($this->oModule->_iProfileId, $this->oModule->_defineActionName($sAction)); if ($aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) { return false; } return true; }
function isAllowedView(&$aFile, $isPerformAction = false) { $bAdmin = $this->isAdmin($this->_iProfileId); if ($bAdmin || $aFile['medProfId'] == $this->_iProfileId) { return true; } if (!$bAdmin && $aFile['Approved'] != 'approved') { return false; } $aOwnerInfo = getProfileInfo($aFile['medProfId']); if ($aOwnerInfo['Status'] == 'Rejected' || $aOwnerInfo['Status'] == 'Suspended') { return false; } if (!$this->oAlbumPrivacy->check('album_view', $aFile['albumId'], $this->_iProfileId)) { return false; } $this->_defineActions(); $aCheck = checkAction($this->_iProfileId, $this->_defineActionName('view'), $isPerformAction); if ($aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) { return false; } return true; }
function _isDeleteAllowed($bPerform = false) { if (!isLogged()) { return false; } if (isAdmin()) { return true; } $aCheckResult = checkAction(getLoggedId(), ACTION_ID_ARTICLES_DELETE, $bPerform); return $aCheckResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED; }
/** * page code function */ function PageCompPageMainCode() { global $dir; $member['ID'] = (int) $_COOKIE['memberID']; ob_start(); $p_arr = getProfileInfo($member['ID']); if ($_POST['CHANGE_STATUS']) { switch ($_POST['CHANGE_STATUS']) { case 'SUSPEND': if ($p_arr['Status'] == 'Active') { db_res("UPDATE `Profiles` SET `Status` = 'Suspended' WHERE `ID` = '{$member['ID']}';"); modules_block($p_arr['ID']); } break; case 'ACTIVATE': if ($p_arr['Status'] == 'Suspended') { db_res("UPDATE `Profiles` SET `Status` = 'Active' WHERE `ID` = {$member['ID']}"); // call modules to add user to modules $check_res = checkAction($member['ID'], ACTION_ID_USE_CHAT); if ($check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) { modules_unblock($p_arr['ID'], 'chat'); } $check_res = checkAction($member['ID'], ACTION_ID_USE_FORUM); if ($check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) { modules_unblock($p_arr['ID'], 'forum'); } } break; } createUserDataFile($p_arr['ID']); reparseObjTags('profile', $member['ID']); $p_arr = getProfileInfo($member['ID']); } echo "<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>"; echo _t("_Profile status"); ?> : <b><font class=prof_stat_<?php echo $p_arr['Status']; ?> > <?php echo _t("__{$p_arr['Status']}"); ?> </font></b><br /> <?php switch ($p_arr['Status']) { case 'Active': echo _t("_PROFILE_CAN_SUSPEND"); ?> <br /><br /><form action="<?php echo $_SERVER['PHP_SELF']; ?> " method=post> <input type=hidden name=CHANGE_STATUS value=SUSPEND> <center><input class=no type=submit value="<?php echo _t("_Suspend account"); ?> "></center> </form> <?php break; case 'Suspended': echo _t("_PROFILE_CAN_ACTIVATE"); ?> <br /><br /><form action="<?php echo $_SERVER['PHP_SELF']; ?> " method=post> <input type=hidden name=CHANGE_STATUS value=ACTIVATE> <center><input class=no type=submit value="<?php echo _t("_Activate account"); ?> "></center> </form> <?php break; default: echo _t("_PROFILE_CANT_ACTIVATE/SUSPEND"); break; } echo "</td></table>"; $ret = ob_get_contents(); ob_end_clean(); return $ret; }
function isAllowedApprove($isPerformAction = false) { if ($this->isAdmin()) { return true; } if (isMember() == false) { return false; } $this->_defineActions(); $aCheck = checkAction($this->_iVisitorID, BX_BLOG_POSTS_APPROVING, $isPerformAction); return $aCheck[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED; }
function isAllowedCreatorCommentsDeleteAndEdit(&$aEvent, $isPerformAction = false) { if ($this->isAdmin()) { return true; } if (!$GLOBALS['logged']['member'] || $aEvent['author_id'] != $this->_iProfileId) { return false; } $this->_defineActions(); $aCheck = checkAction($this->_iProfileId, BX_STORE_PRODUCT_COMMENTS_DELETE_AND_EDIT, $isPerformAction); return $aCheck[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED; }
function _isMembershipEnabledFor($iProfileId, $sMembershipActionConstant, $isPerformAction = false) { defineMembershipActions(array('photos add', 'photos view', 'sounds view', 'videos view')); if (!defined($sMembershipActionConstant)) { return false; } $aCheck = checkAction($iProfileId ? $iProfileId : $_COOKIE['memberID'], constant($sMembershipActionConstant), $isPerformAction); return $aCheck[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED; }
function _isCommentDeleteAllowed($bPerform = false) { if (isAdmin()) { return true; } $iUserId = (int) $this->_getAuthorId(); if ($this->_iOwnerId == $iUserId) { return true; } $aCheckResult = checkAction($iUserId, ACTION_ID_TIMELINE_DELETE_COMMENT, $bPerform); return $aCheckResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED; }
/** * Put top code for the page **/ function PageCode($admintmpl = 0) { global $dir; global $site; global $_page; global $_page_comp; global $logged; global $langHTMLCharset; global $tmpl; global $ADMIN; global $tmi_letters; global $dbh_letters; global $max_thumb_height; global $max_thumb_width; global $_page_cont; $ni = $_page['name_index']; global $oTemplConfig; $oTemplMenu = new BxTemplMenu($oTemplConfig); $free_mode = getParam("free_mode") == "on" ? 1 : 0; // reading templates if (!$admintmpl) { $fn = "{$dir['root']}templates/tmpl_{$tmpl}/page_{$ni}.html"; if (!file_exists($fn)) { $fn = "{$dir['root']}templates/tmpl_{$tmpl}/default.html"; } } else { $fn = "{$dir['root']}admin/tmpl_admin.html"; } $templ = file_get_contents($fn); // process includes (multi-level) do { $templ1 = $templ; $templ = preg_replace_callback("/__include (.*)__/", "TmplInclude", $templ1); $templ = preg_replace_callback("/__includebase (.*)__/", "TmplIncludeBase", $templ); } while ($templ1 != $templ); //insert to your template page key: __t: lang_key__ and you will get translated string $templ = preg_replace_callback("/__t: (_.+)__/", create_function('$matches', 'return _t($matches[1]);'), $templ); PageStaticComponents(); // lang block if ((int) getParam('lang_enable')) { ob_start(); lang_select_txt(); $_page_cont[0]['switch_lang_block'] = ob_get_clean(); } else { $_page_cont[0]['switch_lang_block'] = ''; } // charset $_page_cont[0]['page_charset'] = $langHTMLCharset; //change templates if ('on' == getParam("enable_template")) { $_page_cont[0]['switch_skin_block'] = templates_select_txt(); } else { $_page_cont[0]['switch_skin_block'] = ''; } //Path to css if (strlen($_page['css_name']) > 0) { $filename = $dir['root'] . $site['css_dir'] . $_page['css_name']; if (file_exists($filename) && is_file($filename)) { $_page_cont[0]['styles'] = '<link href="' . $site['css_dir'] . $_page['css_name'] . '" rel="stylesheet" type="text/css" />'; } else { $_page_cont[0]['styles'] = ''; } } else { $_page_cont[0]['styles'] = ''; } //Path to js if (strlen($_page['js_name']) > 0) { $filename = $dir['root'] . 'inc/js/' . $_page['js_name']; if (file_exists($filename) && is_file($filename)) { $langDelete = _t('_delete'); $langLoading = _t('_loading ...'); $langDeleteMessage = _t('_poll successfully deleted'); $langMakeIt = _t('_make it'); $lang_you_should_specify_member = _t('_You should specify at least one member'); if ($site['js_init']) { $_page_cont[0]['java_script'] = $site['js_init']; } $_page_cont[0]['java_script'] .= <<<EOJ <script type="text/javascript" language="javascript"> \tvar site_url = '{$site['url']}'; \tvar lang_delete = '{$langDelete}'; \tvar lang_loading = '{$langLoading}'; \tvar lang_delete_message = '{$langDeleteMessage}'; \tvar lang_make_it = '{$langMakeIt}'; \tvar lang_you_should_specify_member = '{$lang_you_should_specify_member}'; \t \tvar iQSearchWindowWidth = {$oTemplConfig->iQSearchWindowWidth}; \tvar iQSearchWindowHeight = {$oTemplConfig->iQSearchWindowHeight}; </script> <script src="{$site['url']}inc/js/{$_page['js_name']}" type="text/javascript" language="javascript"></script> EOJ; } else { $_page_cont[0]['java_script'] = ''; } } else { $_page_cont[0]['java_script'] = ''; } $_page_cont[0]['css_dir'] = $site['css_dir']; $_page_cont[0]['plugins'] = $site['plugins']; $_page_cont[0]['thumb_width'] = $max_thumb_width; $_page_cont[0]['thumb_height'] = $max_thumb_height; $_page_cont[0]['site_url'] = $site['url']; $_page_cont[0]['images'] = $site['images']; $_page_cont[0]['icons'] = $site['icons']; $_page_cont[0]['zodiac'] = $site['zodiac']; $_page_cont[0]['bottom_text'] = _t("_bottom_text", date("Y")); $_page_cont[0]['copyright'] = _t("_copyright", date("Y")) . getVersionComment(); // please do not delete version for debug possibilities $_page_cont[0]['powered'] = getParam('enable_boonex_footers') ? _t("_powered_by_Dolphin") : ''; $_page_cont[0]['main_logo'] = getMainLogo(); //place meta data on site pages $_page_cont[0]['meta_keywords'] = process_line_output(getParam("MetaKeyWords")); $_page_cont[0]['meta_description'] = process_line_output(getParam("MetaDescription")); if (strlen($_page['extra_js'])) { $_page_cont[0]['extra_js'] = $_page['extra_js']; } else { $_page_cont[0]['extra_js'] = ''; } if (strlen($_page['extra_css'])) { $_page_cont[0]['extra_css'] = $_page['extra_css']; } else { $_page_cont[0]['extra_css'] = ''; } // top menu items $_page_cont[0]['top_menu'] = $oTemplMenu->getTopMenu(); $_page_cont[0]['hidden_menu'] = getAllMenus(); $_page_cont[0]['custom_menu'] = $oTemplMenu->getCustomMenu(); $_page_cont[0]['TOP_Home'] = '<a class="menu_item_link" href="' . $site['url'] . 'index.php">' . _t("_Home") . '</a>'; $_page_cont[0]['BMI_Home'] = '<a class="bottommenu" href="' . $site['url'] . 'index.php">' . _t("_Home") . '</a>'; $_page_cont[0]['TOP_About'] = '<a class="menu_item_link" href="' . $site['url'] . 'about_us.php">' . _t("_About Us") . '</a>'; $_page_cont[0]['BMI_About'] = '<a class="bottommenu" href="' . $site['url'] . 'about_us.php">' . _t("_About Us") . '</a>'; $_page_cont[0]['TOP_Privacy'] = '<a class="menu_item_link" href="' . $site['url'] . 'privacy.php">' . _t("_Privacy") . '</a>'; $_page_cont[0]['BMI_Privacy'] = '<a class="bottommenu" href="' . $site['url'] . 'privacy.php">' . _t("_Privacy") . '</a>'; $_page_cont[0]['TOP_Termsofuse'] = '<a class="menu_item_link" href="' . $site['url'] . 'terms_of_use.php">' . _t("_Terms_of_use") . '</a>'; $_page_cont[0]['BMI_Termsofuse'] = '<a class="bottommenu" href="' . $site['url'] . 'terms_of_use.php">' . _t("_Terms_of_use") . '</a>'; $_page_cont[0]['TOP_Services'] = '<a class="menu_item_link" href="' . $site['url'] . 'services.php">' . _t("_Services") . '</a>'; $_page_cont[0]['BMI_Services'] = '<a class="bottommenu" href="' . $site['url'] . 'services.php">' . _t("_Services") . '</a>'; $_page_cont[0]['TOP_FAQ'] = '<a class="menu_item_link" href="' . $site['url'] . 'faq.php">' . _t("_FAQ") . '</a>'; $_page_cont[0]['BMI_FAQ'] = '<a class="bottommenu" href="' . $site['url'] . 'faq.php">' . _t("_FAQ") . '</a>'; $_page_cont[0]['TOP_Articles'] = '<a class="menu_item_link" href="' . $site['url'] . 'articles.php">' . _t("_Articles") . '</a>'; $_page_cont[0]['BMI_Articles'] = '<a class="bottommenu" href="' . $site['url'] . 'articles.php">' . _t("_Articles") . '</a>'; $_page_cont[0]['TOP_Stories'] = '<a class="menu_item_link" href="' . $site['url'] . 'stories.php">' . _t("_Stories2") . '</a>'; $_page_cont[0]['BMI_Stories'] = '<a class="bottommenu" href="' . $site['url'] . 'stories.php">' . _t("_Stories2") . '</a>'; $_page_cont[0]['TOP_Links'] = '<a class="menu_item_link" href="' . $site['url'] . 'links.php">' . _t("_Links") . '</a>'; $_page_cont[0]['BMI_Links'] = '<a class="bottommenu" href="' . $site['url'] . 'links.php">' . _t("_Links") . '</a>'; $_page_cont[0]['TOP_News'] = '<a class="menu_item_link" href="' . $site['url'] . 'news.php">' . _t("_News") . '</a>'; $_page_cont[0]['BMI_News'] = '<a class="bottommenu" href="' . $site['url'] . 'news.php">' . _t("_News") . '</a>'; $_page_cont[0]['TOP_Aff'] = getParam("enable_aff") == 'on' ? '<a class="menu_item_link" href="' . $site['url'] . 'affiliates.php">' . _t("_Affiliates") . '</a>' : ''; $_page_cont[0]['BMI_Aff'] = getParam("enable_aff") == 'on' ? '<a class="bottommenu" href="' . $site['url'] . 'affiliates.php">' . _t("_Affiliates") . '</a>' : ''; $_page_cont[0]['TOP_Invitefriend'] = '<a class="menu_item_link" href="javascript:void(0);" onclick="return launchTellFriend();">' . _t("_Invite a friend") . '</a>'; $_page_cont[0]['BMI_Invitefriend'] = '<a class="bottommenu" href="javascript:void(0);" onclick="return launchTellFriend();">' . _t("_Invite a friend") . '</a>'; $_page_cont[0]['TOP_Contacts'] = '<a class="menu_item_link" href="' . $site['url'] . 'contact.php">' . _t("_Contacts") . '</a>'; $_page_cont[0]['BMI_Contacts'] = '<a class="bottommenu" href="' . $site['url'] . 'contact.php">' . _t("_Contacts") . '</a>'; $_page_cont[0]['TOP_Browse'] = '<a class="menu_item_link" href="' . $site['url'] . 'browse.php">' . _t("_Browse Profiles") . '</a>'; $_page_cont[0]['BMI_Browse'] = '<a class="bottommenu" href="' . $site['url'] . 'browse.php">' . _t("_Browse Profiles") . '</a>'; $_page_cont[0]['TOP_Feedback'] = '<a class="menu_item_link" href="' . $site['url'] . 'story.php">' . _t("_Add story") . '</a>'; $_page_cont[0]['BMI_Feedback'] = '<a class="bottommenu" href="' . $site['url'] . 'story.php">' . _t("_Add story") . '</a>'; $_page_cont[0]['TOP_ContactUs'] = '<a class="menu_item_link" href="' . $site['url'] . 'contact.php">' . _t("_contact_us") . '</a>'; $_page_cont[0]['BMI_ContactUs'] = '<a class="bottommenu" href="' . $site['url'] . 'contact.php">' . _t("_contact_us") . '</a>'; $_page_cont[0]['TOP_Bookmark'] = '<a class="menu_item_link" href="javascript:void(0);" onclick="addBookmark();">' . _t("_Bookmark") . '</a>'; $_page_cont[0]['BMI_Bookmark'] = '<a class="bottommenu" href="javascript:void(0);" onclick="addBookmark();">' . _t("_Bookmark") . '</a>'; $_page_cont[0]['hello_member'] = HelloMemberSection(); // member/visitor menu if ($logged['admin']) { $_page_cont[0]['menu_right'] = $oTemplMenu->loggedAdminMenu(); } elseif ($logged['aff']) { $_page_cont[0]['menu_right'] = $oTemplMenu->loggedAffMenu(); } elseif ($logged['moderator']) { $_page_cont[0]['menu_right'] = $oTemplMenu->loggedModeratorMenu(); } elseif ($logged['member']) { $_page_cont[0]['menu_right'] = $oTemplMenu->loggedMemberMenu(); } else { $_page_cont[0]['menu_right'] = $oTemplMenu->visitorMenu(); } /*if ( !strlen($_page_cont[$ni]['actions_menu']) ) $_page_cont[0]['actions_menu'] = $oTemplMenu -> actionsMenu();*/ if (!strlen($_page_cont[$ni]['add_to_header'])) { $_page_cont[0]['add_to_header'] = ''; } $check_res = checkAction((int) $_COOKIE['memberID'], ACTION_ID_USE_IM); $enable_im = getParam("enable_im"); if ($enable_im && $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && !$ADMIN) { $_page_cont[0]['IM_title'] = _t("_IM title"); $_page_cont[0]['IM'] = RetIM(); } else { $_page_cont[0]['IM_title'] = ""; $_page_cont[0]['IM'] = ""; } $enable_shoutBox = 'on' == getParam("enable_shoutBox") ? 1 : 0; if ($enable_shoutBox) { $_page_cont[0]['shout_box'] = loadShoutbox(); } else { $_page_cont[0]['shout_box'] = ''; } $_page_cont[0]['top_page_head'] = getTopPageHead(); // page header $_page_cont[0]['page_header'] = $_page['header']; $_page_cont[0]['page_header_text'] = $_page['header_text']; // banner rotation/shifting system if (strstr($templ, "__banner_top__")) { $_page_cont[0]['banner_top'] = banner_put_nv(1); } if (strstr($templ, "__banner_left__")) { $_page_cont[0]['banner_left'] = banner_put_nv(2); } if (strstr($templ, "__banner_right__")) { $_page_cont[0]['banner_right'] = banner_put_nv(3); } if (strstr($templ, "__banner_bottom__")) { $_page_cont[0]['banner_bottom'] = banner_put_nv(4); } //end of banner rotation/shifting system //--- Ray IM Integration ---// global $sRayHomeDir; $_page_cont[0]['ray_invite_js'] = "\r\n\t\t<script type=\"text/javascript\" language=\"javascript\">\r\n\t\t\tvar sRayUrl = '" . $site['url'] . $sRayHomeDir . "';\r\n\t\t</script>\r\n\t\t<script src=\"" . $site['url'] . "ray/modules/global/js/integration.js\" type=\"text/javascript\" language=\"javascript\"></script>"; $_page_cont[0]['ray_invite_swf'] = ""; $iId = (int) $_COOKIE['memberID']; $sPassword = getPassword($iId); $bEnableRay = getParam('enable_ray') == 'on'; $check_res = checkAction($iId, ACTION_ID_USE_RAY_IM); if ($bEnableRay && $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) { $_page_cont[0]['ray_invite_swf'] = getApplicationContent("im", "invite", array('id' => $iId, 'password' => $sPassword), true); } //--- Ray IM Integration ---// foreach ($_page_cont[0] as $key => $value) { $templ = str_replace("__{$key}__", $value, $templ); } if (is_array($_page_cont[$ni])) { foreach ($_page_cont[$ni] as $key => $value) { $templ = str_replace("__{$key}__", $value, $templ); } } header('Content-type: text/html; charset=utf-8'); echo $templ; }
/** * Function will check the current logged member membership level; * * @param : $iMemberId (integer) - member's Id; * @param : $isPerformAction (boolean) - if isset this parameter that function will amplify the old action's value; */ function isMessengerAlowed($iMemberId, $isPerformAction = false) { //$this -> iLoggedMemberId $this->_defineActions(); $aCheck = checkAction($iMemberId, BX_USE_SIMPLE_MESSENGER, $isPerformAction); return $aCheck[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED; }
function processMembershipChecksForMediaUploads(&$aInputs) { $isAdmin = $GLOBALS['logged']['admin'] && isProfileActive($this->_iProfileId); defineMembershipActions(array('photos add', 'sounds add', 'videos add', 'files add')); if (defined('BX_PHOTOS_ADD')) { $aCheck = checkAction(getLoggedId(), BX_PHOTOS_ADD); } if (!defined('BX_PHOTOS_ADD') || $aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED && !$isAdmin) { unset($aInputs['thumb']); } $a = array('images' => 'PHOTOS', 'videos' => 'VIDEOS', 'sounds' => 'SOUNDS', 'files' => 'FILES'); foreach ($a as $k => $v) { if (defined("BX_{$v}_ADD")) { $aCheck = checkAction(getLoggedId(), constant("BX_{$v}_ADD")); } if ((!defined("BX_{$v}_ADD") || $aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) && !$isAdmin) { unset($this->_aMedia[$k]); unset($aInputs['header_' . $k]); unset($aInputs[$k . '_choice']); unset($aInputs[$k . '_upload']); } } }
function isAllowedCreatorCommentsDeleteAndEdit(&$aDataEntry, $isPerformAction = false) { if ($this->isAdmin()) { return true; } if (getParam('bx_groups_author_comments_admin') && $this->isEntryAdmin($aDataEntry)) { return true; } $this->_defineActions(); $aCheck = checkAction($this->_iProfileId, BX_GROUPS_COMMENTS_DELETE_AND_EDIT, $isPerformAction); return $aCheck[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED; }