v7‰PNG  IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ± üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0A­ºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT Standard.php000064400000217432152101630240007020 0ustar00setTitle(___('Global')) ->setComment(''); $this->data['help-id'] = 'Setup/Global'; } function validateCurl($val) { if (!$val) return; exec("$val http://www.yahoo.com/ 2>&1", $out, $return); if ($return) return "Couldn't execute '$val http://www.yahoo.com/'. Exit code: $return, $out"; } function initElements() { $this->addText('site_title', array( 'class' => 'el-wide', ), array('help-id' => '#Setup.2FEdit_Site_Title')) ->setLabel(___('Site Title')); $this->addStatic(null, null, array('help-id' => '#Root_URL_and_License_Key'))->setContent( '' . ___('change') . '')->setLabel(___('Root Url and License Keys')); $players = array('Flowplayer'=>'Flowplayer'); if(file_exists($this->getDi()->root_dir . '/application/default/views/public/js/jwplayer/jwplayer.js')) $players['JWPlayer'] = 'JWPlayer'; $this->addSelect('video_player') ->setId('video-player') ->setLabel(___('Video Player')) ->loadOptions($players) ->toggleFrozen(count($players)==1); $this->setDefault('video_player', 'Flowplayer'); $this->addText('flowplayer_license') ->setId('video-player-Flowplayer') ->setLabel(___("FlowPlayer License Key\nyou may get your key in %smembers area%s", '', '')) ->addRule('regex', ___('Value must be alphanumeric'), '/^[a-zA-Z0-9]*$/'); $this->addText('jwplayer_license') ->setId('video-player-JWPlayer') ->setLabel(___("JWPlayer License Key")); $this->addScript() ->setScript(<<addSelect('theme', null, array('help-id' => '#Setup.2FEdit_User_Pages_Theme')) ->setLabel(___('User Pages Theme')) ->loadOptions(Am_Di::getInstance()->view->getThemes('user')); $this->addSelect('admin_theme', null, array('help-id' => '#Setup.2FEdit_Admin_Pages_Theme')) ->setLabel(___('Admin Pages Theme')) ->loadOptions(Am_Di::getInstance()->view->getThemes('admin')); $tax_plugins =array( 'global-tax' => ___('Global Tax'), 'regional' => ___('Regional Tax'), 'vat2015' => ___('EU VAT'), 'gst' => ___('GST (Inclusive Tax)') ); foreach(Am_Di::getInstance()->plugins_tax->getAvailable() as $plugin) if(!isset($tax_plugins[$plugin])) $tax_plugins[$plugin] = ucwords(str_replace("-", ' ', $plugin)); $this->addSelect('plugins.tax', array('size' => 1)) ->setLabel(___('Tax')) ->loadOptions(array( '' => ___('No Tax') ) + $tax_plugins); $fs = $this->addFieldset('##02') ->setLabel(___('Signup Form Configuration')); $this->setDefault('login_min_length', 5); $this->setDefault('login_max_length', 16); $loginLen = $fs->addGroup(null, null, array('help-id' => '#Setup.2FEdit_Username_Rules'))->setLabel(___('Username Length')); $loginLen->addInteger('login_min_length', array('size'=>3))->setLabel('min'); $loginLen->addStatic('')->setContent(' — '); $loginLen->addInteger('login_max_length', array('size'=>3))->setLabel('max'); $fs->addAdvCheckbox('login_disallow_spaces', null, array('help-id' => '#Setup.2FEdit_Username_Rules')) ->setLabel(___('Do not Allow Spaces in Username')); $fs->addAdvCheckbox('login_dont_lowercase', null, array('help-id' => '#Setup.2FEdit_Username_Rules')) ->setLabel(___("Do not Lowercase Username\n". "by default, aMember automatically lowercases entered username\n". "here you can disable this function")); $this->setDefault('pass_min_length', 6); $this->setDefault('pass_max_length', 25); $passLen = $fs->addGroup(null, null, array('help-id' => '#Setup.2FEdit_Password_Length'))->setLabel(___('Password Length')); $passLen->addInteger('pass_min_length', array('size'=>3))->setLabel('min'); $passLen->addStatic('')->setContent(' — '); $passLen->addInteger('pass_max_length', array('size'=>3))->setLabel('max'); $fs->addAdvCheckbox('require_strong_password') ->setLabel(___("Require Strong Password\n" . 'password should contain at least 2 capital letters, 2 or more numbers and 2 or more special chars')); $fs = $this->addFieldset('##03') ->setLabel(___('Miscellaneous')); $this->setDefault('admin.records-on-page', 10); $fs->addInteger('admin.records-on-page') ->setLabel(___('Records per Page (for grids)')); $fs->addAdvCheckbox('disable_rte') ->setLabel(___('Disable Visual HTML Editor')); $this->setDefault('currency', 'USD'); $currency = $fs->addSelect('currency', array ( 'size' => 1, 'class' => 'am-combobox' ), array('help-id' => '#Set_Up.2FEdit_Base_Currency')) ->setLabel(___("Base Currency\n". "base currency to be used for reports and affiliate commission. ". "It could not be changed if there are any invoices in database.") ) ->loadOptions(Am_Currency::getFullList()); if (Am_Di::getInstance()->db->selectCell("SELECT COUNT(*) FROM ?_invoice")) { $currency->toggleFrozen(true); } $url = Am_Di::getInstance()->url('admin-currency-exchange'); $label = Am_Html::escape(___('Edit')); $this->addHtml() ->setLabel(___('Currency Exchange Rates')) ->setHtml(<<$label CUT ); $this->addSelect('404_page') ->setLabel(___("Page Not Found (404)\n" . "%sthis page will be public and do not require any login/password%s\n" . 'you can create new pages %shere%s', '', '', '', '')) ->loadOptions(array(''=>___('Default Not Found Page')) + Am_Di::getInstance()->db->selectCol("SELECT page_id AS ?, title FROM ?_page", DBSIMPLE_ARRAY_KEY)); } } class Am_Form_Setup_Plugins extends Am_Form_Setup { // list of cc plugins saved for special handling protected $plugins_cc = array(); function __construct() { parent::__construct('plugins'); $this->setTitle(___('Plugins')) ->setComment(''); $this->data['help-id'] = 'Setup/Plugins'; } function getPluginsList($folders) { $ret = array(); foreach ($folders as $folder) foreach (scandir($folder) as $f) { if ($f[0] == '.') continue; $path = "$folder/$f"; if (is_file($path) && preg_match('/^(.+)\.php$/', $f, $regs)) { $ret[ $regs[1] ] = $regs[1]; } elseif (is_dir($path)) { if (is_file("$path/$f.php")) $ret[$f] = $f; } } ksort($ret); return $ret; } function initElements() { /* @var $bootstrap Bootstrap */ $modules = $this->addMagicSelect('modules', null, array('help-id' => '#Enabling.2FDisabling_Modules')) ->setLabel(___('Enabled Modules')); $this->setDefault('modules', array()); foreach (Am_Di::getInstance()->modules->getAvailable() as $module) { $fn = AM_APPLICATION_PATH . '/' . $module . '/module.xml'; if (!file_exists($fn)) continue; $xml = simplexml_load_file($fn); if (!$xml) continue; if ($module == 'cc') continue; $modules->addOption($module . ' - ' . $xml->desc, $module); } foreach (Am_Di::getInstance()->plugins as $type => $mgr) { if ($type == 'modules') continue; /* @var $mgr Am_Plugins */ switch($type) { case 'payment' : $help_id = '#Enabling.2FDisabling_Payment_Plugins'; break; case 'protect' : $help_id = '#Enabling.2FDisabling_Integration_Plugins'; break; case 'misc' : $help_id = '#Enabling.2FDisabling_Other_Plugins'; break; default : $help_id = ''; break; } $el = $this->addMagicSelect('plugins.' . $type, array('class' => 'magicselect am-combobox-fixed'), array('help-id' => $help_id)) ->setLabel(___('%s Plugins', ___($mgr->getTitle()))); $paths = $mgr->getPaths(); $plugins = self::getPluginsList($paths); if ($type == 'payment') { $this->plugins_cc = self::getPluginsList(array(AM_APPLICATION_PATH . '/cc/plugins')); if (!Am_Di::getInstance()->modules->isEnabled('cc')) { $plugins = array_merge($plugins, $this->plugins_cc); ksort($plugins); } array_remove_value($plugins, 'free'); } elseif ($type == 'storage') { $plugins = array('upload'=>'upload', 'disk'=>'disk') + $plugins; } $el->loadOptions($plugins); } $this->setDefault('plugins.payment', array()); $this->setDefault('plugins.protect', array()); $this->setDefault('plugins.misc', array()); $this->setDefault('plugins.storage', array('upload', 'disk')); } public function beforeSaveConfig(Am_Config $before, Am_Config $after) { //we will enable it later if there is at least one CC plugin $modules = $after->get('modules', array()); array_remove_value($modules, 'cc'); $after->set('modules', $modules); // Do the same for plugins; foreach(Am_Di::getInstance()->plugins as $type => $pm) { /* @var $pm Am_Plugins */ $configKey = $type == 'modules' ? 'modules' : ('plugins.'.$type); $b = (array)$before->get($configKey); $a = (array)$after->get($configKey); $enabled = array_filter(array_diff($a, $b), 'strlen'); $disabled = array_filter(array_diff($b, $a), 'strlen'); if ($type == 'payment') { foreach ($a as $plugin) { if (!empty($this->plugins_cc[$plugin])) { $modules = $after->get('modules', array()); $modules[] = 'cc'; $after->set('modules', $modules); break; } } } foreach ($disabled as $plugin) { if ($pm->load($plugin)) try { $pm->get($plugin)->deactivate(); } catch(Exception $e) { Am_Di::getInstance()->errorLogTable->logException($e); trigger_error("Error during plugin [$plugin] deactivation: " . get_class($e). ": " . $e->getMessage(), E_USER_WARNING); } // Now clean config for plugin; $after->set($pm->getConfigKey($plugin), array()); } foreach ($enabled as $plugin) { if ($pm->load($plugin)) { $class = $pm->getPluginClassName($plugin); try { call_user_func(array($class, 'activate'), $plugin, $type); } catch(Exception $e) { Am_Di::getInstance()->errorLogTable->logException($e); trigger_error("Error during plugin [$plugin] activattion: " . get_class($e). ": " . $e->getMessage(),E_USER_WARNING); } } } } Am_Di::getInstance()->config->set('modules', $modules = $after->get('modules', array())); Am_Di::getInstance()->app->dbSync(true, $modules); $after->save(); } } class Am_Form_Setup_Email extends Am_Form_Setup { function __construct() { parent::__construct('email'); $this->setTitle(___('E-Mail')) ->setComment(''); $this->data['help-id'] = 'Setup/Email'; } function checkSMTPHost($val){ $res = ($val['email_method'] == 'smtp') ? (bool)strlen($val['smtp_host']) : true; if (!$res) { $elements = $this->getElementsByName('smtp_host'); $elements[0]->setError(___('SMTP Hostname is required if you have enabled SMTP method')); } return $res; } function initElements() { $this->addText('admin_email', array ( 'class' => 'el-wide', ), array('help-id' => '#Email_Address_Configuration')) ->setLabel(___("Admin E-Mail Address\n". "used to send email notifications to admin\n". "and as default outgoing address") ) ->addRule('callback', ___('Please enter valid e-mail address'), array('Am_Validate', 'email')); $this->addText('technical_email', array('class' => 'el-wide')) ->setLabel(___("Technical E-Mail Address\n". "shown on error pages. If empty, [Admin E-Mail Address] is used")) ->addRule('callback', ___('Please enter valid e-mail address'), array('Am_Validate', 'empty_or_email')); $this->addText('admin_email_from', array ( 'class' => 'el-wide', ), array('help-id' => '#Email_Address_Configuration')) ->setLabel(___( "Outgoing Email Address\n". "used as From: address for sending e-mail messages\n". "to customers. If empty, [Admin E-Mail Address] is used" )) ->addRule('callback', ___('Please enter valid e-mail address'), array('Am_Validate', 'empty_or_email')); $this->addText('admin_email_name', array ( 'class' => 'el-wide', ), array('help-id' => '#Email_Address_Configuration')) ->setLabel(___( "E-Mail Sender Name\n" . "used to display name of sender in outgoing e-mails" )); $fs = $this->addFieldset('##19') ->setLabel(___('E-Mail System Configuration')); $fs->addSelect('email_method', null, array('help-id' => '#Email_System_Configuration')) ->setLabel(___( "Email Sending method\n" . "PLEASE DO NOT CHANGE if emailing from aMember works")) ->loadOptions(array( 'mail' => ___('Internal PHP mail() function (default)'), 'smtp' => ___('SMTP'), 'ses' => ___('Amazon SES'), 'sendgrid' => ___('Send Grid (Web API v2)'), 'sendgrid3' => ___('Send Grid (Web API v3)'), 'campaignmonitor' => ___('CampaignMonitor (Transactional API)'), 'mailjet' => ___('Mail Jet'), 'disabled' => ___('Disabled') )); $fs->addText('smtp_host', array('class' => 'el-wide'), array('help-id' => '#SMTP_Mail_Settings')) ->setLabel(___('SMTP Hostname')); $this->addRule('callback', ___('SMTP Hostname is required if you have enabled SMTP method'), array($this, 'checkSMTPHost')); $fs->addInteger('smtp_port', array('size' => 4), array('help-id' => '#SMTP_Mail_Settings')) ->setLabel(___('SMTP Port')); $fs->addSelect('smtp_security', null, array('help-id' => '#SMTP_Mail_Settings')) ->setLabel(___('SMTP Security')) ->loadOptions(array( '' => 'None', 'ssl' => 'SSL', 'tls' => 'TLS', )); $fs->addText('smtp_user', array('autocomplete'=>'off'), array('help-id' => '#SMTP_Mail_Settings')) ->setLabel(___('SMTP Username')); $fs->addPassword('smtp_pass', array('autocomplete'=>'off'), array('help-id' => '#SMTP_Mail_Settings')) ->setLabel(___('SMTP Password')); $fs->addText('ses_id', array('class' => 'el-wide')) ->setLabel(___('Amazon SES Access Id')); $fs->addPassword('ses_key', array('class' => 'el-wide')) ->setLabel(___('Amazon SES Secret Key')); $fs->addSelect('ses_region', '', array('options' =>array( Am_Mail_Transport_Ses::REGION_US_EAST_1 => 'US East (N. Virginia)', Am_Mail_Transport_Ses::REGION_US_WEST_2 => 'US West (Oregon)', Am_Mail_Transport_Ses::REGION_EU_WEST_1 => 'EU (Ireland)' ))) ->setLabel(___('Amazon SES Region')); $fs->addText('sendgrid_user') ->setLabel(___('SendGrid Username')) ->addRule('required', ___('This field is required'), null, HTML_QuickForm2_Rule::CLIENT); $fs->addPassword('sendgrid_key') ->setLabel(___('SendGrid Password')) ->addRule('required', ___('This field is required'), null, HTML_QuickForm2_Rule::CLIENT); $fs->addPassword('sendgrid3_key', array('class' => 'el-wide')) ->setLabel(___('SendGrid API Key')) ->addRule('required', ___('This field is required'), null, HTML_QuickForm2_Rule::CLIENT); $fs->addText('campaignmonitor_apikey', array('class' => 'el-wide')) ->setLabel(___('Campaignmonitor API Key')) ->addRule('required', ___('This field is required'), null, HTML_QuickForm2_Rule::CLIENT); $fs->addText('campaignmonitor_clientid', array('class' => 'el-wide')) ->setLabel(___('Client API ID')) ->addRule('required', ___('This field is required'), null, HTML_QuickForm2_Rule::CLIENT); $fs->addText('mailjet_apikey_public', array('class' => 'el-wide')) ->setLabel(___('Mail Jet API Public Key')) ->addRule('required', ___('This field is required'), null, HTML_QuickForm2_Rule::CLIENT); $fs->addPassword('mailjet_apikey_private', array('class' => 'el-wide')) ->setLabel(___('Mail Jet API Private Key')) ->addRule('required', ___('This field is required'), null, HTML_QuickForm2_Rule::CLIENT); $test = ___('Test E-Mail Settings'); $em = ___('E-Mail Address to Send to'); $se = ___('Send Test E-Mail'); $fs->addStatic('email_test', null, array('help-id' => '#Test_Email_Settings'))->setContent(<< $test? CUT ); $se = ___('Sending Test E-Mail...'); $this->addScript()->setScript(<<setDefault('email_log_days', 0); $fs->addText('email_log_days', array ( 'size' => 6, ), array('help-id' => '#Outgoing_Messages_Log')) ->setLabel(___('Log Outgoing E-Mail Messages for ... days')); $fs->addAdvCheckbox('email_queue_enabled', null, array('help-id' => '#Using_the_Email_Throttle_Queue')) ->setLabel(___('Use E-Mail Throttle Queue')); $fs->addScript()->setScript(<<addSelect('email_queue_period') ->setLabel(___( "Allowed E-Mails Period\n" . "choose if your host is limiting e-mails per day or per hour")) ->loadOptions( array ( 3600 => 'Hour', 86400 => 'Day', ) ); $this->setDefault('email_queue_limit', 100); $fs->addInteger('email_queue_limit', array('size' => 6)) ->setLabel(___( "Allowed E-Mails Count\n" . "enter number of emails allowed within the period above")); $fs = $this->addFieldset('##10') ->setLabel(___('Validation Messages to Customer')); $fs->addElement('email_link', 'verify_email_signup', null, array('help-id' => '#Validation_Message_Configuration')) ->setLabel(___("Verify E-Mail Address On Signup Page\n". "e-mail verification may be enabled for each signup form separately\n". "at aMember CP -> Forms Editor -> Edit, click \"configure\" on E-Mail brick")); $fs->addElement('email_link', 'verify_email_profile', null, array('help-id' => '#Validation_Message_Configuration')) ->setLabel(___("Verify New E-Mail Address On Profile Page\n". "e-mail verification for profile form may be enabled\n". "at aMember CP -> Forms Editor -> Edit, click \"configure\" on E-Mail brick")); $fs = $this->addFieldset('##11') ->setLabel(___('Signup Messages')); $fs->addElement('email_checkbox', 'registration_mail') ->setLabel(___("Send Registration E-Mail\n". "once customer completes signup form (before payment)")); $fs->addElement('email_checkbox', 'registration_mail_admin') ->setLabel(___("Send Registration E-Mail to Admin\n". "once customer completes signup form (before payment)")); $fs = $this->addFieldset('##12') ->setLabel(___("Pending Invoice Notification Rules")); $fs->addElement(new Am_Form_Element_PendingNotificationRules('pending_to_user')) ->setLabel(___("Pending Invoice Notifications to User\n". "only one email will be send for each defined day.\n". "all email for specific day will be selected and conditions will be checked.\n". "First email with matched condition will be send and other ignored")); $fs->addElement(new Am_Form_Element_PendingNotificationRules('pending_to_admin')) ->setLabel(___("Pending Invoice Notifications to Admin\n". "only one email will be send for each defined day.\n". "all email for specific day will be selected and conditions will be checked.\n". "First email with matched condition will be send and other ignored")); $fs = $this->addFieldset('##13') ->setLabel(___('Messages to Customer after Payment')); $fs->addElement('email_checkbox', 'send_signup_mail', null, array('help-id' => '#Email_Messages_Configuration')) ->setLabel(___("Send Signup E-Mail\n". "once FIRST subscripton is completed")); $fs->addElement('email_checkbox', 'send_payment_mail', null, array('help-id' => '#Email_Messages_Configuration')) ->setLabel(___("E-Mail Payment Receipt to User\n". 'every time payment is received')); $fs->addElement('email_checkbox', 'send_payment_admin', null, array('help-id' => '#Email_Messages_Configuration')) ->setLabel(___("Admin Payment Notifications\n". "to admin once payment is received")); $fs->addElement('email_checkbox', 'send_free_payment_admin', null, array('help-id' => '#Email_Messages_Configuration')) ->setLabel(___("Admin Free Subscription Notifications\n". "to admin once free signup is completed")); $fs = $this->addFieldset('##15') ->setLabel(___('E-Mails by User Request')); $fs->addElement('email_checkbox', 'mail_cancel_member') ->setLabel(___("Send Cancel Notifications to User\n" . 'send email to member when he cancels recurring subscription.')); $fs->addElement('email_checkbox', 'mail_upgraded_cancel_member') ->setLabel(___("Send Cancel (due to upgrade) Notifications to User\n" . 'send email to member when he cancels recurring subscription due to upgrade.')); $fs->addElement('email_checkbox', 'mail_cancel_admin') ->setLabel(___("Send Cancel Notifications to Admin\n" . 'send email to admin when recurring subscription cancelled by member')); $fs->addElement('email_link', 'send_security_code') ->setLabel(___("Remind Password to Customer")); $fs->addElement('email_checkbox', 'changepass_mail') ->setLabel(___("Change Password Notification\n" . 'send email to user after password change')); if($this->haveCronRebillPlugins()) { $fs = $this->addFieldset('##17') ->setLabel(___('E-Mail Messages on Rebilling Event', '')); $fs->addElement('email_checkbox', 'cc.admin_rebill_stats') ->setLabel(___("Send Credit Card Rebill Stats to Admin\n" . "Credit Card Rebill Stats will be sent to Admin daily. It works for payment processors like Authorize.Net and PayFlow Pro only")); $fs->addElement('email_checkbox', 'cc.rebill_failed') ->setLabel(___("Credit Card Rebill Failed\n" . "if credit card rebill failed, user will receive the following e-mail message. It works for payment processors like Authorize.Net and PayFlow Pro only")); $fs->addElement('email_checkbox', 'cc.rebill_success') ->setLabel(___("Credit Card Rebill Successfull\n" . "if credit card rebill was sucessfull, user will receive the following e-mail message. It works for payment processors like Authorize.Net and PayFlow Pro only")); if($this->haveStoreCreditCardPlugins()) { $gr = $fs->addGroup() ->setLabel(___("Credit Card Expiration Notice\n" . "if saved customer credit card expires soon, user will receive the following e-mail message. It works for payment processors like Authorize.Net and PayFlow Pro only")); ; $gr->addElement('email_checkbox', 'cc.card_expire'); $gr->addHTML()->setHTML(' ' . ___('Send message') . ' '); $gr->addText('cc.card_expire_days', array('size'=>2, 'value'=>5)); $gr->addHTML()->setHTML(' ' . ___('days before rebilling')); } } $fs = $this->addFieldset('##16') ->setLabel(___('E-Mails by Admin Request')); $fs->addElement('email_link', 'send_security_code_admin', null, array('help-id' => '#Forgotten_Password_Templates')) ->setLabel(___('Remind Password to Admin')); $fs = $this->addFieldset('##18') ->setLabel(___('Miscellaneous')); $fs->addElement('email_checkbox', 'profile_changed', null, array('help-id' => '#Configuring_Advanced_Options')) ->setLabel(___("Send Notification to Admin When Profile is Changed\n". "admin will receive an email if user has changed profile" )); $fs->addAdvCheckbox('disable_unsubscribe_link', null, array('help-id' => '#Miscellaneous_Email_Settings')) ->setLabel(___('Do not include Unsubscribe Link into e-mails')); $this->addScript()->setScript(<<addTextarea('unsubscribe_html', array('class' => 'el-wide', 'rows'=>6), array('help-id' => '#Miscellaneous_Email_Settings')) ->setLabel(___("HTML E-Mail Unsubscribe Link\n" . "%link% will be replaced to actual unsubscribe URL")); $this->setDefault('unsubscribe_html', Am_Mail::UNSUBSCRIBE_HTML); $fs->addTextarea('unsubscribe_txt', array('class' => 'el-wide', 'rows'=>6), array('help-id' => '#Miscellaneous_Email_Settings')) ->setLabel(___("Text E-Mail Unsubscribe Link\n" . "%link% will be replaced to actual unsubscribe URL")); $this->setDefault('unsubscribe_txt', Am_Mail::UNSUBSCRIBE_TXT); $fs->addAdvCheckbox('disable_unsubscribe_block', null, array('help-id' => '#Miscellaneous_Email_Settings')) ->setLabel(___('Do not Show Unsubscribe Block on Member Page')); $fs->addText('copy_admin_email', array('class' => 'el-wide'), array('help-id' => '#Miscellaneous_Email_Settings')) ->setLabel(___("Send Copy of All Admin Notifications\n" . 'will be used to send copy of email notifications to admin ' . 'you can specify more then one email separated by comma: ' . 'test@email.com,test1@email.com,test2@email.com')) ->addRule('callback', 'Please enter valid e-mail address', array('Am_Validate', 'emails')); } function haveCronRebillPlugins() { foreach(Am_Di::getInstance()->plugins_payment->getAllEnabled() as $p) { if($p->getRecurringType() == Am_Paysystem_Abstract::REPORTS_CRONREBILL) return true; } } function haveStoreCreditCardPlugins() { foreach(Am_Di::getInstance()->plugins_payment->getAllEnabled() as $p) { if($p->storesCcInfo()) return true; } } } class Am_Form_Setup_Pdf extends Am_Form_Setup { function __construct() { parent::__construct('pdf'); $this->setTitle(___('PDF Invoice')) ->setComment(''); $this->data['help-id'] = 'Setup/PDF Invoice'; $info = ___('You can find info regarding pdf invoice customization %shere%s', '', ''); $this->addProlog(<<$info CUT ); } function initElements() { $this->addAdvCheckbox('send_pdf_invoice', null, array('help-id' => '#Enabling_PDF_Invoices')) ->setLabel(___("Enable PDF Invoice")); $g = $this->addGroup() ->setLabel(___('Display Options')) ->setSeparator('
'); $g->addAdvCheckbox('pdf_invoice_sent_user', null, array('content' => ___('Attach invoice file (.pdf) to Payment Receipt to User'))); $g->addAdvCheckbox('pdf_invoice_sent_admin', null, array('content' => ___('Attach invoice file (.pdf) to Payment Receipt to Admin'))); $g->addAdvCheckbox('pdf_invoice_link', null, array('content' => ___('Allow user to download PDF invoice in his account'))); $this->addText('invoice_filename', array('size'=>30, 'class' => 'el-wide')) ->setLabel(___("Filename for Invoice\n" . '%public_id% will be replaced with real public id of invoice, %receipt_id% will be replaced with payment receipt, ' . 'also you can use the following placehoders %payment.date%, %user.name_f%, %user.name_l%')); $this->setDefault('invoice_filename', 'amember-invoice-%public_id%.pdf'); $this->addAdvRadio('invoice_format', null, array('help-id' => '#PDF_Invoice_Format')) ->setLabel(___('Paper Format')) ->loadOptions(array( Am_Pdf_Invoice::PAPER_FORMAT_LETTER => ___('USA (Letter)'), Am_Pdf_Invoice::PAPPER_FORMAT_A4 => ___('European (A4)') )); $this->setDefault('invoice_format', Am_Pdf_Invoice::PAPER_FORMAT_LETTER); $this->addAdvcheckbox('invoice_include_access') ->setLabel(___('Include Access Periods to PDF Invoice')); if (Am_Di::getInstance()->plugins_tax->getEnabled()) { $this->addAdvcheckbox('invoice_always_tax') ->setLabel(___('Show Tax even it is 0')); } $this->addAdvcheckbox('invoice_do_not_include_terms') ->setLabel(___('Do not Include Subscription Terms to PDF Invoice')); $this->addAdvcheckbox('different_invoice_for_refunds') ->setLabel(___("Display Separate Invoice for Refunds\n". "Setting affect aMember Control Panel only. User will see regular invoice which includes refund information inside")); $upload = $this->addUpload('invoice_custom_template', array(), array('prefix'=>'invoice_custom_template', 'help-id' => '#PDF_Invoice_Template') )->setLabel(___('Custom PDF Template for Invoice (optional)') )->setAllowedMimeTypes(array( 'application/pdf' )); $this->setDefault('invoice_custom_template', ''); $upload->setJsOptions(<<0); jQuery('fieldset#template-generated-settings').toggle(filesCount==0); } } CUT ); $fsCustom = $this->addFieldset('template-custom') ->setLabel(___('Custom Template Settings')) ->setId('template-custom-settings'); $this->setDefault('invoice_skip', 150); $fsCustom->addText('invoice_skip') ->setLabel(___( "Top Margin\n". "How much [pt] skip from top of template before start to output invoice\n". "1 pt = 0.352777 mm")); $fsGenerated = $this->addFieldset('template-generated') ->setLabel(___('Auto-generated Template Settings')) ->setId('template-generated-settings'); $invoice_logo = $fsGenerated->addUpload('invoice_logo', array(), array('prefix'=>'invoice_logo', 'help-id' => '#Company_Logo_for_Invoice') )->setLabel(___("Company Logo for Invoice\n". "it must be png/jpeg/tiff file")) ->setAllowedMimeTypes(array( 'image/png', 'image/jpeg', 'image/tiff' )); $this->setDefault('invoice_logo', ''); $fsGenerated->addTextarea('invoice_contacts', array ( 'rows' => 5, 'class' => 'el-wide' ), array('help-id' => '#Invoice_Contact_Information')) ->setLabel(___("Invoice Contact information\n" . "included at top, use <br> for new line")); $fsGenerated->addTextarea('invoice_footer_note', array ( 'rows' => 5, 'class' => 'el-wide' ), array('help-id' => '#Invoice_Footer_Note')) ->setLabel(___("Invoice Footer Note\n" . "This text will be included at bottom to PDF Invoice. " . "You can use all user specific placeholders here ". "eg. %user.login%, %user.name_f%, %user.name_l% etc.")); $script = << 0; jQuery('fieldset#template-custom-settings').toggle(show); jQuery('fieldset#template-generated-settings').toggle(!show); } jQuery('input[name=send_pdf_invoice]').change(function(){ if (!this.checked) { jQuery(this).closest('.row').nextAll().not('script').hide() jQuery(this).closest('form').find('input[type=submit]').closest('.row').show(); } else { jQuery(this).closest('.row').nextAll().not('script').show(); change_template_type(jQuery('input[name=invoice_custom_template]:enabled').last()); } }).change(); }); })(jQuery) CUT; $this->addScript()->setScript($script); $gr = $this->addAdvFieldset('invoice_custom_font') ->setLabel(___('Advanced')); $gr->addUpload('invoice_custom_ttf', array(), array('prefix'=>'invoice_custom_ttf') )->setLabel(___("Custom Font for Invoice (optional)\n". "Useful for invoices with non-Latin symbols " . "when there is a problem with displaying such symbols in the PDF invoice. " . "Please upload .ttf file only.")); $this->setDefault('invoice_custom_ttf', ''); $gr->addUpload('invoice_custom_ttfbold', array(), array('prefix'=>'invoice_custom_ttfbold') )->setLabel(___("Custom Bold Font for Invoice (optional)\n". "Useful for invoices with non-Latin symbols " . "when there is a problem with displaying such symbols in the PDF invoice." . "Please upload .ttf file only.")); $this->setDefault('invoice_custom_ttfbold', ''); } } class Am_Form_Setup_VideoPlayer extends Am_Form_Setup { function __construct() { parent::__construct('video-player'); $this->setTitle(___('Video Player')) ->setComment(''); } function initElements() { $this->setupElements($this, 'flowplayer.'); $this->setDefault('flowplayer.logo_postion', 'top-right'); $this->setDefault('flowplayer.cc_postion', 'top'); $this->setDefault('flowplayer.width', 520); $this->setDefault('flowplayer.height', 330); $this->setDefault('flowplayer.autoBuffering', 0); $this->setDefault('flowplayer.bufferLength', 3); $this->setDefault('flowplayer.autoPlay', 1); $this->setDefault('flowplayer.scaling', 'scale'); } public function setupElements(Am_Form $form, $prefix = null) { $form->addUpload($prefix . 'logo_id', null, array('prefix' => 'video-poster')) ->setLabel(___("Logo Image\n" . "watermark on video")); $form->addAdvRadio($prefix . 'logo_position') ->setLabel(___('Logo Position')) ->loadOptions(array( 'top-right' => ___('Top Right'), 'top-left' => ___('Top Left'), 'bottom-right' => ___('Bottom Right'), 'bottom-left' => ___('Bottom Left') )); $form->addAdvRadio($prefix . 'cc_position') ->setLabel(___('Closed Caption Position')) ->loadOptions(array( 'top' => ___('Top'), 'bottom' => ___('Bottom') )); $form->addUpload($prefix . 'poster_id', null, array('prefix' => 'video-poster')) ->setLabel(___("Poster Image\n" . "default poster image")); $gr = $form->addGroup() ->setLabel(___("Default Size\n" . "width×height")); $gr->addText($prefix . 'width', array('size' => 4)); $gr->addStatic()->setContent(' × '); $gr->addText($prefix . 'height', array('size' => 4)); $form->addSelect($prefix . 'autoPlay') ->setLabel(___("Auto Play\n" . 'whether the player should start playback immediately upon loading')) ->loadOptions(array( 0 => ___('No'), 1 => ___('Yes') )); $form->addSelect($prefix . 'autoBuffering') ->setLabel(___("Auto Buffering\n" . 'whether loading of clip into player\'s memory should begin ' . 'straight away. When this is true and autoPlay is false then ' . 'the clip will automatically stop at the first frame of the video.')) ->loadOptions(array( 0 => ___('No'), 1 => ___('Yes') )); $form->addInteger($prefix . 'bufferLength') ->setLabel(___("Buffer Length\n" . 'The amount of video data (in seconds) which should be loaded ' . 'into Flowplayer\'s memory in advance of playback commencing.')); $form->addSelect($prefix . 'scaling') ->setLabel(___("Scaling\n" . "Setting which defines how video is scaled on the video screen. Available options are:\n" . "fit: Fit to window by preserving the aspect ratio encoded in the file's metadata.\n" . "half: Half-size (preserves aspect ratio)\n" . "orig: Use the dimensions encoded in the file. " . "If the video is too big for the available space, the video is scaled using the 'fit' option.\n" . "scale: Scale the video to fill all available space. ". "Ignores the dimensions in the metadata. This is the default setting.")) ->loadOptions(array( 'fit' => 'fit', 'half' => 'half', 'orig' => 'orig', 'scale' => 'scale' )); } } class Am_Form_Setup_Advanced extends Am_Form_Setup { function __construct() { parent::__construct('advanced'); $this->setTitle(___('Advanced')) ->setComment(''); $this->data['help-id'] = 'Setup/Advanced'; } function checkBackupEmail($val) { $res = $val['email_backup_frequency'] ? Am_Validate::email($val['email_backup_address']) : true; if (!$res) { $elements = $this->getElementsByName('email_backup_address'); $elements[0]->setError(___('This field is required')); } return $res; } function initElements() { $this->addAdvCheckbox('use_cron', null, array('help-path' => 'Cron')) ->setLabel(___('Use External Cron')); $gr = $this->addGroup(null, null, array('help-id' => '#Configuring_Advanced_Settings'))->setLabel(array( ___('Maintenance Mode'), ___('put website offline, making it available for admins only'))); $gr->setSeparator(' '); $gr->addCheckbox('', array('id' => 'maint_checkbox', 'data-text' => ___('Site is temporarily disabled for maintenance'))); $gr->addTextarea('maintenance', array('id' => 'maint_textarea', 'rows'=>3, 'cols'=>80)); $gr->addScript()->setScript(<<addGroup(null, null, array('help-id'=>'#Configuring_Advanced_Settings'))->setLabel(___("Clear Access Log")); $gr->addAdvCheckbox('clear_access_log', null, array('help-id' => '#Configuring_Advanced_Settings')); $gr->addStatic()->setContent(sprintf(' %s ', ___("after"))); $gr->addText('clear_access_log_days', array('class'=>'clear_access_log_days', 'size' => 4)); $gr->addStatic()->setContent(sprintf(' %s ', ___("days"))); $this->setDefault('clear_access_log_days', 7); $this->addScript()->setScript(<<addGroup()->setLabel(___('Clear Incomplete Invoices')); $gr->addAdvCheckbox('clear_inc_payments'); $gr->addStatic()->setContent(sprintf(' %s ', ___("after"))); $gr->addInteger('clear_inc_payments_days', array('class'=>'clear_inc_payments_days', 'size'=>4)); $gr->addStatic()->setContent(sprintf(' %s ', ___("days"))); $this->setDefault('clear_inc_payments_days', 7); $this->addScript()->setScript(<<addGroup()->setLabel(___('Clear Incomplete Users')); $gr->addAdvCheckbox('clear_inc_users'); $gr->addStatic()->setContent(sprintf(' %s ', ___("after"))); $gr->addInteger('clear_inc_users_days', array('class'=>'clear_inc_users_days', 'size'=>4)); $gr->addStatic()->setContent(sprintf(' %s ', ___("days"))); $this->setDefault('clear_inc_users_days', 7); $this->addScript()->setScript(<<setDefault('multi_title', ___('Membership')); $this->addText('multi_title', array('class' => 'el-wide'), array('help-id' => '#Configuring_Advanced_Settings')) ->setLabel(___("Multiple Order Title\n". "when user ordering multiple products,\n". "display the following on payment system\n". "instead of product name")); if (!Am_Di::getInstance()->modules->isEnabled('cc')) { $fs = $this->addFieldset('##3') ->setLabel(___('E-Mail Database Backup')); $fs->addSelect('email_backup_frequency', null, array('help-id' => '#Enabling.2FDisabling_Email_Database_Backup')) ->setLabel(___('Email Backup Frequency')) ->setId('select-email-backup-frequency') ->loadOptions(array( '0' => ___('Disabled'), 'd' => ___('Daily'), 'w' => ___('Weekly') )); $di = Am_Di::getInstance(); $backUrl = $di->rurl("backup/cron/k/{$di->security->siteHash('backup-cron', 10)}"); $text = ___('It is required to setup a cron job to trigger backup generation'); $html = << CUT; $fs->addHtml('email_backup_note')->setHtml($html); $fs->addText('email_backup_address') ->setLabel(___('E-Mail Backup Address')); $this->addRule('callback', ___('Email is required if you have enabled Email Backup Feature'), array($this, 'checkBackupEmail')); $script = <<addScript()->setScript($script); } $fs = $this->addFieldset() ->setLabel(___('Manually Approve')); $fs->addAdvCheckbox('manually_approve', null, array('help-id' => '#Configuring_Advanced_Options')) ->setLabel(___("Manually Approve New Users\n" . "manually approve all new users (first payment)\n" . "don't enable it if you have huge users base already\n" . "- all old members become not-approved")); $fs->addElement('email_link', 'manually_approve', array('rel'=>'manually_approve'), array('help-id' => '#Configuring_Advanced_Options')) ->setLabel(___('Require Approval Notification to User (New Signup)')); $fs->addElement('email_link', 'manually_approve_admin', array('rel'=>'manually_approve'), array('help-id' => '#Configuring_Advanced_Options')) ->setLabel(___('Require Approval Notification to Admin (New Signup)')); $fs->addAdvCheckbox('manually_approve_invoice', null, array('help-id' => '#Configuring_Advanced_Options')) ->setLabel(___("Manually Approve New Invoices\n" . 'manually approve all new invoices')); $maPc = array(); foreach (Am_Di::getInstance()->productCategoryTable->getAdminSelectOptions() as $id => $title) { $maPc['c' . $id] = $title; } if ($maPc) { $maOptions = array( ___('Products') => Am_Di::getInstance()->productTable->getOptions(), ___('Product Categories') => $maPc ); } else { $maOptions = Am_Di::getInstance()->productTable->getOptions(); } $fs->addMagicSelect('manually_approve_invoice_products', array('rel'=>'manually_approve_invoice'), array('help-id' => '#Configuring_Advanced_Options')) ->setLabel(___("Require Approval Only if Invoice has these Products (Invoice)\n" . 'By default each invoice will be set as "Not Approved" ' . 'although you can enable this functionality only for selected products')) ->loadOptions($maOptions); $fs->addElement('email_link', 'invoice_approval_wait_admin', array('rel'=>'manually_approve_invoice'), array('help-id' => '#Configuring_Advanced_Options')) ->setLabel('Require Approval Notification to Admin (Invoice)'); $fs->addElement('email_link', 'invoice_approval_wait_user', array('rel'=>'manually_approve_invoice'), array('help-id' => '#Configuring_Advanced_Options')) ->setLabel('Require Approval Notification to User (Invoice)'); $fs->addElement('email_link', 'invoice_approved_user', array('rel'=>'manually_approve_invoice'), array('help-id' => '#Configuring_Advanced_Options')) ->setLabel(___('Invoice Approved Notification to User (Invoice)')); $fs->addTextarea('manually_approve_note', array('rows' => 8, 'class' => 'el-wide')) ->setId('form-manually_approve_note') ->setLabel(___("Manually Approve Note (New Signup/Invoice)\n" . 'this message will be shown for customer after purchase. ' . 'you can use html markup here')); $this->setDefault('manually_approve_note', <<IMPORTANT NOTE: We review all new payments manually, so your payment is under review currently.
You will get email notification after payment will be approved by admin. We are sorry for possible inconvenience. CUT ); $fs->addScript()->setScript(<< 0); }).change(); jQuery("#manually_approve_invoice-0").change(function(){ jQuery("[rel=manually_approve_invoice]").closest(".row").toggle(this.checked); }).change(); jQuery("#manually_approve-0").change(function(){ jQuery("[rel=manually_approve]").closest(".row").toggle(this.checked); }).change(); }); CUT ); $fs = $this->addFieldset('##5') ->setLabel(___('Miscellaneous')); $fs->addAdvCheckbox('dont_check_updates', null, array('help-id' => '#Configuring_Advanced_Options')) ->setLabel(___("Disable Checking for aMember Updates")); $fs->addAdvCheckbox('signup_disable') ->setLabel(___("Disable New Signups")); $fs->addAdvCheckbox('product_paysystem') ->setLabel(___("Assign Paysystem to Product")); $fs->addAdvCheckbox('am3_urls', null, array('help-id' => '#Configuring_Advanced_Options')) ->setLabel(___("Use aMember3 Compatible Urls\n". "Enable old style urls (ex.: signup.php, profile.php)\n". "Usefull only after upgrade from aMember v3 to keep old links working.\n" )); $fs->addAdvCheckbox('allow_coupon_upgrades') ->setLabel(___("Allow usage of coupons for %sUpgrade paths%s", '', '')); $fs->addAdvCheckbox('allow_restore') ->setLabel(___("Allow resume cancelled recurring subscription")); $fs->addAdvCheckbox('allow_cancel') ->setLabel(___("Allow cancel recurring subscription from user account")); if(!ini_get('suhosin.session.encrypt')) { $fs->addSelect('session_storage', null, array('help-id' => '#Configuring_Advanced_Options')) ->setLabel(___("Session Storage")) ->loadOptions(array( 'db' => ___('aMember Database (default)'), 'php' => ___('Standard PHP Sessions'), )); } else { $fs->addHTML('session_storage') ->setLabel(___('Session Storage')) ->setHTML(''.___('Standard PHP Sessions').' '.___("Can't be changed because your server have suhosin extension enabled").""); } } } class Am_Form_Setup_Loginpage extends Am_Form_Setup { function __construct() { parent::__construct('loginpage'); $this->setTitle(___('Login Page')); $this->data['help-id'] = 'Setup/Login_Page'; } function initElements() { $gr = $this->addGroup(null, null, array('help-id' => '#Login_Page_Options')) ->setLabel(___("Redirect After Login\n". "where customer redirected after successful\n". "login at %s", ''.Am_Di::getInstance()->url('login') . '')); $sel = $gr->addSelect('protect.php_include.redirect_ok', array('size' => 1, 'id' => 'redirect_ok-sel'), array('options' => array( 'first_url' => ___('First available protected url'), 'last_url' => ___('Last available protected url'), 'single_url' => ___('If only one protected URL, go directly to the URL. Otherwise go to membership page'), 'member' => ___('Membership Info Page'), 'url' => ___('Fixed Url'), 'referer' => ___('Page Where Log In Link was Clicked'), ))); $gr->setSeparator(' '); $txt = $gr->addText('protect.php_include.redirect_ok_url', array('size' => 40, 'style'=>'display:none', 'id' => 'redirect_ok-txt')); $this->setDefault('protect.php_include.redirect_ok_url', ROOT_URL); $gr->addScript()->setScript(<<addGroup(null, null, array('help-id' => '#Login_Page_Options')) ->setLabel(___('Redirect After Logout')); $gr->setSeparator(' '); $gr->addSelect('protect.php_include.redirect_logout') ->setId('redirect_logout') ->loadOptions(array( 'home' => ___('Home Page'), 'url' => ___('Fixed Url'), 'referer' => ___('Page Where Logout Link was Clicked') )); $gr->addText('protect.php_include.redirect', 'size=40') ->setId('redirect'); $gr->addScript()->setScript(<<addAdvCheckbox('protect.php_include.remember_login', null, array('help-id' => '#Login_Page_Options')) ->setId('remember-login') ->setLabel(___("Remember Login\n". "remember username/password in cookies")); $this->addAdvCheckbox('protect.php_include.remember_auto', array('rel' => 'remember-login'), array('help-id' => '#Login_Page_Options')) ->setLabel(___("Always Remember\n". "if set to Yes, don't ask customer - always remember")); $this->setDefault('protect.php_include.remember_period', 60); $this->addInteger('protect.php_include.remember_period', array('rel' => 'remember-login'), array('help-id' => '#Login_Page_Options')) ->setLabel(___("Remember Period\n" . "cookie will be stored for ... days")); $this->addScript() ->setScript(<<addGroup(); $gr->setSeparator(' '); $gr->setLabel(___("Force Change Password\n" . "ask user to change password every XX days")); $gr->addAdvCheckbox('force_change_password', array('id' => 'force_change_password')) ->setLabel(___('Force Change Password')); $gr->addStatic()->setContent('' . ___('every')); $gr->addText('force_change_password_period', array('placeholder' => 30, 'size'=>3)); $gr->addStatic()->setContent(___('days') . ''); $gr->addScript() ->setScript(<<addAdvCheckbox('auto_login_after_signup', null, array('help-id' => '#Login_Page_Options')) ->setLabel(___('Automatically Login Customer After Signup')); $this->setDefault('login_session_lifetime', 120); $this->addInteger('login_session_lifetime', null, array('help-id' => '#Login_Page_Options')) ->setLabel(___("User Session Lifetime (minutes)\n". "default - 120")) ->addRule('regex', ___('Please specify number greater then zero'), '/^[1-9][0-9]*$/'); $gr = $this->addGroup(null, null, array('help-id' => '#Account_Sharing_Prevention')) ->setLabel(___("Account Sharing Prevention")); $gr->addStatic()->setContent('
'); $gr->addStatic()->setContent(___('if customer uses more than') . ' '); $gr->addInteger('max_ip_count', array('size' => 4)); $gr->addStatic()->setContent(' ' . ___('IP within') . ' '); $gr->addInteger('max_ip_period', array('size' => 5)); $gr->addStatic()->setContent(' ' . ___('minutes %sdeny access for user%s and do the following', '', '')); $gr->addStatic()->setContent('

'); $ms = $gr->addMagicSelect('max_ip_actions') ->loadOptions(array ( 'disable-user' => ___('Disable Customer Account'), 'email-admin' => ___('Email Admin Regarding Account Sharing'), 'email-user' => ___('Email User Regarding Account Sharing'), )); $ms->setJsOptions('{onChange:function(val){ jQuery("#max_ip_actions_admin").toggle(val.hasOwnProperty("email-admin")); jQuery("#max_ip_actions_user").toggle(val.hasOwnProperty("email-user")); }}'); $gr->addStatic()->setContent('
'); $gr->addStatic()->setContent(''); $gr->addSelect('max_ip_octets')->loadOptions(array( 0 => ___('Count all IP as different'), 1 => ___('Use first %d IP address octets to determine different IP (%s)', 3, '123.32.22.xx'), 2 => ___('Use first %d IP address octets to determine different IP (%s)', 2, '123.32.xx.xx'), 3 => ___('Use first %d IP address octets to determine different IP (%s)', 1, '123.xx.xx.xx'), )); $gr->addStatic()->setContent('
'); $gr = $this->addGroup(null, null, array('help-id' => '#Bruteforce_Protection')) ->setLabel(___('Bruteforce Protection')); $gr->addStatic()->setContent('
'); $this->setDefault('bruteforce_count', '5'); $gr->addStatic()->setContent(___('if user enters wrong password') . ' '); $gr->addInteger('bruteforce_count', array('size' => 4)); $gr->addStatic()->setContent(' ' . ___('times within') . ' '); $this->setDefault('bruteforce_delay', '120'); $gr->addInteger('bruteforce_delay', array('size'=>5)); $gr->addStatic()->setContent(' ' . ___('seconds, he will be forced to wait until next try')); $gr->addStatic()->setContent('
'); $this->addElement('email_checkbox', 'bruteforce_notify') ->setLabel(___("Bruteforce Notification\n". "notify admin when bruteforce attack is detected")); if (Am_Recaptcha::isConfigured()) { $this->addAdvCheckbox('recaptcha') ->setLabel(___("Enable ReCaptcha\n". "on login and restore password forms")); } else { $label = Am_Html::escape(___('Configure ReCaptcha to Enable this Option')); $url = $this->getDi()->url('admin-setup/recaptcha'); $this->addHtml() ->setLabel(___("Enable ReCaptcha\n". "on login and restore password forms")) ->setHtml(<<$label CUT ); } $this->addElement('advcheckbox', 'skip_index_page') ->setLabel(___("Skip Index Page if User is Logged-in\n" . 'When logged-in user try to access /amember/index page, he will be redirected to /amember/member')) ->setId('skip-index-page'); $this->addSelect('index_page') ->setLabel(___("Index Page\n" . "%sthis page will be public and do not require any login/password%s\n" . 'you can create new pages %shere%s', '', '', '', '')) ->loadOptions(array(''=> '** ' . ___('Default Index Page'), '-1' => '** ' . ___('Login Page')) + Am_Di::getInstance()->db->selectCol("SELECT page_id AS ?, title FROM ?_page", DBSIMPLE_ARRAY_KEY)) ->setId('index-page'); $this->addAdvCheckbox('other_domains_redirect') ->setLabel(___("Allow Redirects to Other Domains\n". "By default aMember does not allow to redirect to foreign domain names via 'amember_redirect_url' parameter.\n". "These redirects are only allowed for urls within your domain name.\n". "This is restricted to avoid potential security issues.\n" )); $this->addSelect('video_non_member') ->setLabel(___("Video for Non User\n" . 'this video will be shown instead of actual video in case of ' . 'non-user try to access protected video content. %sThis video ' . 'will be public and do not require any login/password%s. ' . 'You can add new video %shere%s', '', '', '', '')) ->loadOptions(array(''=>___('Show Error Message')) + Am_Di::getInstance()->db->selectCol("SELECT video_id AS ?, title FROM ?_video", DBSIMPLE_ARRAY_KEY)); $this->addSelect('video_not_proper_level') ->setLabel(___("Video for User without Proper Membership Level\n" . "this video will be shown instead of actual video in case of " . "user without proper access try to access protected video " . "content. %sThis video will be public and do not require any login/password%s. " . "You can add new video %shere%s", '', '', '', '')) ->loadOptions(array(''=>___('Show Error Message')) + Am_Di::getInstance()->db->selectCol("SELECT video_id AS ?, title FROM ?_video", DBSIMPLE_ARRAY_KEY)); $this->addAdvCheckbox('allow_auth_by_savedpass') ->setLabel(___("Allow to Use Password Hash from 3ty part Scripts to Authenticate User in aMember\n" . "you need to enable this option only if you imported users from 3ty part script without known plain text password")); } } class Am_Form_Setup_Language extends Am_Form_Setup { function __construct() { parent::__construct('language'); $this->setTitle(___('Languages')); $this->data['help-id'] = 'Setup/Languages'; } function initElements() { $this->addAdvCheckbox('lang.display_choice', null, array('help-id' => '#Enabling.2FDisabling_Language_Choice_Option')) ->setLabel(___('Display Language Choice')); $list = Am_Di::getInstance()->languagesListUser; $this->setDefault('lang.default', 'en'); $this->addSelect('lang.default', array('class' => 'am-combobox'), array('help-id' => '#Selecting.2FEditing_Default_Language')) ->setLabel(___('Default Locale')) ->loadOptions($list); $this->addSortableMagicSelect('lang.enabled', array('class' => 'am-combobox'), array('help-id' => '#Selecting_Languages_to_Offer')) ->setLabel(___("Available Locales\ndefines both language and date/number formats, default locale is always enabled")) ->loadOptions($list); $formats = array(); foreach (array( "M j, Y", "j M Y", "F j, Y", "Y-m-d", "m/d/Y", "m/d/y", "d/m/Y", "d/m/y" ) as $f) { $formats[$f] = date($f); } $this->addAdvRadio('date_format') ->setLabel(___('Date Format')) ->loadOptions(array('' => ___('Use Locale Preference')) + $formats); $formats = array(); foreach (array( "g:i a", "g:i A", "H:i" ) as $f) { $formats[$f] = date($f); } $this->addAdvRadio('time_format') ->setLabel(___('Time Format')) ->loadOptions(array('' => ___('Use Locale Preference')) + $formats); } public function beforeSaveConfig(Am_Config $before, Am_Config $after) { $enabled = $after->get('lang.enabled'); $default = $after->get('lang.default'); if (!in_array($default, $enabled)) { $enabled[] = $default; $after->set('lang.enabled', $enabled); } } } class Am_Form_Setup_Theme extends Am_Form_Setup { protected $themeId; public function __construct($themeId) { $this->themeId = $themeId; parent::__construct('themes-'.$themeId); } public function prepare() { parent::prepare(); $this->addFieldsPrefix('themes.'.$this->themeId.'.'); } } class Am_Form_Setup_Recaptcha extends Am_Form_Setup { function __construct() { parent::__construct('recaptcha'); $this->setTitle(___('reCAPTCHA')); } function initElements() { $this->addText("recaptcha-public-key", array('class'=>'el-wide'), array('help-id' => 'Setup/ReCaptcha')) ->setLabel("reCAPTCHA Site key\n" . "you can get it in your account on reCAPTCHA site, you may need to sign up (it is free) if you have no account yet") ->addRule('required', ___('This field is required')); $this->addText("recaptcha-private-key", array('class'=>'el-wide'), array('help-id' => 'Setup/ReCaptcha')) ->setLabel("reCAPTCHA Secret key\n" . "you can get it in your account on reCAPTCHA site, you may need to sign up (it is free) if you have no account yet") ->addRule('required', ___('This field is required')); $this->addAdvRadio('recaptcha-theme') ->loadOptions(array( 'light' => 'light', 'dark' => 'dark' ))->setLabel(___('reCAPTCHA Theme')); $this->addAdvRadio('recaptcha-size') ->loadOptions(array( 'normal' => 'normal', 'compact' => 'compact' ))->setLabel(___('reCAPTCHA Size')); $this->setDefault('recaptcha-size', 'normal'); $this->setDefault('recaptcha-theme', 'light'); } function getReadme() { return <<reCAPTCHA configuration Complete instructions can be found here: http://www.amember.com/docs/Setup/ReCaptcha Use Forms Editor in order to add reCAPTCHA field to signup/renewal page: %root_url%/admin-saved-form CUT; } }ProtectDatabased.php000064400000050421152101630240010462 0ustar00getId()); $this->setTitle($plugin->getTitle()); $this->plugin = $plugin; $url = $this->getDi()->url('default/admin-content/p/integrations/index'); $text = ___("Once the plugin configuration is finished on this page, do not forget to add\n". "a record on %saMember CP -> Protect Content -> Integrations%s page", '', ''); $this->addProlog(<< $text CUT ); } /** @return Am_Protect_Databased */ public function getPlugin() { return $this->plugin; } public function initElements() { parent::initElements(); if(method_exists($this->plugin, "parseExternalConfig") && !$this->plugin->isConfigured()) $this->addFolderSelect(); $this->addOtherDb(); $this->addDbPrefix(); $this->addGroupSettings(); if ($this->plugin->canAutoCreate()&&$this->plugin->isConfigured()) { $gr = $this->addGroup()->setLabel(___("Create aMember Users By Demand\n". "silently create customer in aMember if\n". "user tries to login into aMember with\n". "the same username and password as for %s", $this->getTitle())); $el = $gr->addAdvCheckbox('auto_create'); $auto_create_id = $el->getId(); $options = array('' => ___('Please Select')); if ($this->plugin->canAutoCreateFromGroups()) $options['-1'] = ___('Add Access depends on current user\'s groups in '.$this->plugin->getTitle()); foreach (Am_Di::getInstance()->billingPlanTable->selectAllSorted() as $p) try { $k = $p->product_id.'_'.$p->plan_id; $v = $p->getProduct()->title; $v .= ' ('.$p->getTerms().')'; $options[$k] = $v; } catch (Exception $e){}; $el = $gr->addSelect("auto_create_billing_plan") ->setLabel(___("Default Level\n". "users created by demand\n". "will have access to the sele\n". "(for example all subscriptions expired)")) ->loadOptions($options); $auto_create_billing_plan_id = $el->getId(); $el = $gr->addStatic("auto_create_billing_plan_text")->setContent('
'. ___('please select billing plan to add manual access to users added by demand'). '
'); $auto_create_billing_plan_text_id = $el->getId(); if ($this->plugin->canAutoCreateFromGroups()) { //$group_plans = $gr->addGroup('auto_create_bpgroups'); $group_plans = $gr; unset($options['-1']); $group_plans->addStatic()->setContent('
'); try { foreach($this->plugin->getAvailableUserGroups() as $g) { $group_plans->addStatic()->setContent('
'.$g->getTitle().'
'); $group_plans->addElement('select',"auto_create_bpgroups_".$g->getId())->loadOptions($options); $group_plans->addStatic()->setContent('

'); } } catch (Am_Exception_Db $e){ // to avoid errors while db is not yet configured } $group_plans->addStatic()->setContent('
'); } $this->addScript('script_auto_create')->setScript(<<addFieldsPrefix("protect.{$this->pageId}."); $this->addScript('script')->setScript($this->getJs()); if (defined($const = get_class($this->plugin)."::PLUGIN_STATUS") && (constant($const) == Am_Plugin::STATUS_BETA || constant($const) == Am_Plugin::STATUS_DEV)) { $beta = (constant($const) == Am_Plugin::STATUS_DEV) ? 'ALPHA' : 'BETA'; $this->addProlog("
This plugin is currently in $beta testing stage, some functions may work unstable.". "Please test it carefully before use.
"); } $this->plugin->afterAddConfigItems($this); } public function ajaxAction() { $arr = $this->getConfigValuesFromForm(); if(method_exists($this->plugin, "parseExternalConfig") && array_key_exists("path", $arr) && strlen($arr['path']) ){ // Try to get config values from third party script; $ret = array(); try{ $ret['data'] = call_user_func(array($this->plugin, "parseExternalConfig"), $arr['path']); }catch(Exception $e){ $ret['data'] = false; $ret['error'] = $e->getMessage(); } return print json_encode($ret); } $class = get_class($this->plugin); $obj = new $class(Am_Di::getInstance(), $arr); try { $db = $obj->getDb(); } catch (Am_Exception $e) { return print ___("Error") . " - " . preg_replace('/ at .+$/', '', $e->getMessage()); } return print ___("OK. Press 'Continue...' to refresh Database name autocompletion database"); } public function addFolderSelect(){ $title = $this->getTitle(); $fs = $this->addFieldset('script-path')->setLabel(___('Path to %s', $title)); $group = $fs->addGroup()->setLabel(___('Path to %s Folder', $title)); $path = $group->addText('path')->setAttribute('size', 50)->addClass('dir-browser'); $group->addStatic()->setContent('
'); $this->addScript('script')->setScript(' jQuery(function(){ jQuery(".dir-browser").dirBrowser(); jQuery("#check-path-container").hide(); jQuery("input[name$=\'_path\']").change(function(){ var parentForm = this.form; jQuery.ajax({ "url" : amUrl("/admin-setup/ajax"), "type" : "POST", "dataType" : "text", "data" : jQuery(this).parents("form").serialize(), "success" : function(data){ try { data = eval( "(" + data + ")" ); } catch (err) { jQuery("#check-path-container").html("Could not read config file due to PHP errors").show().css({color: "red"}); return flashError("Could not read config file due to PHP errors"); } if(!data.data){ jQuery("#check-path-container").html(data.error).show().css({color: "red"}); return flashError(data.error); } jQuery("#check-path-container").hide(); jQuery("input[name$=\'_other_db\']").prop("checked", true).change(); for(i in data.data){ var e = jQuery("input[name$=\'__"+i+"\'], select[name$=\'__"+i+"\']"); if(e.is(":checkbox")) e.prop("checked", (data.data[i] ? true : false)).change(); else e.val(data.data[i]); } jQuery("input[name$=\'__path\']").val(""); } }); }); }); '); return $fs; } public function addOtherDb() { $title = $this->getTitle(); $fs = $this->addFieldset('other-db')->setLabel(___('Use Database Connection other than configured for aMember')); $fs->addCheckbox("other_db") ->setLabel(___("Use another MySQL Db\n". "use custom host, user, password for %s database connection". "Usually you can leave this unchecked", $title)) ->setId('other-db'); $fs->addText("user", array('class'=>'other-db'))->setLabel(___('%s MySQL Username', $title)) ->setId('other-db-user'); $fs->addPassword("pass", array('class'=>'other-db'))->setLabel(___('%s MySQL Password', $title)) ->setId('other-db-pass'); $group = $fs->addGroup("")->setLabel(___('%s MySQL Hostname', $title)); $group->setSeparator(' '); $group->addText('host', array('class'=>'other-db')) ->setId('other-db-host'); $group->addInputButton('test-other-db', array('value' => ___('Test Settings'))); $group->addStatic()->setContent('
'); $this->addScript()->setScript(<<getTitle(); $fs = $this->addFieldset('db-prefix')->setLabel(___('%s database and tables prefix', $title)); $group = $fs->addGroup()->setLabel(___('%s Database name and Tables Prefix', $title)); $group->setSeparator(' '); $group->addText("db", array('class'=>'db-prefiix')) ->setId('db-name')->addRule('required', ___('this field is required')); $group->addText("prefix", array('class'=>'db-prefiix')) ->setId('db-prefix'); $group->addRule('callback2', '-error-', array($this, 'configCheckDbSettings')); try { $a = array(); foreach ($this->plugin->guessDbPrefix(Am_Di::getInstance()->db) as $v) { list($d,$p) = explode('.', $v, 2); $a[] = array('label'=>$v, 'value'=>$d); } if ($a) { $guessDb = json_encode((array)$a); $this->addScript('guess_db_script')->setScript(<<getValue() as $k => $v) if (($kk = str_replace($this->fieldsPrefix, '', $k, $count)) && $count) $arr[ $kk ] = $v; return $arr; } public function configCheckDbSettings() { $arr = $this->getConfigValuesFromForm(); $ret = $this->plugin->configCheckDbSettings($arr); if (!$ret) { $class = get_class($this->plugin); $this->plugin = new $class(Am_Di::getInstance(), $arr); if ($this->groupsNeedRefresh) $this->refreshGroupSettings(); } return $ret; } public function saveConfig() { if ($this->getElementById('group_settings_hidden-0')->getValue() == '1') return false; return parent::saveConfig(); } public function refreshGroupSettings() { if ($this->plugin->getGroupMode() != Am_Protect_Databased::GROUP_NONE) { try { $groups = $this->plugin->getAvailableUserGroups(); } catch (Am_Exception_Db $e){ // to avoid errors while db is not yet configured $groups = array(); $this->groupsNeedRefresh = true; } $adminGroups = array(); $bannedGroups = array(); $options = array(); foreach ($groups as $g) { $options[ $g->getId() ] = $g->getTitle(); if ($g->isAdmin()) $adminGroups[] = $g->getId(); if ($g->isBanned()) $bannedGroups[] = $g->getId(); } $this->getElementById('default_group-0')->loadOptions(array('' => ___('-- Please select --')) + $options); $this->getElementById('admin_groups-0')->loadOptions($options); $this->getElementById('banned_groups-0')->loadOptions($options); $dataSources = $this->getDataSources(); // must we check if such variables have been passed? array_unshift($dataSources, new HTML_QuickForm2_DataSource_Array($arr = array( // self::name2underscore($this->getElementById('default_group-0')->getName()) => $default, self::name2underscore($this->getElementById('admin_groups-0')->getName()) => $adminGroups, self::name2underscore($this->getElementById('banned_groups-0')->getName()) => $bannedGroups, ))); $this->setDataSources($dataSources); if ($groups) $this->groupsNeedRefresh = false; } } public function addGroupSettings() { $title = $this->getTitle(); $fs = $this->addFieldset('settings')->setLabel(___('%s Integration Settings', $title)); $fs->addHidden('group_settings_hidden')->setValue('0'); if ($this->plugin->getGroupMode() != Am_Protect_Databased::GROUP_NONE) { try { $groups = $this->plugin->getAvailableUserGroups(); } catch (Am_Exception_Db $e){ // to avoid errors while db is not yet configured $groups = array(); $this->groupsNeedRefresh = true; } $adminGroups = array(); $bannedGroups = array(); $options = array(); foreach ($groups as $g) { $options[ $g->getId() ] = $g->getTitle(); if ($g->isAdmin()) $adminGroups[] = $g->getId(); if ($g->isBanned()) $bannedGroups[] = $g->getId(); } $fs->addSelect("default_group") ->setLabel(___("Default Level\n". "default level - user reset to this access level\n". "if no active subscriptions exists\n". "(for example all subscriptions expired)")) ->loadOptions(array('' => '-- Please select --') + $options); // ->addRule('required', 'This field is required'); $fs->addMagicSelect("admin_groups") ->setLabel(___("Admin Groups\n". "aMember never touches %s accounts\n". "assigned to the following groups. This protects\n". "%s accounts against any aMember activity" , $title, $title . ' ' . ___('admin'))) ->loadOptions($options); $fs->addMagicSelect("banned_groups") ->setLabel(___("Banned Groups\n". "aMember never touches %s accounts\n". "assigned to the following groups. This protects\n". "%s accounts against any aMember activity" , $title, $title . ' ' . ___('banned'))) ->loadOptions($options); $fs->addSelect("locked_group") ->setLabel(___("Locked Group\n". "Whenever user is locked in aMember, \n" . "plugin adds user to this group in %s \n" . "Select any group with limited access which doesn't allow to login into %s\n" . "Some scripts have special group for this situations: 'Unregistered' or 'Guest'" , $title, $title)) ->loadOptions(array(''=>'-- Please select --')+$options); if($this->plugin->getGroupMode() == Am_Protect_Databased::GROUP_MULTI) $fs->addMagicSelect('super_groups') ->setLabel(___("Super Groups\n" . "aMember will not remove %s groups from user's account\n" . "This is useful if you add additional group to user in %s manually\n" . "and this group is not linked to any aMember product\n" . "If that additional group is not added to Super groups, \n" . "it will be removed when aMember updates user account", $title . ' '.___('super'), $title))->loadOptions($options); $fs->addElement(new Am_Form_Element_SortableList("priority")) ->loadOptions($options) ->setLabel(___("Groups Priority\n". "you may drag and drop groups to sort it.\n". "if there are several groups available for user\n". "aMember will choose groups that are higher\n". "in this list as \"Primary\"")); $fs->addScript()->setScript(<< -1; jQuery(this).prop("disabled", disabled ? true : null) .closest("li").toggle(!disabled); }); }).change(); }); CUT ); } $fs->addAdvCheckbox("remove_users") ->setLabel(___("Remove Users\n". "when user record removed from aMember\n". "must the related record be removed from %s", $title)); } public function getJs() { $continue = Am_Html::escape(___("Continue")); return <<0; if (isDbWrong) { db.parents("fieldset").nextUntil("#row-save-0").hide(); jQuery("#save-0").val("$continue..."); jQuery("input[name$='group_settings_hidden']").val("1"); } else { jQuery("input[name$='group_settings_hidden']").val("0"); } }); CUT; } }