Example #1
0
function init()
{
    $ips = \avs\IPs::get();
    // ip1, ip2, ip3, ...
    // ip1 -> ip2
    // ip2 -> ip3
    // ip3 -> ip1
    // do we have enough
    // attention: $ips contains our local IP
    if (count($ips) > 1) {
        for ($index = 0, $count = count($ips); $index < $count - 1; $index++) {
            $ip = $ips[$index];
            $neighborIp = $ips[$index + 1];
            // sende 0->1, 1->2, 2-3, 3-4 etc
            inform($ip, $neighborIp);
        }
        // 1st  / last
        $count = count($ips);
        $myIp = $ips[0];
        $lastIp = $ips[$count - 1];
        // sende last->0
        inform($lastIp, $myIp);
    } else {
        echo "too less known IPs";
    }
}
Example #2
0
} else {
    switch (@$_GET['action']) {
        case 'usercomment':
            ech();
            if (isset($_GET['rid'])) {
                $rid = $_GET['rid'];
            } else {
                $rid = $_POST['RID'];
            }
            $actData = new Request5($rid);
            if (strlen($actData->comment[0]) > 0) {
                $actData->comment[0] .= "\n";
            }
            $actData->comment[0] .= date('d-m-y H:i', time()) . ' ' . $ses->login() . ' ' . $_POST['TEXT'];
            $actData->update();
            inform($actData, $ses->login(), REQ_USERREM);
            break;
        case 'donereq':
        case 'myreq':
        case 'allreq':
        case 'fulltext':
            $ses->dispose('filter.myreq');
            $ses->dispose('filter.allreq');
            $ses->dispose('filter.donereq');
            $ses->dispose('filter.user');
            $ses->dispose('filter.fulltext');
            switch ($_GET['action']) {
                case 'donereq':
                    $ses->valueOf('filter.donereq', true);
                    break;
                case 'myreq':
Example #3
0
 function actUpon(&$o)
 {
     switch ($this->GetAction()) {
         case GM_DELETE:
             break;
             // do nothing, as the action is to NOT PRINT
         // do nothing, as the action is to NOT PRINT
         case GM_MOD:
             $opts = gm_getTaggedOpt($this->ActionTarget, $o);
             if ($opts === FALSE && !in_array($this->ActionMod, array("+=", "-="))) {
                 inform("Couldn't perform " . $this->ActionTarget . $this->ActionMod . $this->ActionValue . " in " . $o->ReconstructClipText() . "\n");
                 break;
             }
             if ($opts == FALSE) {
                 // but we make an exception for += and -=, since 0 is often a default value for these
                 $opts = 0;
             }
             switch ($this->ActionMod) {
                 case "+=":
                     $opts += $this->ActionValue;
                     break;
                 case "-=":
                     $opts -= $this->ActionValue;
                     break;
                 case "*=":
                     $opts *= $this->ActionValue;
                     break;
                 case "/=":
                     $opts /= $this->ActionValue;
                     break;
             }
             $opts = (string) round($opts);
             // convert numbers back to string for correct interpretation by ReconstructClipText
             gm_setTaggedOpt($this->ActionTarget, $o, $opts);
             break;
         case GM_SET:
             gm_setTaggedOpt($this->ActionTarget, $o, $this->ActionValue);
             break;
     }
 }