if (strlen($feature["subhead"]) > 0) { echo '<h2>' . $feature["subhead"] . '</h2>'; } if (strlen($feature["authorName"]) > 0) { echo '<p class="author">By <a href="author.php?id=' . $feature["author"] . '">' . $feature["authorName"] . "</a></p>"; } if (strlen($feature["datePosted"]) > 0) { echo '<p class="postdate">Posted ' . Format::formatDateLine($feature["datePosted"], true) . "</p>"; } ?> </div> <div id="featureSocialBar"> <?php $text = urlencode($feature["headline"]); $url = urlencode(Config::getSiteRoot() . '/feature.php?id=' . $id); $twitterHandle = Utility::getTenantProperty($applicationID, $tenantID, $userID, 'twitterHandle'); ?> <ul class="socialList"> <li><a class="social icon icon-twitter" href="http://twitter.com/intent/tweet?text=<?php echo $text; ?> &url=<?php echo $url . '&ch=t'; ?> &via=<?php echo $twitterHandle; ?> " target="_blank" rel="nofollow" title="Share on Twitter" aria-label="Share on Twitter"></a></li> <li><div class="fb-like" data-layout="button" data-action="like" data-size="large" data-show-faces="true" data-share="true"></div></li> </ul> </div>
<link rel="stylesheet" type="text/css" href="static/css/map.css" /> <script src="js/main.js"></script> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB9Zbt86U4kbMR534s7_gtQbx-0tMdL0QA&libraries=places"></script> </head> <body> <div id="topPart"> <?php include "partials/header.php"; ?> <!-- Modals --> <?php $showNumLocations = true; include "partials/configModal.php"; include "partials/locationModal.php"; include "partials/locationEditModal.php"; $defaultIcon = Utility::getTenantProperty($applicationID, $tenantID, $userID, 'defaultIcon'); if (strlen($defaultIcon) > 0) { echo '<input type="hidden" id="defaultIcon" value="' . $defaultIcon . ' " />'; } ?> </div> <div class="mapPane"> <div id="expandMap" class="mapEnlarge hidden" ><button class="btn btn-default btn-sm" onclick="expandMap();"><span class="glyphicon glyphicon-resize-full" aria-hidden="true"></span></button></div> <div id="shrinkMap" class="mapEnlarge" ><button class="btn btn-default btn-sm" onclick="shrinkMap();"><span class="glyphicon glyphicon-resize-small" aria-hidden="true"></span></button></div> <div id="mapwrapper" class="mapWrapper"> <div id="mapcanvas"></div> <?php //include "partials/mapOptions.php"; ?> <div id="loading" class="modal"><!-- Place inside div to cover --></div> </div>
Context::$tenantid = $tenantID; if (!isset($_SESSION['userID'])) { // set ID to 0 to indicate unauthenticated user $_SESSION['userID'] = 0; $userID = 0; } else { $userID = $_SESSION['userID']; } Log::debug('instantiating new user for userID=' . $userID, 1); $user = new User($userID, $tenantID); Context::$currentUser = $user; if ($newsession) { Log::startSession(session_id(), $tenantID, $userID); } if ($userID > 0 && !$user->canAccessTenant($tenantID)) { Log::debug('Unauthorized user attempted to access tenant page. (user='******', tenant=' . $tenantID . ')', 9); header('HTTP/1.0 403 Forbidden'); echo '<p>You are not allowed to access this resource.</p>'; exit; } elseif ($userID == 0) { // TO DO: check whether tenant allows anonymous access // for now, assume that they all do $allowAnon = Utility::getTenantProperty($applicationID, $tenantID, $userID, 'allowAnonAccess'); if (!$allowAnon && strtolower(basename($_SERVER['PHP_SELF'])) != 'login.php') { //echo strtolower(basename($_SERVER['PHP_SELF'])); Log::debug('Unauthenticated user attempted to access tenant page. Redirecting to login. (tenant=' . $tenantID . ')', 9); header('Location: Login.php?context=loginRequired'); die; } } Utility::debug('pageCheck complete. (user='******', tenant=' . $tenantID . ')', 1);
<a class="navbar-brand" href="<?php echo Config::getSiteRoot(); ?> /index.php"><?php $icon = Utility::getTenantProperty($applicationID, $tenantID, $userID, 'smallLogo'); $title = ucfirst(Utility::getTenantProperty($applicationID, $tenantID, $userID, 'title')); if (strlen($icon) > 0) { echo '<img src="' . Config::getSiteRoot() . $icon . '" alt=""' . $title . '" />'; } else { echo $title; } ?> </a> </div> <?php $finditem = Utility::getTenantProperty($applicationID, $tenantID, $userID, 'finditem'); ?> <div class="collapse navbar-collapse" id="navbar1"> <ul class="nav navbar-nav"> <?php $menu = Utility::getTenantMenu($applicationID, $userID, $tenantID); if (is_array($menu)) { foreach ($menu as $item) { $roles = $item["roles"]; $visible = false; if ($roles == '' || $user->hasRole('admin', $tenantID)) { $visible = true; } else { $roleSet = explode(',', $roles); foreach ($roleSet as $role) { if ($user->hasRole($role, $tenantID)) {
public function changePassword($data) { $userid = $data->{'id'}; $username = $data->{'username'}; if (!property_exists($data, "original")) { // if no password was submitted, the assumption must be that it is a reset request. $data->{'original'} = 'reset'; } $expirationDays = Utility::getTenantProperty(1, $this->tenantid, $this->id, 'passwordExpires'); $expirationDate = null; if ($expirationDays) { $interval = 'P' . $expirationDays . 'D'; $expirationDate = new DateTime("now"); $expirationDate = $expirationDate->add(new DateInterval($interval)); } // check change password rules if ($data->{'original'} == $data->{'new1'}) { throw new Exception('The new password cannot be the same as your current one.'); } elseif ($data->{'new2'} != $data->{'new1'}) { throw new Exception('The two versions of the new password do not match'); } elseif (strlen($data->{'new1'}) < 8) { throw new Exception('The new password must be at least 8 characters long.'); } // validate original password if (!$this->validatePassword($data->{'original'}, $username, $userid)) { throw new Exception('Original password is incorrect'); } return $this->updatepassword($data->{'new1'}, $expirationDate); }
<?php include dirname(__FILE__) . '/core/partials/pageCheck.php'; $thisPage = "states"; // get list of states to enable for tenant - set as Tenant Property using admin page $stateList = Utility::getTenantProperty($applicationID, $tenantID, $userID, 'enabledStates'); if (is_null($stateList)) { $stateList = ""; } ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Food Finder</title> <?php include "partials/includes.php"; ?> <script src="js/raphael.js" type="text/javascript" ></script> <script src="js/jquery.usmap.js" type="text/javascript"></script> <script src="js/states.js" type="text/javascript" ></script> <script src="js/content.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="static/css/statemap.css" > <div id="outer"> <?php include 'partials/header.php'; ?> <?php include 'core/partials/contentControls.php'; ?>
$thisPage = "mediaManager"; $return = 20; $offset = Utility::getRequestVariable('offset', 0); $filters = ""; // should we get from param? $class = new Media($userID, $tenantID); $count = $class->getEntityCount($filters); $media = $class->getEntities($filters, $return, $offset); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title><?php echo Utility::getTenantProperty($applicationID, $_SESSION['tenantID'], $userID, 'title'); ?> </title> <?php include "partials/includes.php"; ?> <link rel="stylesheet" type="text/css" href="static/css/mediaManager.css" /> <script type="text/javascript" src="js/jquery.form.min.js"></script> <script type="text/javascript" src="js/bootpag.min.js"></script> <script src="js/mediaManager.js" type="text/javascript"></script> <script src="js/workingPanel.js" type="text/javascript"></script> </head> <body> <div id="maincontent"> <div id="outer"> <?php
?> " /> <link rel="stylesheet" type="text/css" href="<?php echo Config::getSiteRoot(); ?> /core/css/styles.css" /> <link rel="stylesheet" type="text/css" href="<?php echo Config::getSiteRoot(); ?> /core/css/bootstrap.css" /> <link rel="stylesheet" type="text/css" href="<?php echo Config::getSiteRoot(); ?> /static/css/foodfinder.css" /> <link rel="stylesheet" type="text/css" href="<?php echo Config::getSiteRoot() . '/' . Utility::getTenantProperty($applicationID, $tenantID, $userID, 'css'); ?> " /> <script src="<?php echo Config::getSiteRoot(); ?> /js/jquery-1.10.2.js"></script> <script src="<?php echo Config::getSiteRoot(); ?> /js/mustache.js"></script> <script src="<?php echo Config::getSiteRoot(); ?> /js/bootstrap.min.js"></script>
</div> <div class="panel"> <form id="tenantSwitcherForm" action="admin.php?flushCache=yes" method="post" role="form" > <input class="btn btn-default" type="submit" value="Clear Cache" /> <h3>Tenant Settings</h3> <div class="row"> <div class="col-md-3">Current Tenant Style Sheet (css)</div> <div class="col-md-3"><?php echo Utility::getTenantProperty($applicationID, $tenantID, $userID, 'css'); ?> </div> </div> <div class="row"> <div class="col-md-3">Show Ads (showAds)</div> <div class="col-md-3"><?php echo Utility::getTenantProperty($applicationID, $tenantID, $userID, 'showAds'); ?> </div> </div> </form> </div> </div> <div id="useradmin" role="tabpanel" class="tab-pane"> <h1>Manage Users</h1> <div id="user-buttons" class="btn-group btn-default"> <button class="btn btn-default" id="adduser" onclick="addUser();"> <span class="glyphicon glyphicon-plus"></span> Add User </button> </div> <div id="alertZone"></div> <div id="userList">
public static function getTenantPropertyEx($applicationID, $tenantID, $userID, $property, $defaultValue) { $value = Utility::getTenantProperty($applicationID, $tenantID, $userID, $property); if (is_null($value)) { $value = $defaultValue; } return $value; }