예제 #1
0
파일: csv2sql.php 프로젝트: Ekleog/platal
function processArgs()
{
    global $sourceName, $table, $includedFile, $debug, $action, $keys;
    $opts = getopt('oui:t:r:dk:');
    if ($opts['i'] == '-' || empty($opts['i'])) {
        $sourceName = 'php://stdin';
    } else {
        $sourceName = $opts['i'];
    }
    if ($opts['k'] && !empty($opts['k'])) {
        $keys = $opts['k'];
    }
    if (isset($opts['u'])) {
        $action = CSV_UPDATE;
    } elseif (isset($opts['o'])) {
        $action = CSV_UPDATEONLY;
    }
    if (isset($opts['d'])) {
        $debug = true;
    }
    if ($opts['r'] && !empty($opts['r'])) {
        $includedFile = $opts['r'];
    }
    if (!$opts['t'] || empty($opts['t'])) {
        showHelp('Table non définie');
        exit;
    }
    $table = $opts['t'];
}
예제 #2
0
/**
 * widget function
 * works for select menus and some input fields
 * @param string $title 
 * @param string $function 
 * @param string $name 
 * @param string $value 
 * @param string $attr 
 * @param string $type 
 * @param string $subtitle 
 * @param string $req 
 * @param string $tag 
 * @param string $tag_attr 
 * @param string $extra 
 * @param string $afterwards 
 * @return string
 * @author edited by Peng Wang <*****@*****.**>
 */
function ips($title, $function, $name, $value = '', $attr = '', $type = '', $subtitle = '', $req = '', $tag = '', $tag_attr = '', $extra = '', $afterwards = '')
{
    $OBJ =& get_instance();
    global $error_msg, $go;
    // set a default
    // we might want div later
    if (!$tag) {
        $tag = 'label';
    }
    $tag_attr ? $tag_attr = "{$tag_attr}" : ($tag_attr = '');
    $OBJ->access->prefs['user_help'] == 1 ? $help = showHelp($title) : ($help = '');
    $afterwards ? $afterwards = $afterwards : ($afterwards = '');
    if (isset($error_msg[$name])) {
        $msg = span($error_msg[$name], "class='error'");
    } else {
        $msg = null;
    }
    $subtitle ? $subtitle = span($subtitle, "class='small-txt'") : ($subtitle = '');
    $title ? $title = label($title . ' ' . $subtitle . ' ' . $help . $msg) : ($title = '');
    $req ? $req = showerror($msg) : ($req = '');
    $extra ? $add = $extra : ($add = '');
    $value = showvalue($name, $value);
    if ($function === 'input') {
        $function = input($name, $type, attr($attr), $value);
    } else {
        $function ? $function = $function($value, $name, attr($attr), $add) : ($function = null);
    }
    return $title . "\n" . $function;
}
예제 #3
0
    if (function_exists("pcntl_exec")) {
        pcntl_exec("/bin/bash", array("./updateScript.sh"));
    } else {
        if (function_exists("passthru")) {
            die(passthru("./updateScript.sh"));
        } else {
            die("Please execute ./updateScript.sh now.");
        }
    }
}
# Make a quick run through the command line arguments to see if the user wants
# to print the help. This saves us a lot of headache with respecting the order
# in which configuration parameters have to be overwritten.
foreach ($argv as $_option) {
    if (0 === strpos($_option, "--help") || 0 === strpos($_option, "-h")) {
        showHelp($argv[0]);
        exit(0);
    }
}
// Read external configuration - Stage 1 - typo3scripts.conf (overwrites default, hard-coded configuration)
$BASE_CONFIG_FILENAME = "typo3scripts.conf";
if (file_exists($BASE_CONFIG_FILENAME)) {
    if (!is_readable($BASE_CONFIG_FILENAME)) {
        consoleWriteLine("Unable to read '" . $BASE_CONFIG_FILENAME . "'. Check permissions.");
        exit(1);
    }
    consoleWriteVerbose("Sourcing script configuration from " . $BASE_CONFIG_FILENAME . "...");
    $_baseConfig = file_get_contents($BASE_CONFIG_FILENAME);
    $_baseConfigFixed = preg_replace("/^(?!\\s*\$)(?P<name>[^#][^=]+)\\s*=\\s*(?P<value>[^\$]*?)\$/ms", "\$\\1=\"\\2\";", $_baseConfig);
    eval($_baseConfigFixed);
    consoleWriteLineVerbose("Done.");
예제 #4
0
        case 'b':
        case 'addcbbox':
            $options['addcbbox'] = true;
            break;
        case 'l':
        case 'link':
            $options['link'] = true;
            break;
        case 'i':
        case 'fonts':
            $options['fonts'] = explode(',', $val);
            break;
        case 'h':
        case 'help':
        default:
            showHelp();
            break;
    }
    // end of switch
}
// end of while loop
if (empty($options['fonts'])) {
    echo "ERROR: missing input fonts (try --help for usage)\n\n";
    exit(2);
}
// check the output path
if (!is_dir($options['outpath']) or !is_writable($options['outpath'])) {
    echo "ERROR: Can't write to " . $options['outpath'] . "\n\n";
    exit(3);
}
echo "\n>>> Converting fonts for TCPDF:\n";
예제 #5
0
파일: run.php 프로젝트: focuslife/v0.1
| ext.standard.tests.general_functions.bug27678
| tests.lang.bug24640
)\\.phpt$~x', $file)) {
                return null;
            }
            if (!preg_match('~--FILE--\\s*(.*?)--[A-Z]+--~s', $code, $matches)) {
                return null;
            }
            if (preg_match('~--EXPECT(?:F|REGEX)?--\\s*(?:Parse|Fatal) error~', $code)) {
                return null;
            }
            return $matches[1];
        };
        break;
    default:
        showHelp('Test type must be one of: PHP5, PHP7 or Symfony');
}
require_once dirname(__FILE__) . '/../lib/PhpParser/Autoloader.php';
PhpParser\Autoloader::register();
$parserName = 'PhpParser\\Parser\\' . $version;
$parser = new $parserName(new PhpParser\Lexer\Emulative());
$prettyPrinter = new PhpParser\PrettyPrinter\Standard();
$nodeDumper = new PhpParser\NodeDumper();
$parseFail = $ppFail = $compareFail = $count = 0;
$readTime = $parseTime = $ppTime = $reparseTime = $compareTime = 0;
$totalStartTime = microtime(true);
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
    if (!$fileFilter($file)) {
        continue;
    }
    $startTime = microtime(true);
예제 #6
0
function parseArgs($args)
{
    $operations = array();
    $files = array();
    array_shift($args);
    $parseOptions = true;
    foreach ($args as $arg) {
        if (!$parseOptions) {
            $files[] = $arg;
            continue;
        }
        switch ($arg) {
            case '--dump':
            case '-d':
                $operations[] = 'dump';
                break;
            case '--pretty-print':
            case '-p':
                $operations[] = 'pretty-print';
                break;
            case '--serialize-xml':
                $operations[] = 'serialize-xml';
                break;
            case '--var-dump':
                $operations[] = 'var-dump';
                break;
            case '--resolve-names':
            case '-N':
                $operations[] = 'resolve-names';
                break;
            case '--':
                $parseOptions = false;
                break;
            default:
                if ($arg[0] === '-') {
                    showHelp("Invalid operation {$arg}.");
                } else {
                    $files[] = $arg;
                }
        }
    }
    return array($operations, $files);
}
예제 #7
0
파일: run.php 프로젝트: royopa/PHP-Parser
| ext.standard.tests.general_functions.bug27678
| tests.lang.bug24640
)\\.phpt$~x', $file)) {
                return null;
            }
            if (!preg_match('~--FILE--\\s*(.*?)--[A-Z]+--~s', $code, $matches)) {
                return null;
            }
            if (preg_match('~--EXPECT(?:F|REGEX)?--\\s*(?:Parse|Fatal) error~', $code)) {
                return null;
            }
            return $matches[1];
        };
        break;
    default:
        showHelp('Test type must be either "Symfony" or "PHP"!');
}
require_once dirname(__FILE__) . '/../lib/PhpParser/Autoloader.php';
PhpParser\Autoloader::register();
$parserName = 'PhpParser\\Parser\\' . $version;
$parser = new $parserName(new PhpParser\Lexer\Emulative());
$prettyPrinter = new PhpParser\PrettyPrinter\Standard();
$nodeDumper = new PhpParser\NodeDumper();
$parseFail = $ppFail = $compareFail = $count = 0;
$readTime = $parseTime = $ppTime = $reparseTime = $compareTime = 0;
$totalStartTime = microtime(true);
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
    if (!$fileFilter($file)) {
        continue;
    }
    $startTime = microtime(true);
예제 #8
0
     break;
 case 'generate':
     generateBackup($cid, $option);
     break;
 case 'confirm':
     confirmBackup($option);
     break;
 case 'download':
     downloadBackup($_REQUEST[file]);
     break;
 case 'cron':
     HTML_cloner::Cron();
     break;
 case 'about':
 case 'credits':
     showHelp($option);
     break;
 case 'restore':
     HTML_cloner::Restore($option);
     break;
 case 'cron_delete':
     if (unlink($_CONFIG['multiple_config_dir'] . "/" . $_REQUEST['fconfig'])) {
         $msg = " was deleted";
     } else {
         $msg = " was not deleted, please delete it manually!";
     }
     mosRedirect('index2.php?option=' . $option . "&task=config", $_REQUEST['fconfig'] . $msg);
     break;
 case 'remove':
     deleteBackups($cid, $option);
     break;
예제 #9
0
    while ($row = @mysqli_fetch_assoc($result)) {
        echo "\t" . $row['gps_type_id'] . ": " . $row['gps_type_name'] . "<br>\n";
    }
    echo "<br>\n";
    echo "<b>GPS Paths:</b><br>\n";
    $typeSql = "select gps_path_id, gps_path_name from gps_path order by gps_path_id";
    $result = mysqli_query($con, $typeSql);
    while ($row = @mysqli_fetch_assoc($result)) {
        echo "\t" . $row['gps_path_id'] . ": " . $row['gps_path_name'] . "<br>\n";
    }
    echo "<br>\n";
    echo "<b>Marker Status:</b><br>\n";
    echo "\t*: Default\n<br>";
    echo "\tH: Hidden\n<br>";
    echo "\tP: Path Only\n<br>";
    echo "<br>\n";
}
if (isset($_GET['key']) && $_GET['key'] == phpGPS_Settings::$_secretKey) {
    if (isset($_GET["newEntry"]) && $_GET["newEntry"] == "Y") {
        echo "New Entry<br /><br />\n";
        newEntry($con);
    } else {
        if (isset($_GET["help"])) {
            showHelp($con);
        } else {
            echo "Invalid Option";
        }
    }
} else {
    echo "Invalid Key!";
}
예제 #10
0
<?php

require_once "../inc/init.php";
if (!isInRequest("subject", "category")) {
    showHelpError("Invalid inputs");
} else {
    showHelp($_REQUEST["subject"], $_REQUEST["category"]);
}
function showHelp($subject, $category)
{
    $smarty = new IBSSmarty();
    $smarty->default_template_handler_func = 'template_handler_func';
    $smarty->assign("tpl_file", getTplFile($subject, $category));
    $smarty->assign("subject", $subject);
    $smarty->assign("category", $category);
    $smarty->display("help/skeleton.tpl");
}
function getTplFile($subject, $category)
{
    $subject = quotemeta(helpFixFileName($subject));
    $category = quotemeta(helpFixFileName($category));
    return "help/{$category}/{$subject}.tpl";
}
function helpFixFileName($file_name)
{
    $file_name = str_replace(" ", "_", $file_name);
    $file_name = str_replace(".", "_", $file_name);
    return $file_name;
}
function template_handler_func($resource_type, $resource_name, &$template_source, &$template_timestamp, &$smarty_obj)
{
예제 #11
0
        } elseif (!is_file($arg) && ('--' != substr($arg, 0, 2) || $hasFnSeparator)) {
            $fileNotFound = true;
            $missingFiles[] = $arg;
            fwrite(STDERR, '!');
        }
        if (0 == $fileCount % 20) {
            fwrite(STDERR, ' ' . $fileCount . PHP_EOL);
        }
    }
    fwrite(STDERR, PHP_EOL);
    if (null !== $cache) {
        fwrite(STDERR, ' ' . $cacheHitCount . ' files untouched (cache hit)' . PHP_EOL);
    }
    fwrite(STDERR, ' ' . $fileCount . ' files total' . PHP_EOL);
    fwrite(STDERR, 'Took ' . round(microtime(true) - $start, 2) . 's' . PHP_EOL);
    if (sizeof($missingFiles)) {
        fwrite(STDERR, 'Files not found: ' . PHP_EOL);
        foreach ($missingFiles as $file) {
            fwrite(STDERR, "\t - " . $file . PHP_EOL);
        }
    }
    if ($dryRun && $filesChanged) {
        exit(1);
    }
    if ($fileNotFound) {
        exit(255);
    }
} else {
    showHelp($argv, $enableCache, $inPhar);
}
exit(0);
예제 #12
0
function processCommand($cmdString) {
	if (substr($cmdString, 0, 1) != '/') return false;

	$firstSpace = strpos($cmdString, ' ');

	if ($firstSpace) {
		$command = substr($cmdString, 1, $firstSpace - 1);
		$args = substr($cmdString, $firstSpace + 1);
		$args = trim($args);
		
		if ($args == '') unset($args);
		else $args = explode(' ', $args);
		
	} else {
		$command = substr($cmdString, 1);
	}

	
	switch($command) {
		case 'help':
			if (isset($args))
				showHelp($args[0]);
			else
				showHelp('help');
			break;
			
		case 'login':
			if (isset($args))
				if (login(md5($args[0])))
					sysShout('Logged in! <a href="javascript:window.location.reload()">Refresh</a> this browser window to view information about shouts that were made before you logged in.');
				else
					sysShout('Login failed.');
			break;

		case 'logout':
			if (logout())
				sysShout('Logged out.');
			else
					sysShout('Logout failed.');
			break;

		case 'ban':
			if (isset($args)) {
				if (ban($args[0]))
					sysShout('Banned ' . formatString($args[0]) . '.');
				else
					sysShout('Couldn\'t ban ' . formatString($args[0]) . '.');
			}
			break;

		case 'unban':
			if (isset($args)) {
				if (unban($args[0]))
					sysShout('Unbanned ' . formatString($args[0]) . '.');
				else
					sysShout('Couldn\'t unban ' . formatString($args[0]) . '.');
					
			}
			break;

		case 'bans':
			listBans();
			break;

		case 'clearbans':
			if (clearBans())
				sysShout('Bans cleared.');
			else
				sysShout('Couldn\'t clear bans.');
				break;

		case 'clear':
			if (clearLog())
				sysShout('All shouts cleared; <a href="javascript:window.location.reload()">refresh</a> your browser window.');
			else
				sysShout('Couldn\'t clear the chat.');
			break;
	}

	return true;
}
예제 #13
0
 * Yes, it's dead slow compared to C :/
 */
error_reporting(E_ALL | E_STRICT);
require __DIR__ . '/../lib/Phlexy/bootstrap.php';
require __DIR__ . '/phpLexerDefinition.php';
if ($argc !== 3) {
    showHelp('Invalid argument count.');
}
$testType = $argv[1];
$testFilesDirectory = $argv[2];
if ($testType === 'php-src-tests') {
    $codes = getCodes($testFilesDirectory, 'PhpTestFileFilterIterator', 'CodeFilterIterator');
} elseif ($testType === 'code') {
    $codes = getCodes($testFilesDirectory, 'PhpFileFilterIterator', 'CodeFilterIterator');
} else {
    showHelp('Invalid test type.');
}
$factory = new \Phlexy\LexerFactory\Stateful\UsingCompiledRegex(new \Phlexy\LexerDataGenerator());
$lexer = $factory->createLexer(getPHPLexerDefinition(), 'i');
$myTime = 0;
$phpTime = 0;
foreach ($codes as $code) {
    try {
        $startTime = microtime(true);
        $myLex = $lexer->lex($code);
        $myTime += microtime(true) - $startTime;
    } catch (Exception $e) {
        echo "\n", 'Exception: ', $codes->getPathName(), "\n";
        echo 'Message: ', $e->getMessage(), "\n";
        echo 'State stack: ', '[' . implode(', ', $lexer->getStateStack()) . ']';
        die;
예제 #14
0
function install($argv)
{
    $checkOnly = false;
    $helpOnly = false;
    $quiet = false;
    $installDir = getcwd();
    $version = 'stable';
    $skipNextArg = false;
    foreach ($argv as $i => $arg) {
        if ($skipNextArg) {
            $skipNextArg = false;
            continue;
        }
        if ($arg == '--check') {
            $checkOnly = true;
        } elseif ($arg == '--quiet') {
            $quiet = true;
        } elseif ($arg == '--help' or $arg == '-h') {
            $helpOnly = true;
        } elseif ($arg == '--install-dir') {
            $skipNextArg = true;
            $installDir = trim($argv[$i + 1]);
        } elseif ($arg == '--version') {
            $skipNextArg = true;
            $version = trim($argv[$i + 1]);
            if ($version == 'master') {
                $version = 'default';
            }
        }
    }
    if ($helpOnly) {
        showHelp();
        exit(0);
    }
    $checkResult = checkEnvironment($installDir);
    reportProblems($checkResult, $checkOnly && !$quiet);
    if ($checkOnly || !$checkResult->isOk()) {
        exit($checkResult->getExitCode());
    }
    $exitCode = installPieCrust($version, $installDir, $quiet);
    exit($exitCode);
}
예제 #15
0
 function page_edit()
 {
     global $go, $default;
     $this->template->location = $this->lang->word('edit');
     // sub-locations
     $this->template->sub_location[] = array($this->lang->word('main'), "?a={$go['a']}");
     $this->template->add_js('jquery.js');
     $this->template->add_js('jquery.inplace.js');
     $this->template->add_js('toolman.dragdrop.js');
     $this->template->add_js('ndxz.exhibit-edit.js');
     if ($default['color_picker'] === true) {
         $this->template->add_js('plugin.js');
     }
     $this->template->add_css('plugin.css');
     $script = "<script type='text/javascript'>\n        <!--\n        var action = '{$go['a']}';\n        var ide = '{$go['id']}';\n        //-->\n        </script>";
     $this->template->add_script = $script;
     // the record
     $rs = $this->db->fetchRecord("SELECT *\n            FROM " . PX . "objects, " . PX . "objects_prefs, " . PX . "sections\n            WHERE id = '{$go['id']}'\n            AND object = '" . OBJECT . "'\n            AND section_id = secid\n            AND object = obj_ref_type");
     load_module_helper('files', $go['a']);
     load_helpers(array('editortools', 'output'));
     // we need this for a bunch of things
     $bgcolor = $rs['color'] === '' ? 'ffffff' : $rs['color'];
     // ++++++++++++++++++++++++++++++++++++++++++++++++++++
     $body = $this->error === true ? div($this->error_msg, "id='show-error'") . br() : '';
     $body .= "<div id='tab'>\n";
     $body .= "<div class='c5'>\n";
     // left column
     $body .= "<div class='colA'>\n";
     $body .= "<div class='bg-grey'>\n";
     $body .= "<div>\n";
     // rewrite this so we can save texts...
     $body .= div("<h3><span class='sec-title'>{$rs['sec_desc']}</span> <span class='inplace1'>{$rs['title']}</span></h3>", "class='col'");
     $body .= div(p("&nbsp;", "id='ajaxhold'"), "class='col txt-right'");
     $body .= "<div class='cl'><!-- --></div>\n";
     $body .= "</div>\n";
     $body .= editorTools($rs['content'], $this->access->prefs['user_mode'], editorButtons($rs['status']), $rs['process']);
     $body .= "<div>\n";
     $body .= div(label($this->lang->word('images')), "class='col'");
     $body .= div(p("&nbsp;", "id='imgshold'"), "class='col txt-right'");
     $body .= "<div class='cl'><!-- --></div>\n";
     $body .= "</div>\n";
     // the uploader part
     $body .= "<div id='iframe'><iframe src='?a={$go['a']}&q=jxload&id={$go['id']}' frameborder='0' scrolling='auto' width='625' height='100'></iframe></div>\n";
     // end uploader part
     $body .= "<div id='img-container'>";
     $body .= getExhibitImages($go['id']);
     $body .= "</div>\n";
     // end images part
     $body .= "</div>\n";
     $body .= "</div>\n";
     // end left colum
     // right column
     $body .= "<div class='colB'>\n";
     $body .= "<div class='colB-set'>\n";
     $body .= "<div class='colB-pad'>\n";
     $body .= label($this->lang->word('publish')) . br();
     $body .= getOnOff($rs['status'], "class='listed' id='ajx-status'");
     $body .= "<label>" . $this->lang->word('exhibition format') . "</label>\n";
     $body .= getPresent(DIRNAME . BASENAME . '/site/plugin/', $rs['format']);
     if ($this->access->prefs['user_mode'] == 1) {
         $body .= label($this->lang->word('thumb max') . showHelp($this->lang->word('thumb max'))) . br();
         $body .= getThumbSize($rs['thumbs'], "class='listed' id='ajx-thumbs'");
         $body .= label($this->lang->word('image max')) . br();
         $body .= getImageSizes($rs['images'], "class='listed' id='ajx-images'");
     }
     // background color - this is a mess
     $body .= "<label>" . $this->lang->word('background color') . "</label>\n";
     if ($default['color_picker'] === true) {
         $body .= getColorPicker($bgcolor);
     } else {
         $body .= "<div style='margin: 3px 0 5px 0;' onclick=\"toggle('plugin2'); return false;\"><span id='plugID' style='background: #{$bgcolor}; cursor: pointer;'>&nbsp;</span> ";
         $body .= span('#' . $bgcolor, "id='colorTest2'");
         $body .= "</div>\n";
         $body .= "<div id='plugin2' style='display:none;'>\n";
         $body .= "<input type='text' id='colorBox' name='color' value='{$bgcolor}' style='margin-bottom: 0;' maxlength='7' />\n";
         $body .= "<input type='button' onclick=\"updateColor();\" value='Update' />\n";
         $body .= "</div>\n";
     }
     $body .= p("<small>" . $this->lang->word('edit color') . "</small>", "style='margin-bottom: 12px;'");
     // end background color
     // background image
     $body .= "<label>" . $this->lang->word('background image') . " <span class='small-txt'>" . getLimit() . " max</span></label>\n";
     $body .= "<div id='iframe'><iframe src='?a={$go['a']}&q=jxbg&id={$go['id']}' frameborder='0' scrolling='no' width='200' height='55'></iframe></div>\n";
     // aditional options
     $body .= "<div style='margin: 3px 0 5px 0;' onclick=\"toggle('adt-options'); return false;\"><label style='cursor:pointer;'>" . $this->lang->word('additional options') . "</label> ";
     $body .= "<div id='adt-options' style='display:none; padding-top:12px;'>\n";
     $body .= label($this->lang->word('background tiling')) . br();
     $body .= getOnOff($rs['tiling'], "class='listed' id='ajx-tiling'");
     if ($this->access->prefs['user_mode'] == 1) {
         $body .= label($this->lang->word('page process')) . br();
         $body .= getOnOff($rs['process'], "class='listed' id='ajx-process'");
         $body .= label($this->lang->word('hide page')) . br();
         $body .= getOnOff($rs['hidden'], "class='listed' id='ajx-hidden'");
     }
     $body .= "</div>\n";
     $body .= "</div>\n";
     // end advanced
     // hidden fields
     $body .= input('hord', 'hidden', null, $rs['ord']);
     $body .= input('hsection_id', 'hidden', null, $rs['section_id']);
     $body .= "</div>\n";
     $body .= "</div>\n";
     $body .= "</div>\n";
     // end right column
     $body .= "<div class='cl'><!-- --></div>\n";
     $body .= "</div>\n";
     // the script for colors
     if ($default['color_picker'] === true) {
         $body .= "<script type='text/javascript'>\n            function mkColor(v) { \$S('plugID').background='#'+v; }\n            loadSV(); updateH('{$bgcolor}');\n            </script>";
     }
     $this->template->body = $body;
     return;
 }