Beispiel #1
0
 function loginForm()
 {
     do_action('loginx_before_login_form');
     if (parent::useWoo() && !$_GET['password'] && !$_POST['reset'] && !$_GET['reset'] && !$_GET['resend'] && !$_GET['act']) {
         print '<script>window.location.href = "' . get_permalink(woocommerce_get_page_id('myaccount')) . '";</script>';
         exit;
     }
     require_once PHPX_DIR . '/phpx_form.php';
     $form = new phpx_form();
     if (parent::loginx_successMessage()) {
         $text = '<div class="loginx_success">' . parent::loginx_successMessage('get') . '</div>';
     } else {
         if ($_GET['password'] || $_POST['reset']) {
             $form->startForm(parent::loginx_getURL() . '?password=1');
             if (parent::loginx_errorMessage()) {
                 $form->freeText(parent::loginx_errorMessage('get'), 'loginx_error');
             }
             $form->freeText($this->options['password_text']);
             $form->textField('Email/Username', 'email', '', true);
             $form->hidden('nonce', wp_create_nonce('loginx'));
             $text = '<div id="loginx_password">' . $form->endForm() . '</div>';
         } else {
             if ($_GET['reset']) {
                 $user_id = $this->wpdb->get_var($this->wpdb->prepare('select user_id from ' . $this->wpdb->prefix . 'loginx_key where loginx_key = %s and loginx_expire > %d limit 1', $_GET['reset'], time()));
                 if (!$user_id) {
                     $text = '<div class="loginx_error">' . $this->options['bad_key'] . '</div>';
                 } else {
                     $form->startForm(parent::loginx_getURL());
                     if (parent::loginx_errorMessage()) {
                         $form->freeText(parent::loginx_errorMessage('get'), 'loginx_error');
                     }
                     $form->freeText($this->options['password_reset_text']);
                     $form->password('Password', 'pass', true, 6);
                     $form->password('Confirm Password', 'pass_confirm', true, 6, true);
                     $form->hidden('nonce', wp_create_nonce('loginx'));
                     $form->hidden('reset', $_GET['reset']);
                     $text = '<div id="loginx_password">' . $form->endForm() . '</div>';
                 }
             } else {
                 $form->startForm($this->loginx_getURL());
                 if (parent::loginx_errorMessage()) {
                     $form->freeText(parent::loginx_errorMessage('get'), 'loginx_error');
                 }
                 $form->textField('Username', 'username', '', true);
                 $form->password('Password', 'password', true, 4);
                 //$form->checkBox('Remember Me?', 'remember', 0);
                 $form->hidden('remember', 'forever');
                 $form->hidden('nonce', wp_create_nonce('loginx'));
                 $form->freeText('<div id="loginx_password_link"><a href="' . get_permalink() . '?password=1">Forgot Login/Password?</a></div>');
                 $form->freeText('<div id="loginx_register_link"><a href="' . get_permalink($this->options['register_page']) . '">Register</a></div>');
                 if (function_exists('rpx_init')) {
                     $form->freeText(do_shortcode('[rpxlogin]'));
                 }
                 $text = '<div id="loginx_form">' . $form->endForm() . '</div>';
             }
         }
     }
     do_action('loginx_after_login_form');
     return $text;
 }
Beispiel #2
0
 function adbarx_admin()
 {
     if ($_POST['nonce']) {
         if (!wp_verify_nonce($_POST['nonce'], 'adbarx_admin')) {
             die('Invalid Security Token');
         }
         $this->options['remember'] = $_POST['showOnce'] == 'on' ? 1 : 0;
         $this->options['content'] = $_POST['content'];
         $this->options['title'] = $_POST['title'];
         if ($_POST['resetViews'] == 'on') {
             $this->options['cookie'] = 'adx_' . substr(md5(microtime()), 5, 20);
         }
         update_option('adbarx_options', $this->options);
     }
     add_filter('admin_head', array($this, 'adbarx_showEditor'));
     require_once PHPX_DIR . 'phpx_form.php';
     $form = new phpx_form();
     $form->instantReturn = true;
     $text = '<div class="wrap"><h2>Ad Bar X</h2>';
     $text .= $form->startForm('themes.php?page=adbarx/includes/adbarx_functions.php', 'adbarxForm');
     $text .= $form->hidden('nonce', wp_create_nonce('adbarx_admin'));
     print $text;
     the_editor(stripslashes($this->options['content']), 'content');
     $text = '<br /><br />';
     $text .= $form->textField('Bar Title', 'title', $this->options['title']);
     $text .= $form->checkBox('Show Adbar Once', 'showOnce', 1);
     $text .= $form->checkBox('Reset All Views', 'resetViews', 0);
     $text .= $form->endForm();
     $text .= '</div>';
     print $text;
 }
Beispiel #3
0
 function crowdx_run()
 {
     if ($_POST['submit']) {
         if (!wp_verify_nonce($_POST["_wpnonce"])) {
             die('Security check');
         }
         $omit = array('_wpnonce', 'submit');
         foreach (array_keys($_POST) as $p) {
             if (!in_array($p, $omit)) {
                 $this->options[$p] = $_POST[$p];
             }
         }
         update_option('crowdx_options', $this->options);
         $status = 'Options Updated';
     }
     $userRoleArray = array();
     $wp_roles = new WP_Roles();
     foreach ($wp_roles->role_names as $role => $name) {
         $userRoleArray[$role] = $name;
     }
     require_once PHPX_DIR . 'phpx_page.php';
     require_once PHPX_DIR . 'phpx_form.php';
     $page = new phpx_page();
     $form = new phpx_form();
     $form->startForm($this->baseURL, "crowdxForm");
     $form->hidden("_wpnonce", wp_create_nonce());
     $form->dropDown('Enabled', 'enable', $this->options['enable'], array('Off', 'On'));
     $form->dropDown('All Users (Internal and Crowd)', 'all_users', $this->options['all_users'], array('Off', 'On'));
     $form->dropDown('Auto Add New Users from Crowd', 'add_users', $this->options['add_users'], array('Off', 'On'));
     $form->dropDown('User Role for Added Users', 'default_user_role', $this->options['default_user_role'], $userRoleArray);
     $form->dropDown('Fallback to Internal Database', 'fallback', $this->options['fallback'], array('Off', 'On'));
     $form->textField('URL to Crowd Server', 'server', $this->options['server']);
     $form->textField('Application Name', 'app_name', $this->options['app_name'], true);
     $form->textField('Application Password', 'app_pass', $this->options['app_pass'], true);
     $form->endForm('Submit');
     $text = $page->startPage('CrowdX Configuration', $status) . $form->text . $page->endPage();
     print $text;
 }
Beispiel #4
0
 function registerForm()
 {
     if ($_POST['submit']) {
         $cont = true;
         if (!wp_verify_nonce($_POST['nonce'], 'loginx_register')) {
             parent::loginx_errorMessage('Security Token Mismatch');
             $cont = false;
         } else {
             if (username_exists($_POST['user_login'])) {
                 parent::loginx_errorMessage('Username Exists.  Do you want to <a href="' . $this->loginx_getURL() . '">Login?</a>');
                 $_POST['user_login'] = '';
                 $cont = false;
             } else {
                 if (email_exists($_POST['user_email'])) {
                     parent::loginx_errorMessage('Email Exists.  Do you want to <a href="' . $this->loginx_getURL() . '">Login?</a>');
                     $_POST['user_email'] = '';
                     $cont = false;
                 } else {
                     if ($_POST['recaptcha_challenge_field']) {
                         $data['privatekey'] = $this->options['captcha_private'];
                         $data['remoteip'] = $_SERVER['REMOTE_ADDR'];
                         $data['challenge'] = $_POST['recaptcha_challenge_field'];
                         $data['response'] = $_POST['recaptcha_response_field'];
                         $c = curl_init();
                         curl_setopt($c, CURLOPT_URL, 'http://www.google.com/recaptcha/api/verify');
                         curl_setopt($c, CURLOPT_POST, true);
                         curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
                         curl_setopt($c, CURLOPT_POSTFIELDS, $data);
                         $response = curl_exec($c);
                         $r = explode("\n", $response);
                         if ($r[0] == 'true') {
                         } else {
                             parent::loginx_errorMessage($this->option['captcha_fail']);
                             $cont = false;
                         }
                     }
                 }
             }
         }
         if ($cont == true) {
             $omit = array('submit', 'nonce', 'user_pass_confirm', 'captcha', 'recaptcha_challenge_field', 'recaptcha_response_field');
             $wpFields = array();
             $createArray = array();
             $metaArray = array();
             $results = $this->wpdb->get_results('select loginx_field_name from ' . $this->wpdb->prefix . 'loginx_field where loginx_field_wp = 1');
             foreach ($results as $row) {
                 $wpFields[] = $row->loginx_field_name;
             }
             foreach ($_POST as $k => $v) {
                 if (!in_array($k, $omit)) {
                     if (in_array($k, $wpFields)) {
                         $createArray[$k] = $v;
                     } else {
                         $metaArray[$k] = $v;
                     }
                 }
             }
             $user_id = wp_insert_user($createArray);
             foreach ($metaArray as $k => $v) {
                 add_user_meta($user_id, $k, $v, true);
             }
             if ($this->options['email_valid'] == 'on') {
                 $actKey = substr(md5(microtime() . NONCE_SALT), 5, 15);
                 $this->wpdb->insert($this->wpdb->prefix . 'loginx_key', array('user_id' => $user_id, 'loginx_key' => $actKey, 'loginx_expire' => 0, 'act' => 1));
                 $subject = parent::loginx_emailTrans($this->options['act_email_subject']);
                 $message = parent::loginx_emailTrans($this->options['act_email_text'], array('::LINK::' => get_permalink($this->options['login_page']) . '?act=' . $actKey));
                 wp_mail($_POST['user_email'], $subject, $message);
                 parent::loginx_successMessage($this->options['register_success_message']);
                 $text = '<div id="loginx_form">' . parent::loginx_successMessage() . '</div>';
                 return $text;
             } else {
                 wp_redirect(get_permalink($this->options['profile_page']));
             }
         }
     }
     require_once PHPX_DIR . 'phpx_form.php';
     $form = new phpx_form();
     $form->startForm(get_permalink(), 'loginxRegisterForm');
     $form->hidden('nonce', wp_create_nonce('loginx_register'));
     if (parent::loginx_errorMessage()) {
         $form->freeText(parent::loginx_errorMessage('get'), 'loginx_error');
     }
     $results = $this->wpdb->get_results('select loginx_field_name, loginx_field_label, loginx_field_options, loginx_field_type, loginx_field_req from ' . $this->wpdb->prefix . 'loginx_field where loginx_field_reg = 1 order by loginx_field_ord asc');
     $form = parent::publicForm($form, $results);
     $text = '<div id="loginx_form">' . $form->endForm() . '</div>';
     return $text;
 }
Beispiel #5
0
 function editProfile()
 {
     global $current_user;
     get_currentuserinfo();
     if ($_POST['submit']) {
         $cont = true;
         if (!wp_verify_nonce($_POST['nonce'], 'loginx_profile')) {
             parent::loginx_errorMessage('Security Token Mismatch');
             $cont = false;
         } else {
             if ($current_user->user_email != $_POST['user_email'] && $_POST['user_email'] != '' && isset($_POST['user_email'])) {
                 if (email_exists($_POST['user_email'])) {
                     parent::loginx_errorMessage('Email already exists.');
                     $cont = false;
                 } else {
                     if ($this->options['email_valid'] == 'on') {
                         $emailVerify = true;
                         $actKey = substr(md5(microtime() . NONCE_SALT), 5, 15);
                         $this->wpdb->insert($this->wpdb->prefix . 'loginx_key', array('user_id' => $current_user->ID, 'loginx_key' => $actKey, 'loginx_expire' => 0, 'act' => 1));
                         $subject = parent::loginx_emailTrans($this->options['act_email_subject']);
                         $message = parent::loginx_emailTrans($this->options['act_email_text'], array('::LINK::' => get_permalink($this->options['login_page']) . '?act=' . $actKey));
                         wp_mail($_POST['user_email'], $subject, $message);
                     }
                 }
             }
         }
         if ($cont == true) {
             $_POST['user_login'] = $current_user->user_login;
             $omit = array('submit', 'nonce', 'user_pass_confirm', 'captcha', 'recaptcha_challenge_field', 'recaptcha_response_field');
             $wpFields = array();
             $createArray = array();
             $metaArray = array();
             $results = $this->wpdb->get_results('select loginx_field_name, loginx_field_wp from ' . $this->wpdb->prefix . 'loginx_field');
             foreach ($results as $row) {
                 if ($row->loginx_field_wp == 1) {
                     $wpFields[] = $row->loginx_field_name;
                 } else {
                     $metaFields[] = $row->loginx_field_name;
                 }
             }
             foreach ($_POST as $k => $v) {
                 if (!in_array($k, $omit)) {
                     if (in_array($k, $wpFields)) {
                         if ($_POST[$k] != '') {
                             $updateArray[$k] = $v;
                         }
                     } else {
                         $metaArray[$k] = $v;
                     }
                 }
             }
             $updateArray['ID'] = $current_user->ID;
             wp_update_user($updateArray);
             foreach ($metaArray as $k => $v) {
                 update_user_meta($current_user->ID, $k, $v);
             }
             foreach ($metaFields as $m) {
                 if (!in_array($m, array_keys($metaArray))) {
                     delete_user_meta($current_user->ID, $m);
                 }
             }
             $message = $emailVerify == true ? $this->options['profile_email_verify_message'] : '';
             $message .= $this->options['profile_success_message'];
             do_action('loginx_after_profile_save', $emailVerify);
             parent::loginx_successMessage($message);
         }
     }
     require_once PHPX_DIR . 'phpx_form.php';
     $form = new phpx_form();
     $form->startForm(get_permalink() . '?edit=1', 'loginxProfileForm');
     $form->hidden('nonce', wp_create_nonce('loginx_profile'));
     $form->hidden('loginx_form', 1);
     if (parent::loginx_errorMessage()) {
         $form->freeText(parent::loginx_errorMessage('get'), 'loginx_error');
     } else {
         if (parent::loginx_successMessage()) {
             $form->freeText(parent::loginx_successMessage('get'), 'loginx_success');
         }
     }
     $results = $this->wpdb->get_results('select loginx_field_name, loginx_field_label, loginx_field_options, loginx_field_type, loginx_field_req, loginx_field_no_edit from ' . $this->wpdb->prefix . 'loginx_field where loginx_field_profile = 1 order by loginx_field_ord asc');
     parent::setFormValue($current_user);
     $form = parent::publicForm($form, $results, false);
     $form->freeText($this->rpx_user_profile());
     $this->text .= '<div id="loginx_form">' . $form->endForm() . '</div>';
 }
Beispiel #6
0
 function adminPage()
 {
     if (current_user_can('publish_pages')) {
         if ($_POST['submit']) {
             $omit = array('submit', 'wp_nonce');
             if (!wp_verify_nonce($_POST['wp_nonce'], 'tabx')) {
                 die('Invalid Token');
             }
             foreach ($_POST as $k => $v) {
                 if (!in_array($k, $omit)) {
                     $this->options[$k] = $v;
                 }
             }
             if ($_FILES['image']['name'] != '') {
                 $file = wp_handle_upload($_FILES['image'], array('test_form' => false));
                 $this->options['image'] = $file['url'];
             }
             update_option('tabx_options', $this->options);
             $message = '<p>Options Saved</p>';
         }
         $envArray = array('Development', 'Production');
         require_once PHPX_DIR . 'phpx_form.php';
         $form = new phpx_form();
         $text = '<div class="wrap" id="phpxContainer"><h2>Slide Out Tab</h2>';
         if ($message || $_GET['message']) {
             $text .= $message;
         }
         $text .= $form->startForm('tools.php?page=tabx/tabx.php', 'tabxForm', 'post', true);
         $text .= $form->hidden('wp_nonce', wp_create_nonce('tabx'));
         $text .= $form->textField('Link Text', 'link_text', $this->options['link_text']);
         ob_start();
         wp_editor(stripslashes($this->options['content']), 'tabxcontent', array('textarea_name' => 'content'));
         $text .= $form->freeText(ob_get_contents());
         ob_end_clean();
         $locationArray = array('top' => 'top', 'bottom' => 'bottom', 'left' => 'left', 'right' => 'right');
         $actionArray = array('click' => 'click', 'hover' => 'hover');
         $fixedArray = array('true' => 'True', 'false' => 'False');
         $text .= $form->fileField('Image', 'image');
         $text .= $form->freeText('<strong>Current Image: </strong><br /><img src="' . $this->options['image'] . '" />');
         $text .= $form->textField('Image Height', 'height', $this->options['height']);
         $text .= $form->textField('Image Width', 'width', $this->options['width']);
         $text .= $form->dropDown('Location', 'location', $this->options['location'], $locationArray);
         $text .= $form->textField('Speed', 'speed', $this->options['speed']);
         $text .= $form->dropDown('Action', 'action', $this->options['action'], $actionArray);
         $text .= $form->textField('Top Position', 'top', $this->options['top']);
         $text .= $form->textField('Left Position', 'left', $this->options['left']);
         $text .= $form->dropDown('Fixed Position', 'fixed', $this->options['fixed'], $fixedArray);
         $text .= $form->endForm();
         $text .= '</div>';
         print $text;
     }
 }
Beispiel #7
0
 function fieldform()
 {
     require_once PHPX_DIR . 'phpx_form.php';
     $form1 = new phpx_form();
     $form1->labels = false;
     $form1->instantReturn = true;
     $text .= $form1->startForm($adminURL, 'loginxFieldForm', 'post', false, 'false');
     $id = 0;
     $reg = 0;
     $req = 0;
     if ($_GET['action'] == 'edit') {
         $row = $this->wpdb->get_row($this->wpdb->prepare('select * from ' . $this->wpdb->prefix . 'loginx_field where loginx_field_id = %d limit 1', $_GET['id']));
         $id = $row->loginx_field_id;
         $req = $row->loginx_field_req;
         $reg = $row->loginx_field_reg;
     }
     $addField = '<table class="inline"><tr><th>Name</th><th>Label</th><th>Type</th><th>Options</th></tr><tr>';
     $addField .= '<td>' . $form1->textField('Name', 'loginx_field_name', $row->loginx_field_name, true) . '</td>';
     $addField .= '<td>' . $form1->textField('Label', 'loginx_field_label', $row->loginx_field_label, true) . '</td>';
     $addField .= '<td>' . $form1->dropDown('Type', 'loginx_field_type', $row->loginx_field_type, $this->fieldTypes, false, true) . '</td>';
     $addField .= '<td>' . $form1->textArea('Options', 'loginx_field_options', $row->loginx_field_options) . '</td>';
     $addField .= '</tr></table>';
     $text .= '<a name="customFields"></a><fieldset><legend>Custom Fields</legend>';
     $text .= $form1->startFieldSet('Add Custom User Field');
     $text .= $form1->hidden('nonce', wp_create_nonce('loginx_manage_fields'));
     $text .= $form1->hidden('loginx_field_id', $id);
     $text .= $form1->freeText($addField);
     $text .= $form1->endForm();
     $text .= '</fieldset>';
     $text .= '<div id="customFieldsList">';
     $text .= '</div>';
     $text .= '</fieldset>';
     return $text;
 }