Beispiel #1
0
 /** 
  * Test deactivation routine.
  */
 public function test_deactivate()
 {
     // Setup
     // Act
     deactivate();
     // Verify
 }
Beispiel #2
0
$res = DatabaseManager::Query($select);
if ($res->RowCount() > 1) {
    $res = $res->Result();
    foreach ($res as $value) {
        //if not admin or super
        if ($value["pLevel"] != UserLevel::Admin && $value["pLevel"] != UserLevel::Super && $value["activated"] != -1) {
            //check if user in not activated
            if (lateActivation($value)) {
                remove($value["id"]);
            } else {
                if (lateForms($value)) {
                    //				echo "late with forms <br>";
                    deactivate($value["id"]);
                } else {
                    if (lateAssessment($value)) {
                        deactivate($value["id"]);
                    } else {
                        if (needAssessmentReminder($curr)) {
                            remind($curr);
                        }
                    }
                }
            }
            //store disabled users
            if ($value["activated"] == -1) {
                store($value["id"], $value["email"]);
                remove($value["id"]);
            }
        }
    }
}
Beispiel #3
0
$user_msg = '';
$_SESSION['not'] = '';
$msg = '';
$phone = $_REQUEST['sender'];
$users_phone = removePlus($phone);
if (@$_REQUEST['msgdata']) {
    $user_msg = trim(urldecode($_REQUEST['msgdata']));
    //echo $user_msg;
    $tokens = explode(" ", $user_msg);
    if (strtoupper(trim($tokens[0])) == 'STOP') {
        //echo trim($tokens[0]); exit;
        $service = '';
        for ($i = 1; $i <= count($tokens); $i++) {
            @($service .= $tokens[$i] . " ");
        }
        deactivate($phone, trim($service));
    }
}
$data = R::find('users', ' mobile_number = :phone', array('phone' => $users_phone));
@($category = R::find('category', 1));
#check if its a new user
if ($data) {
    $cat_id = findCategory($user_msg);
    $msg = $_SESSION['not'];
    #not a new user
    if ($cat_id) {
        $sub_data = R::findOne('subscription', ' user_phone = :phone and category_id = :cat', array('phone' => $phone, 'cat' => $cat_id));
        if ($sub_data) {
            #User subscribed for a category
            if ($cat_id) {
                #If the category is listed
Beispiel #4
0
function allTests($communicator)
{
    global $NS;

    $random = $NS ? constant("Ice\\EndpointSelectionType::Random") : constant("Ice_EndpointSelectionType::Random");
    $ordered = $NS ? constant("Ice\\EndpointSelectionType::Ordered") : constant("Ice_EndpointSelectionType::Ordered");

    $ref = "communicator:default -p 12010";
    $com = $communicator->stringToProxy($ref)->ice_uncheckedCast("::Test::RemoteCommunicator");

    echo "testing binding with single endpoint... ";
    flush();
    {
        $adapter = $com->createObjectAdapter("Adapter", "default");

        $test1 = $adapter->getTestIntf();
        $test2 = $adapter->getTestIntf();
        test($test1->ice_getConnection() == $test2->ice_getConnection());

        $test1->ice_ping();
        $test2->ice_ping();

        $com->deactivateObjectAdapter($adapter);

        $test3 = $test1->ice_uncheckedCast("::Test::TestIntf");
        test($test3->ice_getConnection() == $test1->ice_getConnection());
        test($test3->ice_getConnection() == $test2->ice_getConnection());

        try
        {
            $test3->ice_ping();
            test(false);
        }
        catch(Exception $ex)
        {
            $cre = $NS ? "Ice\\ConnectionRefusedException" : "Ice_ConnectionRefusedException";
            if(!($ex instanceof $cre))
            {
                throw $ex;
            }
        }
    }
    echo "ok" . "\n";

    echo "testing binding with multiple endpoints... ";
    flush();
    {
        $adapters = array();
        $adapters[] = $com->createObjectAdapter("Adapter11", "default");
        $adapters[] = $com->createObjectAdapter("Adapter12", "default");
        $adapters[] = $com->createObjectAdapter("Adapter13", "default");

        //
        // Ensure that when a connection is opened it's reused for new
        // proxies and that all endpoints are eventually tried.
        //
        $names = array("Adapter11", "Adapter12", "Adapter13");
        while(count($names) > 0)
        {
            $adpts = $adapters;

            $test1 = createTestIntfPrx($adpts);
            shuffle($adpts);
            $test2 = createTestIntfPrx($adpts);
            shuffle($adpts);
            $test3 = createTestIntfPrx($adpts);

            test($test1->ice_getConnection() == $test2->ice_getConnection());
            test($test2->ice_getConnection() == $test3->ice_getConnection());

            $key = array_search($test1->getAdapterName(), $names);
            if($key !== false)
            {
                unset($names[$key]);
            }
            $test1->ice_getConnection()->close(false);
        }

        //
        // Ensure that the proxy correctly caches the connection (we
        // always send the request over the same connection.)
        //
        {
            foreach($adapters as $p)
            {
                $p->getTestIntf()->ice_ping();
            }

            $test = createTestIntfPrx($adapters);
            $name = $test->getAdapterName();
            $nRetry = 10;
            for($i = 0; $i < $nRetry && $test->getAdapterName() == $name; $i++);
            test($i == $nRetry);

            foreach($adapters as $p)
            {
                $p->getTestIntf()->ice_getConnection()->close(false);
            }
        }

        //
        // Deactivate an adapter and ensure that we can still
        // establish the connection to the remaining adapters.
        //
        $com->deactivateObjectAdapter($adapters[0]);
        $names = array("Adapter12", "Adapter13");
        while(count($names) > 0)
        {
            $adpts = $adapters;

            $test1 = createTestIntfPrx($adpts);
            shuffle($adpts);
            $test2 = createTestIntfPrx($adpts);
            shuffle($adpts);
            $test3 = createTestIntfPrx($adpts);

            test($test1->ice_getConnection() == $test2->ice_getConnection());
            test($test2->ice_getConnection() == $test3->ice_getConnection());

            $key = array_search($test1->getAdapterName(), $names);
            if($key !== false)
            {
                unset($names[$key]);
            }
            $test1->ice_getConnection()->close(false);
        }

        //
        // Deactivate an adapter and ensure that we can still
        // establish the connection to the remaining adapter.
        //
        $com->deactivateObjectAdapter($adapters[2]);
        $test = createTestIntfPrx($adapters);
        test($test->getAdapterName() == "Adapter12");   

        deactivate($com, $adapters);
    }
    echo "ok" . "\n";

    echo "testing random endpoint selection... ";
    flush();
    {
        $adapters = array();
        $adapters[] = $com->createObjectAdapter("Adapter21", "default");
        $adapters[] = $com->createObjectAdapter("Adapter22", "default");
        $adapters[] = $com->createObjectAdapter("Adapter23", "default");

        $test = createTestIntfPrx($adapters);
        test($test->ice_getEndpointSelection() == $random);

        $names = array("Adapter21", "Adapter22", "Adapter23");
        while(count($names) > 0)
        {
            $key = array_search($test->getAdapterName(), $names);
            if($key !== false)
            {
                unset($names[$key]);
            }
            $test->ice_getConnection()->close(false);
        }

        $test = $test->ice_endpointSelection($random)->ice_uncheckedCast("::Test::TestIntf");
        test($test->ice_getEndpointSelection() == $random);

        $names = array("Adapter21", "Adapter22", "Adapter23");
        while(count($names) > 0)
        {
            $key = array_search($test->getAdapterName(), $names);
            if($key !== false)
            {
                unset($names[$key]);
            }
            $test->ice_getConnection()->close(false);
        }

        deactivate($com, $adapters);
    }
    echo "ok" . "\n";

    echo "testing ordered endpoint selection... ";
    flush();
    {
        $adapters = array();
        $adapters[] = $com->createObjectAdapter("Adapter31", "default");
        $adapters[] = $com->createObjectAdapter("Adapter32", "default");
        $adapters[] = $com->createObjectAdapter("Adapter33", "default");

        $test = createTestIntfPrx($adapters);
        $test = $test->ice_endpointSelection($ordered)->ice_uncheckedCast("::Test::TestIntf");
        test($test->ice_getEndpointSelection() == $ordered);
        $nRetry = 5;

        //
        // Ensure that endpoints are tried in order by deactiving the adapters
        // one after the other.
        //
        for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter31"; $i++);
        test($i == $nRetry);
        $com->deactivateObjectAdapter($adapters[0]);
        for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter32"; $i++);
        test($i == $nRetry);
        $com->deactivateObjectAdapter($adapters[1]);
        for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter33"; $i++);
        test($i == $nRetry);
        $com->deactivateObjectAdapter($adapters[2]);

        try
        {
            $test->getAdapterName();
        }
        catch(Exception $ex)
        {
            $cre = $NS ? "Ice\\ConnectionRefusedException" : "Ice_ConnectionRefusedException";
            if(!($ex instanceof $cre))
            {
                throw $ex;
            }
        }

        $endpoints = $test->ice_getEndpoints();

        $adapters = array();

        //
        // Now, re-activate the adapters with the same endpoints in the opposite
        // order.
        // 
        $adapters[] = $com->createObjectAdapter("Adapter36", $endpoints[2]->toString());
        for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter36"; $i++);
        test($i == $nRetry);
        $test->ice_getConnection()->close(false);
        $adapters[] = $com->createObjectAdapter("Adapter35", $endpoints[1]->toString());
        for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter35"; $i++);
        test($i == $nRetry);
        $test->ice_getConnection()->close(false);
        $adapters[] = $com->createObjectAdapter("Adapter34", $endpoints[0]->toString());
        for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter34"; $i++);
        test($i == $nRetry);

        deactivate($com, $adapters);
    }
    echo "ok" . "\n";

    echo "testing per request binding with single endpoint... ";
    flush();
    {
        $adapter = $com->createObjectAdapter("Adapter41", "default");

        $test1 = $adapter->getTestIntf()->ice_connectionCached(false)->ice_uncheckedCast("::Test::TestIntf");
        $test2 = $adapter->getTestIntf()->ice_connectionCached(false)->ice_uncheckedCast("::Test::TestIntf");
        test(!$test1->ice_isConnectionCached());
        test(!$test2->ice_isConnectionCached());
        test($test1->ice_getConnection() == $test2->ice_getConnection());

        $test1->ice_ping();

        $com->deactivateObjectAdapter($adapter);

        $test3 = $test1->ice_uncheckedCast("::Test::TestIntf");
        try
        {
            test($test3->ice_getConnection() == $test1->ice_getConnection());
            test(false);
        }
        catch(Exception $ex)
        {
            $cre = $NS ? "Ice\\ConnectionRefusedException" : "Ice_ConnectionRefusedException";
            if(!($ex instanceof $cre))
            {
                throw $ex;
            }
        }
    }
    echo "ok" . "\n";

    echo "testing per request binding with multiple endpoints... ";
    flush();
    {
        $adapters = array();
        $adapters[] = $com->createObjectAdapter("Adapter51", "default");
        $adapters[] = $com->createObjectAdapter("Adapter52", "default");
        $adapters[] = $com->createObjectAdapter("Adapter53", "default");

        $test = createTestIntfPrx($adapters)->ice_connectionCached(false)->ice_uncheckedCast("::Test::TestIntf");
        test(!$test->ice_isConnectionCached());

        $names = array("Adapter51", "Adapter52", "Adapter53");
        while(count($names) > 0)
        {
            $key = array_search($test->getAdapterName(), $names);
            if($key !== false)
            {
                unset($names[$key]);
            }
        }

        $com->deactivateObjectAdapter($adapters[0]);

        $names = array("Adapter52", "Adapter53");
        while(count($names) > 0)
        {
            $key = array_search($test->getAdapterName(), $names);
            if($key !== false)
            {
                unset($names[$key]);
            }
        }

        $com->deactivateObjectAdapter($adapters[2]);

        test($test->getAdapterName() == "Adapter52");

        deactivate($com, $adapters);
    }
    echo "ok" . "\n";

    echo "testing per request binding and ordered endpoint selection... ";
    flush();
    {
        $adapters = array();
        $adapters[] = $com->createObjectAdapter("Adapter61", "default");
        $adapters[] = $com->createObjectAdapter("Adapter62", "default");
        $adapters[] = $com->createObjectAdapter("Adapter63", "default");

        $test = createTestIntfPrx($adapters);
        $test = $test->ice_endpointSelection($ordered)->ice_uncheckedCast("::Test::TestIntf");
        test($test->ice_getEndpointSelection() == $ordered);
        $test = $test->ice_connectionCached(false)->ice_uncheckedCast("::Test::TestIntf");
        test(!$test->ice_isConnectionCached());
        $nRetry = 5;

        //
        // Ensure that endpoints are tried in order by deactiving the adapters
        // one after the other.
        //
        for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter61"; $i++);
        test($i == $nRetry);
        $com->deactivateObjectAdapter($adapters[0]);
        for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter62"; $i++);
        test($i == $nRetry);
        $com->deactivateObjectAdapter($adapters[1]);
        for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter63"; $i++);
        test($i == $nRetry);
        $com->deactivateObjectAdapter($adapters[2]);

        try
        {
            $test->getAdapterName();
        }
        catch(Exception $ex)
        {
            $cre = $NS ? "Ice\\ConnectionRefusedException" : "Ice_ConnectionRefusedException";
            if(!($ex instanceof $cre))
            {
                throw $ex;
            }
        }

        $endpoints = $test->ice_getEndpoints();

        $adapters = array();

        //
        // Now, re-activate the adapters with the same endpoints in the opposite
        // order.
        // 
        $adapters[] = $com->createObjectAdapter("Adapter66", $endpoints[2]->toString());
        for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter66"; $i++);
        test($i == $nRetry);
        $adapters[] = $com->createObjectAdapter("Adapter65", $endpoints[1]->toString());
        for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter65"; $i++);
        test($i == $nRetry);
        $adapters[] = $com->createObjectAdapter("Adapter64", $endpoints[0]->toString());
        for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter64"; $i++);
        test($i == $nRetry);

        deactivate($com, $adapters);
    }
    echo "ok" . "\n";

    echo "testing endpoint mode filtering... ";
    flush();
    {
        $adapters = array();
        $adapters[] = $com->createObjectAdapter("Adapter71", "default");
        $adapters[] = $com->createObjectAdapter("Adapter72", "udp");

        $test = createTestIntfPrx($adapters);
        test($test->getAdapterName() == "Adapter71");

        $testUDP = $test->ice_datagram()->ice_uncheckedCast("::Test::TestIntf");
        test($test->ice_getConnection() != $testUDP->ice_getConnection());
        try
        {
            $testUDP->getAdapterName();
        }
        catch(Exception $ex)
        {
            $cre = $NS ? "Ice\\TwowayOnlyException" : "Ice_TwowayOnlyException";
            if(!($ex instanceof $cre))
            {
                throw $ex;
            }
        }
    }
    echo "ok" . "\n";

    if(strlen($communicator->getProperties()->getProperty("Ice.Plugin.IceSSL")) > 0)
    {
        echo "testing unsecure vs. secure endpoints... ";
        flush();
        {
            $adapters = array();
            $adapters[] = $com->createObjectAdapter("Adapter81", "ssl");
            $adapters[] = $com->createObjectAdapter("Adapter82", "tcp");

            $test = createTestIntfPrx($adapters);
            for($i = 0; $i < 5; $i++)
            {
                test($test->getAdapterName() == "Adapter82");
                $test->ice_getConnection()->close(false);
            }

            $testSecure = $test->ice_secure(true)->ice_uncheckedCast("::Test::TestIntf");
            test($testSecure->ice_isSecure());
            $testSecure = $test->ice_secure(false)->ice_uncheckedCast("::Test::TestIntf");
            test(!$testSecure->ice_isSecure());
            $testSecure = $test->ice_secure(true)->ice_uncheckedCast("::Test::TestIntf");
            test($testSecure->ice_isSecure());
            test($test->ice_getConnection() != $testSecure->ice_getConnection());

            $com->deactivateObjectAdapter($adapters[1]);

            for($i = 0; $i < 5; $i++)
            {
                test($test->getAdapterName() == "Adapter81");
                $test->ice_getConnection()->close(false);
            }

            $endpts = $test->ice_getEndpoints();
            $com->createObjectAdapter("Adapter83", $endpts[1]->toString()); // Reactive tcp OA.

            for($i = 0; $i < 5; $i++)
            {
                test($test->getAdapterName() == "Adapter83");
                $test->ice_getConnection()->close(false);
            }

            $com->deactivateObjectAdapter($adapters[0]);
            try
            {
                $testSecure->ice_ping();
                test(false);
            }
            catch(Exception $ex)
            {
                $cre = $NS ? "Ice\\ConnectionRefusedException" : "Ice_ConnectionRefusedException";
                if(!($ex instanceof $cre))
                {
                    throw $ex;
                }
            }

            deactivate($com, $adapters);
        }
        echo "ok" . "\n";
    }

    $com->shutdown();
}
}
switch ($request->getPost('action')) {
    case 'get_vew_params':
        response(array('status' => 'ok', 'data' => getViewParams($userId, $request->getPost('type'))));
        break;
    case 'check_activate':
        if ($request->getPost('secret') === null || $request->getPost('sync1') === null) {
            $result = array('status' => 'error', 'error' => 'NOT_ENOUGH_PARAMS');
        } else {
            $fields = array('ACTIVE' => 'Y', 'USER_ID' => $userId, 'SECRET' => $_POST['secret'], 'TYPE' => $_POST['type'], 'SYNC1' => $_POST['sync1'], 'SYNC2' => $_POST['sync2']);
            $result = checkAndActivate($fields);
        }
        response($result);
        break;
    case 'deactivate':
        $result = deactivate($userId, $request->getPost('days'));
        response($result);
        break;
    case 'deffer':
        $result = deffer($userId, $request->getPost('days'));
        response($result);
        break;
    case 'activate':
        $result = activate($userId);
        response($result);
        break;
    case 'get_recovery_codes':
        $result = getRecoveryCodes($userId, $request->getPost('allow_regenerate') === 'Y');
        response($result);
        break;
    case 'regenerate_recovery_codes':
Beispiel #6
0
    while ($row = $sql->fetch_row($result)) {
        echo "<tr><td><input id=\"checkbox{$i}\" type=checkbox name=reasoncodes[] value={$row['1']} /></td>\n            <td><label for=\"checkbox{$i}\">{$row['0']}</label></td></tr>";
        $i++;
    }
    echo "</table>";
    echo "&nbsp;&nbsp;&nbsp;<input type=submit value=\"Enter Reason\">";
    echo "</form>";
} else {
    $memNum = $memID;
    $termType = $_POST['termType'];
    $codes = isset($_REQUEST["reasoncodes"]) ? $_REQUEST['reasoncodes'] : array();
    $reasonCode = 0;
    foreach ($codes as $c) {
        $reasonCode = $reasonCode | (int) $c;
    }
    deactivate($memNum, $termType, '', $reasonCode);
    addressList($memNum);
    // FIRE ALL UPDATE
    include 'custUpdates.php';
    updateCustomerAllLanes($memNum);
}
?>

<table>
<tr>
<td><a href="testEdit.php?memnum=<?php 
echo $memNum;
?>
 ">
Edit Info</a>
</td>
 function toggle($table, $id, $field, $value)
 {
     $Herb =& get_instance();
     $query = "SELECT * FROM `" . $table . "` WHERE id = '" . $id . "';";
     $res = $Herb->db->query($query);
     $row = $res->result_array();
     if (flag($row[$field], $value)) {
         deactivate($table, $id, $field, $value);
     } else {
         activate($table, $id, $field, $value);
     }
 }