本文整理汇总了PHP中isModerator函数的典型用法代码示例。如果您正苦于以下问题:PHP isModerator函数的具体用法?PHP isModerator怎么用?PHP isModerator使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isModerator函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: BxOSiSearchUnit
function BxOSiSearchUnit(&$oConfig, $_oTemplate = null)
{
$this->_oConfig = $oConfig;
$this->sHomePath = $this->_oConfig->getHomePath();
$this->sHomeUrl = $this->_oConfig->getHomeUrl();
$this->aPermalinks = array('param' => 'permalinks_osi', 'enabled' => array('file' => ''), 'disabled' => array('file' => ''));
$this->bShowCheckboxes = false;
if (isAdmin() || isModerator()) {
$this->aCurrent['restriction']['status'] = '';
$this->bShowCheckboxes = true;
}
parent::BxBaseSearchResultText();
$this->oOsiTemplate = $_oTemplate;
}
示例2: BxAdsSearchUnit
function BxAdsSearchUnit()
{
$oMain = $this->getAdsMain();
$this->sHomePath = $oMain->_oConfig->getHomePath();
$this->sHomeUrl = $oMain->_oConfig->getHomeUrl();
$this->aPermalinks = array('param' => 'permalinks_module_ads', 'enabled' => array('file' => 'ads/entry/{uri}', 'category' => 'ads/cat/{uri}', 'subcategory' => 'ads/subcat/{uri}', 'tag' => 'ads/tag/{uri}', 'browseAll' => 'ads/', 'admin_file' => 'ads/entry/{uri}', 'admin_category' => 'ads/cat/{uri}', 'admin_subcategory' => 'ads/subcat/{uri}', 'admin_tag' => 'ads/tag/{uri}', 'admin_browseAll' => 'ads/'), 'disabled' => array('file' => 'classifieds.php?ShowAdvertisementID={id}', 'category' => 'classifieds.php?bClassifiedID={id}', 'subcategory' => 'classifieds.php?bSubClassifiedID={id}', 'tag' => 'classifieds_tags.php?tag={uri}', 'browseAll' => 'classifieds.php', 'admin_file' => 'classifieds.php?ShowAdvertisementID={id}', 'admin_category' => 'classifieds.php?bClassifiedID={id}', 'admin_subcategory' => 'classifieds.php?bSubClassifiedID={id}', 'admin_tag' => 'classifieds_tags.php?tag={uri}', 'admin_browseAll' => 'classifieds.php'));
$this->bShowCheckboxes = false;
if (isAdmin() || isModerator()) {
//$this->aCurrent['restriction']['activeStatus'] = '';
//$this->bShowCheckboxes = true;
}
parent::BxBaseSearchResultText();
//$this->sTemplUnit = file_get_contents( $this->sHomeUrl . 'templates/base/'.$this->sTU.'.html' );
$this->sSelectedUnit = 'unit_ads';
$this->iPostViewType = $iPostViewType;
}
示例3: saveEditTab
/**
* Saves the user edit tab postdata into the tab's permanent storage
* @param object tab reflecting the tab database entry
* @param object mosUser reflecting the user being displayed
* @param int 1 for front-end, 2 for back-end
* @param array _POST data for saving edited tab content as generated with getEditTab
* @returns mixed : either string HTML for tab content, or false if ErrorMSG generated
*/
function saveEditTab($tab, &$user, $ui, $postdata) {
global $_CB_framework;
// Get all relevant tab parameters - these settings are global and set by the admin
$tabparams = $this->_pgGetTabParameters($user);
$isModerator=isModerator($_CB_framework->myId());
// Short Greeting:
$cb_pgshortgreeting = cbGetParam($_POST, "cb_pgshortgreeting", "");
$user->cb_pgshortgreeting = cbUnEscapeSQL($cb_pgshortgreeting);
// Enable Gallery:
if ($tabparams["pgallowuserenable"]=="1" || $ui==2 || $isModerator) {
$cb_pgenable = cbGetParam($_POST, "cb_pgenable", null);
if ($cb_pgenable) {
$user->cb_pgenable = $cb_pgenable;
}
}
// Enable Autopublish Items:
if ($tabparams["pgallowautopublishoverride"] || $ui==2 || $isModerator) {
if ($tabparams["pgautopublish"]) {
$cb_pgautopublish = cbGetParam($_POST, "cb_pgautopublish", null);
if ($cb_pgautopublish) {
$user->cb_pgautopublish = $cb_pgautopublish;
}
}
}
// Auto-approve Items setting in backend or frontend for moderators:
if ( ($ui == 2 && $tabparams["pgallowautoapproveoverride"]) || ($isModerator && $tabparams["pgallowautoapproveoverride"]) ) {
$cb_pgautoapprove = cbGetParam($_POST, "cb_pgautoapprove", null);
if ($cb_pgautoapprove) {
$user->cb_pgautoapprove = $cb_pgautoapprove;
}
}
/* Not needed, done by CB fields: */
if ($ui == 2 || $isModerator) {
// Item Quota (setting only in backend and frontend for moderators):
$cb_pgtotalquotaitems = cbGetParam($_POST, "cb_pgtotalquotaitems", null);
if (is_numeric($cb_pgtotalquotaitems)) {
$user->cb_pgtotalquotaitems = $cb_pgtotalquotaitems;
}
}
if ($ui == 2 || $isModerator) {
// Storage Quota (setting only in backend and frontend for moderators):
$cb_pgtotalquotasize = cbGetParam($_POST, "cb_pgtotalquotasize", null);
if (is_numeric($cb_pgtotalquotasize)) {
$user->cb_pgtotalquotasize = $cb_pgtotalquotasize;
}
}
if ($ui == 2 || $isModerator) {
// Maximum Single Upload Size (setting only in backend and frontend for moderators):
$cb_pguploadsize = cbGetParam($_POST, "cb_pguploadsize", null);
if (is_numeric($cb_pguploadsize)) {
$user->cb_pguploadsize = $cb_pguploadsize;
}
}
if ($ui == 2 || $isModerator) {
// Current Item Count Usage (information field only):
$cb_pgtotalitems = cbGetParam($_POST, "cb_pgtotalitems", null);
if (is_numeric($cb_pgtotalitems)) {
$user->cb_pgtotalitems = $cb_pgtotalitems;
}
}
if ($ui == 2 || $isModerator) {
// Current Item Size Usage (information field only):
$cb_pgtotalsize = cbGetParam($_POST, "cb_pgtotalsize", null);
if (is_numeric($cb_pgtotalsize)) {
$user->cb_pgtotalsize = $cb_pgtotalsize;
}
}
if ($ui == 2 || $isModerator) {
// Last Update Date (information field only):
$cb_pglastupdate = cbGetParam($_POST, "cb_pglastupdate", null);
if ($cb_pglastupdate !== null) {
$user->cb_pglastupdate = $cb_pglastupdate;
}
}
// Access Mode:
if ($tabparams["pgallowaccessmodeoverride"] || $ui ==2 || $isModerator) {
$cb_pgaccessmode = cbGetParam($_POST, "cb_pgaccessmode", null);
if ($cb_pgaccessmode) {
//.........这里部分代码省略.........
示例4: mysqli
$servername = "okenso.com";
$username = "hdev";
$password = "devsnake371";
$dbname = "dev";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$error = false;
$error_message = "";
$data = json_decode(file_get_contents('php://input'), true);
$user = $data["username"];
$viewer = $data["viewer"];
$channelname = $data["channelname"];
$channelowner = $data["channelowner"];
if (isAdmin($conn, $user) || isOwner($conn, $user, $channelname, $channelowner) || isModerator($conn, $user, $channelname, $channelowner)) {
removeViewer($conn, $viewer, $channelname, $channelowner);
} else {
$error = true;
$error_message = "You do not have permission to remove a viewer from this channel";
}
$conn->close();
$response = array('error' => $error, 'error_message' => $error_message, 'viewer' => $viewer);
echo json_encode($response);
function removeViewer($conn, $viewer, $channelname, $channelowner)
{
$sql = "DELETE FROM private_view_channels WHERE\n prv_username = \"" . $viewer . "\" AND prv_chname = \"" . $channelname . "\" AND prv_chowner = \"" . $channelowner . "\";";
$conn->query($sql);
}
?>
示例5: getProfileViewActions
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');
}
示例6: canReview
function canReview($id, $meta, $parid)
{
return isModerator($id) && $meta[$parid]['user'] != $_SERVER['REMOTE_USER'] && $meta[$parid]['ip'] != clientIP(true);
}
示例7: getAuto
private function getAuto( $user, $rawPassword, $extras, $trigger ) {
$cbUser = new CBuser();
$cbUser->load( (int) $user->id );
if ( ( ! isset( $user->gids ) ) || ( isset( $user->gids ) && ( ! is_array( $user->gids ) ) ) ) {
$gids = array( $user->gid );
} else {
$gids = $user->gids;
}
if ( $user->id ) {
array_unshift( $gids, -3 );
if ( isModerator( $user->id ) ) {
array_unshift( $gids, -5 );
} else {
array_unshift( $gids, -4 );
}
} else {
array_unshift( $gids, -2 );
}
array_unshift( $gids, -1 );
$access = explode( '|*|', $trigger->get( 'access' ) );
if ( ! array_intersect( $access, $gids ) ) {
return;
}
$conditionals = count( explode( "\n", $trigger->get( 'field' ) ) );
for ( $i = 0, $n = $conditionals; $i < $n; $i++ ) {
if ( ! cbgjautoClass::getFieldMatch( $user, $cbUser, $extras, cbgjClass::getHTMLCleanParam( true, "field$i", null, null, $trigger->get( 'field' ) ), cbgjClass::getCleanParam( true, "operator$i", null, null, $trigger->get( 'operator' ) ), cbgjClass::getHTMLCleanParam( true, "value$i", null, null, $trigger->get( 'value' ) ) ) ) {
return;
}
}
$plugin = cbgjClass::getPlugin();
$exclude = $trigger->get( 'exclude' );
if ( $exclude ) {
cbArrayToInts( explode( ',', $exclude ) );
$exclude = array_unique( $exclude );
if ( in_array( $user->id, $exclude ) ) {
return;
}
}
$params = $trigger->getParams();
if ( ( $params->get( 'auto', null ) == 3 ) && $params->get( 'cat_name', null ) ) {
$owner = (int) $cbUser->replaceUserVars( $params->get( 'cat_owner', $user->id ), true, true, $extras );
if ( ! $owner ) {
$owner = (int) $user->id;
}
$parent = (int) $params->get( 'cat_parent', 0 );
$name = trim( strip_tags( $cbUser->replaceUserVars( $params->get( 'cat_name', null ), true, true, $extras ) ) );
$description = $cbUser->replaceUserVars( $params->get( 'cat_description', null ), true, true, $extras );
if ( $params->get( 'cat_unique', 1 ) ) {
$where = array( array( 'user_id', '=', $owner ), array( 'name', '=', $name ), array( 'parent', '=', (int) $parent ) );
} else {
$where = array( array( 'name', '=', $name ), array( 'parent', '=', (int) $parent ) );
}
$row = cbgjData::getCategories( null, $where, null, null, false );
if ( ! $row->get( 'id' ) ) {
$row->set( 'published', 1 );
$row->set( 'parent', (int) $parent );
$row->set( 'user_id', $owner );
$row->set( 'name', $name );
if ( $plugin->params->get( 'category_editor', 1 ) >= 2 ) {
$row->set( 'description', cbgjClass::getFilteredText( $description ) );
} else {
$row->set( 'description', trim( strip_tags( $description ) ) );
}
$row->set( 'access', (int) $plugin->params->get( 'category_access_default', -2 ) );
$row->set( 'types', $params->get( 'types', $plugin->params->get( 'category_types_default', '1|*|2|*|3' ) ) );
$row->set( 'create', (int) $plugin->params->get( 'category_create_default', 1 ) );
$row->set( 'create_access', (int) $plugin->params->get( 'category_createaccess_default', -1 ) );
$row->set( 'nested', (int) $plugin->params->get( 'category_nested_default', 1 ) );
$row->set( 'nested_access', (int) $plugin->params->get( 'category_nestedaccess_default', -1 ) );
$row->set( 'date', cbgjClass::getUTCDate() );
$row->set( 'ordering', 99999 );
$row->store();
}
} elseif ( ( $params->get( 'auto', null ) == 2 ) && $params->get( 'category', null ) && $params->get( 'grp_name', null ) ) {
if ( ( $params->get( 'category', null ) == -1 ) && $params->get( 'cat_name', null ) ) {
$owner = (int) $cbUser->replaceUserVars( $params->get( 'cat_owner', $user->id ), true, true, $extras );
//.........这里部分代码省略.........
示例8: getBlockCode_ActionsBlock
/**
* Function will generate block with actions;
*/
function getBlockCode_ActionsBlock()
{
$sCode = '';
if (!$this->aPollInfo) {
return MsgBox(_t('_Empty'));
}
// prepare all needed keys
$aUnitInfo = array('ViewerID' => (int) $this->iMemberId, 'ID' => (int) $this->aPollInfo['id_poll'], 'BaseUri' => $this->oModule->_oConfig->getBaseUri());
$aUnitInfo['base_url'] = BX_DOL_URL_ROOT . $aUnitInfo['BaseUri'];
$aUnitInfo['approved_cpt'] = '';
$aUnitInfo['approved_act'] = '';
$aUnitInfo['del_poll_title'] = $aUnitInfo['del_poll_url'] = $aUnitInfo['del_poll_script'];
if (isLogged() && ($this->aPollInfo['id_profile'] == $this->iMemberId || isAdmin())) {
$sDeleteLink = $this->oModule->getModulePath() . '&action=delete_poll&id=' . $aUnitInfo['ID'];
$aUnitInfo['del_poll_title'] = _t('_bx_poll_delete');
$aUnitInfo['del_poll_url'] = $sDeleteLink;
$aUnitInfo['del_poll_script'] = "if(confirm('" . bx_js_string(_t('_Are_you_sure')) . "')) window.open ('" . $sDeleteLink . "','_self'); return false;";
}
$sMainPrefix = 'bx_poll';
if (isAdmin($this->iMemberId) || isModerator($this->iMemberId) && $this->aPollInfo['id_profile'] != $this->iMemberId) {
$sMsg = '_';
$iAppr = 1;
if ($this->aPollInfo['poll_approval'] == 1) {
$sMsg .= 'dis';
$iAppr = 0;
}
$aUnitInfo['approved_cpt'] = _t('_' . $sMainPrefix . $sMsg . 'approve');
$aUnitInfo['approved_act'] = $iAppr;
}
$oSubscription = BxDolSubscription::getInstance();
$aButton = $oSubscription->getButton($this->iMemberId, $sMainPrefix, '', $this->aPollInfo['id_poll']);
$sCode .= $oSubscription->getData();
$aUnitInfo['sbs_poll_title'] = $aButton['title'];
$aUnitInfo['sbs_poll_script'] = $aButton['script'];
$aUnitInfo['TitleShare'] = $this->oModule->isAllowedShare($this->aPollInfo) ? _t('_Share') : '';
if (BxDolRequest::serviceExists('wall', 'get_repost_js_click')) {
$sCode .= BxDolService::call('wall', 'get_repost_js_script');
$aUnitInfo['repostCpt'] = _t('_Repost');
$aUnitInfo['repostScript'] = BxDolService::call('wall', 'get_repost_js_click', array($this->iMemberId, $sMainPrefix, 'add', $this->aPollInfo['id_poll']));
}
$sActions = $GLOBALS['oFunctions']->genObjectsActions($aUnitInfo, $sMainPrefix);
if (empty($sActions)) {
return '';
}
return $sCode . $sActions;
}
示例9: PageCompAds
function PageCompAds($oAds)
{
$sRetHtml = '';
$sRetHtml .= $oAds->PrintCommandForms();
if ($_REQUEST) {
if (false !== bx_get('action')) {
switch (bx_get('action')) {
case '3':
echo $oAds->actionSearch();
exit;
break;
case '2':
$iClassifiedSubID = (int) bx_get('FilterSubCat');
$sRetHtml .= $oAds->PrintSubRecords($iClassifiedSubID);
break;
case '1':
$iClassifiedID = (int) bx_get('FilterCat');
$sRetHtml .= $oAds->PrintAllSubRecords($iClassifiedID);
break;
case 'report':
$iCommentID = (int) bx_get('commentID');
print $oAds->GenReportSubmitForm($iCommentID);
exit;
case 'post_report':
print $oAds->ActionReportSubmit();
exit;
case 'show_calendar':
$sRetHtml .= $oAds->GenAdsCalendar();
break;
case 'show_calendar_ads':
$sRetHtml .= $oAds->GenAdsByDate();
break;
case 'show_featured':
$sRetHtml .= $oAds->GenAllAds('featured');
break;
case 'show_categories':
$sRetHtml .= $oAds->genCategoriesBlock();
break;
case 'show_all_ads':
$sRetHtml .= $oAds->GenAllAds();
break;
case 'show_popular':
$sRetHtml .= $oAds->GenAllAds('popular');
break;
case 'show_top_rated':
$sRetHtml .= $oAds->GenAllAds('top');
break;
case 'my_page':
$sRetHtml .= $oAds->GenMyPageAdmin();
break;
case 'tags':
$sRetHtml .= $oAds->GenTagsPage();
break;
}
} elseif (false !== bx_get('bClassifiedID') && (int) bx_get('bClassifiedID') > 0 || false !== bx_get('catUri') && bx_get('catUri') != '') {
$iClassifiedID = (int) bx_get('bClassifiedID') > 0 ? (int) bx_get('bClassifiedID') : (int) db_value("SELECT `ID` FROM `{$oAds->_oConfig->sSQLCatTable}` WHERE `CEntryUri`='" . process_db_input(bx_get('catUri'), BX_TAGS_STRIP) . "' LIMIT 1");
if ($iClassifiedID > 0) {
$sRetHtml .= $oAds->PrintAllSubRecords($iClassifiedID);
}
} elseif (false !== bx_get('bSubClassifiedID') && (int) bx_get('bSubClassifiedID') > 0 || false !== bx_get('scatUri') && bx_get('scatUri') != '') {
$iSubClassifiedID = (int) bx_get('bSubClassifiedID') > 0 ? (int) bx_get('bSubClassifiedID') : (int) db_value("SELECT `ID` FROM `{$oAds->_oConfig->sSQLSubcatTable}` WHERE `SEntryUri`='" . process_db_input(bx_get('scatUri'), BX_TAGS_STRIP) . "' LIMIT 1");
if ($iSubClassifiedID > 0) {
$sRetHtml .= $oAds->PrintSubRecords($iSubClassifiedID);
}
} elseif (false !== bx_get('ShowAdvertisementID') && (int) bx_get('ShowAdvertisementID') > 0 || false !== bx_get('entryUri') && bx_get('entryUri') != '') {
$iID = (int) bx_get('ShowAdvertisementID') > 0 ? (int) bx_get('ShowAdvertisementID') : (int) db_value("SELECT `ID` FROM `{$oAds->_oConfig->sSQLPostsTable}` WHERE `EntryUri`='" . process_db_input(bx_get('entryUri'), BX_TAGS_STRIP) . "' LIMIT 1");
$oAds->ActionPrintAdvertisement($iID);
bx_import('PageView', $oAds->_aModule);
$oAPV = new BxAdsPageView($oAds, $iID);
$sRetHtml .= $oAPV->getCode();
} elseif (false !== bx_get('UsersOtherListing')) {
$iProfileID = (int) bx_get('IDProfile');
if ($iProfileID > -1) {
$sRetHtml .= $oAds->getMemberAds($iProfileID);
}
} elseif (false !== bx_get('DeleteAdvertisementID')) {
$id = (int) bx_get('DeleteAdvertisementID');
if ($id > 0) {
$sRetHtml .= $oAds->ActionDeleteAdvertisement($id);
$sRetHtml .= $oAds->GenMyPageAdmin('manage');
}
} elseif (false !== bx_get('ActivateAdvertisementID')) {
$iAdID = (int) bx_get('ActivateAdvertisementID');
if ($iAdID > 0 && ($oAds->bAdminMode || isModerator($oAds->_iVisitorID))) {
$sStatus = bx_get('ActType') == 'active' ? 'active' : 'inactive';
$oAds->_oDb->setPostStatus($iAdID, $sStatus);
$oAds->ActionPrintAdvertisement($iAdID);
bx_import('PageView', $oAds->_aModule);
$oAPV = new BxAdsPageView($oAds, $iAdID);
$sRetHtml .= $oAPV->getCode();
}
} elseif (false !== bx_get('BuyNow')) {
$advId = (int) bx_get('IDAdv');
if ($advId > 0) {
$sRetHtml .= $oAds->ActionBuyAdvertisement($advId);
}
} elseif (false !== bx_get('BuySendNow')) {
$advId = (int) bx_get('IDAdv');
if ($advId > 0) {
$sRetHtml .= $oAds->ActionBuySendMailAdvertisement($advId);
//.........这里部分代码省略.........
示例10: _htmlEditForm
/**
*
*
* @param moscomprofilerFields $field
* @param moscomprofilerUser $user
* @param string $reason 'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'list' for user-lists
* @param boolean $displayFieldIcons
* @return string HTML: <tag type="$type" value="$value" xxxx="xxx" yy="y" />
*/
function _htmlEditForm(&$field, &$user, $reason, $displayFieldIcons = true)
{
global $_CB_framework, $_CB_database, $ueConfig;
if ($field->name == 'avatar' && !($ueConfig['allowAvatarUpload'] || $ueConfig['allowAvatarGallery'])) {
return null;
}
$name = $field->name;
$nameapproved = $field->name . 'approved';
$required = $this->_isRequired($field, $user, $reason);
$existingAvatar = false;
if ($user && $user->id) {
// we can not trust the following, as if another field did error out, it's wrong:
// $existingAvatar = ( $user->$name != null );
// so load from database:
$realDatabaseUser = new moscomprofilerUser($_CB_database);
if ($realDatabaseUser->load((int) $user->id)) {
$existingAvatar = $realDatabaseUser->{$name} != null;
}
}
$html = '<div>';
$choices = array();
if ($reason == 'register' || $reason == 'edit' && $user->id == 0) {
if ($required == 0) {
$choices[] = moscomprofilerHTML::makeOption('', _UE_AVATAR_NONE);
}
} else {
if ($existingAvatar || $required == 0) {
$choices[] = moscomprofilerHTML::makeOption('', _UE_AVATAR_NO_CHANGE);
}
}
if ($name != 'avatar' || $ueConfig['allowAvatarUpload']) {
$choices[] = moscomprofilerHTML::makeOption('upload', $existingAvatar ? _UE_AVATAR_UPLOAD_NEW : _UE_AVATAR_UPLOAD);
}
if ($name == 'avatar' && $ueConfig['allowAvatarGallery']) {
$choices[] = moscomprofilerHTML::makeOption('gallery', _UE_AVATAR_SELECT);
}
if ($_CB_framework->getUi() == 2 && $existingAvatar && $user->{$nameapproved} == 0) {
$choices[] = moscomprofilerHTML::makeOption('approve', _UE_APPROVE_IMAGE);
}
if ($existingAvatar && $required == 0) {
$choices[] = moscomprofilerHTML::makeOption('delete', _UE_DELETE_AVATAR);
}
$html .= '<div>';
if ($reason != 'register' && $user->id != 0 && $existingAvatar) {
$html .= $this->_avatarHtml($field, $user, $reason) . ' ';
}
if ($reason == 'edit' && $existingAvatar && $user->{$nameapproved} == 0 && isModerator($_CB_framework->myId())) {
$html .= $this->_avatarHtml($field, $user, $reason, false, 10) . ' ';
}
if (count($choices) > 1) {
$additional = ' class="inputbox"';
if ($_CB_framework->getUi() == 1 && $reason == 'edit' && $field->readonly) {
$additional .= ' disabled="disabled"';
}
$html .= moscomprofilerHTML::selectList($choices, $name . '__choice', $additional, 'value', 'text', '', $required, true, false);
/*
$js = " $('#cbimg_upload_" . $name . ",#cbimg_gallery_" . $name . "').hide();"
. "\n $('#" . $name . "__choice').click( function() {"
. "\n var choice = $(this).val();"
. "\n if ( choice == '' ) {"
. "\n $('#cbimg_upload_" . $name . "').slideUp('slow');"
. "\n $('#cbimg_gallery_" . $name . "').slideUp('slow');"
. "\n } else if ( choice == 'upload' ) {"
. "\n $('#cbimg_upload_" . $name . "').slideDown('slow');"
. "\n $('#cbimg_gallery_" . $name . "').slideUp('slow');"
. "\n } else if ( choice == 'gallery' ) {"
. "\n $('#cbimg_upload_" . $name . "').slideUp('slow');"
. "\n $('#cbimg_gallery_" . $name . "').slideDown('slow');"
. "\n }"
. "\n } ).click();"
;
*/
static $functOut = false;
if (!$functOut) {
$js = "function cbslideImage(choice,uplodid,galleryid) {" . "\n\tif ( ( choice == '' ) || ( choice == 'approve' ) || ( choice == 'delete' ) ) {" . "\n\t\t\$(uplodid).slideUp('slow');" . "\n\t\t\$(galleryid).slideUp('slow');" . "\n\t} else if ( choice == 'upload' ) {" . "\n\t\t\$(uplodid).slideDown('slow');" . "\n\t\t\$(galleryid).slideUp('slow');" . "\n\t} else if ( choice == 'gallery' ) {" . "\n\t\t\$(uplodid).slideUp('slow');" . "\n\t\t\$(galleryid).slideDown('slow');" . "\n\t}" . "\n}";
$_CB_framework->outputCbJQuery($js);
$functOut = true;
}
$js = "\$('#cbimg_upload_" . $name . ",#cbimg_gallery_" . $name . "').hide();" . "\n\t{" . "\n\t \$('#" . $name . "__choice').click( function() {" . "\n\t\tcbslideImage( \$(this).val(), '#cbimg_upload_" . $name . "', '#cbimg_gallery_" . $name . "' );" . "\n\t } ).click();" . "\n\t \$('#" . $name . "__choice').change( function() {" . "\n\t\tcbslideImage( \$(this).val(), '#cbimg_upload_" . $name . "', '#cbimg_gallery_" . $name . "' );" . "\n\t } );" . "\n\t}";
$_CB_framework->outputCbJQuery($js);
} else {
$html .= '<input type="hidden" name="' . $name . '__choice" value="' . $choices[0]->value . '" />';
}
$html .= $this->_fieldIconsHtml($field, $user, 'htmledit', $reason, 'select', '', null, '', array(), $displayFieldIcons, $required);
$html .= '</div>';
if ($name != 'avatar' || $ueConfig['allowAvatarUpload']) {
$button = $reason == 'register' ? _UE_REGISTER : ($_CB_framework->getUi() == 2 ? _UE_SAVE : _UE_UPDATE);
$saveFieldName = $field->name;
$saveFieldRequired = $field->required;
$field->name .= '__file';
if ($field->required && $user && isset($user->{$saveFieldName}) && $user->{$saveFieldName}) {
//.........这里部分代码省略.........
示例11: actionApprove
/**
* Method for ajax approval / disaproval from action button ;
*
* @return : (text) - Html response ;
*/
function actionApprove($iPollId, $iApprove = 1)
{
$iPollId = (int) $iPollId;
if ($iPollId) {
$iActionerId = getLoggedId();
$iApprove = (int) $iApprove;
$sJQueryJS = genAjaxyPopupJS($iPollId);
if (isAdmin($iActionerId) || isModerator($iActionerId)) {
if (!$this->_oDb->setStatus($iPollId, $iApprove)) {
$sMsg = '_Error';
} else {
$sMsg = '_Saved';
}
} else {
$sMsg = '_Access denied';
}
header('Content-Type: text/html; charset=UTF-8');
echo MsgBox(_t($sMsg)) . $sJQueryJS;
exit;
}
}
示例12: PageListControl
/**
* Perform admin or moderator actions
*
* @param $sAction string
* @param $iViewerId integer
* @param $iTargetId integer
* @return mixed - HTML code or FALSE
*/
function PageListControl($sAction, $iViewerId, $iTargetId)
{
$sAction = clear_xss($sAction);
$iViewerId = (int) $iViewerId;
$iTargetId = (int) $iTargetId;
$mixedRes = FALSE;
$sMsg = '_Error';
if (isAdmin($iViewerId) or isModerator($iViewerId) and $iViewerId != $iTargetId) {
switch ($sAction) {
case 'activate':
case 'deactivate':
$mixedRes = _setStatus($iTargetId, $sAction);
break;
case 'ban':
if (bx_admin_profile_ban_control($iTargetId)) {
$sMsg = '_Success';
}
$mixedRes = MsgBox(_t($sMsg));
break;
case 'unban':
if (bx_admin_profile_ban_control($iTargetId, FALSE)) {
$sMsg = '_Success';
}
$mixedRes = MsgBox(_t($sMsg));
break;
case 'featured':
case 'unfeatured':
$mixedRes = _setFeature($iTargetId, $sAction);
break;
case 'delete':
profile_delete($iTargetId);
$mixedRes = MsgBox(_t('_Success')) . genAjaxyPopupJS($iTargetId, 'ajaxy_popup_result_div', BX_DOL_URL_ROOT . 'browse.php');
break;
case 'delete_spam':
profile_delete($iTargetId, TRUE);
$mixedRes = MsgBox(_t('_Success')) . genAjaxyPopupJS($iTargetId, 'ajaxy_popup_result_div', BX_DOL_URL_ROOT . 'browse.php');
break;
default:
}
}
return $mixedRes;
}
示例13: userProfile
static function userProfile($user, $option, $submitvalue)
{
global $_CB_framework, $ueConfig, $_POST, $_PLUGINS;
$_PLUGINS->loadPluginGroup('user');
$results = $_PLUGINS->trigger('onBeforeUserProfileRequest', array(&$user, 1));
if ($_PLUGINS->is_errors()) {
echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n";
exit;
}
$cbTemplate = HTML_comprofiler::_cbTemplateLoad();
$cbMyIsModerator = isModerator($_CB_framework->myId());
$cbUserIsModerator = isModerator($user->id);
$showProfile = 1;
if ($user->banned != 0 || $user->block == 1 && $user->confirmed && $user->approved) {
echo "<font color='red'>";
if ($user->banned != 0) {
if ($_CB_framework->myId() != $user->id) {
echo _UE_USERPROFILEBANNED;
} else {
echo _UE_BANNED_CHANGE_PROFILE;
}
}
if ($user->block == 1 && $user->confirmed && $user->approved) {
echo _UE_USERPROFILEBLOCKED;
}
if ($_CB_framework->myId() != $user->id && $cbMyIsModerator != 1) {
$showProfile = 0;
} else {
if ($user->block == 1) {
echo ": " . _UE_LOGIN_BLOCKED;
}
if ($user->banned != 0) {
echo "<br />" . nl2br($user->bannedreason);
}
}
echo "<br /></font>";
}
if (!$user->confirmed) {
echo "<font color='red'>" . _UE_USER_NOT_CONFIRMED . "</font><br />";
}
if (!$user->approved) {
echo "<font color='red'>" . _UE_USER_NOT_APPROVED . "</font><br />";
}
if ((!$user->confirmed || !$user->approved) && $cbMyIsModerator != 1) {
$showProfile = 0;
}
if ($showProfile == 1) {
$results = $_PLUGINS->trigger('onBeforeUserProfileDisplay', array(&$user, 1, $cbUserIsModerator, $cbMyIsModerator));
if ($_PLUGINS->is_errors()) {
echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n";
exit;
}
$output = 'html';
$cbUser =& CBuser::getInstance($user->id);
$_CB_framework->displayedUser((int) $user->id);
$userViewTabs = $cbUser->getProfileView();
/*
$tabs = new cbTabs( 0, 1 );
$userViewTabs = $tabs->getViewTabs($user); // this loads, registers menu and user status and renders the tabs
*/
$_CB_framework->setPageTitle(cbUnHtmlspecialchars(getNameFormat($user->name, $user->username, $ueConfig['name_format'])));
$_CB_framework->appendPathWay(getNameFormat($user->name, $user->username, $ueConfig['name_format']));
outputCbTemplate(1);
initToolTip(1);
$_CB_framework->document->addHeadScriptDeclaration('
function cbConnSubmReq() {
cClick();
document.connOverForm.submit();
}
function confirmSubmit() {
if (confirm("' . _UE_CONFIRMREMOVECONNECTION . '"))
return true ;
else
return false ;
}
');
if (is_array($results)) {
echo implode('', $results);
}
echo "\n\t<div class=\"cbProfile\"><div id=\"cbProfileInner\">";
echo HTML_comprofiler::_cbTemplateRender($cbTemplate, $user, 'Profile', 'drawProfile', array(&$user, &$userViewTabs), $output);
echo "</div><div class=\"cbClr\"></div></div>\n" . "<div class=\"cbClr\"></div>";
// end of cbProfile floating div
$tab = null;
if (isset($_GET['tab'])) {
$tab = urldecode(stripslashes(cbGetParam($_GET, 'tab', '')));
} elseif (isset($_POST['tab'])) {
$tab = stripslashes(cbGetParam($_POST, 'tab', ''));
}
if ($tab) {
$_CB_framework->outputCbJQuery("showCBTab('" . addslashes($tab) . "');");
}
if ($_CB_framework->myId() != $user->id) {
recordViewHit($_CB_framework->myId(), $user->id, getenv('REMOTE_ADDR'));
}
$_PLUGINS->trigger('onAfterUserProfileDisplay', array($user, true));
}
}
示例14: sql_query
$objid = $objData["objid"];
// Fetch artist's data.
$result = sql_query("SELECT `useid`, `useUsername` FROM `users` " . "WHERE `useid` = '" . $objData["objCreator"] . "' LIMIT 1");
$useData = mysql_fetch_assoc($result);
// This does not work until abuCreator is added. The addition of abuCreator will probably also result in other code modification.
$useData["abuseCases"] = intval(mysql_result(sql_query("SELECT COUNT(*) FROM `abuses` WHERE `abuCreator` = '" . $objData["objCreator"] . "'"), 0));
$useData["abusePercent"] = round(intval(mysql_result(sql_query("SELECT COUNT(*) FROM `abuses` WHERE `abuCreator` = '" . $objData["objCreator"] . "' AND ((`abuMod` = '-' AND `abusMod` = '-') OR (`aburMod` = '-'))"), 0)) / $useData["abuseCases"] * 100);
// Fetch reporter's data.
$result = sql_query("SELECT `useid`, `useUsername` FROM `users` " . "WHERE `useid` = '" . $objData["abuSubmitter"] . "' LIMIT 1");
$repData = mysql_fetch_assoc($result);
$repData["abuseCases"] = intval(mysql_result(sql_query("SELECT COUNT(*) FROM `abuses` WHERE `abuSubmitter` = '" . $objData["abuSubmitter"] . "'"), 0));
$repData["abusePercent"] = round(intval(mysql_result(sql_query("SELECT COUNT(*) FROM `abuses` WHERE `abuSubmitter` = '" . $objData["abuSubmitter"] . "' AND ((`abuMod` = '-' AND `abusMod` = '-') OR (`aburMod` = '-'))"), 0)) / $repData["abuseCases"] * 100);
// Determine the current user's access level.
$accessLevel = 0;
// No access.
if ($objData["abuMod"] == "?" && isModerator()) {
$accessLevel = 1;
// Moderator.
} elseif ($objData["abuMod"] != "?" && $objData["abusMod"] == "?" && isSModerator()) {
$accessLevel = 2;
// Supermoderator.
} elseif ($objData["abuMod"] != "?" && $objData["abusMod"] != "?" && $objData["abuMod"] != $objData["abusMod"] && isAdmin()) {
$accessLevel = 3;
// Administrator.
}
if ($objData["abuResolved"]) {
$accessLevel = 0;
}
// This abuse case is resolved.
if ($accessLevel > 0 && isset($_POST["submit"])) {
// Check if we got a correct decision: "+" or "-"
示例15: member_auth
$GLOBALS['oTopMenu']->setCurrentProfileID($iProfileId);
$_page_cont[$iIndex]['page_main_code'] = $oPoll->searchMy();
} else {
member_auth(0);
}
break;
case 'show_poll_info':
case 'poll_home':
// draw polls question on menu's panel;
$aPollInfo = current($oPoll->_oDb->getPollInfo($iPollId));
$sCode = '';
$sInitPart = $oPoll->getInitPollPage();
if ($aPollSettings['action'] == 'show_poll_info') {
$isAllowView = FALSE;
if (!empty($aPollInfo)) {
if ((int) $aPollInfo['poll_approval'] == 1 || isAdmin($iProfileId) || isModerator($iProfileId)) {
$isAllowView = TRUE;
}
}
if ($isAllowView) {
$oViewPoll = bx_instance($aModule['class_prefix'] . 'View', array($aPollSettings['action'], $aModule, $oPoll, $iPollId), $aModule);
$sPageTitle = $aPollInfo['poll_question'];
$sPageCaption = _t('_bx_poll_view', $aPollInfo['poll_question']);
$_page['header'] = $sPageCaption;
$_page['header_text'] = $sPageCaption;
$oPoll->_oTemplate->addJsTranslation(array('_Are_you_sure'));
$oPoll->_oTemplate->setPageDescription($aPollInfo['poll_question']);
$oPoll->_oTemplate->addPageKeywords($aPollInfo['poll_answers'], BX_POLL_ANS_DIVIDER);
if (mb_strlen($sPageTitle) > $oPoll->sPollHomeTitleLenght) {
$sPageTitle = mb_substr($sPageTitle, 0, $oPoll->sPollHomeTitleLenght) . '...';
}