Пример #1
0
<?php

require_once 'session.php';
require_once 'shared.php';
require_once 'header.php';
if (isset($cacheCleared)) {
    displayInfo("Cache Cleared Successfully");
    print "<p/>";
}
if (isset($_REQUEST['keyPrefix']) || isset($_REQUEST['id'])) {
    $keyPrefixOrId = isset($_REQUEST['keyPrefix']) ? $_REQUEST['keyPrefix'] : $_REQUEST['id'];
    $specifiedType = WorkbenchContext::get()->getObjectTypeByKeyPrefixOrId(trim($keyPrefixOrId));
    if ($specifiedType == null) {
        displayWarning("Unknown object type");
    }
    WorkbenchContext::get()->setDefaultObject($specifiedType);
}
?>

<p class='instructions'>Choose an object to describe:</p>

<form name='describeForm' method='POST' action='describe.php'>
    <?php 
printObjectSelection(WorkbenchContext::get()->getDefaultObject(), 'default_object', 30, "onChange=\"document.getElementById('loadingMessage').style.visibility='visible'; document.describeForm.submit();\"");
?>

    <span id='loadingMessage' style='visibility:hidden; color:#888;'>
        &nbsp;&nbsp;<img src='<?php 
print getPathToStaticResource('/images/wait16trans.gif');
?>
' align='absmiddle'/> Loading...
Пример #2
0
	<head>
		<title><?php 
    echo $title;
    ?>
</title>
		<link rel="stylesheet" media="screen" type="text/css" title="Style" href="style.css" />
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	</head>
	<body>
		<h1><?php 
    echo $title;
    ?>
</h1>
		
		<?php 
    displayWarning();
    ?>
		
		<h2>R&eacute;pertoire de destination :</h2>
		<p>
			Vous vous appr&ecirc;tez &agrave; d&eacute;placer <b><?php 
    echo $fileName;
    ?>
</b>,
			dans quel r&eacute;pertoire souhaitez-vous le placer ?
		</p>
		<form method='POST' enctype="multipart/form-data">
			<?php 
    echo $formList;
    ?>
			<label>
Пример #3
0
/**
 * Print screen for user to enter
 * field mapping values. This is used
 * for all PUT functions.
 *
 * @param $action
 * @param $csvArray
 */
function setFieldMappings($action, $csvArray)
{
    $currRecord = null;
    $id = isset($_REQUEST['id']) ? trim(htmlspecialchars($_REQUEST['id'], ENT_QUOTES)) : null;
    if (requiresObject($action)) {
        // if an object is not explicitly given, infer from the id, if that was given
        if (!isset($_REQUEST['default_object'])) {
            WorkbenchContext::get()->setDefaultObject(WorkbenchContext::get()->getObjectTypeByKeyPrefixOrId($id));
        }
        if (WorkbenchContext::get()->getDefaultObject()) {
            $objectType = WorkbenchContext::get()->getDefaultObject();
            $describeSObjectResult = WorkbenchContext::get()->describeSObjects($objectType);
            if (!$csvArray && !empty($id)) {
                $currRecord = queryCurrentRecord($describeSObjectResult, $id);
                if ($currRecord == null) {
                    displayUploadFileWithObjectSelectionForm($action, $id, "An existing " . WorkbenchContext::get()->getDefaultObject() . " could not found with the id '{$id}'. Confirm both the object type and id are correct.");
                    exit;
                }
            }
        } else {
            if (!$csvArray && !empty($_REQUEST['id'])) {
                displayUploadFileWithObjectSelectionForm($action, $id, "The object type of id '{$id}' is unknown. Choose an object type and confirm the id is correct.");
            } else {
                displayUploadFileWithObjectSelectionForm($action, $id, "Must choose an object to {$action}.");
            }
            exit;
        }
    } else {
        if (!$csvArray && $id) {
            $objectType = WorkbenchContext::get()->getObjectTypeByKeyPrefixOrId($id);
            if ($objectType) {
                $describeSObjectResult = WorkbenchContext::get()->describeSObjects($objectType);
                $currRecord = queryCurrentRecord($describeSObjectResult, $id);
            } else {
                $currRecord = new SObject();
                $currRecord->fields = new StdClass();
                $currRecord->fields->Id = $id;
            }
        }
    }
    if ($currRecord != null && isset($describeSObjectResult)) {
        $isDeleted = isset($currRecord->fields->IsDeleted) && $currRecord->fields->IsDeleted == "true";
        $dmlActions = array("update" => !$isDeleted && $describeSObjectResult->updateable, "delete" => !$isDeleted && $describeSObjectResult->deletable, "undelete" => $isDeleted && $describeSObjectResult->undeletable, "purge" => $isDeleted && $describeSObjectResult->undeletable);
        if (isset($dmlActions[$action]) && !$dmlActions[$action]) {
            displayWarning("It does not seem like this record can be " . $action . "d. Are you sure you wish to continue?");
        }
    }
    print "<form method='POST' action=''>" . getCsrfFormTag();
    if ($action == 'upsert') {
        print "<p class='instructions'>Choose the Salesforce field to use as the External Id. Be sure to also map this field below:</p>\n";
        print "<table class='fieldMapping'><tr>\n";
        print "<td style='color: red;'>External Id</td>";
        print "<td><select name='_ext_id' style='width: 100%;'>\n";
        foreach ($describeSObjectResult->fields as $fields => $field) {
            if ($field->idLookup) {
                //limit the fields to only those with the idLookup property set to true. Corrected Issue #10
                print " <option value='{$field->name}'";
                if ($field->name == 'Id') {
                    print " selected='true'";
                }
                print ">{$field->name}</option>\n";
            }
        }
        print "</select></td></tr></table>\n";
    }
    //end if upsert
    if ($action == "retrieve") {
        print "<h3 style='margin:0px;'><a href='describe.php?id={$id}' style='text-decoration:none; color:inherit;'>" . $objectType . "</a></h3>";
        print "<h1 style='margin-top:0px;'>" . (isset($currRecord->fields->Name) ? htmlspecialchars($currRecord->fields->Name) : $currRecord->fields->Id) . "</h1>";
        foreach ($dmlActions as $dmlAction => $enabled) {
            print "<input type=\"button\" onclick=\"window.location.href='{$dmlAction}.php?sourceType=singleRecord&id={$id}'\" value=\"" . ucfirst($dmlAction) . "\" " . (!$enabled ? "disabled=disabled" : "") . "/>&nbsp;&nbsp;";
        }
        if (WorkbenchConfig::get()->value('linkIdToUi')) {
            $uiViewable = isset($describeSObjectResult->urlDetail) || in_array($objectType, array("Dashboard", "Report", "Division", "BusinessHours", "BrandTemplate"));
            print "<input type=\"button\" onclick=\"window.open('" . getJumpToSfdcUrlPrefix() . "{$id}')\" value=\"View in Salesforce\" " . ($uiViewable ? "" : "disabled=disabled") . "/>&nbsp;&nbsp;";
        }
        print "<p/>";
    } else {
        if ($csvArray) {
            $instructions = "Map the Salesforce fields to the columns from the uploaded CSV:";
        } else {
            if (requiresObject($action)) {
                $instructions = "Provide values for the " . WorkbenchContext::get()->getDefaultObject() . " fields below:";
            } else {
                $instructions = "Confirm the id to {$action} below:";
            }
        }
        print "<p class='instructions'>{$instructions}</p>\n";
    }
    print "<table class='fieldMapping'>\n";
    print "<tr><th>Field</th>";
    if ($csvArray) {
        print "<th>CSV Field</th>";
    } else {
        print "<th>Value</th>";
    }
    if (WorkbenchConfig::get()->value("showReferenceBy") && ($action == 'insert' || $action == 'update' || $action == 'upsert')) {
        print "<th onmouseover=\"Tip('For fields that reference other objects, external ids from the foreign objects provided can be automatically matched to their corresponding primary ids. Use this column to select the object and field by which to perform the Smart Lookup. If left unselected, standard lookup using the primary id will be performed. If this field is disabled, only standard lookup is available because the foreign object contains no external ids.')\">Smart Lookup &nbsp; <img align='absmiddle' src='" . getPathToStaticResource('/images/help16.png') . "'/></th>";
    }
    print "</tr>\n";
    if ($action == 'insert') {
        foreach ($describeSObjectResult->fields as $field) {
            if ($field->createable) {
                printPutFieldForMapping($field, $csvArray, true, null);
            }
        }
    }
    if ($action == 'update') {
        printPutFieldForMappingId($csvArray, true, $currRecord);
        foreach ($describeSObjectResult->fields as $field) {
            if ($field->updateable) {
                printPutFieldForMapping($field, $csvArray, true, $currRecord);
            }
        }
    }
    if ($action == 'upsert') {
        printPutFieldForMappingId($csvArray, true, $currRecord);
        foreach ($describeSObjectResult->fields as $field) {
            if ($field->updateable && $field->createable) {
                printPutFieldForMapping($field, $csvArray, true, $currRecord);
            }
        }
    }
    if ($action == 'delete' || $action == 'undelete' || $action == 'purge') {
        printPutFieldForMappingId($csvArray, false, $currRecord);
    }
    if ($action == "retrieve") {
        foreach ($describeSObjectResult->fields as $field) {
            // fix an IIS issue where the id is not in fields
            if (!isset($currRecord->fields->Id) && isset($currRecord->Id)) {
                $currRecord->fields->Id = $currRecord->Id;
            }
            printPutFieldForMapping($field, false, false, $currRecord, false);
        }
    }
    print "</table>\n";
    if ($csvArray) {
        print "<p><input type='submit' name='action' value='Map Fields' />\n";
        print "<input type='button' value='Preview CSV' onClick='window.open(" . '"csv_preview.php"' . ")'></p>\n";
    } else {
        if ($action !== "retrieve") {
            print "<input type='hidden' name='sourceType' value='singleRecord' />\n";
            print "<p><input type='submit' name='action' value='Confirm " . ucwords($action) . "' />\n";
        }
    }
    print "</form>\n";
}
        print getCsrfFormTag();
        ?>
    <input type='hidden' name='deployFileTmpName' value='<?php 
        print $deployFileTmpName;
        ?>
' />
<p />
    <?php 
        $tree = new ExpandableTree("deployOptionsTree", $_SESSION[$deployFileTmpName . "_OPTIONS"]);
        $tree->setForceCollapse(true);
        $tree->printTree();
        ?>
<p />
    <?php 
        if (!isset($_POST['checkOnly'])) {
            displayWarning("Warning, this deployment will make permanent changes to this organization's metadata and cannot be rolled back. " . "Use the 'Check Only' option to validate this deployment without making changes.");
            print "<p/>";
        }
        ?>
 <input type='submit' name='deploymentConfirmed' value='Deploy' />
</form>
    <?php 
    } else {
        require_once 'header.php';
        ?>
<p class='instructions'>Choose a ZIP file to deploy and any applicable
options:</p>

<form id='deployForm' name='deployForm' method='POST'
    action=''
    enctype='multipart/form-data'><input type='file' name='deployFile'
Пример #5
0
 function exportQueryAsCsv($records, $queryAction)
 {
     if (!WorkbenchConfig::get()->value("allowQueryCsvExport")) {
         throw new Exception("Export to CSV not allowed");
     }
     if ($records) {
         try {
             $csvFile = fopen('php://output', 'w') or die("Error opening php://output");
             $csvFilename = "export" . date('YmdHis') . ".csv";
             header("Content-Type: application/csv");
             header("Content-Disposition: attachment; filename={$csvFilename}");
             //Write first row to CSV and unset variable
             fputcsv($csvFile, $this->getQueryResultHeaders(new SObject($records[0])));
             //Export remaining rows and write to CSV line-by-line
             foreach ($records as $record) {
                 fputcsv($csvFile, $this->getQueryResultRow(new SObject($record), false));
             }
             fclose($csvFile) or die("Error closing php://output");
         } catch (Exception $e) {
             require_once "header.php";
             displayQueryForm(new QueryRequest($_POST), 'csv', $queryAction);
             print "<p />";
             displayError($e->getMessage(), false, true);
         }
     } else {
         require_once "header.php";
         displayQueryForm(new QueryRequest($_POST), 'csv', $queryAction);
         print "<p />";
         displayWarning("No records returned for CSV output.", false, true);
     }
 }
Пример #6
0
//show the query results with default object selected on a previous page, otherwise
// just display the blank form. When the user selects the SCREEN or CSV options, the
//query is processed by the correct function
if (isset($_POST['queryMore']) && isset($_POST['queryLocator'])) {
    require_once 'header.php';
    displayQueryForm($queryRequest);
    $queryRequest->setQueryAction('QueryMore');
    $asyncJob = new QueryFutureTask($queryRequest, $_POST['queryLocator']);
    echo $asyncJob->perform();
    include_once 'footer.php';
} else {
    if (isset($_POST['querySubmit']) && $_POST['querySubmit'] == 'Query' && $queryRequest->getSoqlQuery() != null && ($queryRequest->getExportTo() == 'screen' || $queryRequest->getExportTo() == 'matrix')) {
        require_once 'header.php';
        displayQueryForm($queryRequest);
        if ($queryRequest->getExportTo() == 'matrix' && ($queryRequest->getMatrixCols() == "" || $queryRequest->getMatrixRows() == "")) {
            displayWarning("Both column and row must be specified for Matrix view.", false, true);
            return;
        }
        echo "<p><a name='qr'>&nbsp;</a></p>";
        echo updateUrlScript($queryRequest);
        $asyncJob = new QueryFutureTask($queryRequest);
        echo $asyncJob->enqueueOrPerform();
        include_once 'footer.php';
    } else {
        if (isset($_POST['querySubmit']) && $_POST['querySubmit'] == 'Query' && $queryRequest->getSoqlQuery() != null && strpos($queryRequest->getExportTo(), 'async_') === 0) {
            try {
                queryAsync($queryRequest);
            } catch (Exception $e) {
                require_once 'header.php';
                displayQueryForm($queryRequest);
                throw $e;
Пример #7
0
function installationOperation(&$step)
{
    global $errors;
    $language = isset($_POST['language']) ? $_POST['language'] : $GLOBALS['language'];
    switch ($step) {
        case 1:
            $errors = Install::check();
            break;
        case 2:
            $errors = Install::check();
            Install::installUrl(USVN_CONFIG_FILE, USVN_HTACCESS_FILE, $_SERVER['REQUEST_URI'], $_SERVER['HTTP_HOST'], isset($_SERVER['HTTPS']));
            break;
        case 3:
            Install::installLanguage(USVN_CONFIG_FILE, $language);
            Install::installTimezone(USVN_CONFIG_FILE, $_POST['timezone']);
            Install::installLocale(USVN_CONFIG_FILE);
            $GLOBALS['language'] = $_POST['language'];
            USVN_Translation::initTranslation($GLOBALS['language'], USVN_LOCALE_DIRECTORY);
            break;
        case 4:
            if ($_POST['agreement'] != 'ok') {
                throw new USVN_Exception(T_('You need to accept the licence to continue installation.'));
            }
            break;
        case 5:
            Install::installConfiguration(USVN_CONFIG_FILE, $_POST['title']);
            $import = Install::installSubversion(USVN_CONFIG_FILE, $_POST['pathSubversion'], $_POST['passwdFile'], $_POST['authzFile'], $_POST['urlSubversion'], $_FILES['configFile']);
            if ($import === true) {
                displayWarning(T_("A copy of the old SVN repository has been made, any modification done on the old one won't interact on the new one. You should disable the old repository access."));
                $step = 7;
            }
            break;
        case 6:
            if (isset($_POST['createdb'])) {
                $createdb = true;
            } else {
                $createdb = false;
            }
            Install::installDb(USVN_CONFIG_FILE, USVN_APP_DIR . '/install/sql/', $_POST['host'], $_POST['user'], $_POST['password'], $_POST['database'], $_POST['prefix'], $_POST['adapter'], $createdb);
            break;
        case 7:
            Install::installAdmin(USVN_CONFIG_FILE, $_POST['login'], $_POST['password'], $_POST['firstname'], $_POST['lastname'], $_POST['email']);
            break;
        case 8:
            Install::installCheckForUpdate(USVN_CONFIG_FILE, $_POST['update']);
            Install::installEnd(USVN_CONFIG_FILE);
            $GLOBALS['apacheConfig'] = Install::getApacheConfig(USVN_CONFIG_FILE);
            break;
    }
}
Пример #8
0
    displayError($errors);
} else {
    if (isset($_GET['saved'])) {
        displayInfo(($_GET['saved'] == "D" ? "Defaults restored" : "Settings saved") . " successfully.");
    }
}
if (isLoggedIn()) {
    $unsupportedConfigs = array();
    foreach (WorkbenchConfig::get()->entries() as $configKey => $configValue) {
        if (isset($configValue['minApiVersion']) && !WorkbenchContext::get()->isApiVersionAtLeast($configValue['minApiVersion'])) {
            $unsupportedConfigs[] = $configValue['label'] . sprintf(" (Requires %01.1f)", $configValue['minApiVersion']);
        }
    }
    if (count($unsupportedConfigs) > 0) {
        print "<p/>";
        displayWarning(array_merge(array("The following settings will be ignored for your current API version " . WorkbenchContext::get()->getApiVersion() . ":"), $unsupportedConfigs));
        print "<p/><em style='color: orange;'>Quick Fix: <a style='color: orange;' href='sessionInfo.php' target='_blank'>Change API Version</a></em>";
    }
}
print "<p/><form id='settings_form' method='post' action=''>\n";
print "<table border='0' cellspacing='5' style='border-width-top: 1'>\n";
print "<tr> <td colspan='3' align='left'><input type='submit' name='submitConfigSetter' value='Apply Settings'/>&nbsp;<input type='submit' name='restoreDefaults' value='Restore Defaults'/>&nbsp;<input type='reset' value='Cancel'/></td> </tr>";
foreach (WorkbenchConfig::get()->entries() as $configKey => $configValue) {
    // don't even try to deal with complex types
    if (isset($configValue['dataType']) && $configValue['dataType'] == "complex") {
        continue;
    }
    if (isset($configValue['isHeader']) && $configValue['display']) {
        print "\t<tr><th align='left' colspan='3'><br/>" . htmlspecialchars($configValue['label'], ENT_QUOTES) . "</th></tr>\n";
    } else {
        if (isset($configValue['overrideable']) && $configValue['overrideable'] == true) {