コード例 #1
0
ファイル: controller.php プロジェクト: rii-J/concrete5-de
	public function displayItem() {
		$u = new User();
		if ($u->isRegistered()) {
			$fp = FilePermissions::getGlobal();
			if ($fp->canSearchFiles() && $u->config('UI_FILEMANAGER')) {
				return true;
			}
		}
		return false;
	}
コード例 #2
0
ファイル: controller.php プロジェクト: rii-J/concrete5-de
	public function displayItem() {
		$u = new User();
		if ($u->isRegistered()) {
			if ($u->config('UI_SITEMAP')) {
				$sh = Loader::helper('concrete/dashboard/sitemap');
				return $sh->canRead();
			}
		}
		return false;
	}
コード例 #3
0
ファイル: TSunic.class.php プロジェクト: nfrickler/tsunic
 /** Check, if JavaScript is enabled
  *
  * Is JavaScript enabled for this user? This method will give you the
  * answer.
  *
  * @param bool $getDistinguishable
  *	Return true, only if JavaScript has been disabled by the user
  *	explicitely (false, if this has been detected automatically)
  *
  * @return bool
  */
 public function isJavascript($getDistinguishable = false)
 {
     // get javascript-setting
     $value = $this->Usr->config('$$$javascript');
     // get return
     if ($getDistinguishable) {
         return $value;
     } else {
         if ($value == 'off' or $value === false) {
             return false;
         }
         return true;
     }
 }
コード例 #4
0
 protected function finishLogin($loginData = array())
 {
     $u = new User();
     if ($this->post('uMaintainLogin')) {
         $u->setUserForeverCookie();
     }
     if (count($this->locales) > 0) {
         if (Config::get('LANGUAGE_CHOOSE_ON_LOGIN') && $this->post('USER_LOCALE') != '') {
             $u->setUserDefaultLanguage($this->post('USER_LOCALE'));
         }
     }
     // Verify that the user has filled out all
     // required items that are required on register
     // That means users logging in after new user attributes
     // have been created and required will be prompted here to
     // finish their profile
     $this->set('invalidRegistrationFields', false);
     Loader::model('attribute/categories/user');
     $ui = UserInfo::getByID($u->getUserID());
     $aks = UserAttributeKey::getRegistrationList();
     $unfilledAttributes = array();
     foreach ($aks as $uak) {
         if ($uak->isAttributeKeyRequiredOnRegister()) {
             $av = $ui->getAttributeValueObject($uak);
             if (!is_object($av)) {
                 $unfilledAttributes[] = $uak;
             }
         }
     }
     if ($this->post('completePartialProfile')) {
         foreach ($unfilledAttributes as $uak) {
             $e1 = $uak->validateAttributeForm();
             if ($e1 == false) {
                 $this->error->add(t('The field "%s" is required', $uak->getAttributeKeyName()));
             } else {
                 if ($e1 instanceof ValidationErrorHelper) {
                     $this->error->add($e1);
                 }
             }
         }
         if (!$this->error->has()) {
             // the user has needed to complete a partial profile, and they have done so,
             // and they have no errors. So we save our profile data against the account.
             foreach ($unfilledAttributes as $uak) {
                 $uak->saveAttributeForm($ui);
                 $unfilledAttributes = array();
             }
         }
     }
     if (count($unfilledAttributes) > 0) {
         $u->logout();
         $this->set('invalidRegistrationFields', true);
         $this->set('unfilledAttributes', $unfilledAttributes);
     }
     $txt = Loader::helper('text');
     $rcID = $this->post('rcID');
     $nh = Loader::helper('validation/numbers');
     //set redirect url
     if ($nh->integer($rcID)) {
         $nh = Loader::helper('navigation');
         $rc = Page::getByID($rcID);
         $url = $nh->getLinkToCollection($rc, true);
         $loginData['redirectURL'] = $url;
     } elseif (strlen($rcID)) {
         $rcID = trim($rcID, '/');
         $nc2 = Page::getByPath('/' . $rcID);
         if (is_object($nc2) && !$nc2->isError()) {
             $loginData['redirectURL'] = BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '/' . $rcID;
         }
     }
     /*
     //full page login redirect (non-ajax login)
     if( strlen($loginData['redirectURL']) && $_REQUEST['format']!='JSON' ){ 
     	header('Location: ' . $loginData['redirectURL']);
     	exit;	
     }
     */
     $dash = Page::getByPath("/dashboard", "RECENT");
     $dbp = new Permissions($dash);
     Events::fire('on_user_login', $this);
     //End JSON Login
     if ($_REQUEST['format'] == 'JSON') {
         return $loginData;
     }
     //should administrator be redirected to dashboard?  defaults to yes if not set.
     $adminToDash = intval(Config::get('LOGIN_ADMIN_TO_DASHBOARD'));
     //Full page login, standard redirection
     $u = new User();
     // added for the required registration attribute change above. We recalc the user and make sure they're still logged in
     if ($u->isRegistered()) {
         if ($u->config('NEWSFLOW_LAST_VIEWED') == 'FIRSTRUN') {
             $u->saveConfig('NEWSFLOW_LAST_VIEWED', 0);
         }
         if ($loginData['redirectURL']) {
             //make double secretly sure there's no caching going on
             header("Cache-Control: no-store, no-cache, must-revalidate");
             header("Pragma: no-cache");
             header('Expires: Fri, 30 Oct 1998 14:19:41 GMT');
             //in the past
             $this->externalRedirect($loginData['redirectURL']);
         } else {
             if ($dbp->canRead() && $adminToDash) {
                 $this->redirect('/dashboard');
             } else {
                 //options set in dashboard/users/registration
                 $login_redirect_cid = intval(Config::get('LOGIN_REDIRECT_CID'));
                 $login_redirect_mode = Config::get('LOGIN_REDIRECT');
                 //redirect to user profile
                 if ($login_redirect_mode == 'PROFILE' && ENABLE_USER_PROFILES) {
                     $this->redirect('/profile/', $u->uID);
                     //redirect to custom page
                 } elseif ($login_redirect_mode == 'CUSTOM' && $login_redirect_cid > 0) {
                     $redirectTarget = Page::getByID($login_redirect_cid);
                     if (intval($redirectTarget->cID) > 0) {
                         $this->redirect($redirectTarget->getCollectionPath());
                     } else {
                         $this->redirect('/');
                     }
                     //redirect home
                 } else {
                     $this->redirect('/');
                 }
             }
         }
     }
 }
コード例 #5
0
ファイル: controller.php プロジェクト: VonUniGE/concrete5-1
 public function view($updated = false, $aux = false)
 {
     $u = new User();
     $this->set('site_tracking_code', Config::get('SITE_TRACKING_CODE'));
     $this->set('url_rewriting', URL_REWRITING);
     $this->set('marketplace_enabled_in_config', Config::get('ENABLE_MARKETPLACE_SUPPORT'));
     $this->set('site', SITE);
     $this->set('ui_breadcrumb', $u->config('UI_BREADCRUMB'));
     $this->set('ui_filemanager', $u->config('UI_FILEMANAGER'));
     $this->set('ui_sitemap', $u->config('UI_SITEMAP'));
     $this->set('api_key_picnik', Config::get('API_KEY_PICNIK'));
     $txtEditorMode = Config::get('CONTENTS_TXT_EDITOR_MODE');
     $this->set('txtEditorMode', $txtEditorMode);
     $this->set('rewriteRules', $this->getRewriteRules());
     $textEditorWidth = Config::get('CONTENTS_TXT_EDITOR_WIDTH');
     $this->set('textEditorWidth', $textEditorWidth);
     $textEditorHeight = Config::get('CONTENTS_TXT_EDITOR_HEIGHT');
     $this->set('textEditorHeight', $textEditorHeight);
     $txtEditorCstmCode = Config::get('CONTENTS_TXT_EDITOR_CUSTOM_CODE');
     if (!strlen($txtEditorCstmCode) || $txtEditorMode != 'CUSTOM') {
         $txtEditorCstmCode = $this->get_txt_editor_default();
     }
     $this->set('txtEditorCstmCode', $txtEditorCstmCode);
     Loader::library('marketplace');
     $mi = Marketplace::getInstance();
     if ($mi->isConnected()) {
         $this->set('marketplacePageURL', Marketplace::getSitePageURL());
     }
     if ($updated) {
         switch ($updated) {
             case 'statistics_saved':
                 $this->set('message', t('Statistics tracking preference saved.'));
                 break;
             case "tracking_code_saved":
                 $this->set('message', t('Your tracking code has been saved.'));
                 break;
                 /*
                 //moved to set_permissions
                 case "maintenance_enabled";
                 	$this->set('message', t('Maintenance Mode turned on. Your site is now private.'));	
                 	break;
                 case "maintenance_disabled":
                 	$this->set('message', t('Maintenance Mode turned off. Your site is public.'));	
                 	break;
                 */
             /*
             //moved to set_permissions
             case "maintenance_enabled";
             	$this->set('message', t('Maintenance Mode turned on. Your site is now private.'));	
             	break;
             case "maintenance_disabled":
             	$this->set('message', t('Maintenance Mode turned off. Your site is public.'));	
             	break;
             */
             case "marketplace_turned_on":
                 $this->set('message', t('Marketplace support is now enabled.'));
                 break;
             case "marketplace_turned_off":
                 $this->set('message', t('Marketplace support is now disabled.'));
                 break;
             case "favicon_saved":
                 $this->set('message', t('Bookmark icon saved.'));
                 break;
             case "favicon_removed":
                 $this->set('message', t('Bookmark icon removed.'));
                 break;
             case "editing_preferences_saved":
                 $this->set('message', t('Editing preferences saved.'));
                 break;
             case "sitename_saved":
                 $this->set('message', t("Your site's name has been saved."));
                 break;
             case "image_editing_saved":
                 $this->set('message', t("Image editing options have been saved."));
                 break;
             case "debug_saved":
                 $this->set('message', t('Debug configuration saved.'));
                 break;
             case "cache_cleared":
                 $this->set('message', t('Cached files removed.'));
                 break;
             case "cache_updated":
                 $this->set('message', t('Cache settings saved.'));
                 break;
             case "txt_editor_config_saved":
                 $this->set('message', t('Content text editor settings saved.'));
                 break;
             case "rewriting_saved":
                 if (URL_REWRITING) {
                     if ($aux == 0) {
                         $this->set('message', t('URL rewriting enabled. Make sure you copy the lines below these URL Rewriting settings area and place them in your .htaccess or web server configuration file.'));
                     } else {
                         $this->set('message', t('URL rewriting enabled. .htaccess file updated.'));
                     }
                 } else {
                     $this->set('message', t('URL rewriting disabled.'));
                 }
                 break;
         }
     }
 }
コード例 #6
0
ファイル: file_list.php プロジェクト: homer6/concrete5-mirror
 public function getCurrent()
 {
     $u = new User();
     $fldc = $u->config('FILE_LIST_DEFAULT_COLUMNS');
     if ($fldc != '') {
         $fldc = @unserialize($fldc);
     }
     if (!$fldc instanceof DatabaseItemListColumnSet) {
         $fldc = new FileManagerDefaultColumnSet();
     }
     return $fldc;
 }
コード例 #7
0
ファイル: interface.php プロジェクト: Zyqsempai/amanet
 public function showNewsflowOverlay()
 {
     $tp = new TaskPermission();
     $c = Page::getCurrentPage();
     if (MOBILE_THEME_IS_ACTIVE == false && ENABLE_NEWSFLOW_OVERLAY == true && $tp->canViewNewsflow() && $c->getCollectionPath() != '/dashboard/news') {
         $u = new User();
         $nf = $u->config('NEWSFLOW_LAST_VIEWED');
         if ($nf == 'FIRSTRUN') {
             return false;
         }
         if (Config::get('SITE_MAINTENANCE_MODE')) {
             return false;
         }
         if (!$nf) {
             return true;
         }
         if (time() - $nf > NEWSFLOW_VIEWED_THRESHOLD) {
             return true;
         }
     }
     return false;
 }
コード例 #8
0
ファイル: sitemap.php プロジェクト: rii-J/concrete5-de
var CCM_DIALOG_TITLE = "<?php echo $dialog_title?>";
var CCM_DIALOG_HEIGHT = "<?php echo $dialog_height?>";
var CCM_DIALOG_WIDTH = "<?php echo $dialog_width?>";
var CCM_TARGET_ID = "<?php echo $target_id?>";
var CCM_SITEMAP_EXPLORE_NODE = "<?php echo $node?>";
</script>

<?php  if (!$sitemapCombinedMode) { ?>
	<h1 id="ccm-sitemap-title"><?php echo t('Sitemap')?></h1>
<?php  } ?>

<div id="ccm-dashboard-select-display-mode">
<form>
<?php  
$u = new User();
$sitemapOverlayPreference = $u->config('SITEMAP_OVERLAY_DISPLAY_MODE');
$display_mode = $sitemapOverlayPreference;

if (!isset($callback)) {
	$sitemap_select_callback = 'ccm_selectSitemapNode';
}
if ($sitemapOverlayPreference != 'explore') {
	$sitemapOverlayPreference = 'full';
	$display_mode = 'full';
	$node = 0;
} else if (!isset($node)) {
	$node = 1;
}
?>
<input type="radio" name="ccm-dashboard-display-mode" value="full" <?php  if ($sitemapOverlayPreference == 'full') { ?> checked <?php  } ?> onclick="ccm_sitemapSelectDisplayMode('<?php echo $instance_id?>', 'full', '<?php echo $select_mode?>', '<?php echo $cID?>')" /> <?php echo t('Full Sitemap')?>
&nbsp;&nbsp;&nbsp;&nbsp;
コード例 #9
0
ファイル: dashboard.php プロジェクト: rmxdave/concrete5
 public function getDashboardPaneHeader($title = false, $help = false, $navigatePages = array(), $upToPage = false)
 {
     $c = Page::getCurrentPage();
     $vt = Loader::helper('validation/token');
     $token = $vt->generate('access_quick_nav');
     $currentMenu = array();
     $nh = Loader::helper('navigation');
     $trail = $nh->getTrailToCollection($c);
     if (count($trail) > 1 || count($navigatePages) > 1 || is_object($upToPage)) {
         $parent = Page::getByID($c->getCollectionParentID());
         if (count($trail) > 1 && !is_object($upToPage)) {
             $upToPage = Page::getByID($parent->getCollectionParentID());
         }
         Loader::block('autonav');
         $subpages = array();
         if ($navigatePages !== -1) {
             if (count($navigatePages) > 0) {
                 $subpages = $navigatePages;
             } else {
                 $subpages = AutonavBlockController::getChildPages($parent);
             }
         }
         $subpagesP = array();
         foreach ($subpages as $sc) {
             $cp = new Permissions($sc);
             if ($cp->canRead()) {
                 $subpagesP[] = $sc;
             }
         }
         if (count($subpagesP) > 0 || is_object($upToPage)) {
             $relatedPages = '<div id="ccm-page-navigate-pages-content" style="display: none">';
             $relatedPages .= '<ul class="ccm-navigate-page-menu">';
             foreach ($subpagesP as $sc) {
                 if ($c->getCollectionPath() == $sc->getCollectionPath() || strpos($c->getCollectionPath(), $sc->getCollectionPath()) == 0 && strpos($c->getCollectionPath(), $sc->getCollectionPath()) !== false) {
                     $class = 'nav-selected';
                 } else {
                     $class = '';
                 }
                 $relatedPages .= '<li class="' . $class . '"><a href="' . $nh->getLinkToCollection($sc, false, true) . '">' . $sc->getCollectionName() . '</a></li>';
             }
             if ($upToPage) {
                 $relatedPages .= '<li class="ccm-menu-separator"></li>';
                 $relatedPages .= '<li><a href="' . $nh->getLinkToCollection($upToPage, false, true) . '">' . t('&lt; Back to %s', $upToPage->getCollectionName()) . '</a></li>';
             }
             $relatedPages .= '</ul>';
             $relatedPages .= '</div>';
             $navigateTitle = $parent->getCollectionName();
         }
     }
     $html = '<div class="ccm-pane-header">';
     $html .= $relatedPages;
     $class = 'ccm-icon-favorite';
     $u = new User();
     $quicknav = unserialize($u->config('QUICK_NAV_BOOKMARKS'));
     if (is_array($quicknav)) {
         if (in_array($c->getCollectionID(), $quicknav)) {
             $class = 'ccm-icon-favorite-selected';
         }
     }
     $html .= '<ul class="ccm-pane-header-icons">';
     if (!$help) {
         $ih = Loader::helper('concrete/interface/help');
         $pageHelp = $ih->getPages();
         if (isset($pageHelp[$c->getCollectionPath()])) {
             $help = $pageHelp[$c->getCollectionPath()];
         }
     }
     if (is_array($help)) {
         $help = $help[0] . '<br/><br/><a href="' . $help[1] . '" class="btn small" target="_blank">' . t('Learn More') . '</a>';
     }
     if (isset($relatedPages)) {
         $html .= '<li><a href="javascript:void(0)" onmouseover="ccm_togglePopover(event, this)" class="ccm-icon-navigate-pages" title="' . $navigateTitle . '" id="ccm-page-navigate-pages">' . t('Help') . '</a></li>';
     }
     if ($help) {
         $html .= '<li><span style="display: none" id="ccm-page-help-content">' . $help . '</span><a href="javascript:void(0)" onclick="ccm_togglePopover(event, this)" class="ccm-icon-help" title="' . t('Help') . '" id="ccm-page-help">' . t('Help') . '</a></li>';
     }
     if (Config::get('TOOLBAR_QUICK_NAV_BEHAVIOR') != 'disabled') {
         $html .= '<li><a href="javascript:void(0)" id="ccm-add-to-quick-nav" onclick="ccm_toggleQuickNav(' . $c->getCollectionID() . ',\'' . $token . '\')" class="' . $class . '">' . t('Add to Favorites') . '</a></li>';
     }
     $html .= '<li><a href="javascript:void(0)" onclick="ccm_closeDashboardPane(this)" class="ccm-icon-close">' . t('Close') . '</a></li>';
     $html .= '</ul>';
     if (!$title) {
         $title = $c->getCollectionName();
     }
     $html .= '<h3>' . $title . '</h3>';
     $html .= '</div>';
     return $html;
 }
コード例 #10
0
        $statusMessage .= "<br/>" . t('(All edits take effect immediately)');
    }
    if ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage() || $cp->canApproveCollection()) {
        ?>

menuHTML += '<div id="ccm-page-controls">';
menuHTML += '<div id="ccm-logo-wrapper"><img src="<?php 
        echo ASSETS_URL_IMAGES;
        ?>
/logo_menu.png" width="49" height="49" id="ccm-logo" /></div>';
menuHTML += '<div id="ccm-system-nav-wrapper1">';
menuHTML += '<div id="ccm-system-nav-wrapper2">';
menuHTML += '<ul id="ccm-system-nav">';

<?php 
        if ($sh->canRead() && $u->config('UI_SITEMAP')) {
            ?>
	menuHTML += '<li><a id="ccm-nav-sitemap" dialog-title="<?php 
            echo t('Navigate to Page');
            ?>
" href="<?php 
            echo REL_DIR_FILES_TOOLS_REQUIRED;
            ?>
/sitemap_search_selector?callback=ccm_goToSitemapNode&sitemap_select_mode=select_page" dialog-on-open="$(\'#ccm-nav-sitemap\').removeClass(\'ccm-nav-loading\')" dialog-width="90%" dialog-height="70%" dialog-modal="false"><?php 
            echo t('Sitemap');
            ?>
</a></li>';
<?php 
        }
        $fp = FilePermissions::getGlobal();
        if ($fp->canSearchFiles() && $u->config('UI_FILEMANAGER')) {
コード例 #11
0
ファイル: User.php プロジェクト: Omnikron13/phpuserlite
 public static function getDB()
 {
     if (User::$db === NULL) {
         User::$db = new PDO('sqlite:' . User::config('db_path'));
         User::$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         User::$db->exec('PRAGMA foreign_keys = ON');
     }
     return User::$db;
 }
コード例 #12
0
ファイル: dashboard.php プロジェクト: Mihail9575/concrete5
 public static function getMine()
 {
     $u = new User();
     $qn = unserialize($u->config('QUICK_NAV_BOOKMARKS'));
     if (is_object($qn)) {
         return $qn;
     }
     $qn = new ConcreteDashboardMenu();
     $qnx = new ConcreteDashboardDefaultMenu();
     $qn->items = $qnx->items;
     return $qn;
 }
コード例 #13
0
ファイル: interface.php プロジェクト: nbourguig/concrete5
	public function getQuickNavigationBar() {
		$c = Page::getCurrentPage();
		if (!is_object($c) || Config::get('TOOLBAR_QUICK_NAV_BEHAVIOR') == 'disabled') {
			return;
		}
		
		if (!is_array($_SESSION['ccmQuickNavRecentPages'])) {
			$_SESSION['ccmQuickNavRecentPages'] = array();
		}
		if (in_array($c->getCollectionID(), $_SESSION['ccmQuickNavRecentPages'])) {
			unset($_SESSION['ccmQuickNavRecentPages'][array_search($c->getCollectionID(), $_SESSION['ccmQuickNavRecentPages'])]);
			$_SESSION['ccmQuickNavRecentPages'] = array_values($_SESSION['ccmQuickNavRecentPages']);
		}
		
		$_SESSION['ccmQuickNavRecentPages'][] = $c->getCollectionID();

		if (count($_SESSION['ccmQuickNavRecentPages']) > 5) {
			array_shift($_SESSION['ccmQuickNavRecentPages']);
		}
		
		$html = '';
		$class = '';
		if (Config::get('TOOLBAR_QUICK_NAV_BEHAVIOR') == 'always') { 
			$class = 'ccm-quick-nav-always';
		}
		$html .= '<div id="ccm-quick-nav" class="' . $class . '">';
		$html .= '<ul id="ccm-quick-nav-favorites" class="pills">';
		$u = new User();
		$quicknav = unserialize($u->config('QUICK_NAV_BOOKMARKS'));
		if (is_array($quicknav)) {
			foreach($quicknav as $cID) {
				$c = Page::getByID($cID);
				$cp = new Permissions($c);
				if ($cp->canRead() && is_object($c) && (!$c->isError())) {
					$html .= '<li id="ccm-quick-nav-page-' . $c->getCollectionID() . '">' . $this->getQuickNavigationLinkHTML($c) . '</li>';
				}
			}
		}
		$html .= '</ul>';
		if (count($_SESSION['ccmQuickNavRecentPages']) > 0) {
			$html .= '<ul id="ccm-quick-nav-breadcrumb" class="pills">';
			$i = 0;
			foreach($_SESSION['ccmQuickNavRecentPages'] as $_cID) {
				$_c = Page::getByID($_cID);
				$name = t('(No Name)');
				$divider = '';
				if (isset($_SESSION['ccmQuickNavRecentPages'][$i+1])) {
					$divider = '<span class="divider">/</span>';
				}
				if ($_c->getCollectionName()) {
					$name = $_c->getCollectionName();
				}
				$html .= '<li><a id="ccm-recent-page-' . $_c->getCollectionID() . '" href="' . Loader::helper('navigation')->getLinkToCollection($_c) . '">' . t($name) . '</a>' . $divider . '</li>';
				$i++;
			}
			$html .= '</ul>';
		}
		$html .= '</div>';
		return $html;
	}
コード例 #14
0
<?php  } ?>

<?php 
if ($statusMessage != '') {?> 
	$(function() { ccmAlert.hud('<?php echo str_replace("'",'"',$statusMessage) ?>', 5000); });
<?php  } ?>

	
	$(function() {
		$(document.body).prepend('<div id="ccm-page-controls-wrapper"></div>');
		$("#ccm-page-controls-wrapper").html(menuHTML);
	
		<?php  if ($c->isArrangeMode()) { ?>
			$(ccm_arrangeInit);	
		<?php  } else if ($c->isEditMode()) { ?>
			$(ccm_editInit);	
		<?php  } else { ?>
			$(ccm_init);
		<?php  } ?>
		
		<?php  if ($u->config('UI_BREADCRUMB')) {  ?>
			ccm_setupBreadcrumb();
		<?php  } ?>
		
	});
<?php 
	}
	
} ?>