function actionAdmin($sName = '') { $GLOBALS['iAdminPage'] = 1; require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php'; $sUri = $this->_oConfig->getUri(); check_logged(); if (!@isAdmin()) { send_headers_page_changed(); login_form("", 1); exit; } //--- Process actions ---// $mixedResultSettings = ''; if (isset($_POST['save']) && isset($_POST['cat'])) { $mixedResultSettings = $this->setSettings($_POST); } //--- Process actions ---// $aDetailsBox = $this->getDetailsForm(BX_PMT_ADMINISTRATOR_ID); $aPendingOrdersBox = $this->getOrdersBlock(BX_PMT_ORDERS_TYPE_PENDING, BX_PMT_ADMINISTRATOR_ID); $aProcessedOrdersBox = $this->getOrdersBlock(BX_PMT_ORDERS_TYPE_PROCESSED, BX_PMT_ADMINISTRATOR_ID); $aSubscriptionOrdersBox = $this->getOrdersBlock(BX_PMT_ORDERS_TYPE_SUBSCRIPTION, BX_PMT_ADMINISTRATOR_ID); $sContent = ''; $sContent .= $this->_oTemplate->getJsCode('orders', true); $sContent .= DesignBoxAdmin(_t($this->_sLangsPrefix . 'bcpt_settings'), $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $this->getSettingsForm($mixedResultSettings)))); $sContent .= DesignBoxAdmin(_t($this->_sLangsPrefix . 'bcpt_details'), $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $aDetailsBox[0]))); $sContent .= DesignBoxAdmin(_t($this->_sLangsPrefix . 'bcpt_pending_orders'), $aPendingOrdersBox[0]); $sContent .= DesignBoxAdmin(_t($this->_sLangsPrefix . 'bcpt_processed_orders'), $aProcessedOrdersBox[0]); $sContent .= DesignBoxAdmin(_t($this->_sLangsPrefix . 'bcpt_subscription_orders'), $aSubscriptionOrdersBox[0]); $sContent .= $this->getMoreWindow(); $sContent .= $this->getManualOrderWindow(); $this->_oTemplate->addAdminJs(array('orders.js', '_orders.js')); $this->_oTemplate->addAdminCss(array('orders.css', '_orders.css')); $aParams = array('title' => array('page' => _t($this->_sLangsPrefix . 'pcpt_administration')), 'content' => array('page_main_code' => $sContent)); $this->_oTemplate->getPageCodeAdmin($aParams); }
public function serviceGetCacheUpdater() { check_logged(); if (!isAdmin()) { return ''; } $oTemplate = BxDolStudioTemplate::getInstance(); $sContent = $oTemplate->addJs('launcher.js', true); $sContent .= $oTemplate->parseHtmlByName('launcher_cache_updater.html', array('js_object' => $this->getPageJsObject())); return $sContent; }
function getPageCode(&$aParams) { global $_page; global $_page_cont; $iIndex = isset($aParams['index']) ? (int) $aParams['index'] : 0; $_page['name_index'] = $iIndex; $_page['js_name'] = isset($aParams['js']) ? $aParams['js'] : ''; $_page['css_name'] = isset($aParams['css']) ? $aParams['css'] : ''; $_page['extra_js'] = isset($aParams['extra_js']) ? $aParams['extra_js'] : ''; check_logged(); if (isset($aParams['content'])) { foreach ($aParams['content'] as $sKey => $sValue) { $_page_cont[$iIndex][$sKey] = $sValue; } } if (isset($aParams['title']['page'])) { $this->setPageTitle($aParams['title']['page']); } if (isset($aParams['title']['block'])) { $this->setPageMainBoxTitle($aParams['title']['block']); } if (isset($aParams['breadcrumb'])) { $GLOBALS['oTopMenu']->setCustomBreadcrumbs($aParams['breadcrumb']); } PageCode($this); }
function actionAlbumsViewMy($sParamValue = '', $sParamValue1 = '', $sParamValue2 = '', $sParamValue3 = '') { $sAction = bx_get('action'); if ($sAction !== false) { header('Content-Type: text/html; charset=UTF-8'); if (!isLogged() && bx_get('oid') && bx_get('pwd')) { // in case of request from flash, cookies are not passed, and we have to set it explicitly $_COOKIE['memberID'] = bx_get('oid'); $_COOKIE['memberPassword'] = bx_get('pwd'); check_logged(); } if (!isLogged()) { echo MsgBox(_t('_Access denied')); exit; } $sUpl = 'Uploader'; bx_import($sUpl, $this->_aModule); $sClassName = $this->_oConfig->getClassPrefix() . $sUpl; $oUploader = new $sClassName(); $this->processUpload($oUploader, $sAction); exit; } $bNotAllowView = $this->_iProfileId == 0 || !isLoggedActive(); $aAlbumInfo = array(); if (!$bNotAllowView && !empty($sParamValue1)) { $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => $sParamValue1, 'owner' => $this->_iProfileId)); if (!empty($aAlbumInfo)) { $bNotAllowView = $aAlbumInfo['AllowAlbumView'] == BX_DOL_PG_HIDDEN; } } if ($bNotAllowView) { $sKey = _t('_' . $this->_oConfig->getMainPrefix() . '_access_denied'); $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1); $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode), '', '', false); return; } //album actions check if (is_array($_POST['entry'])) { foreach ($_POST['entry'] as $iValue) { $iValue = (int) $iValue; switch (true) { case isset($_POST['action_delete']): $iCount = $this->_deleteAlbumUnits($iValue); if ($iCount == 0) { $this->oAlbums->removeAlbum($iValue); } break; case isset($_POST['action_move_to']): $this->oAlbums->moveObject((int) $_POST['album_id'], (int) $_POST['new_album'], $iValue); break; case isset($_POST['action_delete_object']): $this->_deleteFile($iValue); break; } } } $sCode = ''; switch ($sParamValue) { case 'main': bx_import('PageAlbumsOwner', $this->_aModule); $sClassName = $this->_oConfig->getClassPrefix() . 'PageAlbumsOwner'; $oPage = new $sClassName($this, array('browse', 'owner', getUsername($this->_iProfileId))); $sCode .= $oPage->getCode(); break; case 'main_objects': $sCode .= $this->getAlbumPageView($aAlbumInfo); break; } bx_import('PageAlbumsMy', $this->_aModule); $sClassName = $this->_oConfig->getClassPrefix() . 'PageAlbumsMy'; $oPage = new $sClassName($this, $this->_iProfileId, array($sParamValue, $sParamValue1, $sParamValue2, $sParamValue3)); $sClassPostfix = $oPage->getViewLevel() == 0 ? 'PageAlbumsOwner' : 'PageAlbumView'; bx_import($sClassPostfix, $this->_aModule); $sClassName = $this->_oConfig->getClassPrefix() . $sClassPostfix; $oPageViewOwner = new $sClassName($this, array()); $iPageWidth = $oPageViewOwner->getPageWidth(); if ($iPageWidth != 0) { $oPage->forcePageWidth($iPageWidth); } $GLOBALS['oTopMenu']->setCurrentProfileID($this->_iProfileId); $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $oPage->getCode() . $sCode), '', '', false); }
function actionAdmin() { $GLOBALS['iAdminPage'] = 1; require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php'; check_logged(); if (!@isAdmin()) { send_headers_page_changed(); login_form("", 1); exit; } //--- Process actions ---// $mixedResultSettings = ''; if (isset($_POST['save']) && isset($_POST['cat'])) { $mixedResultSettings = $this->setSettings($_POST); } if (isset($_POST['feedback-approve'])) { $this->_actPublish($_POST['feedback-ids'], true); } else { if (isset($_POST['feedback-reject'])) { $this->_actPublish($_POST['feedback-ids'], false); } else { if (isset($_POST['feedback-delete'])) { $this->_actDelete($_POST['feedback-ids']); } } } //--- Process actions ---// $sFilterValue = ''; if (isset($_GET['feedback-filter'])) { $sFilterValue = process_db_input($_GET['feedback-filter'], BX_TAGS_STRIP); } $sContent = DesignBoxAdmin(_t('_feedback_bcaption_settings'), $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $this->getSettingsForm($mixedResultSettings)))); $sContent .= DesignBoxAdmin(_t('_feedback_bcaption_view_admin'), $this->serviceAdminBlock(0, 0, $sFilterValue)); $aParams = array('title' => array('page' => _t('_feedback_pcaption_admin')), 'content' => array('page_main_code' => $sContent)); $this->_oTemplate->getPageCodeAdmin($aParams); }
function registerMember() { $oPC = new BxDolProfilesController(); $oZ = new BxDolAlerts('profile', 'before_join', 0, 0, $this->aValues[0]); $oZ->alert(); $aProfile1 = $this->oPF->getProfileFromValues($this->aValues[0]); if (empty($aProfile1['NickName'])) { $aProfile1['NickName'] = uriGenerate(empty($aProfile1['FirstName']) ? genRndPwd(10, false) : $aProfile1['FirstName'], 'Profiles', 'NickName'); } list($iId1, $sStatus1) = $oPC->createProfile($aProfile1); //--- check whether profile was created successfully or not if (!$iId1) { if (isset($aProfile1['ProfilePhoto']) && !empty($aProfile1['ProfilePhoto'])) { @unlink($GLOBALS['dir']['tmp'] . $aProfile1['ProfilePhoto']); } return array(false, 'Fail'); } //--- check for couple profile if ($this->bCouple) { $aProfile2 = $this->oPF->getProfileFromValues($this->aValues[1]); list($iId2, $sStatus2) = $oPC->createProfile($aProfile2, false, $iId1); if (!$iId2) { $oPC->deleteProfile($iId1); return array(false, 'Fail'); } } //--- upload profile photo if (isset($aProfile1['ProfilePhoto']) && !empty($aProfile1['ProfilePhoto'])) { $sPass1 = getPassword($iId1); bx_login($iId1); check_logged(); BxDolService::call('avatar', 'set_image_for_cropping', array($iId1, $GLOBALS['dir']['tmp'] . $aProfile1['ProfilePhoto'])); if (BxDolRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader')) { $aFileInfo = array('medTitle' => _t('_sys_member_thumb_avatar'), 'medDesc' => _t('_sys_member_thumb_avatar'), 'medTags' => _t('_ProfilePhotos'), 'Categories' => array(_t('_ProfilePhotos')), 'album' => str_replace('{nickname}', getUsername($iId1), getParam('bx_photos_profile_album_name')), 'albumPrivacy' => BX_DOL_PG_ALL); BxDolService::call('photos', 'perform_photo_upload', array($GLOBALS['dir']['tmp'] . $aProfile1['ProfilePhoto'], $aFileInfo, false), 'Uploader'); } } if (BxDolModule::getInstance('BxWmapModule')) { BxDolService::call('wmap', 'response_entry_add', array('profiles', $iId1)); } //--- create system event bx_import('BxDolAlerts'); $oZ = new BxDolAlerts('profile', 'join', $iId1, 0, array('status_text' => &$sStatus1)); $oZ->alert(); return array($iId1, $sStatus1); }
function serviceResponceProtectURL($sURL) { if (!isLogged() && bx_get('oid') && bx_get('pwd')) { // in case of request from flash, cookies are not passed, and we have to set it explicitly $_COOKIE['memberID'] = bx_get('oid'); $_COOKIE['memberPassword'] = bx_get('pwd'); check_logged(); } if (!$this->serviceIsUrlAccessable($sURL, getLoggedId())) { global $_page; global $_page_cont; $_page['name_index'] = -1; $_page['header'] = _t("_bx_pageac_access_denied"); $_page_cont[$_page['name_index']]['page_main_code'] = MsgBox(_t("_bx_pageac_deny_text")); PageCode(); exit; } }
/** * Declare that content is require user authoriztion and display login form if user isn't logged in * @param $bStudio require webmaster authorization */ function bx_require_authentication($bStudio = false) { $iRole = BX_DOL_ROLE_MEMBER; if ($bStudio) { $iRole = BX_DOL_ROLE_ADMIN; } $sID = isset($_COOKIE['memberID']) ? bx_process_input($_COOKIE['memberID']) : false; $sPassword = isset($_COOKIE['memberPassword']) ? bx_process_input($_COOKIE['memberPassword']) : false; if (bx_check_login($sID, $sPassword, $iRole)) { bx_login_form($bStudio); } check_logged(); }
function save_user_team($team_id, $new_team_name = false) { check_logged(); sql_begin(); // create new team if necessary if ($new_team_name) { sql_pe("INSERT INTO user_teams VALUES(NULL, ?, ?)", array(trim($new_team_name), $_SESSION['user_id'])); $team_id = sql_insert_id(); } sql_pe("UPDATE users SET user_team=? WHERE user_id=? LIMIT 1", array($team_id, $_SESSION['user_id'])); sql_commit(); return $team_id; }
function list_permissions($role_in) { global $_SESSION; if (!isset($_SESSION)) { session_start(); } $user_name = check_logged(); /// function checks if visitor is logged in. if (!$user_name) { return; } $allowed = false; if (!check_role("admin")) { return false; } // read the permissions database $d = loadDB(); if ($role_in !== null) { // return role names of the current user foreach ($d["roles"] as $key => $value) { if ($value["name"] == $role_in) { $permissions_names = array(); foreach ($value["permissions"] as $perm) { foreach ($d["permissions"] as $r) { if ($perm == $r["id"]) { $permissions_names[] = $r["name"]; } } } return $permissions_names; } } } else { // return all role names $permissions_names = array(); foreach ($d["permissions"] as $r) { $permissions_names[] = $r['name']; } return $permissions_names; } return; }
function serviceMenuItemsFilter($sType, &$aItems) { if ($_REQUEST['modules-uninstall'] && in_array('boonex/pageac/', $_REQUEST['pathes'])) { return; } //to avoid menu filtering during module uninstallation. define('BX_DOL_ROLE_MEMBER', 1); //this code is required here because at the time of BxDolMenu::load function call profiles.inc.php isn't fully included yet, define('BX_DOL_ROLE_ADMIN', 2); //thus all defines and function calls located in profiles.inc.php aren't executed at this moment check_logged(); //so a call to isLogged or check_logged always would fail here because BX_DOL_ROLE_MEMBER/BX_DOL_ROLE_ADMIN aren't defined yet. if (!isLogged()) { return; } elseif (isRole(BX_DOL_ROLE_ADMIN, getLoggedId())) { return; } //admin isn't affected by this module $aMembership = getMemberMembershipInfo(getLoggedId()); $iMemLevel = intval($aMembership['ID']); $aMenuCache = $this->_oDb->getAllMenuItems($sType); if ($sType == 'member') { foreach ($aItems as $sSection => $aSubItems) { if (!is_array($aSubItems)) { continue; } foreach ($aSubItems as $iItem => $aItem) { $iRealID = $aSubItems[$iItem]['menu_id']; if (!empty($aMenuCache[$iRealID]['MemLevels']) && !$aMenuCache[$iRealID]['MemLevels'][$iMemLevel]) { unset($aItems[$sSection][$iItem]); } } $aItems[$sSection] = array_values($aItems[$sSection]); } } else { foreach ($aItems as $iItem => $aItem) { if (!empty($aMenuCache[$iItem]['MemLevels']) && !$aMenuCache[$iItem]['MemLevels'][$iMemLevel]) { unset($aItems[$iItem]); } } } }
function actionAdmin() { $GLOBALS['iAdminPage'] = 1; require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php'; $sUri = $this->_oConfig->getUri(); check_logged(); if (!@isAdmin()) { send_headers_page_changed(); login_form("", 1); exit; } //--- Process actions ---// $mixedResultSettings = ''; if (isset($_POST['save']) && isset($_POST['cat'])) { $mixedResultSettings = $this->setSettings($_POST); } //--- Process actions ---// $sContent = DesignBoxAdmin(_t('_' . $sUri . '_bcaption_settings'), $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $this->getSettingsForm($mixedResultSettings)))); $aParams = array('title' => array('page' => _t('_membership_pcaption_admin')), 'content' => array('page_main_code' => $sContent)); $this->_oTemplate->getPageCodeAdmin($aParams); }
function registerMember() { $oPC = new BxDolProfilesController(); require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php'; $oZ = new BxDolAlerts('profile', 'before_join', 0, 0, $this->aValues[0]); $oZ->alert(); $aProfile1 = $this->oPF->getProfileFromValues($this->aValues[0]); list($iId1, $sStatus1) = $oPC->createProfile($aProfile1); //--- check whether profile was created successfully or not if (!$iId1) { if (isset($aProfile1['ProfilePhoto']) && !empty($aProfile1['ProfilePhoto'])) { @unlink($GLOBALS['dir']['tmp'] . $aProfile1['ProfilePhoto']); } return array(false, 'Fail'); } //--- check for couple profile if ($this->bCouple) { $aProfile2 = $this->oPF->getProfileFromValues($this->aValues[1]); list($iId2, $sStatus2) = $oPC->createProfile($aProfile2, false, $iId1); if (!$iId2) { $oPC->deleteProfile($iId1); return array(false, 'Fail'); } } //--- upload profile photo if (isset($aProfile1['ProfilePhoto']) && !empty($aProfile1['ProfilePhoto'])) { $sPass1 = getPassword($iId1); bx_login($iId1); check_logged(); BxDolService::call('avatar', 'set_image_for_cropping', array($iId1, $GLOBALS['dir']['tmp'] . $aProfile1['ProfilePhoto'])); if (BxDolRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader')) { $aFileInfo = array('medTitle' => _t('_bx_ava_avatar'), 'medDesc' => _t('_bx_ava_avatar'), 'medTags' => _t('_ProfilePhotos'), 'Categories' => array(_t('_ProfilePhotos')), 'album' => str_replace('{nickname}', getNickName($iId1), getParam('bx_photos_profile_album_name'))); BxDolService::call('photos', 'perform_photo_upload', array($GLOBALS['dir']['tmp'] . $aProfile1['ProfilePhoto'], $aFileInfo, false), 'Uploader'); } } //--- create system event bx_import('BxDolAlerts'); $oZ = new BxDolAlerts('profile', 'join', $iId1, 0, array('status_text' => &$sStatus1)); $oZ->alert(); return array($iId1, $sStatus1); }
<?php session_start(); /// initialize session include "../../code/php/AC.php"; $user_name = check_logged(); /// function checks if visitor is logged. echo '<script type="text/javascript"> user_name = "' . $user_name . '"; </script>' . "\n"; $allowed = false; if (check_role("admin")) { echo '<script type="text/javascript"> role = "admin"; </script>' . "\n"; $allowed = true; } $r = 'requests'; // collect .json files from the request directory to construct a table of current requests $req = array(); if (is_dir($r) && is_readable($r)) { if ($handle = opendir($r)) { while (false !== ($entry = readdir($handle))) { $file_parts = pathinfo($entry); if ($entry != "." && $entry != ".." && $file_parts['extension'] == 'json') { $req[] = json_decode(file_get_contents($r . "/" . $entry), true); } } closedir($handle); } } ?> <!DOCTYPE html> <html lang="en">
function actionAdmin($sName = '') { $GLOBALS['iAdminPage'] = 1; require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php'; $sUri = $this->_oConfig->getUri(); check_logged(); if (!@isAdmin()) { send_headers_page_changed(); login_form("", 1); exit; } //--- Process actions ---// $mixedResultSettings = ''; if (isset($_POST['save']) && isset($_POST['cat'])) { $mixedResultSettings = $this->setSettings($_POST); } if (isset($_POST[$sUri . '-publish'])) { $this->_actPublish($_POST[$sUri . '-ids'], true); } else { if (isset($_POST[$sUri . '-unpublish'])) { $this->_actPublish($_POST[$sUri . '-ids'], false); } else { if (isset($_POST[$sUri . '-featured'])) { $this->_actFeatured($_POST[$sUri . '-ids'], true); } else { if (isset($_POST[$sUri . '-unfeatured'])) { $this->_actFeatured($_POST[$sUri . '-ids'], false); } else { if (isset($_POST[$sUri . '-delete'])) { $this->_actDelete($_POST[$sUri . '-ids']); } } } } } //--- Process actions ---// //--- Get New/Edit form ---// $sPostForm = ''; if (!empty($sName)) { $sPostForm = $this->serviceEditBlock(process_db_input($sName, BX_TAGS_STRIP)); } else { if (isset($_POST['id'])) { $sPostForm = $this->serviceEditBlock((int) $_POST['id']); } else { $sPostForm = $this->servicePostBlock(); } } //--- Get New/Edit form ---// $sFilterValue = ''; if (isset($_GET[$sUri . '-filter'])) { $sFilterValue = process_db_input($_GET[$sUri . '-filter'], BX_TAGS_STRIP); } $sContent = DesignBoxAdmin(_t('_' . $sUri . '_bcaption_settings'), $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $this->getSettingsForm($mixedResultSettings)))); $sContent .= DesignBoxAdmin(_t('_' . $sUri . '_bcaption_post'), $sPostForm); $sContent .= DesignBoxAdmin(_t('_' . $sUri . '_bcaption_all'), $this->serviceAdminBlock(0, 0, $sFilterValue)); $aParams = array('title' => array('page' => _t('_' . $sUri . '_pcaption_admin')), 'content' => array('page_main_code' => $sContent)); $this->_oTemplate->getPageCodeAdmin($aParams); }
<?php session_start(); /// initialize session include "passwords.php"; check_logged(); /// function checks if visitor is logged. ?> <!DOCTYPE html> <?php global $uid; ?> <html lang="en"> <head> <meta charset="utf-8"> <title>Skruf Knowledge Base</title> <link rel="shortcut icon" href="/img/favicon.ico"> <!-- BOOTSTRAP --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> <!-- SKB --> <link rel="stylesheet" href="./css/skb.css">
function get_current_tagset() { check_logged(); return OPTION(OPT_NE_TAGSET); }