1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-22 13:41:52 +02:00

More batch-shortcode cleanup.

This commit is contained in:
CaMer0n 2012-06-20 01:12:33 +00:00
parent 73f3106df5
commit a0743652de
9 changed files with 228 additions and 133 deletions

@ -44,7 +44,8 @@ if (!$CONTACT_FORM) {
}
}
if(isset($_POST['send-contactus'])){
if(isset($_POST['send-contactus']))
{
$error = "";
@ -163,7 +164,8 @@ if(SITECONTACTINFO && $CONTACT_INFO)
if(isset($pref['sitecontacts']) && $pref['sitecontacts'] != 255)
{
require_once(e_CORE."shortcodes/batch/contact_shortcodes.php");
// require_once(e_CORE."shortcodes/batch/contact_shortcodes.php");
$contact_shortcodes = e107::getScBatch('contact');
$text = $tp->parseTemplate($CONTACT_FORM, TRUE, $contact_shortcodes);
if(trim($text) != "")

@ -21,7 +21,7 @@ class comment_shortcodes extends e_shortcode
{
var $var;
function sc_subject_input($parm)
function sc_subject_input($parm='')
{
$tp = e107::getParser();
$pref = e107::getPref();
@ -35,7 +35,7 @@ class comment_shortcodes extends e_shortcode
}
function sc_subject($parm)
function sc_subject($parm='')
{
$tp = e107::getParser();
$pref = e107::getPref();
@ -56,7 +56,7 @@ class comment_shortcodes extends e_shortcode
}
function sc_username($parm)
function sc_username($parm='')
{
global $USERNAME;
if (isset($this->var['user_id']) && $this->var['user_id'])
@ -66,14 +66,14 @@ class comment_shortcodes extends e_shortcode
else
{
$this->var['user_id'] = 0;
$USERNAME = preg_replace("/[0-9]+\./", '', $this->var['comment_author_name']);
$USERNAME = preg_replace("/[0-9]+\./", '', vartrue($this->var['comment_author_name']));
$USERNAME = str_replace("Anonymous", LAN_ANONYMOUS, $USERNAME);
}
return $USERNAME;
}
function sc_timedate($parm)
function sc_timedate($parm='')
{
global $TIMEDATE, $datestamp, $gen;
$datestamp = $gen->convert_date($this->var['comment_datestamp'], "short");
@ -81,7 +81,7 @@ class comment_shortcodes extends e_shortcode
}
function sc_reply($parm)
function sc_reply($parm='')
{
global $REPLY, $action, $table, $id, $thisaction, $thistable, $thisid;
@ -99,14 +99,14 @@ class comment_shortcodes extends e_shortcode
function sc_comment_avatar($parm)
function sc_comment_avatar($parm='')
{
$tp = e107::getParser();
//
$text = $tp->parseTemplate("{USER_AVATAR=".$this->var['user_image']."}");
$text .= "<div class='field-help' style='display;none;'>
$text = $tp->parseTemplate("{USER_AVATAR=".vartrue($this->var['user_image'])."}");
$text .= "<div class='field-help' style='display:none;'>
<div class='left'>";
$text .= "<h2>".$this->sc_username()."</h2>";
// $text .= e107::getDate()-> // convert($this->var['user_lastvisit'],'short');
@ -121,7 +121,7 @@ class comment_shortcodes extends e_shortcode
function sc_avatar($parm)
function sc_avatar($parm='')
{
return $this->sc_comment_avatar($parm);
@ -147,14 +147,14 @@ class comment_shortcodes extends e_shortcode
}
function sc_comments($parm)
function sc_comments($parm='')
{
global $COMMENTS;
return (isset($this->var['user_id']) && $this->var['user_id'] ? COMLAN_99.": ".$this->var['user_comments'] : COMLAN_194)."<br />";
}
function sc_joined($parm)
function sc_joined($parm='')
{
global $JOINED, $gen;
$JOINED = '';
@ -166,12 +166,12 @@ class comment_shortcodes extends e_shortcode
}
function sc_comment_itemid($parm) // for ajax item id.
function sc_comment_itemid($parm='') // for ajax item id.
{
return 'comment-'.intval($this->var['comment_id']);
}
function sc_comment_moderate($parm)
function sc_comment_moderate($parm='')
{
if(!getperms('0') && !getperms("B"))
{
@ -199,7 +199,7 @@ class comment_shortcodes extends e_shortcode
function sc_comment_button($parm)
function sc_comment_button($parm='')
{
$pref = e107::getPref('comments_sort');
@ -214,7 +214,7 @@ class comment_shortcodes extends e_shortcode
}
function sc_author_input($parm)
function sc_author_input($parm='')
{
if($this->mode == 'edit')
{
@ -229,7 +229,7 @@ class comment_shortcodes extends e_shortcode
}
function sc_comment_rate($parm)
function sc_comment_rate($parm='')
{
if($this->var['comment_blocked'] > 0 || $this->var['rating_enabled'] == false)
@ -247,7 +247,7 @@ class comment_shortcodes extends e_shortcode
}
function sc_comment_input($parm)
function sc_comment_input($parm='')
{
$options = array(
'class' => 'tbox input comment-input',
@ -265,7 +265,7 @@ class comment_shortcodes extends e_shortcode
}
/*
function sc_user_avatar($parm)
function sc_user_avatar($parm='')
{
$this->var['user_id'] = USERID;
$this->var['user_image'] = USERIMAGE;
@ -273,7 +273,7 @@ class comment_shortcodes extends e_shortcode
}
*/
function sc_comment($parm)
function sc_comment($parm='')
{
// global $COMMENT, $pref;
$tp = e107::getParser();
@ -285,7 +285,7 @@ class comment_shortcodes extends e_shortcode
return $tp->toHTML($this->var['comment_comment'], TRUE, FALSE, $this->var['user_id']);
}
function sc_comment_status($parm)
function sc_comment_status($parm='')
{
switch ($this->var['comment_blocked'])
{
@ -307,7 +307,7 @@ class comment_shortcodes extends e_shortcode
function sc_commentedit($parm)
function sc_commentedit($parm='')
{
global $COMMENTEDIT, $comment_edit_query;
$pref = e107::getPref();
@ -333,14 +333,14 @@ class comment_shortcodes extends e_shortcode
}
function sc_rating($parm)
function sc_rating($parm='')
{
global $RATING;
return $RATING;
}
function sc_ipaddress($parm)
function sc_ipaddress($parm='')
{
global $IPADDRESS, $e107;
//require_once(e_HANDLER."encrypt_handler.php");
@ -348,7 +348,7 @@ class comment_shortcodes extends e_shortcode
}
function sc_level($parm)
function sc_level($parm='')
{
global $LEVEL, $pref;
//FIXME - new level handler, currently commented to avoid parse errors
@ -357,7 +357,7 @@ class comment_shortcodes extends e_shortcode
}
function sc_location($parm)
function sc_location($parm='')
{
global $LOCATION;
$tp = e107::getParser();
@ -365,7 +365,7 @@ class comment_shortcodes extends e_shortcode
}
function sc_signature($parm)
function sc_signature($parm='')
{
global $SIGNATURE;
$tp = e107::getParser();

@ -15,52 +15,111 @@
*/
if (!defined('e107_INIT')) { exit; }
include_once(e_HANDLER.'shortcode_handler.php');
$contact_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
/*
SC_BEGIN CONTACT_EMAIL_COPY
global $pref;
if(!isset($pref['contact_emailcopy']) || !$pref['contact_emailcopy'])
class contact_shortcodes extends e_shortcode
{
return;
}
return "<input type='checkbox' name='email_copy' value='1' />";
SC_END
SC_BEGIN CONTACT_PERSON
global $sql,$tp,$pref;
if($pref['sitecontacts'] == e_UC_ADMIN){
$query = "user_admin =1";
}elseif($pref['sitecontacts'] == e_UC_MAINADMIN){
$query = "user_admin = 1 AND (user_perms = '0' OR user_perms = '0.') ";
}else{
$query = "FIND_IN_SET(".$pref['sitecontacts'].",user_class) ";
}
$text = "<select name='contact_person' class='tbox contact_person'>\n";
$count = $sql -> db_Select("user", "user_id,user_name", $query . " ORDER BY user_name");
if($count > 1){
while($row = $sql-> db_Fetch())
function sc_contact_email_copy($parm='')
{
$text .= "<option value='".$row['user_id']."'>".$row['user_name']."</option>\n";
}
}else{
return;
global $pref;
if(!isset($pref['contact_emailcopy']) || !$pref['contact_emailcopy'])
{
return;
}
return "<input type='checkbox' name='email_copy' value='1' />";
}
function sc_contact_person($parm='')
{
$tp = e107::getParser();
$sql = e107::getDb();
$pref = e107::getPref();
if(varset($pref['sitecontacts']) == e_UC_ADMIN)
{
$query = "user_admin =1";
}
elseif(varset($pref['sitecontacts']) == e_UC_MAINADMIN)
{
$query = "user_admin = 1 AND (user_perms = '0' OR user_perms = '0.') ";
}
else
{
$query = "FIND_IN_SET(".$pref['sitecontacts'].",user_class) ";
}
$text = "<select name='contact_person' class='tbox contact_person'>\n";
$count = $sql -> db_Select("user", "user_id,user_name", $query . " ORDER BY user_name");
if($count > 1)
{
while($row = $sql-> db_Fetch())
{
$text .= "<option value='".$row['user_id']."'>".$row['user_name']."</option>\n";
}
}
else
{
return;
}
$text .= "</select>";
return $text;
}
function sc_contact_imagecode($parm='')
{
//return e107::getSecureImg()->r_image()."<div>".e107::getSecureImg()->renderInput()."</div>";
return "<input type='hidden' name='rand_num' value='".e107::getSecureImg()->random_number."' />".e107::getSecureImg()->r_image();
}
function sc_contact_imagecode_input($parm='')
{
return e107::getSecureImg()->renderInput();
// return "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />";
}
function sc_contact_name($parm='')
{
return "<input type='text' title='Your full name' name='author_name' required='required' size='30' class='tbox' value=\"".$_POST['author_name']."\" />";
}
function sc_contact_email($parm='')
{
return "<input type='email' title='a valid email address' name='email_send' required='required' size='30' class='tbox' value='".($_POST['email_send'] ? $_POST['email_send'] : USEREMAIL)."' />";
}
function sc_contact_subject($parm='')
{
return "<input type='text' title='the subject of your enquiry' name='subject' required='required' size='30' class='tbox' value=\"".$_POST['subject']."\" />";
}
function sc_contact_body($parm='')
{
return "<textarea cols='50' rows='10' name='body' required='required' class='tbox'>".stripslashes($_POST['body'])."</textarea>";
}
function sc_contact_submit_button($parm='')
{
return "<input type='submit' name='send-contactus' value=\"".LANCONTACT_08."\" class='button' />";
}
}
$text .= "</select>";
return $text;
SC_END
SC_BEGIN CONTACT_IMAGECODE
global $sec_img;
return "<input type='hidden' name='rand_num' value='".$sec_img->random_number."' />".$sec_img->r_image();
SC_END
SC_BEGIN CONTACT_IMAGECODE_INPUT
return "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />";
SC_END
*/
?>

@ -152,16 +152,14 @@ class user_shortcodes extends e_shortcode
function sc_user_lastvisit($parm)
{
$gen = new convert;
return $this->var['user_currentvisit'] ? $gen->convert_date($this->var['user_currentvisit'], "long") : "<i>".LAN_USER_33."</i>";
return $this->var['user_currentvisit'] ? e107::getDate()->convert_date($this->var['user_currentvisit'], "long") : "<i>".LAN_USER_33."</i>";
}
function sc_user_lastvisit_lapse($parm)
{
$gen = new convert;
return $this->var['user_currentvisit'] ? "( ".$gen -> computeLapse($this->var['user_currentvisit'])." ".LAN_USER_34." )" : '';
{
return $this->var['user_currentvisit'] ? "( ".e107::getDate()->computeLapse($this->var['user_currentvisit'])." ".LAN_USER_34." )" : '';
}
@ -175,16 +173,14 @@ class user_shortcodes extends e_shortcode
function sc_user_join($parm)
{
$gen = new convert;
return $gen->convert_date($this->var['user_join'], "forum");
return e107::getDate()->convert_date($this->var['user_join'], "forum");
}
function sc_user_daysregged($parm)
{
$gen = new convert;
return $gen -> computeLapse($this->var['user_join'])." ".LAN_USER_34;
return e107::getDate()->computeLapse($this->var['user_join'])." ".LAN_USER_34;
}
@ -228,7 +224,7 @@ class user_shortcodes extends e_shortcode
function sc_user_email_link($parm)
{
global $user, $tp;
$tp = e107::getParser();
return ($this->var['user_hideemail'] && !ADMIN) ? "<i>".LAN_USER_35."</i>" : $tp->parseTemplate("{email={$this->var['user_email']}-link}");
}
@ -296,8 +292,7 @@ class user_shortcodes extends e_shortcode
function sc_user_name_link($parm)
{
$uparams = array('id' => $this->var['user_id'], 'name' => $this->var['user_name']);
$url = e107::getUrl();
return "<a href='".$url->create('user/profile/view', $uparams)."'>".$this->var['user_name']."</a>";
return "<a href='".e107::getUrl()->create('user/profile/view', $uparams)."'>".$this->var['user_name']."</a>";
}
@ -357,7 +352,6 @@ class user_shortcodes extends e_shortcode
function sc_user_forum_link($parm)
{
global $user;
return $this->var['user_forums'] ? "<a href='".e_HTTP."userposts.php?0.forums.".$this->var['user_id']."'>".LAN_USER_37."</a>" : "";
}
@ -365,7 +359,8 @@ class user_shortcodes extends e_shortcode
function sc_user_sendpm($parm)
{
global $pref, $tp, $user;
$pref = e107::getPref();
$tp = e107::getParser();
if(isset($pref['plug_installed']['pm']) && ($this->var['user_id'] > 0))
{
return $tp->parseTemplate("{SENDPM={$this->var['user_id']}}");
@ -374,29 +369,45 @@ class user_shortcodes extends e_shortcode
function sc_user_rating($parm)
function sc_user_rating($parm='')
{
$pref = e107::getPref();
if($pref['profile_rate'] && USER)
$frm = e107::getForm();
if(!vartrue($pref['profile_rate'])){ return; }
if(!USER){ return "Login to rate this user"; } // TODO LAN
switch ($parm)
{
include_once(e_HANDLER."rate_class.php");
$rater = new rater;
$ret = "<span>";
if($rating = $rater->getrating('user', $this->var['user_id']))
{
$num = $rating[1];
for($i=1; $i<= $num; $i++)
case 'like':
return $frm->like('user',$this->var['user_id']);
break;
case 'legacy':
$rater = e107::getRate();
$ret = "<span>";
if($rating = $rater->getrating('user', $this->var['user_id']))
{
$ret .= "<img src='".e_IMAGE_ABS."user_icons/user_star.png' alt='' />";
$num = $rating[1];
for($i=1; $i<= $num; $i++)
{
$ret .= "<img src='".e_IMAGE_ABS."rate/star.png' alt='' />";
}
}
}
if(!$rater->checkrated('user', $this->var['user_id']))
{
$ret .= " &nbsp; &nbsp;".$rater->rateselect('', 'user', $this->var['user_id']);
}
$ret .= "</span>";
return $ret;
}
if(!$rater->checkrated('user', $this->var['user_id']))
{
$ret .= " &nbsp; &nbsp;".$rater->rateselect('', 'user', $this->var['user_id']);
}
$ret .= "</span>";
return $ret;
break;
default:
return $frm->rate('user',$this->var['user_id']);
break;
}
return "";
}
@ -458,7 +469,7 @@ class user_shortcodes extends e_shortcode
{
if ($this->var['user_sess'] && file_exists(e_MEDIA."avatars/".$this->var['user_sess']))
{
//return $tp->parseTemplate("{USER_AVATAR=".$this->var['user_image']."}", true);
//return $tp->parseTemplate("{USER_AVATAR=".$this->var['user_image']."}", true); // this one will resize.
return "<img src='".e_UPLOAD_ABS."public/avatars/".$this->var['user_sess']."' alt='' />";
}
else
@ -565,15 +576,14 @@ class user_shortcodes extends e_shortcode
function sc_profile_comment_form($parm) // deprecated.
function sc_profile_comment_form($parm='') // deprecated.
{
return ;
}
function sc_total_users($parm)
function sc_total_users($parm='')
{
global $users_total;
return $users_total;
@ -581,7 +591,7 @@ class user_shortcodes extends e_shortcode
function sc_user_form_records($parm)
function sc_user_form_records($parm='')
{
global $records, $user_frm;
$ret = $user_frm->form_select_open("records");

@ -27,10 +27,11 @@ $(document).ready(function()
});
});
// var color = $(".divider").parents().css("background-color");
// $(".e-tip").tipsy({gravity: 'sw',fade: true, live: true});

@ -647,7 +647,14 @@ class e_form
return e107::getRate()->render($table, $id, $options);
}
function like($table,$id,$options=null)
{
$table = preg_replace('/\W/', '', $table);
$id = intval($id);
return e107::getRate()->renderLike($table,$id,$options);
}

@ -40,19 +40,19 @@ define("e_UC_MEMBER", 253);
define("e_UC_ADMIN", 254);
define("e_UC_NOBODY", 255);
*/
define('e_UC_ADMINMOD',249);
define('e_UC_MODS',248);
define('e_UC_NEWUSER',247); // Users in 'probationary' period
define('e_UC_BOTS',246); // Reserved to identify search bots
define('e_UC_ADMINMOD' ,249);
define('e_UC_MODS' ,248);
define('e_UC_NEWUSER' ,247); // Users in 'probationary' period
define('e_UC_BOTS' ,246); // Reserved to identify search bots
// 243..245 reserved for future predefined user classes
define('e_UC_SPECIAL_BASE',243); // Assign class IDs 243 and above for fixed/special purposes
define('e_UC_SPECIAL_END',255); // Highest 'special' class
define('e_UC_SPECIAL_BASE' ,243); // Assign class IDs 243 and above for fixed/special purposes
define('e_UC_SPECIAL_END' ,255); // Highest 'special' class
define('UC_ICON_DIR',e_IMAGE_ABS.'generic/'); // Directory for the icons used in the admin tree displays
define('UC_ICON_DIR', e_IMAGE_ABS.'generic/'); // Directory for the icons used in the admin tree displays
define('e_UC_BLANK','-1');
define('UC_TYPE_STD', '0');
define('UC_TYPE_GROUP', '1');
define('e_UC_BLANK' ,'-1');
define('UC_TYPE_STD' , '0');
define('UC_TYPE_GROUP' , '1');
define('UC_CACHE_TAG', 'nomd5_classtree');
@ -86,10 +86,14 @@ class user_class
e_UC_NEWUSER => UC_LAN_9,
e_UC_BOTS => UC_LAN_10
);
$this->text_class_link = array('public' => e_UC_PUBLIC, 'guest' => e_UC_GUEST, 'nobody' => e_UC_NOBODY, 'member' => e_UC_MEMBER,
'admin' => e_UC_ADMIN, 'main' => e_UC_MAINADMIN, 'new' => e_UC_NEWUSER, 'mods' => e_UC_MODS,
'bots' => e_UC_BOTS, 'readonly' => e_UC_READONLY);
$this->readTree(TRUE); // Initialise the classes on entry
}
@ -506,6 +510,7 @@ class user_class
$ret[e_UC_READONLY] = $this->class_tree[e_UC_READONLY]['userclass_description'];
}
*/
return $ret;
}
@ -555,13 +560,16 @@ class user_class
{
foreach ($this->class_tree[$listnum]['class_children'] as $p)
{
// Looks like we don't need to differentiate between function and class calls
if (isset($perms[$p]))
{
$ret .= call_user_func($callback,$treename, $p,$current_value,$nest_level, $opt_options);
}
$ret .= $this->vetted_sub_tree($treename, $callback,$p,$nest_level,$current_value, $perms, $opt_options);
}
}
}
return $ret;
}
@ -594,12 +602,17 @@ class user_class
}
foreach ($this->class_parents as $p)
{
if (isset($perms[$p]))
{
$ret .= call_user_func($callback,$treename, $p,$current_value,0, $opt_options);
}
$ret .= $this->vetted_sub_tree($treename, $callback,$p,0, $current_value, $perms, $opt_options);
}
// Inverted classes. (negative values for exclusion).
//FIXME - inverted class functionality lost during development.
return $ret;
}

@ -37,24 +37,24 @@ if(!isset($CONTACT_FORM))
<table style='".USER_WIDTH."' cellpadding='1' cellspacing='7'>
{CONTACT_PERSON}
<tr><td>".LANCONTACT_03."<br />
<input type='text' name='author_name' size='30' class='tbox' value=\"".$_POST['author_name']."\" />
{CONTACT_NAME}
</td></tr>
<tr><td>".LANCONTACT_04."<br />
<input type='text' name='email_send' size='30' class='tbox' value='".($_POST['email_send'] ? $_POST['email_send'] : USEREMAIL)."' />
{CONTACT_EMAIL}
</td></tr>
<tr><td>
".LANCONTACT_05."<br />
<input type='text' name='subject' size='30' class='tbox' value=\"".$_POST['subject']."\" />
{CONTACT_SUBJECT}
</td></tr>
{CONTACT_EMAIL_COPY}
<tr><td>
".LANCONTACT_06."<br />
<textarea cols='50' rows='10' name='body' class='tbox'>".stripslashes($_POST['body'])."</textarea>
{CONTACT_BODY}
</td></tr>
{CONTACT_IMAGECODE}
{CONTACT_IMAGECODE_INPUT}
<tr><td>
<input type='submit' name='send-contactus' value=\"".LANCONTACT_08."\" class='button' />
{CONTACT_SUBMIT_BUTTON}
</td></tr>
</table>
</form>";

@ -159,8 +159,11 @@ img.user-avatar { max-width:128px; -webkit-box-shadow:#CCCCCC 0px 0px 1
.comment-input { width:100%; }
.comment-box-right textarea { border:1px solid red; width: 90%; resize: none; margin:0px auto;}
.comment-box-right textarea {
margin: 0 auto;
resize: none;
width: 100% !important;
}
.comment-status { float:right; font-style: italic }
a.comment-edit { }
@ -188,7 +191,7 @@ div.e-comment-edit-save { margin-top:8px; padding: 5px }
}
.divider { border-bottom: 1px solid silver; font-size: 18px; margin-bottom: 30px; position: relative; text-align: center; }
.divider span { background: #fff; padding: 0 15px; position: relative; top: 10px; }
.divider span { padding: 0 15px; position: relative; top: 10px; }