code
stringlengths
17
247k
docstring
stringlengths
30
30.3k
func_name
stringlengths
1
89
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
153
url
stringlengths
51
209
license
stringclasses
4 values
public function getExpiresAt() { return $this->getField('expires_at'); }
Returns the date & time that the token expires. @return \DateTime|null
getExpiresAt
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
MIT
public function getIsValid() { return $this->getField('is_valid'); }
Returns whether the token is valid. @return boolean
getIsValid
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
MIT
public function getIssuedAt() { return $this->getField('issued_at'); }
Returns the date & time the token was issued at. @return \DateTime|null
getIssuedAt
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
MIT
public function getScopes() { return $this->getField('scopes'); }
Returns the scope permissions associated with the token. @return array
getScopes
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
MIT
public function getUserId() { return $this->getField('user_id'); }
Returns the login id of the user associated with the token. @return string|null
getUserId
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
MIT
public function getLastRequest() { return $this->lastRequest; }
Returns the last FacebookRequest that was sent. Useful for debugging and testing. @return FacebookRequest|null
getLastRequest
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
MIT
public function getAuthorizationUrl($redirectUrl, $state, array $scope = [], array $params = [], $separator = '&') { $params += [ 'client_id' => $this->app->getId(), 'state' => $state, 'response_type' => 'code', 'sdk' => 'php-sdk-' . Facebook::VERSION, 'redirect_uri' => $redirectUrl, 'scope' => implode(',', $scope) ]; return static::BASE_AUTHORIZATION_URL . '/' . $this->graphVersion . '/dialog/oauth?' . http_build_query($params, null, $separator); }
Generates an authorization URL to begin the process of authenticating a user. @param string $redirectUrl The callback URL to redirect to. @param string $state The CSPRNG-generated CSRF value. @param array $scope An array of permissions to request. @param array $params An array of parameters to generate URL. @param string $separator The separator to use in http_build_query(). @return string
getAuthorizationUrl
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
MIT
public function getAccessTokenFromCode($code, $redirectUri = '') { $params = [ 'code' => $code, 'redirect_uri' => $redirectUri, ]; return $this->requestAnAccessToken($params); }
Get a valid access token from a code. @param string $code @param string $redirectUri @return AccessToken @throws FacebookSDKException
getAccessTokenFromCode
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
MIT
public function getLongLivedAccessToken($accessToken) { $accessToken = $accessToken instanceof AccessToken ? $accessToken->getValue() : $accessToken; $params = [ 'grant_type' => 'fb_exchange_token', 'fb_exchange_token' => $accessToken, ]; return $this->requestAnAccessToken($params); }
Exchanges a short-lived access token with a long-lived access token. @param AccessToken|string $accessToken @return AccessToken @throws FacebookSDKException
getLongLivedAccessToken
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
MIT
public function getCodeFromLongLivedAccessToken($accessToken, $redirectUri = '') { $params = [ 'redirect_uri' => $redirectUri, ]; $response = $this->sendRequestWithClientParams('/oauth/client_code', $params, $accessToken); $data = $response->getDecodedBody(); if (!isset($data['code'])) { throw new FacebookSDKException('Code was not returned from Graph.', 401); } return $data['code']; }
Get a valid code from an access token. @param AccessToken|string $accessToken @param string $redirectUri @return AccessToken @throws FacebookSDKException
getCodeFromLongLivedAccessToken
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
MIT
protected function sendRequestWithClientParams($endpoint, array $params, $accessToken = null) { $params += $this->getClientParams(); $accessToken = $accessToken ?: $this->app->getAccessToken(); $this->lastRequest = new FacebookRequest( $this->app, $accessToken, 'GET', $endpoint, $params, null, $this->graphVersion ); return $this->client->sendRequest($this->lastRequest); }
Send a request to Graph with an app access token. @param string $endpoint @param array $params @param AccessToken|string|null $accessToken @return FacebookResponse @throws FacebookResponseException
sendRequestWithClientParams
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
MIT
protected function getClientParams() { return [ 'client_id' => $this->app->getId(), 'client_secret' => $this->app->getSecret(), ]; }
Returns the client_* params for OAuth requests. @return array
getClientParams
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/OAuth2Client.php
MIT
public function getField($field, $default = null) { if (isset($this->metadata[$field])) { return $this->metadata[$field]; } return $default; }
Returns a value from the metadata. @param string $field The property to retrieve. @param mixed $default The default to return if the property doesn't exist. @return mixed
getField
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function getProperty($field, $default = null) { return $this->getField($field, $default); }
Returns a value from the metadata. @param string $field The property to retrieve. @param mixed $default The default to return if the property doesn't exist. @return mixed @deprecated 5.0.0 getProperty() has been renamed to getField() @todo v6: Remove this method
getProperty
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function getChildProperty($parentField, $field, $default = null) { if (!isset($this->metadata[$parentField])) { return $default; } if (!isset($this->metadata[$parentField][$field])) { return $default; } return $this->metadata[$parentField][$field]; }
Returns a value from a child property in the metadata. @param string $parentField The parent property. @param string $field The property to retrieve. @param mixed $default The default to return if the property doesn't exist. @return mixed
getChildProperty
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function getErrorProperty($field, $default = null) { return $this->getChildProperty('error', $field, $default); }
Returns a value from the error metadata. @param string $field The property to retrieve. @param mixed $default The default to return if the property doesn't exist. @return mixed
getErrorProperty
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function getMetadataProperty($field, $default = null) { return $this->getChildProperty('metadata', $field, $default); }
Returns a value from the "metadata" metadata. *Brain explodes* @param string $field The property to retrieve. @param mixed $default The default to return if the property doesn't exist. @return mixed
getMetadataProperty
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function isError() { return $this->getField('error') !== null; }
Any error that a request to the graph api would return due to the access token. @return bool|null
isError
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function getErrorMessage() { return $this->getErrorProperty('message'); }
The error message for the error. @return string|null
getErrorMessage
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function getErrorSubcode() { return $this->getErrorProperty('subcode'); }
The error subcode for the error. @return int|null
getErrorSubcode
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function getMetadata() { return $this->getField('metadata'); }
General metadata associated with the access token. Can contain data like 'sso', 'auth_type', 'auth_nonce'. @return array|null
getMetadata
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function getSso() { return $this->getMetadataProperty('sso'); }
The 'sso' child property from the 'metadata' parent property. @return string|null
getSso
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function getAuthType() { return $this->getMetadataProperty('auth_type'); }
The 'auth_type' child property from the 'metadata' parent property. @return string|null
getAuthType
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function getAuthNonce() { return $this->getMetadataProperty('auth_nonce'); }
The 'auth_nonce' child property from the 'metadata' parent property. @return string|null
getAuthNonce
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function getProfileId() { return $this->getField('profile_id'); }
For impersonated access tokens, the ID of the page this token contains. @return string|null
getProfileId
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function validateAppId($appId) { if ($this->getAppId() !== $appId) { throw new FacebookSDKException('Access token metadata contains unexpected app ID.', 401); } }
Ensures the app ID from the access token metadata is what we expect. @param string $appId @throws FacebookSDKException
validateAppId
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function validateUserId($userId) { if ($this->getUserId() !== $userId) { throw new FacebookSDKException('Access token metadata contains unexpected user ID.', 401); } }
Ensures the user ID from the access token metadata is what we expect. @param string $userId @throws FacebookSDKException
validateUserId
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function validateExpiration() { if (!$this->getExpiresAt() instanceof \DateTime) { return; } if ($this->getExpiresAt()->getTimestamp() < time()) { throw new FacebookSDKException('Inspection of access token metadata shows that the access token has expired.', 401); } }
Ensures the access token has not expired yet. @throws FacebookSDKException
validateExpiration
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
private function convertTimestampToDateTime($timestamp) { $dt = new \DateTime(); $dt->setTimestamp($timestamp); return $dt; }
Converts a unix timestamp into a DateTime entity. @param int $timestamp @return \DateTime
convertTimestampToDateTime
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
private function castTimestampsToDateTime() { foreach (static::$dateProperties as $key) { if (isset($this->metadata[$key]) && $this->metadata[$key] !== 0) { $this->metadata[$key] = $this->convertTimestampToDateTime($this->metadata[$key]); } } }
Casts the unix timestamps as DateTime entities.
castTimestampsToDateTime
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
MIT
public function __construct($accessToken, $expiresAt = 0) { $this->value = $accessToken; if ($expiresAt) { $this->setExpiresAtFromTimeStamp($expiresAt); } }
Create a new access token entity. @param string $accessToken @param int $expiresAt
__construct
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessToken.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessToken.php
MIT
public function getAppSecretProof($appSecret) { return hash_hmac('sha256', $this->value, $appSecret); }
Generate an app secret proof to sign a request to Graph. @param string $appSecret The app secret. @return string
getAppSecretProof
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessToken.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessToken.php
MIT
public function isAppAccessToken() { return strpos($this->value, '|') !== false; }
Determines whether or not this is an app access token. @return bool
isAppAccessToken
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessToken.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessToken.php
MIT
public function isLongLived() { if ($this->expiresAt) { return $this->expiresAt->getTimestamp() > time() + (60 * 60 * 2); } if ($this->isAppAccessToken()) { return true; } return false; }
Determines whether or not this is a long-lived token. @return bool
isLongLived
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessToken.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessToken.php
MIT
public function isExpired() { if ($this->getExpiresAt() instanceof \DateTime) { return $this->getExpiresAt()->getTimestamp() < time(); } if ($this->isAppAccessToken()) { return false; } return null; }
Checks the expiration of the access token. @return boolean|null
isExpired
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessToken.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessToken.php
MIT
public function __toString() { return $this->getValue(); }
Returns the access token as a string. @return string
__toString
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/Authentication/AccessToken.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/Authentication/AccessToken.php
MIT
public function validateLength($length) { if (!is_int($length)) { throw new \InvalidArgumentException('getPseudoRandomString() expects an integer for the string length'); } if ($length < 1) { throw new \InvalidArgumentException('getPseudoRandomString() expects a length greater than 1'); } }
Validates the length argument of a random string. @param int $length The length to validate. @throws \InvalidArgumentException
validateLength
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php
MIT
public function binToHex($binaryData, $length) { return \substr(\bin2hex($binaryData), 0, $length); }
Converts binary data to hexadecimal of arbitrary length. @param string $binaryData The binary data to convert to hex. @param int $length The length of the string to return. @return string
binToHex
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php
MIT
public static function createPseudoRandomStringGenerator($generator) { if (!$generator) { return self::detectDefaultPseudoRandomStringGenerator(); } if ($generator instanceof PseudoRandomStringGeneratorInterface) { return $generator; } if ('random_bytes' === $generator) { return new RandomBytesPseudoRandomStringGenerator(); } if ('mcrypt' === $generator) { return new McryptPseudoRandomStringGenerator(); } if ('openssl' === $generator) { return new OpenSslPseudoRandomStringGenerator(); } if ('urandom' === $generator) { return new UrandomPseudoRandomStringGenerator(); } throw new InvalidArgumentException('The pseudo random string generator must be set to "random_bytes", "mcrypt", "openssl", or "urandom", or be an instance of Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface'); }
Pseudo random string generator creation. @param PseudoRandomStringGeneratorInterface|string|null $generator @throws InvalidArgumentException If the pseudo random string generator must be set to "random_bytes", "mcrypt", "openssl", or "urandom", or be an instance of Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface. @return PseudoRandomStringGeneratorInterface
createPseudoRandomStringGenerator
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php
MIT
private static function detectDefaultPseudoRandomStringGenerator() { // Check for PHP 7's CSPRNG first to keep mcrypt deprecation messages from appearing in PHP 7.1. if (function_exists('random_bytes')) { return new RandomBytesPseudoRandomStringGenerator(); } // Since openssl_random_pseudo_bytes() can sometimes return non-cryptographically // secure pseudo-random strings (in rare cases), we check for mcrypt_create_iv() next. if (function_exists('mcrypt_create_iv')) { return new McryptPseudoRandomStringGenerator(); } if (function_exists('openssl_random_pseudo_bytes')) { return new OpenSslPseudoRandomStringGenerator(); } if (!ini_get('open_basedir') && is_readable('/dev/urandom')) { return new UrandomPseudoRandomStringGenerator(); } throw new FacebookSDKException('Unable to detect a cryptographically secure pseudo-random string generator.'); }
Detects which pseudo-random string generator to use. @throws FacebookSDKException If unable to detect a cryptographically secure pseudo-random string generator. @return PseudoRandomStringGeneratorInterface
detectDefaultPseudoRandomStringGenerator
php
boonex/dolphin.pro
plugins/facebook-php-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php
https://github.com/boonex/dolphin.pro/blob/master/plugins/facebook-php-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php
MIT
function actionResponse($sProvider, $iVendorId) { $oProvider = $this->_getProvider($sProvider, $iVendorId); if(is_string($oProvider)) { $this->_oTemplate->getPageCodeError($oProvider); return; } $aResult = $oProvider->processResponse($_REQUEST); $sMethod = 'getPageCodeResponse'; $sMessage = $this->_sLangsPrefix . 'msg_successfully_done'; if((int)$aResult['code'] != 0) { $sMethod = 'getPageCodeError'; $sMessage = $this->_sLangsPrefix . 'err_unknown'; } $this->_oTemplate->$sMethod($sMessage); return; }
Currently is used with errors returned from Hosted Checkout Pages.
actionResponse
php
boonex/dolphin.pro
modules/boonex/paypal_payflow/classes/BxPfwModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/paypal_payflow/classes/BxPfwModule.php
MIT
function serviceHomepageBlock() { if (!$this->_oDb->isAnyPublicContent()) { return ''; } bx_import('PageMain', $this->_aModule); $o = new BxEventsPageMain ($this); $o->sUrlStart = BX_DOL_URL_ROOT . '?'; $sDefaultHomepageTab = $this->_oDb->getParam('bx_events_homepage_default_tab'); $sBrowseMode = $sDefaultHomepageTab; switch ($_GET['bx_events_filter']) { case 'featured': case 'recent': case 'top': case 'popular': case 'upcoming': case $sDefaultHomepageTab: $sBrowseMode = $_GET['bx_events_filter']; break; } return $o->ajaxBrowse( $sBrowseMode, $this->_oDb->getParam('bx_events_perpage_homepage'), array( _t('_bx_events_tab_upcoming') => array( 'href' => BX_DOL_URL_ROOT . '?bx_events_filter=upcoming', 'active' => 'upcoming' == $sBrowseMode, 'dynamic' => true ), _t('_bx_events_tab_featured') => array( 'href' => BX_DOL_URL_ROOT . '?bx_events_filter=featured', 'active' => 'featured' == $sBrowseMode, 'dynamic' => true ), _t('_bx_events_tab_recent') => array( 'href' => BX_DOL_URL_ROOT . '?bx_events_filter=recent', 'active' => 'recent' == $sBrowseMode, 'dynamic' => true ), _t('_bx_events_tab_top') => array( 'href' => BX_DOL_URL_ROOT . '?bx_events_filter=top', 'active' => 'top' == $sBrowseMode, 'dynamic' => true ), _t('_bx_events_tab_popular') => array( 'href' => BX_DOL_URL_ROOT . '?bx_events_filter=popular', 'active' => 'popular' == $sBrowseMode, 'dynamic' => true ), ) ); }
Homepage block with different events @return html to display on homepage in a block
serviceHomepageBlock
php
boonex/dolphin.pro
modules/boonex/events/classes/BxEventsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/events/classes/BxEventsModule.php
MIT
function serviceProfileBlock($iProfileId) { $iProfileId = (int)$iProfileId; $aProfile = getProfileInfo($iProfileId); bx_import('PageMain', $this->_aModule); $o = new BxEventsPageMain ($this); $o->sUrlStart = getProfileLink($aProfile['ID']) . '?'; return $o->ajaxBrowse( 'user', $this->_oDb->getParam('bx_events_perpage_profile'), array(), process_db_input($aProfile['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), true, false ); }
Profile block with user's events @param $iProfileId profile id @return html to display on homepage in a block
serviceProfileBlock
php
boonex/dolphin.pro
modules/boonex/events/classes/BxEventsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/events/classes/BxEventsModule.php
MIT
function serviceProfileBlockJoined($iProfileId) { $iProfileId = (int)$iProfileId; $aProfile = getProfileInfo($iProfileId); bx_import('PageMain', $this->_aModule); $o = new BxEventsPageMain ($this); $o->sUrlStart = $_SERVER['PHP_SELF'] . '?' . bx_encode_url_params($_GET, array('page')); return $o->ajaxBrowse( 'joined', $this->_oDb->getParam('bx_events_perpage_profile'), array(), process_db_input($aProfile['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), true, false ); }
Profile block with events user joined @param $iProfileId profile id @return html to display on homepage in a block
serviceProfileBlockJoined
php
boonex/dolphin.pro
modules/boonex/events/classes/BxEventsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/events/classes/BxEventsModule.php
MIT
function serviceGetMemberMenuItem() { parent::_serviceGetMemberMenuItem(_t('_bx_events'), _t('_bx_events'), 'calendar'); }
Member menu item for my events @return html to show in member menu
serviceGetMemberMenuItem
php
boonex/dolphin.pro
modules/boonex/events/classes/BxEventsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/events/classes/BxEventsModule.php
MIT
function serviceGetMemberMenuItemAddContent() { if (!$this->isAllowedAdd()) { return ''; } return parent::_serviceGetMemberMenuItem(_t('_bx_events_single'), _t('_bx_events_single'), 'calendar', false, '&bx_events_filter=add_event'); }
Member menu item for adding event @return html to show in member menu
serviceGetMemberMenuItemAddContent
php
boonex/dolphin.pro
modules/boonex/events/classes/BxEventsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/events/classes/BxEventsModule.php
MIT
function serviceGetWallPostComment($aEvent) { $aParams = array( 'txt_privacy_view_event' => 'view_event', 'obj_privacy' => $this->_oPrivacy ); return parent::_serviceGetWallPostComment($aEvent, $aParams); }
DEPRICATED, saved for backward compatibility
serviceGetWallPostComment
php
boonex/dolphin.pro
modules/boonex/events/classes/BxEventsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/events/classes/BxEventsModule.php
MIT
function serviceSetUpcomingEventsOnMap() { if (!$this->_oDb->isModule('wmap')) return; return BxDolService::call('wmap', 'part_update', array( 'events', array( 'join_where' => $this->_getJoinWhereForWMap(), ) )); }
set to display upcoming events only on the map
serviceSetUpcomingEventsOnMap
php
boonex/dolphin.pro
modules/boonex/events/classes/BxEventsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/events/classes/BxEventsModule.php
MIT
function serviceResponseProfileDelete($oAlert) { if (!($iProfileId = (int)$oAlert->iObject)) { return false; } $this->_oDb->deleteMessagesByProfile((int)$iProfileId); return true; }
Delete messages of removed profile @param $oAlert object @return boolean
serviceResponseProfileDelete
php
boonex/dolphin.pro
modules/boonex/shoutbox/classes/BxShoutBoxModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/shoutbox/classes/BxShoutBoxModule.php
MIT
function serviceUpdateObjects($sModuleUri = 'all', $bInstall = true) { $aModules = $sModuleUri == 'all' ? $this->_oDb->getModules() : array($this->_oDb->getModuleByUri($sModuleUri)); foreach ($aModules as $aModule) { if (!BxDolRequest::serviceExists($aModule, 'get_shoutbox_data')) { continue; } if (!($aData = BxDolService::call($aModule['uri'], 'get_shoutbox_data'))) { continue; } if ($bInstall) { $this->_oDb->insertData($aData); } else { $this->_oDb->deleteData($aData); } } $this->_oDb->clearShoutboxObjectsCache(); }
Update shoutbox objects for a module(s)
serviceUpdateObjects
php
boonex/dolphin.pro
modules/boonex/shoutbox/classes/BxShoutBoxModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/shoutbox/classes/BxShoutBoxModule.php
MIT
function serviceGetPaymentData() { return $this->_aModule; }
Integration with Payment module
serviceGetPaymentData
php
boonex/dolphin.pro
modules/boonex/membership/classes/BxMbpModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/membership/classes/BxMbpModule.php
MIT
function serviceGetItems($iVendorId) { $aItems = $this->_oDb->getMembershipsBy(array('type' => 'price_all')); $aResult = array(); foreach($aItems as $aItem) $aResult[] = array( 'id' => $aItem['price_id'], 'vendor_id' => 0, 'title' => $aItem['mem_name'] . ' ' . _t('_membership_txt_on_N_days', $aItem['price_days']), 'description' => $aItem['mem_description'], 'url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'index', 'price' => $aItem['price_amount'], 'duration' => $aItem['price_days'] ); return $aResult; }
Is used in Orders Administration to get all products of the requested seller(vendor). @param integer $iVendorId seller ID. @return array of products.
serviceGetItems
php
boonex/dolphin.pro
modules/boonex/membership/classes/BxMbpModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/membership/classes/BxMbpModule.php
MIT
function serviceGetCartItem($iClientId, $iItemId) { return $this->_getCartItem($iClientId, $iItemId); }
Is used in Shopping Cart to get one product by specified id. @param integer $iClientId client's ID. @param integer $iItemId product's ID. @return array with product description.
serviceGetCartItem
php
boonex/dolphin.pro
modules/boonex/membership/classes/BxMbpModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/membership/classes/BxMbpModule.php
MIT
function serviceUnregisterCartItem($iClientId, $iSellerId, $iItemId, $iItemCount, $sOrderId) {}
Unregister the product purchased earlier. @param integer $iClientId client's ID. @param integer $iSellerId seller's ID. @param integer $iItemId product's ID. @param integer $iItemCount product count. @param string $sOrderId internal order ID.
serviceUnregisterCartItem
php
boonex/dolphin.pro
modules/boonex/membership/classes/BxMbpModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/membership/classes/BxMbpModule.php
MIT
function getBlockCode_OwnerBlock() { if(!$this -> aPollInfo) { return MsgBox( _t('_Empty') ); } return $this -> oModule -> getOwnerBlock($this -> aPollInfo['id_profile'], $this -> aPollInfo); }
The function will generate the block of the polls owner
getBlockCode_OwnerBlock
php
boonex/dolphin.pro
modules/boonex/poll/classes/BxPollView.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/poll/classes/BxPollView.php
MIT
function getFieldAction($sAction) { return 'Allow' . str_replace(' ', '', ucwords(str_replace('_', ' ', $sAction))); }
Get database field name for action. @param string $sAction action name. @return string with field name.
getFieldAction
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsPrivacy.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsPrivacy.php
MIT
function getAdsByDate($iCatSubcatID, $sLimitAddon, $bSub = false) { $sWhereAdd = ($bSub) ? "`{$this->_oConfig->sSQLSubcatTable}`" : "`{$this->_oConfig->sSQLCatTable}`"; $sTimeRestriction = ($this->_oConfig->bAdminMode == true) ? '' : "AND UNIX_TIMESTAMP() - `{$this->_oConfig->sSQLPostsTable}`.`LifeTime`*24*60*60 < `{$this->_oConfig->sSQLPostsTable}`.`DateTime`"; $sSQL = " SELECT `{$this->_oConfig->sSQLPostsTable}`.* , `{$this->_oConfig->sSQLCatTable}`.`Name`, `{$this->_oConfig->sSQLCatTable}`.`Description`, `{$this->_oConfig->sSQLCatTable}`.`Unit1`, `{$this->_oConfig->sSQLCatTable}`.`Unit2`, (UNIX_TIMESTAMP() - `{$this->_oConfig->sSQLPostsTable}`.`DateTime`) AS 'sec', `{$this->_oConfig->sSQLPostsTable}`.`DateTime` AS 'DateTime_UTS' FROM `{$this->_oConfig->sSQLPostsTable}` INNER JOIN `{$this->_oConfig->sSQLSubcatTable}` ON `{$this->_oConfig->sSQLPostsTable}`.`IDClassifiedsSubs` = `{$this->_oConfig->sSQLSubcatTable}`.`ID` INNER JOIN `{$this->_oConfig->sSQLCatTable}` ON `{$this->_oConfig->sSQLSubcatTable}`.`IDClassified` = `{$this->_oConfig->sSQLCatTable}`.`ID` WHERE {$sWhereAdd}.`ID` = '{$iCatSubcatID}' {$sTimeRestriction} ORDER BY `{$this->_oConfig->sSQLPostsTable}`.`DateTime` DESC ".$sLimitAddon; $vSqlRes = db_res ($sSQL); return $vSqlRes; }
SQL Get all Advertisement data, units take into mind LifeDate of Adv @param $iClsID @param $sAddon - string addon of Limits (for pagination) @param $bSub - present that current ID is SubCategory @return SQL data
getAdsByDate
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsDb.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsDb.php
MIT
function actionSearch() { global $aPreValues; $this->isAllowedSearch(true); // perform action $sCategory = (int)bx_get('FilterCat'); $sSubCategory = (int)bx_get('FilterSubCat'); $sCountry = process_db_input(bx_get('FilterCountry'), BX_TAGS_STRIP); $sCountry = (isset($aPreValues['Country'][$sCountry]) == true) ? $sCountry : ''; $sKeywords = process_db_input(bx_get('FilterKeywords'), BX_TAGS_STRIP); $sSubCats = ''; if ($sSubCategory <= 0) { if ($sCategory > 0) { $aSubCats = array(); $vSubCats = $this->_oDb->getAllSubCatsInfo($sCategory); while ($aSubCat = $vSubCats->fetch()) { $aSubCats[] = (int)$aSubCat['ID']; } sort($aSubCats); if (count($aSubCats) > 0) { $sSubCats = "`{$this->_oConfig->sSQLSubcatTable}`.`ID` IN (" . implode(",", $aSubCats) . ")"; } else { return $oFunctions->MsgBox(_t('_SubCategory is required')); } } } $sCustomFieldCaption1 = process_db_input(bx_get('CustomFieldCaption1'), BX_TAGS_STRIP); $sCustomFieldCaption2 = process_db_input(bx_get('CustomFieldCaption2'), BX_TAGS_STRIP); require_once($this->_oConfig->getClassPath() . 'BxAdsSearchUnit.php'); $oTmpAdsSearch = new BxAdsSearchUnit(); $oTmpAdsSearch->aCurrent['paginate']['perPage'] = 10; $oTmpAdsSearch->aCurrent['sorting'] = 'last'; if ($sCategory > 0) { $oTmpAdsSearch->aCurrent['restriction']['categoryID']['value'] = $sCategory; } if (count($aSubCats) > 0) { $oTmpAdsSearch->aCurrent['third_restr'] = "`{$this->_oConfig->sSQLSubcatTable}`.`ID` IN (" . implode(",", $aSubCats) . ")"; } else { if ($sSubCategory > 0) { $oTmpAdsSearch->aCurrent['restriction']['subcategoryID']['value'] = $sSubCategory; } } if ($sCountry != '') { $oTmpAdsSearch->aCurrent['restriction']['country']['value'] = $sCountry; } if ($sKeywords != '') { $oTmpAdsSearch->aCurrent['restriction']['message_filter']['value'] = $sKeywords; } $oTmpAdsSearch->aCurrent['restriction']['categoryID']['value'] = $iSafeCatID; $sFilteredAds = $oTmpAdsSearch->displayResultBlock(); if ($oTmpAdsSearch->aCurrent['paginate']['totalNum'] == 0) { $sFilteredAds = MsgBox(_t('_Empty')); } else { // Prepare link to pagination $sRequest = bx_html_attribute($_SERVER['PHP_SELF']) . '?'; foreach ($_GET as $sKey => $sValue) { $sRequest .= '&' . $sKey . '=' . $sValue; } $sRequest .= '&page={page}&per_page={per_page}'; // End of prepare link to pagination $oTmpAdsSearch->aCurrent['paginate']['page_url'] = $sRequest; $sPagination = $oTmpAdsSearch->showPagination(); } $sFilterForm = $this->PrintFilterForm(); $sCode = DesignBoxContent(_t('_SEARCH_RESULT_H'), $sFilterForm . $sFilteredAds . $sPagination, 1); $sJS = <<<EOF <script language="JavaScript" type="text/javascript"> <!-- var sAdsSiteUrl = "{$this->sHomeUrl}"; --> </script> EOF; //--------------------------- output ------------------------------------------- $this->aPageTmpl['header'] = _t('_bx_ads_Filter'); $this->aPageTmpl['css_name'] = array('ads.css', 'twig.css'); $this->aPageTmpl['js_name'] = array('main.js'); $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sJS . $sCode)); }
Generate array of filtered Advertisements @return HTML presentation of data
actionSearch
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function PrintCommandForms() { $sAdsLink = ($this->bUseFriendlyLinks) ? 'ads/' : $this->sCurrBrowsedFile; $this->_oTemplate->addJs('main.js'); return <<<EOF <script language="JavaScript" type="text/javascript"> <!-- var sAdsSiteUrl = "{$this->sHomeUrl}"; --> </script> <form action="{$sAdsLink}" method="post" name="command_activate_advertisement"> <input type="hidden" name="ActivateAdvertisementID" id="ActivateAdvertisementID" value="" /> <input type="hidden" name="ActType" id="ActType" value="" /> </form> <form action="{$sAdsLink}" method="post" name="command_delete_advertisement"> <input type="hidden" name="DeleteAdvertisementID" id="DeleteAdvertisementID" value="" /> </form> EOF; }
Generate common forms and includes js @return HTML presentation of data
PrintCommandForms
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function parseUploadedFiles() { $sCurrentTime = time(); if ($_FILES) { $aIDs = array(); for ($i = 0; $i < count($_FILES['userfile']['tmp_name']); $i++) { if ($_FILES['userfile']['error'][$i]) { continue; } if ($_FILES['userfile']['size'][$i] > $this->iMaxUplFileSize) { echo _t_err('_bx_ads_Warn_max_file_size', $_FILES['userfile']['name'][$i]); continue; } list($width, $height, $type, $attr) = getimagesize($_FILES['userfile']['tmp_name'][$i]); if ($type != 1 && $type != 2 && $type != 3) { continue; } $sBaseName = $this->_iVisitorID . '_' . $sCurrentTime . '_' . ($i + 1); $sExt = strrchr($_FILES['userfile']['name'][$i], '.'); $sExt = strtolower(trim($sExt)); $sImg = BX_DIRECTORY_PATH_ROOT . "{$this->sUploadDir}img_{$sBaseName}{$sExt}"; $sImgThumb = BX_DIRECTORY_PATH_ROOT . "{$this->sUploadDir}thumb_{$sBaseName}{$sExt}"; $sImgThumbBig = BX_DIRECTORY_PATH_ROOT . "{$this->sUploadDir}big_thumb_{$sBaseName}{$sExt}"; $sImgIcon = BX_DIRECTORY_PATH_ROOT . "{$this->sUploadDir}icon_{$sBaseName}{$sExt}"; $vResizeRes = imageResize($_FILES['userfile']['tmp_name'][$i], $sImg, $this->iImgSize, $this->iImgSize); $vThumbResizeRes = imageResize($_FILES['userfile']['tmp_name'][$i], $sImgThumb, $this->iThumbSize, $this->iThumbSize); $vBigThumbResizeRes = imageResize($_FILES['userfile']['tmp_name'][$i], $sImgThumbBig, $this->iBigThumbSize, $this->iBigThumbSize); $vIconResizeRes = imageResize($_FILES['userfile']['tmp_name'][$i], $sImgIcon, $this->iIconSize, $this->iIconSize); if ($vResizeRes || $vThumbResizeRes || $vBigThumbResizeRes || $vIconResizeRes) { echo _t_err("_ERROR_WHILE_PROCESSING"); continue; } $iImgId = $this->_oDb->insertMedia($this->_iVisitorID, $sBaseName, $sExt); if (!$iImgId) { @unlink($sImg); @unlink($sImgThumb); @unlink($sImgThumbBig); @unlink($sImgIcon); continue; } $aIDs[] = $iImgId; } return implode(',', $aIDs); }
Parsing uploaded files, store its with temp names, fill data into SQL tables @param $iMemberID current member ID @return Text presentation of data (enum ID`s)
parseUploadedFiles
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function getMemberAds($iOtherProfileID = 0, $iRandLim = 0, $iExceptUnit = 0) { $sBrowseAllAds = _t('_bx_ads_Browse_All_Ads'); $sUserListC = _t('_bx_ads_Users_other_listing'); $sHomeLink = ($this->bUseFriendlyLinks) ? BX_DOL_URL_ROOT . 'ads/' : "{$this->sCurrBrowsedFile}?Browse=1"; $sSiteUrl = BX_DOL_URL_ROOT; $sBreadCrumbs = <<<EOF <div class="paginate bx-def-padding-left bx-def-padding-right"> <div class="view_all"> <a href="{$sHomeLink}">{$sBrowseAllAds}</a> </div> </div> EOF; require_once($this->_oConfig->getClassPath() . 'BxAdsSearchUnit.php'); $oTmpAdsSearch = new BxAdsSearchUnit(); if ($iRandLim > 0) { $oTmpAdsSearch->aCurrent['paginate']['perPage'] = (int)$iRandLim; } else { $oTmpAdsSearch->aCurrent['paginate']['perPage'] = 10; } $oTmpAdsSearch->aCurrent['sorting'] = 'last'; $oTmpAdsSearch->aCurrent['restriction']['owner']['value'] = $iOtherProfileID; if ($iExceptUnit > 0) { $oTmpAdsSearch->aCurrent['restriction']['id']['value'] = $iExceptUnit; $oTmpAdsSearch->aCurrent['restriction']['id']['operator'] = '!='; } $sMemberAds = $oTmpAdsSearch->displayResultBlock(); if ($oTmpAdsSearch->aCurrent['paginate']['totalNum'] == 0) { $sMemberAds = MsgBox(_t('_Empty')); } if ($iRandLim == 0) { $GLOBALS['oTopMenu']->setCurrentProfileID($iOtherProfileID); return DesignBoxContent($sUserListC, $sMemberAds . $sBreadCrumbs, 1); } return $sMemberAds; }
Generate list of My Advertisements @return HTML presentation of data
getMemberAds
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function PrintAllSubRecords($iClassifiedID) { $iSafeCatID = (int)$iClassifiedID; $sSiteUrl = BX_DOL_URL_ROOT; require_once($this->_oConfig->getClassPath() . 'BxAdsSearchUnit.php'); $oTmpAdsSearch = new BxAdsSearchUnit(); $oTmpAdsSearch->aCurrent['paginate']['perPage'] = 10; $oTmpAdsSearch->aCurrent['sorting'] = 'last'; $oTmpAdsSearch->aCurrent['restriction']['categoryID']['value'] = $iSafeCatID; $sCategoryAds = $oTmpAdsSearch->displayResultBlock(); if ($oTmpAdsSearch->aCurrent['paginate']['totalNum'] == 0) { $sCategoryAds = MsgBox(_t('_Empty')); } else { // Prepare link to pagination if ($this->bUseFriendlyLinks == false) { //old variant $sRequest = bx_html_attribute($_SERVER['PHP_SELF']) . '?bClassifiedID=' . $iSafeCatID . '&page={page}&per_page={per_page}'; } else { $sRequest = BX_DOL_URL_ROOT . 'ads/all/cat/'; $sPaginAddon = '/' . process_db_input(bx_get('catUri'), BX_TAGS_STRIP); $sRequest .= '{per_page}/{page}' . $sPaginAddon; } // End of prepare link to pagination $oTmpAdsSearch->aCurrent['paginate']['page_url'] = $sRequest; $sCategoryAds .= $oTmpAdsSearch->showPagination(); } // Breadcrumb creating $sBrowseAllAds = _t('_bx_ads_Browse_All_Ads'); $sHomeLink = ($this->bUseFriendlyLinks) ? BX_DOL_URL_ROOT . 'ads/' : "{$this->sCurrBrowsedFile}?Browse=1"; $sNameCat = $this->_oDb->getCategoryNameByID($iSafeCatID); $sBreadCrumbs = <<<EOF <div class="breadcrumbs"> <a href="{$sHomeLink}">{$sBrowseAllAds}</a> <span class="bullet">&#8594;</span> <span class="active_link">{$sNameCat}</span> </div> EOF; // End of Breadcrumb creating $sFilter = $this->PrintFilterForm($iClassifiedID); $sCategoryAdsPageContent = DesignBoxContent($sBreadCrumbs, $sFilter . $sCategoryAds, 1); return $sCategoryAdsPageContent; }
Generate array of Advertisements of some Classified @param $iClassifiedID ID of Classified @return HTML presentation of data
PrintAllSubRecords
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function PrintSubRecords($iIDClassifiedsSubs) { $iIDClassifiedsSubs = (int)$iIDClassifiedsSubs; $sSiteUrl = BX_DOL_URL_ROOT; require_once($this->_oConfig->getClassPath() . 'BxAdsSearchUnit.php'); $oTmpAdsSearch = new BxAdsSearchUnit(); $oTmpAdsSearch->aCurrent['paginate']['perPage'] = 10; $oTmpAdsSearch->aCurrent['sorting'] = 'last'; $oTmpAdsSearch->aCurrent['restriction']['subcategoryID']['value'] = $iIDClassifiedsSubs; $sSubAds = $oTmpAdsSearch->displayResultBlock(); if ($oTmpAdsSearch->aCurrent['paginate']['totalNum'] == 0) { $sSubAds = MsgBox(_t('_Empty')); } else { // Prepare link to pagination if ($this->bUseFriendlyLinks == false) { //old variant $sRequest = bx_html_attribute($_SERVER['PHP_SELF']) . '?bSubClassifiedID=' . $iIDClassifiedsSubs . '&page={page}&per_page={per_page}'; } else { $sRequest = BX_DOL_URL_ROOT . 'ads/all/subcat/'; $sPaginAddon = '/' . process_db_input(bx_get('scatUri'), BX_TAGS_STRIP); $sRequest .= '{per_page}/{page}' . $sPaginAddon; } // End of prepare link to pagination $oTmpAdsSearch->aCurrent['paginate']['page_url'] = $sRequest; $sSubAds .= $oTmpAdsSearch->showPagination(); } // Breadcrumb creating $aSubcatRes = $this->_oDb->getCatAndSubInfoBySubID($iIDClassifiedsSubs); $sCaption = "<div class=\"fl\">{$aSubcatRes['Name']}->{$aSubcatRes['NameSub']}</div>\n"; $sDesc = "<div class=\"cls_result_row\">{$aSubcatRes['Description']}</div>"; $sHomeLink = ($this->bUseFriendlyLinks) ? BX_DOL_URL_ROOT . 'ads/' : "{$this->sCurrBrowsedFile}?Browse=1"; $sCategLink = ($this->bUseFriendlyLinks) ? BX_DOL_URL_ROOT . 'ads/cat/' . $aSubcatRes['CEntryUri'] : "{$this->sCurrBrowsedFile}?bClassifiedID={$aSubcatRes['ClassifiedsID']}"; $sBrowseAllAds = _t('_bx_ads_Browse_All_Ads'); $sBreadCrumbs = <<<EOF <div class="breadcrumbs"> <a href="{$sHomeLink}">{$sBrowseAllAds}</a> <span class="bullet">&#8594;</span> <a href="{$sCategLink}">{$aSubcatRes['Name']}</a> <span class="bullet">&#8594;</span> <span class="active_link">{$aSubcatRes['NameSub']}</span> </div> EOF; // End of Breadcrumb creating $sFilter = $this->PrintFilterForm(0, $iIDClassifiedsSubs); $sSubPageContent = DesignBoxContent($sBreadCrumbs, $sFilter . $sSubAds, 1); return $sSubPageContent; }
Generate array of Advertisements of some SubClassified @param $iIDClassifiedsSubs ID of SubClassified @return HTML presentation of data
PrintSubRecords
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function getAdsMainPage() { if (!$this->isAllowedBrowse()) { return $this->_oTemplate->displayAccessDenied(); } bx_import('PageHome', $this->_aModule); $oAdsPageHome = new BxAdsPageHome($this); return $oAdsPageHome->getCode(); }
Generate array of Classified in lists doubled form @return HTML presentation of data
getAdsMainPage
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function PrintFilterForm($iClassifiedID = 0, $iSubClassifiedID = 0) { global $aPreValues; if (!$this->isAllowedSearch()) { return; } $sCategoriesC = _t('_bx_ads_Categories'); $sViewAllC = _t('_View All'); $iClassifiedID = (false !== bx_get('FilterCat') && (int)bx_get('FilterCat') > 0) ? (int)bx_get('FilterCat') : (int)$iClassifiedID; $iSubClassifiedID = (false !== bx_get('FilterSubCat') && (int)bx_get('FilterSubCat') > 0) ? (int)bx_get('FilterSubCat') : (int)$iSubClassifiedID; $sCountry = process_db_input(bx_get('FilterCountry'), BX_TAGS_STRIP); $sCountry = (isset($aPreValues['Country'][$sCountry]) == true) ? $sCountry : -1; $sKeywords = process_db_input(bx_get('FilterKeywords'), BX_TAGS_STRIP); $iFilterStyleHeight = 38; $sSubDspStyle = ($sCategorySub != "") ? '' : 'none'; $sClassifiedsOptions = ''; $vSqlRes = $this->_oDb->getAllCatsInfo(); if (!$vSqlRes) { return _t('_Error Occured'); } while ($aSqlResStr = $vSqlRes->fetch()) { $sClassifiedsOptions .= "<option value=\"{$aSqlResStr['ID']}\"" . (($aSqlResStr['ID'] == $iClassifiedID) ? " selected" : '') . ">{$aSqlResStr['Name']}</option>\n"; }
Generate Filter form with ability of searching by Category, Country and keyword (in Subject and Message) @return HTML presentation of form
PrintFilterForm
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function getManageClassifiedsForm($iCategoryID = 0, $bOnlyForm = false) { $sAction = 'add_main_category'; $sTitle = $sDescription = ''; $sCustomName1 = $sCustomName2 = $sUnit = $sUnit2 = $sPicture = ''; if ($iCategoryID) { $aCatInfos = $this->_oDb->getCatInfo($iCategoryID); $sTitle = $aCatInfos[0]['Name']; $sDescription = $aCatInfos[0]['Description']; $sCustomName1 = $aCatInfos[0]['CustomFieldName1']; $sCustomName2 = $aCatInfos[0]['CustomFieldName2']; $sUnit = $aCatInfos[0]['Unit1']; $sUnit2 = $aCatInfos[0]['Unit2']; $sPicture = $aCatInfos[0]['Picture']; } //adding form $aForm = array( 'form_attrs' => array( 'name' => 'create_main_cats_form', 'action' => $this->sCurrBrowsedFile, 'method' => 'post', ), 'params' => array( 'db' => array( 'table' => $this->_oConfig->sSQLCatTable, 'key' => 'ID', 'submit_name' => 'add_button', ), ), 'inputs' => array( 'action' => array( 'type' => 'hidden', 'name' => 'action', 'value' => $sAction, ), 'Name' => array( 'type' => 'text', 'name' => 'Name', 'caption' => _t('_Title'), 'required' => true, 'value' => $sTitle, 'checker' => array( 'func' => 'length', 'params' => array(3, 64), 'error' => _t('_bx_ads_title_error_desc', 64), ), 'db' => array( 'pass' => 'Xss', ), ), 'Description' => array( 'type' => 'text', 'name' => 'Description', 'caption' => _t('_Description'), 'required' => true, 'value' => $sDescription, 'checker' => array( 'func' => 'length', 'params' => array(3, 128), 'error' => _t('_bx_ads_description_error_desc', 128), ), 'db' => array( 'pass' => 'Xss', ), ), 'CustomFieldName1' => array( 'type' => 'text', 'name' => 'CustomFieldName1', 'caption' => _t('_bx_ads_customFieldName1'), 'required' => false, 'value' => $sCustomName1, 'db' => array( 'pass' => 'Xss', ), ), 'Unit1' => array( 'type' => 'text', 'name' => 'Unit1', 'caption' => _t('_bx_ads_Unit') . ' 1', 'required' => false, 'value' => $sUnit, 'db' => array( 'pass' => 'Xss', ), ), 'CustomFieldName2' => array( 'type' => 'text', 'name' => 'CustomFieldName2', 'caption' => _t('_bx_ads_customFieldName2'), 'required' => false, 'value' => $sCustomName2, 'db' => array( 'pass' => 'Xss', ), ), 'Unit2' => array( 'type' => 'text', 'name' => 'Unit2', 'caption' => _t('_bx_ads_Unit') . ' 2', 'required' => false, 'value' => $sUnit2, 'db' => array( 'pass' => 'Xss', ), ), 'Picture' => array( 'type' => 'text', 'name' => 'Picture', 'caption' => _t('_Picture'), 'info' => _t('_In') . ' \modules\boonex\ads\templates\base\images\icons\'', 'value' => $sPicture, 'db' => array( 'pass' => 'Xss', ), ), 'add_button' => array( 'type' => 'submit', 'name' => 'add_button', 'value' => ($iCategoryID) ? _t('_Edit') : _t('_bx_ads_add_main_category'), ), ), ); if ($iCategoryID) { $aForm['inputs']['hidden_postid'] = array( 'type' => 'hidden', 'name' => 'id', 'value' => $iCategoryID, ); } $sCode = ''; $oForm = new BxTemplFormView($aForm); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $aValsAdd = array(); if ($iCategoryID == 0) { $sCategUri = uriGenerate(bx_get('Name'), $this->_oConfig->sSQLCatTable, 'CEntryUri'); $aValsAdd['CEntryUri'] = $sCategUri; } $iLastId = -1; if ($iCategoryID > 0) { $oForm->update($iCategoryID, $aValsAdd); $iLastId = $iCategoryID; } else { $iLastId = $oForm->insert($aValsAdd); } if ($iLastId > 0) { $sCode = MsgBox(_t('_bx_ads_Main_category_successfully_added'), 3); } else { $sCode = MsgBox(_t('_bx_ads_Main_category_failed_add'), 3); } } if ($bOnlyForm) { return $sCode . $oForm->getCode(); } $sActions = array( 'add_subcat' => array( 'href' => 'javascript: void(0);', 'title' => _t('_bx_ads_add_subcategory'), 'onclick' => 'loadHtmlInPopup(\'ads_add_sub_category\', \'modules/boonex/ads/post_mod_ads.php?action=add_sub_category\');', 'active' => 0 ), 'manager' => array( 'href' => 'javascript: void(0);', 'title' => _t('_bx_ads_category_manager'), 'onclick' => 'loadHtmlInPopup(\'ads_category_manager\', \'modules/boonex/ads/post_mod_ads.php?action=category_manager\');', 'active' => 0 ) ); return DesignBoxAdmin(_t('_bx_ads_Manage_categories_form'), $sCode . $oForm->getCode(), $sActions, '', 11); }
Compose Form to managing with Classifieds, subs, and custom fields @return HTML presentation of data
getManageClassifiedsForm
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function PrintAdvertisementsByTag($sTag) { $sSiteUrl = BX_DOL_URL_ROOT; $sSafeTag = addslashes(trim(strtolower($sTag))); $sTagResultC = _t('_bx_ads_search_results_by_tag'); $sBrowseAllAds = _t('_bx_ads_Browse_All_Ads'); $sHomeLink = ($this->bUseFriendlyLinks) ? BX_DOL_URL_ROOT . 'ads/' : "{$this->sCurrBrowsedFile}?Browse=1"; $sBreadCrumbs = <<<EOF <a href="{$sHomeLink}">{$sBrowseAllAds}</a> / {$sTagResultC} - {$sSafeTag} EOF; require_once($this->_oConfig->getClassPath() . 'BxAdsSearchUnit.php'); $oTmpAdsSearch = new BxAdsSearchUnit(); if ($iRandLim > 0) { $oTmpAdsSearch->aCurrent['paginate']['perPage'] = (int)$iRandLim; } else { $oTmpAdsSearch->aCurrent['paginate']['perPage'] = 10; } $oTmpAdsSearch->aCurrent['sorting'] = 'last'; $oTmpAdsSearch->aCurrent['restriction']['tag']['value'] = $sSafeTag; $sAdsByTags = $oTmpAdsSearch->displayResultBlock(); if ($oTmpAdsSearch->aCurrent['paginate']['totalNum'] == 0) { $sAdsByTags = MsgBox(_t('_Empty')); } else { // Prepare link to pagination $sSafeTagS = title2uri($sSafeTag); if ($this->bUseFriendlyLinks == false) { $sRequest = $this->sHomeUrl . "classifieds_tags.php?tag={$sSafeTagS}&page={page}&per_page={per_page}"; } else { $sRequest = BX_DOL_URL_ROOT . "ads/tag/{$sSafeTagS}/{per_page}/{page}"; } // End of prepare link to pagination $oTmpAdsSearch->aCurrent['paginate']['page_url'] = $sRequest; $sAdsByTags .= $oTmpAdsSearch->showPagination(); } return DesignBoxContent($sBreadCrumbs, $sAdsByTags, 1); }
Compose result of searching Advertisements by Tag @param $sTag selected tag string @return HTML result
PrintAdvertisementsByTag
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function GenTagsPage() { bx_import('BxTemplTagsModule'); $aParam = array( 'type' => 'ad', 'orderby' => 'popular' ); $oTags = new BxTemplTagsModule($aParam, _t('_all'), BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'tags'); return $oTags->getCode(); }
New implementation of Tags page @return html
GenTagsPage
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function serviceAdsIndexPage() { require_once($this->_oConfig->getClassPath() . 'BxAdsSearchUnit.php'); $oTmpAdsSearch = new BxAdsSearchUnit(); $oTmpAdsSearch->aCurrent['paginate']['perPage'] = 4; $oTmpAdsSearch->aCurrent['sorting'] = 'last'; //privacy changes $oTmpAdsSearch->aCurrent['restriction']['allow_view']['value'] = $this->_iVisitorID ? array( BX_DOL_PG_ALL, BX_DOL_PG_MEMBERS ) : array(BX_DOL_PG_ALL); $sPostPagination = ''; $sAllAds = $oTmpAdsSearch->displayResultBlock(); if ($oTmpAdsSearch->aCurrent['paginate']['totalNum'] > 0) { $sPostPagination = $oTmpAdsSearch->showPagination2(); $aMenu = $oTmpAdsSearch->displayMenu(); return array($sAllAds, $aMenu[0], $sPostPagination); } }
Ads block for index page (as PHP function). List of latest ads. @return html of last ads units
serviceAdsIndexPage
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function serviceAdsProfilePage($_iProfileID) { $GLOBALS['oTopMenu']->setCurrentProfileID($_iProfileID); bx_import('SearchUnit', $this->_aModule); $oTmpAdsSearch = new BxAdsSearchUnit(); $oTmpAdsSearch->aCurrent['paginate']['perPage'] = 10; $oTmpAdsSearch->aCurrent['sorting'] = 'last'; $oTmpAdsSearch->aCurrent['restriction']['owner']['value'] = $_iProfileID; $sMemberAds = $oTmpAdsSearch->displayResultBlock(); if ($oTmpAdsSearch->aCurrent['paginate']['totalNum'] > 0) { $sClr = '<div class="clear_both"></div>'; if ($oTmpAdsSearch->aCurrent['paginate']['perPage'] < $oTmpAdsSearch->aCurrent['paginate']['totalNum']) { $sAjLink = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'get_list/'; bx_import('BxDolPaginate'); $sBoxId = 'ads_' . $_iProfileID . '_view'; $oPgn = new BxDolPaginate(array( 'page_url' => 'javascript:void();', 'count' => $oTmpAdsSearch->aCurrent['paginate']['totalNum'], 'per_page' => $oTmpAdsSearch->aCurrent['paginate']['perPage'], 'page' => $oTmpAdsSearch->aCurrent['paginate']['page'], 'on_change_page' => "getHtmlData('$sBoxId', '{$sAjLink}view/{$_iProfileID}&page={page}&per_page={per_page}');", 'on_change_per_page' => "getHtmlData('$sBoxId', '{$sAjLink}view/{$_iProfileID}&page=1&per_page=' + this.value);" )); $sMemberAds = '<div id="' . $sBoxId . '">' . $sMemberAds . $sClr . $oPgn->getPaginate() . '</div>'; } return <<<EOF <div class="clear_both"></div> <div class="dbContent"> {$sMemberAds} {$sClr} </div> EOF; } }
Ads block for profile page (as PHP function). List of latest ads of member. @param $_iProfileID - member id @return html of last ads units
serviceAdsProfilePage
php
boonex/dolphin.pro
modules/boonex/ads/classes/BxAdsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/ads/classes/BxAdsModule.php
MIT
function serviceResponseContent($oAlert) { $oResponse = new BxSpyResponseContent($this); $oResponse -> response($oAlert); }
SERVICE METHODS Process alert. @param BxDolAlerts $oAlert an instance with accured alert.
serviceResponseContent
php
boonex/dolphin.pro
modules/boonex/spy/classes/BxSpyModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/spy/classes/BxSpyModule.php
MIT
function _getSpyBlock($aVars) { if(!isset($aVars['active'])) $aVars['active'] = false; if(!isset($aVars['dynamic'])) $aVars['dynamic'] = bx_get('dynamic') !== false; if(!isset($aVars['type'])) $aVars['type'] = bx_get('type') !== false ? bx_get('type') : 'all'; if(!isset($aVars['page_ajax'])) $aVars['page_ajax'] = true; if(!isset($aVars['page'])) $aVars['page'] = bx_get('page') !== false ? (int) bx_get('page') : 1; $aVars['page']= $aVars['page'] > 0 ? $aVars['page'] : 1; //-- set search filter --// $this -> oSearch -> aCurrent['restriction']['viewed']['value'] = ''; if($aVars['type'] != 'all') $this -> oSearch -> aCurrent['restriction']['type']['value'] = process_db_input($aVars['type'], BX_TAGS_STRIP); switch($this->sSpyMode) { case 'friends_events': $this -> oSearch -> aCurrent['join']['friends_data'] = array( 'type' => 'INNER', 'table' => $this -> _oDb -> sTablePrefix . 'friends_data', 'mainField' => 'id', 'onField' => 'event_id', 'joinFields' => array(), ); $this -> oSearch -> aCurrent['restriction']['friends']['value'] = $aVars['profile']; $this -> oSearch -> aCurrent['restriction']['no_my']['value'] = $aVars['profile']; break; default: //--- get only member's activity ---// if($aVars['profile']) $this -> oSearch -> aCurrent['restriction']['only_me']['value'] = $aVars['profile']; } //-- get data --// $aActivites = $this -> oSearch -> getSearchData(); $sActivites = $this -> _proccesActivites($aActivites); $sOutputCode = $this->_oTemplate->getWrapper($this -> sEventsWrapper, $aActivites ? $sActivites : MsgBox(_t('_Empty'))); //-- process pagination URL --// $sPaginate = ''; if($this -> oSearch -> aCurrent['paginate']['totalNum'] > $this -> _oConfig -> iPerPage) { $aVars['page_url'] .= (strpos($aVars['page_url'], '?') === false ? '?' : '&amp;') . 'type=' . $aVars['type'] . '&page={page}&per_page={per_page}'; $sOnClick = ''; if($aVars['page_ajax']) $sOnClick = 'return !loadDynamicBlock({id}, \'' . $aVars['page_url'] . '\')'; $oPaginate = new BxDolPaginate(array( 'page_url' => $aVars['page_url'], 'count' => $this -> oSearch -> aCurrent['paginate']['totalNum'], 'per_page' => $this -> _oConfig -> iPerPage, 'page' => $aVars['page'], 'on_change_page' => $sOnClick, )); $sPaginate = $oPaginate -> getSimplePaginate(null, -1, -1, false); } if($aVars['dynamic']) header('Content-Type: text/html; charset=utf-8'); else $this ->_oTemplate->addCss('spy.css'); //-- check init part --// if($aVars['page'] == 1) $sOutputCode = $this -> getInitPart($aVars['type'], $aVars['profile'], $aVars['active']) . $sOutputCode; return array($sOutputCode, array(), $sPaginate, true); }
Generate spy block @param $aVars array $aVars[type] - string $aVars[page_url] - string $aVars[page] - integer $aVars[profile] - integer @return array
_getSpyBlock
php
boonex/dolphin.pro
modules/boonex/spy/classes/BxSpyModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/spy/classes/BxSpyModule.php
MIT
function response($oAlert) { $sKey = $oAlert->sUnit . '_' . $oAlert->sAction; $iCommentId = 0; switch($oAlert->sAction) { case 'delete': case 'delete_poll': case 'delete_post': $this->_oModule->_oDb->deleteActivityByObject($oAlert->sUnit, $oAlert->iObject); return; case 'commentPost': if(!isset($oAlert->aExtras['comment_id']) || (int)$oAlert->aExtras['comment_id'] == 0) return; $iCommentId = (int)$oAlert->aExtras['comment_id']; break; case 'commentRemoved': if(!isset($oAlert->aExtras['comment_id']) || (int)$oAlert->aExtras['comment_id'] == 0) return; $this->_oModule->_oDb->deleteActivityByObject($oAlert->sUnit, $oAlert->iObject, (int)$oAlert->aExtras['comment_id']); return; } // call defined method; if(!is_array($this -> aInternalHandlers) || !array_key_exists($sKey, $this -> aInternalHandlers)) return; if(!BxDolRequest::serviceExists($this -> aInternalHandlers[$sKey]['module_uri'], $this -> aInternalHandlers[$sKey]['module_method'])) return; // define functions parameters; $aParams = array( 'action' => $oAlert->sAction, 'object_id' => $oAlert->iObject, 'sender_id' => $oAlert->iSender, 'extra_params' => $oAlert->aExtras, ); $aResult = BxDolService::call($this->aInternalHandlers[$sKey]['module_uri'], $this->aInternalHandlers[$sKey]['module_method'], $aParams); if(empty($aResult)) return; // create new event; // define recipent id; $iRecipientId = isset($aResult['recipient_id']) ? $aResult['recipient_id'] : $oAlert -> iObject; if(isset($aResult['spy_type']) && $aResult['spy_type'] == 'content_activity' && $iRecipientId == $oAlert->iSender) $iRecipientId = 0; $iEventId = 0; if($oAlert->iSender || (!$oAlert->iSender && $this->_oModule->_oConfig->bTrackGuestsActivites)) $iEventId = $this->_oModule->_oDb->createActivity( $oAlert->sUnit, $oAlert->sAction, $oAlert->iObject, $iCommentId, $oAlert->iSender, $iRecipientId, $aResult ); if(!$iEventId) return; // try to define all profile's friends; $aFriends = getMyFriendsEx($oAlert->iSender); if(empty($aFriends) || !is_array($aFriends)) return; // attach event to friends; foreach($aFriends as $iFriendId => $aItems) $this->_oModule->_oDb->attachFriendEvent($iEventId, $oAlert->iSender, $iFriendId); }
Overwtire the method of parent class. @param BxDolAlerts $oAlert an instance of alert.
response
php
boonex/dolphin.pro
modules/boonex/spy/classes/BxSpyResponseContent.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/spy/classes/BxSpyResponseContent.php
MIT
function getUnit(&$aData) { $iPostID = (int)$aData['PostID']; $sPostUri = $aData['PostUri']; $sName = $aData['PostCaption']; $sUrl = $this->oBlogsModule->genUrl($iPostID, $sPostUri, 'entry'); return <<<EOF <div style="width:95%;"> <a title="{$sName}" href="{$sUrl}">{$sName}</a> </div> EOF; }
return html for data unit for some day, it is: - icon 32x32 with link if data have associated image, use $GLOBALS['oFunctions']->sysIcon() to return small icon - data title with link if data have no associated image
getUnit
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsCalendar.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsCalendar.php
MIT
function GenCommandForms() { $this->_oTemplate->addJs('main.js'); }
Generate common forms and includes js @return void
GenCommandForms
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function GenPostListMobile($iAuthor = 0, $sMode = false) { if ($this->_iVisitorID) // some workaround for mobile apps, to force login { bx_login($this->_iVisitorID); } bx_import('BxDolMobileTemplate'); $oMobileTemplate = new BxDolMobileTemplate($this->_oConfig, $this->_oDb); $oMobileTemplate->pageStart(); echo $oMobileTemplate->addCss('blogs_common.css', 1); $iPerPage = 10; $iPage = (int)bx_get('page'); if ($iPage < 1) { $iPage = 1; } $this->iPostViewType = 4; $sOrder = 'last'; $sMobileWrapper = 'mobile_row.html'; $aParams = array(); switch ($sMode) { case 'post': $aViewingPostInfo = $this->_oDb->getPostInfo((int)bx_get('id')); if (!$this->oPrivacy->check('view', (int)bx_get('id'), $this->_iVisitorID) || !$this->isAllowedBlogPostView($aViewingPostInfo['OwnerID'], true) ) { $oMobileTemplate->displayAccessDenied($sCaption); return; } $this->iPostViewType = 3; $aParams = array('id' => (int)bx_get('id')); $sCaption = _t('_bx_blog_post_view'); $sMobileWrapper = 'mobile_box.html'; echo $oMobileTemplate->addCss('blogs.css', 1); break; case 'user': $aParams = array('id' => (int)bx_get('id')); $sCaption = _t('_bx_blog_Members_blog', getNickName((int)bx_get('id'))); break; case 'featured': $sCaption = _t('_bx_blog_Featured_Posts'); break; case 'top': $sOrder = 'top'; $sCaption = _t('_bx_blog_Top_Posts'); break; case 'popular': $sOrder = 'popular'; $sCaption = _t('_bx_blog_Popular_Posts'); break; case 'last': default: $sMode = 'last'; $sCaption = _t('_bx_blog_Latest_posts'); } if ('post' != $sMode && !$this->isAllowedBlogsPostsBrowse()) { $oMobileTemplate->displayAccessDenied($sCaption); return; } $oTmpBlogSearch = false; $sCode = $this->_GenPosts($this->iPostViewType, $iPerPage, $sMode, $aParams, $sOrder, $oBlogSearchResults, $sMobileWrapper); if (!$sCode || $oBlogSearchResults->aCurrent['paginate']['totalNum'] == 0) { $oMobileTemplate->displayNoData($sCaption); return; } echo $sCode; if ($sMode != 'post') { bx_import('BxDolPaginate'); $oPaginate = new BxDolPaginate(array( 'page_url' => $this->genBlogSubUrl() . '?action=mobile&mode=' . $sMode . '&page={page}', 'count' => $oBlogSearchResults->aCurrent['paginate']['totalNum'], 'per_page' => $iPerPage, 'page' => $iPage, )); echo $oPaginate->getMobilePaginate(); } $oMobileTemplate->pageCode($sCaption, false); }
Generate List of Posts for mobile frontend @param $iAuthor - display posts of provided user only @param $sMode - display all latest[default], featured or top posts @return HTML presentation of data
GenPostListMobile
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function GenMemberDescrAndCat($aBlogsRes, $sCategoryName = '') { $sSureC = _t('_Are_you_sure'); $sApplyChangesC = _t('_Submit'); $iMemberID = (int)$aBlogsRes['OwnerID']; $sOwnerNickname = getNickName($iMemberID); $aBlogInfo = $this->_oDb->getBlogInfo($iMemberID); $this->aViewingPostInfo = $aBlogInfo; if ($this->iViewingPostID == -1) { $aBlogID = (int)$aBlogInfo['ID']; $sWorkLink = $this->genBlogFormUrl(); $sProcessingFile = $this->genBlogSubUrl(); $aBlogActionKeys = array( 'visitor_id' => $this->_iVisitorID, 'owner_id' => $iMemberID, 'owner_name' => $sOwnerNickname, 'blog_owner_link' => '',//$sOwnerBlogLink, 'admin_mode' => "'" . $this->bAdminMode . "'", 'sure_label' => $sSureC, 'work_url' => $sProcessingFile, 'site_url' => BX_DOL_URL_ROOT, 'blog_id' => $aBlogID, 'blog_description_js' => $sDescrAct, ); $sBlogActionsVal = $GLOBALS['oFunctions']->genObjectsActions($aBlogActionKeys, 'bx_blogs_m', false); if (($this->_iVisitorID == $iMemberID && $iMemberID > 0) || $this->bAdminMode == true) { $aBlogDesc = $aBlogInfo['Description']; $sDescrAct = $this->ActionPrepareForEdit($aBlogDesc); $sBlogDescription = process_html_output($aBlogDesc); $sBlogActionsVal .= <<<EOF <div id="edited_blog_div" style="display: none; position:relative;"> <div class="bx-def-bc-padding" style="padding-top:0;"> <form action="{$sWorkLink}" method="post" name="EditBlogForm"> <input type="hidden" name="action" id="action" value="edit_blog" /> <input type="hidden" name="EditBlogID" id="EditBlogID" value="" /> <input type="hidden" name="EOwnerID" id="EOwnerID" value="" /> <textarea name="Description" rows="3" cols="3" style="width:99%;height:50px;" onkeyup="if( this.value.length > 255 ) this.value = this.value.substr( 0, 255 );" value="{$sBlogDescription}">{$sBlogDescription}</textarea> <div class="bx-def-margin-sec-top"> <input type="submit" value="{$sApplyChangesC}" class="form_input_submit bx-btn bx-btn-small" /> </div> <div class="clear_both"></div> </form> </div> </div> EOF; } } $sBlogActionsSect = ($sBlogActionsVal != '') ? DesignBoxContent(_t('_Actions'), $sBlogActionsVal, 1) : ''; $sDescriptionSect = DesignBoxContent(_t('_Overview'), $this->getPostOverviewBlock(), 1); $sCategoriesSect = $this->getPostCategoriesBlock(); $sTagsSect = DesignBoxContent(_t('_Tags'), $this->getPostTagsBlock(), 1); $sFeaturedSectCont = $this->getPostFeatureBlock(); $sFeaturedSect = ($sFeaturedSectCont) ? DesignBoxContent(_t('_bx_blog_Featured_Posts'), $this->getPostFeatureBlock(), 1) : ''; return $sBlogActionsSect . $sActionsSect . $sDescriptionSect . $sCategoriesSect . $sFeaturedSect . $sTagsSect; }
Generate User Right Part for Blogs @param $aBlogsRes - Blog Array Data @param $iView - type of view(1 is short view, 2 is full view, 3 is post view(short)) @return HTML presentation of data
GenMemberDescrAndCat
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function GenPostPage($iParamPostID = 0) { $this->iViewingPostID = ($iParamPostID > 0) ? $iParamPostID : $this->iViewingPostID; list($sCode, $bShowBlocks) = $this->getViewingPostInfo(); if (empty($this->aViewingPostInfo)) { header("HTTP/1.1 404 Not Found"); $sMsg = _t('_sys_request_page_not_found_cpt'); $GLOBALS['oTopMenu']->setCustomSubHeader($sMsg); return DesignBoxContent($sMsg, MsgBox($sMsg), 1); } $iBlogLimitChars = (int)getParam('max_blog_preview'); $sPostText = htmlspecialchars_adv(mb_substr(trim(strip_tags($this->aViewingPostInfo['PostText'])), 0, $iBlogLimitChars)); $this->_oTemplate->setPageDescription($sPostText); if (mb_strlen($this->aViewingPostInfo['Tags']) > 0) { $this->_oTemplate->addPageKeywords($this->aViewingPostInfo['Tags']); } $sRetHtml .= $sCode; if ($bShowBlocks) { $oBPV = new BxDolBlogsPageView($this); $sRetHtml .= $oBPV->getCode(); } return $sRetHtml; }
Generate User`s Blog Post Page @return HTML presentation of data
GenPostPage
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function AddNewPostForm($iPostID = 0, $bBox = true) { $this->CheckLogged(); if ($iPostID == 0) { if (!$this->isAllowedPostAdd()) { return $this->_oTemplate->displayAccessDenied(); } } else { $iOwnerID = (int)$this->_oDb->getPostOwnerByID($iPostID); if (!$this->isAllowedPostEdit($iOwnerID)) { return $this->_oTemplate->displayAccessDenied(); } } $sPostCaptionC = _t('_Title'); $sPostTextC = _t('_Text'); $sAssociatedImageC = _t('_associated_image'); $sAddBlogC = ($iPostID) ? _t('_Submit') : _t('_Add Post'); $sTagsC = _t('_Tags'); $sNewPostC = _t('_New Post'); $sEditPostC = _t('_bx_blog_Edit_post'); $sDelImgC = _t('_Delete image'); $sErrorC = _t('_Error Occured'); $sCaptionErrorC = _t('_bx_blog_Caption_error'); $sTextErrorC = _t('_bx_blog_Text_error'); $sTagsInfoC = _t('_sys_tags_note'); $sLink = $this->genBlogFormUrl(); $sAddingForm = ''; $oCategories = new BxDolCategories(); $oCategories->getTagObjectConfig(); $aAllowView = $this->oPrivacy->getGroupChooser($this->_iVisitorID, 'blogs', 'view', array(), _t('_bx_blog_privacy_view')); $aAllowRate = $this->oPrivacy->getGroupChooser($this->_iVisitorID, 'blogs', 'rate', array(), _t('_bx_blog_privacy_rate')); $aAllowComment = $this->oPrivacy->getGroupChooser($this->_iVisitorID, 'blogs', 'comment', array(), _t('_bx_blog_privacy_comment')); $sAction = ($iPostID == 0) ? 'new_post' : 'edit_post'; //adding form $aForm = array( 'form_attrs' => array( 'name' => 'CreateBlogPostForm', 'action' => $sLink, 'method' => 'post', 'enctype' => 'multipart/form-data', ), 'params' => array( 'db' => array( 'table' => $this->_oConfig->sSQLPostsTable, 'key' => 'PostID', 'submit_name' => 'add_button', ), ), 'inputs' => array( 'PostCaption' => array( 'type' => 'text', 'name' => 'PostCaption', 'caption' => $sPostCaptionC, 'required' => true, 'checker' => array( 'func' => 'length', 'params' => array(3, 255), 'error' => $sCaptionErrorC, ), 'db' => array( 'pass' => 'Xss', ), ), 'Tags' => array( 'type' => 'text', 'name' => 'Tags', 'caption' => $sTagsC, 'info' => $sTagsInfoC, 'required' => false, 'db' => array( 'pass' => 'Xss', ), ), 'PostText' => array( 'type' => 'textarea', 'html' => 2, 'name' => 'PostText', 'caption' => $sPostTextC, 'required' => true, 'checker' => array( 'func' => 'length', 'params' => array(3, 65535), 'error' => $sTextErrorC, ), 'db' => array( 'pass' => 'XssHtml', ), ), 'Categories' => $oCategories->getGroupChooser('bx_blogs', $this->_iVisitorID, true), 'File' => array( 'type' => 'file', 'name' => 'BlogPic[]', 'caption' => $sAssociatedImageC, ), 'AssociatedImage' => array( 'type' => 'hidden', ), 'allowView' => $aAllowView, 'allowRate' => $aAllowRate, 'allowComment' => $aAllowComment, 'hidden_action' => array( 'type' => 'hidden', 'name' => 'action', 'value' => $sAction, ), 'add_button' => array( 'type' => 'submit', 'name' => 'add_button', 'value' => $sAddBlogC, ), ), ); if ($iPostID > 0) { $aBlogPost = $this->_oDb->getJustPostInfo($iPostID); $sPostCaption = $aBlogPost['PostCaption']; $sPostText = $aBlogPost['PostText']; $sPostTags = $aBlogPost['Tags']; $sPostPicture = $aBlogPost['PostPhoto']; if ($sPostPicture != '') { $sBlogsImagesUrl = BX_BLOGS_IMAGES_URL; $sPostPictureTag = <<<EOF <div class="blog_edit_image" id="edit_post_image_{$iPostID}"> <img class="bx-def-shadow bx-def-round-corners bx-def-margin-sec-right" style="max-width:{$this->iThumbSize}px; max-height:{$this->iThumbSize}px;" src="{$sBlogsImagesUrl}big_{$sPostPicture}" /> <a href="{$sLink}?action=del_img&amp;post_id={$iPostID}" onclick="BlogpostImageDelete('{$sLink}?action=del_img&post_id={$iPostID}&mode=ajax', 'edit_post_image_{$iPostID}');return false;" >{$sDelImgC}</a> </div> EOF; $aForm['inputs']['AssociatedImage']['type'] = 'custom'; $aForm['inputs']['AssociatedImage']['content'] = $sPostPictureTag; $aForm['inputs']['AssociatedImage']['caption'] = $sAssociatedImageC; } $aCategories = explode(';', $aBlogPost['Categories']); $aForm['inputs']['PostCaption']['value'] = $sPostCaption; $aForm['inputs']['PostText']['value'] = $sPostText; $aForm['inputs']['Tags']['value'] = $sPostTags; $aForm['inputs']['Categories']['value'] = $aCategories; $aForm['inputs']['allowView']['value'] = $aBlogPost['allowView']; $aForm['inputs']['allowRate']['value'] = $aBlogPost['allowRate']; $aForm['inputs']['allowComment']['value'] = $aBlogPost['allowComment']; $aForm['inputs']['hidden_postid'] = array( 'type' => 'hidden', 'name' => 'EditPostID', 'value' => $iPostID, ); if ($aBlogPost['PostPhoto'] != '' && file_exists(BX_BLOGS_IMAGES_PATH . 'small_' . $aBlogPost['PostPhoto'])) { $GLOBALS['oTopMenu']->setCustomSubIconUrl(BX_BLOGS_IMAGES_URL . 'small_' . $aBlogPost['PostPhoto']); } else { $GLOBALS['oTopMenu']->setCustomSubIconUrl('book'); } $GLOBALS['oTopMenu']->setCustomSubHeader($sPostCaption); } if (empty($aForm['inputs']['allowView']['value']) || !$aForm['inputs']['allowView']['value']) { $aForm['inputs']['allowView']['value'] = BX_DOL_PG_ALL; } if (empty($aForm['inputs']['allowRate']['value']) || !$aForm['inputs']['allowRate']['value']) { $aForm['inputs']['allowRate']['value'] = BX_DOL_PG_ALL; } if (empty($aForm['inputs']['allowComment']['value']) || !$aForm['inputs']['allowComment']['value']) { $aForm['inputs']['allowComment']['value'] = BX_DOL_PG_ALL; } $oForm = new BxTemplFormView($aForm); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $this->CheckLogged(); $iOwnID = $this->_iVisitorID; $sCurTime = time(); $sPostUri = uriGenerate(bx_get('PostCaption'), $this->_oConfig->sSQLPostsTable, 'PostUri'); $sAutoApprovalVal = (getParam('blogAutoApproval') == 'on') ? "approval" : "disapproval"; $aValsAdd = array( 'PostDate' => $sCurTime, 'PostStatus' => $sAutoApprovalVal ); if ($iPostID == 0) { $aValsAdd['OwnerID'] = $iOwnID; $aValsAdd['PostUri'] = $sPostUri; } $iBlogPostID = -1; if ($iPostID > 0) { unset($aValsAdd['PostDate']); $oForm->update($iPostID, $aValsAdd); $this->isAllowedPostEdit($iOwnerID, true); $iBlogPostID = $iPostID; } else { $iBlogPostID = $oForm->insert($aValsAdd); $this->isAllowedPostAdd(true); } if ($iBlogPostID) { $this->iLastPostedPostID = $iBlogPostID; if ($_FILES) { for ($i = 0; $i < count($_FILES['BlogPic']['tmp_name']); $i++) { if ($_FILES['BlogPic']['error'][$i]) { continue; } if (0 < $_FILES['BlogPic']['size'][$i] && 0 < strlen($_FILES['BlogPic']['name'][$i]) && 0 < $iBlogPostID) { $sTmpFile = $_FILES['BlogPic']['tmp_name'][$i]; if (file_exists($sTmpFile) == false) { break; } $aSize = getimagesize($sTmpFile); if (!$aSize) { @unlink($sTmpFile); break; } switch ($aSize[2]) { case IMAGETYPE_JPEG: case IMAGETYPE_GIF: case IMAGETYPE_PNG: $sOriginalFilename = $_FILES['BlogPic']['name'][$i]; $sExt = strrchr($sOriginalFilename, '.'); $sFileName = 'blog_' . $iBlogPostID . '_' . $i; @unlink($sFileName); move_uploaded_file($sTmpFile, BX_BLOGS_IMAGES_PATH . $sFileName . $sExt); @unlink($sTmpFile); if (strlen($sExt)) { $sPathSrc = BX_BLOGS_IMAGES_PATH . $sFileName . $sExt; $sPathDst = BX_BLOGS_IMAGES_PATH . '%s_' . $sFileName . $sExt; imageResize($sPathSrc, sprintf($sPathDst, 'small'), $this->iIconSize / 1, $this->iIconSize / 1); imageResize($sPathSrc, sprintf($sPathDst, 'big'), $this->iThumbSize, $this->iThumbSize); imageResize($sPathSrc, sprintf($sPathDst, 'browse'), $this->iBigThumbSize, null); imageResize($sPathSrc, sprintf($sPathDst, 'orig'), $this->iImgSize, $this->iImgSize); chmod(sprintf($sPathDst, 'small'), 0644); chmod(sprintf($sPathDst, 'big'), 0644); chmod(sprintf($sPathDst, 'browse'), 0644); chmod(sprintf($sPathDst, 'orig'), 0644); $this->_oDb->performUpdatePostWithPhoto($iBlogPostID, $sFileName . $sExt); @unlink($sPathSrc); } break; default: @unlink($sTempFileName); return false; } } } } //reparse tags bx_import('BxDolTags'); $oTags = new BxDolTags(); $oTags->reparseObjTags('blog', $iBlogPostID); //reparse categories $oCategories = new BxDolCategories(); $oCategories->reparseObjTags('bx_blogs', $iBlogPostID); $sAlertAction = ($iPostID == 0) ? 'create' : 'edit_post'; bx_import('BxDolAlerts'); $oZ = new BxDolAlerts('bx_blogs', $sAlertAction, $iBlogPostID, $this->_iVisitorID); $oZ->alert(); header("X-XSS-Protection: 0"); // to prevent browser's security audit to block youtube embeds(and others), just after post creation return $this->GenPostPage($iBlogPostID); } else { return MsgBox($sErrorC); } } else { $sAddingForm = $oForm->getCode(); } $sCaption = ($iPostID) ? $sEditPostC : $sNewPostC; $sAddingFormVal = '<div class="blogs-view bx-def-bc-padding">' . $sAddingForm . '</div>'; return ($bBox) ? DesignBoxContent($sCaption, '<div class="blogs-view bx-def-bc-padding">' . $sAddingForm . '</div>', 1) : $sAddingFormVal; }
Generate Form for NewPost/EditPost @param $iPostID - Post ID @return HTML presentation of data
AddNewPostForm
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function GenAddCategoryForm() { $this->CheckLogged(); $aBlogsRes = $this->_oDb->getBlogInfo($this->_iVisitorID); if (!$aBlogsRes) { return $this->GenCreateBlogForm(); } $iOwnerID = (int)$aBlogsRes['OwnerID']; if ((!$this->_iVisitorID || $iOwnerID != $this->_iVisitorID) && !$this->isAllowedBlogView($iOwnerID)) { return $this->_oTemplate->displayAccessDenied(); } $sAddCategoryC = _t('_Add Category'); $sRetHtml = ''; if (($this->_iVisitorID == $aBlogsRes['OwnerID'] && $this->_iVisitorID > 0) || $this->bAdminMode == true) { $sCategoryCaptionC = _t('_Title'); $sErrorC = _t('_Error Occured'); $sLink = $this->genBlogFormUrl(); //adding form $aForm = array( 'form_attrs' => array( 'name' => 'CreateBlogPostForm', 'action' => $sLink, 'method' => 'post' ), 'params' => array( 'db' => array( 'table' => 'sys_categories', /*'key' => 'PostID',*/ 'submit_name' => 'add_button', ), ), 'inputs' => array( 'Caption' => array( 'type' => 'text', 'name' => 'Category', 'caption' => $sCategoryCaptionC, 'required' => true, 'checker' => array( 'func' => 'length', 'params' => array(3, 128), 'error' => $sErrorC, ), 'db' => array( 'pass' => 'Xss', ), ), 'hidden_action' => array( 'type' => 'hidden', 'name' => 'action', 'value' => 'add_category', ), 'add_button' => array( 'type' => 'submit', 'name' => 'add_button', 'value' => $sAddCategoryC, ), ), ); $oForm = new BxTemplFormView($aForm); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $this->CheckLogged(); $aValsAdd = array( 'ID' => '0', 'Type' => 'bx_blogs', 'Owner' => $this->_iVisitorID ); $iInsertedCategoryID = $oForm->insert($aValsAdd); if ($iInsertedCategoryID >= 0) { return $this->GenMemberBlog($this->_iVisitorID); } else { return MsgBox($sErrorC); } } else { $sRetHtml = $oForm->getCode(); } } else { $sRetHtml = $this->_oTemplate->displayAccessDenied(); } return DesignBoxContent($sAddCategoryC, '<div class="blogs-view bx-def-bc-padding">' . $sRetHtml . '</div>', 1); }
Generate a Form to Editing/Adding of Category of Blog @return HTML presentation of data
GenAddCategoryForm
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function GenSearchResult() { if (!$this->isAllowedBlogPostSearch(true)) { return $this->_oTemplate->displayAccessDenied(); } $iCheckedMemberID = $this->_iVisitorID; $bNoProfileMode = (false !== bx_get('ownerID') || false !== bx_get('blogOwnerName')) ? false : true; $sRetHtml = ''; $sSearchedTag = uri2title(process_db_input(bx_get('tagKey'), BX_TAGS_STRIP)); $iMemberID = $this->defineUserId(); $sTagsC = _t('_Tags'); $sNoBlogC = _t('_bx_blog_No_blogs_available'); require_once($this->_oConfig->getClassPath() . 'BxBlogsSearchUnit.php'); $oTmpBlogSearch = new BxBlogsSearchUnit($this); $oTmpBlogSearch->PerformObligatoryInit($this, 4); $oTmpBlogSearch->aCurrent['restriction']['tag2']['value'] = $sSearchedTag; $oTmpBlogSearch->aCurrent['paginate']['perPage'] = $this->_oConfig->getPerPage(); if ($iMemberID > 0) { $oTmpBlogSearch->aCurrent['restriction']['owner']['value'] = $iMemberID; } if (($iMemberID != 0 && $iMemberID == $iCheckedMemberID) || $this->isAdmin() == true) { $oTmpBlogSearch->aCurrent['restriction']['activeStatus'] = ''; } $sBlogPostsVal = $oTmpBlogSearch->displayResultBlock(); $sBlogPostsVal = '<div class="blogs-view bx-def-bc-padding">' . $sBlogPostsVal . '</div>'; $oTmpBlogSearch->aCurrent['paginate']['page_url'] = $oTmpBlogSearch->getCurrentUrl('tag', 0, title2uri($sSearchedTag)); $sBlogPostsVal .= $oTmpBlogSearch->showPagination3(); $sBlogPosts = ($oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0) ? MsgBox(_t('_Empty')) : $sBlogPostsVal; $sContentSect = DesignBoxContent($sTagsC . ' - ' . $sSearchedTag, $sBlogPostsVal, 1); if ($bNoProfileMode == false) { $sRightSect = ''; if ($iMemberID > -1) { $aBlogsRes = $this->_oDb->getBlogInfo($iMemberID); if (!$aBlogsRes) { $sNoBlogC = MsgBox($sNoBlogC); $sRetHtml = <<<EOF <div class="{$sWidthClass}"> {$sNoBlogC} </div> <div class="clear_both"></div> EOF; } else { $sRightSect = $this->GenMemberDescrAndCat($aBlogsRes); $sWidthClass = ($iMemberID > 0) ? 'cls_info_left' : 'cls_res_thumb'; $sRetHtml = $this->Templater($sContentSect, $sRightSect, $sWidthClass); } } else { $sRetHtml = MsgBox(_t('_Profile Not found Ex')); } } else { $sRetHtml = <<<EOF <div class="{$sWidthClass}"> {$sContentSect} </div> <div class="clear_both"></div> EOF; } return $sRetHtml; }
Generate a Block of searching result by Tag (GET is tagKey) @return HTML presentation of data
GenSearchResult
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function GenPostCalendarDay() { // date=2009/3/18 $sCode = MsgBox(_t('_Empty')); $sDate = bx_get('date'); $aDate = explode('/', $sDate); $iValue1 = (int)$aDate[0]; $iValue2 = (int)$aDate[1]; $iValue3 = (int)$aDate[2]; if ($iValue1 > 0 && $iValue2 > 0 && $iValue3 > 0) { $this->iPostViewType = 4; $sCaption = _t('_bx_blog_caption_browse_by_day') . getLocaleDate(strtotime("{$iValue1}-{$iValue2}-{$iValue3}"), BX_DOL_LOCALE_DATE_SHORT); if (!$this->isAllowedBlogsPostsBrowse()) { return DesignBoxContent($sCaption, $this->_oTemplate->displayAccessDenied(), 1); } require_once($this->_oConfig->getClassPath() . 'BxBlogsSearchUnit.php'); $oTmpBlogSearch = new BxBlogsSearchUnit($this); $oTmpBlogSearch->PerformObligatoryInit($this, $this->iPostViewType); $oTmpBlogSearch->aCurrent['paginate']['perPage'] = $this->_oConfig->getPerPage(); $oTmpBlogSearch->aCurrent['sorting'] = 'last'; $oTmpBlogSearch->aCurrent['restriction']['calendar-min'] = array( 'value' => "UNIX_TIMESTAMP('{$iValue1}-{$iValue2}-{$iValue3} 00:00:00')", 'field' => 'PostDate', 'operator' => '>=', 'no_quote_value' => true ); $oTmpBlogSearch->aCurrent['restriction']['calendar-max'] = array( 'value' => "UNIX_TIMESTAMP('{$iValue1}-{$iValue2}-{$iValue3} 23:59:59')", 'field' => 'PostDate', 'operator' => '<=', 'no_quote_value' => true ); $sCode = $oTmpBlogSearch->displayResultBlock(); $sCode = ($oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0) ? MsgBox(_t('_Empty')) : $sCode; $sRequest = BX_DOL_URL_ROOT . 'modules/boonex/blogs/blogs.php?action=show_calendar_day&date=' . "{$iValue1}/{$iValue2}/{$iValue3}" . '&page={page}&per_page={per_page}'; $oTmpBlogSearch->aCurrent['paginate']['page_url'] = $sRequest; $sPagination = $oTmpBlogSearch->showPagination3(); } $sRetHtmlVal = <<<EOF <div class="bx-def-bc-padding"> {$sCode} </div> {$sPagination} EOF; return DesignBoxContent($sCaption, $sRetHtmlVal, 1); }
Generate List of Posts for calendar @return HTML presentation of data
GenPostCalendarDay
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function GenCreateBlogForm($bBox = true) { $this->CheckLogged(); if (!$this->isAllowedPostAdd()) { return $this->_oTemplate->displayAccessDenied(); } $sRetHtml = $sCreateForm = ''; $sActionsC = _t('_Actions'); $sPleaseCreateBlogC = _t('_bx_blog_Please_create_blog'); $sNoBlogC = _t('_bx_blog_No_blogs_available'); $sMyBlogC = _t('_bx_blog_My_blog'); $sNewBlogDescC = _t('_bx_blog_description'); $sErrorC = _t('_bx_blog_create_blog_form_error'); $sSubmitC = _t('_Submit'); $sRetHtml .= MsgBox($sNoBlogC); if ($this->_iVisitorID || $this->isAdmin()) { $sRetHtml = MsgBox($sPleaseCreateBlogC); $sLink = $this->genBlogFormUrl(); $sAddingForm = ''; //adding form $aForm = array( 'form_attrs' => array( 'name' => 'CreateBlogForm', 'action' => $sLink, 'method' => 'post', ), 'params' => array( 'db' => array( 'table' => $this->_oConfig->sSQLBlogsTable, 'key' => 'ID', 'submit_name' => 'add_button', ), ), 'inputs' => array( 'Description' => array( 'type' => 'textarea', 'html' => 0, 'name' => 'Description', 'caption' => $sNewBlogDescC, 'required' => true, 'checker' => array( 'func' => 'length', 'params' => array(3, 255), 'error' => $sErrorC, ), 'db' => array( 'pass' => 'XssHtml', ), ), 'hidden_action' => array( 'type' => 'hidden', 'name' => 'action', 'value' => 'create_blog', ), 'add_button' => array( 'type' => 'submit', 'name' => 'add_button', 'value' => $sSubmitC, ), ), ); $oForm = new BxTemplFormView($aForm); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $this->CheckLogged(); $iOwnID = $this->_iVisitorID; $aBlogsRes = $this->_oDb->getBlogInfo($iOwnID); if (!$aBlogsRes) { $aValsAdd = array( 'OwnerID' => $iOwnID ); $iBlogID = $oForm->insert($aValsAdd); //return $this->GenMemberBlog($iOwnID, false); $bUseFriendlyLinks = $this->isPermalinkEnabled(); $sBlogAddLink = ($bUseFriendlyLinks) ? BX_DOL_URL_ROOT . 'blogs/my_page/add/' : $this->genBlogFormUrl() . '?action=my_page&mode=add'; header('Location:' . $sBlogAddLink); return $this->GenMyPageAdmin('add'); } else { return MsgBox($sErrorC); } } else { $sAddingForm = $oForm->getCode(); } $aVars = array('content' => $sAddingForm); $sAddingForm = $this->_oTemplate->parseHtmlByName('default_padding.html', $aVars); $sCreateForm = ($bBox) ? DesignBoxContent($sActionsC, $sAddingForm, 1) : $sAddingForm; } $sMyBlogResult = ($bBox) ? DesignBoxContent($sMyBlogC, $sRetHtml, 1) : $sRetHtml; return $sMyBlogResult . $sCreateForm; }
Generate a Form to Create Blog @return HTML presentation of data
GenCreateBlogForm
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function serviceActionDeleteBlog() { $this->ActionDeleteBlogSQL(); }
Blog deleting. For outer usage (carefully in using).
serviceActionDeleteBlog
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function serviceBlogsCalendarIndexPage($iBlockID) { if (!$this->isAllowedBlogsPostsBrowse()) { return $this->_oTemplate->displayAccessDenied(); } return $this->GenBlogCalendar(true, $iBlockID, BX_DOL_URL_ROOT); }
Blogs mini-calendar block for index page (as PHP function). List of latest posts. @return html of blog mini-calendar
serviceBlogsCalendarIndexPage
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function serviceBlogsIndexPage($bShortPgn = true, $iPerPage = 0) { if (!$this->isAllowedBlogsPostsBrowse()) { return $this->_oTemplate->displayAccessDenied(); } require_once($this->_oConfig->getClassPath() . 'BxBlogsSearchUnit.php'); $oBlogSearch = new BxBlogsSearchUnit(); $oBlogSearch->PerformObligatoryInit($this, 4); $oBlogSearch->aCurrent['paginate']['perPage'] = ($iPerPage > 0 ? $iPerPage : $this->_oConfig->getPerPage('index')); $aVis = array(BX_DOL_PG_ALL); if ($this->getUserId()) { $aVis[] = BX_DOL_PG_MEMBERS; } $oBlogSearch->aCurrent['restriction']['allow_view']['value'] = $aVis; $sCode = $oBlogSearch->displayResultBlock(); $sPostPagination = $oBlogSearch->showPagination2(false, $this->genBlogLink('home'), $bShortPgn); if ($oBlogSearch->aCurrent['paginate']['totalNum'] > 0) { $sCodeBlock = $sCode; return array($sCodeBlock, false, $sPostPagination); } }
Blogs block for index page (as PHP function). List of latest posts. @return html of last blog posts
serviceBlogsIndexPage
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function serviceBlogsProfilePage($_iProfileID) { if (!$this->isAllowedBlogsPostsBrowse()) { return $this->_oTemplate->displayAccessDenied(); } $GLOBALS['oTopMenu']->setCurrentProfileID($_iProfileID); require_once($this->_oConfig->getClassPath() . 'BxBlogsSearchUnit.php'); $oBlogSearch = new BxBlogsSearchUnit(); $oBlogSearch->PerformObligatoryInit($this, 4); $oBlogSearch->aCurrent['paginate']['perPage'] = $this->_oConfig->getPerPage('profile'); $oBlogSearch->aCurrent['restriction']['owner']['value'] = $_iProfileID; //$oBlogSearch->aCurrent['restriction']['publicStatus']['value'] = 'public'; $sCode = $oBlogSearch->displayResultBlock(); if ($oBlogSearch->aCurrent['paginate']['totalNum']) { return <<<EOF <div class="bx-def-bc-padding"> {$sCode} </div> EOF; } }
Blogs block for profile page (as PHP function). List of latest posts of member. @param $_iProfileID - member id @return html of last blog posts
serviceBlogsProfilePage
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function serviceGetPostsCountForMember($iMemberId) { return $this->_oDb->getMemberPostsCnt((int)$iMemberId); }
Get number of posts for particular member @return html with generated menu item
serviceGetPostsCountForMember
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function onPostApproveDisapprove($iBPostID, $isApprove) { $aPostInfo = $this->_oDb->getPostInfo($iBPostID); if (!$aPostInfo) { return; } //reparse tags bx_import('BxDolTags'); $oTags = new BxDolTags(); $oTags->reparseObjTags('blog', $iBPostID); //reparse categories bx_import('BxDolCategories'); $oCategories = new BxDolCategories($aPostInfo['OwnerID']); $oCategories->reparseObjTags('bx_blogs', $iBPostID); $oZ = new BxDolAlerts('bx_blogs', $isApprove ? 'approve' : 'disapprove', $iBPostID, $this->_iVisitorID); $oZ->alert(); }
Fired when post status is changed to approved or disapproved
onPostApproveDisapprove
php
boonex/dolphin.pro
modules/boonex/blogs/classes/BxBlogsModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/blogs/classes/BxBlogsModule.php
MIT
function serviceHomepagePartBlock($sPart) { if (!isset($this->_aParts[$sPart])) { return ''; } $this->_oTemplate->addJs($this->_sProto . '://www.google.com/jsapi?key=' . getParam('bx_wmap_key')); $this->_oTemplate->addJs('BxWmap.js'); $this->_oTemplate->addCss('main.css'); return $this->serviceSeparatePageBlock(false, false, false, $sPart, '', 'bx_wmap_homepage_part', 'bx_wmap_home_' . $sPart, 'PartHome', 'part_home/' . $sPart, false); }
Module Homepage block with world map @return html with world map
serviceHomepagePartBlock
php
boonex/dolphin.pro
modules/boonex/world_map/classes/BxWmapModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/world_map/classes/BxWmapModule.php
MIT
function serviceLocationBlock($sPart, $iEntryId) { if (!isset($this->_aParts[$sPart])) { return ''; } $sParamPrefix = 'bx_wmap_entry_' . $sPart; $iEntryId = (int)$iEntryId; $r = $this->_oDb->getDirectLocation($iEntryId, $this->_aParts[$sPart]); $sBoxContent = ''; if ($r && !empty($r['lat'])) { $aVars = array( 'msg_incorrect_google_key' => _t('_bx_wmap_msg_incorrect_google_key'), 'loading' => _t('_loading ...'), 'map_control' => getParam($sParamPrefix . '_control_type'), 'map_is_type_control' => getParam($sParamPrefix . '_is_type_control') == 'on' ? 1 : 0, 'map_is_scale_control' => getParam($sParamPrefix . '_is_scale_control') == 'on' ? 1 : 0, 'map_is_overview_control' => getParam($sParamPrefix . '_is_overview_control') == 'on' ? 1 : 0, 'map_is_dragable' => getParam($sParamPrefix . '_is_map_dragable') == 'on' ? 1 : 0, 'map_lat' => $r['lat'], 'map_lng' => $r['lng'], 'map_zoom' => -1 != $r['zoom'] ? $r['zoom'] : (getParam($sParamPrefix . '_zoom') ? getParam($sParamPrefix . '_zoom') : BX_WMAP_ZOOM_DEFAULT_ENTRY), 'map_type' => $r['type'] ? $r['type'] : (getParam($sParamPrefix . '_map_type') ? getParam($sParamPrefix . '_map_type') : 'normal'), 'parts' => $sPart, 'custom' => '', 'suffix' => 'Location', 'subclass' => 'bx_wmap_location_box', 'data_url' => BX_DOL_URL_MODULES . "' + '?r=wmap/get_data_location/" . $iEntryId . "/" . $sPart . "/{instance}", 'save_data_url' => '', 'save_location_url' => '', 'shadow_url' => '', 'lang' => bx_lang_name(), 'key' => getParam('bx_wmap_key'), ); $this->_oTemplate->addJs($this->_sProto . '://www.google.com/jsapi?key=' . getParam('bx_wmap_key')); $this->_oTemplate->addJs('BxWmap.js'); $this->_oTemplate->addCss('main.css'); $aVars2 = array( 'map' => $this->_oTemplate->parseHtmlByName('map', $aVars), ); $sBoxContent = $this->_oTemplate->parseHtmlByName('entry_location', $aVars2); } $sBoxFooter = ''; if ($r['author_id'] == $this->_iProfileId || $this->isAdmin()) { $aVars = array( 'icon' => $this->_oTemplate->getIconUrl('more.png'), 'url' => $this->_oConfig->getBaseUri() . "edit/$iEntryId/$sPart", 'title' => _t('_bx_wmap_box_footer_edit'), ); $sBoxFooter = $this->_oTemplate->parseHtmlByName('box_footer', $aVars); if (!$sBoxContent) { $sBoxContent = MsgBox(_t('_bx_wmap_msg_locations_is_not_defined')); } } if ($sBoxContent || $sBoxFooter) { return array($sBoxContent, array(), $sBoxFooter); } return ''; }
Block with entry's location map @param $sPart module/part name @param $iEntryId entry's id which location is shown on the map @return html with entry's location map
serviceLocationBlock
php
boonex/dolphin.pro
modules/boonex/world_map/classes/BxWmapModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/world_map/classes/BxWmapModule.php
MIT
function actionPost() { $sJsObject = $this->_oConfig->getJsObject('post'); $sResult = "parent." . $sJsObject . ".loading(false);\n"; $this->_iOwnerId = (int)$_POST['WallOwnerId']; if (!$this->_isCommentPostAllowed(true)) return "<script>" . $sResult . "alert('" . bx_js_string(_t('_wall_msg_not_allowed_post')) . "');</script>"; $sPostType = process_db_input($_POST['WallPostType'], BX_TAGS_STRIP); $sContentType = process_db_input($_POST['WallContentType'], BX_TAGS_STRIP); $sMethod = "_process" . ucfirst($sPostType) . ucfirst($sContentType); if(method_exists($this, $sMethod)) { $aResult = $this->$sMethod(); if((int)$aResult['code'] == 0) { $iId = $this->_oDb->insertEvent(array( 'owner_id' => $this->_iOwnerId, 'object_id' => $aResult['object_id'], 'type' => $this->_oConfig->getCommonPostPrefix() . $sPostType, 'action' => '', 'content' => process_db_input($aResult['content'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), 'title' => process_db_input($aResult['title'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), 'description' => process_db_input($aResult['description'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION) )); $this->onPost($iId); $sResult = "parent.$('form#WallPost" . ucfirst($sPostType) . "').find(':input:not(:button,:submit,[type = hidden],[type = radio],[type = checkbox])').val('');\n"; $sResult .= "parent." . $sJsObject . "._getPost(null, " . $iId . ");"; } else $sResult .= "alert('" . bx_js_string(_t($aResult['message'])) . "');"; } else $sResult .= "alert('" . bx_js_string(_t('_wall_msg_failed_post')) . "');"; return '<script>' . $sResult . '</script>'; }
ACTION METHODS Post somthing on the wall. @return string with JavaScript code.
actionPost
php
boonex/dolphin.pro
modules/boonex/wall/classes/BxWallModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/wall/classes/BxWallModule.php
MIT
function actionGetUploader($iOwnerId, $sType, $sSubType = '') { $this->_iOwnerId = $iOwnerId; header('Content-Type: text/html; charset=utf-8'); if(!in_array($sType, array('photo', 'sound', 'video'))) return ''; return $this->_oTemplate->getUploader($iOwnerId, $sType, $sSubType); }
Get photo/sound/video uploading form. @return string with form.
actionGetUploader
php
boonex/dolphin.pro
modules/boonex/wall/classes/BxWallModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/wall/classes/BxWallModule.php
MIT
function servicePostBlockIndexTimeline($sType = 'id') { if(!isLogged()) return ''; $aOwner = $this->_oDb->getUser(getLoggedId(), $sType); $this->_iOwnerId = $aOwner['id']; if(!$this->_isCommentPostAllowed()) return ""; $aTopMenu = $this->_getPostTabs(BX_WALL_VIEW_TIMELINE); if(empty($aTopMenu) || empty($aTopMenu['tabs'])) return ""; //--- Parse template ---// $sClassActive = ' wall-ptc-active'; $sContent = $this->_oTemplate->parseHtmlByName('post.html', array ( 'js_code' => $this->_oTemplate->getJsCode('post', array('iOwnerId' => 0)), 'class_text' => !empty($aTopMenu['mask']['text']) ? $sClassActive : '', 'content_text' => isset($aTopMenu['mask']['text']) ? $this->_getWriteForm('_getWriteFormIndex') : '', 'class_link' => !empty($aTopMenu['mask']['link']) ? $sClassActive : '', 'content_link' => isset($aTopMenu['mask']['link']) ? $this->_getShareLinkForm('_getShareLinkFormIndex') : '', 'class_photo' => !empty($aTopMenu['mask']['photo']) ? $sClassActive : '', 'content_photo' => isset($aTopMenu['mask']['photo']) ? $this->_oTemplate->getUploader(0, 'photo') : '', 'class_sound' => !empty($aTopMenu['mask']['sound']) ? $sClassActive : '', 'content_sound' => isset($aTopMenu['mask']['sound']) ? $this->_oTemplate->getUploader(0, 'sound') : '', 'class_video' => !empty($aTopMenu['mask']['video']) ? $sClassActive : '', 'content_video' => isset($aTopMenu['mask']['video']) ? $this->_oTemplate->getUploader(0, 'video') : '', )); $this->_oTemplate->addCss('post.css'); $this->_oTemplate->addJs(array('main.js', 'post.js')); return array($sContent, $aTopMenu['tabs'], LoadingBox('bx-wall-post-loading'), true, 'getBlockCaptionMenu'); }
Display Post block on home page. @param integer $mixed - owner ID or Username. @return array containing block info.
servicePostBlockIndexTimeline
php
boonex/dolphin.pro
modules/boonex/wall/classes/BxWallModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/wall/classes/BxWallModule.php
MIT
function servicePostBlockProfileTimeline($mixed, $sType = 'id') { $aOwner = $this->_oDb->getUser($mixed, $sType); $this->_iOwnerId = $aOwner['id']; if(($aOwner['id'] != $this->_getAuthorId() && !$this->_isCommentPostAllowed()) || !$this->_isViewAllowed()) return ""; $aTopMenu = $this->_getPostTabs(BX_WALL_VIEW_TIMELINE); if(empty($aTopMenu) || empty($aTopMenu['tabs'])) return ""; //--- Parse template ---// $sClassActive = ' wall-ptc-active'; $sContent = $this->_oTemplate->parseHtmlByName('post.html', array ( 'js_code' => $this->_oTemplate->getJsCode('post', array('iOwnerId' => $this->_iOwnerId)), 'class_text' => !empty($aTopMenu['mask']['text']) ? $sClassActive : '', 'content_text' => isset($aTopMenu['mask']['text']) ? $this->_getWriteForm() : '', 'class_link' => !empty($aTopMenu['mask']['link']) ? $sClassActive : '', 'content_link' => isset($aTopMenu['mask']['link']) ? $this->_getShareLinkForm() : '', 'class_photo' => !empty($aTopMenu['mask']['photo']) ? $sClassActive : '', 'content_photo' => isset($aTopMenu['mask']['photo']) ? $this->_oTemplate->getUploader($this->_iOwnerId, 'photo') : '', 'class_sound' => !empty($aTopMenu['mask']['sound']) ? $sClassActive : '', 'content_sound' => isset($aTopMenu['mask']['sound']) ? $this->_oTemplate->getUploader($this->_iOwnerId, 'sound') : '', 'class_video' => !empty($aTopMenu['mask']['video']) ? $sClassActive : '', 'content_video' => isset($aTopMenu['mask']['video']) ? $this->_oTemplate->getUploader($this->_iOwnerId, 'video') : '', )); $GLOBALS['oTopMenu']->setCurrentProfileID((int)$this->_iOwnerId); $this->_oTemplate->addCss('post.css'); $this->_oTemplate->addJs(array('main.js', 'post.js')); return array($sContent, $aTopMenu['tabs'], LoadingBox('bx-wall-post-loading'), true, 'getBlockCaptionMenu'); }
Display Post block on profile page. @param integer $mixed - owner ID or Username. @return array containing block info.
servicePostBlockProfileTimeline
php
boonex/dolphin.pro
modules/boonex/wall/classes/BxWallModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/wall/classes/BxWallModule.php
MIT
function _processTextUpload() { $sJsObject = $this->_oConfig->getJsObject('view'); $aOwner = $this->_oDb->getUser($this->_getAuthorId()); $sContent = $_POST['content']; $sContent = strip_tags($sContent); $sContent = nl2br($sContent); if(empty($sContent)) return array( 'code' => 1, 'message' => '_wall_msg_text_empty_message' ); $sContentMore = ''; $iMaxLength = $this->_oConfig->getCharsDisplayMax(); if(mb_strlen($sContent) > $iMaxLength) { $iLength = mb_strpos($sContent, ' ', $iMaxLength); $sContentMore = trim(mb_substr($sContent, $iLength)); $sContent = trim(mb_substr($sContent, 0, $iLength)); } return array( 'code' => 0, 'object_id' => $aOwner['id'], 'content' => $this->_oTemplate->parseHtmlByName('common_text.html', array( 'content' => $sContent, 'bx_if:show_more' => array( 'condition' => !empty($sContentMore), 'content' => array( 'js_object' => $sJsObject, 'post_content_more' => $sContentMore ) ), )), 'title' => _t('_wall_added_title_text', getNickName($aOwner['id'])), 'description' => $sContent ); }
Private Methods Is used for actions processing.
_processTextUpload
php
boonex/dolphin.pro
modules/boonex/wall/classes/BxWallModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/wall/classes/BxWallModule.php
MIT
function _getTimeline($iStart, $iPerPage, $sFilter, $sTimeline, $aModules) { return $this->_oTemplate->getTimeline($iStart, $iPerPage, $sFilter, $sTimeline, $aModules); }
Private Methods Is used for content displaying
_getTimeline
php
boonex/dolphin.pro
modules/boonex/wall/classes/BxWallModule.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/wall/classes/BxWallModule.php
MIT
function getSystem($aEvent, $sDisplayType = BX_WALL_VIEW_TIMELINE) { $sHandler = $aEvent['type'] . '_' . $aEvent['action']; if(!$this->_oConfig->isHandler($sHandler)) return ''; $aResult = $this->_getSystemData($aEvent, $sDisplayType); $bResult = !empty($aResult); if($bResult && isset($aResult['perform_delete']) && $aResult['perform_delete'] == true) { $this->_oDb->deleteEvent(array('id' => $aEvent['id'])); return ''; } else if(!$bResult || ($bResult && empty($aResult['content']))) return ''; $sResult = ""; switch($sDisplayType) { case BX_WALL_VIEW_TIMELINE: if((empty($aEvent['title']) && !empty($aResult['title'])) || (empty($aEvent['description']) && !empty($aResult['description']))) $this->_oDb->updateEvent(array( 'title' => process_db_input($aResult['title'], BX_TAGS_STRIP), 'description' => process_db_input($aResult['description'], BX_TAGS_STRIP) ), $aEvent['id']); $sResult = $this->parseHtmlByTemplateName('balloon', array( 'post_type' => $aEvent['type'], 'post_id' => $aEvent['id'], 'post_owner_icon' => $this->getOwnerThumbnail((int)$aEvent['owner_id']), 'post_content' => $aResult['content'], 'comments_content' => $this->getComments($aEvent, $aResult) )); break; case BX_WALL_VIEW_OUTLINE: //--- Votes $sVote = ''; $oVote = $this->_oModule->_getObjectVoting($aEvent); if($oVote->isEnabled() && $oVote->isVotingAllowed()) $sVote = $oVote->getVotingOutline(); //--- Repost $sRepost = ''; if($this->_oModule->_isRepostAllowed($aEvent)) { $iOwnerId = $this->_oModule->_getAuthorId(); //--- in whose timeline the content will be shared $iObjectId = $this->_oModule->_oConfig->isSystem($aEvent['type'], $aEvent['action']) ? $aEvent['object_id'] : $aEvent['id']; $sRepost = $this->_oModule->serviceGetRepostElementBlock($iOwnerId, $aEvent['type'], $aEvent['action'], $iObjectId, array( 'show_do_repost_as_button_small' => true, 'show_do_repost_icon' => true, 'show_do_repost_label' => false )); } $sResult = $this->parseHtmlByContent($aResult['content'], array( 'post_id' => $aEvent['id'], 'post_owner_icon' => $this->getOwnerIcon((int)$aEvent['owner_id']), 'post_vote' => $sVote, 'post_repost' => $sRepost )); break; } return $sResult; }
Common public methods. Is used to display events on the Wall.
getSystem
php
boonex/dolphin.pro
modules/boonex/wall/classes/BxWallTemplate.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/wall/classes/BxWallTemplate.php
MIT
function getCommentsFirstSystem($sType, $iEventId, $iCommentId = 0) { return $this->_oModule->_oTemplate->parseHtmlByTemplateName('comments', array( 'actions' => $this->getActionsExt($iCommentId, $sType, $iEventId), 'cmt_system' => $this->_sSystem, 'cmt_object' => $this->getId(), 'bx_if:show_replies' => array( 'condition' => $iCommentId != 0, 'content' => array( 'id' => $iCommentId, ) ), 'cmt_addon' => $this->getCmtsInit() )); }
get full comments(system) block with initializations
getCommentsFirstSystem
php
boonex/dolphin.pro
modules/boonex/wall/classes/BxWallCmts.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/wall/classes/BxWallCmts.php
MIT
function getLangString ($s, $sLang = '') { global $gConf; if (!$sLang) $sLang = $gConf['lang']; require_once ($gConf['dir']['langs'] . $sLang . '.php'); return isset($GLOBALS['L'][$s]) ? $GLOBALS['L'][$s] : '_' . $s; }
file to get language string, overrride it if you use external language file
getLangString
php
boonex/dolphin.pro
modules/boonex/forum/integrations/base/lang.php
https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/integrations/base/lang.php
MIT