예제 #1
0
파일: back.php 프로젝트: crazyyy/octagram
 function redirectProcess()
 {
     global $wysi_location;
     if (!$wysi_location) {
         $wysi_location = $this->getDefaultUrl();
     }
     WYSIJA::redirect($wysi_location);
 }
예제 #2
0
 function form_edit()
 {
     // define whether the form can be edited
     $this->data['can_edit'] = true;
     // wysija form editor javascript files
     $this->js[] = 'wysija-form-editor';
     $this->js[] = 'wysija-admin-ajax-proto';
     // $this->js[]='wysija-admin-ajax';
     $this->js[] = 'wysija-base-script-64';
     $this->js[] = 'mailpoet-select2';
     // make sure the editor content is not cached
     //header('Cache-Control: no-cache, max-age=0, must-revalidate, no-store'); // HTTP/1.1
     //header('Expires: Fri, 9 Mar 1984 00:00:00 GMT');
     // get form id
     $form_id = isset($_REQUEST['id']) && (int) $_REQUEST['id'] > 0 ? (int) $_REQUEST['id'] : null;
     $form = array('name' => __('New form', WYSIJA));
     // if no form id was specified, then it's a new form
     if ($form_id !== null) {
         // try to get form data based on form id
         $model_forms = WYSIJA::get('forms', 'model');
         $form = $model_forms->getOne($form_id);
         // if the form does not exist
         if (empty($form)) {
             // redirect to forms list
             $this->error(__('This form does not exist.', WYSIJA), true);
             WYSIJA::redirect('admin.php?page=wysija_config#tab-forms');
         } else {
             // pass form id to the view
             $this->data['form_id'] = (int) $form['form_id'];
         }
     }
     // pass form to the view
     $this->data['form'] = $form;
     $helper_form_engine = WYSIJA::get('form_engine', 'helper');
     $lists = $helper_form_engine->get_lists();
     $this->data['lists'] = $lists;
     // disable editing capability when there is no list
     if (empty($lists)) {
         $this->data['can_edit'] = false;
     }
     // get custom fields
     $this->data['custom_fields'] = $helper_form_engine->get_custom_fields();
     // translations
     $this->jsTrans = array_merge($this->jsTrans, $helper_form_engine->get_translations());
 }
예제 #3
0
 function check()
 {
     $config =& WYSIJA::get('config', 'model');
     if (!$config->getValue('wysija_db_version') || version_compare($config->getValue('wysija_db_version'), WYSIJA::get_version()) < 0) {
         $this->update(WYSIJA::get_version());
     }
     $noredirect = false;
     $timeInstalled = $config->getValue('installed_time') + 3600;
     if (current_user_can('switch_themes')) {
         if ((!$config->getValue('wysija_whats_new') || version_compare($config->getValue('wysija_whats_new'), WYSIJA::get_version()) < 0) && isset($_REQUEST['page']) && in_array($_REQUEST['page'], array('wysija_config', 'wysija_campaigns', 'wysija_subscribers'))) {
             if (isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('whats_new', 'welcome_new', 'activate-plugin'))) {
                 $noredirect = true;
             }
             if (!$noredirect) {
                 if (time() > $timeInstalled) {
                     WYSIJA::redirect('admin.php?page=wysija_campaigns&action=whats_new');
                 } else {
                     WYSIJA::redirect('admin.php?page=wysija_campaigns&action=welcome_new');
                 }
                 $mConfig =& WYSIJA::get('config', 'model');
                 $mConfig->save(array('wysija_whats_new' => WYSIJA::get_version()));
             }
         }
     }
 }
예제 #4
0
파일: UPDATE.PHP 프로젝트: pauEscarcia/AIMM
    /**
     *
     * @return type
     */
    function check(){

        //we can go there if this is not a new installation and it's an admin
        if(WYSIJA::current_user_can('switch_themes') ){

            // check that the redirection is only processed from wysija's interfaces
            if(isset($_REQUEST['page']) && in_array($_REQUEST['page'], array('wysija_config','wysija_campaigns','wysija_subscribers'))){

                // we are earlier than 1.1  or earlier than the current file version so we can run what's needed to reach the right version number
                $config=WYSIJA::get('config','model');

                if(!$config->getValue('wysija_db_version') || version_compare($config->getValue('wysija_db_version'),WYSIJA::get_version()) < 0){
                    $this->update(WYSIJA::get_version());
                }
                // once the update procedure is done we can redirect to the what's new/fixed page
                $noredirect=false;

                //get the right option name based on the type of site we're in
                $whats_new_option='wysija_whats_new';
                $is_multisite=is_multisite();
                $is_network_admin=WYSIJA::current_user_can('manage_network');

                // check that in case of a multisite configuration only the network admin sees that update page
                if($is_multisite){
                    if($is_network_admin){
                        $whats_new_option='ms_wysija_whats_new';
                    }else {
                        return;
                    }
                }

                // a whats_new option is set and it is less than the current version so that means we need to display it
                if((!$config->getValue($whats_new_option) || version_compare($config->getValue($whats_new_option),WYSIJA::get_version()) < 0)){

                    //if there is an action set and it's one of those then we just don't redirect
                    if(isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('whats_new','welcome_new','activate-plugin')))  $noredirect=true;

                    if(!$noredirect) {
                        $timeInstalled=$config->getValue('installed_time')+3600;
                        //if it is a fresh install then it redirects to the welcome screen otherwise to the update one
                        if(time()>$timeInstalled){
                            WYSIJA::redirect('admin.php?page=wysija_campaigns&action=whats_new');
                        }else{
                            WYSIJA::redirect('admin.php?page=wysija_campaigns&action=welcome_new');
                        }
                    }
                }
            }


        }
    }
예제 #5
0
 function check()
 {
     $config =& WYSIJA::get('config', 'model');
     if (!$config->getValue('wysija_db_version') || version_compare($config->getValue('wysija_db_version'), WYSIJA::get_version()) < 0) {
         $this->update(WYSIJA::get_version());
     }
     $noredirect = false;
     if (WYSIJA::current_user_can('switch_themes')) {
         if (isset($_REQUEST['page']) && in_array($_REQUEST['page'], array('wysija_config', 'wysija_campaigns', 'wysija_subscribers'))) {
             $whats_new_option = 'wysija_whats_new';
             $is_multisite = is_multisite();
             $is_network_admin = WYSIJA::current_user_can('manage_network');
             if ($is_multisite) {
                 if ($is_network_admin) {
                     $whats_new_option = 'ms_wysija_whats_new';
                 } else {
                     return;
                 }
             }
             if (!$config->getValue($whats_new_option) || version_compare($config->getValue($whats_new_option), WYSIJA::get_version()) < 0) {
                 if (isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('whats_new', 'welcome_new', 'activate-plugin'))) {
                     $noredirect = true;
                 }
                 if (!$noredirect) {
                     $timeInstalled = $config->getValue('installed_time') + 3600;
                     if (time() > $timeInstalled) {
                         WYSIJA::redirect('admin.php?page=wysija_campaigns&action=whats_new');
                     } else {
                         WYSIJA::redirect('admin.php?page=wysija_campaigns&action=welcome_new');
                     }
                 }
             }
         }
     }
 }
예제 #6
0
파일: config.php 프로젝트: namwoody/curry
 function form_edit()
 {
     // wysija form editor javascript files
     $this->js[] = 'wysija-form-editor';
     $this->js[] = 'wysija-admin-ajax-proto';
     $this->js[] = 'wysija-admin-ajax';
     $this->js[] = 'wysija-base-script-64';
     // make sure the editor content is not cached
     //header('Cache-Control: no-cache, max-age=0, must-revalidate, no-store'); // HTTP/1.1
     //header('Expires: Fri, 9 Mar 1984 00:00:00 GMT');
     // get form id
     $form_id = isset($_REQUEST['id']) && (int) $_REQUEST['id'] > 0 ? (int) $_REQUEST['id'] : null;
     $form = array('name' => __('New form', WYSIJA));
     // if no form id was specified, then it's a new form
     if ($form_id !== null) {
         // try to get form data based on form id
         $model_forms = WYSIJA::get('forms', 'model');
         $form = $model_forms->getOne($form_id);
         // if the form does not exist
         if (empty($form)) {
             // redirect to forms list
             $this->error(__('This form does not exist.', WYSIJA), true);
             WYSIJA::redirect('admin.php?page=wysija_config#tab-forms');
         } else {
             // pass form id to the view
             $this->data['form_id'] = (int) $form['form_id'];
         }
     }
     // pass form to the view
     $this->data['form'] = $form;
     $helper_form_engine = WYSIJA::get('form_engine', 'helper');
     $lists = $helper_form_engine->get_lists();
     // select default list
     $default_list = array();
     if (!empty($lists)) {
         $default_list[] = array('list_id' => $lists[0]['list_id'], 'is_checked' => 0);
     }
     $this->data['lists'] = $lists;
     // get available custom fields
     $model_user_field = WYSIJA::get('user_field', 'model');
     $model_user_field->orderBy('field_id');
     $custom_fields = $model_user_field->getRows(false);
     // extra widgets that can be added more than once
     $extra_fields = array(array('name' => __('List selection', WYSIJA), 'column_name' => 'list', 'column_type' => 'list', 'params' => array('label' => __('Select list(s):', WYSIJA), 'values' => $default_list)), array('name' => __('Random text or HTML', WYSIJA), 'column_name' => 'html', 'column_type' => 'html', 'params' => array('text' => __('Random text or HTML', WYSIJA))), array('name' => __('Divider', WYSIJA), 'column_name' => 'divider', 'column_type' => 'divider'));
     // set data to be passed to the view
     $this->data['custom_fields'] = array_merge($custom_fields, $extra_fields);
     // translations
     $this->jsTrans = array_merge($this->jsTrans, $helper_form_engine->get_translations());
     // This should be the title of the page but I don't know how to make it happen...
     // __('Edit', WYSIJA).' '.$this->data['form']['name'];
 }