function appnet_action($a, $uid, $pid, $action) { require_once 'addon/appnet/AppDotNet.php'; $token = get_pconfig($uid, 'appnet', 'token'); $clientId = get_pconfig($uid, 'appnet', 'clientid'); $clientSecret = get_pconfig($uid, 'appnet', 'clientsecret'); $app = new AppDotNet($clientId, $clientSecret); $app->setAccessToken($token); logger("appnet_action '" . $action . "' ID: " . $pid, LOGGER_DATA); try { switch ($action) { case "delete": $result = $app->deletePost($pid); break; case "like": $result = $app->starPost($pid); break; case "unlike": $result = $app->unstarPost($pid); break; } logger("appnet_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG); } catch (AppDotNetException $e) { logger("appnet_action: Error sending action " . $action . " pid " . $pid . " " . appnet_error($e->getMessage()), LOGGER_DEBUG); } }