function toggleMode() { $conn = getDbConn(); $sql = "SELECT * FROM cloud_gallery_config WHERE config_key='IS_READ_ONLY_MODE'"; $result = $conn->query($sql); $rows = $result->num_rows; if ($rows > 0) { if (isReadOnlyMode()) { $sql = "UPDATE cloud_gallery_config SET config_value='0' WHERE config_key='IS_READ_ONLY_MODE'"; } else { $sql = "UPDATE cloud_gallery_config SET config_value='1' WHERE config_key='IS_READ_ONLY_MODE'"; } } else { $sql = "INSERT into cloud_gallery_config (config_key, config_value) VALUES ('IS_READ_ONLY_MODE', '1')"; } $conn->query($sql); $conn->close(); }
if (WorkbenchConfig::get()->value("requireSSL") && !usingSslEndToEnd()) { if (WorkbenchContext::isEstablished()) { WorkbenchContext::get()->release(); } httpError("403.4 SSL Required", "Secure connection to Workbench and Salesforce required"); //TODO: what do we want to do here? } //kick user back to login page for any page that requires a session and one isn't established $myPage = getMyPage(); if (!isLoggedIn() && $myPage->requiresSfdcSession) { session_unset(); session_destroy(); header('Location: login.php'); exit; } if (!$myPage->isReadOnly && isReadOnlyMode()) { throw new WorkbenchHandledException("This page is not accessible in read-only mode"); } if (WorkbenchContext::isEstablished() && !$myPage->isReadOnly && $_SERVER['REQUEST_METHOD'] == 'POST') { validateCsrfToken(); } if (WorkbenchContext::isEstablished() && isset($_POST['termsAccepted'])) { WorkbenchContext::get()->agreeToTerms(); } if (isLoggedIn()) { // todo: should this be in the ctx? if (!in_array(basename($_SERVER['PHP_SELF'], ".php"), array("login", "logout")) && isset($_SESSION['lastRequestTime'])) { $idleTime = microtime(true) - $_SESSION['lastRequestTime']; if ($idleTime > WorkbenchConfig::get()->value("sessionIdleMinutes") * 60) { // ping SFDC to check if session is still alive WorkbenchContext::get()->getPartnerConnection()->getServerTimestamp();
<?php session_start(); include 'header.php'; ?> </p></p> <?php require 'vendor/autoload.php'; require 'resources/library/db.php'; if (isReadOnlyMode()) { ?> <h3 center> Read Only Mode has been enabled. Photo uploads are temporarily disabled. You can still view the gallery. <br/> Please click <a href="gallery.php">here</a> to navigate to the Gallery or use navigation menu to navigate to any other location</h3> <?php } else { ?> <form enctype="multipart/form-data" action="result.php" method="POST"> <div class="row"> <div class="small-8 columns"> <div class="small-3 columns"> <label for="userfile">Select file to Upload</label> </div> <div class="small-9 columns"> <input type="file" id="userfile" name="userfile" placeholder="Choose File" /> </div> </div> </div> <div class="row">
<div id='mainBlock'> <div id='navMenu' style="clear: both;"> <span class="preload1"></span> <span class="preload2"></span> <ul id="nav"> <?php foreach ($GLOBALS["MENUS"] as $menu => $pages) { if (isReadOnlyMode() && $menu == "Data") { //special-case for Data menu, since all read-only continue; } $menuLabel = $menu == "WORKBENCH" ? " <img src='" . getPathToStaticResource('/images/workbench-3-cubed-white-small.png') . "'/>" : strtolower($menu); print "<li class='top'><a class='top_link'><span class='down'>" . $menuLabel . "</span></a>\n" . "<ul class='sub'>"; foreach ($pages as $href => $page) { if (!$page->onNavBar || !isLoggedIn() && $page->requiresSfdcSession || isLoggedIn() && $page->title == 'Login' || !$page->isReadOnly && isReadOnlyMode()) { continue; } print "<li><a href='{$href}' onmouseover=\"Tip('{$page->desc}')\" target=\"" . $page->window . "\">{$page->title}</a></li>\n"; } print "</ul></li>"; if (!isLoggedIn() || !termsOk()) { break; } //only show first "Workbench" menu in these cases } ?> </ul> </div> <?php