Exemple #1
0
    protected function _initSetupForm(Am_Form_Setup $form)
    {
        $form->addText('login')->setLabel('API Login')->addRule('required');
        $form->addPassword('passwd')->setLabel('API Password')->addRule('required');
        $form->addText('pslid')->setLabel('PSLID (Service User)')->addRule('required');
        $form->addText('sun')->setLabel('Service User Number (SUN)')->addRule('required');
        $form->addText('lead_time')->setLabel('Lead time, days')->default = 12;
        for ($i = 1; $i <= 28; $i++) {
            $options[$i] = ___("%d-th day", $i);
        }
        $payment_day = $form->addMagicSelect('payment_day')->setLabel(___("Process Payment Day"))->loadOptions($options);
        $payment_day->default = 8;
        $payment_day->addRule('required');
        $form->addText('legal_name', array('class' => 'el-wide'))->setLabel(___("Legal Name\n" . "Please enter the legal name of your organisation " . "which will be included in the Direct Debit Guarantee statement"))->addRule('required');
        $form->addTextarea('legal_address', array('class' => 'el-wide', 'rows' => 5))->setLabel(___("Legal Address\n" . "Please enter the legal address of your organisation " . "which will be included in the Direct Debit Guarantee statement"))->addRule('required');
        $form->addAdvCheckbox('auddis', array('id' => 'auddis'))->setLabel("Log AUDDIS reports as Tickets in helpdesk\n" . "helpdesk module should be enabled");
        $form->addText('auddis_login', array('id' => 'auddis-login'))->setLabel('Username of user for AUDDIS reports');
        $form->addScript()->setScript(<<<CUT
(function(){
    \$('#auddis').change(function(){
        \$('#auddis-login').closest('.row').toggle(this.checked);
    }).change();
    \$('#auddis-login').autocomplete({
        minLength: 2,
        source: window.rootUrl + "/admin-users/autocomplete/"
    });
})()
CUT
);
    }
Exemple #2
0
 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));
 }
 public function _initSetupForm(Am_Form_Setup $form)
 {
     $form->addText("key")->setLabel(array('Access Key', '
         You\'ll find your AccessKey in
         ControlCenter --> My Configuration'));
     $form->addText("project")->setLabel(array('Project Identifier'));
     $form->addAdvCheckbox("testing")->setLabel("Test Mode Enabled");
     $form->addMagicSelect("methods")->setLabel(___("Available methods\n" . "if none is selected then all methods will be listed"))->loadOptions(array('prepay' => $this->defaultPrepayDescription, 'lastschrift' => $this->defaultLastschriftDescription));
     $form->addText("prepay.title")->setLabel(array('Prepay method title', $this->defaultPrepayDescription));
     $form->setDefault('prepay.title', $this->defaultPrepayDescription);
     $form->addText("lastschrift.title")->setLabel(array('Lastschrift method title', $this->defaultLastschriftDescription));
     $form->setDefault('lastschrift.title', $this->defaultLastschriftDescription);
 }
Exemple #4
0
 protected function _initSetupForm(Am_Form_Setup $form)
 {
     $el = $form->addText('url', array('size' => 60))->setLabel('AutoResponse Pro Url');
     $el->addRule('required');
     $el->addRule('regex', 'URL must start with http:// or https://', '/^(http|https):\\/\\//');
     $ef = $form->addSelect('email_field')->setLabel('Choose Alternative E-Mail Field');
     $fields = $this->getDi()->userTable->getFields(true);
     $ef->loadOptions(array_combine($fields, $fields));
     $ef->addRule('required', true);
     $form->setDefault('email_field', 'email');
     $ff = $form->addMagicSelect('fields')->setLabel('Pass additional fields to ARP');
     $ff->loadOptions(array_combine($fields, $fields));
 }
Exemple #5
0
 protected function _initSetupForm(Am_Form_Setup $form)
 {
     $form->addText('login')->setLabel('API Login')->addRule('required');
     $form->addPassword('passwd')->setLabel('API Password')->addRule('required');
     $form->addText('pslid')->setLabel('PSLID (Service User)')->addRule('required');
     $form->addText('sun')->setLabel('Service User Number (SUN)')->addRule('required');
     $form->addText('lead_time')->setLabel('Lead time, days')->default = 12;
     for ($i = 1; $i <= 28; $i++) {
         $options[$i] = ___("%d-th day", $i);
     }
     $payment_day = $form->addMagicSelect('payment_day')->setLabel(___("Process Payment Day"))->loadOptions($options);
     $payment_day->default = 8;
     $payment_day->addRule('required');
     $form->addText('legal_name', array('class' => 'el-wide'))->setLabel(___("Legal Name\n" . "Please enter the legal name of your organisation " . "which will be included in the Direct Debit Guarantee statement"))->addRule('required');
     $form->addTextarea('legal_address', array('class' => 'el-wide', 'rows' => 5))->setLabel(___("Legal Address\n" . "Please enter the legal address of your organisation " . "which will be included in the Direct Debit Guarantee statement"))->addRule('required');
 }
Exemple #6
0
 protected function _initSetupForm(Am_Form_Setup $form)
 {
     $form->setTitle(___(self::TITLE));
     $form->addText('api_key', array('size' => 40))->setLabel(array("API Key", ""))->addRule('required');
     $form->addText('api_url', array('size' => 60))->setLabel(array("Full API URL", "eg., http://{your_domain}/{your_install_swm_directory}/api/api.php"))->addRule('required');
     if ($this->isConfigured()) {
         $form->addSortableMagicSelect('amember_fields')->setLabel("Pass additional fields from aMember")->loadOptions($this->getAmemberOptions());
         $form->addSortableMagicSelect('swm_fields')->setLabel("to SWM")->loadOptions($this->getSWMOptions());
         $opt = array();
         foreach ($this->getLists() as $k => $l) {
             $opt[$k] = '#' . $k . ' - ' . $l['title'];
         }
         $form->addMagicSelect('double_optin')->setLabel("Enabled Double Optin for these lists")->loadOptions($opt);
     }
     $form->addAdvCheckbox('check_blocklists')->setLabel(array('Check All Emails at Blocklists', "before subscribing"));
     $form->addAdvCheckbox('send_pass')->setLabel(array('Send Password to SWM', "it's not safe\npasswords are not stored encrypted at SWM"));
     $form->addAdvCheckbox('debud_mode')->setLabel(array('Debug Mode Enabled', "write debug info to logs\nit's recommended enable it at the first time"));
 }
Exemple #7
0
    protected function _afterInitSetupForm(Am_Form_Setup $form)
    {
        // insert title, description fields
        $form->setTitle(ucfirst(toCamelCase($this->getId())));
        $el = $form->addMagicSelect('reattempt', array('multiple' => 'multiple'));
        $options = array();
        for ($i = 1; $i < 60; $i++) {
            $options[$i] = ___("on %d-th day", $i);
        }
        $el->loadOptions($options);
        $el->setLabel(___("Retry On Failure\n" . "if the recurring billing has failed,\n" . "aMember can repeat it after several days,\n" . "and extend customer subscription for that period\n" . "enter number of days to repeat billing attempt"));
        if ($this->storesCcInfo() && !$this->_pciDssNotRequired) {
            $text = "<p><font color='red'>WARNING!</font> Every application processing e-check information, must be certified\n" . "as PA-DSS compliant, and every website processing credit cards must\n" . "be certified as PCI-DSS compliant.</p>";
            $text .= "<p>aMember Pro is not yet certified as PA-DSS compliant. We will start certification process\n" . "once we get 4.2.0 branch released and stable. This plugins is provided solely for TESTING purproses\n" . "Use it for anything else but testing at your own risk.</p>";
            $form->addProlog(<<<CUT
<div class="warning_box">
    {$text}
</div>   
CUT
);
        }
        $keyFile = defined('AM_KEYFILE') ? AM_KEYFILE : APPLICATION_PATH . '/configs/key.php';
        if (!is_readable($keyFile)) {
            $random = $this->getDi()->app->generateRandomString(78);
            $text = "<p>To use credit card plugins, you need to create a key file that contains unique\n";
            $text .= "encryption key for your website. It is necessary even if the plugin does not\n";
            $text .= "store sensitive information.</p>";
            $text .= "<p>In a text editor, create file with the following content (one-line, no spaces before opening &lt;?php):\n";
            $text .= "<br /><br /><pre style='background-color: #e0e0e0;'>&lt;?php return '{$random}';</pre>\n";
            $text .= "<br />save the file as <b>key.php</b>, and upload to <i>amember/application/configs/</i> folder.\n";
            $text .= "This warning will disappear once you do it correctly.</p>";
            $text .= "<p>KEEP A BACKUP COPY OF THE key.php FILE (!)</p>";
            $form->addProlog(<<<CUT
<div class="warning_box">
    {$text}
</div>
CUT
);
        }
        return parent::_afterInitSetupForm($form);
    }
Exemple #8
0
    protected function _afterInitSetupForm(Am_Form_Setup $form)
    {
        // insert title, description fields
        $form->setTitle(ucfirst(toCamelCase($this->getId())));
        $el = $form->addMagicSelect('reattempt', array('multiple' => 'multiple'));
        $options = array();
        for ($i = 1; $i < 60; $i++) {
            $options[$i] = ___("on %d-th day", $i);
        }
        $el->loadOptions($options);
        $el->setLabel(___("Retry On Failure\n" . "if the recurring billing has failed,\n" . "aMember can repeat it after several days,\n" . "and extend customer subscription for that period\n" . "enter number of days to repeat billing attempt"));
        if ($this->canUseMaxmind()) {
            $form->addFieldset()->setLabel(___('MaxMind Credit Card Fraud Detection'));
            $form->addAdvCheckbox('use_maxmind')->setLabel(___('Use MaxMind Credit Card Fraud Detection'));
            $form->addText('maxmind_license_key')->setLabel(___("Maxmind License Key\n" . "%sObtain a Free or Premium license key%s", '<a href="http://www.maxmind.com/app/minfraud" target="_blank">', '</a>'));
            $form->addSelect('maxmind_requested_type')->setLabel(___("Requested Type\n" . "To be used if you have multiple plans in one account\n" . "and wish to select type of query you wish to make.\n" . "By default the service uses the highest level available"))->loadOptions(array("" => 'Default', "free" => 'Free', "city" => 'City (standard paid service)', "premium" => 'Premium (premium paid service)'));
            $form->addText('maxmind_risk_score')->setLabel(___("Risk Score\n" . "Overall %sRisk Score%s (decimal from 0 to 10)\n" . "For orders that return a fraud score of 2.5 and above,\n" . " it is recommended to hold for review,\n" . " or require the validation with the Telephone Verification service\n", '<a href="http://www.maxmind.com/app/web_services_score2" target="_blank">', '</a>'));
            $form->setDefault('maxmind_risk_score', '2.5');
            /*$form->addAdvCheckbox('maxmind_use_telephone_verification')->setLabel(
              ___("Telephone Verification\n" .
                      "Enable %sTelephone Verification%s service"
                      , '<a href="http://www.maxmind.com/app/telephone_overview" target="_blank">', '</a>'));*/
            $form->addAdvCheckbox('maxmind_use_number_identification')->setLabel(___("Number Identification\n" . "Enable %sTelephone Number Identification (TNI)%s service", '<a href="http://www.maxmind.com/app/phone_id" target="_blank">', '</a>'));
            $form->addMagicSelect('maxmind_tni_phone_types')->setLabel(___("Allowed Phone Types\n" . "The TNI service is able to categorize customer inputted US and Canadian\n" . "phone numbers into %seight different phone types%s\n" . "such as fixed land line, mobile, VoIP, and invalid phone numbers", '<a href="http://www.maxmind.com/app/phone_id_codes" target="_blank">', '</a>'))->loadOptions(array('0' => 'Undetermined (Medium Risk Level)', '1' => 'Fixed Line (Low Risk Level)', '2' => 'Mobile (Low-Medium Risk Level)', '3' => 'PrePaid Mobile (Medium-High Risk Level)', '4' => 'Toll-Free (High Risk Level)', '5' => 'Non-Fixed VoIP (High Risk Level)', '8' => 'Invalid Number (High Risk Level)', '9' => 'Restricted Number (High Risk Level)'));
            $form->addAdvCheckbox('maxmind_allow_country_not_matched')->setLabel(___("Allow payment if country not matched\n" . "Whether country of IP address matches billing address country\n" . "(mismatch = higher risk)"));
            $form->addAdvCheckbox('maxmind_allow_high_risk_country')->setLabel(___("Allow payment if high risk countries\n" . "Whether IP address or billing address country is in\n" . "Egypt, Ghana, Indonesia, Lebanon, Macedonia, Morocco, Nigeria,\n" . "Pakistan, Romania, Serbia and Montenegro, Ukraine, or Vietnam"));
            $form->addAdvCheckbox('maxmind_allow_anonymous_proxy')->setLabel(___("Allow payment if anonymous proxy\n" . "Whether IP address is %sAnonymous Proxy%s\n" . "(anonymous proxy = very high risk)", '<a href="http://www.maxmind.com/app/proxy#anon" target="_blank">', '</a>'));
            $form->addAdvCheckbox('maxmind_allow_free_mail')->setLabel(___("Allow payment if free e-mail\n" . "Whether e-mail is from free e-mail provider\n" . "(free e-mail = higher risk)"));
            $form->addElement('script')->setScript(<<<CUT
function showHideMaxmind()
{
    var el = \$("[id^=use_maxmind-]");    
    \$("[id^=maxmind_]").closest(".row").toggle(el.prop('checked'));
    if(el.prop('checked'))
        /*showHideNumberidentification();*/
        showHidePhonetypes();
}
/*function showHideNumberidentification()
{
    var el = \$("[id^=maxmind_use_telephone_verification-]");    
    \$("[id^=maxmind_tni_phone_types-]").closest(".row").toggle(el.prop('checked'));
    \$("[id^=maxmind_use_number_identification-]").closest(".row").toggle(el.prop('checked'));
    if(el.prop('checked'))
        showHidePhonetypes();
}*/
function showHidePhonetypes()
{
    \$("[id^=maxmind_tni_phone_types-]").closest(".row").toggle(\$("[id^=maxmind_use_number_identification-]").prop('checked'));
}
\$(function(){
    \$("[id^=use_maxmind-]").click(function(){
        showHideMaxmind();
    });
    /*\$("[id^=maxmind_use_telephone_verification-]").click(function(){
        showHideNumberidentification();
    });*/
    \$("[id^=maxmind_use_number_identification-]").click(function(){
        showHidePhonetypes();
    });
    showHideMaxmind();
});
CUT
);
        }
        if ($this->storesCcInfo() && !$this->_pciDssNotRequired) {
            $text = "<p><font color='red'>WARNING!</font> Every application processing credit card information, must be certified\n" . "as PA-DSS compliant, and every website processing credit cards must\n" . "be certified as PCI-DSS compliant.</p>";
            $text .= "<p>aMember Pro is not yet certified as PA-DSS compliant. " . "This plugins is provided solely for TESTING purproses\n" . "Use it for anything else but testing at your own risk.</p>";
            $form->addProlog(<<<CUT
<div class="warning_box">
    {$text}
</div>   
CUT
);
        }
        $keyFile = defined('AM_KEYFILE') ? AM_KEYFILE : APPLICATION_PATH . '/configs/key.php';
        if (!is_readable($keyFile)) {
            $random = $this->getDi()->app->generateRandomString(78);
            $text = "<p>To use credit card plugins, you need to create a key file that contains unique\n";
            $text .= "encryption key for your website. It is necessary even if the plugin does not\n";
            $text .= "store sensitive information.</p>";
            $text .= "<p>In a text editor, create file with the following content (one-line, no spaces before opening &lt;?php):\n";
            $text .= "<br /><br /><pre style='background-color: #e0e0e0;'>&lt;?php return '{$random}';</pre>\n";
            $text .= "<br />save the file as <b>key.php</b>, and upload to <i>amember/application/configs/</i> folder.\n";
            $text .= "This warning will disappear once you do it correctly.</p>";
            $text .= "<p>KEEP A BACKUP COPY OF THE key.php FILE (!)</p>";
            $form->addProlog(<<<CUT
<div class="warning_box">
    {$text}
</div>
CUT
);
        }
        return parent::_afterInitSetupForm($form);
    }