public function __construct($domain = 'example.com') { if (empty($domain)) { $domain = getLine('Enter domain without www (ie. example.com):'); } $this->domain = $domain; $ex = explode('.', $domain, 2); $this->username = $ex[0]; echo "Domain: " . $this->domain . "\n"; echo "Username: "******"\n"; echo "Set up your DNS here: \n" . $this->getLinodeDnsLink() . "\n"; echo "Set your nameservers to ns1.linode.com (1-5) (godaddy, namecheap, etc)\n"; echo "Perform the commands below:\n"; echo $this->getAddUserScript() . "\n"; echo "mkdir -p /home/{$this->username}/public_html" . "\n"; echo "mkdir -p /home/{$this->username}/logs" . "\n"; $sites_avail_file = "/etc/apache2/sites-available/{$this->domain}"; if (file_exists($sites_avail_file)) { echo 'Site already exists' . "\n"; $create_or_replace = 'Replace'; } else { $create_or_replace = 'Create'; } echo "You need an apache virtual host file such as the one below" . "\n" . "{$sites_avail_file}" . "\n" . "{$create_or_replace} it? [Y/n]"; if (getLine() == 'Y') { file_put_contents($sites_avail_file, $this->genApacheSiteTemplate()); } echo "Now please enable the site with the command below\n"; echo "a2ensite {$this->domain}" . "\n"; echo "\n"; echo "done.\n"; }
function getLine($input, $curr_line) { global $headers, $curr_line, $lines; foreach ($input as $key => $value) { if (is_array($value)) { getLine($value, $curr_line); } elseif (preg_match('/^[0-9][0-9]*$/', $key)) { if (is_array($value)) { getLine($value, $curr_line); unset($input['$key']); $lines[] = $curr_line; $curr_line = array(); var_dump($lines); getLine($input, $curr_line); break; } } elseif ($key != 'inDataset' && !preg_match('/^[0-9][0-9]*$/', $key)) { if ($key == '_about') { $key = $input['inDataset']; } if (!in_array($key, $headers)) { $headers[] = $key; } $curr_line[$key] = $value; } } }
function successful() { global $conn; $temp = getLine(); // If not correct response to signify succesfull command, close connection and kill PHP quoting error if ($temp != "error id=0 msg=ok") { // Attempt to tell TS3 we are quitting execCommand("quit"); // Close connection fclose($conn); // Kill PHP script, quoting error from TS3 die("Suiciding: Unexpected TS3 error: \"" . $temp . "\"\n"); } }
if ($antonym_term != "") { $antonym_array = getAntonym($db2, $db->f('wmid')); if (is_array($antonym_array)) { list($antonym_mid, $antonym_word) = $antonym_array; $antonym_line = $antonym_word . $antonym_term; #print "Anto: ".$w.": ".$antonym_word." -- ".$antonym_line."<br>"; } } if ($sub_term != "") { #subordinate concepts: $sub_line = ""; $sub = getSubordinateSynsets($db2, $db->f('meaning_id')); foreach ($sub as $sub_id) { $sub_synset = getSynsetWithUsage($sub_id); if (sizeof($sub_synset) > 0) { $sub_line = getLine($sub_synset, $w, $sub_term); $sub_line = substr($sub_line, 1); # cut off "-" $syn_line = $syn_line . $sub_line; } } } $syn_line = $syn_line . $generic_line; if ($antonym_line != "") { $syn_line .= "|" . $antonym_line; } if (strtolower($prev_word) == strtolower($w)) { if ($syn_line != "") { array_push($lines, $syn_line . "\n"); } } else {
function outputSTDOUT($out) { if (count($out) != 0) { if ($GLOBALS['colors']) { echo "\n\n[34mResults: [0m\n\n"; } else { echo "\n\nResults:\n\n"; } foreach ($out as $match) { if ($GLOBALS['colors']) { echo "[35;1m*[0m"; echo " In \"[34m{$match['0']}[0m\": "; echo "[35;1m{$match['3']}[0m\n"; echo getLine($match[0], $match[2], 1, 1, "\n"); } else { echo "*"; echo " In \"{$match['0']}\": "; echo "{$match['3']}\n"; echo getLine($match[0], $match[2], 1, 1, "\n"); } } } else { if ($GLOBALS['colors']) { echo "\n\n[34mNo Results !!![0m\n"; } else { echo "\n\nNo Results !!!\n"; } } //end of function outputSTDOUT }
if ($i % 1000 == 0) { print strftime("%H:%M:%S") . " -- word {$i}...<br>"; flush(); } $i++; $word_id = $db->f('word_id'); #print $db->f('meaning_id')."\n"; $synset = getSynsetWithUsage($db->f('meaning_id')); $str = getMorphologic($db->f('meaning_id')); $str2 = ""; if ($str != "") { $str2 = "(" . $str . ")"; } else { $str2 = "-"; } $syn_line = getLine($synset, $w, ''); $generic_line = ""; # Antonyme: $antonym_line = ""; if ($antonym_term != "") { $antonym_array = getAntonym($db2, $db->f('wmid')); if (is_array($antonym_array)) { list($antonym_mid, $antonym_word) = $antonym_array; $antonym_line = $antonym_word . $antonym_term; print "Anto: " . $w . ": " . $antonym_word . " -- " . $antonym_line . "<br>"; } } $syn_line = $str2 . $syn_line . $generic_line; if ($antonym_line != "") { $syn_line .= "|" . $antonym_line; }
\t注:此处的别名必须是你使用Wind::import方法导入类将使用的真实目录别名 EOA; e($message); } //遍历各个路径 $classes = $imports = $fileList = array(); foreach ($folders as $folder) { $alias = ''; if (!is_dir($folder)) { e("'{$folder}' is not a real directory!\n"); } $alias = strtoupper(basename($folder)) . ':'; $r = getLine("'{$folder}' is to be register as '{$alias}' ? (Y|N) "); if (strtolower($r[0]) != 'y') { $alias = getLine('Please input the relative path using namespace: '); } $fileList += readRecur(realpath($folder), $alias); } /* 载入需要的文件信息 */ Wind::import('WIND:utility.WindPack'); /* 打包 */ $pack = new WindPack(); $pack->packFromFileList($fileList, _COMPILE_PATH . 'wind_basic.php', WindPack::STRIP_PHP, true); $message = array(); $message[] = "COMPILE: pack core file successful~"; /*装载imports和classes*/ $data = '<?php Wind::$_imports += ' . var_export($imports, true) . ';' . 'Wind::$_classes += ' . var_export($classes, true) . ';'; WindFile::write(_COMPILE_PATH . 'wind_imports.php', $data); $message[] = "COMPILE: wind_imports.php successful~"; $message[] = '';
function createLeafHtml(&$smarty, $leaf_info, $line) { $total_rate_kbits = price($leaf_info["total_rate_kbits"]); $default_rate_kbits = price($leaf_info["default_rate_kbits"]); $total_ceil_kbits = price($leaf_info["total_ceil_kbits"]); $default_ceil_kbits = price($leaf_info["default_ceil_kbits"]); $n_table = "<table cellspacing=0 cellpadding=0 align=center border=0 width=100%>"; $n_table .= "<tr><td align=center>" . getLine($line) . "</td></tr>"; $n_table .= "<tr><td align=center>" . verticalLineImage() . "</td>"; $n_table .= "<tr><td>"; $color = "blue"; $n_table .= <<<END \t\t<table border="0" cellspacing="0" cellpadding="0" align=center> \t\t\t<tr> \t\t\t\t<td class="Form_Title_Begin"><img border="0" src="/IBSng/images/form/begin_form_title_{$color}.gif"></td> \t\t\t\t<td class="Form_Title_{$color}"> \t\t\t\t <a href="#" id='{$leaf_info["leaf_id"]}_leaf_link' onClick="showReportLayer('{$leaf_info["leaf_id"]}_leaf_id',this,'right'); return false;" class="bw_node"> \t\t\t\t\t{$leaf_info["leaf_name"]} \t\t\t\t </td> \t\t\t\t</td> \t\t\t\t<td class="Form_Title_End"><img border="0" src="/IBSng/images/form/end_form_title_{$color}.gif"></td> \t\t\t</tr> END; $n_table .= leafLimitTR("Total limit: <b>R:{$total_rate_kbits}|C:{$total_ceil_kbits}</b> kbits"); $n_table .= leafLimitTR("Default limit: <b>R:{$default_rate_kbits}|C:{$default_ceil_kbits}</b> kbits"); $n_table .= "</table></td></tr>"; $n_table .= "</table>"; return $n_table . createLeafLayer($smarty, $leaf_info); }
$info->authors[0]->email = $author_email; } echo "Author role: (Developer) "; $info->authors[0]->role = getLine() ?: "Developer"; } echo "\n"; echo "PSR-4 namespace name of package: (leave blank if not needed) "; $psr4_name = stripslashes(getLine()); if ($psr4_name) { $autoload = array("psr-4" => array($psr4_name => null)); echo "PSR-4 namespace source directory: (src/) "; $src_dir = getLine() ?: "src/"; if (!is_dir($src_dir)) { echo "Create source directory: {$src_dir} (yes|no)?"; if (strtolower(getLine()) === "yes" and mkdir($src_dir, 0775, "recursive")) { echo "Done."; } } $autoload['psr-4'][$psr4_name] = $src_dir; $info->autoload = json_decode(json_encode($autoload, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)); } $output = json_encode($info, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT) . "\n"; echo "\n"; echo $output; echo "\n"; echo "Write to composer.json? (yes|no) "; if (strtolower(getLine()) === "yes") { file_put_contents("composer.json", $output); echo "Written.\n"; } echo "Done.\n";
if (isset($ini[$testname]['outp'])) { $outp = $ini[$testname]['outp']; } if (isset($ini[$testname]['ret'])) { $ret = $ini[$testname]['ret']; } if (isset($ini[$testname]['isCritical'])) { if ($ini[$testname]['isCritical'] == 1 || $ini[$testname]['isCritical'] == "") { $testcritical = $ini[$testname]['isCritical']; if ($testcritical == 1) { $testcritical = true; } else { $testcritical = false; } } else { $output->Warn("On line " . getLine($argv[$x], "isCritical=" . $ini[$testname]['isCritical']) . " of file " . $argv[$x] . ": isCritical has to be 'true' or 'false'.\n"); } } $out = array(); $ereturn = 0; exec($exec, $out, $ereturn); $temp = implode("", $out); if ($outp != "") { if ($temp != $outp) { $testSuccess = false; } } if ($ret != "") { if ($ereturn != $ret) { $testSuccess = false; }
//verifica quem é o admin do evento. $line['host'] = getEventAdmin($line['name'])['username']; if ($line['host'] == $_SESSION['username']){ $line['host'] = "Delete Event"; } else{ $line['host'] = "host: ".$line['host']; } //inclui todos os comentários em $line['ArrayCom'] $tableCom = getCommentsFromEvent($line['name']); $maxCom = sizeof($tableCom); $line['tableCom'] = $tableCom; $line['maxCom'] = $maxCom; $line['ArrayCom'] = array(); for($j = 0; $j < $maxCom; $j++){ $lineCom = getLine($tableCom, $j); $comUser = getUsername($lineCom['idUser']); array_push($line['ArrayCom'], $comUser['username'], $lineCom['commentary'], $lineCom['idComment']); } $line['type'] = getEventType($line['name']); $line['attend'] = Attend($line['name']); $line['people'] = getUsersAttendingEvent($line['name']); $line['Npeople'] = count($line['people']); $line['session'] = $_SESSION['username']; echo json_encode($line); ?>
function isScrolledIntoView(elem) { var $elem = $(elem); var $window = $(window); var docViewTop = $window.scrollTop(); var docViewBottom = docViewTop + $window.height(); var elemTop = $elem.offset().top; var elemBottom = elemTop + $elem.height(); return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); } setInterval(function() { <?php echo getLine(); ?> }, 100); $(document).ready(function(){ var sticky = new Waypoint.Sticky({ element: $('.basic-sticky-example')[0] }); var inview = new Waypoint.Inview({ element: $('#hello')[0], enter: function(direction) { notify('Enter triggered with direction ' + direction) }, entered: function(direction) { notify('Entered triggered with direction ' + direction) },
<?php $values = []; while (!array_key_exists('a', $values)) { foreach (getLine() as $line) { $command = parseLine($line); $firstInput = $command[1]; $operator = $command[2]; $secondInput = $command[3]; $outputName = $command[4]; if ($operator === '') { if (is_numeric($secondInput)) { $inputValue = (int) $secondInput; } else { if (array_key_exists($secondInput, $values)) { $inputValue = $values[$secondInput]; } else { continue; } } $outputValue = $inputValue; } else { if ($operator === 'NOT') { if (is_numeric($secondInput)) { $num = (int) $secondInput; $inputValue = $num; } else { if (array_key_exists($secondInput, $values)) { $inputValue = $values[$secondInput]; } else { continue;
function getLine($file) { $buffer = ""; // iterate over each character in line. while (!feof($file)) { // append the character to the buffer. $character = fgetc($file); $buffer .= $character; // check for end of line. if ($character == "\n" or $character == "\r") { // checks if the next character is part of the line ending, as in // the case of windows '\r\n' files, or not as in the case of // mac classic '\r', and unix/os x '\n' files. $character = fgetc($file); if ($character == "\n") { // part of line ending, append to buffer. $buffer .= $character; } else { // not part of line ending, roll back file pointer. fseek($file, -1, SEEK_CUR); } // end of line, so stop reading. break; } } // return the line buffer. return $buffer; } echo getLine($file) . "\n"; echo getLine($file) . "\n"; fclose($file);