예제 #1
0
파일: aweber.php 프로젝트: grlf/eyedock
 protected function _initSetupForm(Am_Form_Setup $form)
 {
     $url = 'https://auth.aweber.com/1.0/oauth/authorize_app/' . self::APP_ID;
     $el = $form->addTextarea('auth', array('cols' => 80, 'rows' => 4))->setLabel("aWeber App Authorization Code\n" . "get it on <a target='_blank' href='{$url}'>aWeber Website</a>");
     $el->addRule('regex', 'Invalid value', '/^[a-zA-Z0-9]+\\|[a-zA-Z0-9]+\\|[a-zA-Z0-9]+\\|[a-zA-Z0-9]+\\|[a-zA-Z0-9]+\\|\\s*$/');
     if ($this->getConfig('auth') && !$this->getConfig('access.access_token')) {
         if (!empty($_GET['oauth_token'])) {
             $api = $this->getApi();
             $api->user->tokenSecret = $_COOKIE['requestTokenSecret'];
             $api->user->requestToken = $_GET['oauth_token'];
             $api->user->verifier = $_GET['oauth_verifier'];
             list($accessToken, $accessTokenSecret) = $api->getAccessToken();
             $this->getDi()->config->saveValue('newsletter.aweber.access', array('access_token' => $accessToken, 'access_secret' => $accessTokenSecret));
             Am_Controller::redirectLocation(REL_ROOT_URL . "/admin-setup/aweber");
             return;
         } else {
             $api = $this->getApi();
             $callbackUrl = Am_Controller::getFullUrl();
             try {
                 list($requestToken, $requestTokenSecret) = $api->getRequestToken($callbackUrl);
                 Am_Controller::setCookie('requestTokenSecret', $requestTokenSecret);
                 $form->addStatic()->setLabel('Access Tokens')->setContent(sprintf('Access tokens are empty or expired, %sclick this link%s to update', '<a href="' . Am_Controller::escape($api->getAuthorizeUrl()) . '">', '</a>'));
             } catch (Exception $e) {
                 $this->getDi()->errorLogTable->logException($e);
                 $form->addStatic()->setLabel('Access Tokens')->setContent('Plugin configuration error. Got an error from API: ' . $e->getMessage());
             }
         }
     }
     $fields = $this->getDi()->userTable->getFields(true);
     unset($fields['email']);
     unset($fields['name_f']);
     unset($fields['name_l']);
     $ff = $form->addMagicSelect('fields')->setLabel("Pass additional fields to AWeber\nfields must be configured in AWeber with exactly same titles\nelse API calls will fail and users will not be added\n\nBy default the plugin passes \"email\" and \"name\"\nfields to Aweber, so usually you do not need to select \nthat fields to send as additional fields.\n");
     $ff->loadOptions(array_combine($fields, $fields));
 }
예제 #2
0
파일: api.php 프로젝트: grlf/eyedock
 function wp_clear_auth_cookie()
 {
     $cookie_domain = @$_SERVER['HTTP_HOST'];
     Am_Controller::setCookie($this->AUTH_COOKIE, ' ', time() - 31536000, $this->ADMIN_COOKIE_PATH, $cookie_domain);
     Am_Controller::setCookie($this->SECURE_AUTH_COOKIE, ' ', time() - 31536000, $this->ADMIN_COOKIE_PATH, $cookie_domain);
     Am_Controller::setCookie($this->AUTH_COOKIE, ' ', time() - 31536000, $this->PLUGINS_COOKIE_PATH, $cookie_domain);
     Am_Controller::setCookie($this->SECURE_AUTH_COOKIE, ' ', time() - 31536000, $this->PLUGINS_COOKIE_PATH, $cookie_domain);
     Am_Controller::setCookie($this->LOGGED_IN_COOKIE, ' ', time() - 31536000, $this->COOKIE_PATH, $cookie_domain);
     Am_Controller::setCookie($this->LOGGED_IN_COOKIE, ' ', time() - 31536000, $this->SITECOOKIEPATH, $cookie_domain);
     // Old cookies
     Am_Controller::setCookie($this->AUTH_COOKIE, ' ', time() - 31536000, $this->COOKIE_PATH, $cookie_domain);
     Am_Controller::setCookie($this->AUTH_COOKIE, ' ', time() - 31536000, $this->SITECOOKIEPATH, $cookie_domain);
     Am_Controller::setCookie($this->SECURE_AUTH_COOKIE, ' ', time() - 31536000, $this->COOKIE_PATH, $cookie_domain);
     Am_Controller::setCookie($this->SECURE_AUTH_COOKIE, ' ', time() - 31536000, $this->SITECOOKIEPATH, $cookie_domain);
 }
예제 #3
0
 function onAuthAfterLogout(Am_Event_AuthAfterLogout $event)
 {
     $this->deleteCookieFiles();
     Am_Controller::setCookie(self::NR_COOKIE, null, time() - 36000, '/', $this->getDi()->request->getHttpHost());
 }
예제 #4
0
 function onAuthAfterLogout(Am_Event_AuthAfterLogout $event)
 {
     Am_Controller::setCookie('fbsr_' . $this->getConfig('app_id'), null, time() - 3600 * 24, "/");
     Am_Controller::setCookie('fbs_' . $this->getConfig('app_id'), null, time() - 3600 * 24, "/");
     $this->getSession()->unsetAll();
 }
예제 #5
0
 function setCookie(User $aff, $banner, $aff_click_id = null)
 {
     $tm = $this->getDi()->time + $this->getDi()->config->get('aff.cookie_lifetime', 30) * 3600 * 24;
     $val = base64_encode($aff->login);
     $val .= '-' . ($banner ? $banner->pk() : "0");
     if ($aff_click_id) {
         $val .= '-' . $this->encodeClickId($aff_click_id);
     }
     Am_Controller::setCookie(self::COOKIE_NAME, $val, $tm, '/', $_SERVER['HTTP_HOST']);
 }
예제 #6
0
 function onAuthAfterLogout(Am_Event_AuthAfterLogout $event)
 {
     $domain = Zend_Controller_Front::getInstance()->getRequest()->getHttpHost();
     Am_Controller::setCookie('fbsr_' . $this->getConfig('app_id'), null, time() - 3600 * 24, "/");
     Am_Controller::setCookie('fbm_' . $this->getConfig('app_id'), null, time() - 3600 * 24, "/");
     Am_Controller::setCookie('fbsr_' . $this->getConfig('app_id'), null, time() - 3600 * 24, "/", $domain, false);
     Am_Controller::setCookie('fbm_' . $this->getConfig('app_id'), null, time() - 3600 * 24, "/", $domain, false);
     $event->getUser()->data()->set(self::FACEBOOK_LOGOUT, true)->update();
 }
예제 #7
0
 function wp_clear_auth_cookie()
 {
     Am_Controller::setCookie($this->AUTH_COOKIE, ' ', time() - 31536000, $this->ADMIN_COOKIE_PATH);
     Am_Controller::setCookie($this->SECURE_AUTH_COOKIE, ' ', time() - 31536000, $this->ADMIN_COOKIE_PATH);
     Am_Controller::setCookie($this->AUTH_COOKIE, ' ', time() - 31536000, $this->PLUGINS_COOKIE_PATH);
     Am_Controller::setCookie($this->SECURE_AUTH_COOKIE, ' ', time() - 31536000, $this->PLUGINS_COOKIE_PATH);
     Am_Controller::setCookie($this->LOGGED_IN_COOKIE, ' ', time() - 31536000, $this->COOKIE_PATH);
     Am_Controller::setCookie($this->LOGGED_IN_COOKIE, ' ', time() - 31536000, $this->SITECOOKIEPATH);
     // Old cookies
     Am_Controller::setCookie($this->AUTH_COOKIE, ' ', time() - 31536000, $this->COOKIE_PATH);
     Am_Controller::setCookie($this->AUTH_COOKIE, ' ', time() - 31536000, $this->SITECOOKIEPATH);
     Am_Controller::setCookie($this->SECURE_AUTH_COOKIE, ' ', time() - 31536000, $this->COOKIE_PATH);
     Am_Controller::setCookie($this->SECURE_AUTH_COOKIE, ' ', time() - 31536000, $this->SITECOOKIEPATH);
 }
예제 #8
0
파일: Bootstrap.php 프로젝트: grlf/eyedock
 function setKeywordCookie(User $aff, $keyword = null)
 {
     $tm = $this->getDi()->time + $this->getDi()->config->get('aff.cookie_lifetime', 30) * 3600 * 24;
     if (!is_null($keyword)) {
         Am_Controller::setCookie(sprintf("%s-%s", self::COOKIE_NAME, md5($aff->login)), base64_encode($keyword), $tm, '/', $_SERVER['HTTP_HOST']);
     }
 }
예제 #9
0
파일: mailchimp.php 프로젝트: grlf/eyedock
 public function onInitFinished()
 {
     // Do not track anything for admin pages or if tracking is disabled.
     if (defined('AM_ADMIN') || !$this->getConfig('ecommerce_tracking')) {
         return;
     }
     // mailchimp send two variables via get: mc_cid, and mc_eid both should be set in cookies.
     if ($mc_cid = $this->getDi()->request->getFiltered('mc_cid')) {
         Am_Controller::setCookie('mc_cid', $mc_cid, time() + 3600 * 24 * 30);
     }
     if ($mc_eid = $this->getDi()->request->getFiltered('mc_eid')) {
         Am_Controller::setCookie('mc_eid', $mc_eid, time() + 3600 * 24 * 30);
     }
 }