Beispiel #1
0
        }
    } catch (Exception $e) {
        // The API encountered a problem before the script started executing.
        echo 'Caught exception: ', $e->getMessage(), "\n";
    }
}
function encodeResult($response)
{
    // The structure of the result will depend upon what the Apps Script function returns.
    // var_dump($resp);
    $resp = $response->getResponse();
    $result = $resp['result'];
    return json_encode($result);
}
// -----------------
function getContactList($groupName)
{
    $request = createRequest('getContactList', array('g' => $groupName));
    return execute($request, 'encodeResult');
}
function addContactToGroup($firstName, $lastName, $email, $groupName)
{
    $request = createRequest('addContactToGroup', array('f' => $firstName, 'l' => $lastName, 'e' => $email, 'g' => $groupName));
    return execute($request, 'encodeResult');
}
// -----------------
echo getContactList('2011 South Calgary Garden');
// function encode($response) { echo json_encode($response->getResponse()); }
// function noop($response) { echo ''; }
// $request = createRequest('mailToContact', array('e' => '*****@*****.**', 's' => 'Email Subject Here', 't' => 'Generic Template' ));
// execute($request, 'encode');
  			<input type="text" class="input-medium search-query" name="query" />
  			<button type="submit" class="btn">Search</button>
		</form>
      	<h2>My <?php 
echo ucfirst($type);
?>
s</h2>
      	<?php 
// if there is an error STOP
// are we doing a search or simple look up ?
if (isset($_POST['query'])) {
    // we are doing a search
    $contactList = searchContactList($type, $_POST['query']);
} else {
    // we are doing a contactList lookup
    $contactList = getContactList($type);
}
// if there is an error STOP
/*if( !$contactList ) {
			// throw an error and stop
			echo '<p class="alert alert-error"><strong>Sorry</strong> there has been an error.<br />API Message: '. (!$contactList ? 'The api is returning NULL' : $contactList->Message ) .'</p>';
			die();
		}*/
?>
      	<!-- we are showing tabular data - so lets setup a table (note this is hidden-phone) -->
      	<table class="table table-bordered table-striped hidden-phone">
			<thead>
			<tr>
				<th></th>
				<th>Name</th>
				<th>State</th>
Beispiel #3
0
         exit;
     } else {
         $icq->sendMessage($msg['from'], "The system is going down for reboot NOW! :)");
     }
     break;
 case '!clear':
     $list = $icq->getContactList();
     if ($msg['from'] == ADMINUIN) {
         $icq->deleteContact(array_keys($list));
         $icq->sendMessage(ADMINUIN, "Contact list cleared...");
     } else {
         $icq->sendMessage($msg['from'], "What do you want to clear?");
     }
     break;
 case '!contact':
     $c = getContactList($icq->getContactList());
     foreach ($c as $m) {
         $m = str_replace("", '', $m);
         $icq->sendMessage($msg['from'], $m);
     }
     break;
 case '!groups':
     var_dump($icq->getContactListGroups());
     break;
 case '!removeme':
     $list = $icq->getContactList();
     if (isset($list[$msg['from']])) {
         $icq->deleteContact($msg['from']);
     }
     $icq->sendMessage($msg['from'], $msg['from'] . ' deleted from bot contact list');
     break;
Beispiel #4
0
     $response = rateTag($_REQUEST['url'], $_REQUEST['url_parameter'], $_REQUEST['tag'], $_REQUEST['up']);
     break;
 case "delete_tag":
     $response = deleteTag($_REQUEST['url'], $_REQUEST['url_parameter'], $_REQUEST['tag']);
     break;
 case "get_pages_with_tag":
     $response = getPagesWithTag($_REQUEST['tag']);
     break;
 case "follow_contact":
     $response = followContact($_REQUEST['username']);
     break;
 case "unfollow_contact":
     $response = unfollowContact($_REQUEST['username']);
     break;
 case "get_contact_list":
     $response = getContactList();
     break;
 case "add_link":
     $response = addLink($_REQUEST['from_url'], $_REQUEST['from_url_param'], $_REQUEST['to_url'], $_REQUEST['to_url_param'], $_REQUEST['note']);
     break;
 case "delete_link":
     $response = deleteLink($_REQUEST['from_url'], $_REQUEST['from_url_param'], $_REQUEST['to_url'], $_REQUEST['to_url_param']);
     break;
 case "get_links":
     $response = getLinks($_REQUEST['url'], $_REQUEST['url_param']);
     break;
 case "rate_link":
     $response = rateLink($_REQUEST['from_url'], $_REQUEST['from_url_param'], $_REQUEST['to_url'], $_REQUEST['to_url_param'], $_REQUEST['up']);
     break;
 case "get_link_comment":
     $response = getLinkComment($_REQUEST['from_url'], $_REQUEST['from_url_param'], $_REQUEST['to_url'], $_REQUEST['to_url_param']);
Beispiel #5
0
 protected function OnInput()
 {
     parent::OnInput();
     $this->title = 'Список контактов';
     $this->allcontacts = getContactList();
 }