예제 #1
0
파일: Plugin.php 프로젝트: grlf/eyedock
    function _afterInitSetupForm(Am_Form_Setup $form)
    {
        $url = Am_Controller::escape(REL_ROOT_URL) . '/default/admin-content/p/newsletter/index';
        $text = ___("Once the plugin configuration is finished on this page, do not forget to add\n" . "a record on %saMember CP -> Protect Content -> Newsletters%s page", '<a href="' . $url . '" target="_blank" class="link">', '</a>');
        $form->addProlog(<<<CUT
<div class="warning_box">
    {$text}
</div>
CUT
);
        if ($this->canGetLists()) {
            $lists = array();
            try {
                foreach ($this->getLists() as $k => $v) {
                    $lists[$k] = $v['title'];
                }
            } catch (Exception $e) {
                //just log
                $this->getDi()->errorLogTable->logException($e);
            }
            $gr = $form->addGroup()->setLabel(___('Unsubscribe customer from selected newsletter threads'));
            $gr->addSelect('unsubscribe_after_signup')->loadOptions(array('' => ___('Please Select'), self::UNSUBSCRIBE_AFTER_ADDED => ___('After the user has been added'), self::UNSUBSCRIBE_AFTER_PAID => ___('After first payment has been completed')));
            $gr->addStatic()->setContent('<br><br>');
            $gr->addMagicSelect('unsubscribe_after_signup_lists')->loadOptions($lists);
        }
        parent::_afterInitSetupForm($form);
    }
예제 #2
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));
 }
예제 #3
0
 protected function getContent($obj, Am_Grid_Editable $grid)
 {
     $id = $this->action->getIdForRecord($obj);
     $val = $obj->{$this->field->getFieldName()};
     list($url, $params) = $this->divideUrlAndParams($this->action->getUrl($obj, $id));
     $content = sprintf('<input name="%s" class="live-checkbox" data-url="%s" data-id="%d" data-params="%s" data-value="%s" data-empty_value="%s" type="checkbox" %s/>', Am_Controller::escape($grid->getId() . '_' . $this->field->getFieldName() . '-' . $grid->escape($id)), Am_Controller::escape($url), $id, Am_Controller::escape(Am_Controller::getJson($params)), Am_Controller::escape($this->action->getValue()), Am_Controller::escape($this->action->getEmptyValue()), $val == $this->action->getValue() ? 'checked ' : '');
     return $content;
 }
예제 #4
0
 public function renderLink(ResourceAbstract $resource)
 {
     $html = "";
     $url = $resource->getUrl();
     if (!empty($url)) {
         $html = sprintf('<a href="%s" target="_blank">%s</a>', Am_Controller::escape($url), ___('link'));
     }
     return $this->renderTd($html, false);
 }
예제 #5
0
    public function getReadme()
    {
        $ipn = Am_Controller::escape($this->getPluginUrl('ipn'));
        return <<<CUT
You need to enable 'Direct HTTP server-to-server request' on page 'Configuration -> Technical Information -> Transaction Feedback' in your ePDQ account
and set it to
<strong>{$ipn}</strong>
CUT;
    }
예제 #6
0
 function renderTable($kvRows)
 {
     $h = "<table class='logdetail'>\n";
     foreach ($kvRows as $k => $v) {
         $h .= sprintf("<tr><th>%s</th><td>%s</td></tr>\n", Am_Controller::escape($k), Am_Controller::escape($v));
     }
     $h .= "</table>\n";
     return $h;
 }
예제 #7
0
파일: MailEditor.php 프로젝트: grlf/eyedock
    protected function renderClientRules(HTML_QuickForm2_JavascriptBuilder $builder)
    {
        $id = Am_Controller::escape($this->editor->getId());
        $vars = "";
        foreach ($this->tagsOptions as $k => $v) {
            $vars .= sprintf("[%s, %s],\n", Am_Controller::getJson($v), Am_Controller::getJson($k));
        }
        $vars = trim($vars, "\n\r,");
        $builder->addElementJavascript(<<<CUT
\$(function(){
    \$('select#insert-tags').change(function(){
        var val = \$(this).val();
        if (!val) return;
        \$("#txt-0").insertAtCaret(val);
        \$(this).prop("selectedIndex", -1);
    });
            
    if (CKEDITOR.instances["{$id}"]) {
        delete CKEDITOR.instances["{$id}"];
    }
    var editor = null;
    \$("input[name='format']").change(function()
    {
        if (window.configDisable_rte) return;
        if (!this.checked) return;
        if (this.value == 'html')
        {
            if (!editor) {
                editor = initCkeditor("{$id}", { placeholder_items: [
                    {$vars}
                ], entities_greek: false});
            }
            \$('#insert-tags-wrapper').hide();
        } else {
            if (editor) {
                editor.destroy();
                editor = null;
            }
            \$('#insert-tags-wrapper').show();
        }
    }).change();
});            
CUT
);
    }
예제 #8
0
 function initElements()
 {
     $this->addElement('text', 'site_title', array('size' => 40), array('help-id' => '#Site Title'))->setLabel(___('Site Title'));
     $this->addElement('static', null, null, array('help-id' => '#Root Url and License Key'))->setContent('<div><a href="' . Am_Controller::escape(REL_ROOT_URL) . '/admin-license" target="_top">' . ___('change') . '</a></div>')->setLabel(___('Root Url and License Keys'));
     $this->addText('flowplayer_license')->setLabel(___("FlowPlayer License Key\nyou may get your key in %smembers area%s", '<a href="http://www.amember.com/amember/member?flowplayer_key=1">', '</a>'))->addRule('regex', ___('Value must be alphanumeric'), '/^[a-zA-Z0-9]*$/');
     $this->addElement('select', 'theme', null, array('help-id' => '#User Pages Theme'))->setLabel(___('User Pages Theme'))->loadOptions(Am_View::getThemes('user'));
     $this->addElement('select', 'admin_theme')->setLabel(___('Admin Pages Theme'))->loadOptions(Am_View::getThemes('admin'));
     /*
              if (!extension_loaded("curl")){
                  $el = $this->addElement('text', 'curl')
                      ->setLabel(___('cURL executable file location', "you need it only if you are using payment processors<br />
                      like Authorize.Net or PayFlow Pro<br />
                      usually valid path is /usr/bin/curl or /usr/local/bin/curl"));
                  $el->default = '/usr/bin/curl';
                  $el->addRule('callback2', 'error', array($this, 'validateCurl'));
              }
     */
     $fs = $this->addElement('fieldset', '##02')->setLabel(___('Signup Form Configuration'));
     //         $this->addElement('advcheckbox', 'generate_login')
     //             ->setLabel(___('Generate Login', 'should aMember generate username for customer?'));
     $this->setDefault('login_min_length', 5);
     $this->setDefault('login_max_length', 16);
     $loginLen = $fs->addGroup()->setLabel(___('Username length'));
     $loginLen->addInteger('login_min_length')->setLabel('min');
     $loginLen->addInteger('login_max_length')->setLabel('max');
     $fs->addElement('advcheckbox', 'login_disallow_spaces')->setLabel(___('Do not allow spaces in username'));
     $fs->addElement('advcheckbox', 'login_dont_lowercase')->setLabel(___("Do not lowercase username\n" . "by default, aMember automatically lowercases entered username\n" . "here you can disable this function"));
     //         $fs->addElement('advcheckbox', 'generate_pass')
     //             ->setLabel(___('Generate Password', 'should aMember generate password for customer?'));
     //
     $this->setDefault('pass_min_length', 6);
     $this->setDefault('pass_max_length', 25);
     $passLen = $fs->addGroup()->setLabel(___('Password Length'));
     $passLen->addInteger('pass_min_length')->setLabel('min');
     $passLen->addInteger('pass_max_length')->setLabel('max');
     $fs = $this->addElement('fieldset', '##03')->setLabel(___('Miscellaneous'));
     $this->setDefault('admin.records-on-page', 10);
     $fs->addElement('text', 'admin.records-on-page')->setLabel(___('Records per page (for grids)'));
     $this->setDefault('currency', 'USD');
     $currency = $fs->addElement('select', 'currency', array('size' => 1))->setLabel(___("Base Currency\n" . "base currency to be used for reports and affiliate commission.\n" . "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);
     }
 }
예제 #9
0
    public function __toString()
    {
        $output = sprintf('<div style="padding:0.5em"><h1>%s</h1><div class="grid-container"><table id="regional-tax-table" %s><tr><th>%s</th>
	<th>%s</th>
        <th>%s</th>
	<th>%s</th>
	<th>&nbsp;</th></tr>', ___('Configured Tax Values'), 'class="grid"', ___('Country'), ___('State'), ___('Zip'), ___('Tax Value'));
        $label_add = ___('Add');
        $output .= "<tr class='regional-tax-add'>" . "<td width='30%'><select id='regional-tax-country' size='1'><option/>" . Am_Controller::renderOptions(Am_Di::getInstance()->countryTable->getOptions()) . "</select>" . "<td width='30%'><select id='regional-tax-state' size='1'></select></td>" . "<td><input type='text' id='regional-tax-zip' /></td>" . "<td><input type='text' id='regional-tax-rate' size='5' maxlength='5' /></td>" . "<td><input type='button' id='regional-tax-add-button' value='{$label_add}'/></td>" . "</tr>\n";
        $name = $this->getName();
        foreach ($this->regional_taxes as $id => $region) {
            $hidden = Am_Controller::escape(implode('|', array($region['country'], $region['state'], $region['zip'], $region['tax_value'])));
            $output .= '<tr>' . sprintf('<td>%s</td>', Am_Di::getInstance()->countryTable->getTitleByCode($region['country'])) . sprintf('<td>%s</td>', $region['state'] ? Am_Di::getInstance()->stateTable->getTitleByCode($region['country'], $region['state']) : '*') . sprintf('<td>%s</td>', $region['zip'] ? $region['zip'] : '*') . sprintf('<td>%.2f%s</td>', $region['tax_value'], '&nbsp;%') . sprintf('<td><a href="javascript:" class="regional-tax-remove">%s</a>%s</td>', ___('Remove'), "<input type='hidden' name='{$name}[]' value='{$hidden}'>") . '</tr>';
        }
        $output .= '</table></div></div>';
        $id = $this->getId();
        $output .= "\n        <style type='text/css'>\n            #row-{$id} .element-title { display: none;  }\n            #row-{$id} .element { margin-left: 0 } \n        </style>\n        ";
        return sprintf('<tr><td colspan="2" id="tax-regional-regions">%s</td></tr>', $output . $this->getJs());
    }
예제 #10
0
 function ajaxCheckUniqEmail($vars)
 {
     $user_id = $this->getDi()->auth->getUserId();
     if (!$user_id) {
         $user_id = $this->getDi()->session->signup_member_id;
     }
     $email = $vars['email'];
     $msg = null;
     if ($_url = @$vars['_url']) {
         $url = base64_decode($_url);
     } else {
         $url = REL_ROOT_URL . '/member';
     }
     if (!$this->getDi()->userTable->checkUniqEmail($email, $user_id)) {
         $msg = ___('An account with the same email already exists.') . '<br />' . ___('Please %slogin%s to your existing account.%sIf you have not completed payment, you will be able to complete it after login', '<a href="' . Am_Controller::escape($url) . '" class="ajax-link">', '</a>', '<br />');
     }
     if (!$msg) {
         $msg = Am_Di::getInstance()->banTable->checkBan(array('email' => $email));
     }
     if (!$msg && !Am_Validate::email($email)) {
         $msg = ___('Please enter valid Email');
     }
     return $this->ajaxResponse($msg ? $msg : true);
 }
    public function renderInputs()
    {
        $filter = (array) $this->vars['filter'];
        $filter['dat1'] = Am_Controller::escape(@$filter['dat1']);
        $filter['dat2'] = Am_Controller::escape(@$filter['dat2']);
        $filter['text'] = Am_Controller::escape(@$filter['text']);
        $options = Am_Controller::renderOptions(array('' => '***', 'invoice' => ___('Invoice'), 'login' => ___('Username')), @$filter['type']);
        //'receipt'    => ___('Receipt'),
        $start = ___("Start Date");
        $end = ___("End Date");
        $tfilter = ___("Filter");
        $prefix = $this->grid->getId();
        return <<<CUT
<b>{$start}</b>        
<input type="text" name="{$prefix}_filter[dat1]" class='datepicker' value="{$filter['dat1']}" />
<b>{$end}</b>        
<input type="text" name="{$prefix}_filter[dat2]" class='datepicker' value="{$filter['dat2']}" />
<b>{$tfilter}</b>        
<input type="text" name="{$prefix}_filter[text]" value="{$filter['text']}" />
<select name="{$prefix}_filter[type]">
{$options}
</select>
CUT;
    }
예제 #12
0
파일: Bootstrap.php 프로젝트: grlf/eyedock
    function onGridProductInitForm(Am_Event $event)
    {
        $form = $event->getGrid()->getForm();
        $fs = $form->addAdvFieldset('cart')->setLabel(___('Shopping Cart'));
        $fs->addUpload('img', null, array('prefix' => self::UPLOAD_PREFIX))->setLabel(___("Product Picture\n" . 'for shopping cart pages. Only jpg, png and gif formats allowed'))->setAllowedMimeTypes(array('image/png', 'image/jpeg', 'image/gif'));
        $fs->addText('path', array('class' => 'el-wide'))->setId('product-path')->setLabel(___("Path\n" . 'will be used to construct user-friendly url, in case of you ' . 'leave it empty aMember will use id of this product to do it'))->addRule('callback', ___('Path should be unique across all products'), array('callback' => array($this, 'checkPath'), 'arguments' => array($event->getGrid())));
        $root_url = Am_Controller::escape(Am_Di::getInstance()->config->get('root_url'));
        $fs->addStatic()->setLabel(___('Permalink'))->setContent(<<<CUT
<div data-root_url="{$root_url}" id="product-permalink"></div>
CUT
);
        $fs->addScript()->setScript(<<<CUT
\$('#product-path').bind('keyup', function(){
    \$('#product-permalink').closest('.row').toggle(\$(this).val() != '');
    \$('#product-permalink').html(\$('#product-permalink').data('root_url') + '/product/' + encodeURIComponent(\$(this).val()).replace(/%20/g, '+'))
}).trigger('keyup')
CUT
);
        $fs->addHtmlEditor('cart_description')->setLabel(___("Product Description\n" . 'displayed on the shopping cart page'));
        $fs = $form->addAdvFieldset('meta', array('id' => 'meta'))->setLabel(___('Meta Data'));
        $fs->addText('meta_title', array('class' => 'el-wide'))->setLabel(___('Title'));
        $fs->addText('meta_keywords', array('class' => 'el-wide'))->setLabel(___('Keywords'));
        $fs->addText('meta_description', array('class' => 'el-wide'))->setLabel(___('Description'));
    }
예제 #13
0
 function renderSubject(MailQueue $m)
 {
     $s = $m->subject;
     if (strpos($s, '=?') === 0) {
         $s = mb_decode_mimeheader($s);
     }
     return "<td>" . Am_Controller::escape($s) . "</td>";
 }
예제 #14
0
파일: Controller.php 프로젝트: grlf/eyedock
 public function renderEditCategoryTitle($record, $fieldName, $grid)
 {
     return sprintf('<td><a href="javascript:;" class="link am-helpdesk-edit-category" data-category_id="%s">%s</a></td>', $this->getDi()->app->obfuscate($record->pk()), Am_Controller::escape($record->title));
 }
예제 #15
0
파일: payflow.php 프로젝트: grlf/eyedock
 public function cancelPaymentAction(\Am_Request $request, \Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     $ret = parent::cancelPaymentAction($request, $response, $invokeArgs);
     foreach ($response->getHeaders() as $h) {
         if ($h['name'] == 'Location') {
             $redirect = $h['value'];
         }
     }
     if ($response->isRedirect()) {
         $response->clearAllHeaders()->clearBody();
         $url = Am_Controller::escape($redirect);
         $response->setBody("<html>\n                <head>\n                    <script type='text/javascript'>\n                        window.top.location.href = '{$url}';\n                    </script>\n                </head>\n             </html>\n            ");
     }
     return $ret;
 }
예제 #16
0
파일: stripe.php 프로젝트: grlf/eyedock
    protected function displayReuse()
    {
        $result = new Am_Paysystem_Result();
        $tr = new Am_Paysystem_Transaction_Stripe_GetCustomer($this->plugin, $this->invoice, $this->invoice->getUser()->data()->get(Am_Paysystem_Stripe::TOKEN));
        $tr->run($result);
        if (!$result->isSuccess()) {
            throw new Am_Exception_Paysystem("Stored customer profile not found");
        }
        $card = $tr->getInfo();
        if ($card['active_card']['last4']) {
            $card = 'XXXX XXXX XXXX ' . $card['active_card']['last4'];
        } else {
            $last4 = 'XXXX';
            foreach (@(array) $card['cards']['data'] as $c) {
                if (@$c['id'] == @$card['default_card']) {
                    $last4 = $c['last4'];
                }
            }
            $card = 'XXXX XXXX XXXX ' . $last4;
        }
        $text = ___('Click "Continue" to pay this order using stored credit card %s', $card);
        $continue = ___('Continue');
        $cancel = ___('Cancel');
        $action = $this->plugin->getPluginUrl('cc');
        $id = Am_Controller::escape($this->_request->get('id'));
        $action = Am_Controller::escape($action);
        $receipt = $this->view->partial('_receipt.phtml', array('invoice' => $this->invoice, 'di' => $this->getDi()));
        $this->view->content .= <<<CUT
<div class='am-reuse-card-confirmation'>
{$receipt}
{$text}
<form method='get' action='{$action}'>
    <input type='hidden' name='id' value='{$id}' />
    <input type='submit' class='tb-btn tb-btn-primary' name='reuse_ok' value='{$continue}' />
    &nbsp;&nbsp;&nbsp;
    <input type='submit' class='tb-btn' name='reuse_cancel' value='{$cancel}' />
</form>
</div>
   
CUT;
        $this->view->display('layout.phtml');
    }
예제 #17
0
    protected function renderWarning($usage, $url)
    {
        $str = '';
        foreach ($usage as $msg) {
            if ($msg['link']) {
                $str .= sprintf('<li><a href="%s" target="_blank">%s</a></li>', Am_Controller::escape(REL_ROOT_URL . $msg['link']), Am_Controller::escape($msg['title']));
            } else {
                $str .= sprintf('<li>%s</li>', Am_Controller::escape($msg['title']));
            }
        }
        $url = Am_Controller::escape($url);
        $s = ___('Unable to delete this file as it is used for:');
        return <<<CUT
<div class="info">
<p>{$s}</p>
<ul class="list">
   {$str}
</ul>
</div>
<p><a id="delete-back-link" href="{$url}">Back To Grid</a></p>
<script type="text/javascript">
\$(document)
.off('click',"#delete-back-link")
.on('click',"#delete-back-link", function(){
        \$(this).closest('.filesmanager-container').load(\$(this).attr('href'));
        return false;
})
</script>
CUT;
    }
예제 #18
0
    public function renderInputs()
    {
        $prefix = $this->grid->getId();
        $filter = (array) $this->vars['filter'];
        $filter['dat1'] = Am_Controller::escape(@$filter['dat1']);
        $filter['dat2'] = Am_Controller::escape(@$filter['dat2']);
        $countryOptions = array();
        $countryOptions = $countryOptions + Am_Di::getInstance()->countryTable->getOptions();
        $countryOptions = Am_Controller::renderOptions($countryOptions, @$filter['country']);
        $paysysOptions = array();
        $paysysOptions = $paysysOptions + Am_Di::getInstance()->paysystemList->getOptions();
        $paysysOptions = Am_Controller::renderOptions($paysysOptions, @$filter['paysys_id']);
        $pOptions = array();
        $period = array(Am_Interval::PERIOD_THIS_MONTH, Am_Interval::PERIOD_LAST_MONTH, Am_Interval::PERIOD_THIS_QUARTER, Am_Interval::PERIOD_LAST_QUARTER, Am_Interval::PERIOD_THIS_YEAR, Am_Interval::PERIOD_LAST_YEAR, Am_Interval::PERIOD_ALL);
        $i = $this->grid->getDi()->interval;
        foreach ($period as $k) {
            $pOptions[$k] = $i->getTitle($k);
        }
        $pOptions['exact'] = ___('Exact Period');
        $pOptions = Am_Controller::renderOptions($pOptions, @$filter['period']);
        $start = ___('Start Date');
        $end = ___('End Date');
        $offer_country = '-' . ___('Filter by Country') . '-';
        $offer_paysys = '-' . ___('Filter by Paysystem') . '-';
        $dSelect = ___('Report Dates');
        $pSelect = ___('Report Period');
        $dont_show_empty_checked = @$filter['dont_show_empty'] == 1 ? 'checked' : '';
        $dont_show_empty_label = ___('Do not include records with empty VAT');
        return <<<CUT
   <div style='display:table-cell; padding-bottom:0.4em;'>
        {$pSelect}
        <select name='{$prefix}_filter[period]' id='filter-period'>
            {$pOptions}
        </select>&nbsp;&nbsp;
   </div>
   <div style='display:table-cell; padding-bottom:0.4em;' id='filter-exact'>
        {$dSelect}
        <input type="text" placeholder="{$start}" name="{$prefix}_filter[dat1]" class='datepicker' style="width:80px" value="{$filter['dat1']}" />
        <input type="text" placeholder="{$end}" name="{$prefix}_filter[dat2]" class='datepicker' style="width:80px" value="{$filter['dat2']}" />&nbsp;&nbsp;
    </div>

    <div style='display:table-cell; padding-right:0.4em; padding-bottom:0.4em; width:160px; box-sizing:border-box;'>
        <select name="{$prefix}_filter[country][]" style="width:160px" class="magicselect" multiple="multiple" data-offer='{$offer_country}'>
            {$countryOptions}
        </select>&nbsp;&nbsp;
    </div>

   <div style='display:table-cell; padding-right:0.4em; padding-bottom:0.4em; width:160px; box-sizing:border-box;'>
        <select name="{$prefix}_filter[paysys_id][]" style="width:160px" class="magicselect" multiple="multiple" data-offer='{$offer_paysys}'>
            {$paysysOptions}
        </select>
   </div>

   <br/>

   <div style='display:table-cell; padding-right:0.4em; padding-bottom:0.4em; box-sizing:border-box;'>
        <label>
            <input type="hidden" name="{$prefix}_filter[dont_show_empty]" value="0" />
            <input type="checkbox" name="{$prefix}_filter[dont_show_empty]" value="1" {$dont_show_empty_checked} /> {$dont_show_empty_label}
        </label>
   </div>


   <script>
    jQuery(document).ready(function(){
        jQuery('input[type=checkbox]').change(function(){jQuery('.filter').submit()});
        jQuery('#filter-period').change(function(){
                if(jQuery(this).val() == 'exact')
                    jQuery("#filter-exact").show();
                else
                    jQuery("#filter-exact").hide();

            }).change();

    });
   </script>

CUT;
    }
예제 #19
0
 public function renderShowDisabled()
 {
     return sprintf('<label>
             <input type="hidden" name="%s_filter[dont_show_disabled]" value="0" />
             <input type="checkbox" name="%s_filter[dont_show_disabled]" value="1" %s /> %s</label>', $this->grid->getId(), $this->grid->getId(), @$this->vars['filter']['dont_show_disabled'] == 1 ? 'checked' : '', Am_Controller::escape(___('do not show disabled products')));
 }
예제 #20
0
    protected function renderClientRules(HTML_QuickForm2_JavascriptBuilder $builder)
    {
        $id = Am_Controller::escape($this->editor->getId());
        $vars = "";
        foreach ($this->tagsOptions as $k => $v) {
            $vars .= "['{$k}'],\n";
        }
        $vars = trim($vars, "\n\r,");
        $builder->addElementJavascript(<<<CUT
\$(function(){
    // modified version of http://alexking.org/blog/2003/06/02/inserting-at-the-cursor-using-javascript
    \$.fn.insertAtCaret = function (myValue) {
            return this.each(function(){
                    //IE support
                    if (document.selection) {
                            this.focus();
                            sel = document.selection.createRange();
                            sel.text = myValue;
                            this.focus();
                    }
                    //MOZILLA/NETSCAPE support
                    else if (this.selectionStart || this.selectionStart == '0') {
                            var startPos = this.selectionStart;
                            var endPos = this.selectionEnd;
                            var scrollTop = this.scrollTop;
                            this.value = this.value.substring(0, startPos)
                                          + myValue
                                  + this.value.substring(endPos,
    this.value.length);
                            this.focus();
                            this.selectionStart = startPos + myValue.length;
                            this.selectionEnd = startPos + myValue.length;
                            this.scrollTop = scrollTop;
                    } else {
                            this.value += myValue;
                            this.focus();
                    }
            });

    };
            
    \$('select#insert-tags').change(function(){
        var val = \$(this).val();
        if (!val) return;
        \$("#txt-0").insertAtCaret(val);
        \$(this).prop("selectedIndex", -1);
    });
            
    if (CKEDITOR.instances["{$id}"]) {
        delete CKEDITOR.instances["{$id}"];
    }
    var editor = null;
    \$("input[name='format']").change(function()
    {
        if (!this.checked) return;
        if (this.value == 'html')
        {
            if (!editor) {
                editor = initCkeditor("{$id}", { placeholder_items: [
                    {$vars}
                ]});
            }
            \$('select#insert-tags').hide();
        } else {
            if (editor) {
                editor.destroy();
                editor = null;
            }
            \$('select#insert-tags').show();
        }
    }).change();
});            
CUT
);
    }
예제 #21
0
파일: paymill.php 프로젝트: grlf/eyedock
    protected function displayReuse()
    {
        $result = new Am_Paysystem_Result();
        $cc_last4 = $this->invoice->getUser()->data()->get(Am_Paysystem_Paymill::CC_LAST4);
        $card = 'XXXX XXXX XXXX ' . $cc_last4;
        $text = ___('Click "Continue" to pay this order using stored credit card %s', $card);
        $continue = ___('Continue');
        $cancel = ___('Cancel');
        $action = $this->plugin->getPluginUrl('cc');
        $id = Am_Controller::escape($this->_request->get('id'));
        $action = Am_Controller::escape($action);
        $this->view->content .= <<<CUT
<div class='am-reuse-card-confirmation'>
{$text}
<form method='get' action='{$action}'>
    <input type='hidden' name='id' value='{$id}' />
    <input type='submit' class='tb-btn tb-btn-primary' name='reuse_ok' value='{$continue}' />
    &nbsp;&nbsp;&nbsp;
    <input type='submit' class='tb-btn' name='reuse_cancel' value='{$cancel}' />
</form>
</div>
   
CUT;
        $this->view->display('layout.phtml');
    }
예제 #22
0
 public function getText()
 {
     return empty($this->config['isHtml']) ? Am_Controller::escape(@$this->config['text']) : @$this->config['text'];
 }
예제 #23
0
 protected function ccError($msg)
 {
     $this->view->content .= "<strong><span class='error'>" . $msg . "</span></strong>";
     $url = $this->_request->getRequestUri();
     $url .= (strchr($url, '?') ? '&' : '?') . 'id=' . $this->_request->get('id');
     $url = Am_Controller::escape($url);
     $this->view->content .= " <strong><a href='{$url}'>" . ___('Return and try again') . "</a></strong>";
     $this->view->display('layout.phtml');
     exit;
 }
예제 #24
0
 public function formRadio($name, $options, $selected)
 {
     $out = "";
     $name = Am_Controller::escape($name);
     foreach ($options as $k => $v) {
         $k = Am_Controller::escape($k);
         $sel = $k == $selected;
         $sel = $sel ? " checked='checked'" : "";
         $out .= "<input type='radio' name='{$name}' value='{$k}'{$sel}>\n{$v}\n<br />\n";
     }
     return $out;
 }
예제 #25
0
 function setName($name)
 {
     $x = preg_split('/[\\\\\\/]/', $name);
     $this->name = Am_Controller::escape(array_pop($x));
     return $this;
 }
예제 #26
0
 function render()
 {
     $view = $this->getView();
     $html = $view['html'];
     $html = str_replace('%yes%', '<button name="yes" onclick="window.location.href=window.location.href + (window.location.href.indexOf(\'?\') == -1 ? \'?\' : \'&\') + \'oto=yes\'">' . $view['yes']['label'] . '</button>', $html);
     $html = str_replace('%no%', '<a href="javascript:" onclick="window.location.href=window.location.href + (window.location.href.indexOf(\'?\') == -1 ? \'?\' : \'&\') + \'oto=no\'">' . $view['no']['label'] . '</a>', $html);
     if ($view['no_layout']) {
         $title = Am_Controller::escape($view['title']);
         $html = strpos($html, 'html') === false ? "<!DOCTYPE html>\n<html><head><title>{$title}</title></head><body>" . $html . "</body></html>" : $html;
     } else {
         $v = $this->getDi()->view;
         $v->title = $view['title'];
         $v->content = $html;
         $v->layoutNoMenu = $v->layoutNoLang = $v->layoutNoTitle = true;
         $html = $v->render('layout.phtml');
     }
     return $html;
 }
예제 #27
0
 function stepCopy(Am_BatchProcessor $batch)
 {
     @set_time_limit(600);
     $info = $this->loadRemoteAccess();
     $class = 'Am_FileConnector_' . ucfirst(toCamelCase($info['method']));
     $connector = new $class($info);
     if (!$connector->connect()) {
         $this->outText('Connection error: ' . Am_Controller::escape($connector->getMessage()));
         return false;
     }
     if (!$connector->chdir($info['root'])) {
         $this->outText('Could not chroot to root folder: [' . Am_Controller::escape($info['root']) . ']');
         return false;
     }
     foreach ($this->getSession()->upgrades as $k => $upgrade) {
         if (empty($upgrade->dir)) {
             continue;
         }
         $dir = $upgrade->dir . DIRECTORY_SEPARATOR . 'amember' . DIRECTORY_SEPARATOR;
         $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::SELF_FIRST);
         foreach ($iterator as $file) {
             if ($file->getFileName() == '.' || $file->getFileName() == '..') {
                 continue;
             }
             if (!strpos($file->getPathName(), $strip = $dir)) {
                 new Am_Exception_InputError(sprintf('Could not strip local root prefix: [%s] from fn [%s]', $strip, $file->getPathName()));
             }
             // path relative to amember root
             $path = substr($file->getPathName(), strlen($strip));
             if ($file->isDir()) {
                 if (!$connector->mkdir($path) && !$connector->ls($path)) {
                     $this->outText('Could not create folder [' . Am_Controller::escape($path) . ']<br />' . $connector->getError());
                     return false;
                 }
                 $this->outText('created folder ' . Am_Controller::escape($path) . "<br />\n");
             } else {
                 if (!$connector->put($file->getPathName(), $path)) {
                     $this->outText('Could not copy file [' . Am_Controller::escape($file->getPathName()) . '] to remote [' . Am_Controller::escape($path) . '] ' . $connector->getError());
                     return false;
                 }
                 $this->outText('copy file ' . Am_Controller::escape($path) . "<br />\n");
             }
         }
         // remove localdirectory and files
         $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST);
         foreach ($iterator as $file) {
             if ($file->getFileName() == '.' || $file->getFileName() == '..') {
                 continue;
             }
             if ($file->isDir()) {
                 rmdir($file->getPathName());
             } else {
                 unlink($file->getPathName());
             }
         }
         rmdir($dir);
         rmdir($upgrade->dir);
         unset($upgrade->dir);
         if (!$batch->checkLimits()) {
             //                $batch->stop();
             //                return false;
         }
     }
     return true;
 }
 public function getUrl($record = null, $id = null)
 {
     $id = $record->pk();
     switch ($record->type) {
         case AffBanner::TYPE_TEXTLINK:
             $prefix = 'textlinks';
             break;
         case AffBanner::TYPE_BANNER:
             $prefix = 'banners';
             break;
         case AffBanner::TYPE_PAGEPEEL:
             $prefix = 'pagepeel';
             break;
         case AffBanner::TYPE_LIGHTBOX:
             $prefix = 'lightboxs';
             break;
         case AffBanner::TYPE_CUSTOM:
             $prefix = 'custom';
             break;
         default:
             throw new Am_Exception_InternalError(sprintf('Unknown banner type [%s] in %s::%s', $record->type, __CLASS__, __METHOD__));
     }
     $back_url = Am_Controller::escape($this->grid->getBackUrl());
     return REL_ROOT_URL . "/aff/admin-banners/p/{$prefix}/index?_{$prefix}_a=edit&_{$prefix}_b={$back_url}&_{$prefix}_id={$id}";
 }
예제 #29
0
 public function renderLink()
 {
     if (!empty($this->hide)) {
         return;
     }
     $url = $this->getUrl();
     $title = $this->getLinkTitle();
     if (empty($title)) {
         return;
     }
     if ($url) {
         return sprintf('<a href="%s">%s</a>', Am_Controller::escape($url), $title);
     } else {
         return $title;
     }
 }
예제 #30
0
파일: Content.php 프로젝트: grlf/eyedock
 public function renderPath(ResourceAbstractFile $file)
 {
     $upload = $file->getUpload();
     try {
         $file->isLocal();
     } catch (Exception $e) {
         if (!$upload) {
             return $this->renderTd('<span class="error">' . ___('The file has been removed from disk or corrupted. Please re-upload it.') . '</span>' . ' <span style="color: grey">(' . ___('Error from Storage Engine') . ': ' . Am_Controller::escape($e->getMessage()) . ')</span>' . '<br />' . ___('Real Path') . ': ' . Am_Controller::escape($file->path), false);
         }
     }
     return $upload && !file_exists($upload->getFullPath()) ? $this->renderTd('<div class="reupload-conteiner-hide"><span class="error">' . ___('The file has been removed from disk or corrupted. Please re-upload it.') . '</span>' . '<div class="reupload-conteiner"><span class="upload-name">' . $this->escape($upload->getName() . '/' . $upload->getFilename()) . '</span><br />' . '<div><span class="reupload" data-upload_id="' . $upload->pk() . '"  data-return-url="' . $this->escape($this->makeUrl()) . '" id="reupload-' . $upload->pk() . '"></span></div></div></div>', false) : $this->renderTd(sprintf('%s <span style="color:grey">(%s)</span>', $this->escape($file->getDisplayFilename()), $file->getStorageId()), false);
 }