Example #1
0
 public function addDefaultPages()
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $id = $request->getInt('id', $request->getInt('user_id'));
     if (!$id && $request->getInt('_u_id')) {
         $id = $request->getInt('_u_id');
     }
     if (!$id && $request->getParam('_u_a') == 'insert') {
         $id = 'insert';
     }
     if (!$id) {
         throw new Am_Exception_InputError("Could not find out [id]");
     }
     $userUrl = REL_ROOT_URL . '/admin-users?';
     if ($action = $request->getFiltered('_u_a', 'edit')) {
         $userUrl .= "_u_a={$action}&";
     }
     if ($a = $request->getFiltered('_u_id', $id)) {
         $userUrl .= "_u_id={$a}";
     }
     $this->addPage(array('id' => 'users', 'uri' => $userUrl, 'label' => ___('User Info'), 'order' => 0, 'disabled' => $id <= 0, 'active' => $request->getFiltered('_u_id', false)))->addPage(array('id' => 'payments', 'label' => ___('Payments'), 'controller' => 'admin-user-payments', 'params' => array('user_id' => $id), 'order' => 100, 'resource' => 'grid_payment'))->addPage(array('id' => 'access-log', 'label' => ___('Access Log'), 'controller' => 'admin-users', 'action' => 'access-log', 'params' => array('user_id' => $id), 'order' => 200, 'resource' => Am_Auth_Admin::PERM_LOGS));
     $event = new Am_Event_UserTabs($this, $id <= 0, (int) $id);
     $event->run();
     /// workaround against using the current route for generating urls
     foreach (new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST) as $child) {
         if ($child instanceof Zend_Navigation_Page_Mvc && $child->getRoute() === null) {
             $child->setRoute('default');
         }
         if ($id <= 0) {
             $child->set('disabled', true);
         }
     }
 }
Example #2
0
 public function getTitle()
 {
     if ($this->fn == self::FN_FREE) {
         return ___('Free Access');
     }
     if ($this->fn == self::FN_FREE_WITHOUT_LOGIN) {
         return ___('Free Access without log-in');
     }
     $pr = null;
     if ($this->id) {
         if ($this->fn == self::FN_PRODUCT) {
             $pr = $this->getDi()->productTable->load($this->id, false);
         } elseif ($this->fn == self::FN_CATEGORY) {
             if ($this->id == self::ANY_PRODUCT) {
                 return ___('Any product');
             } else {
                 $pr = $this->getDi()->productCategoryTable->load($this->id, false);
             }
         }
     }
     if (!$pr) {
         return sprintf('(%s #%d)', $this->getClass(), $this->getId());
     }
     return sprintf('(%d) %s', $pr->pk(), $pr->title);
 }
 /**
  * Overload parent function.  See parent for details.
  *
  */
 function getDownloadBlockForLocale($locale, $options = array())
 {
     $options['product'] = array_key_exists('product', $options) ? $options['product'] : 'thunderbird';
     # Used on the sidebar only
     $options['download_title'] = ___('Get Thunderbird');
     return parent::getDownloadBlockForLocale($locale, $options);
 }
Example #4
0
 public function initFromSavedForm(SavedForm $record)
 {
     foreach ($record->getBricks() as $brick) {
         $brick->insertBrick($this);
     }
     $this->addSubmit('_submit_', array('value' => ___('Save Profile')));
 }
Example #5
0
 public function __construct(Am_Di $di, array $config)
 {
     $this->defaultTitle = ___("ClickBank");
     $this->defaultDescription = ___("pay using credit card or PayPal");
     parent::__construct($di, $config);
     $di->billingPlanTable->customFields()->add(new Am_CustomFieldText('clickbank_product_id', 'ClickBank Product#', 'you have to create similar product in ClickBank and enter its number here', array()));
 }
    function createForm()
    {
        $f = new Am_Form();
        $f->addHidden('s')->setValue($this->getFiltered('s'));
        $f->addHidden('e')->setValue($this->getParam('e'));
        $g = $f->addGroup('newsletter', array('id' => 'newsletter-group'))->setLabel(___('Untick checkbox to cancel subscription'));
        $g->setSeparator("<br />\n");
        $ids = $this->view->guest->getLists();
        foreach ($this->lists as $l) {
            $title = $l->title;
            if ($l->desc) {
                $title .= " - " . $l->desc;
            }
            $el = $g->addCheckbox($l->pk())->setContent($title);
            if (in_array($l->list_id, $ids) && !$this->_request->isPost()) {
                $el->setAttribute('checked');
            }
            // checked by default
        }
        if (count($this->lists) > 1) {
            $f->addCheckbox('unsubscribe')->setLabel(___('Cancel all Subscriptions'));
            $f->addScript()->setScript(<<<CUT
jQuery(document).ready(function(\$) {
    \$("input#unsubscribe-0").change(function(){
        \$("#row-newsletter-group").toggle(!this.checked);
    });
});
CUT
);
        }
        $f->addSubmit('do', array('value' => ___('Change Subscription')));
        return $f;
    }
 /**
  * This method does the actual security check, other security checks are done on a per call basis to this method in specific scripts.
  * Improved version reduces the cost of queries by 3, I also believe that this is a more secure method.
  *
  * @param boolean $validate_crypt_key Set if you would like the system to verify an encryption before accepting global $_POST variables. Use with method send_crypt_key_validation in your form.
  * @return string
  * @author Jason Schoeman
  */
 public function securityIni($validate_token = false)
 {
     if (isset($_SESSION['user_id'])) {
         $this->_log(sprintf(___('Security check for user id %s'), $_SESSION['user_id']));
     }
     if ($this->configuration['system_down'] == true) {
         if ($this->configuration['user_role'] == $this->configuration['root_role']) {
             if ($this->configuration['system_down_bypass'] == false) {
                 $this->template->warning(___('System is switched off for normal users, only root can access the system.'), false, false);
             }
         } else {
             if ($this->configuration['system_down_bypass'] == false) {
                 $settings_message = $this->db->getSettings(array('system_down_message'));
                 $this->core->skipLogin = true;
                 $this->core->haltController = sprintf($settings_message['system_down_message'], $this->configuration['scripts_name_version']);
             }
         }
     }
     if (!empty($_POST)) {
         $this->post = $this->sqlWatchdog($_POST);
     }
     if (!empty($_GET)) {
         $this->get = $this->sqlWatchdog($_GET);
     }
     if (!empty($_COOKIE)) {
         $this->cookie = $this->sqlWatchdog($_COOKIE);
     }
     if (!empty($_SESSION)) {
         $this->session = $_SESSION;
     }
     if (!empty($_REQUEST)) {
         $this->request = array_merge((array) $this->post, (array) $this->get);
     }
 }
Example #8
0
 function indexAction()
 {
     $this->getDi()->auth->requireLogin($this->_request->getRequestUri());
     //$this->getModule()->checkAndUpdate($this->getDi()->user);
     $subusers_count = $this->getDi()->user->data()->get('subusers_count');
     if (empty($subusers_count)) {
         throw new Am_Exception_Security(___('Resellers-only page'));
     }
     $this->view->headScript()->prependFile(REL_ROOT_URL . "/js.php?js=admin");
     $this->view->subusers_count = $subusers_count;
     $grid = Am_Grid_Editable_Subusers::factory($this->getDi()->user, $this->getRequest(), $this->view, $this->getDi());
     $pending = 0;
     foreach ($subusers_count as $v) {
         if ($v['pending_count']) {
             $pending += $v['pending_count'];
         }
     }
     if ($pending) {
         $this->view->message = ___('You have too many subusers assigned to this account.  You may choose to remove %d users from your account', $pending);
     } else {
         if ($this->getDi()->config->get('subusers_cannot_delete') == 2) {
             // no pending accounts, user cannot delete
             $grid->actionDelete('delete');
         }
     }
     $grid->runWithLayout('member/subusers.phtml');
 }
Example #9
0
 public function chain($item = null)
 {
     list($item) = self::_wrapArgs(func_get_args(), 1);
     $__ = isset($this) && isset($this->_chained) && $this->_chained ? $this : ___($item);
     $__->_chained = true;
     return $__;
 }
Example #10
0
 /**
  * Validate if given coupon is applicable to a customer
  * @param int (optional)$user_id
  * @return string|null error message or null if all OK
  */
 function validate($user_id = null)
 {
     $batch = $this->getBatch();
     if ($batch->is_disabled) {
         return ___('Coupon code disabled');
     }
     if ($batch->use_count && $batch->use_count <= $this->used_count) {
         return ___('Coupon usage limit exceeded');
     }
     if ($batch->user_id && $user_id && $batch->user_id != $user_id) {
         return ___('This coupon belongs to another customer');
     }
     $tm = $this->getDi()->time;
     if ($batch->begin_date && strtotime($batch->begin_date) > $tm) {
         return ___('Coupon is not yet active');
     }
     if ($batch->expire_date && strtotime($batch->expire_date . ' 23:59:59') < $tm) {
         return ___('Coupon code expired');
     }
     if ($batch->user_use_count && $user_id) {
         $member_used_count = $this->getDi()->invoiceTable->findPaidCountByCouponId($this->coupon_id, $user_id);
         if ($batch->user_use_count <= $member_used_count) {
             return ___('Coupon usage limit exceeded');
         }
     }
     return null;
 }
Example #11
0
 function addSaveButton($title = null)
 {
     if ($title === null) {
         $title = ___("Save");
     }
     return $this->addSubmit('save', array('value' => $title));
 }
Example #12
0
    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);
    }
Example #13
0
 public function run(Am_Paysystem_Result $result)
 {
     $this->result = $result;
     $log = $this->getInvoiceLog();
     $log->add($this->request);
     $this->response = $this->request->send();
     $log->add($this->response);
     $this->validateResponseStatus($this->result);
     if ($this->result->isFailure()) {
         return;
     }
     try {
         $this->parseResponse();
         // validate function must set success status
         $this->validate();
         if ($this->result->isSuccess()) {
             $this->processValidated();
         }
     } catch (Exception $e) {
         if ($e instanceof PHPUnit_Framework_Error) {
             throw $e;
         }
         if ($e instanceof PHPUnit_Framework_Asser) {
             throw $e;
         }
         if (!$result->isFailure()) {
             $result->setFailed(___("Payment failed"));
         }
         $log->add($e);
     }
 }
Example #14
0
 public function validate()
 {
     if ($this->vars['err']) {
         return $this->result->setFailed(___('Payment failed'));
     }
     $this->result->setSuccess($this);
 }
    public function renderConfig(&$output, $grid)
    {
        $type = substr($grid->getId(), 1);
        $url = $this->escape($this->getUrl(null, 'config-save'));
        $checked1 = $checked2 = "";
        if ($this->getDi()->config->get('ban.' . $type . '_action') == 'die') {
            $checked2 = 'selected="selected"';
        } else {
            $checked1 = 'selected="selected"';
        }
        $text = ___("Choose action when locked %s used by customer during signup", '[' . $type . ']');
        $opt1 = ___("Display error message");
        $opt2 = ___("Die and show ugly error message");
        $output .= <<<CUT
        <br /><br />
        <form method="post" action="{$url}">
        {$text}
        <input type="hidden" name="c" value="{$type}">
        <select name="a" id="{$type}-action" onchange="this.form.submit()">
            <option value="error" {$checked1}>{$opt1}</option>
            <option value="die" {$checked2}>{$opt2}</option>
        </select>
        </form>
        </script>
CUT;
    }
Example #16
0
 function indexAction()
 {
     $this->getDi()->plugins_payment->loadEnabled()->getAllEnabled();
     $id = $this->_request->getFiltered('id');
     if (empty($id)) {
         $id = filterId(@$_GET['id']);
     }
     $this->invoice = null;
     if ($id) {
         $this->invoice = $this->getDi()->invoiceTable->findBySecureId($id, 'THANKS');
         if (!$this->invoice) {
             throw new Am_Exception_InputError("Invoice #{$id} not found");
         }
         $tm = max($this->invoice->tm_started, $this->invoice->tm_added);
         if ($this->getDi()->time - strtotime($tm) > 48 * 3600) {
             throw new Am_Exception_InputError("Link expired");
         }
         // Clean signup_member_login and signup_member_id to avoid duplicate signups with the same email address.
         $this->getSession()->signup_member_id = null;
         $this->getSession()->signup_member_login = null;
         $this->view->invoice = $this->invoice;
         foreach ($this->invoice->getPaymentRecords() as $p) {
             $this->view->payment = $p;
         }
         if (!$this->invoice->tm_started) {
             $this->view->show_waiting = true;
             $this->view->refreshTime = "<span id='am-countdown'>00:10</span> " . ___("seconds");
         }
         $this->view->script = $this->getJs(10);
     }
     $this->getDi()->hook->call(Am_Event::THANKS_PAGE, array('controller' => $this, 'invoice' => $this->invoice));
     $this->view->layoutNoMenu = true;
     $this->view->display('thanks.phtml');
 }
 /**
  * This function is likely never returns
  * but anyway handle result and exceptions
  * @return Am_Paysystem_Result
  */
 function process()
 {
     $err = $this->invoice->validate();
     if ($err) {
         throw new Am_Exception_InputError($err[0]);
     }
     $this->invoice->save();
     $plugin = Am_Di::getInstance()->plugins_payment->loadGet($this->invoice->paysys_id);
     $this->result = new Am_Paysystem_Result();
     $plugin->processInvoice($this->invoice, $this->controller->getRequest(), $this->result);
     if ($this->result->isSuccess() || $this->result->isFailure()) {
         if ($transaction = $this->result->getTransaction()) {
             $transaction->setInvoice($this->invoice);
             $transaction->process();
         }
     }
     if ($this->result->isSuccess()) {
         $url = REL_ROOT_URL . "/thanks?id=" . $this->invoice->getSecureId('THANKS');
         $this->callback($this->onSuccess);
         $this->controller->redirectLocation($url, ___("Invoice processed"), ___("Invoice processed successfully"));
         // no return Am_Exception_Redirect
     } elseif ($this->result->isAction()) {
         $this->callback($this->onAction);
         $this->result->getAction()->process($this->controller);
         // no return Am_Exception_Redirect
     } else {
         //  ($result->isFailure()) {
         $this->callback($this->onFailure);
     }
     return $this->result;
 }
 function displayAction()
 {
     $this->setActiveMenu('setup');
     $this->p = filterId($this->_request->getParam('page'));
     if ($this->p === 'ajax') {
         return $this->ajaxAction();
     }
     $this->initSetupForms();
     $this->form = $this->getForm($this->p, false);
     $this->form->prepare();
     if ($this->form->isSubmitted()) {
         $this->form->setDataSources(array($this->_request));
         if ($this->form->validate() && $this->form->saveConfig()) {
             $this->redirectHtml($this->getUrl(null, $this->p), ___('Config values updated...'));
             return;
         }
     } else {
         $this->form->setDataSources(array(new HTML_QuickForm2_DataSource_Array($this->getConfigValues()), new HTML_QuickForm2_DataSource_Array($this->form->getDefaults())));
     }
     $this->view->assign('p', $this->p);
     $this->view->assign('pages', $this->renderPages());
     $this->form->replaceDotInNames();
     $this->view->assign('pageObj', $this->form);
     $this->view->assign('form', $this->form);
     $this->view->display('admin/setup.phtml');
 }
Example #19
0
    public function initConfigForm(Am_Form $form)
    {
        $el = $form->addSelect('type', array('id' => 'newsletter-type-select'))->setLabel(___('Type'));
        $el->addOption(___('Single Checkbox'), 'checkbox');
        $el->addOption(___('Checkboxes for Selected Lists'), 'checkboxes');
        $form->addAdvCheckbox('no_label', array('id' => 'newsletter-no-label'))->setLabel(___("Hide Label"));
        $form->addScript()->setScript(<<<CUT
\$(function(){
    \$('#newsletter-type-select').change(function(){
        \$('#newsletter-no-label').closest('.row').toggle(\$(this).val() == 'checkbox')
    }).change();
})
CUT
);
        $lists = $form->addSortableMagicSelect('lists', array('id' => 'newsletter-lists-select'))->setLabel(___("Lists\n" . 'All List will be displayed if none selected'));
        $lists->loadOptions(Am_Di::getInstance()->newsletterListTable->getAdminOptions());
        $form->addScript()->setScript(<<<CUT
jQuery(document).ready(function(\$) {
    \$("#newsletter-type-select").change(function(){
        var val = \$(this).val();
        \$("#row-newsletter-lists-select").toggle(val == 'checkboxes');
    }).change();
});
CUT
);
        $form->addAdvCheckbox('unchecked')->setLabel(___("Default unchecked\n" . 'Leave unchecked if you want newsletter default to be checked'));
    }
Example #20
0
 function addDefaultPages()
 {
     $this->addPage(array('id' => 'member', 'controller' => 'member', 'label' => ___('Dashboard'), 'order' => 0));
     $this->addPage(array('id' => 'add-renew', 'controller' => 'signup', 'action' => 'index', 'label' => ___('Add/Renew Subscription'), 'order' => 100));
     $this->addPage(array('id' => 'payment-history', 'controller' => 'member', 'action' => 'payment-history', 'label' => ___('Payments History'), 'order' => 200));
     $this->addPage(array('id' => 'profile', 'controller' => 'profile', 'label' => ___('Edit Profile'), 'order' => 300));
     try {
         $user = Am_Di::getInstance()->user;
     } catch (Am_Exception_Db_NotFound $e) {
         $user = null;
     }
     if ($user) {
         $tree = Am_Di::getInstance()->resourceCategoryTable->getAllowedTree($user);
         $pages = array();
         foreach ($tree as $node) {
             $pages[] = $this->getContentCategoryPage($node);
         }
         if (count($pages)) {
             $this->addPages($pages);
         }
     }
     Am_Di::getInstance()->hook->call(Am_Event::USER_MENU, array('menu' => $this, 'user' => $user));
     /// workaround against using the current route for generating urls
     foreach (new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST) as $child) {
         if ($child instanceof Zend_Navigation_Page_Mvc && $child->getRoute() === null) {
             $child->setRoute('default');
         }
     }
 }
Example #21
0
 public function __construct($name)
 {
     parent::__construct('', array('id' => 'mail-editor'));
     $subject = $this->addElement('text', 'subject', array('size' => 80))->setLabel(___('Subject'));
     $subject->addRule('required');
     $this->addStatic()->setContent('<br /><br />');
     $format = $this->addGroup(null)->setLabel(___('E-Mail Format'));
     $format->addRadio('format', array('value' => 'html'))->setContent(___('HTML Message'));
     $format->addRadio('format', array('value' => 'text'))->setContent(___('Plain-Text Message'));
     $this->addStatic()->setContent('<br /><br />');
     $this->editor = $this->addElement(new Am_Form_Element_HtmlEditor('txt', null, true));
     $this->editor->addRule('required');
     $this->addStatic()->setContent('<br /><br />');
     $this->tagsOptions = Am_Mail_TemplateTypes::getInstance()->getTagsOptions($name);
     $tagsOptions = array();
     foreach ($this->tagsOptions as $k => $v) {
         $tagsOptions[$k] = "{$k} - {$v}";
     }
     $sel = $this->addSelect('', array('id' => 'insert-tags'));
     $sel->loadOptions(array_merge(array('' => ''), $tagsOptions));
     $this->addStatic()->setContent('<br /><br />');
     $this->addClass('no-label');
     $fileChooser = new Am_Form_Element_Upload('attachments', array('multiple' => 1), array('prefix' => EmailTemplate::ATTACHMENT_FILE_PREFIX));
     $this->addElement($fileChooser)->setLabel(___('Attachments'));
 }
Example #22
0
 function addDefaultPages()
 {
     $separator = new Am_Navigation_Admin_Item_Separator();
     $this->addPage(array('id' => 'dashboard', 'controller' => 'admin', 'label' => ___('Dashboard')));
     $this->addPage(Zend_Navigation_Page::factory(array('id' => 'users', 'uri' => '#', 'label' => ___('Users'), 'resource' => 'grid_u', 'privilege' => 'browse', 'pages' => array_merge(array(array('id' => 'users-browse', 'controller' => 'admin-users', 'label' => ___('Browse Users'), 'resource' => 'grid_u', 'privilege' => 'browse', 'class' => 'bold'), array('id' => 'users-insert', 'uri' => REL_ROOT_URL . '/admin-users?_u_a=insert', 'label' => ___('Add User'), 'resource' => 'grid_u', 'privilege' => 'insert')), !Am_Di::getInstance()->config->get('manually_approve') ? array() : array(array('id' => 'user-not-approved', 'controller' => 'admin-users', 'action' => 'not-approved', 'label' => ___('Not Approved Users'), 'resource' => 'grid_u', 'privilege' => 'browse')), array(array('id' => 'users-email', 'controller' => 'admin-email', 'label' => ___('E-Mail Users'), 'resource' => Am_Auth_Admin::PERM_EMAIL), clone $separator, array('id' => 'users-import', 'controller' => 'admin-import', 'label' => ___('Import Users'), 'resource' => Am_Auth_Admin::PERM_IMPORT))))));
     $this->addPage(array('id' => 'reports', 'uri' => '#', 'label' => ___('Reports'), 'pages' => array(array('id' => 'reports-reports', 'controller' => 'admin-reports', 'label' => ___('Reports'), 'resource' => Am_Auth_Admin::PERM_REPORT), array('id' => 'reports-payments', 'type' => 'Am_Navigation_Page_Mvc', 'controller' => 'admin-payments', 'label' => ___('Payments'), 'resource' => array('grid_payment', 'grid_invoice')))));
     $this->addPage(array('id' => 'products', 'uri' => '#', 'label' => ___('Products'), 'pages' => array_filter(array(array('id' => 'products-manage', 'controller' => 'admin-products', 'label' => ___('Manage Products'), 'resource' => 'grid_product', 'class' => 'bold'), array('id' => 'products-coupons', 'controller' => 'admin-coupons', 'label' => ___('Coupons'), 'resource' => 'grid_coupon')))));
     /**
      *  Temporary disable this menu if user is on upgrade controller in order to avoid error: 
      *  Fatal error: Class Folder contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (ResourceAbstract::getAccessType)
      *  
      *   @todo Remove this in the future;
      * 
      */
     $content_pages = array();
     if (Zend_Controller_Front::getInstance()->getRequest()->getControllerName() != 'admin-upgrade') {
         foreach (Am_Di::getInstance()->resourceAccessTable->getAccessTables() as $t) {
             $k = $t->getPageId();
             $content_pages[] = array('id' => 'content-' . $k, 'module' => 'default', 'controller' => 'admin-content', 'action' => 'index', 'label' => $t->getAccessTitle(), 'resource' => 'grid_content', 'params' => array('page_id' => $k), 'route' => 'inside-pages');
         }
     }
     $this->addPage(array('id' => 'content', 'controller' => 'admin-content', 'label' => ___('Protect Content'), 'resource' => 'grid_content', 'class' => 'bold', 'pages' => $content_pages));
     $this->addPage(array('id' => 'configuration', 'uri' => '#', 'label' => ___('Configuration'), 'pages' => array_filter(array(array('id' => 'setup', 'controller' => 'admin-setup', 'label' => ___('Setup/Configuration'), 'resource' => Am_Auth_Admin::PERM_SETUP, 'class' => 'bold'), array('id' => 'saved-form', 'controller' => 'admin-saved-form', 'label' => ___('Forms Editor'), 'resource' => @constant('Am_Auth_Admin::PERM_FORM'), 'class' => 'bold'), array('id' => 'fields', 'controller' => 'admin-fields', 'label' => ___('Add User Fields'), 'resource' => @constant('Am_Auth_Admin::PERM_ADD_USER_FIELD')), array('id' => 'email-template-layout', 'controller' => 'admin-email-template-layout', 'label' => ___('Email Layouts'), 'resource' => Am_Auth_Admin::PERM_SETUP), array('id' => 'ban', 'controller' => 'admin-ban', 'label' => ___('Blocking IP/E-Mail'), 'resource' => @constant('Am_Auth_Admin::PERM_BAN')), array('id' => 'countries', 'controller' => 'admin-countries', 'label' => ___('Countries/States'), 'resource' => @constant('Am_Auth_Admin::PERM_COUNTRY_STATE')), array('id' => 'admins', 'controller' => 'admin-admins', 'label' => ___('Admin Accounts'), 'resource' => Am_Auth_Admin::PERM_SUPER_USER), array('id' => 'change-pass', 'controller' => 'admin-change-pass', 'label' => ___('Change Password'))))));
     $this->addPage(array('id' => 'utilites', 'uri' => '#', 'label' => ___('Utilities'), 'order' => 1000, 'pages' => array_filter(array(Am_Di::getInstance()->modules->isEnabled('cc') ? null : array('id' => 'backup', 'controller' => 'admin-backup', 'label' => ___('Backup'), 'resource' => Am_Auth_Admin::PERM_BACKUP_RESTORE), Am_Di::getInstance()->modules->isEnabled('cc') ? null : array('id' => 'restore', 'controller' => 'admin-restore', 'label' => ___('Restore'), 'resource' => Am_Auth_Admin::PERM_BACKUP_RESTORE), array('id' => 'rebuild', 'controller' => 'admin-rebuild', 'label' => ___('Rebuild Db'), 'resource' => @constant('Am_Auth_Admin::PERM_REBUILD_DB')), clone $separator, array('id' => 'logs', 'type' => 'Am_Navigation_Page_Mvc', 'controller' => 'admin-logs', 'label' => ___('Logs'), 'resource' => array(@constant('Am_Auth_Admin::PERM_LOGS'), @constant('Am_Auth_Admin::PERM_LOGS_ACCESS'), @constant('Am_Auth_Admin::PERM_LOGS_INVOICE'), @constant('Am_Auth_Admin::PERM_LOGS_MAIL'), @constant('Am_Auth_Admin::PERM_LOGS_ADMIN'))), array('id' => 'info', 'controller' => 'admin-info', 'label' => ___('System Info'), 'resource' => @constant('Am_Auth_Admin::PERM_SYSTEM_INFO')), clone $separator, array('id' => 'trans-global', 'controller' => 'admin-trans-global', 'label' => ___('Edit Messages'), 'resource' => @constant('Am_Auth_Admin::PERM_TRANSLATION')), array('id' => 'clear', 'controller' => 'admin-clear', 'label' => ___('Delete Old Records'), 'resource' => @constant('Am_Auth_Admin::PERM_CLEAR')), array('id' => 'build-demo', 'controller' => 'admin-build-demo', 'label' => ___('Build Demo'), 'resource' => @constant('Am_Auth_Admin::PERM_BUILD_DEMO'))))));
     $this->addPage(array('id' => 'help', 'uri' => '#', 'label' => ___('Help & Support'), 'order' => 1001, 'pages' => array_filter(array(array('id' => 'documentation', 'uri' => 'http://www.amember.com/docs/', 'target' => '_blank', 'label' => ___('Documentation')), array('id' => 'report-bugs', 'uri' => 'http://bt.amember.com/', 'target' => '_blank', 'label' => ___('Report Bugs'))))));
     Am_Di::getInstance()->hook->call(Am_Event::ADMIN_MENU, array('menu' => $this));
     /// workaround against using the current route for generating urls
     foreach (new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST) as $child) {
         if ($child instanceof Zend_Navigation_Page_Mvc && $child->getRoute() === null) {
             $child->setRoute('default');
         }
     }
 }
Example #23
0
 function indexAction()
 {
     $e = $this->getParam('e');
     if (!$e) {
         throw new Am_Exception_InputError("Empty e-mail parameter passed - wrong url");
     }
     $s = $this->getFiltered('s');
     if (!Am_Mail::validateUnsubscribeLink($e, $s, Am_Mail::LINK_USER)) {
         throw new Am_Exception_InputError(___('Wrongly signed URL, please contact site admin'));
     }
     $this->view->user = $this->getDi()->userTable->findFirstByEmail($e);
     if (!$this->view->user) {
         throw new Am_Exception_InputError(___("Wrong parameters, error #1253"));
     }
     if ($this->_request->get('yes')) {
         $this->view->user->unsubscribed = 1;
         $this->view->user->update();
         $this->getDi()->hook->call(Am_Event::USER_UNSUBSCRIBED_CHANGED, array('user' => $this->view->user, 'unsubscribed' => 1));
         return $this->_redirect('member?' . http_build_query(array('_msg' => ___('Status of your subscription has been changed.')), '', '&'));
     } elseif ($this->_request->get('no')) {
         return $this->_redirect('member');
     }
     $this->view->e = $e;
     $this->view->s = $s;
     if (!$this->getDi()->blocks->get($this->view, 'unsubscribe')) {
         $this->getDi()->blocks->add(new Am_Block('unsubscribe', ___('Unsubscribe'), 'unsubscribe-std', null, 'unsubscribe-std.phtml'));
     }
     $this->view->display('unsubscribe.phtml');
 }
Example #24
0
 function indexAction()
 {
     if (!$this->getDi()->auth->getUserId()) {
         $this->getDi()->auth->checkExternalLogin($this->getRequest());
     }
     if ($this->getDi()->auth->getUserId()) {
         $this->_redirect('aff/aff');
     }
     // there are no reasons to use this form if logged-in
     $form = $this->getDi()->savedFormTable->getByType(SavedForm::D_AFF);
     if (!$form) {
         throw new Am_Exception_QuietError(___('There are no form available for affiliate signup.'));
     }
     $this->record = $form;
     $this->view->title = $this->record->title;
     if ($this->record->meta_title) {
         $this->view->meta_title = $this->record->meta_title;
     }
     if ($this->record->meta_keywords) {
         $this->view->headMeta()->setName('keywords', $this->record->meta_keywords);
     }
     if ($this->record->meta_description) {
         $this->view->headMeta()->setName('description', $this->record->meta_description);
     }
     $this->form = new Am_Form_Signup();
     $this->form->setParentController($this);
     $this->form->initFromSavedForm($this->record);
     $this->form->run();
 }
 function ajaxCheckCoupon($vars)
 {
     $coupon = htmlentities($vars['coupon']);
     $coupon = $this->getDi()->couponTable->findFirstByCode($coupon);
     $msg = $coupon ? $coupon->validate() : ___('No coupons found with such coupon code');
     return $this->ajaxResponse($msg === null ? true : $msg);
 }
Example #26
0
 function backupAction()
 {
     check_demo();
     if (!$this->_request->isPost()) {
         throw new Am_Exception_InputError(___('Backup can be runned by POST request only'));
     }
     $dat = date('Y_m_d-Hi');
     $host = strtolower(preg_replace('/[^a-zA-Z0-9\\.]/', '', preg_replace('/^www\\./', '', $_SERVER['HTTP_HOST'])));
     $fn = "amember-{$host}-{$dat}.sql";
     while (@ob_end_clean()) {
     }
     $bp = $this->getDi()->backupProcessor;
     if ($bp->isGzip()) {
         header("Content-Type: application/x-gzip");
     } else {
         header("Content-Type: text/sql");
     }
     header("Content-Disposition: attachment; filename={$fn}" . ($bp->isGzip() ? ".gz" : ""));
     $stream = fopen('php://output', 'wb');
     if (!$stream) {
         throw new Am_Exception_InternalError('Could not open php://output stream');
     }
     $bp->run($stream);
     $this->getDi()->adminLogTable->log('Downloaded backup');
     exit;
     // no any output later!
 }
Example #27
0
 public function skip($string)
 {
     $arr = explode("\n", $string);
     $s_arr = array();
     //find line for skipe
     //store this info to array
     foreach ($arr as $k => $v) {
         if (preg_match('/^\\s*>\\s*>/', trim($v))) {
             $s_arr[$k] = 1;
         } else {
             $s_arr[$k] = 0;
         }
     }
     //add one none skiped line at the end
     //in order to resolve problem if last line should be skiped too
     $arr[] = '';
     $arr = array_map(array('Am_Controller', 'escape'), $arr);
     $s_arr[] = 0;
     //remove empty lines beetween skiped lines
     $prev = 0;
     $empty_lines = array();
     foreach ($s_arr as $k => $v) {
         if (trim($arr[$k]) == '') {
             $empty_lines[] = $k;
         } elseif ($v && $prev) {
             foreach ($empty_lines as $key) {
                 $s_arr[$key] = 1;
             }
             $empty_lines = array();
             $prev = 1;
         } elseif ($v) {
             $empty_lines = array();
             $prev = 1;
         } else {
             $prev = 0;
         }
     }
     //skip
     $skiped = 0;
     $skiped_lines = array();
     $label_lines_skipped = ___('lines skipped');
     foreach ($s_arr as $k => $v) {
         if ($v) {
             $skiped_lines[] = $arr[$k];
             if (!$skiped) {
                 $first_skiped_line = $k;
             } else {
                 unset($arr[$k]);
             }
             $skiped++;
         } elseif ($skiped) {
             $arr[$first_skiped_line] = '<div style="color:red; cursor:pointer; display:inline" onclick="elem = this.nextSibling; elem.style.display = (elem.style.display == \'block\') ? \'none\' : \'block\';">...' . $skiped . ' ' . $label_lines_skipped . '...</div><div style="display:none; border-left:1px solid red; padding-left:0.5em"><pre>' . implode("\n", $skiped_lines) . '</pre></div>';
             $skiped = 0;
             $skiped_lines = array();
         }
     }
     $string = implode("\n", $arr);
     return $string;
 }
Example #28
0
    public static function display_backend()
    {
        ?>
		<fieldset>
			<legend><i class="fa fa-fw fa-newspaper-o"></i> <?php 
        echo ___('Graphic text mode settings');
        ?>
</legend>
			<p class="description"><?php 
        echo ___('Graphic text mode is a different with normal card list mode. It is mixed list with graphic and text.');
        ?>
</p>
			<table class="form-table">
				<tbody>
					<tr>
						<th><label for="<?php 
        echo __CLASS__;
        ?>
-enabled"><?php 
        echo ___('Enable or not?');
        ?>
</label></th>
						<td>
							<select name="<?php 
        echo __CLASS__;
        ?>
[enabled]" id="<?php 
        echo __CLASS__;
        ?>
-enabled" class="widefat">
								<?php 
        the_option_list(-1, ___('Disable'), self::get_options('enabled'));
        ?>
								<?php 
        the_option_list(1, ___('Enable'), self::get_options('enabled'));
        ?>
							</select>
						</td>
					</tr>
					<tr>
						<th><label for="<?php 
        echo __CLASS__;
        ?>
-cat-id"><?php 
        echo ___('Which category using?');
        ?>
</label></th>
						<td>
							<?php 
        theme_features::cat_option_list(__CLASS__, 'cat-id');
        ?>
						</td>
					</tr>
				</tbody>
			</table>
		</fieldset>

		<?php 
    }
Example #29
0
 public function _initSetupForm(Am_Form_Setup $form)
 {
     $form->addText('merchant', array('size' => 20, 'maxlength' => 16))->setLabel("The QuickPayId")->addRule('required');
     $form->addText('secret', array('size' => 66, 'maxlength' => 80))->setLabel("Secret code")->addRule('required');
     $fl = $form->addFieldset()->setLabel(___('Quickpay parameters'));
     $fl->addSelect('lang', array(), array('options' => array('da' => 'Danish', 'de' => 'German', 'en' => 'English', 'es' => 'Spanish', 'fo' => 'Faeroese', 'fi' => 'Finnish', 'fr' => 'French', 'kl' => 'Greenlandish', 'it' => 'Italian', 'no' => 'Norwegian', 'nl' => 'Dutch', 'pl' => 'Polish', 'ru' => 'Russian', 'sv' => 'Swedish')))->setLabel("The payment window language");
     $form->addAdvCheckbox("testing")->setLabel("Test Mode Enabled");
 }
Example #30
0
    function onSetupForms(Am_Event_SetupForms $event)
    {
        $form = new Am_Form_Setup($this->getId());
        $form->setTitle('REST API');
        $event->addForm($form);
        $form->addAdvCheckbox('api_debug_mode')->setLabel(___('Enable Debug Mode') . "\n" . ___('all requests will be added to %sLogs%s,
useful if something is going wrong', '<a href="' . ROOT_URL . '/admin-logs">', '</a>'));
    }