本文整理汇总了PHP中getUserInput函数的典型用法代码示例。如果您正苦于以下问题:PHP getUserInput函数的具体用法?PHP getUserInput怎么用?PHP getUserInput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUserInput函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateINI_1_1_0
function updateINI_1_1_0()
{
showMessage2("Updating INI-files...");
$siteaccessList = getUserInput("Please specify the eZ Flow siteaccesses on your site (separated with space, for example eng nor): ");
$siteaccessList = explode(' ', $siteaccessList);
$translationSA = array();
foreach ($siteaccessList as $siteaccess) {
if (!file_exists('settings/siteaccess/' . $siteaccess)) {
continue;
}
/* Update override.ini.append.php part */
$settings = array('full_silverlight' => array('Source' => 'node/view/full.tpl', 'MatchFile' => 'full/silverlight.tpl', 'Subdir' => 'templates', 'Match' => array('class_identifier' => 'silverlight')), 'line_silverlight' => array('Source' => 'node/view/line.tpl', 'MatchFile' => 'line/silverlight.tpl', 'Subdir' => 'templates', 'Match' => array('class_identifier' => 'silverlight')), 'edit_ezsubtreesubscription_forum_topic' => array('Source' => 'content/datatype/edit/ezsubtreesubscription.tpl', 'MatchFile' => 'datatype/edit/ezsubtreesubscription/forum_topic.tpl', 'Subdir' => 'templates', 'Match' => array('class_identifier' => 'forum_topic')), 'block_item_article' => array('Source' => 'node/view/block_item.tpl', 'MatchFile' => 'block_item/article.tpl', 'Subdir' => 'templates', 'Match' => array('class_identifier' => 'article')), 'block_item_image' => array('Source' => 'node/view/block_item.tpl', 'MatchFile' => 'block_item/image.tpl', 'Subdir' => 'templates', 'Match' => array('class_identifier' => 'image')), 'dynamic_3_items1' => array('Source' => 'block/view/view.tpl', 'MatchFile' => 'block/dynamic_3_items1.tpl', 'Subdir' => 'templates', 'Match' => array('type' => 'Dynamic3Items', 'view' => '3_items1')));
$ini = eZINI::instance('override.ini', 'settings/siteaccess/' . $siteaccess, null, null, false, true);
$ini->setReadOnlySettingsCheck(false);
$ini->setVariables($settings);
$ini->save(false, '.append.php', false, false, 'settings/siteaccess/' . $siteaccess, false);
/* Update menu.ini.append.php part */
$settings = array('SelectedMenu' => array('CurrentMenu' => 'DoubleTop', 'TopMenu' => 'double_top', 'LeftMenu' => ''));
$ini = eZINI::instance('menu.ini', 'settings/siteaccess/' . $siteaccess, null, null, false, true);
$ini->setReadOnlySettingsCheck(false);
$ini->setVariables($settings);
$ini->save(false, '.append.php', false, false, 'settings/siteaccess/' . $siteaccess, false);
/* Get site.ini for ContentObjectLocale code */
$ini = eZINI::instance('site.ini', 'settings/siteaccess/' . $siteaccess, null, null, false, true);
$contentObjectLocale = explode('-', $ini->variable('RegionalSettings', 'ContentObjectLocale'));
$translationSA[$siteaccess] = ucfirst($contentObjectLocale[0]);
}
$settings = array(array('name' => 'site.ini', 'settings' => array('RegionalSettings' => array('TranslationSA' => $translationSA))), array('name' => 'content.ini', 'settings' => array('table' => array('CustomAttributes' => array('0' => 'summary', '1' => 'caption')), 'td' => array('CustomAttributes' => array('0' => 'valign')), 'th' => array('CustomAttributes' => array('0' => 'scope', '1' => 'abbr', '2' => 'valign')), 'CustomTagSettings' => array('AvailableCustomTags' => array('0' => 'underline'), 'IsInline' => array('underline' => 'true')), 'embed-type_images' => array('AvailableClasses' => array()))), array('name' => 'ezoe_attributes.ini', 'settings' => array('CustomAttribute_table_summary' => array('Name' => 'Summary (WAI)', 'Required' => 'true'), 'CustomAttribute_scope' => array('Name' => 'Scope', 'Title' => 'The scope attribute defines a way to associate header cells and data cells in a table.', 'Type' => 'select', 'Selection' => array('0' => '', 'col' => 'Column', 'row' => 'Row')), 'CustomAttribute_valign' => array('Title' => 'Lets you define the vertical alignment of the table cell/ header.', 'Type' => 'select', 'Selection' => array('0' => '', 'top' => 'Top', 'middle' => 'Middle', 'bottom' => 'Bottom', 'baseline' => 'Baseline')), 'Attribute_table_border' => array('Type' => 'htmlsize', 'AllowEmpty' => 'true'), 'CustomAttribute_embed_offset' => array('Type' => 'int', 'AllowEmpty' => 'true'), 'CustomAttribute_embed_limit' => array('Type' => 'int', 'AllowEmpty' => 'true'))), array('name' => 'ezxml.ini', 'settings' => array('TagSettings' => array('TagPresets' => array('0' => '', 'mini' => 'Simple formatting')))));
foreach ($settings as $setting) {
$iniName = $setting['name'];
$onlyModified = false;
if (file_exists('settings/override/' . $iniName . '.append') || file_exists('settings/override/' . $iniName . '.append.php')) {
$ini = eZINI::instance($iniName, 'settings/override', null, null, false, true);
} else {
$ini = eZINI::create($iniName, 'settings/override');
$onlyModified = true;
}
$ini->setReadOnlySettingsCheck(false);
$ini->setVariables($setting['settings']);
$ini->save(false, '.append.php', false, $onlyModified, 'settings/override', false);
}
}
示例2: runMenu
function runMenu($courthouseConfig)
{
$UserChoice = "I";
while ($UserChoice != "X") {
clearScreen();
echo "+-------------------------------------------------------------------------+\n";
echo "| |\n";
echo "| Cryptolingus Cracking Suite (CLCS) - COURTHOUSE |\n";
echo "| |\n";
echo "+-------------------------------------------------------------------------+\n";
echo "\n";
echo "Commands:\n";
echo "---------\n";
echo "[I] Initialize Courthouse\n";
echo "[B] Build jobs... for 'murica\n";
echo "[S] Show configuration\n";
echo "[V] View status\n";
echo "[X] Exit Justice\n";
echo "\n";
$UserChoice = getUserInput("Choice:", TRUE);
switch ($UserChoice) {
case 'B':
buildJobs($courthouseConfig);
break;
case 'I':
initializeCourthouse($courthouseConfig);
break;
case 'S':
$courthouseConfig->showAllSettings();
break;
case 'V':
showCourthouseStatus($courthouseConfig);
break;
case 'X':
break;
default:
showError();
break;
}
}
}
示例3: downloadPackages
function downloadPackages($packageList, $packageURL, $packageDir, $packageRepository)
{
global $cli;
showMessage2("Configuring...");
if (!is_array($packageList) || count($packageList) == 0) {
showError("Package list is empty. Aborting...");
}
// 1. check if packages specified in $packageList exist in $packageRepository(means already downloaded and imported).
// if yes - ask user to do download or not. If not - go out
foreach (array_keys($packageList) as $k) {
$packageName = $packageList[$k];
$package = eZPackage::fetch($packageName);
if (is_object($package)) {
global $autoMode;
if ($autoMode == 'on') {
$action = 'y';
} else {
$action = getUserInput("Package '{$packageName}' already imported. Import it anyway? [y/n]: ");
}
if (strpos($action, 'n') === 0) {
unset($packageList[$k]);
} else {
eZDir::recursiveDelete(eZPackage::repositoryPath() . "/{$packageRepository}/{$packageName}");
}
}
}
if (count($packageList) == 0) {
// all packages are imported.
return true;
}
// 2. check $packgesList exists in $packageDir(means packages downloaded but not imported)
// if yes - ask user to import or not. If not - go out
if (!checkDir($packageDir)) {
return false;
}
$downloadPackageList = array();
foreach ($packageList as $packageName) {
if (file_exists("{$packageDir}/{$packageName}.ezpkg")) {
global $autoMode;
if ($autoMode == 'on') {
$action = 'y';
} else {
$action = getUserInput("Package '{$packageName}' already downloaded. Download it anyway? [y/n]: ");
}
if (strpos($action, 'n') === 0) {
continue;
}
}
$downloadPackageList[] = $packageName;
}
//
// download
//
showMessage2("Downloading...");
if (count($downloadPackageList) > 0) {
// TODO: using 'eZStepSiteTypes' is hack.
// need to exclude 'downloadFile' from that class.
$tpl = false;
$http = false;
$ini = false;
$persistenceList = false;
$downloader = new eZStepSiteTypes($tpl, $http, $ini, $persistenceList);
foreach ($downloadPackageList as $packageName) {
showMessage("{$packageName}");
$archiveName = $downloader->downloadFile("{$packageURL}/{$packageName}.ezpkg", $packageDir);
if ($archiveName === false) {
showError("download error - " . $downloader->ErrorMsg);
}
}
}
//
// import
//
showMessage2("Importing...");
foreach ($packageList as $packageName) {
showMessage("{$packageName}");
$package = eZPackage::import("{$packageDir}/{$packageName}.ezpkg", $packageName, false, $packageRepository);
if (!is_object($package)) {
showError("Faild to import '{$packageName}' package: err = {$package}");
}
}
return true;
}
示例4: internalClear
private function internalClear($purge, $cacheEntries, $name, $purgeSleep = null, $purgeMax = null, $purgeExpiry = null)
{
$this->cli->output(($purge ? 'Purging ' : 'Clearing ') . $this->cli->stylize('emphasize', $name ? $name : 'All cache') . ': ');
$warnPaths = array();
foreach ($cacheEntries as $cacheEntry) {
$absPath = realpath(eZSys::cacheDirectory() . DIRECTORY_SEPARATOR . $cacheEntry['path']);
$absPathElementCount = count(explode(DIRECTORY_SEPARATOR, rtrim($absPath, DIRECTORY_SEPARATOR)));
// Refuse to delete root directory ('/' or 'C:\')
// 2 => since one path element ('/foo') produces two exploded elements
if ($absPath && $absPathElementCount < 2) {
$this->cli->error('Refusing to delete root directory! Please check your cache settings. Path: ' . $absPath);
$this->script->shutdown(1);
exit;
}
// Warn if the cache entry is not function based, and the path is outside ezp root, and the path has less than 2 elements
if ($absPath && (!$purge || !isset($cacheEntry['purge-function'])) && !isset($cacheEntry['function']) && $absPathElementCount < 3 && strpos(dirname($absPath) . DIRECTORY_SEPARATOR, realpath(eZSys::rootDir()) . DIRECTORY_SEPARATOR) === false) {
$warnPaths[] = $absPath;
}
}
if (!empty($warnPaths)) {
$this->cli->warning('The following cache paths are outside of the eZ Publish root directory, and have less than 2 path elements. ' . 'Are you sure you want to ' . ($purge ? 'purge' : 'clear') . ' them?');
foreach ($warnPaths as $warnPath) {
$this->cli->output($warnPath);
}
if (function_exists("getUserInput")) {
$input = getUserInput(($purge ? 'Purge' : 'Clear') . '? yes/no:', array('yes', 'no'));
} else {
$validInput = false;
$readlineExists = function_exists("readline");
while (!$validInput) {
if ($readlineExists) {
$input = readline($query);
} else {
echo $prompt . ' ';
$input = trim(fgets(STDIN));
}
if ($acceptValues === false || in_array($input, $acceptValues)) {
$validInput = true;
}
}
}
if ($input === 'no') {
$this->script->shutdown();
exit;
}
}
$firstItem = true;
foreach ($cacheEntries as $cacheEntry) {
if ($firstItem) {
$firstItem = false;
} else {
$this->cli->output(', ', false);
}
$this->cli->output($this->cli->stylize('emphasize', $cacheEntry['name']), false);
if ($purge) {
eZCache::clearItem($cacheEntry, true, array($this, 'reportProgress'), $purgeSleep, $purgeMax, $purgeExpiry);
} else {
eZCache::clearItem($cacheEntry);
}
}
$this->cli->output();
}
示例5: getUserInput
<form action="ValidateCredentials.action" method="post">
<div class="label">Email Address</div>
<div class="contents"><input type="text" name="email" value="<?php
echo getUserInput("email");
?>
" /></div>
<div class="label">Password</div>
<div class="contents"><input type="password" name="password" value="<?php
echo getUserInput("password");
?>
" /></div>
<div class="contents"><input type="submit" name="submit" value="Log In" /></div>
<input type="hidden" name="referringPage" value="<?php
echo get("referringPage");
?>
" />
</form>
示例6: showWarning
//
$packageURL = $scriptOptions['url'];
if (!$packageURL) {
$packageINI = eZINI::instance('package.ini');
$packageURL = $packageINI->variable('RepositorySettings', 'RemotePackagesIndexURL');
}
//
// 'auto-mode' option
//
global $autoMode;
$autoMode = $scriptOptions['auto-mode'];
if ($autoMode != 'off') {
$autoMode = 'on';
$importDir = eZPackage::repositoryPath() . "/{$packageRepository}";
showWarning("Processing in auto-mode: \n" . "- packages will be downloaded to '{$packageDir}';\n" . "- packages will be imported to '{$importDir}';\n" . "- installing of existing classes will be skipped;\n" . "- all files(extesion, design, downloaded and imported packages) will be overwritten;");
$action = getUserInput("Continue? [y/n]: ");
if (strpos($action, 'y') !== 0) {
$script->shutdown(0, 'Done');
}
}
/**************************************************************
* do the work *
***************************************************************/
if (downloadPackages($packageList, $packageURL, $packageDir, $packageRepository)) {
if (file_exists(installScriptDir($packageRepository))) {
//
// Prepare siteaccesses access info.
//
$locales = eZContentLanguage::fetchLocaleList();
$primaryLanguage = eZContentLanguage::topPriorityLanguage();
$siteINI = eZINI::instance();
示例7: checkPaths
function checkPaths( $cacheEntries, $purge )
{
global $cli, $script;
$warnPaths = array();
foreach ( $cacheEntries as $cacheEntry )
{
$absPath = realpath( eZSys::cacheDirectory() . DIRECTORY_SEPARATOR . $cacheEntry['path'] );
$absPathElementCount = count( explode( DIRECTORY_SEPARATOR, rtrim( $absPath, DIRECTORY_SEPARATOR ) ) );
// Refuse to delete root directory ('/' or 'C:\')
if ( $absPath &&
$absPathElementCount < 2 ) // 2, since one path element ('/foo') produces two exploded elements
{
$cli->error( 'Refusing to delete root directory! Please check your cache settings. Path: ' . $absPath );
$script->shutdown( 1 );
exit();
}
// Warn if the cache entry is not function based, and the path is outside ezp root, and the path has less than 2 elements
if ( $absPath &&
( !$purge || !isset( $cacheEntry['purge-function'] ) ) &&
!isset( $cacheEntry['function'] ) &&
$absPathElementCount < 3 && /* 3, since two path elements ('/foo/bar') produce three exploded elements */
strpos( dirname( $absPath ) . DIRECTORY_SEPARATOR, realpath( eZSys::rootDir() ) . DIRECTORY_SEPARATOR ) === false )
{
$warnPaths[] = $absPath;
}
}
if ( count( $warnPaths ) > 0 )
{
$cli->warning( 'The following cache paths are outside of the eZ Publish root directory, and have less than 2 path elements. ' .
'Are you sure you want to ' . ( $purge ? 'purge' : 'clear' ) . ' them?' );
foreach ( $warnPaths as $warnPath )
{
$cli->output( $warnPath );
}
$input = getUserInput( ( $purge ? 'Purge' : 'Clear' ) . '? yes/no:', array( 'yes', 'no' ) );
if ( $input == 'no' )
{
$script->shutdown();
exit();
}
}
}
示例8: initializeJustice
function initializeJustice($jConfig)
{
resetCLCSdb("Justice", $jConfig);
$processTargetsDirectory = getUserInput("Process the targets directory to load targets [Y/N]?", TRUE);
if ($processTargetsDirectory == "Y") {
loadTargets(TRUE, "Justice", $jConfig);
}
$processWordlistsDirectory = getUserInput("Process the wordlists directory to load wordlists [Y/N]?", TRUE);
if ($processWordlistsDirectory == "Y") {
loadWordlist(TRUE, "Justice", $jConfig);
}
userAck();
}
示例9: setAssetTitle
/**
* Assigns a title attribute value to a selected asset
*
* @param int $asset_id The asset ID
* @param string $asset_title The title to be set for the asset
*
* @return boolean
* @access public
*/
function setAssetTitle($asset_id, $asset_title)
{
$success = FALSE;
$asset =& $GLOBALS['SQ_SYSTEM']->am->getAsset($asset_id);
if ($asset->id) {
// Make sure that we have a 'title' attribute
$current_title = $asset->attr('title');
if ($current_title == NULL) {
printStdErr('* Asset ID ' . $asset_id . " does not have a title field, so one cannot be assigned.\n");
printStdErr('User Options ------------');
printStdErr('(I)gnore this asset and continue with modification of titles');
printStdErr('(C)ancel modification script');
$user_choice = getUserInput(array('i', 'c'));
if ($user_choice == 'c') {
printStdErr("\n- Titles modification cancelled by user");
exit(-7);
}
} else {
// Set the 'title' attribute for the asset
$asset->setAttrValue('title', $asset_title);
$asset->saveAttributes();
// Read back the title to ensure that it is set as expected
$success = $asset->attr('title') == $asset_title;
if (!$success) {
printStdErr('* The title "' . $asset_title . '" could not be set for asset ID ' . $asset_id . "\n");
printStdErr('User Options ------------');
printStdErr('(I)gnore this asset and continue with modification of titles');
printStdErr('(C)ancel modification script');
$user_choice = getUserInput(array('i', 'c'));
if ($user_choice == 'c') {
printStdErr("\n- Titles modification cancelled by user");
exit(-8);
}
}
}
}
//end if
return $success;
}
示例10: getUserInput
echo $message->getMessage();
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
}
?>
<div class="contents">Name: <input type="text" size="40" name="name" value="<?php
echo getUserInput("name");
?>
" /></div>
<div class="contents"><textarea rows="5" cols="50" name="contents"><?php
echo getUserInput("contents");
?>
</textarea></div>
<div class="contents"><input type="submit" name="submit" value="Comment" /></div>
<input type="hidden" name="blogId" value="<?php
echo $post->getId();
?>
" />
</form>
</div>
</div>
<?php
}