From f53df847669b6abf5c21ad24ab6f5d307dbe076b Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Thu, 31 May 2012 06:07:33 +0000 Subject: [PATCH] Sign page refinements and some bbecode work. --- e107_admin/cpage.php | 34 +++- e107_admin/prefs.php | 39 ++-- e107_admin/users.php | 2 +- e107_core/bbcodes/html.bb | 4 +- .../shortcodes/batch/bbcode_shortcodes.php | 13 ++ e107_core/xml/default_install.xml | 6 +- e107_files/jslib/core/all.jquery.js | 50 ++++- e107_files/jslib/password/jquery.pwdMeter.js | 2 +- e107_handlers/form_handler.php | 27 ++- e107_plugins/facebook/e_module.php | 187 +++++------------- e107_themes/templates/header_default.php | 3 + e107_themes/templates/signup_template.php | 75 ++++--- signup.php | 30 ++- 13 files changed, 273 insertions(+), 199 deletions(-) diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php index 3fb65c34b..ecd20fa67 100644 --- a/e107_admin/cpage.php +++ b/e107_admin/cpage.php @@ -36,6 +36,8 @@ require_once(e_HANDLER.'message_handler.php'); require_once(e_HANDLER.'form_handler.php'); $frm = new e_form(true); $emessage = eMessage::getInstance(); + + // $page = new page; /* @@ -123,7 +125,13 @@ class page_admin extends e_admin_dispatcher 'path' => null, 'ui' => 'page_admin_form_ui', 'uipath' => null - ) + ), + 'dialog' => array( + 'controller' => 'page_admin_ui', + 'path' => null, + 'ui' => 'page_admin_form_ui', + 'uipath' => null + ) ); protected $adminMenu = array( @@ -215,6 +223,14 @@ class page_admin_ui extends e_admin_ui function init() { + if($this->getQuery('iframe') == 1) + { + + $this->getResponse()->setIframeMod(); + } + + + //FIXME - mode not retained after using drop-down 'filter' or 'search'. if($_GET['mode'] =='menu') { @@ -266,6 +282,18 @@ class page_admin_ui extends e_admin_ui $this->createPage('menu'); } + function dialogPage() // FIXME - remove table-rendering when using 'return' ?? + { + $frm = e107::getForm(); + $text .= "
\n"; + $text .= "
Title: ".$frm->text('page_subtitle[]', '', 250)."
\n"; + $text .= $frm->bbarea('data[]', '', 'page','help','large'); + $text .= "
"; + echo $text; + exit; + // return $text; + + } // Create Page Page. @@ -405,10 +433,11 @@ class page_admin_ui extends e_admin_ui $text .= $this->bbareaMulti('data', $textareaValue, 'page','help','large'); $text .= ""; + // $text .= $frm->bbarea('data', $textareaValue, 'page','help','large'); - + // $text .= ""; //
".display_help('cpage-help', 'cpage')." @@ -580,6 +609,7 @@ class page_admin_ui extends e_admin_ui $c++; } + $text .= ""; return $text; diff --git a/e107_admin/prefs.php b/e107_admin/prefs.php index 9f6bdc27a..c0d3059de 100644 --- a/e107_admin/prefs.php +++ b/e107_admin/prefs.php @@ -734,22 +734,31 @@ $text .= " --> */ -$signup_option_title = array(CUSTSIG_2, CUSTSIG_6, CUSTSIG_7, CUSTSIG_17, CUSTSIG_20); -$signup_option_names = array("signup_option_realname", "signup_option_signature", "signup_option_image", "signup_option_class", 'signup_option_customtitle'); -foreach($signup_option_names as $key => $value) -{ - $text .= " - - ".$signup_option_title[$key]." - - ".$frm->radio($value, 0, !$pref[$value]).$frm->label(CUSTSIG_12, $value, 0)."   - ".$frm->radio($value, 1, ($pref[$value] == 1)).$frm->label(CUSTSIG_14, $value, 1)."   - ".$frm->radio($value, 2, ($pref[$value] == 2)).$frm->label(CUSTSIG_15, $value, 2)." - - - "; -} + $signup_option_names = array( + // "signup_option_loginname" => "Login Name", + "signup_option_email_confirm" => "Email Confirmation", + "signup_option_realname" => CUSTSIG_2, + "signup_option_signature" => CUSTSIG_6, + "signup_option_image" => CUSTSIG_7, + "signup_option_class" => CUSTSIG_17, + 'signup_option_customtitle' => CUSTSIG_20, + 'signup_option_hideemail' => 'Option to hide email' + ); + + foreach($signup_option_names as $value => $key) + { + $text .= " + + ".$key." + + ".$frm->radio($value, 0, !$pref[$value]).$frm->label(CUSTSIG_12, $value, 0)."   + ".$frm->radio($value, 1, ($pref[$value] == 1)).$frm->label(CUSTSIG_14, $value, 1)."   + ".$frm->radio($value, 2, ($pref[$value] == 2)).$frm->label(CUSTSIG_15, $value, 2)." + + + "; + } $text .= " diff --git a/e107_admin/users.php b/e107_admin/users.php index cadb92b02..756272424 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -1653,7 +1653,7 @@ class users ".USRLAN_62." - ".$rs->form_password("password1",40,"",20)." + ".$frm->password('password','',20,array('size'=>40,'class'=>'tbox e-password-admin'))." "; /* diff --git a/e107_core/bbcodes/html.bb b/e107_core/bbcodes/html.bb index 907026ea9..c4dbdc05d 100644 --- a/e107_core/bbcodes/html.bb +++ b/e107_core/bbcodes/html.bb @@ -1,3 +1,3 @@ -//$code_text = str_replace("\r\n", " ", $code_text); -//$code_text = html_entity_decode($code_text, ENT_QUOTES, CHARSET); +$code_text = str_replace("\r\n", " ", $code_text); +$code_text = html_entity_decode($code_text, ENT_QUOTES, CHARSET); return $code_text; diff --git a/e107_core/shortcodes/batch/bbcode_shortcodes.php b/e107_core/shortcodes/batch/bbcode_shortcodes.php index 5d1372987..81d9703a4 100644 --- a/e107_core/shortcodes/batch/bbcode_shortcodes.php +++ b/e107_core/shortcodes/batch/bbcode_shortcodes.php @@ -54,6 +54,18 @@ class bbcode_shortcodes extends e_shortcode return $text; } + function bb_newpage($id) + { + // $data = "[table]\n[tr]\n\t[td]Cell 1[/td]\n\t[td]Cell 2[/td]\n[/tr]\n[/table]"; // works with jquery, but not onclick. + $data = "[newpage]"; + $event = $this->getEvent('addtext',$data,LANHELP_34,1); + $text = ""; + $text .= ""; + return $text; + } + + + function bb_list($id) { @@ -149,6 +161,7 @@ class bbcode_shortcodes extends e_shortcode function bb_fontcol($id) { + return ''; // $bbcode['fontcol'] = array("e-expandit","col_selector_".$rand, LANHELP_21,"fontcol.png","Color_Select",'col_selector_'.$rand); $formid = $id."_"; diff --git a/e107_core/xml/default_install.xml b/e107_core/xml/default_install.xml index cba1fc6ee..c0f6423a4 100644 --- a/e107_core/xml/default_install.xml +++ b/e107_core/xml/default_install.xml @@ -158,9 +158,11 @@ 3 1 0 - 1 + 0 + 0 1 - 1 + 0 + 0 4 0 diff --git a/e107_files/jslib/core/all.jquery.js b/e107_files/jslib/core/all.jquery.js index cf0e3f11a..192467e2e 100644 --- a/e107_files/jslib/core/all.jquery.js +++ b/e107_files/jslib/core/all.jquery.js @@ -63,7 +63,7 @@ $(document).ready(function() // Tabs $(function() { - $( "#tab-container" ).tabs(); + $( "#tab-container" ).tabs({cache: true}); }); // Tabs @@ -71,6 +71,52 @@ $(document).ready(function() $( ".e-tabs" ).tabs(); }); + $('.e-tabs-add').on("click", function(){ + var url = $(this).attr('data-url'); + var count = parseInt($("#e-tab-count").val()) + 1; + + // alert(count); + //return false; + if($("#tab-container").tabs("add",url + '?iframe=1',"Page "+count)) + { + $("#e-tab-count").val(count); + } + + return false; + }); + + $('.e-email').on('blur', function() { + // alert('hello'); + $(this).mailcheck({ + + suggested: function(element, suggestion) { + var id = $(element); + var hint = $(element).next('div').attr('data-hint'); + var mes = hint.replace('[x]',suggestion.full); + $(element).next('div').html(mes); + $(element).next('div').show('slow'); + }, + empty: function(element) { + $(element).next('div').hide('slow'); + } + }); + }); + + $('.e-password').on('keyup', function() { + // var len = $(this).val().length; + + //data-minlength + }); + + + + + + // var tabs = $('#tab-container').clone(true); + // $('#htmlEditor').append(tabs); + + + /* $("a.e-bb").click(function(){ var add = $(this).attr('data-bbcode'); @@ -143,7 +189,7 @@ $(document).ready(function() // Password $(function() { - $("#password1").pwdMeter({ + $(".e-password-admin").pwdMeter({ minLength: 6, displayGeneratePassword: true, generatePassText: "Generate", diff --git a/e107_files/jslib/password/jquery.pwdMeter.js b/e107_files/jslib/password/jquery.pwdMeter.js index 9763d5a78..dcf3bedb2 100644 --- a/e107_files/jslib/password/jquery.pwdMeter.js +++ b/e107_files/jslib/password/jquery.pwdMeter.js @@ -94,7 +94,7 @@ jQuery.fn.pwdMeter = function(options){ var randomPassword = random_password(); $('#Spn_NewPassword').text(randomPassword); $(options.passwordBox).val(randomPassword); - alert(randomPassword); + // alert(randomPassword); evaluateMeter(); }); diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 7235036f4..2de1fcc9b 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -110,6 +110,14 @@ class e_form //never allow id in format name-value for text fields return "get_attributes($options, $name)." />"; } + + function email($name, $value, $maxlength = 200, $options = array()) + { + $options = $this->format_options('text', $name, $options); + //never allow id in format name-value for text fields + return "get_attributes($options, $name)." /> + "; + } function iconpreview($id, $default, $width='', $height='') // FIXME { @@ -582,9 +590,11 @@ class e_form function password($name, $value = '', $maxlength = 50, $options = array()) { + $options = $this->format_options('text', $name, $options); + $options['class'] = vartrue($options['class'],'e-password'); //never allow id in format name-value for text fields - return "get_attributes($options, $name)." />"; + return "get_attributes($options, $name)." />"; } // autoexpand done @@ -1048,6 +1058,18 @@ class e_form case 'disabled': if($optval) $ret .= " disabled='disabled'"; break; + + case 'required': + if($optval) $ret .= " required='required'"; + break; + + case 'placeholder': + if($optval) $ret .= " placeholder='{$optval}'"; + break; + + case 'pattern': + if($optval) $ret .= " pattern='{$optval}'"; + break; case 'other': if($optval) $ret .= " $optval"; @@ -1133,9 +1155,12 @@ class e_form 'selected' => false, 'checked' => false, 'disabled' => false, + 'required' => false, // 'multiple' => false, - see case 'select' 'tabindex' => 0, 'label' => '', + 'placeholder' => '', + 'pattern' => '', 'other' => '' ); diff --git a/e107_plugins/facebook/e_module.php b/e107_plugins/facebook/e_module.php index 354744cef..6dd3f5231 100644 --- a/e107_plugins/facebook/e_module.php +++ b/e107_plugins/facebook/e_module.php @@ -1,143 +1,46 @@ -register('logout',array('e_facebook','fb_logout'),e_PLUGIN.'facebook/facebook_function.php'); - global $fb; - - $fb = e107::getSingleton('e_facebook',e_PLUGIN.'facebook/facebook_function.php'); - include_once (e_PLUGIN.'facebook/facebook_function.php'); - - if (function_exists('prevent_cache_headers')) - { - prevent_cache_headers(); - } - - define('XMLNS', "xmlns:fb='http://www.facebook.com/2008/fbml'"); - - global $pref; - - if ($pref['disable_emailcheck'] == 0) // Ensure "Make entering an email address optional" is setted to "ON"; - { - $pref['disable_emailcheck'] = 1; - save_prefs(); - } - - if (e_QUERY == 'facebook') // when clicked it inserts a new User in e107. - { - Fb_Connect_Me(); - } - - if (e_QUERY == 'login') // simple Re-Login after logged out from e107 - { - $fb->fb_login(); // Fb_LogIn(); - } - - if (e_QUERY == 'logout') // simulate Facebook logOut when logged out from e107 - { - // Fb_LogOut(); - } - - if (e_QUERY == 'facebook_switch') - { - Switch_Facebook_User(); - } - - if (USERID && (e_QUERY == 'facebook_link') && $fb->fb_uid) // - { - // $fb->Add_Facebook_Connect_User('', USERID); - $fb->addFacebookUser(); - } - - if (e_QUERY == 'facebook_delete') - { - - Delete_Duplicate_Facebook_User(); - - } - - - function theme_foot() - { - global $fb; - /** - * the init js needs to be at the bottom of the document, within the tag - * this is so that any xfbml elements are already rendered by the time the xfbml - * rendering takes over. otherwise, it might miss some elements in the doc. - * - */ - - global $onload_js; - - $text .= render_facebook_init_js($fb->fb_uid); - // Print out all onload function calls - - if ($onload_js) - { - - $text .= ''; - - } - return $text; - - } - - /** - * - * Facebook Deprecated get Feed Story trough Template Bundle 2009 - * - - function getTemplateData() { - - $template_data = array( - 'post_title' => $_POST[ 'subject' ], - 'body' => $_POST[ 'comment' ], - 'body_short' => $_POST[ 'comment' ], - 'post_permalink' => e_SELF, - 'blogname' => SITENAME, - 'blogdesc' => SITEDESCRIPTION, - 'siteurl' => SITEURLBASE); - - return $template_data; - } - - */ - - - /** - * get Feed Story infos to send to Facebook - * - * the new way FB.Connect.streamPublish(); - * - */ - - - function getStreamToPublish() - { - //global $pref; - //$stream = facebook_client()->api_client->stream_get('','','','','',''.$pref[ 'Facebook_App-Bundle' ].'',''); - - // $stream = facebook_client()->api_client->stream_publish($_POST[ 'comment' ]); - - return $_POST['comment']; - } - - /** - * if comment is submitted and "publish_to_facebook" is checked send a copy to Facebook - * - */ - - if (isset($_POST['commentsubmit']) && ($_POST['publish_to_facebook'] == true)) - { - - register_feed_form_js(); - - } - -} + top.location.href='" . $dialog_url . "'"); + } + + if($_REQUEST['state'] == $_SESSION['state']) { + $token_url = "https://graph.facebook.com/oauth/access_token?" + . "client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url) + . "&client_secret=" . $app_secret . "&code=" . $code; + + $response = file_get_contents($token_url); + $params = null; + parse_str($response, $params); + + $graph_url = "https://graph.facebook.com/me?access_token=" + . $params['access_token']; + + $user = json_decode(file_get_contents($graph_url)); + echo("Hello " . $user->name); + } + else { + echo("The state does not match. You may be a victim of CSRF."); + } + +} + + ?> \ No newline at end of file diff --git a/e107_themes/templates/header_default.php b/e107_themes/templates/header_default.php index bc25d8048..4f7447e09 100644 --- a/e107_themes/templates/header_default.php +++ b/e107_themes/templates/header_default.php @@ -25,13 +25,16 @@ $e107->sql->db_Mark_Time('(Header Top)'); e107::css('core', 'password/style.css', 'jquery'); e107::js('core', 'password/jquery.pwdMeter.js', 'jquery', 2); +e107::js('core', 'jquery.mailcheck.min.js','jquery',2); e107::js('core', 'colorbox/jquery.colorbox-min.js', 'jquery', 2); e107::css('core', 'colorbox/colorbox.css', 'jquery'); + e107::js('core', 'rate/js/jquery.raty.js', 'jquery', 2); e107::css('core', 'core/all.jquery.css', 'jquery'); e107::js("core", "core/all.jquery.js","jquery",5); // Load all default functions. + // // *** Code sequence for headers *** // IMPORTANT: These items are in a carefully constructed order. DO NOT REARRANGE diff --git a/e107_themes/templates/signup_template.php b/e107_themes/templates/signup_template.php index 6bd107c89..dbf2c9e41 100755 --- a/e107_themes/templates/signup_template.php +++ b/e107_themes/templates/signup_template.php @@ -52,7 +52,7 @@ $USERCLASS_SUBSCRIBE_START = " ".LAN_USER_76." ".req($pref['signup_option_class'])."
".LAN_USER_73." - + "; } @@ -145,6 +145,38 @@ $sc_style['SIGNUP_IMAGECODE']['post'] = " "; +$sc_style['SIGNUP_LOGINNAME']['pre'] = " + + + + +"; + +$sc_style['SIGNUP_HIDE_EMAIL']['pre'] = " + + + + +"; + +$sc_style['SIGNUP_EMAIL_CONFIRM']['pre'] = " + + + + +"; + + + if(!defined($COPPA_TEMPLATE)) { $COPPA_TEMPLATE = LAN_SIGNUP_77." ".LAN_SIGNUP_14.". ".LAN_SIGNUP_15." ".$tp->emailObfuscate(SITEADMINEMAIL,LAN_SIGNUP_14)." ".LAN_SIGNUP_16." @@ -173,27 +205,34 @@ if(!defined($SIGNUP_BEGIN)) { $SIGNUP_BEGIN = " {SIGNUP_FORM_OPEN} -
-{SIGNUP_SIGNUP_TEXT} -
+"; } + + + + if(!defined($SIGNUP_BODY)) { -$SIGNUP_BODY = " + // TODO Add other signup options for Facebook and Twitter. +$SIGNUP_BODY = " {SIGNUP_XUP}
{SIGNUP_XUP_ACTION}
".LAN_SIGNUP_81.req(2)." +"; +$sc_style['SIGNUP_LOGINNAME']['post'] = " +
".LAN_USER_83." +"; +$sc_style['SIGNUP_HIDE_EMAIL']['post'] = " +
".LAN_SIGNUP_39." +"; +$sc_style['SIGNUP_EMAIL_CONFIRM']['post'] = " +
{SIGNUP_DISPLAYNAME} + - - + + -{SIGNUP_REALNAME} +{SIGNUP_EMAIL_CONFIRM} - - - - - - - - - - - - - - - {SIGNUP_USERCLASS_SUBSCRIBE} {SIGNUP_EXTENDED_USER_FIELDS} {SIGNUP_SIGNATURE} diff --git a/signup.php b/signup.php index e2338b5c9..a2f18ee25 100644 --- a/signup.php +++ b/signup.php @@ -16,6 +16,9 @@ require_once("class2.php"); + + + $qs = explode(".", e_QUERY); if($qs[0] != 'activate') @@ -39,7 +42,10 @@ $userMethods->deleteExpired(); // Delete time-expired partial registrations require_once(e107::coreTemplatePath('signup')); //correct way to load a core template. -include_once(e_CORE.'shortcodes/batch/signup_shortcodes.php'); +//include_once(e_CORE.'shortcodes/batch/signup_shortcodes.php'); + +$signup_shortcodes = e107::getScBatch('signup'); +$facebook_shortcodes = e107::getScBatch('facebook',TRUE); $signup_imagecode = ($pref['signcode'] && extension_loaded('gd')); $text = ''; @@ -261,9 +267,16 @@ if($signup_imagecode) } -if (USER || ($pref['user_reg'] == 0) || (vartrue($pref['auth_method'],'e107') != 'e107')) +if ((USER || ($pref['user_reg'] == 0) || (vartrue($pref['auth_method'],'e107') != 'e107')) && !getperms('0')) { - header('location: '.e_HTTP.'index.php'); + header('location: '.e_HTTP.'index.php'); +} + +if(getperms('0')) +{ + //$mes = e107::getMessage(); + //$mes->debug("You are currently logged in."); + $SIGNUP_BEGIN = "
You are currently logged in.
". $SIGNUP_BEGIN; } @@ -380,6 +393,17 @@ if (isset($_POST['register'])) $_POST['loginname'] = $userMethods->generateUserLogin($pref['predefinedLoginName']); } + if(!isset($_POST['hideemail'])) // For when it is disabled - default is to hide-email. + { + $_POST['hideemail'] = 1; + } + + if(!isset($_POST['email_confirm'])) + { + $_POST['email_confirm'] = $_POST['email']; + } + + // Use LoginName for DisplayName if restricted if (!check_class($pref['displayname_class'],e_UC_PUBLIC.','.e_UC_MEMBER)) {
".LAN_SIGNUP_81." *
".LAN_SIGNUP_82."
{SIGNUP_LOGINNAME} +{SIGNUP_REALNAME} +
".LAN_USER_60."{SIGNUP_IS_MANDATORY=email} +{SIGNUP_EMAIL}
".LAN_SIGNUP_83." * @@ -207,27 +246,7 @@ $SIGNUP_BODY = " {SIGNUP_PASSWORD2}
".LAN_USER_60."{SIGNUP_IS_MANDATORY=email} -{SIGNUP_EMAIL} -
".LAN_SIGNUP_39."{SIGNUP_IS_MANDATORY=email} -{SIGNUP_EMAIL_CONFIRM} -
".LAN_USER_83." {SIGNUP_HIDE_EMAIL} -