function init(&$oDb) { parent::init($oDb); $sUri = $this->getUri(); $sName = 'bx_' . $sUri; $this->_bAutoapprove = $this->_oDb->getParam('news_autoapprove') == 'on'; $this->_bComments = $this->_oDb->getParam('news_comments') == 'on'; $this->_sCommentsSystemName = $sName; $this->_bVotes = $this->_oDb->getParam('news_votes') == 'on'; $this->_sVotesSystemName = $sName; $this->_sViewsSystemName = $sName; $this->_sSubscriptionsSystemName = $sName; $this->_sActionsViewSystemName = $sName; $this->_sCategoriesSystemName = $sName; $this->_sTagsSystemName = $sName; $this->_sAlertsSystemName = $sName; $this->_sSearchSystemName = $sName; $this->_sDateFormat = getLocaleFormat(BX_DOL_LOCALE_DATE_SHORT, BX_DOL_LOCALE_DB); $this->_sAnimationEffect = 'fade'; $this->_iAnimationSpeed = 'slow'; $this->_iIndexNumber = (int) $this->_oDb->getParam('news_index_number'); $this->_iMemberNumber = (int) $this->_oDb->getParam('news_member_number'); $this->_iSnippetLength = 1000; $this->_iPerPage = (int) $this->_oDb->getParam('news_per_page'); $this->_sSystemPrefix = 'news'; $this->_aJsClasses = array('main' => 'BxNewsMain'); $this->_aJsObjects = array('main' => 'oNewsMain'); $this->_iRssLength = (int) $this->_oDb->getParam('news_rss_length'); }
/** * Class constructor; */ function BxSimpleMessengerConfig($aModule) { parent::BxDolConfig($aModule); // define the tables prefix ; $this->sTablePrefix = $this->getDbPrefix(); // time (in seconds) script checks for messages ; $this->iUpdateTime = getParam('simple_messenger_update_time'); // number of visible messages into chat box ; $this->iVisibleMessages = getParam('simple_messenger_visible_messages'); // limit of returning messages in message box; $this->iCountRetMessages = 10; // flashing signals amount of the non-active window ; $this->iBlinkCounter = getParam('simple_messenger_blink_counter'); // save messenger's chat history ; $this->bSaveChatHistory = false; // allow to procces some smiles code; $this->bProccesSmiles = getParam('simple_messenger_procces_smiles'); // contains block's id where the list of messages will be generated ; $this->sOutputBlock = 'extra_area'; // contain history block's prefix (need for defines the last message); $this->sOutputBlockPrefix = 'messages_history_'; // number of allowed chat boxes; $this->iCountAllowedChatBoxes = getParam('simple_messenger_allowed_chatbox'); $this->sMessageDateFormat = getLocaleFormat(BX_DOL_LOCALE_DATE, BX_DOL_LOCALE_DB); }
/** * Constructor */ function BxWallConfig($aModule) { parent::BxDolConfig($aModule); $this->_bFullCompilation = false; $this->_sAlertSystemName = "bx_wall"; $this->_sCommonPostPrefix = 'wall_common_'; $this->_sCommentSystemName = "bx_wall"; $this->_sAnimationEffect = 'fade'; $this->_iAnimationSpeed = 'slow'; $this->_sDividerDateFormat = getLocaleFormat(BX_DOL_LOCALE_DATE_SHORT, BX_DOL_LOCALE_DB); }
/** * Constructor */ function BxPmtConfig($aModule) { parent::BxDolConfig($aModule); $this->_iAdminId = BX_PMT_ADMINISTRATOR_ID; $this->_sAdminUsername = BX_PMT_ADMINISTRATOR_USERNAME; $this->_sJsObjectCart = 'oPmtCart'; $this->_sJsObjectOrders = 'oPmtOrders'; $this->_sReturnUrl = BX_DOL_URL_ROOT . $this->getBaseUri() . 'cart/'; $this->_sDataReturnUrl = BX_DOL_URL_ROOT . $this->getBaseUri() . 'act_finalize_checkout/'; $this->_iOrdersPerPage = 10; $this->_iHistoryPerPage = 10; $this->_sDateFormatOrders = getLocaleFormat(BX_DOL_LOCALE_DATE_SHORT, BX_DOL_LOCALE_DB); }
/** * Constructor */ function BxWallConfig($aModule) { parent::BxDolConfig($aModule); $this->_bJsMode = false; $this->_sAlertSystemName = "bx_wall"; $this->_sCommonPostPrefix = 'wall_common_'; $this->_sCommentSystemName = "bx_wall"; $this->_sAnimationEffect = 'fade'; $this->_iAnimationSpeed = 'slow'; $this->_sDividerDateFormat = getLocaleFormat(BX_DOL_LOCALE_DATE_SHORT, BX_DOL_LOCALE_DB); $this->_aHideTimeline = array(); $this->_aHideOutline = array(); $this->_aHandlers = array(); $this->_aJsObjects = array('post' => 'oWallPost', 'view' => 'oWallView', 'outline' => 'oWallOutline'); }
/** * Constructor */ function __construct($aModule) { parent::__construct($aModule); $this->_iAdminId = BX_PMT_ADMINISTRATOR_ID; $this->_sAdminUsername = BX_PMT_ADMINISTRATOR_USERNAME; $this->_sJoinUrl = $this->getBaseUri() . 'join/'; $this->_sReturnUrl = $this->getBaseUri() . 'cart/'; $this->_sDataReturnUrl = $this->getBaseUri() . 'act_finalize_checkout/'; $this->_iOrdersPerPage = 10; $this->_iHistoryPerPage = 10; $this->_sDateFormatOrders = getLocaleFormat(BX_DOL_LOCALE_DATE_SHORT, BX_DOL_LOCALE_DB); $this->_sAnimationEffect = 'fade'; $this->_iAnimationSpeed = 'slow'; $this->_aPrefixes = array('general' => 'bx_pmt_', 'langs' => '_payment_', 'options' => 'pmt_'); $this->_aJsClasses = array('cart' => 'BxPmtCart', 'orders' => 'BxPmtOrders'); $this->_aJsObjects = array('cart' => 'oPmtCart', 'orders' => 'oPmtOrders'); $this->_sOptionsCategory = 'Payment'; }
function init(&$oDb) { parent::init($oDb); $this->_bAutoapprove = $this->_oDb->getParam('feedback_autoapprove') == 'on'; $this->_bComments = $this->_oDb->getParam('feedback_comments') == 'on'; $this->_sCommentsSystemName = "bx_feedback"; $this->_bVotes = $this->_oDb->getParam('feedback_votes') == 'on'; $this->_sVotesSystemName = "bx_feedback"; $this->_sDateFormat = getLocaleFormat(BX_DOL_LOCALE_DATE_SHORT, BX_DOL_LOCALE_DB); $this->_sAnimationEffect = 'fade'; $this->_iAnimationSpeed = 'slow'; $this->_iIndexNumber = (int) $this->_oDb->getParam('feedback_index_number'); $this->_iSnippetLength = (int) $this->_oDb->getParam('feedback_snippet_length'); $this->_iPerPage = (int) $this->_oDb->getParam('feedback_per_page'); $this->_sSystemPrefix = 'feedback'; $this->_aJsClasses = array('main' => 'BxFeedbackMain'); $this->_aJsObjects = array('main' => 'oFeedbackMain'); $this->_iRssLength = (int) $this->_oDb->getParam('feedback_rss_length'); }
function BxWallConfig($aModule) { parent::BxDolConfig($aModule); $sName = 'bx_wall'; $this->_bJsMode = false; $this->_sAlertSystemName = $sName; $this->_sCommentSystemName = $sName; $this->_sVotingSystemName = $sName; $this->_aRepostDefaults = array('show_do_repost_as_button' => false, 'show_do_repost_as_button_small' => false, 'show_do_repost_icon' => false, 'show_do_repost_label' => true, 'show_counter' => true); $this->_sCommonPostPrefix = 'wall_common_'; $this->_aPrefixes = array('style' => 'wall', 'language' => '_wall', 'option' => 'wall_', 'common_post' => $this->_sCommonPostPrefix); $this->_sAnimationEffect = 'fade'; $this->_iAnimationSpeed = 'slow'; $this->_sDividerDateFormat = getLocaleFormat(BX_DOL_LOCALE_DATE_SHORT, BX_DOL_LOCALE_DB); $this->_aHideTimeline = array(); $this->_aHideOutline = array(); $this->_aHandlers = array(); $this->_aJsClasses = array('post' => 'BxWallPost', 'repost' => 'BxWallRepost', 'view' => 'BxWallView', 'outline' => 'BxWallOutline'); $this->_aJsObjects = array('post' => 'oWallPost', 'repost' => 'oWallRepost', 'view' => 'oWallView', 'outline' => 'oWallOutline', 'voting' => 'oWallVoting'); $sHtmlPrefix = str_replace('_', '-', $sName); $this->_aHtmlIds = array('repost' => array('main' => $sHtmlPrefix . '-repost-', 'counter' => $sHtmlPrefix . '-repost-counter-', 'by_popup' => $sHtmlPrefix . '-repost-by-')); }
/** * Convert date(timestamp) in accordance with requested format code. * * @param string $sTimestamp - timestamp * @param integer $iCode - format code * 1(4) - short date format. @see sys_options -> short_date_format_php * 2 - time format. @see sys_options -> time_format_php * 3(5) - long date format. @see sys_options -> date_format_php * 6 - RFC 2822 date format. */ function getLocaleDate($sTimestamp = '', $iCode = BX_DOL_LOCALE_DATE_SHORT) { $sFormat = (int) $iCode == 6 ? 'r' : getLocaleFormat($iCode); return date($sFormat, $sTimestamp); }
* Overwrite necessary variables or add new in this file * *******************************************************************************/ global $gConf; $dir = array(); $aPathInfo = pathinfo(__FILE__); require_once $aPathInfo['dirname'] . '/../../../../../inc/header.inc.php'; $path = BX_DIRECTORY_PATH_ROOT . 'modules/boonex/forum/'; // path to orca files /** * forum tweaks */ require_once BX_DIRECTORY_PATH_INC . 'db.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php'; $gConf['date_format'] = getLocaleFormat(BX_DOL_LOCALE_DATE, BX_DOL_LOCALE_DB); // time/date format /** * directories configuration */ $gConf['dir']['error_log'] = $path . 'log/orca.error.log'; // error log file path $gConf['dir']['classes'] = $path . 'classes/'; // classes directiry path $gConf['dir']['js'] = $path . 'js/'; // js directiry path $gConf['dir']['inc'] = $path . 'inc/'; // include files path $gConf['dir']['xmlcache'] = $path . 'xml/'; // not used $gConf['dir']['xml'] = $path . 'integrations/' . BX_ORCA_INTEGRATION . '/';
function filterDateUTC($sTimestamp) { return gmdate(getLocaleFormat(BX_DOL_LOCALE_DATE), $sTimestamp); }
function getMembers($aParams) { if (!isset($aParams['view_start']) || empty($aParams['view_start'])) { $aParams['view_start'] = 0; } if (!isset($aParams['view_per_page']) || empty($aParams['view_per_page'])) { $aParams['view_per_page'] = BX_DOL_ADM_MP_PER_PAGE; } $aParams['view_order_way'] = 'ASC'; if (!isset($aParams['view_order']) || empty($aParams['view_order'])) { $aParams['view_order'] = 'ID'; } else { $aOrder = explode(' ', $aParams['view_order']); if (count($aOrder) > 1) { $aParams['view_order'] = $aOrder[0]; $aParams['view_order_way'] = $aOrder[1]; } } $sDateFormat = getLocaleFormat(BX_DOL_LOCALE_DATE, BX_DOL_LOCALE_DB); $sSelectClause = $sJoinClause = $sWhereClause = $sGroupClause = ''; switch ($aParams['ctl_type']) { case 'qlinks': switch ($aParams['ctl_params']['by']) { case 'status': $sWhereClause .= " AND `tp`.`Status`='" . ucfirst($aParams['ctl_params']['value']) . "'"; break; case 'featured': $sWhereClause .= " AND `tp`.`Featured`='1'"; break; case 'banned': $sWhereClause .= " AND (`tbl`.`Time`='0' OR (`tbl`.`Time`<>'0' AND DATE_ADD(`tbl`.`DateTime`, INTERVAL `tbl`.`Time` HOUR)>NOW()))"; break; case 'type': $sWhereClause .= $aParams['ctl_params']['value'] == 'single' ? " AND `tp`.`Couple`='0'" : " AND `tp`.`Couple`<>'0' AND `tp`.`Couple`>`tp`.`ID`"; break; case 'role': $iRole = BX_DOL_ROLE_MEMBER; if ($aParams['ctl_params']['value'] == 'admins') { $iRole = BX_DOL_ROLE_ADMIN; } $sWhereClause .= " AND `tp`.`Role` & " . $iRole . ""; break; case 'sex': $sWhereClause .= " AND LOWER(`tp`.`Sex`)='" . strtolower($aParams['ctl_params']['value']) . "'"; break; case 'membership': $sWhereClause .= " AND LOWER(`tl`.`Name`)='" . strtolower($aParams['ctl_params']['value']) . "'"; break; } break; case 'tags': $sWhereClause .= " AND `tp`.`Tags` LIKE '%" . $aParams['ctl_params']['value'] . "%'"; break; case 'search': $sWhereClause .= " AND (\r\n \t`tp`.`ID` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\r\n `tp`.`NickName` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR \r\n `tp`.`Email` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR \r\n `tp`.`Headline` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR \r\n `tp`.`DescriptionMe` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR \r\n `tp`.`Tags` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR \r\n `tp`.`DateReg` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR \r\n `tp`.`DateLastLogin` LIKE '%" . $aParams['ctl_params']['value'] . "%'\r\n )"; break; } //--- Get Paginate ---// $oPaginate = new BxDolPaginate(array('start' => $aParams['view_start'], 'count' => (int) db_value("SELECT COUNT(`tp`.`ID`) FROM `Profiles` AS `tp` LEFT JOIN `sys_admin_ban_list` AS `tbl` ON `tp`.`ID`=`tbl`.`ProfID` LEFT JOIN `sys_acl_levels_members` AS `tlm` ON `tp`.`ID`=`tlm`.`IDMember` AND `tlm`.`DateStarts` < NOW() AND (`tlm`.`DateExpires`>NOW() || ISNULL(`tlm`.`DateExpires`)) LEFT JOIN `sys_acl_levels` AS `tl` ON `tlm`.`IDLevel`=`tl`.`ID` " . $sJoinClause . " WHERE 1 AND (`tp`.`Couple`=0 OR `tp`.`Couple`>`tp`.`ID`)" . $sWhereClause), 'per_page' => $aParams['view_per_page'], 'page_url' => $GLOBALS['site']['url_admin'] . 'profiles.php?start={start}', 'on_change_page' => BX_DOL_ADM_MP_JS_NAME . '.changePage({start})')); $sPaginate = $oPaginate->getPaginate(); //--- Get Items ---// $sQuery = "\r\n \tSELECT\r\n \t\t`tp`.`ID` as `id`,\r\n \t\t`tp`.`NickName` AS `username`,\r\n \t\t`tp`.`Headline` AS `headline`,\r\n \t\t`tp`.`Sex` AS `sex`,\r\n \t\t`tp`.`DateOfBirth` AS `date_of_birth`,\r\n \t\t`tp`.`Country` AS `country`,\r\n \t\t`tp`.`City` AS `city`,\r\n \t\t`tp`.`DescriptionMe` AS `description`,\r\n \t\t`tp`.`Email` AS `email`,\r\n \t\tDATE_FORMAT(`tp`.`DateReg`, '" . $sDateFormat . "' ) AS `registration`,\r\n \t\tDATE_FORMAT(`tp`.`DateLastLogin`, '" . $sDateFormat . "' ) AS `last_login`,\r\n \t\t`tp`.`Status` AS `status`,\r\n \t\tIF(`tbl`.`Time`='0' OR DATE_ADD(`tbl`.`DateTime`, INTERVAL `tbl`.`Time` HOUR)>NOW(), 1, 0) AS `banned`, \r\n \t\t`tl`.`ID` AS `ml_id`, \r\n \t\tIF(ISNULL(`tl`.`Name`),'', `tl`.`Name`) AS `ml_name`\r\n \t\t" . $sSelectClause . "\r\n \tFROM `Profiles` AS `tp` \r\n LEFT JOIN `sys_admin_ban_list` AS `tbl` ON `tp`.`ID`=`tbl`.`ProfID`\r\n LEFT JOIN `sys_acl_levels_members` AS `tlm` ON `tp`.`ID`=`tlm`.`IDMember` AND `tlm`.`DateStarts` < NOW() AND (`tlm`.`DateExpires`>NOW() || ISNULL(`tlm`.`DateExpires`)) \r\n LEFT JOIN `sys_acl_levels` AS `tl` ON `tlm`.`IDLevel`=`tl`.`ID` \r\n \t" . $sJoinClause . "\r\n \tWHERE\r\n \t\t1 AND (`tp`.`Couple`=0 OR `tp`.`Couple`>`tp`.`ID`)" . $sWhereClause . "\r\n \t" . $sGroupClause . "\r\n \tORDER BY `tp`.`" . $aParams['view_order'] . "` " . $aParams['view_order_way'] . "\r\n \tLIMIT " . $aParams['view_start'] . ", " . $aParams['view_per_page']; $aProfiles = $GLOBALS['MySQL']->getAll($sQuery); //--- Display ---// $sFunction = 'getMembers' . ucfirst($aParams['view_type']); return $sFunction($aProfiles, $sPaginate); }
/** * Function will generate the view message block ; * * @return : Html presentation data ; */ function getBlockCode_ViewMessage() { global $oSysTemplate; global $oFunctions; global $site; global $oTemplConfig; // init some needed variables; $sOutputHtml = null; $sActionsList = null; // generate page toggle ellements ; $aToggleItems = array('inbox' => _t('_Inbox'), 'outbox' => _t('_Outbox'), 'trash' => _t('_Trash'), 'compose' => _t('_Compose')); $sRequest = 'mail.php' . '?'; foreach ($aToggleItems as $sKey => $sValue) { $aTopToggleEllements[$sValue] = array('href' => $sRequest . '&mode=' . $sKey, 'dynamic' => false, 'active' => false); } // language keys ; $aLanguageKeys = array('back_inbox' => _t('_Back') . ' ' . _t('_to') . ' ' . _t('_Inbox'), 'back_outbox' => _t('_Back') . ' ' . _t('_to') . ' ' . _t('_Outbox'), 'back_trash' => _t('_Back') . ' ' . _t('_to') . ' ' . _t('_Trash'), 'spam_message' => _t('_Report'), 'delete_message' => _t('_Delete'), 'reply_message' => _t('_Reply'), 'restore_message' => _t('_Restore'), 'are_you_sure' => _t('_Are you sure?'), 'more' => _t('_More actions'), 'mark_read' => _t('_Mark as old'), 'mark_unread' => _t('_Mark as New')); $sQuery = "\n SELECT\n *,\n DATE_FORMAT(`Date`, '" . getLocaleFormat(BX_DOL_LOCALE_DATE, BX_DOL_LOCALE_DB) . "') AS `Date`\n FROM\n `sys_messages`\n WHERE\n `ID` = {$this->aMailBoxSettings['messageID']}\n AND\n (\n `Sender` = {$this->aMailBoxSettings['member_id']}\n OR\n `Recipient` = {$this->aMailBoxSettings['member_id']}\n )\n "; $rResult = db_res($sQuery); while (true == ($aRow = mysql_fetch_assoc($rResult))) { // ** generate member's information ; $sMemberIcon = get_member_thumbnail($aRow['Sender'], 'none'); $aMemberInfo = getProfileInfo($aRow['Sender']); // define the back link; if ($aRow['Trash'] == 'recipient') { $sBackCaption = $aLanguageKeys['back_trash']; $sBackUrl = 'mail.php' . '?mode=trash'; } else { if ($aRow['Sender'] == $this->aMailBoxSettings['member_id']) { $sBackCaption = $aLanguageKeys['back_outbox']; $sBackUrl = 'mail.php' . '?mode=outbox'; } else { $sBackCaption = $aLanguageKeys['back_inbox']; $sBackUrl = 'mail.php' . '?mode=inbox'; } } $sMemberNickName = getNickName($aMemberInfo['ID']); $sMemberLocation = getProfileLink($aMemberInfo['ID']); $sMemberSexImage = isset($aMemberInfo['Sex']) ? $oFunctions->genSexIcon($aMemberInfo['Sex']) : null; $sMemberAge = isset($aMemberInfo['DateOfBirth']) && $aMemberInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aMemberInfo['DateOfBirth'])) : null; $sMemberCountry = isset($aMemberInfo['Country']) && $aMemberInfo['Country'] ? $aMemberInfo['Country'] : null; $sMemberFlag = $sMemberCountry ? $site['flags'] . strtolower($sMemberCountry) . $this->sMembersFlagExtension : null; if ($sMemberCountry) { $sMemberCountryFlag = '<img src="' . $sMemberFlag . '" alt="' . $sMemberCountry . '" />'; } $sCity = isset($aMemberInfo['City']) && $aMemberInfo['City'] ? $aMemberInfo['City'] . ', ' : null; // member's city and country; $sMemberCountry = $sCity . $sMemberCountry; // generate the member's actions list; if ($aRow['Sender'] != $this->aMailBoxSettings['member_id']) { // prepare all needed keywords ; $aMemberInfo['anonym_mode'] = $oTemplConfig->bAnonymousMode; $aMemberInfo['member_pass'] = $aMemberInfo['Password']; $aMemberInfo['member_id'] = $aMemberInfo['ID']; $aMemberInfo['url'] = BX_DOL_URL_ROOT; //--- Subscription integration ---// $oSubscription = new BxDolSubscription(); $sAddon = $oSubscription->getData(); $aButton = $oSubscription->getButton((int) $this->aMailBoxSettings['member_id'], 'profile', '', (int) $aRow['Sender']); $aMemberInfo['sbs_profile_title'] = $aButton['title']; $aMemberInfo['sbs_profile_script'] = $aButton['script']; //--- Subscription integration ---// $aMemberInfo['cpt_edit'] = ''; $aMemberInfo['cpt_send_letter'] = _t('_SendLetter'); $aMemberInfo['cpt_remove_friend'] = _t('_Remove friend'); $aMemberInfo['cpt_fave'] = _t('_Fave'); $aMemberInfo['cpt_remove_fave'] = _t('_Remove Fave'); $aMemberInfo['cpt_befriend'] = _t('_Befriend'); $aMemberInfo['cpt_greet'] = _t('_Greet'); $aMemberInfo['cpt_get_mail'] = _t('_Get E-mail'); $aMemberInfo['cpt_share'] = _t('_Share'); $aMemberInfo['cpt_report'] = _t('_Report'); $aMemberInfo['cpt_block'] = _t('_Block'); $aMemberInfo['cpt_unblock'] = _t('_Unblock'); $aMemberInfo['member_id'] = $this->aMailBoxSettings['member_id']; $sActionsList = $sAddon . $oFunctions->genObjectsActions($aMemberInfo, 'Profile'); } // try to define the message status ; if ($aRow['Sender'] == $this->aMailBoxSettings['member_id']) { if (strstr($aRow['Trash'], 'sender')) { $this->aMailBoxSettings['mailbox_mode'] = 'trash'; } else { $this->aMailBoxSettings['mailbox_mode'] = 'outbox'; } $sRelocateParameter = 'outbox'; } else { if ($aRow['Sender'] != $this->aMailBoxSettings['member_id']) { if (strstr($aRow['Trash'], 'recipient')) { $this->aMailBoxSettings['mailbox_mode'] = 'trash'; } else { $this->aMailBoxSettings['mailbox_mode'] = 'inbox'; } $sRelocateParameter = 'inbox'; } } // generate extended mailbox actions switch ($this->aMailBoxSettings['mailbox_mode']) { case 'inbox': // generate actions for inbox mode ; $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', array(), array('type' => 'button', 'value' => $aLanguageKeys['delete_message'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxViewMessage != \'undefined\') oMailBoxViewMessage.deleteMessages(' . $aRow['ID'] . ')')), array('type' => 'button', 'value' => $aLanguageKeys['spam_message'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxViewMessage != \'undefined\') oMailBoxViewMessage.spamMessages(\'\', ' . $aRow['Sender'] . ')')), array('type' => 'button', 'value' => $aLanguageKeys['mark_read'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxViewMessage != \'undefined\') oMailBoxViewMessage.markMessages(\'read\', ' . $aRow['ID'] . ')')), array('type' => 'button', 'value' => $aLanguageKeys['mark_unread'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxViewMessage != \'undefined\') oMailBoxViewMessage.markMessages(\'unread\', ' . $aRow['ID'] . ')'))))); if ($aRow['Sender'] != $this->aMailBoxSettings['member_id']) { $aForm['inputs']['actions'][0] = array('type' => 'button', 'value' => $aLanguageKeys['reply_message'], 'attrs' => array('onclick' => 'oMailBoxViewMessage.replyMessage(' . $this->aMailBoxSettings['messageID'] . ', ' . $aRow['Sender'] . ');')); } $oForm = new BxTemplFormView($aForm); $sMessageBoxActions = $oForm->getCode(); break; case 'outbox': // generate actions for outbox mode ; $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete_message'], 'attrs' => array('onclick' => 'if (typeof oMailBoxViewMessage != \'undefined\') oMailBoxViewMessage.deleteMessages(' . $aRow['ID'] . ')'))))); $oForm = new BxTemplFormView($aForm); $sMessageBoxActions = $oForm->getCode(); break; case 'trash': // generate actions for outbox mode ; $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => null, 1 => array('type' => 'button', 'value' => $aLanguageKeys['restore_message'], 'attrs' => array('onclick' => 'if (typeof oMailBoxViewMessage != \'undefined\') oMailBoxViewMessage.restoreMessages(' . $aRow['ID'] . ');'))))); if ($aRow['Sender'] != $this->aMailBoxSettings['member_id']) { $aForm['inputs']['actions'][0] = array('type' => 'button', 'value' => $aLanguageKeys['reply_message'], 'attrs' => array('onclick' => 'oMailBoxViewMessage.replyMessage(' . $this->aMailBoxSettings['messageID'] . ', ' . $aRow['Sender'] . ');')); } $oForm = new BxTemplFormView($aForm); $sMessageBoxActions = $oForm->getCode(); break; } // prepare for output ; $sTopcontrols = $oSysTemplate->parseHtmlByName('mail_box_view_message_top_controls.html', array('inbox_mode' => $sBackUrl, 'back_to_inbox' => $sBackCaption, 'back_img_src' => getTemplateIcon('back_to_inbox.png'))); $aTemplateKeys = array('top_controls' => $sTopcontrols, 'member_thumbnail' => $sMemberIcon, 'member_nick_name' => $sMemberNickName, 'member_location' => $sMemberLocation, 'member_sex_img' => $sMemberSexImage, 'member_sex' => $aMemberInfo['Sex'], 'member_age' => $sMemberAge, 'member_flag' => $sMemberCountryFlag, 'city_country' => $sMemberCountry, 'clock_img' => getTemplateIcon('clock.png'), 'date_create' => $aRow['Date'], 'message_subject' => $aRow['Subject'], 'member_actions_list' => $sActionsList, 'message_text' => $aRow['Text'], 'are_you_sure' => $aLanguageKeys['are_you_sure'], 'current_page' => 'mail.php', 'spam_message' => $aLanguageKeys['spam_message'], 'delete_message' => $aLanguageKeys['delete_message'], 'message_id' => $aRow['ID'], 'message_actions' => $sMessageBoxActions, 'page_mode' => $sRelocateParameter); // build and return final template ; $sOutputHtml = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['view_message_box'], $aTemplateKeys); } // if message nothing found ; if (!mysql_num_rows($rResult)) { $sOutputHtml = MsgBox(_t('_Empty')); } return array($sOutputHtml, $aTopToggleEllements, array(), true); }
/** * Function will get array with messages ; * * @return : hash array with messages ; */ function getMessages() { // init some needed variables ; $sWhereParameter = null; $sTypeMessages = null; // define the sort parameter ; $sSortParameter = array_key_exists($this->aMailBoxSettings['sort_mode'], $this->aSortCriterias) ? $this->aSortCriterias[$this->aMailBoxSettings['sort_mode']] : $this->aSortCriterias['date_desc']; // define mailbox mode ; switch ($this->aMailBoxSettings['mailbox_mode']) { case 'inbox': $sWhereParameter = " AND `sys_messages`.`Recipient` = {$this->aMailBoxSettings['member_id']} AND NOT FIND_IN_SET('Recipient', `sys_messages`.`Trash`) "; break; case 'inbox_new': $sWhereParameter = " AND `sys_messages`.`Recipient`={$this->aMailBoxSettings['member_id']} AND NOT FIND_IN_SET('Recipient', `sys_messages`.`Trash`) AND `New`='1' "; break; case 'outbox': $sWhereParameter = " AND `sys_messages`.`Sender` = {$this->aMailBoxSettings['member_id']} AND NOT FIND_IN_SET('Sender', `sys_messages`.`Trash`)"; break; case 'trash': $sWhereParameter = "\n AND\n (\n (\n `sys_messages`.`Sender` = {$this->aMailBoxSettings['member_id']}\n AND\n FIND_IN_SET('Sender', `sys_messages`.`Trash`)\n )\n OR\n (\n `sys_messages`.`Recipient` = {$this->aMailBoxSettings['member_id']}\n AND\n FIND_IN_SET('Recipient', `sys_messages`.`Trash`)\n )\n )\n AND\n (\n (\n `sys_messages`.`Sender` = {$this->aMailBoxSettings['member_id']}\n AND\n NOT FIND_IN_SET('Sender', `sys_messages`.`TrashNotView`)\n )\n OR\n (\n `sys_messages`.`Recipient` = {$this->aMailBoxSettings['member_id']}\n AND\n NOT FIND_IN_SET('Recipient', `sys_messages`.`TrashNotView`)\n )\n )\n "; break; } // define messages types if (is_array($this->aReceivedMessagesTypes) and !empty($this->aReceivedMessagesTypes)) { foreach ($this->aReceivedMessagesTypes as $sKey) { if ($sKey) { $sTypeMessages .= "`sys_messages`.`Type` = '{$sKey}' OR"; } } $sTypeMessages = 'AND (' . preg_replace("/OR\$/", '', $sTypeMessages) . ')'; } else { return; } // if defined all needed parameters ; if ($sWhereParameter) { // count of all messages ; $this->iTotalMessageCount = db_value("\n SELECT\n COUNT(`sys_messages`.`ID`)\n FROM\n `sys_messages`\n WHERE\n 1\n {$sWhereParameter}\n {$sTypeMessages}\n "); if ($this->iTotalMessageCount) { // define number of maximum message for per page ; if ($this->aMailBoxSettings['page'] < 1) { $this->aMailBoxSettings['page'] = 1; } $sLimitFrom = ($this->aMailBoxSettings['page'] - 1) * $this->aMailBoxSettings['per_page']; $sSqlLimit = "LIMIT {$sLimitFrom}, {$this->aMailBoxSettings['per_page']}"; $sFieldName = $this->aMailBoxSettings['mailbox_mode'] == 'outbox' ? 'Recipient' : 'Sender'; $sQuery = "\n SELECT\n `sys_messages`.`ID`, DATE_FORMAT(`sys_messages`.`Date`, '" . getLocaleFormat(BX_DOL_LOCALE_DATE, BX_DOL_LOCALE_DB) . "') AS `Date`,\n UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`sys_messages`.`Date`) AS `DateUTS`,\n UNIX_TIMESTAMP(`sys_messages`.`Date`) AS `DateTS`,\n `sys_messages`.`Sender`, `sys_messages`.`Recipient`, `sys_messages`.`Text`,\n `sys_messages`.`Subject`, `sys_messages`.`New`, `sys_messages`.`Type`\n FROM\n `sys_messages`\n INNER JOIN\n `Profiles`\n ON\n `Profiles`.`ID` = `sys_messages`.`{$sFieldName}`\n WHERE\n 1\n {$sWhereParameter}\n {$sTypeMessages}\n ORDER BY {$sSortParameter}\n {$sSqlLimit}\n "; $aMessages = array(); $rResult = db_res($sQuery); // generate array with messages ; while (true == ($aRow = $rResult->fetch())) { $aMessages[] = $aRow; } // return generated array ; return $aMessages; } } }
/** * Function will return array with needed requests ; * * @param : $sTableName (string) - DB's table name; * @param : $aRequestTypes (array) - contain language keys for differences person's mode ; [ from ] - needed if person mode = 'from' ; [ to ] - needed if person mode = 'to' ; * @param : $sAdditionalParam (string) - additional SQL query ; * @param : $sAdditionalField (string) - additional table's field ; * @return : (array) array with all requests ; [ member_id ] - member's ID ; [ date ] - request's date ; [ type ] - type of request ; */ function getRequests($sTableName, &$aRequestTypes, $sAdditionalParam = null, $sAdditionalField = null) { $sTableName = process_db_input($sTableName); $sAdditionalParam = process_db_input($sAdditionalParam); $sAdditionalField = process_db_input($sAdditionalField); // ** init some needed variables ; $aRequests = array(); // init all sort criterias ; $aSortCriterias = array('date' => "`{$sTableName}`.`When` ASC", 'author' => '`Profiles`.`NickName` ASC', 'date_desc' => "`{$sTableName}`.`When` DESC", 'author_desc' => '`Profiles`.`NickName` DESC'); // define the sort parameter ; $sSortParameter = array_key_exists($this->aCommunicatorSettings['sorting'], $aSortCriterias) ? $aSortCriterias[$this->aCommunicatorSettings['sorting']] : $aSortCriterias['date_desc']; // define the person mode ; switch ($this->aCommunicatorSettings['person_switcher']) { case 'from': $sFieldName = '`ID`'; break; case 'to': $sFieldName = '`Profile`'; break; default: $sFieldName = '`ID`'; } // count of all requests ; $this->iTotalRequestsCount = db_value("\n SELECT\n COUNT(*)\n FROM\n `{$sTableName}`\n WHERE\n `{$sTableName}`.{$sFieldName} = {$this->aCommunicatorSettings['member_id']}\n {$sAdditionalParam}\n "); if ($this->iTotalRequestsCount) { // lang keys ; $sRequestFrom = $GLOBALS['MySQL']->escape($aRequestTypes['from']); $sRequestTo = $GLOBALS['MySQL']->escape($aRequestTypes['to']); // define number of maximum rows for per page ; if ($this->aCommunicatorSettings['page'] < 1) { $this->aCommunicatorSettings['page'] = 1; } $sLimitFrom = ($this->aCommunicatorSettings['page'] - 1) * $this->aCommunicatorSettings['per_page']; $sSqlLimit = "LIMIT {$sLimitFrom}, {$this->aCommunicatorSettings['per_page']}"; // define the additional table's field ; $sExtFieldName = $sAdditionalField ? ", `{$sTableName}`.`{$sAdditionalField}`" : null; $sQuery = "\n SELECT\n IF(`{$sTableName}`.`ID` = {$this->aCommunicatorSettings['member_id']},\n `{$sTableName}`.`Profile`, `{$sTableName}`.`ID`) AS `iMemberID`,\n\n IF(`{$sTableName}`.`ID` = {$this->aCommunicatorSettings['member_id']}, '{$sRequestFrom}', '{$sRequestTo}')\n AS `sType`,\n\n DATE_FORMAT(`{$sTableName}`.`When`, '" . getLocaleFormat(BX_DOL_LOCALE_DATE, BX_DOL_LOCALE_DB) . "') AS `sDate`\n {$sExtFieldName}\n FROM\n `{$sTableName}`\n LEFT JOIN\n `Profiles`\n ON\n `Profiles`.`ID` = IF(`{$sTableName}`.`ID` = {$this->aCommunicatorSettings['member_id']},\n `{$sTableName}`.`Profile`, `{$sTableName}`.`ID`)\n WHERE\n `{$sTableName}`.{$sFieldName} = {$this->aCommunicatorSettings['member_id']}\n {$sAdditionalParam}\n ORDER BY\n {$sSortParameter}\n {$sSqlLimit}\n "; $rResult = db_res($sQuery); while (true == ($aRow = mysql_fetch_assoc($rResult))) { $sExtType = (!empty($aRequestTypes['specific_key']) and $sAdditionalField) ? ' ' . _t($aRequestTypes['specific_key'], $aRow[$sAdditionalField]) : null; $aRequests[] = array('member_id' => $aRow['iMemberID'], 'date' => $aRow['sDate'], 'type' => $aRow['sType'] . $sExtType); } } return $aRequests; }
function getMembers($aParams) { if (!isset($aParams['view_start']) || empty($aParams['view_start'])) { $aParams['view_start'] = 0; } if (!isset($aParams['view_per_page']) || empty($aParams['view_per_page'])) { $aParams['view_per_page'] = BX_DOL_ADM_MP_PER_PAGE; } $aParams['view_order_way'] = 'ASC'; if (!isset($aParams['view_order']) || empty($aParams['view_order'])) { $aParams['view_order'] = 'ID'; } else { $aOrder = explode(' ', $aParams['view_order']); if (count($aOrder) > 1) { $aParams['view_order'] = $aOrder[0]; $aParams['view_order_way'] = $aOrder[1]; } } $sDateFormat = getLocaleFormat(BX_DOL_LOCALE_DATE, BX_DOL_LOCALE_DB); $sSelectClause = $sJoinClause = $sWhereClause = $sGroupClause = ''; if (isset($aParams['ctl_type'])) { switch ($aParams['ctl_type']) { case 'qlinks': switch ($aParams['ctl_params']['by']) { case 'status': $sWhereClause .= " AND `tp`.`Status`='" . ucfirst($aParams['ctl_params']['value']) . "'"; break; case 'featured': $sWhereClause .= " AND `tp`.`Featured`='1'"; break; case 'banned': $sWhereClause .= " AND (`tbl`.`Time`='0' OR (`tbl`.`Time`<>'0' AND DATE_ADD(`tbl`.`DateTime`, INTERVAL `tbl`.`Time` HOUR)>NOW()))"; break; case 'type': $sWhereClause .= $aParams['ctl_params']['value'] == 'single' ? " AND `tp`.`Couple`='0'" : " AND `tp`.`Couple`<>'0' AND `tp`.`Couple`>`tp`.`ID`"; break; case 'role': $iRole = BX_DOL_ROLE_MEMBER; if ($aParams['ctl_params']['value'] == 'admins') { $iRole = BX_DOL_ROLE_ADMIN; } $sWhereClause .= " AND `tp`.`Role` & " . $iRole . ""; break; case 'sex': $sWhereClause .= " AND LOWER(`tp`.`Sex`)='" . strtolower($aParams['ctl_params']['value']) . "' AND `tp`.`Couple` = 0 "; break; case 'membership': $sWhereClause .= " AND LOWER(`tl`.`Name`)='" . strtolower($aParams['ctl_params']['value']) . "'"; break; } break; case 'tags': $sWhereClause .= " AND `tp`.`Tags` LIKE '%" . $aParams['ctl_params']['value'] . "%'"; break; case 'search': $sWhereClause .= " AND (\n `tp`.`ID` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\n `tp`.`NickName` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\n `tp`.`Email` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\n `tp`.`DescriptionMe` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\n `tp`.`Tags` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\n `tp`.`DateReg` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\n `tp`.`DateLastLogin` LIKE '%" . $aParams['ctl_params']['value'] . "%'\n )"; break; } } //--- Get Paginate ---// $oPaginate = new BxDolPaginate(array('start' => $aParams['view_start'], 'count' => (int) db_value("SELECT COUNT(`tp`.`ID`) FROM `Profiles` AS `tp` LEFT JOIN `sys_admin_ban_list` AS `tbl` ON `tp`.`ID`=`tbl`.`ProfID` LEFT JOIN `sys_acl_levels_members` AS `tlm` ON `tp`.`ID`=`tlm`.`IDMember` AND `tlm`.`DateStarts` < NOW() AND (`tlm`.`DateExpires`>NOW() || ISNULL(`tlm`.`DateExpires`)) LEFT JOIN `sys_acl_levels` AS `tl` ON `tlm`.`IDLevel`=`tl`.`ID` " . $sJoinClause . " WHERE 1 AND (`tp`.`Couple`=0 OR `tp`.`Couple`>`tp`.`ID`)" . $sWhereClause), 'per_page' => $aParams['view_per_page'], 'page_url' => $GLOBALS['site']['url_admin'] . 'profiles.php?start={start}', 'on_change_page' => BX_DOL_ADM_MP_JS_NAME . '.changePage({start})')); $sPaginate = $oPaginate->getPaginate(); //--- Get Controls ---// $GLOBALS['oAdmTemplate']->addJsTranslation(array('_adm_btn_mp_ban_duration')); $aButtons = array('adm-mp-activate' => _t('_adm_btn_mp_activate'), 'adm-mp-deactivate' => _t('_adm_btn_mp_deactivate'), 'adm-mp-ban' => array('type' => 'submit', 'name' => 'adm-mp-ban', 'value' => _t('_adm_btn_mp_ban'), 'onclick' => 'onclick="javascript: return ' . BX_DOL_ADM_MP_JS_NAME . '.actionBan(this);"'), 'adm-mp-unban' => _t('_adm_btn_mp_unban'), 'adm-mp-confirm' => _t('_adm_btn_mp_confirm'), 'adm-mp-delete' => _t('_adm_btn_mp_delete'), 'adm-mp-delete-spammer' => _t('_adm_btn_mp_delete_spammer')); $sControls = BxTemplSearchResult::showAdminActionsPanel('adm-mp-members-' . $aParams['view_type'], $aButtons, 'members'); //--- Get Items ---// $sQuery = "\n SELECT\n `tp`.`ID` as `id`,\n `tp`.`NickName` AS `username`,\n `tp`.`Sex` AS `sex`,\n `tp`.`DateOfBirth` AS `date_of_birth`,\n `tp`.`Country` AS `country`,\n `tp`.`City` AS `city`,\n `tp`.`DescriptionMe` AS `description`,\n `tp`.`Email` AS `email`,\n DATE_FORMAT(`tp`.`DateReg`, '" . $sDateFormat . "' ) AS `registration`,\n DATE_FORMAT(`tp`.`DateLastLogin`, '" . $sDateFormat . "' ) AS `last_login`,\n DATE_FORMAT(`tp`.`DateLastNav`, '" . $sDateFormat . "' ) AS `last_activity`,\n `tp`.`Status` AS `status`,\n IF(`tbl`.`Time`='0' OR DATE_ADD(`tbl`.`DateTime`, INTERVAL `tbl`.`Time` HOUR)>NOW(), 1, 0) AS `banned`,\n `tl`.`ID` AS `ml_id`,\n IF(ISNULL(`tl`.`Name`),'', `tl`.`Name`) AS `ml_name`\n " . $sSelectClause . "\n FROM `Profiles` AS `tp`\n LEFT JOIN `sys_admin_ban_list` AS `tbl` ON `tp`.`ID`=`tbl`.`ProfID`\n LEFT JOIN `sys_acl_levels_members` AS `tlm` ON `tp`.`ID`=`tlm`.`IDMember` AND `tlm`.`DateStarts` < NOW() AND (`tlm`.`DateExpires`>NOW() || ISNULL(`tlm`.`DateExpires`))\n LEFT JOIN `sys_acl_levels` AS `tl` ON `tlm`.`IDLevel`=`tl`.`ID`\n " . $sJoinClause . "\n WHERE\n 1 AND (`tp`.`Couple`=0 OR `tp`.`Couple`>`tp`.`ID`)" . $sWhereClause . "\n " . $sGroupClause . "\n ORDER BY `tp`.`" . $aParams['view_order'] . "` " . $aParams['view_order_way'] . "\n LIMIT " . $aParams['view_start'] . ", " . $aParams['view_per_page']; $aProfiles = $GLOBALS['MySQL']->getAll($sQuery); //--- Display ---// $sFunction = 'getMembers' . ucfirst($aParams['view_type']); return $sFunction($aProfiles, $sPaginate, $sControls); }
function getAdminBlock() { global $oAdmTemplate; $aInfo = $GLOBALS['MySQL']->getRow("SELECT `NickName` AS `username`, `Password` AS `Password`, DATE_FORMAT(`DateLastLogin`, '" . getLocaleFormat(BX_DOL_LOCALE_DATE, BX_DOL_LOCALE_DB) . "') AS `last_login` FROM `Profiles` WHERE `ID`='" . $_COOKIE['memberID'] . "' LIMIT 1"); return array('icon' => $oAdmTemplate->getIconUrl('dashboard_admin.png'), 'title' => ucfirst($aInfo['username']), 'url' => '', 'content' => _t('_adm_txt_dashboard_last_login') . ': ' . $aInfo['last_login'] . '<br /><a href="' . $GLOBALS['site']['url_admin'] . 'settings.php?cat=ap">' . _t('_adm_txt_dashboard_change_password') . '</a>'); }