예제 #1
0
/**
 * @param array $files Configuration files, from lowest to highest precedence.
 * @return array An associative array mapping config variables to respective values.
 */
function readConfig(array $files)
{
    if (count($files) == 0) {
        return array();
    } else {
        return array_merge(parse_ini_file(head($files)), readConfig(tail($files)));
    }
}
예제 #2
0
/**
 * @author Sérgio Rafael Siqueira <*****@*****.**>
 *
 * @param callable $fn
 *
 * @return mixed
 */
function partial(callable $fn)
{
    $args = tail(func_get_args());
    $numRequiredParams = (new \ReflectionFunction($fn))->getNumberOfRequiredParameters();
    return function () use($fn, $args, $numRequiredParams) {
        $args = array_merge($args, func_get_args());
        if ($numRequiredParams > count($args)) {
            return call_user_func_array(partial, array_merge([$fn], $args));
        }
        return call_user_func_array($fn, $args);
    };
}
예제 #3
0
/**
 * @author Sérgio Rafael Siqueira <*****@*****.**>
 *
 * @param array $xss
 *
 * @return array
 */
function sort(array $xss)
{
    $xss = array_values($xss);
    if (!has(1, $xss)) {
        return $xss;
    }
    $pivot = head($xss);
    $xs = tail($xss);
    $left = array_filter($xs, function ($x) use($pivot) {
        return $x < $pivot;
    });
    $right = array_filter($xs, function ($x) use($pivot) {
        return $x > $pivot;
    });
    return array_merge(sort($left), [$pivot], sort($right));
}
예제 #4
0
/**
 * @author Marcelo Camargo <*****@*****.**>
 * @author Sérgio Rafael Siqueira <*****@*****.**>
 *
 * @return array
 */
function takewhile()
{
    $args = func_get_args();
    $takewhile = function (callable $condition, array $xss) {
        if ([] === $xss) {
            return [];
        }
        $head = head($xss);
        $tail = tail($xss);
        if ($condition($head)) {
            return array_merge([$head], takewhile($condition, $tail));
        }
        return [];
    };
    return call_user_func_array(partial($takewhile), $args);
}
예제 #5
0
/**
 * @author Sérgio Rafael Siqueira <*****@*****.**>
 *
 * @return array
 */
function dropwhile()
{
    $args = func_get_args();
    $dropwhile = function (callable $condition, array $xss) {
        if ([] === $xss) {
            return [];
        }
        $head = head($xss);
        $tail = tail($xss);
        if ($condition($head)) {
            return dropwhile($condition, $tail);
        }
        return $xss;
    };
    return call_user_func_array(partial($dropwhile), $args);
}
예제 #6
0
function live_chat_load_events($options)
{
    $tail['filename'] = LIVE_CHAT_STORAGE_PATH . $options['type'] . '/' . $options['reference_id'];
    $tail['line_count'] = LIVE_CHAT_MAX_READ_LINES;
    $tail['buffer_length'] = LIVE_CHAT_STORAGE_BUFFER_LENGTH;
    $options['min_id'] = isset($options['min_id']) ? $options['min_id'] : 0;
    $rows = tail($tail);
    $events = array();
    foreach ($rows as $row) {
        $event = unserialize(trim($row));
        if ($event['id'] > $options['min_id']) {
            $event['message'] = clickable_links($event['message']);
            $event['message'] = setsmilies($event['message']);
            $events[] = $event;
        }
    }
    return $events;
}
예제 #7
0
function changeComplete($type = "Information", $note = "")
{
    session_destroy();
    head();
    ?>
	<section><div class="container">
		<h1><?php 
    echo $type;
    ?>
 Changed!</h1>
		<p>Success! Please re-login to continue.</p>
		<p><?php 
    echo $note;
    ?>
</p>
	</div></section>
	<?php 
    tail();
    die;
}
예제 #8
0
파일: feedback.php 프로젝트: BBKolton/EXCO
function setData($DATABASE)
{
    $db = new DB();
    $values = [];
    foreach ($_POST as $value) {
        array_push($values, $db->quote($value));
    }
    $valuesString = "(" . implode(", ", $values) . ")";
    $db->query("INSERT INTO " . $DATABASE . ".feedback \n\t\t              (type, text, email) \n\t\t              VALUES " . $valuesString);
    head();
    ?>

		<div class="container">
			<h1>Thank you for your feedback!</h1>
			<p>Your feedback has been successfuly saved.</p>
		</div>

		<?php 
    tail();
    die;
}
예제 #9
0
function verifyUser($email, $code, $DATABASE)
{
    $db = new DB();
    $exists = $db->select("SELECT * \n\t                         FROM " . $DATABASE . ".users \n\t                         WHERE email = " . $db->quote($email) . " AND activation = " . $db->quote($code));
    if (empty($exists[0])) {
        error("Invalid Verification", "Your verification is invalid. You might already be verified.");
    } else {
        //TODO this is copied into preferences for updateing email
        if (preg_match("/((@uw\\.edu)|(@u\\.washington\\.edu))/i", $exists[0]["email"])) {
            $netid = substr($exists[0]["email"], 0, strpos($exists[0]["email"], "@"));
            $db->query("UPDATE " . $DATABASE . ".users\n\t\t\t              SET activation = '1', netid = " . $db->quote($netid) . " WHERE email = " . $db->quote($email));
        } else {
            $db->query("UPDATE " . $DATABASE . ".users\n\t\t\t              SET activation = '1', netid = NULL\n\t\t\t              WHERE email = " . $db->quote($email));
        }
        head();
        ?>
		<section class="content">
			<div class="container">
				<h1>Success!</h1>
				<p>You are now verified with the Experimental College! 
				Sign up for some classes!</p>
			</div>
		</section>
		<?php 
        tail();
    }
}
예제 #10
0
echo $lines == '100' ? 'selected' : '';
?>
>100</option>
		<option value="500" <?php 
echo $lines == '500' ? 'selected' : '';
?>
>500</option>
</select>
</form></p>
        </div>

        <div class="content">

<code><pre style="font-size:14px;font-family:monospace;color:black;white-space: inherit"><ol reversed>
<?php 
$output = tail($file, $lines);
$output = explode("\n", $output);
if (DISPLAY_REVERSE) {
    // Latest first
    $output = array_reverse($output);
}
foreach ($output as $out) {
    if (trim($out) != '') {
        echo '<li>' . htmlspecialchars($out) . '</li>';
    }
}
?>
</ol></pre>
	</code>
<footer>
<p> berndklaus.at Log-Parser </p>
예제 #11
0
파일: ArrayBench.php 프로젝트: equip/assist
 public function benchTail()
 {
     return tail($this->words());
 }
예제 #12
0
function loadchat($name)
{
    $file = CHATDIR . $name . '.log';
    if (!file_exists($file)) {
        file_put_contents($file, "");
    }
    // UTF-8 BOM Support
    $line = tail($file, 5);
    return nl2br($line);
}
예제 #13
0
<?php

/*
 * This file is part of the async generator runtime project.
 *
 * (c) Julien Bianchi <*****@*****.**>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */
require_once __DIR__ . '/../../vendor/autoload.php';
use function jubianchi\async\loop\{endless};
use function jubianchi\async\pipe\{make};
use function jubianchi\async\runtime\{await, all};
use function jubianchi\async\socket\{write};
use function jubianchi\async\stream\{tail};
$pipe = make();
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, 0, $argv[1]);
socket_set_nonblock($socket);
await(all(tail(fopen(__DIR__ . '/../data/first.log', 'r'), $pipe), tail(fopen(__DIR__ . '/../data/second.log', 'r'), $pipe), endless(function () use($socket, $pipe) {
    $data = (yield from $pipe->dequeue());
    yield from write($socket, $data);
})));
         $result_rows = sql_query("SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST" . $order_by);
         foreach ($result_rows as $row) {
             foreach ($row as $cell) {
                 if (stripos($cell, $filter) !== false) {
                     array_push($results, $row);
                     break;
                 }
             }
         }
     }
     // $actions = array("Kill" => "stuff"); /* for future implementation */
     $sorted = true;
     break;
 case "sqllogtransactions":
     if (isset($mysql_log_transactions) && isset($mysql_log_location) && file_exists($mysql_log_location) && is_readable($mysql_log_location)) {
         $data = tail($mysql_log_location, 1000);
         $lines = array();
         foreach (preg_split('/\\n/', $data) as $line) {
             $line = trim($line);
             if ($line == "") {
                 continue;
             }
             array_push($lines, $line);
         }
         for ($i = count($lines) - 1; $i >= 0; $i--) {
             if ($filter == "" || stripos($lines[$i], $filter) !== false) {
                 $entry = array("Tail" => count($lines) - $i, "Line" => $lines[$i]);
                 array_push($results, $entry);
             }
         }
     } else {
예제 #15
0
파일: forgot.php 프로젝트: BBKolton/EXCO
function resetCompletePage()
{
    session_start();
    session_destroy();
    //in case a user was logged in when they reset password
    head();
    ?>

		<section class="content">
			<div class="container">
				<h1>Password Reset!</h1>
				<p>Your password has been reset. Please 
				<a href="/asuwxpcl/users/login.php">login</a> to continue</p>
			</div>
		</section>

		<?php 
    tail();
}
예제 #16
0
echo "</tr>\n";
echo "</table>\n";
echo "<br /><br />\n\n";
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%'>\n";
echo "<b>Logs</b><br />\n";
//echo $v_log_dir.'/'.$v_name.".log<br /><br />\n";
echo "</td>\n";
echo "<td width='50%' align='right'>\n";
echo "  <input type='button' class='btn' value='download logs' onclick=\"document.location.href='v_status.php?a=download&t=logs';\" />\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n\n";
if (stristr(PHP_OS, 'WIN')) {
    //windows detected
    //echo "<b>tail -n 1500 ".$v_log_dir."/".$v_name.".log</b><br />\n";
    echo "<textarea id='log' name='log' style='width: 100%' rows='30' wrap='off'>\n";
    echo tail($v_log_dir . "/" . $v_name . ".log", 1500);
    echo "</textarea>\n";
} else {
    //windows not detected
    //echo "<b>tail -n 1500 ".$v_log_dir."/".$v_name.".log</b><br />\n";
    echo "<textarea id='log' name='log' style='width: 100%' rows='30' style='' wrap='off'>\n";
    echo system("tail -n 1500 " . $v_log_dir . "/" . $v_name . ".log");
    echo "</textarea>\n";
}
echo "<br /><br />\n\n";
echo "</td></tr></table>\n";
echo "</div>\n";
require_once "includes/footer.php";
예제 #17
0
function failed_password_check($errmesg, $authreqissuer)
{
    if (isset($authreqissuer)) {
        $return = "Location: " . $authreqissuer . '?error=' . urlencode($errmesg);
        header($return);
        /* Redirect browser */
    } else {
        header('HTTP/1.1 400 Bad Request');
        head("failed password authentication");
        print $errmesg . '<br/>';
        tail();
    }
    die;
}
예제 #18
0
    $mode_message_style = "altertnotice largerfont";
}
########
#################  Validate Input Files ##################
#####(note- these functions are also called earlier in this script, where status="Development" ######
######### Logfile display function call ##########
$logfile = "Pipeline_procedure";
# default id for jquery ui dialog element, 'Create' mode. Corresponds to logfile in path specified by xGDB_logfile.php
$logfile_path = "/xGDBvm/data/" . $DBid . "/logs/";
if ($Process_Type == "validate") {
    $logfile = "Validation";
    $logfile_path = "/xGDBvm/data/scratch/";
}
## Read last 3 lines of logfile in "Locked" mode only:
if ($Status == 'Locked') {
    $tail_logfile = tail($DBid, $logfile, $logfile_path);
    $tail_line1 = $tail_logfile[0];
    $tail_line2 = $tail_logfile[1];
}
$tail_display = $Status == 'Locked' ? "display_on" : "display_off";
######### hide Update parameters unless GDB is Current ########
$conditional_display = $Status == "Current" || $Update_Status == "Update" ? "" : "hidden";
######### In Current or Locked Config, hide GSQ, GTH Remote Job ID display text unless 'Remote' chosen ########
$conditional_gsq = $GSQ_CompResources == "Remote" && $Status != 'Development' ? "" : "display_off";
$conditional_gth = $GTH_CompResources == "Remote" && $Status != 'Development' ? "" : "display_off";
$conditional_dev = $Status == "Development" || $Update_Status == "Yes" ? "" : "display_off";
###### Directory Dropdowns and Mounted Volume Flags #######
# data directory:/data/ ($dir1)
$dir1_dropdown = "{$dataDir}";
// 1-26-16
if (file_exists("/xGDBvm/admin/iplant")) {
예제 #19
0
function displayConfirmation($db, $amount, $invoice)
{
    head();
    ?>

	<section class="content">
		<div class="container">
			<h1>Order Successful!</h1>
			<p>Thank you for taking classes with the Experimental College!
				You should receive an email shortly detailing the classes you applied for.
				Your order information is below.</p>
			<table>

				<?php 
    if ($_POST['type'] == 'credit') {
        ?>
 
					<tr>
						<td>Card Ending in: </td> 
						<td><?php 
        echo substr($_POST['card'], 12);
        ?>
</td>
					</tr>
					<tr>
						<td>Amount: </td>
						<td>$<?php 
        echo $amount;
        ?>
</td>
					</tr>
					<tr>
						<td>Invoice: </td>
						<td><?php 
        echo $invoice;
        ?>
</td>
					</tr>
				<?php 
    }
    ?>

				<tr>
					<td>Classes: </td>
					<td></td>
				</tr>

				<?php 
    for ($j = 0; $j < count($_SESSION["cart"]); $j += 2) {
        $course = $db->select("SELECT name FROM courses \n\t\t\t\t\t                       WHERE id = " . $db->quote($_SESSION["cart"][$j]))[0];
        ?>
					<tr>
						<td></td>
						<td><?php 
        echo $course["name"];
        ?>
</td>
					</tr>
				<?php 
    }
    ?>

			</table>
			<p>Head over to <a href="mycourses.php">my courses</a> at any time to view your
				currently enrolled sections</p>
		</div>
	</section>

	<?php 
    tail();
}
예제 #20
0
function draw_stats()
{
    global $maxlines, $alog, $elog;
    # start timer
    $starttime = microtime(true);
    $out = "";
    # read query string (and display)
    if ($_GET && $_GET['module']) {
        $module = $_GET['module'];
        $out .= "<p>Usage Stats\n";
        $dispmod = preg_replace("/\\/modules\\//", "", $module);
    } else {
        # i don't understand why i wrote this bit:
        if (file_exists("../modules")) {
            $module = "/modules";
        } else {
            $module = "/";
        }
        $out .= "<p>Usage Stats\n";
        $dispmod = "";
    }
    $modmatch = preg_quote($module, "/");
    # our log file is overrun with stuff like battery check
    # requests -- we filter that here and create a temporary
    # log file instead...
    $tmpfile = "/media/RACHEL/filteredlog";
    $lagtime = 60;
    # seconds to refresh the filtered log
    if (!file_exists($tmpfile) || filemtime($tmpfile) < time() - $lagtime) {
        exec("grep -v 'GET /admin' {$alog} > {$tmpfile}");
    }
    # read in the log file
    $content = tail($tmpfile, $maxlines);
    # and process
    $nestcount = 0;
    $not_counted = 0;
    $total_pages = 0;
    while (1) {
        ++$nestcount;
        $count = 0;
        $errors = 0;
        # array();
        $stats = array();
        $start = "";
        foreach (preg_split("/((\r?\n)|(\r\n?))/", $content) as $line) {
            # line count and limiting
            # XXX is this needed if we're using tail()?
            if ($maxlines && $count >= $maxlines) {
                break;
            }
            ++$count;
            # we display the date range - [29/Mar/2015:06:25:15 -0700]
            preg_match("/\\[(.+?) .+?\\]/", $line, $date);
            if ($date) {
                if (!$start) {
                    $start = $date[1];
                }
                $end = $date[1];
            }
            # count errors
            preg_match("/\"GET.+?\" (\\d\\d\\d) /", $line, $matches);
            if ($matches && $matches[1] >= 400) {
                ++$errors;
                #inc($errors, $matches[1]);
            }
            # count pages only (not images and support files)
            preg_match("/GET (.+?(\\/|\\.html?|\\.pdf|\\.php)) /", $line, $matches);
            if ($matches) {
                $url = $matches[1];
                # cout the subpages
                preg_match("/{$modmatch}\\/([^\\/]+)/", $url, $sub);
                if ($sub) {
                    inc($stats, $sub[1]);
                    ++$total_pages;
                } else {
                    if (preg_match("/{$modmatch}\\/\$/", $url)) {
                        # if there was a hit with this directory as the
                        # trailing component, there was probably a page there
                        # so we count that too
                        inc($stats, "./");
                        ++$total_pages;
                    } else {
                        ++$not_counted;
                    }
                }
            } else {
                ++$not_counted;
            }
        }
        # auto-descend into directories if there's only one item
        # XXX basically we redo the above over, one dir deeper each time,
        # until we reach a break condition (multiple choices, single page, or too deep,
        # which is pretty darn inefficient
        if (sizeof($stats) == 1) {
            # PHP 5.3 compat - can't index off a function, need a temp var
            $keys = array_keys($stats);
            # but not if the one thing is an html file
            if (preg_match("/(\\/|\\.html?|\\.pdf|\\.php)\$/", $keys[0])) {
                break;
            }
            # and not if it's too deep
            if ($nestcount > 5) {
                $out .= "<h1>ERROR descending nested directories</h1>\n";
                break;
            }
            $module .= "/" . $keys[0];
            $modmatch = preg_quote($module, "/");
            $dispmod = preg_replace("/\\/modules\\//", "", $module);
            $dispmod = preg_replace("/\\/+/", "/", $dispmod);
        } else {
            break;
        }
    }
    # date & time formatting (we used to show time, but now we don't)
    $start = preg_replace("/\\:.+/", " ", $start, 1);
    $end = preg_replace("/\\:.+/", " ", $end, 1);
    #$start = preg_replace("/\:/", " ", $start, 1);
    #$end   = preg_replace("/\:/", " ", $end, 1);
    #$start = preg_replace("/\:\d\d$/", "", $start, 1);
    #$end   = preg_replace("/\:\d\d$/", "", $end, 1);
    $start = preg_replace("/\\//", " ", $start);
    $end = preg_replace("/\\//", " ", $end);
    $out .= "<b>{$start}</b> through <b>{$end}</b></p>\n";
    # tell the user the path they're in
    if ($dispmod) {
        $out .= "<h3 style='margin-bottom: 0;'>Looking In: {$dispmod}</h3>\n";
        $out .= "<a href='stats.php' style='font-size: small;'>&larr; back to all modules</a>";
    } else {
        $out .= "<h3 style='margin-bottom: 0;'>Looking At: all modules</h3>\n";
    }
    # stats display
    arsort($stats);
    $out .= "<table class=\"stats\">\n";
    $out .= "<tr><th>Hits</th><th>Content</th></tr>\n";
    foreach ($stats as $mod => $hits) {
        # html pages are links to the content
        if (preg_match("/(\\/|\\.html?|\\.pdf|\\.php)\$/", $mod)) {
            $url = "{$module}/{$mod}";
            $out .= "<tr><td>{$hits}</td><td>{$mod} ";
            $out .= "<small>(<a href=\"{$url}\" target=\"_blank\">view</a>)</small></td></tr>\n";
            # directories link to a drill-down
        } else {
            $url = "stats.php?module=" . urlencode("{$module}/{$mod}");
            $out .= "<tr><td>{$hits}</td>";
            $out .= "<td><a href=\"{$url}\">{$mod}</a></td></tr>\n";
        }
    }
    $out .= "</table>\n";
    # timer readout
    $time = microtime(true) - $starttime;
    $out .= sprintf("<p><b>{$count} lines analyzed in %.2f seconds.</b><br>\n", $time);
    $out .= "\n        <span style='font-size: small;'>\n        {$total_pages} content pages seen<br>\n        {$not_counted} items not counted (images, css, js, admin, etc)<br>\n        <!-- {$errors} errors -->\n        Stats are updated each minute, and do not include ka-lite or wiki items.\n        </span></p>\n    ";
    # download log links
    $out .= '
        <ul>
        <li><a href="stats.php?dl_alog=1">Download Raw Access Log</a>
        <li><a href="stats.php?dl_elog=1">Download Raw Error Log</a>
        </ul>
    ';
    # allow clearing logs on the plus
    if (is_rachelplus()) {
        $out .= '
            <script>
                function clearLogs() {
                    if (!confirm("Are you sure you want to clear the logs?")) {
                        return false;
                    }
                    $.ajax({
                        url: "background.php?clearLogs=1",
                        success: function() {
                            $("#clearbut").css("color", "green");
                            $("#clearbut").html("&#10004; Logs Cleared");
                        },
                        error: function() {
                            $("#clearbut").css("color", "#c00");
                            $("#clearbut").html("X Internal Error");
                        }
                    });
                }
            </script>
            <button type="button" id="clearbut" onclick="clearLogs();">Clear Logs</button>
        ';
    }
    return $out;
}
예제 #21
0
/**
 * Returns `true` if the two elements have the same type and are deeply equivalent.
 * ```php
 * $a = (object) ['a' => 1, 'b' => (object) ['c' => 'Hello'], 'd' => false];
 * $b = (object) ['a' => 1, 'b' => (object) ['c' => 'Hi'], 'd' => false];
 * $c = (object) ['a' => 1, 'b' => ['c' => 'Hello'], 'd' => false];
 * equals(5, '5'); // false (should have the same type)
 * equals([1, 2, 3], [1, 2, 3]); // true
 * equals([1, 3, 2], [1, 2, 3]); // false (should have the same order)
 * equals($a, $b); // false
 * equals($a, $c); // false
 * $b->b->c = 'Hello';
 * equals($a, $b); // true
 * ```
 *
 * @signature * -> * -> Boolean
 * @param  mixed $a
 * @param  mixed $b
 * @return bool
 */
function equals()
{
    $equals = function ($a, $b) {
        $type = type($a);
        if ($type != type($b)) {
            return false;
        }
        switch ($type) {
            case 'Null':
            case 'Boolean':
            case 'String':
            case 'Number':
            case 'Unknown':
            case 'Function':
            case 'Resource':
            case 'Error':
            case 'Stream':
                return $a == $b;
            case 'List':
                $length = length($a);
                return length($b) != $length ? false : 0 == $length ? true : equals(head($a), head($b)) && equals(tail($a), tail($b));
            case 'Array':
            case 'ArrayObject':
            case 'Object':
                return equals(keys($a), keys($b)) && equals(values($a), values($b));
        }
    };
    return apply(curry($equals), func_get_args());
}
예제 #22
0
        $db->query($req_eq_inser);
        //System_Daemon::notice("OK");
    }
    //System_Daemon::info("GroupAddr : ".$grpaddr." | hexa : ".$hexa." - value :".$sniffed[$grpaddr]['value'] );
}
//on ecrit les données dans le fichier json trace
System_Daemon::info("Initialisation du fichier knxtrace.json");
makeJsonTrace($sniffed);
/*
Mise a jour du ficheir knxtrace.json a chaque modification d'un equipement suivi
*/
System_Daemon::info("Mise a jour du fichier knxtrace.json a chaque modification d'un equipement suivi et sauvegarde en base s'il doit etre historisé");
//$lastpos = 0;
while (true) {
    // On tail le fichier de log
    $knxlisten = tail(PATH_LOG, $lastpos);
    // On r�agit d�s qu'on a un Write
    // Pour chaque ligne, on r�cup�re le Groupe d'Addresse et de la valeur qu'on converti
    $groupaddr = get_string_between($knxlisten, 'group addr: ', ' -');
    $hexa = get_string_between($knxlisten, 'Hexa: ', ' -');
    //on met a jour le valeur dans le tableau et on regenere le fichier json
    //recursive_array_search
    if (array_key_exists($groupaddr, $sniffed)) {
        $decimal = hexdec($hexa);
        $value = dptSelectDecode($sniffed[$groupaddr]['dpt'], $decimal);
        //ecriture en base si changement d'etat et bas simplement l'equipement qui redis la meme chose sur le bus
        //System_Daemon::notice("Old Value -> ".$groupaddr.":: ".$oldSniffedValue[$groupaddr]);
        //System_Daemon::notice("New Value -> ".$groupaddr.":: ".$value);
        if ($oldSniffedValue[$groupaddr] != $value) {
            //System_Daemon::notice("MAJ");
            $sniffed[$groupaddr]['value'] = $value;
예제 #23
0
파일: common.php 프로젝트: BBKolton/EXCO
function error($type = "Unknown", $message = "Please contact an administrator")
{
    head();
    ?>
		
		<section class="content">
			<div class="container">
				<h1><?php 
    echo $type;
    ?>
</h1>
				<p><?php 
    echo $message;
    ?>
</p>
				<img style="" src="/asuwxpcl/.assets/img/errorzebra.png" alt="error zebra" />
			</div>
		</section>

		<?php 
    tail();
    die;
}
예제 #24
0
파일: login.php 프로젝트: BBKolton/EXCO
function page($error = '', $message = '')
{
    head('<link href="/asuwxpcl/.assets/css/login.css" rel="stylesheet" />');
    ?>

		<section class="content">
			<div class="container">
				<div class='row'>
					<div class='col-xs-12 col-md-6'>
						<?php 
    if ($error == '') {
        ?>
 
							<h1>A New Site!</h1>
							<p>The Experimental College has gotten a facelift! With it, we've archived and cleaned our user database. 
							If you had an account on our old site and have not made one here yet, <b>you will need to create a new 
							account to the right</b></p>
						<?php 
    } else {
        ?>
 
							<div class='error'>
								<h1><?php 
        echo $error;
        ?>
</h1>
								<p><?php 
        echo $message;
        ?>
</p>
							</div>
						<?php 
    }
    ?>
						<form action="/asuwxpcl/users/login.php" method="post">
							<h3>Login</h3>
							<input class='form-control' type="text" name="email" autofocus placeholder="Email" /><br />
							<input class='form-control' type="password" placeholder='Password' name="password" /><br />
							<p>
								<input type="submit" value="login" class='btn btn-info' />
								<a href="/asuwxpcl/users/forgot.php">Forgot Password?</a>
							</p>
						</form>
					</div>
					<div class='col-xs-12 col-md-6'>
						<form action="/asuwxpcl/users/registeruser.php" method="post">
							<h3>Register New User</h3>
							<p><i><b>NOTICE:</b> If you are a member of the University of Washington and
								have a valid NetID email address, use it here to receive student
								pricing.</i></p>
							<input class='form-control' type="text" name="email" placeholder="Email" /><br />
							<div class='form-group'>
								<input class='form-control' type="password" name="password" placeholder="Password"/> Must be longer than 8 characters<br />
							</div>
							<input class='form-control' type="password" name="password2" placeholder="Verify Password"/><br />
							<input class='form-control' type="text" name="first-name" placeholder="First Name" /><br />
							<input class='form-control' type="text" name="last-name" placeholder="Last Name" /><br />
							<input class='form-control' type="text" name="phone" placeholder="Phone Number" /><br />
							<input class='form-control' type='text' name="zip" placeholder="Zip code" /><br />
							<label><input type="checkbox" name="mailing" value="true" checked />Sign me up for newsletters</label><br />
							<input type="submit" value="register" class="btn btn-success"/>
						</form>
					</div>
				</div>
			</div>
		</section>

		<?php 
    tail();
}
예제 #25
0
파일: list.php 프로젝트: tarsana/functional
/**
 * Takes elements from an array while they match the given predicate. It stops at the
 * first element not matching the predicate and does not include it in the result.
 * ```php
 * $items = ['Foo', 'Fun', 'Dev', 'Bar', 'Baz'];
 * takeWhile(startsWith('F'), $items) // ['Foo', 'Fun']
 * takeWhile(startsWith('D'), $items) // []
 * ```
 *
 * @signature (a -> Boolean) -> [a] -> [a]
 * @param  callable $predicate
 * @param  array $list
 * @return array
 */
function takeWhile()
{
    $takeWhile = function ($predicate, $list) {
        $first = head($list);
        return null == $first || !$predicate($first) ? [] : prepend($first, takeWhile($predicate, tail($list)));
    };
    return apply(curry($takeWhile), func_get_args());
}
예제 #26
0
파일: index.php 프로젝트: BBKolton/EXCO
							</a>
						</li>

						<li role='presentation'>
							<a href='galleys.php'>
								<span class='glyphicon glyphicon-tasks'></span> Galleys
							</a>
						</li>

					</ul>
				</div>
				<p>Welcome to the instructor portal! All of the important administrative tasks you may need to take for new courses, galleys, and returning instructor forms are available here. If you're looking for a way to access your class rosters, please use the drop down menu at the top right and select "my courses"</p>
				<p><a href='/asuwxpcl/.assets/docs/spotRegistrationForm.doc'>On the spot registration form</a></p>
			</div>
			<div class='col-md-4'>
				<div class='dates'>
					<h2>News &amp; Alerts</h2>
					<h3>Important Deadlines</h3>
					<p>Instructors, for all important dates and deadlines, please check <a href='dates.php'> here</a>.</p>
					<h3>RIFs Now Open</h3>
					<p>Please submit your rifs for the coming quarter now!</p>
				</div>
			</div>
		</div>
	</div>
</section>


<?php 
tail();
예제 #27
0
 /**
  * Calls a method of the contained object and returns a stream
  * with same object ignoring the result of the method.
  * ```php
  * class ForStreamTest {
  *    protected $value;
  *    public function init($value) {$this->value = $value;}
  *    public function add($value) {$this->value += $value;}
  *    public function addTwo($a, $b) {$this->value += $a + $b;}
  *    public function mult($value) { $this->value *= $value;}
  *    public function value() {return $this->value;}
  *    protected function reset() {$this->value = 0;}
  *    private function clear() {$this->value = null;}
  * }
  *
  * Stream::of(new ForStreamTest)
  *     ->run('init', 5)
  *     ->run('add', 1)
  *     ->run('addTwo', 1, 1)
  *     ->run('mult', 2)
  *     ->run('value')
  *     ->get(); // 16
  *
  * Stream::of(new ForStreamTest)
  *     ->run('reset')
  *     ->get(); // [Error: Method 'reset' of [Object] is not accessible]
  *
  * Stream::of(new ForStreamTest)
  *     ->run('clear')
  *     ->get(); // [Error: Method 'clear' of [Object] is not accessible]
  *
  * Stream::of(new ForStreamTest)
  *     ->run('missing')
  *     ->get(); // [Error: Method 'missing' of [Object] is not found]
  * ```
  *
  * @signature Stream(a) -> (String, ...) -> Stream(a)
  * @param  string $method
  * @param  mixed|null $args...
  * @return Stream
  */
 public function run($method)
 {
     $args = tail(func_get_args());
     return Stream::apply('apply', function ($data) use($method, $args) {
         if (is_callable([$data, $method])) {
             call_user_func_array([$data, $method], $args);
             return $data;
         }
         $text = toString($data);
         if (method_exists($data, $method)) {
             return Error::of("Method '{$method}' of {$text} is not accessible");
         }
         return Error::of("Method '{$method}' of {$text} is not found");
     }, $this);
 }