1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Sign page refinements and some bbecode work.

This commit is contained in:
CaMer0n
2012-05-31 06:07:33 +00:00
parent 1a790c12ab
commit f53df84766
13 changed files with 273 additions and 199 deletions

View File

@@ -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 .= "<fieldset id='e-tab-empty'>\n";
$text .= "<div>Title: ".$frm->text('page_subtitle[]', '', 250)."</div>\n";
$text .= $frm->bbarea('data[]', '', 'page','help','large');
$text .= "</fieldset>";
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 .= "</div>";
// $text .= $frm->bbarea('data', $textareaValue, 'page','help','large');
// $text .= "<textarea class='e-wysiwyg tbox' tabindex='".$frm->getNext()."' id='data' name='data' cols='80'{$insertjs}>".(strstr($data, "[img]http") ? $data : str_replace("[img]../", "[img]", $data))."</textarea>";
// <br />".display_help('cpage-help', 'cpage')."
@@ -580,6 +609,7 @@ class page_admin_ui extends e_admin_ui
$c++;
}
$text .= "<input type='text' id='e-tab-count' value='".count($pages)."' />";
return $text;

View File

@@ -734,22 +734,31 @@ $text .= "
</tr>
-->
*/
$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 .= "
<tr>
<td class='label'>".$signup_option_title[$key]."</td>
<td class='control'>
".$frm->radio($value, 0, !$pref[$value]).$frm->label(CUSTSIG_12, $value, 0)."&nbsp;&nbsp;
".$frm->radio($value, 1, ($pref[$value] == 1)).$frm->label(CUSTSIG_14, $value, 1)."&nbsp;&nbsp;
".$frm->radio($value, 2, ($pref[$value] == 2)).$frm->label(CUSTSIG_15, $value, 2)."
</td>
</tr>
";
}
$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 .= "
<tr>
<td class='label'>".$key."</td>
<td class='control'>
".$frm->radio($value, 0, !$pref[$value]).$frm->label(CUSTSIG_12, $value, 0)."&nbsp;&nbsp;
".$frm->radio($value, 1, ($pref[$value] == 1)).$frm->label(CUSTSIG_14, $value, 1)."&nbsp;&nbsp;
".$frm->radio($value, 2, ($pref[$value] == 2)).$frm->label(CUSTSIG_15, $value, 2)."
</td>
</tr>
";
}
$text .= "
</tbody>

View File

@@ -1653,7 +1653,7 @@ class users
<tr>
<td>".USRLAN_62."</td>
<td>".$rs->form_password("password1",40,"",20)."</td>
<td>".$frm->password('password','',20,array('size'=>40,'class'=>'tbox e-password-admin'))."</td>
</tr>";
/*

View File

@@ -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;

View File

@@ -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 = "<a {$event} class='e-bb e-tabs-add' id='{$id}' data-url='".e_SELF."?mode=dialog&action=dialog&iframe=1' data-function='add' href='#{$this->var['tagid']}' title='Insert a table' data-bbcode='{$data}'>";
$text .= "<img class='bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/newpage.png' alt='' /></a>";
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."_";

View File

@@ -158,9 +158,11 @@
<core name="signup_maxip">3</core>
<core name="signup_option_class">1</core>
<core name="signup_option_customtitle">0</core>
<core name="signup_option_image">1</core>
<core name="signup_option_email_confirm">0</core>
<core name="signup_option_image">0</core>
<core name="signup_option_realname">1</core>
<core name="signup_option_signature">1</core>
<core name="signup_option_signature">0</core>
<core name="signup_option_hideemail">0</core>
<core name="signup_pass_len">4</core>
<core name="signup_remote_emailcheck">0</core>
<core name="signup_text"></core>

View File

@@ -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",

View File

@@ -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();
});

View File

@@ -110,6 +110,14 @@ class e_form
//never allow id in format name-value for text fields
return "<input type='text' name='{$name}' value='{$value}' maxlength='{$maxlength}'".$this->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 "<input type='email' name='{$name}' value='{$value}' maxlength='{$maxlength}'".$this->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 "<input class='e-password' type='password' name='{$name}' value='{$value}' maxlength='{$maxlength}'".$this->get_attributes($options, $name)." />";
return "<input type='password' name='{$name}' value='{$value}' maxlength='{$maxlength}'".$this->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' => ''
);

View File

@@ -1,143 +1,46 @@
<?php
//error_reporting(E_ALL);
if (e_ADMIN_AREA !== TRUE && e107::isInstalled('facebook'))
{
e107::getEvent()->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 </body> 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 .= '<script type="text/javascript">'.'window.onload = function() { '.$onload_js.' };'.'</script>';
}
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();
}
}
<?php
if(strpos(e_QUERY,'access_token') || $_REQUEST["code"] || $_REQUEST['state'])
{
$fbPref = e107::getPlugPref('facebook');
$app_id = $fbPref['appId'];
$app_secret = $fbPref['appSecret'];// "YOUR_APP_SECRET";
$my_url = e_SELF."?";
// session_start();
$code = $_REQUEST["code"];
if(empty($code)) {
$_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection
$dialog_url = "https://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url) . "&state="
. $_SESSION['state'];
echo("<script> top.location.href='" . $dialog_url . "'</script>");
}
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.");
}
}
?>

View File

@@ -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

View File

@@ -52,7 +52,7 @@ $USERCLASS_SUBSCRIBE_START = "
<tr>
<td class='forumheader3' style='width:30%;vertical-align:top'>".LAN_USER_76." ".req($pref['signup_option_class'])."
<br /><span class='smalltext'>".LAN_USER_73."</span></td>
<td class='forumheader3' style='width:70%'>
<td class='forumheader3' style='width:70%;margin-left:0px'>
<table style='".USER_WIDTH."'>
";
}
@@ -145,6 +145,38 @@ $sc_style['SIGNUP_IMAGECODE']['post'] = "
";
$sc_style['SIGNUP_LOGINNAME']['pre'] = "
<tr>
<td class='forumheader3' style='width:30%'>".LAN_SIGNUP_81.req(2)."</td>
<td class='forumheader3' style='width:70%'>
";
$sc_style['SIGNUP_LOGINNAME']['post'] = "
</td>
</tr>
";
$sc_style['SIGNUP_HIDE_EMAIL']['pre'] = "
<tr>
<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_USER_83."</td>
<td class='forumheader3' style='width:70%'>
";
$sc_style['SIGNUP_HIDE_EMAIL']['post'] = "
</td>
</tr>
";
$sc_style['SIGNUP_EMAIL_CONFIRM']['pre'] = "
<tr>
<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_SIGNUP_39."</td>
<td class='forumheader3' style='width:70%'>
";
$sc_style['SIGNUP_EMAIL_CONFIRM']['post'] = "
</td>
</tr>
";
if(!defined($COPPA_TEMPLATE))
{
$COPPA_TEMPLATE = LAN_SIGNUP_77." <a href='http://www.ftc.gov/privacy/coppafaqs.shtm'>".LAN_SIGNUP_14."</a>. ".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}
<div style='text-align:center;".USER_WIDTH."'>
{SIGNUP_SIGNUP_TEXT}
<br />
<div class='signup-container' style='text-align:center;".USER_WIDTH."'>
".LAN_SIGNUP_85."<br /><br /></div>";
}
if(!defined($SIGNUP_BODY))
{
$SIGNUP_BODY = "
// TODO Add other signup options for Facebook and Twitter.
$SIGNUP_BODY = "<div class='signup-other'>{FB=login}{TW=login}</div>
{SIGNUP_XUP}
<div id='default'>
{SIGNUP_XUP_ACTION}
<table class='fborder' style='".USER_WIDTH."'>
{SIGNUP_DISPLAYNAME}
<tr>
<td class='forumheader3' style='width:30%;white-space:nowrap' >".LAN_SIGNUP_81."<span class='required'> *</span><br /><span class='smalltext'>".LAN_SIGNUP_82."</span></td>
<td class='forumheader3' style='width:70%'>
{SIGNUP_LOGINNAME}
{SIGNUP_REALNAME}
<tr>
<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_USER_60."{SIGNUP_IS_MANDATORY=email}</td>
<td class='forumheader3' style='width:70%'>
{SIGNUP_EMAIL}
</td>
</tr>
{SIGNUP_REALNAME}
{SIGNUP_EMAIL_CONFIRM}
<tr>
<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_SIGNUP_83."<span class='required'> *</span></td>
<td class='forumheader3' style='width:70%'>
@@ -207,27 +246,7 @@ $SIGNUP_BODY = "
{SIGNUP_PASSWORD2}
</td>
</tr>
<tr>
<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_USER_60."{SIGNUP_IS_MANDATORY=email}</td>
<td class='forumheader3' style='width:70%'>
{SIGNUP_EMAIL}
</td>
</tr>
<tr>
<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_SIGNUP_39."{SIGNUP_IS_MANDATORY=email}</td>
<td class='forumheader3' style='width:70%'>
{SIGNUP_EMAIL_CONFIRM}
</td>
</tr>
<tr>
<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_USER_83."</td>
<td class='forumheader3' style='width:70%'>
{SIGNUP_HIDE_EMAIL}
</td>
</tr>
{SIGNUP_USERCLASS_SUBSCRIBE}
{SIGNUP_EXTENDED_USER_FIELDS}
{SIGNUP_SIGNATURE}

View File

@@ -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 = "<div class='s-message' style='background-color:red;text-align:center;padding:30px;'> You are currently logged in.</div>". $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))
{