function getProfilesMatch($iPID1 = 0, $iPID2 = 0) { $iPID1 = (int) $iPID1; $iPID2 = (int) $iPID2; if (!$iPID1 or !$iPID2) { return 0; } if ($iPID1 == $iPID2) { return 0; } //maybe need to return 100?? :) // try to find in cache $sQuery = "SELECT `Percent` FROM `ProfilesMatch` WHERE `PID1` = {$iPID1} AND `PID2` = {$iPID2}"; $aPercent = db_assoc_arr($sQuery); if ($aPercent) { return (int) $aPercent['Percent']; } //not found in cache $aProf1 = getProfileInfo($iPID1); $aProf2 = getProfileInfo($iPID2); if (!$aProf1 or !$aProf2) { return 0; } $oPF = new BxDolProfileFields(101); //matching area $iMatch = $oPF->getProfilesMatch($aProf1, $aProf2); //write to cache $sQuery = "INSERT INTO `ProfilesMatch` ( `PID1`, `PID2`, `Percent` ) VALUES ( {$iPID1}, {$iPID2}, {$iMatch} )"; db_res($sQuery); return $iMatch; }
function PageListFriend($sourceID, $targetID) { $ret = ''; $query = "SELECT * FROM `FriendList` WHERE (`ID` = '{$sourceID}' and `Profile` = '{$targetID}') or ( `ID` = '{$targetID}' and `Profile` = '{$sourceID}')"; $temp = db_assoc_arr($query); if ($sourceID == $temp['ID'] || $temp['Check'] == 1) { $ret = _t_action('_already_in_friend_list'); } elseif ($targetID == $temp['ID'] && 0 == $temp['Check']) { $query = "UPDATE `FriendList` SET `Check` = '1' WHERE `ID` = '{$targetID}' AND `Profile` = '{$sourceID}';"; if (db_res($query)) { $ret = _t_action('_User was added to friend list'); } else { $ret = _t_err('_Failed to apply changes'); } } else { $query = "INSERT INTO `FriendList` SET `ID` = '{$sourceID}', `Profile` = '{$targetID}', `Check` = '0';"; if (db_res($query)) { $ret = _t_action('_User was invited to friend list'); } else { $ret = _t_err('_Failed to apply changes'); } } return $ret; }
function showPropForm($iBlockID) { $sQuery = "SELECT * FROM `{$this->sDBTable}` WHERE `Page` = '{$this->sPage_db}' AND `ID` = {$iBlockID}"; $aItem = db_assoc_arr($sQuery); if (!$aItem) { ?> <div style="text-align:center;color:red;">This block has no properties</div> <?php return; } ?> <form name="formItemEdit" id="formItemEdit" action="<?php echo $_SERVER['PHP_SELF']; ?> " method="POST"> <input type="hidden" name="Page" value="<?php echo htmlspecialchars($this->oPage->sName); ?> " /> <input type="hidden" name="id" value="<?php echo $iBlockID; ?> " /> <input type="hidden" name="action" value="saveItem" /> <table class="popup_form_wrapper"> <tr> <td class="corner"><img src="images/op_cor_tl.png" /></td> <td class="side_ver"><img src="images/spacer.gif" /></td> <td class="corner"><img src="images/op_cor_tr.png" /></td> </tr> <tr> <td class="side"><img src="images/spacer.gif" /></td> <td class="container"> <div class="edit_item_table_cont"> <table class="edit_item_table" > <tr> <td class="form_label">Type:</td> <td> <?php switch ($aItem['Func']) { case 'PFBlock': echo 'Profile Fields'; break; case 'Echo': echo 'HTML Block'; break; case 'RSS': echo 'RSS Feed'; break; default: echo 'Special Block'; } ?> </td> </tr> <tr> <td class="form_label">Description:</td> <td><?php echo $aItem['Desc']; ?> </td> </tr> <tr> <td class="form_label">Caption Lang Key:</td> <td> <input type="text" class="form_input_text" name="Caption" value="<?php echo $aItem['Caption']; ?> " /> </td> </tr> <tr> <td class="form_label">Visible for:</td> <td> <label> <input type="checkbox" name="Visible[]" value="non" <?php echo strpos($aItem['Visible'], 'non') === false ? '' : 'checked="checked"'; ?> /> Guest </label> <label> <input type="checkbox" name="Visible[]" value="memb" <?php echo strpos($aItem['Visible'], 'memb') === false ? '' : 'checked="checked"'; ?> /> Member </label> </td> </tr> <?php if ($aItem['Func'] == 'Echo') { ?> <tr> <td class="form_label">HTML-content:</td> <td> </td> </tr> <tr> <td class="form_colspan" colspan="2"> <textarea class="form_input_html" id="form_input_html" name="Content"><?php echo htmlspecialchars_adv($aItem['Content']); ?> </textarea> </td> </tr> <?php } elseif ($aItem['Func'] == 'RSS') { list($sUrl, $iNum) = explode('#', $aItem['Content']); $iNum = (int) $iNum; ?> <tr> <td class="form_label">Url of RSS feed:</td> <td><input type="text" class="form_input_text" name="Url" value="<?php echo $sUrl; ?> " /></td> </tr> <tr> <td class="form_label">Number of RSS items (0 - all):</td> <td><input type="text" class="form_input_text" name="Num" value="<?php echo $iNum; ?> " /></td> </tr> <?php } ?> <tr> <td class="form_colspan" colspan="2"> <input type="submit" value="Save" /> <?php if ($aItem['Func'] == 'RSS' or $aItem['Func'] == 'Echo') { ?> <input type="reset" value="Delete" name="Delete" /> <?php } ?> <input type="reset" value="Cancel" name="Cancel" /> </td> </tr> </table> </div> </td> <td class="side"><img src="images/spacer.gif" alt="" /></td> </tr> <tr> <td class="corner"><img src="images/op_cor_bl.png" /></td> <td class="side_ver"><img src="images/spacer.gif" alt="" /></td> <td class="corner"><img src="images/op_cor_br.png" onload="if( navigator.appName == 'Microsoft Internet Explorer' && version >= 5.5 && version < 7 ) png_fix();" /></td> </tr> </table> </form> <?php }
function serviceGetWallPost($aEvent) { $aOwner = db_assoc_arr("SELECT `ID` AS `id`, `NickName` AS `username` FROM `Profiles` WHERE `ID`='" . (int) $aEvent['owner_id'] . "' LIMIT 1"); $aMusic = $this->serviceGetMusicArray($aEvent['object_id'], 'browse'); if (empty($aOwner) || empty($aMusic)) { return ""; } $sCss = ""; if ($aEvent['js_mode']) { $sCss = $this->oModule->_oTemplate->addCss('wall_post.css', true); } else { $this->oModule->_oTemplate->addCss('wall_post.css'); } $sAddedNewTxt = _t('_bx_sounds_wall_added_new'); if (!$this->oModule->oAlbumPrivacy->check('album_view', $aMusic['album_id'], $this->oModule->_iProfileId)) { $sMusicTxt = _t('_bx_sounds_wall_music_private'); $aOut = array('title' => $aOwner['username'] . ' ' . $sAddedNewTxt . ' ' . $sMusicTxt, 'content' => $sCss . $this->oTemplate->parseHtmlByName('wall_post_private.html', array('cpt_user_name' => $aOwner['username'], 'cpt_added_new' => $sAddedNewTxt . ' ' . $sMusicTxt, 'post_id' => $aEvent['id']))); } else { $sMusicTxt = _t('_bx_sounds_wall_music'); $aOut = array('title' => $aOwner['username'] . ' ' . $sAddedNewTxt . ' ' . $sMusicTxt, 'description' => $aMusic['description'], 'content' => $sCss . $this->oTemplate->parseHtmlByName('wall_post.html', array('cpt_user_name' => $aOwner['username'], 'cpt_added_new' => $sAddedNewTxt, 'cpt_music_url' => $aMusic['url'], 'cpt_music' => $sMusicTxt, 'cnt_player' => $this->_getSharedThumb($aEvent['object_id'], $aMusic['url']), 'post_id' => $aEvent['id']))); } return $aOut; }
function getParamDesc($param_name) { if (!($line = db_assoc_arr("SELECT `desc` FROM `GlParams` WHERE `Name` = '{$param_name}'"))) { return false; } return $line['desc']; }
function deleteGroupImage($iGroupID, $img) { $iGroupID = (int) $iGroupID; $img = (int) $img; if ($iGroupID and $img) { $arrImg = db_assoc_arr("SELECT * FROM `GroupsGallery` WHERE `groupID`='{$iGroupID}' AND `ID`='{$img}'"); if ($arrImg['ID'] == $img) { db_res("DELETE FROM `GroupsGallery` WHERE `ID`='{$img}' AND `groupID`='{$iGroupID}'"); unlink($this->sGrpGalPath . "{$iGroupID}_{$img}_{$arrImg['seed']}_.{$arrImg['ext']}"); unlink($this->sGrpGalPath . "{$iGroupID}_{$img}_{$arrImg['seed']}.{$arrImg['ext']}"); } } }
function getProfileInfo($iMemberID) { return db_assoc_arr("SELECT * FROM `Profiles` WHERE `ID` = " . (int) $iMemberID); }
// Check if administrator is logged in. If not display login form. $logged['admin'] = member_auth(1, true, true); if (bx_get('action') !== false) { switch (bx_get('action')) { case 'edit_form': $id = (int) bx_get('id'); if ($id < 1000) { $aItem = db_assoc_arr("SELECT * FROM `sys_menu_admin` WHERE `id` = '{$id}'", 0); if ($aItem) { echo showEditFormCustom($aItem); } else { echo echoMenuEditMsg(_t('_Error'), 'red'); } } else { $id = $id - 1000; $aItem = db_assoc_arr("SELECT * FROM `sys_menu_admin` WHERE `id` = '{$id}' AND `parent_id`='0'", 0); if ($aItem) { echo showEditFormTop($aItem); } else { echo echoMenuEditMsg(_t('_Error'), 'red'); } } exit; case 'create_item': $newID = createNewElement($_POST['type'], (int) $_POST['source']); echo $newID; exit; case 'deactivate_item': $id = (int) bx_get('id'); if ($id > 1000) { $id = $id - 1000;
<?php if ($_REQUEST['action']) { switch ($_REQUEST['action']) { case 'edit_form': $id = (int) $_REQUEST['id']; $aItem = db_assoc_arr("SELECT * FROM `{$sTableName}` WHERE `ID` = {$id}", 0); if ($aItem) { $aItem['Deletable'] = false; if ($aItem['Func'] == 'Echo') { $aItem['Deletable'] = true; } else { $iTypeNum = (int) db_value("SELECT COUNT( * ) FROM `{$sTableName}` WHERE `Func` = '{$aItem['Func']}'"); if ($iTypeNum > 1) { $aItem['Deletable'] = true; } } showEditForm($aItem); } else { echoMenuEditMsg('Error', 'red'); } exit; case 'create_item': $newID = createNewElement((int) $_GET['source']); echo $newID; exit; case 'deactivate_item': echo "OK"; //moved it to Col 0 exit; case 'save_item':
function deleteItem($iItemID) { $this->genSaveItemHeader(); $aItem = db_assoc_arr("SELECT * FROM `ProfileFields` WHERE `ID` = {$iItemID}"); if (!$aItem) { $this->genSaveItemError('Warning! Item not found.'); } elseif ($aItem['Type'] == 'system' or !(int) $aItem['Deletable']) { $this->genSaveItemError('The field cannot be deleted.'); } else { $sQuery = "DELETE FROM `ProfileFields` WHERE `ID` = {$iItemID}"; db_res($sQuery); if ($aItem['Type'] == 'block') { db_res("DELETE FROM `PageCompose` WHERE `Func` = 'PFBlock' AND `Content` = '{$iItemID}'"); } else { db_res("ALTER TABLE `Profiles` DROP `{$aItem['Name']}`"); } $this->genSaveItemFormUpdate('deleteItem', $iItemID); //$this -> genSaveItemFormClose(); } $this->genSaveItemFooter(); }
function getPageInfo($iID) { return db_assoc_arr("SELECT * FROM `ml_clonetwo_main` WHERE `id` = " . (int) $iID); }
function deleteGroupImage($groupID, $img) { $groupID = (int) $groupID; $img = (int) $img; if ($groupID and $img) { $arrImg = db_assoc_arr("SELECT * FROM `GroupsGallery` WHERE `groupID`={$groupID} AND `ID`={$img}"); if ($arrImg['ID'] == $img) { db_res("DELETE FROM `GroupsGallery` WHERE `ID`={$img} AND `groupID`={$groupID}"); unlink(BX_DIRECTORY_PATH_GROUPS_GALLERY . "{$groupID}_{$img}_{$arrImg['seed']}_.{$arrImg['ext']}"); unlink(BX_DIRECTORY_PATH_GROUPS_GALLERY . "{$groupID}_{$img}_{$arrImg['seed']}.{$arrImg['ext']}"); } } }
function serviceGetWallPost($aEvent) { $sAddedNewTxt = _t('_bx_ads_wall_added_new'); $sPostTxt = _t('_bx_ads_wall_photo'); $iObjectID = (int) $aEvent['object_id']; $aOwner = db_assoc_arr("SELECT `ID` AS `id`, `NickName` AS `username` FROM `Profiles` WHERE `ID`='" . (int) $aEvent['owner_id'] . "' LIMIT 1"); $sTitle = $aOwner['username'] . ' ' . $sAddedNewTxt . ' ' . $sPostTxt; $aPostInfo = $this->_oDb->getAdInfo($iObjectID); $sCaption = $aPostInfo['Subject']; $sEntryUrl = $this->genUrl($iObjectID, $aPostInfo['EntryUri'], 'entry'); $sCss = ''; if ($aEvent['js_mode']) { $sCss = $this->_oTemplate->addCss('wall_post.css', true); } else { $this->_oTemplate->addCss('wall_post.css'); } $aVars = array('cpt_user_name' => $aOwner['username'], 'cpt_added_new' => $sAddedNewTxt, 'cpt_object' => $sPostTxt, 'cpt_item_url' => $sEntryUrl, 'post_id' => $aEvent['id']); return array('title' => $sTitle, 'description' => $sTitle, 'content' => $sCss . $this->_oTemplate->parseHtmlByName('wall_post.html', $aVars)); }
/** * Put to friends list * * @param $iProfileId integer * @param $iMemberId integer * @return text - html presentation data */ function PageListFriend($iProfileId, $iMemberId = 0) { $sOutputCode = ''; $iProfileId = (int) $iProfileId; $iMemberId = (int) $iMemberId; if (!$iMemberId || !getProfileInfo($iMemberId)) { return MsgBox(_t('_Failed to apply changes')); } // block members if (isBlocked($iMemberId, $iProfileId)) { return MsgBox(_t('_You have blocked by this profile')); } //check friends pair $aFriendsInfo = db_assoc_arr("SELECT * FROM `sys_friend_list`\n WHERE (`ID`='{$iProfileId}' AND `Profile`='{$iMemberId}')\n OR (`ID`='{$iMemberId}' AND `Profile` = '{$iProfileId}')"); //-- process friend request --// if ($aFriendsInfo) { if (isset($aFriendsInfo['Check']) && $aFriendsInfo['Check'] == 1) { $sOutputCode = MsgBox(_t('_already_in_friend_list')); } else { if (isset($aFriendsInfo['ID'], $aFriendsInfo['Check'])) { if ($iProfileId == $aFriendsInfo['ID'] && $aFriendsInfo['Check'] == 0) { $sOutputCode = MsgBox(_t('_pending_friend_request')); } else { //make paier as friends $sQuery = "UPDATE `sys_friend_list` SET `Check` = '1'\n WHERE `ID` = '{$iMemberId}' AND `Profile` = '{$iProfileId}';"; if (db_res($sQuery, 0)) { $sOutputCode = MsgBox(_t('_User was added to friend list')); //send system alert bx_import('BxDolAlerts'); $oZ = new BxDolAlerts('friend', 'accept', $iMemberId, $iProfileId); $oZ->alert(); } else { $sOutputCode = MsgBox(_t('_Failed to apply changes')); } } } else { $sOutputCode = MsgBox(_t('_Failed to apply changes')); } } } else { //create new friends request $sQuery = "INSERT INTO `sys_friend_list` SET\n `ID` = '{$iProfileId}', `Profile` = '{$iMemberId}', `Check` = '0'"; if (db_res($sQuery, 0)) { $sOutputCode = MsgBox(_t('_User was invited to friend list')); //send system alert bx_import('BxDolAlerts'); $oZ = new BxDolAlerts('friend', 'request', $iMemberId, $iProfileId); $oZ->alert(); // send email notification $oEmailTemplate = new BxDolEmailTemplates(); $aTemplate = $oEmailTemplate->getTemplate('t_FriendRequest', $iMemberId); $aRecipient = getProfileInfo($iMemberId); $aPlus = array('Recipient' => getNickName($aRecipient['ID']), 'SenderLink' => getProfileLink($iProfileId), 'Sender' => getNickName($iProfileId), 'RequestLink' => BX_DOL_URL_ROOT . 'communicator.php?communicator_mode=friends_requests'); sendMail($aRecipient['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus); } else { $sOutputCode = MsgBox(_t('_Failed to apply changes')); } } //-- return $sOutputCode; }
$_page['header'] = 'Admin Menu Builder'; $_page['css_name'] = 'menu_compose.css'; if ($_REQUEST['action']) { switch ($_REQUEST['action']) { case 'edit_form': $id = (int) $_REQUEST['id']; if ($id < 1000) { $aItem = db_assoc_arr("SELECT * FROM `AdminMenu` WHERE `ID` = {$id}", 0); if ($aItem) { showEditFormCustom($aItem); } else { echoMenuEditMsg('Error', 'red'); } } else { $id = $id - 1000; $aItem = db_assoc_arr("SELECT * FROM `AdminMenuCateg` WHERE `ID` = {$id}", 0); if ($aItem) { showEditFormTop($aItem); } else { echoMenuEditMsg('Error', 'red'); } } exit; case 'create_item': $newID = createNewElement($_GET['type'], (int) $_GET['source']); echo $newID; exit; case 'deactivate_item': $id = (int) $_GET['id']; if ($id > 1000) { $id = $id - 1000;
function getWallPostOutline($aEvent, $sIcon, $aParams = array()) { $sPrefix = $this->_oConfig->getMainPrefix(); $sPrefixAlbum = $sPrefix . '_albums'; $aOwner = db_assoc_arr("SELECT `ID` AS `id`, `NickName` AS `username` FROM `Profiles` WHERE `ID`='" . (int) $aEvent['owner_id'] . "' LIMIT 1"); $aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',', $aEvent['object_id']) : array($aEvent['object_id']); rsort($aObjectIds); $iItems = count($aObjectIds); $iItemsLimit = isset($aParams['grouped']['items_limit']) ? (int) $aParams['grouped']['items_limit'] : 3; if ($iItems > $iItemsLimit) { $aObjectIds = array_slice($aObjectIds, 0, $iItemsLimit); } $bSave = false; $aContent = array(); if (!empty($aEvent['content'])) { $aContent = unserialize($aEvent['content']); } if (!isset($aContent['idims'])) { $aContent['idims'] = array(); } $sClassName = $this->_oConfig->getClassPrefix() . 'Search'; bx_import('Search', $this->_aModule); $oSearch = new $sClassName(); $iDeleted = 0; $aItems = $aTmplItems = array(); foreach ($aObjectIds as $iId) { $aItem = $oSearch->serviceGetItemArray($iId, 'browse'); if (empty($aItem)) { $iDeleted++; } else { if ($aItem['status'] == 'approved' && $this->oAlbumPrivacy->check('album_view', $aItem['album_id'], $this->oModule->_iProfileId)) { if (!isset($aContent['idims'][$iId])) { $sPath = isset($aItem['file_path']) && file_exists($aItem['file_path']) ? $aItem['file_path'] : $aItem['file']; $aContent['idims'][$iId] = BxDolImageResize::instance()->getImageSize($sPath); $bSave = true; } $aItem['dims'] = $aContent['idims'][$iId]; $aItems[] = $aItem; $aTmplItems[] = array('mod_prefix' => $sPrefix, 'item_width' => $aItem['dims']['w'], 'item_height' => $aItem['dims']['h'], 'item_icon' => $aItem['file'], 'item_page' => $aItem['url'], 'item_title' => $aItem['title']); } } } if ($iDeleted == count($aObjectIds)) { return array('perform_delete' => true); } if (empty($aOwner) || empty($aItems)) { return ""; } $aResult = array(); if ($bSave) { $aResult['save']['content'] = serialize($aContent); } $sCss = ""; if ($aEvent['js_mode']) { $sCss = $this->_oTemplate->addCss('wall_outline.css', true); } else { $this->_oTemplate->addCss('wall_outline.css'); } $iOwner = (int) $aEvent['owner_id']; $sOwner = getNickName($iOwner); $sOwnerLink = getProfileLink($iOwner); //--- Grouped events $iItems = count($aItems); if ($iItems > 1) { $aExtra = unserialize($aEvent['content']); $sAlbumUri = $aExtra['album']; $oAlbum = new BxDolAlbums($sPrefix); $aAlbumInfo = $oAlbum->getAlbumInfo(array('fileUri' => $sAlbumUri, 'owner' => $iOwner)); $oAlbumCmts = new BxTemplCmtsView($sPrefixAlbum, $aAlbumInfo['ID']); $aAlbumInfo['comments_count'] = (int) $oAlbumCmts->getObjectCommentsCount(); $aAlbumInfo['Url'] = $oSearch->getCurrentUrl('album', $aAlbumInfo['ID'], $aAlbumInfo['Uri']) . '/owner/' . getUsername($iOwner); $sTmplName = isset($aParams['templates']['grouped']) ? $aParams['templates']['grouped'] : 'modules/boonex/wall/|outline_item_image_grouped.html'; $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array('mod_prefix' => $sPrefix, 'mod_icon' => $sIcon, 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'bx_repeat:items' => $aTmplItems, 'album_url' => $aAlbumInfo['Url'], 'album_title' => $aAlbumInfo['Caption'], 'album_description' => strmaxtextlen($aAlbumInfo['Description'], 200), 'album_comments' => (int) $aAlbumInfo['comments_count'] > 0 ? _t('_wall_n_comments', $aAlbumInfo['comments_count']) : _t('_wall_no_comments'), 'album_comments_link' => $aAlbumInfo['Url'] . '#cmta-' . $sPrefixAlbum . '-' . $aAlbumInfo['ID'], 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago'])); return $aResult; } //--- Single public event $aItem = $aItems[0]; $aTmplItem = $aTmplItems[0]; $sTmplName = isset($aParams['templates']['single']) ? $aParams['templates']['single'] : 'modules/boonex/wall/|outline_item_image.html'; $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array_merge($aTmplItem, array('mod_prefix' => $sPrefix, 'mod_icon' => $sIcon, 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'item_page' => $aItem['url'], 'item_title' => $aItem['title'], 'item_description' => strmaxtextlen($aItem['description'], 200), 'item_comments' => (int) $aItem['comments_count'] > 0 ? _t('_wall_n_comments', $aItem['comments_count']) : _t('_wall_no_comments'), 'item_comments_link' => $aItem['url'] . '#cmta-' . $sPrefix . '-' . $aItem['id'], 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago']))); return $aResult; }
function _serviceGetWallPostOutline($aEvent, $sIcon, $aParams = array()) { $iNoPhotoWidth = $iNoPhotoHeight = 140; $sNoPhoto = $this->_oTemplate->getImageUrl('no-image-thumb.png'); $sBaseUrl = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/'; $aOwner = db_assoc_arr("SELECT `ID` AS `id`, `NickName` AS `username` FROM `Profiles` WHERE `ID`='" . (int) $aEvent['owner_id'] . "' LIMIT 1"); $aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',', $aEvent['object_id']) : array($aEvent['object_id']); rsort($aObjectIds); $iItems = count($aObjectIds); $iItemsLimit = isset($aParams['grouped']['items_limit']) ? (int) $aParams['grouped']['items_limit'] : 3; if ($iItems > $iItemsLimit) { $aObjectIds = array_slice($aObjectIds, 0, $iItemsLimit); } $bSave = false; $aContent = array(); if (!empty($aEvent['content'])) { $aContent = unserialize($aEvent['content']); } if (!isset($aContent['idims'])) { $aContent['idims'] = array(); } $iDeleted = 0; $aItems = $aTmplItems = array(); foreach ($aObjectIds as $iId) { $aItem = $this->_oDb->getEntryByIdAndOwner($iId, $aEvent['owner_id'], 1); if (empty($aItem)) { $iDeleted++; } else { if ($aItem[$this->_oDb->_sFieldStatus] == 'approved' && $aParams['obj_privacy']->check($aParams['txt_privacy_view_event'], $iId, $this->_iProfileId)) { $aItem['thumb_file'] = ''; $aItem['thumb_dims'] = array(); if ($aItem[$this->_oDb->_sFieldThumb]) { $aImage = BxDolService::call('photos', 'get_entry', array($aItem[$this->_oDb->_sFieldThumb], 'browse'), 'Search'); if (!empty($aImage)) { if (!isset($aContent['idims'][$iId])) { $sPath = isset($aImage['file_path']) && file_exists($aImage['file_path']) ? $aImage['file_path'] : $aImage['file']; $aContent['idims'][$iId] = BxDolImageResize::instance()->getImageSize($sPath); $bSave = true; } $aItem['thumb_file'] = $aImage['file']; $aItem['thumb_dims'] = $aContent['idims'][$iId]; } } $aItem[$this->_oDb->_sFieldUri] = $sBaseUrl . $aItem[$this->_oDb->_sFieldUri]; $aItems[] = $aItem; $aTmplItems[] = array('mod_prefix' => $this->_sPrefix, 'item_width' => isset($aItem['thumb_dims']['w']) ? $aItem['thumb_dims']['w'] : $iNoPhotoWidth, 'item_height' => isset($aItem['thumb_dims']['h']) ? $aItem['thumb_dims']['h'] : $iNoPhotoHeight, 'item_icon' => !empty($aItem['thumb_file']) ? $aItem['thumb_file'] : $sNoPhoto, 'item_page' => $aItem[$this->_oDb->_sFieldUri], 'item_title' => $aItem[$this->_oDb->_sFieldTitle]); } } } if ($iDeleted == count($aObjectIds)) { return array('perform_delete' => true); } if (empty($aOwner) || empty($aItems)) { return ""; } $aResult = array(); if ($bSave) { $aResult['save']['content'] = serialize($aContent); } $sCss = ""; if ($aEvent['js_mode']) { $sCss = $this->_oTemplate->addCss('wall_outline.css', true); } else { $this->_oTemplate->addCss('wall_outline.css'); } $iOwner = (int) $aEvent['owner_id']; $sOwner = getNickName($iOwner); $sOwnerLink = getProfileLink($iOwner); //--- Grouped events $iItems = count($aItems); if ($iItems > 1) { $sTmplName = isset($aParams['templates']['grouped']) ? $aParams['templates']['grouped'] : 'modules/boonex/wall/|outline_item_image_grouped'; $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array('mod_prefix' => $this->_sPrefix, 'mod_icon' => $sIcon, 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'bx_repeat:items' => $aTmplItems, 'album_url' => '', 'album_title' => '', 'album_description' => '', 'album_comments' => 0 ? _t('_wall_n_comments', 0) : _t('_wall_no_comments'), 'album_comments_link' => '', 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago'])); return $aResult; } //--- Single public event $aItem = $aItems[0]; $aTmplItem = $aTmplItems[0]; $sTmplName = isset($aParams['templates']['single']) ? $aParams['templates']['single'] : 'modules/boonex/wall/|outline_item_image'; $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array_merge($aTmplItem, array('mod_prefix' => $this->_sPrefix, 'mod_icon' => $sIcon, 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'item_page' => $aItem[$this->_oDb->_sFieldUri], 'item_title' => $aItem[$this->_oDb->_sFieldTitle], 'item_description' => $this->_formatSnippetTextForOutline($aItem), 'item_comments' => (int) $aItem[$this->_oDb->_sFieldCommentCount] > 0 ? _t('_wall_n_comments', $aItem[$this->_oDb->_sFieldCommentCount]) : _t('_wall_no_comments'), 'item_comments_link' => $aItem[$this->_oDb->_sFieldUri] . '#cmta-' . $this->_sPrefix . '-' . $aItem[$this->_oDb->_sFieldId], 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago']))); return $aResult; }
function createUserDataFile($userID) { global $dir, $date_format, $aUser; $userID = (int) $userID; $fileName = $dir['cache'] . 'user' . $userID . '.php'; if ($userID > 0) { $userQuery = "\r\n\t\t\tSELECT\r\n\t\t\t\t\t*,\r\n\t\t\t\t\tDATE_FORMAT(`LastLoggedIn`, '{$date_format}' ) AS `LastLoggedIn`,\r\n\t\t\t\t\tDATE_FORMAT(`LastModified`, '{$date_format}' ) AS `LastModified`\r\n\t\t\tFROM\r\n\t\t\t\t\t`Profiles`\r\n\t\t\tWHERE `ID` = '{$userID}' LIMIT 1\r\n\t\t"; $aPreUser = db_assoc_arr($userQuery); if (isset($aPreUser) and is_array($aPreUser)) { $sUser = '******'; $sUser .= "\n\n"; $sUser .= '$aUser[' . $userID . '] = array();'; $sUser .= "\n"; $sUser .= '$aUser[' . $userID . '][\'datafile\'] = true;'; $sUser .= "\n"; $replaceWhat = array('\\', '\''); $replaceTo = array('\\\\', '\\\''); foreach ($aPreUser as $key => $value) { $sUser .= '$aUser[' . $userID . '][\'' . $key . '\']' . ' = ' . '\'' . str_replace($replaceWhat, $replaceTo, $value) . '\'' . ";\n"; } $sUser .= "\n" . '?>'; if ($file = fopen($fileName, "w")) { fwrite($file, $sUser); fclose($file); @chmod($fileName, 0666); @(include $fileName); return true; } else { return false; } } } else { return false; } }
require_once '../inc/header.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'languages.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'menu.inc.php'; // Check if administrator is logged in. If not display login form. $logged['admin'] = member_auth(1); $_page['header'] = 'Menu Builder'; $_page['css_name'] = 'menu_compose.css'; if ($_REQUEST['action']) { switch ($_REQUEST['action']) { case 'edit_form': $id = (int) $_REQUEST['id']; $aItem = db_assoc_arr("SELECT * FROM `TopMenu` WHERE `ID` = {$id}", 0); if ($aItem) { showEditForm($aItem); } else { echoMenuEditMsg('Error', 'red'); } exit; case 'create_item': $newID = createNewElement($_GET['type'], (int) $_GET['source']); echo $newID; exit; case 'deactivate_item': $res = db_res("UPDATE `TopMenu` SET `Active`=0 WHERE `ID`=" . (int) $_GET['id']); echo mysql_affected_rows(); compileMenus(); exit;
function serviceGetWallPostOutline($aEvent) { $sIcon = 'link'; $sBaseUrl = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/'; $aOwner = db_assoc_arr("SELECT `ID` AS `id`, `NickName` AS `username` FROM `Profiles` WHERE `ID`='" . (int) $aEvent['owner_id'] . "' LIMIT 1"); $aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',', $aEvent['object_id']) : array($aEvent['object_id']); rsort($aObjectIds); $iItems = count($aObjectIds); $iItemsLimit = 3; if ($iItems > $iItemsLimit) { $aObjectIds = array_slice($aObjectIds, 0, $iItemsLimit); } $aContent = array(); if (!empty($aEvent['content'])) { $aContent = unserialize($aEvent['content']); } $iDeleted = 0; $aItems = $aTmplItems = array(); foreach ($aObjectIds as $iId) { $aItem = $this->_oDb->getSiteById($iId); if (empty($aItem)) { $iDeleted++; } else { if ($aItem['status'] == 'approved' && $this->oPrivacy->check('view', $aItem['id'], $this->iOwnerId)) { $aItem['thumb_file'] = ''; if ($aItem[$this->_oDb->_sFieldThumb]) { $aImage = BxDolService::call('photos', 'get_entry', array($aItem[$this->_oDb->_sFieldThumb], 'browse'), 'Search'); $aItem['thumb_file'] = $aImage['no_image'] || empty($aImage) ? '' : $aImage['file']; } $aItem[$this->_oDb->_sFieldUri] = $sBaseUrl . $aItem[$this->_oDb->_sFieldUri]; $aItem['url'] = strncasecmp($aItem['url'], 'http://', 7) != 0 && strncasecmp($aItem['url'], 'https://', 8) != 0 ? 'http://' . $aItem['url'] : $aItem['url']; $aItems[] = $aItem; // BEGIN STW INTEGRATION if ($aItem['thumb_file'] == '' && getParam('bx_sites_account_type') != 'No Automated Screenshots') { bx_sites_import('STW'); $sThumbHTML = getThumbnailHTML($aItem['url'], array()); } // END STW INTEGRATION $aTmplItems[] = array('mod_prefix' => $this->_sPrefix, 'item_title' => $aItem[$this->_oDb->_sFieldTitle], 'bx_if:is_image' => array('condition' => $sThumbHTML == false, 'content' => array('item_page' => $aItem[$this->_oDb->_sFieldUri], 'image' => $aImage['file'] ? $aImage['file'] : $this->_oTemplate->getImageUrl('no-image-thumb.png'))), 'bx_if:is_thumbhtml' => array('condition' => $sThumbHTML != '', 'content' => array('item_page' => $aItem[$this->_oDb->_sFieldUri], 'thumbhtml' => $sThumbHTML))); } } } if ($iDeleted == count($aObjectIds)) { return array('perform_delete' => true); } if (empty($aOwner) || empty($aItems)) { return ""; } $sCss = ''; if ($aEvent['js_mode']) { $sCss = $this->_oTemplate->addCss(array('wall_outline.css'), true); } else { $this->_oTemplate->addCss(array('wall_outline.css')); } $aResult = array(); $iOwner = (int) $aEvent['owner_id']; $sOwner = getNickName($iOwner); $sOwnerLink = getProfileLink($iOwner); //--- Grouped events $iItems = count($aItems); if ($iItems > 1) { $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName('wall_outline_grouped.html', array('mod_prefix' => $this->_sPrefix, 'mod_icon' => $sIcon, 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'bx_repeat:items' => $aTmplItems, 'album_url' => '', 'album_title' => '', 'album_description' => '', 'album_comments' => 0 ? _t('_wall_n_comments', 0) : _t('_wall_no_comments'), 'album_comments_link' => '', 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago'])); return $aResult; } //--- Single public event $aItem = $aItems[0]; $aTmplItem = $aTmplItems[0]; $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName('wall_outline.html', array_merge($aTmplItem, array('mod_prefix' => $this->_sPrefix, 'mod_icon' => $sIcon, 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'item_page' => $aItem[$this->_oDb->_sFieldUri], 'item_title' => $aItem[$this->_oDb->_sFieldTitle], 'item_description' => $this->_formatSnippetText($aItem, 200), 'item_site_url' => $aItem['url'], 'item_site_url_title' => $this->_oTemplate->_getDomain($aItem['url']), 'item_comments' => (int) $aItem['commentsCount'] > 0 ? _t('_wall_n_comments', $aItem['commentsCount']) : _t('_wall_no_comments'), 'item_comments_link' => $aItem[$this->_oDb->_sFieldUri] . '#cmta-' . $this->_sPrefix . '-' . $aItem['id'], 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago']))); return $aResult; }
function TopCodeAdmin($extraCodeInBody = '') { global $dir; global $site; global $_page; global $en_sdating; global $logged; global $dir_dir; global $sdating_dir; global $sRayHomeDir; if ($logged['admin']) { $logo_alt = 'Admin'; $user = '******'; } elseif ($logged['aff']) { $logo_alt = 'Affiliate'; $user = '******'; } elseif ($logged['moderator']) { $logo_alt = 'Moderator'; $user = '******'; } $selfCateg = 0; $selfCategIcon = ''; $self = basename($_SERVER['PHP_SELF']); if ($self != 'index.php') { $aSelfCateg = db_assoc_arr("\r\n\t\t\tSELECT\r\n\t\t\t\t`Categ`,\r\n\t\t\t\t`AdminMenuCateg`.`Icon`\r\n\t\t\tFROM `AdminMenu`\r\n\t\t\tLEFT JOIN `AdminMenuCateg` ON\r\n\t\t\t\t`AdminMenuCateg`.`ID` = `AdminMenu`.`Categ`\r\n\t\t\tWHERE\r\n\t\t\t\tRIGHT(`Url`, " . strlen($self) . ")='{$self}' AND\r\n\t\t\t\t`User`='{$user}'\r\n\t\t\t"); $selfCateg = (int) $aSelfCateg['Categ']; $selfCategIcon = $aSelfCateg['Icon']; } else { $admin_categ = (int) $_GET['admin_categ']; if ($admin_categ) { $aSelfCateg = db_assoc_arr("\r\n\t\t\t\tSELECT\r\n\t\t\t\t\t`ID`,\r\n\t\t\t\t\t`Title`,\r\n\t\t\t\t\t`Icon`\r\n\t\t\t\tFROM `AdminMenuCateg`\r\n\t\t\t\tWHERE\r\n\t\t\t\t\t`ID`={$admin_categ} AND\r\n\t\t\t\t\t`User`='{$user}'\r\n\t\t\t\t"); if ($aSelfCateg) { $selfCateg = (int) $aSelfCateg['ID']; $selfCategIcon = $aSelfCateg['Icon']; $_page['header'] = $aSelfCateg['Title']; } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <title>Admin panel: <?php echo $_page['header']; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="<?php echo $site['plugins']; ?> calendar/calendar_themes/aqua.css" type="text/css" /> <link href="<?php echo $site['url_admin']; ?> styles/general.css" rel="stylesheet" type="text/css" /> <?php if (strlen($_page['css_name']) and file_exists("{$dir['root']}admin/styles/{$_page['css_name']}")) { ?> <link href="styles/<?php echo $_page['css_name']; ?> " rel="stylesheet" type="text/css" /> <link href="styles/<?php echo $_page['css_name2']; ?> " rel="stylesheet" type="text/css" /> <?php } ?> <script type="text/javascript" language="javascript">var sRayUrl = '<?php echo $site['url'] . $sRayHomeDir; ?> ';</script> <script src="../ray/modules/global/js/integration.js" type="text/javascript" language="javascript"></script> <script src="../inc/js/functions.js" type="text/javascript" language="javascript"></script> <!--[if lt IE 7.]> <script defer type="text/javascript"> var site_url = '<?php echo $site['url']; ?> '; </script> <script defer type="text/javascript" src="../inc/js/pngfix.js"></script> <![endif]--> <?php if (strlen($_page['js_name'])) { echo <<<EOJ <script type="text/javascript"> <!-- \tvar site_url = '{$site['url']}'; \tvar lang_delete = 'delete'; \tvar lang_loading = 'loading ...'; \tvar lang_delete_message = 'Poll successfully deleted'; \tvar lang_make_it = 'make it'; --> </script> <script src="{$site['url']}inc/js/{$_page['js_name']}" type="text/javascript" language="javascript"></script> EOJ; } ?> <?php echo $_page['extraCodeInHead']; ?> </head> <body id="admin_cont"> <div id="FloatDesc"></div> <?php echo $_page['extraCodeInBody']; ?> <?php echo $extraCodeInBody; ?> <?php if ($logged['admin'] || $logged['aff'] || $logged['moderator']) { ?> <div class="top_header"> <img src="<?php echo $site['url_admin']; ?> images/top_dol_logo.png" class="top_logo" /> <div class="top_head_title"> <span class="head_blue"> <span class="title_bold">Dolphin</span> <?php echo $logo_alt; ?> - </span> <?php echo $site['title']; ?> </div> <div class="boonex_link"> <a href="http://www.boonex.com/" title="BoonEx - Community Software Experts"> <img src="<?php echo $site['url_admin']; ?> images/boonex.png" alt="BoonEx - Community Software Experts" /> </a> </div> </div> <div class="middle_wrapper"> <div class="clear_both"></div> <div class="right_menu_wrapper"> <div class="clear_both"></div> <?php echo getAdminMenu(); ?> <div class="clear_both"></div> <div style="text-align:center; margin:20px;"> <a href="http://www.expertzzz.com/" title="Experzzz - Community Software Support"> <img src="<?php echo $site['url_admin']; ?> images/expertzzz.gif" alt="Expertzzz - Community Software Support" /> </a> </div> </div> <div class="main_cont" id="main_cont" <?php echo $selfCategIcon ? "style=\"background-image:url({$site['url_admin']}images/icons/{$selfCategIcon});\"" : ''; ?> > <div class="page_header"><?php echo $_page['header']; ?> </div> <div class="page_cont"> <?php } }
if (isset($_GET['menu_position'])) { foreach ($aMenuSection as $sValue => $a) { if ($sValue == $_GET['menu_position']) { $sMenuSection = $sValue; break; } } } $aMenuSection[$sMenuSection]['active'] = 1; // ** FOR 'AJAX' REQUESTS ; if (bx_get('action') !== false) { switch (bx_get('action')) { case 'edit_form': $id = (int) bx_get('id'); header('Content-Type: text/html; charset=utf-8'); $aItem = db_assoc_arr("SELECT * FROM `sys_menu_member` WHERE `ID` = {$id}", 0); $sResponce = $aItem ? showEditForm($aItem, $sMenuSection) : echoMenuEditMsg('Error', 'red'); break; case 'create_item': $newID = createNewElement($_POST['type'], (int) $_POST['source'], $sMenuSection); $sResponce = $newID; break; case 'deactivate_item': $res = db_res("UPDATE `sys_menu_member` SET `Active`='0' WHERE `ID`=" . (int) bx_get('id')); $sResponce = db_affected_rows(); break; case 'save_item': $id = (int) $_POST['id']; if (!$id) { $sResponce = echoMenuEditMsg('Error', 'red'); } else {
function showPropForm($iBlockID) { $sNoPropertiesC = _t('_adm_pbuilder_This_block_has_no_properties'); $sProfileFieldsC = _t('_adm_pbuilder_Profile_Fields'); $sHtmlBlockC = _t('_adm_pbuilder_HTML_Block'); $sXmlBlockC = _t('_adm_pbuilder_XML_Block'); $sRssBlockC = _t('_adm_pbuilder_RSS_Feed'); $sSpecialBlockC = _t('_adm_pbuilder_Special_Block'); $sXmlPathC = _t('_adm_pbuilder_XML_path'); $sUrlRssFeedC = _t('_adm_pbuilder_Url_of_RSS_feed'); $sNumbRssItemsC = _t('_adm_pbuilder_Number_RSS_items'); $sTypeC = _t('_Type'); $sDescriptionC = _t('_Description'); $sCaptionLangKeyC = _t('_adm_pbuilder_Caption_Lang_Key'); $sDesignBoxLangKeyC = _t('_adm_pbuilder_DesignBox_Lang_Key'); $sVisibleForC = _t('_adm_mbuilder_Visible_for'); $sGuestC = _t('_Guest'); $sMemberC = _t('_Member'); $sQuery = "SELECT * FROM `{$this->sDBTable}` WHERE `Page` = '{$this->sPage_db}' AND `ID` = {$iBlockID}"; $aItem = db_assoc_arr($sQuery); if (!$aItem) { return MsgBox($sNoPropertiesC); } $sPageName = htmlspecialchars($this->oPage->sName); $sBlockType = ''; switch ($aItem['Func']) { case 'PFBlock': $sBlockType = $sProfileFieldsC; break; case 'Echo': $sBlockType = $sHtmlBlockC; break; case 'XML': $sBlockType = $sXmlBlockC; break; case 'RSS': $sBlockType = $sRssBlockC; break; default: $sBlockType = $sSpecialBlockC; break; } $aVisibleValues = array(); if (strpos($aItem['Visible'], 'non') !== false) { $aVisibleValues[] = 'non'; } if (strpos($aItem['Visible'], 'memb') !== false) { $aVisibleValues[] = 'memb'; } $sDeleteButton = ($aItem['Func'] == 'RSS' or $aItem['Func'] == 'Echo' or $aItem['Func'] == 'XML') ? '<input type="reset" value="Delete" name="Delete" />' : ''; $aForm = array('form_attrs' => array('name' => 'formItemEdit', 'action' => bx_html_attribute($_SERVER['PHP_SELF']), 'method' => 'post'), 'inputs' => array('Page' => array('type' => 'hidden', 'name' => 'Page', 'value' => $sPageName), 'id' => array('type' => 'hidden', 'name' => 'id', 'value' => $iBlockID), 'action' => array('type' => 'hidden', 'name' => 'action', 'value' => 'saveItem'), 'Cache' => array('type' => 'hidden', 'name' => 'Cache', 'value' => (int) $aItem['Cache']), 'header1' => array('type' => 'value', 'name' => 'header1', 'caption' => $sTypeC, 'value' => $sBlockType), 'header2' => array('type' => 'value', 'name' => 'header2', 'caption' => $sDescriptionC, 'value' => $aItem['Desc']), 'Caption' => array('type' => 'text', 'name' => 'Caption', 'caption' => $sCaptionLangKeyC, 'value' => $aItem['Caption'], 'required' => true), 'DesignBox' => array('type' => 'select', 'name' => 'DesignBox', 'caption' => $sDesignBoxLangKeyC, 'value' => $aItem['DesignBox'], 'values' => array(array('key' => 2, 'value' => _t('_adm_pbuilder_DesignBox_2')), array('key' => 0, 'value' => _t('_adm_pbuilder_DesignBox_0')), array('key' => 11, 'value' => _t('_adm_pbuilder_DesignBox_11')), array('key' => 1, 'value' => _t('_adm_pbuilder_DesignBox_1')), array('key' => 13, 'value' => _t('_adm_pbuilder_DesignBox_13')), array('key' => 3, 'value' => _t('_adm_pbuilder_DesignBox_3'))), 'required' => true), 'Visible' => array('type' => 'checkbox_set', 'caption' => $sVisibleForC, 'name' => 'Visible', 'value' => $aVisibleValues, 'values' => array('non' => $sGuestC, 'memb' => $sMemberC)))); $sBlockContent = $aItem['Content']; //$sBlockContent = htmlspecialchars_adv( $aItem['Content'] ); if ($aItem['Func'] == 'Echo') { $sMceEditorKey = 'bx_mce_editor_disabled'; $bMceEditor = !isset($_COOKIE[$sMceEditorKey]) || (int) $_COOKIE[$sMceEditorKey] != 1; $aForm['inputs']['Content'] = array('type' => 'textarea', 'html' => $bMceEditor ? 2 : 0, 'html_toggle' => true, 'dynamic' => true, 'attrs' => array('id' => 'form_input_html' . $iBlockID, 'style' => 'height:250px;'), 'name' => 'Content', 'value' => $sBlockContent, 'colspan' => true); } elseif ($aItem['Func'] == 'XML') { $aExistedApplications = BxDolService::call('open_social', 'get_admin_applications', array()); $aForm['inputs']['Applications'] = array('type' => 'select', 'name' => 'application_id', 'caption' => _t('_osi_Existed_applications'), 'values' => $aExistedApplications); } elseif ($aItem['Func'] == 'RSS') { list($sUrl, $iNum) = explode('#', $aItem['Content']); $iNum = (int) $iNum; $aForm['inputs']['Url'] = array('type' => 'text', 'name' => 'Url', 'caption' => $sUrlRssFeedC, 'value' => $sUrl, 'required' => true); $aForm['inputs']['Num'] = array('type' => 'text', 'name' => 'Num', 'caption' => $sNumbRssItemsC, 'value' => $iNum, 'required' => true); } $aForm['inputs']['controls'] = array('type' => 'input_set', array('type' => 'submit', 'name' => 'Save', 'value' => _t('_Save'))); if ($aItem['Func'] == 'RSS' || $aItem['Func'] == 'Echo' || $aItem['Func'] == 'XML') { $aForm['inputs']['controls'][] = array('type' => 'reset', 'name' => 'Delete', 'value' => _t('_Delete')); } $oZ = new BxDolAlerts('page_builder', 'block_form_display', $iBlockID, 0, array('form' => &$aForm)); $oZ->alert(); $sResult = ''; $oForm = new BxTemplFormView($aForm); $sContent = ''; $sContent .= $this->getCssCode(); $sContent .= $oForm->getCode(); $sContent = $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $sContent)); return $GLOBALS['oFunctions']->popupBox('adm-pbuilder-properties', _t('_adm_pbuilder_Block'), $sContent); }
function showPropForm($iBlockID) { $sNoPropertiesC = _t('_adm_pbuilder_This_block_has_no_properties'); $sProfileFieldsC = _t('_adm_pbuilder_Profile_Fields'); $sHtmlBlockC = _t('_adm_pbuilder_HTML_Block'); $sXmlBlockC = _t('_adm_pbuilder_XML_Block'); $sRssBlockC = _t('_adm_pbuilder_RSS_Feed'); $sSpecialBlockC = _t('_adm_pbuilder_Special_Block'); $sHtmlContentC = _t('_adm_pbuilder_HTML_content'); $sXmlPathC = _t('_adm_pbuilder_XML_path'); $sUrlRssFeedC = _t('_adm_pbuilder_Url_of_RSS_feed'); $sNumbRssItemsC = _t('_adm_pbuilder_Number_RSS_items'); $sTypeC = _t('_Type'); $sDescriptionC = _t('_Description'); $sCaptionLangKeyC = _t('_adm_pbuilder_Caption_Lang_Key'); $sVisibleForC = _t('_adm_mbuilder_Visible_for'); $sGuestC = _t('_Guest'); $sMemberC = _t('_Member'); $sCaptionCacheC = _t('_adm_pbuilder_Caption_Cache'); $sQuery = "SELECT * FROM `{$this->sDBTable}` WHERE `Page` = '{$this->sPage_db}' AND `ID` = {$iBlockID}"; $aItem = db_assoc_arr($sQuery); if (!$aItem) { return MsgBox($sNoPropertiesC); } $sPageName = htmlspecialchars($this->oPage->sName); $sBlockType = ''; switch ($aItem['Func']) { case 'PFBlock': $sBlockType = $sProfileFieldsC; break; case 'Echo': $sBlockType = $sHtmlBlockC; break; case 'XML': $sBlockType = $sXmlBlockC; break; case 'RSS': $sBlockType = $sRssBlockC; break; default: $sBlockType = $sSpecialBlockC; break; } $aVisibleValues = array(); if (strpos($aItem['Visible'], 'non') !== false) { $aVisibleValues[] = 'non'; } if (strpos($aItem['Visible'], 'memb') !== false) { $aVisibleValues[] = 'memb'; } $sDeleteButton = ($aItem['Func'] == 'RSS' or $aItem['Func'] == 'Echo' or $aItem['Func'] == 'XML') ? '<input type="reset" value="Delete" name="Delete" />' : ''; $aForm = array('form_attrs' => array('name' => 'formItemEdit', 'action' => bx_html_attribute($_SERVER['PHP_SELF']), 'method' => 'post'), 'inputs' => array('Page' => array('type' => 'hidden', 'name' => 'Page', 'value' => $sPageName), 'id' => array('type' => 'hidden', 'name' => 'id', 'value' => $iBlockID), 'action' => array('type' => 'hidden', 'name' => 'action', 'value' => 'saveItem'), 'header1' => array('type' => 'block_header', 'caption' => $sTypeC . ': ' . $sBlockType), 'header2' => array('type' => 'block_header', 'caption' => $sDescriptionC . ': ' . $aItem['Desc']), 'Caption' => array('type' => 'text', 'name' => 'Caption', 'caption' => $sCaptionLangKeyC, 'value' => $aItem['Caption'], 'required' => true), 'Visible' => array('type' => 'checkbox_set', 'caption' => $sVisibleForC, 'name' => 'Visible', 'value' => $aVisibleValues, 'values' => array('non' => $sGuestC, 'memb' => $sMemberC)), 'Cache' => array('type' => 'text', 'name' => 'Cache', 'caption' => $sCaptionCacheC, 'value' => (int) $aItem['Cache'], 'required' => false))); $sBlockContent = $aItem['Content']; //$sBlockContent = htmlspecialchars_adv( $aItem['Content'] ); if ($aItem['Func'] == 'Echo') { $aForm['inputs']['Content'] = array('type' => 'textarea', 'html' => false, 'attrs' => array('id' => 'form_input_html' . $iBlockID), 'name' => 'Content', 'value' => $sBlockContent, 'caption' => $sHtmlContentC, 'required' => true, 'colspan' => true); } elseif ($aItem['Func'] == 'XML') { $aExistedApplications = BxDolService::call('open_social', 'get_admin_applications', array()); $aForm['inputs']['Applications'] = array('type' => 'select', 'name' => 'application_id', 'caption' => _t('_osi_Existed_applications'), 'values' => $aExistedApplications); } elseif ($aItem['Func'] == 'RSS') { list($sUrl, $iNum) = explode('#', $aItem['Content']); $iNum = (int) $iNum; $aForm['inputs']['Url'] = array('type' => 'text', 'name' => 'Url', 'caption' => $sUrlRssFeedC, 'value' => $sUrl, 'required' => true); $aForm['inputs']['Num'] = array('type' => 'text', 'name' => 'Num', 'caption' => $sNumbRssItemsC, 'value' => $iNum, 'required' => true); } $aForm['inputs']['Save'] = array('type' => 'submit', 'name' => 'Save', 'caption' => _t('_Save'), 'value' => _t('_Save')); if ($aItem['Func'] == 'RSS' or $aItem['Func'] == 'Echo' or $aItem['Func'] == 'XML') { $aForm['inputs']['Delete'] = array('type' => 'reset', 'name' => 'Delete', 'caption' => 'Delete', 'value' => 'Delete'); } $sResult = ''; $oForm = new BxTemplFormView($aForm); $aVariables = array('caption' => _t('_adm_pbuilder_Block'), 'main_content' => $oForm->getCode(), 'loading' => LoadingBox('adm-pbuilder-loading')); return $GLOBALS['oAdmTemplate']->parseHtmlByName('popup_form_wrapper.html', $aVariables); }
require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'languages.inc.php'; // Check if administrator is logged in. If not display login form. $logged['admin'] = member_auth(1, true, true); $GLOBALS['oAdmTemplate']->addJsTranslation(array('_adm_mbuilder_Sorry_could_not_insert_object', '_adm_mbuilder_This_items_are_non_editable')); bx_import('BxDolMenuService'); $oMenu = new BxDolMenuService(); $sResponce = null; // ** FOR 'AJAX' REQUESTS ; if (bx_get('action') !== false) { switch (bx_get('action')) { case 'edit_form': $id = (int) bx_get('id'); header('Content-Type: text/html; charset=utf-8'); $aItem = db_assoc_arr("SELECT * FROM `" . $oMenu->sDbTable . "` WHERE `ID` = {$id}", 0); $sResponce = $aItem ? showEditForm($aItem) : echoMenuEditMsg('Error', 'red'); break; case 'create_item': $sResponce = createNewElement($_POST['type'], (int) $_POST['source']); break; case 'deactivate_item': $res = db_res("UPDATE `" . $oMenu->sDbTable . "` SET `Active`='0' WHERE `ID`=" . (int) bx_get('id')); $sResponce = db_affected_rows($res); break; case 'save_item': $id = (int) $_POST['id']; if (!$id) { $sResponce = echoMenuEditMsg('Error', 'red'); break; }
/** * SQL Get all Advertisement data, custom fields, units by Advertisement ID * * @param $iAdvertisementID * @return SQL data */ function GetAdvertisementData($iAdvertisementID) { $sQuery = "\r\n\t\t\tSELECT `ClassifiedsAdvertisements`.*, `Classifieds`.`CustomFieldName1`, `Classifieds`.`CustomFieldName2`, `Classifieds`.`CustomAction1`, `Classifieds`.`CustomAction2`, `ClassifiedsSubs`.`NameSub`, `ClassifiedsSubs`.`SEntryUri`, `ClassifiedsSubs`.`ID` AS 'SubID', `Classifieds`.`Name`, `Classifieds`.`CEntryUri`, `Classifieds`.`ID` AS 'CatID', `Classifieds`.`Unit`, (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`ClassifiedsAdvertisements`.`DateTime`)) AS 'sec'\r\n\t\t\tFROM `ClassifiedsAdvertisements`\r\n\t\t\tINNER JOIN `ClassifiedsSubs`\r\n\t\t\tON (`ClassifiedsAdvertisements`.`IDClassifiedsSubs`=`ClassifiedsSubs`.`ID`)\r\n\t\t\tINNER JOIN `Classifieds`\r\n\t\t\tON (`Classifieds`.`ID`=`ClassifiedsSubs`.`IDClassified`)\r\n\t\t\tWHERE `ClassifiedsAdvertisements`.`ID`={$iAdvertisementID}"; $aSqlResStr = db_assoc_arr($sQuery); return $aSqlResStr; }
function serviceGetWallPost($aEvent) { $aOwner = db_assoc_arr("SELECT `ID` AS `id`, `NickName` AS `username` FROM `Profiles` WHERE `ID`='" . (int) $aEvent['owner_id'] . "' LIMIT 1"); $aPhoto = $this->serviceGetPhotoArray($aEvent['object_id'], 'browse'); if (empty($aOwner) || empty($aPhoto)) { return ""; } $sCss = ""; if ($aEvent['js_mode']) { $sCss = $this->oModule->_oTemplate->addCss('wall_post.css', true); } else { $this->oModule->_oTemplate->addCss('wall_post.css'); } $sAddedNewTxt = _t('_bx_photos_wall_added_new'); if (!$this->oModule->oAlbumPrivacy->check('album_view', $aPhoto['album_id'], $this->oModule->_iProfileId)) { $sPhotoTxt = _t('_bx_photos_wall_photo_private'); $aPhotoOut = array('title' => $aOwner['username'] . ' ' . $sAddedNewTxt . ' ' . $sPhotoTxt, 'content' => $sCss . $this->oTemplate->parseHtmlByName('wall_post_private.html', array('cpt_user_name' => $aOwner['username'], 'cpt_added_new' => $sAddedNewTxt . ' ' . $sPhotoTxt, 'post_id' => $aEvent['id']))); } else { $sPhotoTxt = _t('_bx_photos_wall_photo'); $aPhotoOut = array('title' => $aOwner['username'] . ' ' . $sAddedNewTxt . ' ' . $sPhotoTxt, 'description' => $aPhoto['description'], 'content' => $sCss . $this->oTemplate->parseHtmlByName('wall_post.html', array('cpt_user_name' => $aOwner['username'], 'cpt_added_new' => $sAddedNewTxt, 'cpt_photo_url' => $aPhoto['url'], 'cpt_photo' => $sPhotoTxt, 'cnt_photo_width' => $aPhoto['width'] + 4, 'cnt_photo_height' => $aPhoto['height'] + 4, 'cnt_photo_url' => $aPhoto['file'], 'cnt_photo_title' => $aPhoto['title'], 'post_id' => $aEvent['id']))); } return $aPhotoOut; }
function createNewElement($source) { global $sTableName; if ($source) { $aSource = db_assoc_arr("SELECT `Column`, `Func` FROM `{$sTableName}` WHERE `ID`={$source}"); if ($aSource['Column']) { if ($aSource['Func'] == 'PFBlock') { return 0; } // do not let copy profile blocks $sQuery = "\n\t\t\t\tINSERT INTO `{$sTableName}`\n\t\t\t\t\t( `Title`, `Desc`, `Caption`, `Func`, `Content`, `Visible` )\n\t\t\t\tSELECT\n\t\t\t\t\t `Title`, `Desc`, `Caption`, `Func`, `Content`, `Visible`\n\t\t\t\tFROM `{$sTableName}`\n\t\t\t\tWHERE `ID` = {$source}\n\t\t\t\t"; db_res($sQuery); $newID = mysql_insert_id(); } else { $newID = $source; } //return the source } else { $sQuery = "\n\t\t\tINSERT INTO `{$sTableName}` SET\n\t\t\t\t`Title` = 'NEW BLOCK',\n\t\t\t\t`Desc` = 'Place here your custom HTML-block',\n\t\t\t\t`Visible` = 'non,memb',\n\t\t\t\t`Func` = 'Echo'\n\t\t\t"; db_res($sQuery); $newID = mysql_insert_id(); } return $newID; }
function deleteItem($iItemID) { $this->genSaveItemHeader(); $aItem = db_assoc_arr("SELECT * FROM `sys_profile_fields` WHERE `ID` = {$iItemID}"); if (!$aItem) { $this->genSaveItemError(_t('_adm_fields_warning_item_not_found')); } elseif ($aItem['Type'] == 'system' or !(int) $aItem['Deletable']) { $this->genSaveItemError(_t('_adm_fields_error_field_cannot_be_deleted')); } else { $sQuery = "DELETE FROM `sys_profile_fields` WHERE `ID` = {$iItemID}"; db_res($sQuery); if ($aItem['Type'] == 'block') { db_res("DELETE FROM `sys_page_compose` WHERE `Func` = 'PFBlock' AND `Content` = '{$iItemID}'"); } else { db_res("ALTER TABLE `Profiles` DROP `{$aItem['Name']}`"); } $this->genSaveItemFormUpdate('deleteItem', $iItemID); //$this -> genSaveItemFormClose(); } $this->genSaveItemFooter(); }
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'languages.inc.php'; require_once BX_DIRECTORY_PATH_PLUGINS . 'Services_JSON.php'; bx_import('BxDolMenu'); // Check if administrator is logged in. If not display login form. $logged['admin'] = member_auth(1, true, true); $GLOBALS['oAdmTemplate']->addJsTranslation(array('_adm_mbuilder_Sorry_could_not_insert_object', '_adm_mbuilder_This_items_are_non_editable')); $oMenu = new BxDolMenu(); if (bx_get('action') !== false) { switch (bx_get('action')) { case 'edit_form': $id = (int) bx_get('id'); header('Content-Type: text/html; charset=utf-8'); $aItem = db_assoc_arr("SELECT * FROM `sys_menu_top` WHERE `ID` = '{$id}'", 0); if ($aItem) { echo showEditForm($aItem); } else { echoMenuEditMsg(_t('_Error occured'), 'red'); } exit; case 'create_item': $newID = createNewElement($_POST['type'], (int) $_POST['source']); echo $newID; exit; case 'deactivate_item': $res = db_res("UPDATE `sys_menu_top` SET `Active`=0 WHERE `ID`=" . (int) bx_get('id')); echo db_affected_rows(); $oMenu->compile(); exit;