Пример #1
0
 function handlePCOActions()
 {
     if (isset($_GET['pco-action']) && current_user_can('manage_options')) {
         if ($_GET['pco-action'] == 'logout') {
             PCOAccess::deleteAccessToken();
         } else {
             if ($_GET['pco-action'] == 'auth') {
                 PCOAccess::deleteAccessToken();
                 $pco = new PCOAccess();
                 if ($pco->hasCredentials()) {
                     $thisURL = is_ssl() ? "https://" : "http://";
                     $thisURL .= $_SERVER['HTTP_HOST'];
                     $thisURL .= $_SERVER['REQUEST_URI'];
                     $auth = $pco->authenticate($thisURL);
                     // if we're still here, there was no redirect, so this must be the callback
                     header('Location: ?page=pco_connect');
                 }
             } else {
                 if ($_GET['pco-action'] == 'finalizeauth') {
                     $pco = new PCOAccess();
                 }
             }
         }
     }
 }