Exemplo n.º 1
0
 function getMainMenu()
 {
     if (!isAdmin()) {
         return '';
     }
     $sUri = $_SERVER['REQUEST_URI'];
     $sPath = parse_url(BX_DOL_URL_ROOT, PHP_URL_PATH);
     if ($sPath && $sPath != '/' && 0 == strncmp($sPath, $sUri, strlen($sPath))) {
         $sUri = substr($sUri, strlen($sPath) - strlen($sUri));
     }
     $sUri = BX_DOL_URL_ROOT . $sUri;
     $sFile = basename($_SERVER['PHP_SELF']);
     $oPermalinks = new BxDolPermalinks();
     $aMenu = $GLOBALS['MySQL']->getAll("SELECT `id`, `name`, `title`, `url`, `icon` FROM `sys_menu_admin` WHERE `parent_id`='0' ORDER BY `order`");
     $aItems = array();
     foreach ($aMenu as $aMenuItem) {
         $aMenuItem['url'] = str_replace(array('{siteUrl}', '{siteAdminUrl}'), array(BX_DOL_URL_ROOT, BX_DOL_URL_ADMIN), $aMenuItem['url']);
         $bActiveCateg = $sFile == 'index.php' && !empty($_GET['cat']) && $_GET['cat'] == $aMenuItem['name'];
         $aSubmenu = $GLOBALS['MySQL']->getAll("SELECT * FROM `sys_menu_admin` WHERE `parent_id`='" . $aMenuItem['id'] . "' ORDER BY `order`");
         $aSubitems = array();
         foreach ($aSubmenu as $aSubmenuItem) {
             $aSubmenuItem['url'] = $oPermalinks->permalink($aSubmenuItem['url']);
             $aSubmenuItem['url'] = str_replace(array('{siteUrl}', '{siteAdminUrl}'), array(BX_DOL_URL_ROOT, BX_DOL_URL_ADMIN), $aSubmenuItem['url']);
             if (!defined('BX_DOL_ADMIN_INDEX') && $aSubmenuItem['url'] != '' && (strpos($sUri, $aSubmenuItem['url']) !== false || strpos($aSubmenuItem['url'], $sUri) !== false)) {
                 $bActiveCateg = $bActiveItem = true;
             } else {
                 $bActiveItem = false;
             }
             $aSubitems[] = BxDolAdminMenu::_getMainMenuSubitem($aSubmenuItem, $bActiveItem);
         }
         $aItems[] = BxDolAdminMenu::_getMainMenuItem($aMenuItem, $aSubitems, $bActiveCateg);
     }
     return $GLOBALS['oAdmTemplate']->parseHtmlByName('main_menu.html', array('bx_repeat:items' => $aItems));
 }
Exemplo n.º 2
0
function getUserMusicLink()
{
    global $sRootURL;
    if (BxDolInstallerUtils::isModuleInstalled("sounds")) {
        $oDolPermalinks = new BxDolPermalinks();
        return $sRootURL . $oDolPermalinks->permalink("modules?r=sounds/") . "browse/owner/#nick#";
    }
    return "";
}
Exemplo n.º 3
0
function getUserMusicLink()
{
    global $sRootURL;
    if (isModuleAvailable("sounds")) {
        $oDolPermalinks = new BxDolPermalinks();
        return $sRootURL . $oDolPermalinks->permalink("modules?r=sounds/") . "browse/owner/#nick#";
    }
    return "";
}
Exemplo n.º 4
0
 /**
  * constructor
  */
 function __construct($aModule)
 {
     $this->_iId = empty($aModule['id']) ? 0 : (int) $aModule['id'];
     $this->_sVendor = $aModule['vendor'];
     $this->_sClassPrefix = $aModule['class_prefix'];
     $this->_sDbPrefix = $aModule['db_prefix'];
     $this->_sDirectory = $aModule['path'];
     $this->_sHomePath = BX_DIRECTORY_PATH_MODULES . $this->_sDirectory;
     $this->_sClassPath = $this->_sHomePath . 'classes/';
     $this->_sUri = $aModule['uri'];
     $this->_sHomeUrl = BX_DOL_URL_MODULES . $this->_sDirectory;
     $oPermalinks = new BxDolPermalinks();
     $this->_sBaseUri = $oPermalinks->permalink('modules/?r=' . $this->_sUri . '/');
 }
Exemplo n.º 5
0
 /**
  * After join redirection
  * This serice automatically log in joined user and redirects him to avatar copping page
  * @param $iMemID - joined profile ID
  * @param $sStatusText - status text to display at the top of page, like 'join success'
  * @return false on error,  'EXIT' string on success
  */
 function serviceJoin($iMemID, $sStatusText)
 {
     $sPwd = db_value("SELECT `Password` FROM `Profiles` WHERE `ID` = '" . (int) $iMemID . "' LIMIT 1");
     if ($sPwd) {
         bx_login((int) $iMemID);
         // autologin here
         bx_import('BxDolPermalinks');
         $o = new BxDolPermalinks();
         header('Location: ' . BX_DOL_URL_ROOT . $o->permalink('modules/?r=avatar/') . '&join_text=' . $sStatusText);
         // redirect to upload avatar page
         return 'EXIT';
     }
     return false;
 }
Exemplo n.º 6
0
<?php

$sGlobalHeader = "../global/inc/header.inc.php";
require_once "../../../inc/header.inc.php";
require_once BX_DIRECTORY_PATH_CLASSES . "BxDolPermalinks.php";
require_once $sGlobalHeader;
require_once $sIncPath . "db.inc.php";
require_once $sIncPath . "customFunctions.inc.php";
$sId = (int) $_GET["id"];
$oDolPermalinks = new BxDolPermalinks();
$sNick = getValue("SELECT `NickName` FROM `Profiles` WHERE `ID`=" . $sId);
header("Location: " . $sRootURL . $oDolPermalinks->permalink("modules?r=sounds/") . "albums/browse/owner/" . $sNick);
Exemplo n.º 7
0
 /**
  * @description : function will create menu's cache file ;
  *
  * @return array
  */
 function createMemberMenuCache()
 {
     $this->deleteMemberMenuCaches();
     $oPermalink = new BxDolPermalinks();
     $aCacheData = array();
     $sQuery = "SELECT * FROM `sys_menu_member` WHERE `Active` = '1' ORDER BY `Order`";
     $rResult = db_res($sQuery);
     while (true == ($aRow = $rResult->fetch())) {
         $aRow['Link'] = $oPermalink->permalink($aRow['Link']);
         $aRow['linked_items'] = $this->getLinkedItem($aRow['ID']);
         $aCacheData[$aRow['Position']][$aRow['ID']] = $aRow;
     }
     // if items not found ;
     if (!$rResult->rowCount()) {
         $aCacheData[$sMenuSection] = array();
     }
     $oCache = $this->getCacheObject();
     if (!empty($aCacheData) && is_array($aCacheData)) {
         $oCache->setData($GLOBALS['MySQL']->genDbCacheKey($this->sMenuCacheFile), $aCacheData);
     }
     return $aCacheData;
 }
Exemplo n.º 8
0
 /**
  * Edit location block
  * @param $sPart module/part name
  * @param $iEntryId entry's id which location is edited
  * @return html with clickable map
  */
 function serviceEditLocation($sPart, $iEntryId)
 {
     if (!isset($this->_aParts[$sPart])) {
         return false;
     }
     $iEntryId = (int) $iEntryId;
     $aLocation = $this->_oDb->getDirectLocation($iEntryId, $this->_aParts[$sPart]);
     if ('profiles' == $sPart) {
         $aLocation['title'] = getNickName($aLocation['id']);
     }
     if (!$aLocation) {
         return false;
     }
     $fLat = false;
     $fLng = false;
     $iZoom = false;
     $sMapType = false;
     if ($aLocation && !empty($aLocation['lat'])) {
         $fLat = $aLocation['lat'];
         $fLng = $aLocation['lng'];
         $iZoom = $aLocation['zoom'];
         $sMapType = $aLocation['type'];
     }
     if (false === $fLat || false === $fLng) {
         $aLocationCountry = $this->_geocode($aLocation['country'], $aLocation['country']);
         $fLat = isset($aLocationCountry[0]) ? $aLocationCountry[0] : 0;
         $fLng = isset($aLocationCountry[1]) ? $aLocationCountry[1] : 0;
         $iZoom = BX_WMAP_ZOOM_DEFAULT_EDIT;
     }
     if (false === $iZoom || -1 == $iZoom) {
         $iZoom = getParam("bx_wmap_edit_{$sPart}_zoom");
     }
     if (!$sMapType) {
         $sMapType = getParam("bx_wmap_edit_{$sPart}_map_type");
     }
     $aVars = array('msg_incorrect_google_key' => trim(_t('_bx_wmap_msg_incorrect_google_key')), 'loading' => _t('_loading ...'), 'map_control' => getParam("bx_wmap_edit_{$sPart}_control_type"), 'map_is_type_control' => getParam("bx_wmap_edit_{$sPart}_is_type_control") == 'on' ? 1 : 0, 'map_is_scale_control' => getParam("bx_wmap_edit_{$sPart}_is_scale_control") == 'on' ? 1 : 0, 'map_is_overview_control' => getParam("bx_wmap_edit_{$sPart}_is_overview_control") == 'on' ? 1 : 0, 'map_is_dragable' => getParam("bx_wmap_edit_{$sPart}_is_map_dragable") == 'on' ? 1 : 0, 'map_type' => $sMapType, 'map_lat' => $fLat, 'map_lng' => $fLng, 'map_zoom' => $iZoom, 'parts' => $sPart, 'custom' => '', 'suffix' => 'Edit', 'subclass' => 'bx_wmap_edit', 'data_url' => BX_DOL_URL_MODULES . "?r=wmap/get_data_location/{$iEntryId}/{parts}/{instance}/{ts}", 'save_data_url' => BX_DOL_URL_MODULES . "?r=wmap/save_data/{$iEntryId}/{parts}/{zoom}/{map_type}/{lat}/{lng}/{instance}/{address}/{country}/{ts}", 'save_location_url' => '', 'shadow_url' => '');
     $sMap = $this->_oTemplate->parseHtmlByName('map', $aVars);
     $oPermalinks = new BxDolPermalinks();
     $sBackLink = BX_DOL_URL_ROOT . $oPermalinks->permalink($this->_aParts[$aLocation['part']]['permalink'] . $aLocation['uri']);
     $aVars = array('info' => sprintf(_t('_bx_wmap_edit'), "<a href=\"{$sBackLink}\">{$aLocation['title']}</a>", _t($this->_aParts[$sPart]['title_singular'])), 'map' => $sMap);
     return array($this->_oTemplate->parseHtmlByName('map_edit', $aVars));
 }
Exemplo n.º 9
0
 /**
  * Function will generate site's bottom menu;
  *
  * @return : Html presentation data;
  */
 function genSiteBottomMenu()
 {
     if (isset($GLOBALS['bx_profiler'])) {
         $GLOBALS['bx_profiler']->beginMenu('Bottom Menu');
     }
     $sOutputHtml = null;
     $aLinks = array();
     $oPermalinks = new BxDolPermalinks();
     // read data from cache file
     $oCache = $GLOBALS['MySQL']->getDbCacheObject();
     $aLinks = $oCache->getData($GLOBALS['MySQL']->genDbCacheKey('sys_menu_bottom'));
     if (null === $aLinks) {
         $sQuery = "SELECT * FROM `sys_menu_bottom` ORDER BY `Order`";
         $rResult = db_res($sQuery);
         while ($aItems = mysql_fetch_assoc($rResult)) {
             $aLinks[] = array('menu_caption' => $aItems['Caption'], 'menu_link' => $aItems['Script'] ? 'javascript:void(0)' : $oPermalinks->permalink($aItems['Link']), 'extended_action' => $aItems['Script'] ? 'onclick="' . $aItems['Script'] . '"' : null, 'target' => $aItems['Target'] ? 'target="_blank"' : null);
         }
         $oCache->setData($GLOBALS['MySQL']->genDbCacheKey('sys_menu_bottom'), $aLinks);
     }
     foreach ($aLinks as $iID => $aItem) {
         $aLinks[$iID]['menu_caption'] = _t($aItem['menu_caption']);
     }
     $aTemplateKeys = array('bx_repeat:items' => $aLinks);
     $sOutputHtml = $GLOBALS['oSysTemplate']->parseHtmlByName('extra_bottom_menu.html', $aTemplateKeys);
     if (isset($GLOBALS['bx_profiler'])) {
         $GLOBALS['bx_profiler']->endMenu('Bottom Menu');
     }
     return $sOutputHtml;
 }
Exemplo n.º 10
0
 /**
  * Get base URI which depends on the Permalinks mechanism.
  * 
  * example /modules/?r=module_uri or /m/module_uri
  * @return string with base URI.
  */
 function getBaseUri()
 {
     $oPermalinks = new BxDolPermalinks();
     return $oPermalinks->permalink('modules/?r=' . $this->_sUri . '/');
 }