예제 #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
 function getUrl($record = null, $id = null)
 {
     $vars = $this->grid->getFilter()->getFilterVars();
     $params = array('_eu_vat_details_filter' => @$vars['filter'], 'return_url' => Am_Controller::getFullUrl());
     if (!is_null($record)) {
         $params['_eu_vat_details_filter']['country'][] = $record->country;
         $params['_eu_vat_details_filter']['tax_rate'] = $record->tax_rate;
     }
     return sprintf(REL_ROOT_URL . "/admin-vat-report/details/?%s", http_build_query($params));
 }
예제 #3
0
    public function render()
    {
        $val = Am_Controller::escape($this->options);
        $selfUrl = Am_Controller::escape(Am_Controller::getFullUrl());
        return <<<CUT
        <form class='filter' method='get' action='{$selfUrl}'>
        <b>Filter by Username or Name or E-Mail Address#</b>
        <input type='text' name='search-filter' value='{$val}'>
        <input type='text' name='search-type' value='filter' />
        <input type='submit' value='Filter' class='query-button'>
        </form>
CUT;
    }