mirror of
https://github.com/e107inc/e107.git
synced 2025-08-11 00:54:49 +02:00
Moved single shortcodes to new folder
This commit is contained in:
17
e107_core/shortcodes/single/breadcrumb.sc
Executable file
17
e107_core/shortcodes/single/breadcrumb.sc
Executable file
@@ -0,0 +1,17 @@
|
||||
global $$parm;
|
||||
$bc = $$parm;
|
||||
$flist = explode(",", $bc['fieldlist']);
|
||||
$ret = "";
|
||||
foreach($flist as $f)
|
||||
{
|
||||
if($bc[$f]['value'])
|
||||
{
|
||||
$ret .= $bc[$f]['value'];
|
||||
if($bc[$f]['sep'])
|
||||
{
|
||||
$ret .= $bc[$f]['sep'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
97
e107_core/shortcodes/single/custom.php
Normal file
97
e107_core/shortcodes/single/custom.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
function custom_shortcode($parm)
|
||||
{
|
||||
global $pref;
|
||||
$e107 = e107::getInstance();
|
||||
$custom_query = explode('+', $parm);
|
||||
switch($custom_query[0])
|
||||
{
|
||||
case 'login':
|
||||
case 'login noprofile':
|
||||
include_lan(e_PLUGIN.'login_menu/languages/'.e_LANGUAGE.'.php');
|
||||
$ret = '';
|
||||
$sep = (defined('LOGINC_SEP')) ? LOGINC_SEP : "<span class='loginc sep'>.:.</span>";
|
||||
|
||||
if (USER == true)
|
||||
{
|
||||
$ret .= "<span class='mediumtext'><span class='loginc welcome'>".LOGIN_MENU_L5." ".USERNAME."</span> ".$sep." ";
|
||||
if(ADMIN == true)
|
||||
{
|
||||
$ret .= "<a class='loginc admin' href='".e_ADMIN."admin.php'>".LOGIN_MENU_L11."</a> ".$sep.' ';
|
||||
}
|
||||
$ret .= ($custom_query[0] != 'login noprofile') ? "<a class='loginc profile' href='".e_BASE."user.php?id.".USERID."'>".LOGIN_MENU_L13."</a>\n".$sep." ":"";
|
||||
$ret .= "<a class='loginc usersettings' href='" . e_BASE . "usersettings.php'>".LOGIN_MENU_L12."</a> ".$sep." <a class='loginc logout' href='".e_BASE."index.php?logout'>".LOGIN_MENU_L8."</a> ".$sep."</span>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret .= "<form method='post' action='".e_SELF.(e_QUERY ? '?'.e_QUERY : '')."'>\n<div class='loginc_div'>\n".LOGIN_MENU_L1."<input class='tbox loginc user' type='text' name='username' size='15' value='$username' maxlength='20' /> \n".LOGIN_MENU_L2."<input class='tbox loginc pass' type='password' name='userpass' size='15' value='' maxlength='20' /> \n";
|
||||
$ret .= ($pref['user_tracking'] == "cookie") ? "<input type='checkbox' name='autologin' value='1' />".LOGIN_MENU_L6." \n" : "";
|
||||
$ret .= "<input class='button loginc' type='submit' name='userlogin' value='".LOGIN_MENU_L28."' />";
|
||||
if($pref['user_reg'])
|
||||
{
|
||||
$ret .= " <a class='loginc signup' href='".e_SIGNUP."'>".LOGIN_MENU_L3."</a>";
|
||||
}
|
||||
$ret .= "</div>\n</form>";
|
||||
}
|
||||
return $ret;
|
||||
break;
|
||||
|
||||
case 'search':
|
||||
if(!check_class($pref['search_restrict']))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
$searchflat = true;
|
||||
include_once(e_PLUGIN.'search_menu/search_menu.php');
|
||||
return '';
|
||||
break;
|
||||
|
||||
case 'quote':
|
||||
$qotd_file = e_BASE.'quote.txt';
|
||||
if(!file_exists($qotd_file))
|
||||
{
|
||||
$quote = "Quote file not found ($qotd_file)";
|
||||
}
|
||||
else
|
||||
{
|
||||
$quotes = file($qotdf_file);
|
||||
$quote = $e107->tp->toHTML($quotes[rand(0, count($quotes) -1 )], true);
|
||||
}
|
||||
return $quote;
|
||||
break;
|
||||
|
||||
case 'language':
|
||||
//FIXME obtrusive and may not work with session or subdomains - certainly better to use {LANGUAGELINKS} anyway
|
||||
$languageList = explode(',', e_LANLIST);
|
||||
sort($languageList);
|
||||
$action = (e_QUERY && ! $_GET['elan']) ? e_SELF.'?'.e_QUERY : e_SELF;
|
||||
$text = '
|
||||
<form method="post" action="'.$action.'" id="langchange">
|
||||
<select name="sitelanguage" class="tbox" onchange=\'document.getElementById("langchange").submit()\'>';
|
||||
|
||||
foreach($languageList as $languageFolder)
|
||||
{
|
||||
$selected = ($languageFolder == e_LANGUAGE) ? ' selected="selected"' : '';
|
||||
$text .= '
|
||||
<option value="'.$languageFolder.'"'.$selected.'>'.$languageFolder.'</option>';
|
||||
}
|
||||
|
||||
$text .= '
|
||||
</select>
|
||||
<input type="hidden" name="setlanguage" value="1" />
|
||||
</form>';
|
||||
return $text;
|
||||
break;
|
||||
|
||||
case 'clock':
|
||||
$clock_flat = true;
|
||||
include_once(e_PLUGIN.'clock_menu/clock_menu.php');
|
||||
return '';
|
||||
break;
|
||||
|
||||
case 'welcomemessage':
|
||||
return $e107->tp->parseTemplate('{WMESSAGE}');
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
2
e107_core/shortcodes/single/e_image.sc
Normal file
2
e107_core/shortcodes/single/e_image.sc
Normal file
@@ -0,0 +1,2 @@
|
||||
global $IMAGES_DIRECTORY;
|
||||
return $IMAGES_DIRECTORY;
|
15
e107_core/shortcodes/single/email.sc
Normal file
15
e107_core/shortcodes/single/email.sc
Normal file
@@ -0,0 +1,15 @@
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_user.php");
|
||||
|
||||
global $tp;
|
||||
if (substr($parm, -5) == '-link')
|
||||
{
|
||||
$parm = substr($parm, 0, -5);
|
||||
return ($user_hideemail && !ADMIN) ? "<i>".LAN_143."</i>" : $tp->toHTML($parm,TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ($user_hideemail && !ADMIN) ? "<i>".LAN_143."</i>" : $parm;
|
||||
}
|
||||
|
||||
|
||||
|
16
e107_core/shortcodes/single/email_item.sc
Normal file
16
e107_core/shortcodes/single/email_item.sc
Normal file
@@ -0,0 +1,16 @@
|
||||
if (!check_class(varset($pref['email_item_class'],e_UC_MEMBER)))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
if (defined("ICONMAIL") && file_exists(THEME."images/".ICONMAIL))
|
||||
{
|
||||
$icon = THEME_ABS."images/".ICONMAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
$icon = e_IMAGE_ABS."generic/email.png";
|
||||
}
|
||||
$parms = explode("^",$parm);
|
||||
// message^source^other_parms
|
||||
return "<a href='".e_HTTP."email.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}'/></a>";
|
17
e107_core/shortcodes/single/emailto.sc
Normal file
17
e107_core/shortcodes/single/emailto.sc
Normal file
@@ -0,0 +1,17 @@
|
||||
global $pref;
|
||||
|
||||
if (!USER)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
$image = IMAGE_email;
|
||||
|
||||
if(is_numeric($parm))
|
||||
{
|
||||
return "<a href='".e_BASE."emailmember.php?id.{$parm}'>{$image}</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<a href='mailto:{$parm}'>{$image}</a>";
|
||||
}
|
5
e107_core/shortcodes/single/extended.sc
Executable file
5
e107_core/shortcodes/single/extended.sc
Executable file
@@ -0,0 +1,5 @@
|
||||
//this shortcode is deprecated due to a conflict with the news {EXTENDED} shortcode.
|
||||
// Use USER_EXTENDED instead.
|
||||
|
||||
global $tp;
|
||||
return $tp->parseTemplate("{USER_EXTENDED=$parm}");
|
5
e107_core/shortcodes/single/extended_icon.sc
Normal file
5
e107_core/shortcodes/single/extended_icon.sc
Normal file
@@ -0,0 +1,5 @@
|
||||
//USAGE: {EXTENDED_ICON=<field_name>.<user_id>}
|
||||
//EXAMPLE: {EXTENDED_ICON=user_gender.5} will show the icon of the extended field user_gender for user #5
|
||||
$parms = explode(".", $parm);
|
||||
global $tp;
|
||||
return $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.icon.{$parms[1]}}");
|
5
e107_core/shortcodes/single/extended_text.sc
Normal file
5
e107_core/shortcodes/single/extended_text.sc
Normal file
@@ -0,0 +1,5 @@
|
||||
//USAGE: {EXTENDED_TEXT=<field_name>.<user_id>}
|
||||
//EXAMPLE: {EXTENDED_TEXT=user_gender.5} will show the text of the extended field user_gender for user #5
|
||||
$parms = explode(".", $parm);
|
||||
global $tp;
|
||||
return $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.text.{$parms[1]}}");
|
6
e107_core/shortcodes/single/extended_value.sc
Normal file
6
e107_core/shortcodes/single/extended_value.sc
Normal file
@@ -0,0 +1,6 @@
|
||||
//USAGE: {EXTENDED_VALUE=<field_name>.<user_id>}
|
||||
//EXAMPLE: {EXTENDED_VALUE=user_gender.5} will show the value of the extended field user_gender for user #5
|
||||
$parms = explode(".", $parm);
|
||||
global $tp;
|
||||
return "hello";
|
||||
return $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.value.{$parms[1]}}");
|
104
e107_core/shortcodes/single/iconpicker.php
Normal file
104
e107_core/shortcodes/single/iconpicker.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id$
|
||||
*
|
||||
* Image picker shortcode
|
||||
*
|
||||
*/
|
||||
|
||||
function iconpicker_shortcode($parm)
|
||||
{
|
||||
require_once (e_HANDLER."file_class.php");
|
||||
require_once(e_HANDLER.'admin_handler.php');
|
||||
|
||||
$e107 = &e107::getInstance();
|
||||
|
||||
$fl = new e_file();
|
||||
$parms = array();
|
||||
|
||||
parse_str($parm, $parms);
|
||||
|
||||
if(!varset($parms['path']))
|
||||
{
|
||||
$parms['path'] = e_IMAGE."icons/";
|
||||
$parms['path_omit'] = e_IMAGE."icons/";
|
||||
}
|
||||
$parms['path'] = explode('|', $parms['path']);
|
||||
|
||||
$iconlist = array();
|
||||
foreach($parms['path'] as $iconpath)
|
||||
{
|
||||
$tmp = $fl->get_files($iconpath, '\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG');
|
||||
if($tmp)
|
||||
{
|
||||
$iconlist += $tmp;
|
||||
}
|
||||
unset($tmp);
|
||||
}
|
||||
$iconlist = multiarray_sort($iconlist, 'fname');
|
||||
|
||||
$tmp = array(16, 32, 48, 64, 128);
|
||||
$tmp1 = array();
|
||||
$name = varset($parms['id']);
|
||||
|
||||
global $iconpool,$tp;
|
||||
|
||||
$iconlist = $iconpool; // this overrides most of the code above - needs reviewing.
|
||||
|
||||
foreach($iconlist as $folder)
|
||||
{
|
||||
|
||||
// $filepath = varsettrue($parms['path_omit']) ? str_replace(explode('|', $parms['path_omit']), "", $icon['path'].$icon['fname']) : $e107->tp->createConstants($icon['path'], 1).$icon['fname'];
|
||||
// $filepath_abs = str_replace(array(e_IMAGE, e_FILE, e_PLUGIN), array(e_IMAGE_ABS, e_FILE_ABS, e_PLUGIN_ABS), $icon['path'].$icon['fname']);
|
||||
|
||||
foreach($folder as $icon)
|
||||
{
|
||||
$filepath = $icon;
|
||||
$filepath_abs = $tp->replaceConstants($icon,"abs");
|
||||
$icon_file = basename($filepath_abs);
|
||||
|
||||
$str = "<a href='#{$filepath}' title='{$filepath}' onclick=\"e107Helper.insertText('{$filepath}','{$name}','{$name}-iconpicker'); return false; \"><img class='icon picker list%%size%%' src='{$filepath_abs}' alt='{$icon_file}' /></a>";
|
||||
|
||||
foreach ($tmp as $isize)
|
||||
{
|
||||
if(strpos($icon_file, '_'.$isize.'.') !== false)
|
||||
{
|
||||
|
||||
$tmp1[$isize] = varset($tmp1[$isize]).str_replace('%%size%%', ' S'.$isize, $str);
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
$tmp1['other'] = varset($tmp1['other']).$str;//other
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*foreach($iconlist as $icon)
|
||||
{
|
||||
|
||||
$filepath = varsettrue($parms['path_omit']) ? str_replace(explode('|', $parms['path_omit']), "", $icon['path'].$icon['fname']) : $e107->tp->createConstants($icon['path'], 1).$icon['fname'];
|
||||
$filepath_abs = str_replace(array(e_IMAGE, e_FILE, e_PLUGIN), array(e_IMAGE_ABS, e_FILE_ABS, e_PLUGIN_ABS), $icon['path'].$icon['fname']);
|
||||
$str = "<a href='#{$filepath}' title='{$filepath}' onclick=\"e107Helper.insertText('{$filepath}','{$name}','{$name}-iconpicker'); return false; \"><img class='icon picker list%%size%%' src='{$filepath_abs}' alt='{$filepath}' /></a>";
|
||||
|
||||
foreach ($tmp as $isize)
|
||||
{
|
||||
|
||||
if(strpos($icon['fname'], '_'.$isize.'.') !== false)
|
||||
{
|
||||
|
||||
$tmp1[$isize] = varset($tmp1[$isize]).str_replace('%%size%%', ' S'.$isize, $str);
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
$tmp1['other'] = varset($tmp1['other']).$str;//other
|
||||
}*/
|
||||
|
||||
return $tmp1 ? '<div id="'.$name.'-iconpicker-ajax"><div class="field-spacer iconpicker">'.str_replace('%%size%%', '', implode('</div><div class="field-spacer iconpicker">', $tmp1)).'</div></div>' : '';
|
||||
|
||||
}
|
||||
?>
|
55
e107_core/shortcodes/single/imagepreview.php
Normal file
55
e107_core/shortcodes/single/imagepreview.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
// $Id$
|
||||
|
||||
function imagepreview_shortcode($parm)
|
||||
{
|
||||
list($name, $width, $height) = explode("|",$parm, 3);
|
||||
|
||||
$name = rawurldecode(varset($name));//avoid warnings
|
||||
if(varset($width))
|
||||
{
|
||||
$width = " width: {$width};";
|
||||
}
|
||||
else $width = '';
|
||||
if(varset($height))
|
||||
{
|
||||
$height = " height: {$height};";
|
||||
}
|
||||
else $height = '';
|
||||
|
||||
// array support
|
||||
if(strpos($name, '[')) //can't be first string
|
||||
{
|
||||
$matches = array();
|
||||
$search = $name;
|
||||
|
||||
$tmp = explode('[', $name, 2);
|
||||
$name = $tmp[0]; unset($tmp);
|
||||
|
||||
$path = '';
|
||||
|
||||
if(isset($_POST[$name]) && is_array($_POST[$name]) && preg_match_all('#\[([\w]*)\]#', $search, $matches, PREG_PATTERN_ORDER))
|
||||
{
|
||||
$posted = $_POST[$name];
|
||||
foreach ($matches[1] as $varname)
|
||||
{
|
||||
if(!isset($posted[$varname]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
$posted = $posted[$varname];
|
||||
}
|
||||
}
|
||||
if($posted && is_string($posted))
|
||||
$path = e107::getParser()->replaceConstants($posted, 'full');
|
||||
}
|
||||
else $path = (varset($_POST[$name])/* && deftrue('e_AJAX_REQUEST')*/) ? e107::getParser()->replaceConstants($_POST[$name], 'full') : '';
|
||||
$hide = '';
|
||||
|
||||
if(!$path)
|
||||
{
|
||||
$path = e_IMAGE_ABS."generic/blank.gif";
|
||||
$hide = ' style="display: none;"';
|
||||
}
|
||||
return "<a href='{$path}' rel='external' class='e-image-preview'{$hide}><img src='{$path}' alt=\"\" class='image-selector' style='{$width}{$height}' /></a>";
|
||||
}
|
135
e107_core/shortcodes/single/imageselector.sc
Normal file
135
e107_core/shortcodes/single/imageselector.sc
Normal file
@@ -0,0 +1,135 @@
|
||||
|
||||
// $Id$
|
||||
//FIXME - full rewrite, backward compatible
|
||||
global $sql,$parm,$tp;
|
||||
|
||||
if(strstr($parm,"="))
|
||||
{ // query style parms.
|
||||
parse_str($parm, $parms);
|
||||
extract($parms);
|
||||
}
|
||||
else
|
||||
{ // comma separated parms.
|
||||
list($name,$path,$default,$width,$height,$multiple,$label,$subdirs,$filter,$fullpath,$click_target,$click_prefix,$click_postfix,$tabindex,$class) = explode(",",$parm);
|
||||
}
|
||||
|
||||
$paths = explode("|",$path);
|
||||
|
||||
if(trim($default[0])=="{")
|
||||
{
|
||||
$pvw_default = $tp->replaceConstants($default, 'abs');
|
||||
$path = ""; // remove the default path if a constant is used.
|
||||
}
|
||||
|
||||
$scaction = varsettrue($scaction, 'all');
|
||||
$text = '';
|
||||
$name_id = e107::getForm()->name2id($name);
|
||||
|
||||
//Get Select Box Only!
|
||||
if($scaction == 'select' || $scaction == 'all')
|
||||
{
|
||||
require_once(e_HANDLER."file_class.php");
|
||||
$fl = new e_file;
|
||||
|
||||
|
||||
$recurse = ($subdirs) ? $subdirs : 0;
|
||||
$imagelist = array();
|
||||
|
||||
foreach($paths as $pths)
|
||||
{
|
||||
$imagelist[$tp->createConstants($pths, 1)]= $fl->get_files($pths,'\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG', 'standard', $recurse);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!$fullpath && (count($paths) > 1))
|
||||
{
|
||||
$fullpath = TRUE;
|
||||
}
|
||||
|
||||
$multi = ($multiple == "TRUE" || $multiple == "1") ? " multiple='multiple' style='height:{$height}'" : "";//style='float:left'
|
||||
$width = ($width) ? $width : "0";
|
||||
$height = ($height) ? $height : "0";
|
||||
$label = ($label) ? $label : " -- -- ";
|
||||
$tabindex = varset($tabindex) ? " tabindex='{$tabindex}'" : '';
|
||||
$class = varset($class) ? " class='{$class}'" : " class='tbox imgselector'";
|
||||
|
||||
$text .= "<select{$multi}{$tabindex}{$class} name='{$name}' id='{$name_id}' onchange=\"replaceSC('imagepreview={$name}|{$width}|{$height}',this.form,'{$name_id}_prev'); \">
|
||||
<option value=''>".$label."</option>\n";
|
||||
|
||||
require_once(e_HANDLER.'admin_handler.php');
|
||||
foreach($imagelist as $imagedirlabel => $icons)
|
||||
{
|
||||
|
||||
$text .= "<optgroup label='".$tp->replaceConstants($imagedirlabel, TRUE)."'>";
|
||||
if(empty($icons)) $text .= "<option value=''>Empty</option>\n";
|
||||
else
|
||||
{
|
||||
$icons = multiarray_sort($icons, 'fname');
|
||||
|
||||
foreach($icons as $icon)
|
||||
{
|
||||
$dir = str_replace($paths,"",$icon['path']);
|
||||
|
||||
if(!$filter || ($filter && ereg($filter,$dir.$icon['fname'])))
|
||||
{
|
||||
|
||||
$pth = ($fullpath) ? $tp->createConstants($icon['path'],1) : $dir;
|
||||
$selected = ($default == $pth.$icon['fname'] || $pth.$default == $pth.$icon['fname']) ? " selected='selected'" : "";
|
||||
$text .= "<option value='{$pth}{$icon['fname']}'{$selected}> {$dir}{$icon['fname']}</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$text .= '</optgroup>';
|
||||
}
|
||||
$text .= "</select>";
|
||||
|
||||
|
||||
if($scaction == 'select') return $text;
|
||||
}
|
||||
|
||||
$hide = '';
|
||||
if(!$pvw_default)
|
||||
{
|
||||
if($default)
|
||||
{
|
||||
$test = pathinfo($default);
|
||||
if('.' == $test['dirname'])
|
||||
{
|
||||
// file only, add absolute path
|
||||
$path = $tp->createConstants($path, 1);
|
||||
$path = $tp->replaceConstants($path, 'abs');
|
||||
$pvw_default = $path.$default;
|
||||
}
|
||||
else
|
||||
{
|
||||
// path, convert to absolute path
|
||||
$pvw_default = $tp->createConstants($default, 1);
|
||||
$pvw_default = $tp->replaceConstants($pvw_default, 'abs');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$pvw_default = e_IMAGE_ABS."generic/blank.gif";
|
||||
$hide = ' style="display: none;"';
|
||||
}
|
||||
}
|
||||
|
||||
$text .= "<div class='imgselector-container' id='{$name_id}_prev'>";
|
||||
if(varset($click_target))
|
||||
{
|
||||
$pre = varset($click_prefix);
|
||||
$post = varset($click_postfix);
|
||||
$text .= "<a href='#'{$hide} onclick='addtext(\"{$pre}\"+document.getElementById(\"{$name_id}\").value+\"{$post}\", true);document.getElementById(\"{$name_id}\").selectedIndex = -1;return false;'>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= "<a href='{$pvw_default}'{$hide} rel='external' class='e-image-preview'>";
|
||||
}
|
||||
if(vartrue($height)) $height = "height:{$height};";
|
||||
if(vartrue($width)) $width = "width:{$width}; ";
|
||||
$text .= "<img src='{$pvw_default}' alt='' style='{$width}{$height}' /></a>";
|
||||
|
||||
$text .= "</div>\n";
|
||||
|
||||
return "\n\n<!-- Start Image Selector [{$scaction}] -->\n\n".$text."\n\n<!-- End Image Selector [{$scaction}] -->\n\n";
|
0
e107_core/shortcodes/single/index.html
Normal file
0
e107_core/shortcodes/single/index.html
Normal file
48
e107_core/shortcodes/single/languagelinks.sc
Normal file
48
e107_core/shortcodes/single/languagelinks.sc
Normal file
@@ -0,0 +1,48 @@
|
||||
//<? $Id$
|
||||
global $pref;
|
||||
if( ! defined('LANGLINKS_SEPARATOR'))
|
||||
{
|
||||
define('LANGLINKS_SEPARATOR', ' | ');
|
||||
}
|
||||
//$cursub = explode('.', $_SERVER['HTTP_HOST']);
|
||||
|
||||
require_once(e_HANDLER.'language_class.php');
|
||||
$slng = new language;
|
||||
|
||||
if($parm)
|
||||
{
|
||||
$languageList = explode(',', $parm);
|
||||
}
|
||||
else
|
||||
{
|
||||
$languageList = explode(',', e_LANLIST);
|
||||
sort($languageList);
|
||||
}
|
||||
|
||||
if(count($languageList) < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach($languageList as $languageFolder)
|
||||
{
|
||||
$code = $slng->convert($languageFolder);
|
||||
$name = $slng->toNative($languageFolder);
|
||||
//$subdom = (isset($cursub[2])) ? $cursub[0] : '';
|
||||
|
||||
if(varset($pref['multilanguage_subdomain']))
|
||||
{
|
||||
$code = ($languageFolder == $pref['sitelanguage']) ? 'www.' : $code;
|
||||
$link = (e_QUERY)
|
||||
? str_replace($_SERVER['HTTP_HOST'], $code.'.'.e_DOMAIN, e_SELF).'?'.e_QUERY
|
||||
: str_replace($_SERVER['HTTP_HOST'], $code.'.'.e_DOMAIN, e_SELF);
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = (e_QUERY) ? e_SELF.'?['.$code.']'.e_QUERY : e_SELF.'?['.$code.']';
|
||||
}
|
||||
$class = ($languageFolder == e_LANGUAGE) ? 'languagelink_active' : 'languagelink';
|
||||
$ret[] = "\n<a class='{$class}' href='{$link}'>{$name}</a>";
|
||||
}
|
||||
|
||||
return implode(LANGLINKS_SEPARATOR, $ret);
|
2
e107_core/shortcodes/single/linkstyle.sc
Normal file
2
e107_core/shortcodes/single/linkstyle.sc
Normal file
@@ -0,0 +1,2 @@
|
||||
global $linkstyle;
|
||||
$linkstyle = $parm;
|
10
e107_core/shortcodes/single/menu.php
Normal file
10
e107_core/shortcodes/single/menu.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
function menu_shortcode($parm)
|
||||
{
|
||||
return e107::getMenu()->renderArea($parm);
|
||||
}
|
||||
|
||||
|
||||
?>
|
170
e107_core/shortcodes/single/news_categories.sc
Normal file
170
e107_core/shortcodes/single/news_categories.sc
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id$
|
||||
*
|
||||
* News Categories shortcode
|
||||
*/
|
||||
global $e107, $sql,$pref,$tp,$NEWSCAT,$NEWSCAT_ITEM;
|
||||
|
||||
$cString = 'nq_news_categories_sc';
|
||||
$cached = e107::getCache()->retrieve($cString);
|
||||
|
||||
if(false !== $cached)
|
||||
{
|
||||
return $cached;
|
||||
}
|
||||
|
||||
require_once(e_HANDLER."news_class.php");
|
||||
$ix = new news;
|
||||
|
||||
$nbr_cols = (isset($pref['nbr_cols'])) ? $pref['nbr_cols'] : 1;
|
||||
$nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols;
|
||||
|
||||
if(!defined("NEWSCAT_AMOUNT")){
|
||||
define("NEWSCAT_AMOUNT",3);
|
||||
}
|
||||
|
||||
if(!$NEWSCAT){
|
||||
$NEWSCAT = "
|
||||
<div style='padding:5px'><div style='border-bottom:1px inset black; padding-bottom:1px;margin-bottom:5px'>
|
||||
{NEWSCATICON} {NEWSCATEGORY}
|
||||
</div>
|
||||
{NEWSCAT_ITEM}
|
||||
</div>
|
||||
";
|
||||
}
|
||||
|
||||
if(!$NEWSCAT_ITEM){
|
||||
$NEWSCAT_ITEM = "
|
||||
<div style='width:100%;padding-bottom:2px'>
|
||||
<table style='width:100%' cellpadding='0' cellspacing='0' border='0'>
|
||||
<tr>
|
||||
<td style='width:2px;vertical-align:top'>•
|
||||
</td>
|
||||
<td style='text-align:left;vertical-align:top;padding-left:3px'>
|
||||
{NEWSTITLELINK}
|
||||
<br />
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
if(!defined("NEWSCAT_CATLINK")){
|
||||
define("NEWSCAT_CATLINK","");
|
||||
}
|
||||
if(!defined("NEWSCAT_ITEMLINK")){
|
||||
define("NEWSCAT_ITEMLINK","");
|
||||
}
|
||||
if(!defined("NEWSCAT_STYLE")){
|
||||
define("NEWSCAT_STYLE","width:96%");
|
||||
}
|
||||
if(!defined("NEWSCAT_CATICON")){
|
||||
define("NEWSCAT_CATICON","border:0px");
|
||||
}
|
||||
if(!defined("NEWSCAT_THUMB")){
|
||||
define("NEWSCAT_THUMB","border:0px");
|
||||
}
|
||||
|
||||
if(!defined("NEWSCAT_CELL")){
|
||||
define("NEWSCAT_CELL","vertical-align:top");
|
||||
}
|
||||
|
||||
|
||||
|
||||
$param['itemlink'] = NEWSCAT_ITEMLINK;
|
||||
$param['thumbnail'] = NEWSCAT_THUMB;
|
||||
$param['catlink'] = NEWSCAT_CATLINK;
|
||||
$param['caticon'] = NEWSCAT_CATICON;
|
||||
|
||||
$sql2 = new db;
|
||||
$qry = "SELECT nc.*, ncr.news_rewrite_string AS news_category_rewrite_string, ncr.news_rewrite_id AS news_category_rewrite_id FROM #news_category AS nc
|
||||
LEFT JOIN #news_rewrite AS ncr ON nc.category_id=ncr.news_rewrite_source AND ncr.news_rewrite_type=2
|
||||
ORDER BY nc.category_order ASC
|
||||
";
|
||||
if(!$sql2->db_Select_gen($qry))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$text3 = "\n\n\n
|
||||
<div style='width:100%;text-align:center;margin-left:auto;margin-right:auto'>
|
||||
<table style='".NEWSCAT_STYLE."' cellpadding='0' cellspacing='0'>
|
||||
\n";
|
||||
$t = 0;
|
||||
$wid = floor(100/$nbr_cols);
|
||||
while ($row3 = $sql2->db_Fetch()) {
|
||||
extract($row3);
|
||||
//quick fix
|
||||
if($category_icon)
|
||||
{
|
||||
// new path
|
||||
if(strpos($category_icon, '{') === 0)
|
||||
{
|
||||
$category_icon = e107::getParser()->replaceConstants($category_icon, 'abs');
|
||||
}
|
||||
else //old paths
|
||||
{
|
||||
$category_icon = e_IMAGE_ABS."icons/".$category_icon;
|
||||
}
|
||||
}
|
||||
$search[0] = "/\{NEWSCATICON\}(.*?)/si";
|
||||
$replace[0] = ($category_icon) ? "<a href='".$e107->url->getUrl('core:news', 'main', 'action=list&id='.$category_id.'&sef='.$news_category_rewrite_string)."'><img src='".$category_icon."' alt='' style='".$param['caticon']."' /></a>" : "";
|
||||
|
||||
$search[1] = "/\{NEWSCATEGORY\}(.*?)/si";
|
||||
$replace[1] = ($category_name) ? "<a href='".$e107->url->getUrl('core:news', 'main', 'action=list&id='.$category_id.'&sef='.$news_category_rewrite_string)."' style='".$param['catlink']."' >".$tp->toHTML($category_name,TRUE,"defs")."</a>" : "";
|
||||
|
||||
$text3 .= ($t % $nbr_cols == 0) ? "<tr>" : "";
|
||||
$text3 .= "\n<td style='".NEWSCAT_CELL."; width:$wid%;'>\n";
|
||||
|
||||
// Grab each news item.--------------
|
||||
$cqry = "SELECT n.*, nr.* FROM #news AS n
|
||||
LEFT JOIN #news_rewrite AS nr ON n.news_id=nr.news_rewrite_source AND nr.news_rewrite_type=1
|
||||
WHERE news_category='".intval($category_id)."'
|
||||
AND news_class IN (".USERCLASS_LIST.")
|
||||
AND (news_start=0 || news_start < ".time().")
|
||||
AND (news_end=0 || news_end>".time().")
|
||||
ORDER BY news_datestamp DESC LIMIT 0,".NEWSCAT_AMOUNT;
|
||||
|
||||
$count = $sql->db_Select_gen($cqry);
|
||||
//$count = $sql->db_Select("news", "*", "news_category='".intval($category_id)."' AND news_class IN (".USERCLASS_LIST.") AND (news_start=0 || news_start < ".time().") AND (news_end=0 || news_end>".time().") ORDER BY news_datestamp DESC LIMIT 0,".NEWSCAT_AMOUNT);
|
||||
if($count)
|
||||
{
|
||||
while ($row = $sql->db_Fetch()) {
|
||||
|
||||
//$row['category_name'] = $category_name;
|
||||
//$row['category_icon'] = $category_icon;
|
||||
$row = array_merge($row, $row3);
|
||||
$textbody .= $ix -> render_newsitem($row, 'return', '', $NEWSCAT_ITEM, $param);
|
||||
|
||||
}
|
||||
}
|
||||
// ----------------------------------
|
||||
|
||||
$search[2] = "/\{NEWSCAT_ITEM\}(.*?)/si";
|
||||
$replace[2] = $textbody;
|
||||
|
||||
$text3 .= preg_replace($search, $replace,$NEWSCAT);
|
||||
unset($textbody);
|
||||
|
||||
|
||||
$text3 .= "\n</td>\n";
|
||||
if (($t+1) % $nbr_cols == 0) {
|
||||
$text3 .= "</tr>";
|
||||
$t++;
|
||||
} else {
|
||||
$t++;
|
||||
}
|
||||
}
|
||||
|
||||
while ($t % $nbr_cols != 0){
|
||||
$text3 .= "<td style='".NEWSCAT_CELL.";width:{$wid}%'> </td>\n";
|
||||
$text3 .= (($t+1) % $nbr_cols == 0) ? "</tr>" : "";
|
||||
$t++;
|
||||
}
|
||||
|
||||
$text3 .= "</table></div>";
|
||||
|
||||
e107::getCache()->set($cString, $text3);
|
||||
return $text3;
|
3
e107_core/shortcodes/single/news_category.sc
Normal file
3
e107_core/shortcodes/single/news_category.sc
Normal file
@@ -0,0 +1,3 @@
|
||||
require_once(e_PLUGIN."alt_news/alt_news.php");
|
||||
alt_news($parm);
|
||||
return "";
|
5
e107_core/shortcodes/single/newsfile.sc
Normal file
5
e107_core/shortcodes/single/newsfile.sc
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
$image = (file_exists(THEME."images/download.png") ? THEME_ABS."images/download.png" : e_IMAGE_ABS.'generic/download.png');
|
||||
return "<img src='$image' alt='' style='vertical-align: middle;' /> <a href='".e_FILE_ABS."downloads/".$parm."'>".$parm."</a>";
|
||||
|
4
e107_core/shortcodes/single/newsimage.sc
Normal file
4
e107_core/shortcodes/single/newsimage.sc
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
return "<img src='".e_IMAGE_ABS."newspost_images/".$parm."' alt='' />";
|
||||
|
227
e107_core/shortcodes/single/nextprev.sc
Normal file
227
e107_core/shortcodes/single/nextprev.sc
Normal file
@@ -0,0 +1,227 @@
|
||||
global $pref;
|
||||
$e107 = e107::getInstance();
|
||||
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_np.php');
|
||||
$parm_count = substr_count($parm, ',');
|
||||
|
||||
while($parm_count < 5)
|
||||
{
|
||||
$parm .= ',';
|
||||
$parm_count++;
|
||||
}
|
||||
|
||||
$p = explode(',', $parm, 6);
|
||||
|
||||
$total_items = intval($p[0]);
|
||||
$perpage = intval($p[1]);
|
||||
$current_start = intval($p[2]);
|
||||
$url = trim($p[3]);
|
||||
$caption = trim($p[4]);
|
||||
$pagetitle = explode('|',trim($p[5]));
|
||||
|
||||
if($total_items < $perpage) { return ''; }
|
||||
|
||||
|
||||
|
||||
$caption = (!$caption || $caption == 'off') ? NP_3.' ' : $caption;
|
||||
|
||||
while(substr($url, -1) == '.')
|
||||
{
|
||||
$url=substr($url, 0, -1);
|
||||
}
|
||||
|
||||
$current_page = ($current_start/$perpage) + 1;
|
||||
$total_pages = ceil($total_items/$perpage);
|
||||
|
||||
if($total_pages > 1)
|
||||
{
|
||||
if(varsettrue($pref['old_np']))
|
||||
{
|
||||
|
||||
$NP_PRE_ACTIVE = '';
|
||||
$NP_POST_ACTIVE = '';
|
||||
$NP_STYLE = '';
|
||||
|
||||
if(!defined('NEXTPREV_NOSTYLE') || NEXTPREV_NOSTYLE==FALSE){
|
||||
$NP_PRE_ACTIVE = '[';
|
||||
$NP_POST_ACTIVE = '] ';
|
||||
$NP_STYLE = "style='text-decoration:underline'";
|
||||
}
|
||||
|
||||
|
||||
// Use OLD nextprev method
|
||||
$nppage = '';
|
||||
$nppage .= "\n\n<!-- Start of Next/Prev -->\n\n";
|
||||
if ($total_pages > 10)
|
||||
{
|
||||
$current_page = ($current_start/$perpage)+1;
|
||||
|
||||
for($c = 0; $c <= 2; $c++)
|
||||
{
|
||||
if($perpage * $c == $current_start)
|
||||
{
|
||||
$nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = str_replace("[FROM]", ($perpage * $c), $url);
|
||||
$nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($current_page >= 3 && $current_page <= 5)
|
||||
{
|
||||
for($c = 3; $c <= $current_page; $c++)
|
||||
{
|
||||
if($perpage * $c == $current_start)
|
||||
{
|
||||
$nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = str_replace("[FROM]", ($perpage * $c), $url);
|
||||
$nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($current_page >= 6 && $current_page <= ($total_pages-5))
|
||||
{
|
||||
$nppage .= " ... ";
|
||||
for($c = ($current_page-2); $c <= $current_page; $c++)
|
||||
{
|
||||
if($perpage * $c == $current_start)
|
||||
{
|
||||
$nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = str_replace("[FROM]", ($perpage * $c), $url);
|
||||
$nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$nppage .= " ... ";
|
||||
|
||||
if (($current_page+5) > $total_pages && $current_page != $total_pages)
|
||||
{
|
||||
$tmp = ($current_page-2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmp = $total_pages-3;
|
||||
}
|
||||
|
||||
for($c = $tmp; $c <= ($total_pages-1); $c++)
|
||||
{
|
||||
if($perpage * $c == $current_start)
|
||||
{
|
||||
$nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = str_replace("[FROM]", ($perpage * $c), $url);
|
||||
$nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
for($c = 0; $c < $total_pages; $c++)
|
||||
{
|
||||
if($perpage * $c == $current_start)
|
||||
{
|
||||
$nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = str_replace("[FROM]", ($perpage * $c), $url);
|
||||
$nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$nppage .= "\n\n<!-- End of Next/Prev -->\n\n";
|
||||
return $caption.$nppage;
|
||||
}
|
||||
|
||||
// Use NEW nextprev method
|
||||
$np_parm['template'] = "[PREV] [DROPDOWN] [NEXT]";
|
||||
$np_parms['prev'] = ' << ';
|
||||
$np_parms['next'] = ' >> ';
|
||||
$np_parms['np_class'] = 'tbox npbutton';
|
||||
$np_parms['dropdown_class'] = 'tbox npdropdown';
|
||||
|
||||
if($cached_parms = getcachedvars('nextprev'))
|
||||
{
|
||||
$tmp = $cached_parms;
|
||||
foreach($tmp as $key => $val)
|
||||
{
|
||||
$np_parms[$key]=$val;
|
||||
}
|
||||
}
|
||||
|
||||
$prev='';
|
||||
$next='';
|
||||
if($current_page > 1)
|
||||
{
|
||||
$prevstart = ($current_start - $perpage);
|
||||
|
||||
if(substr($url, 0, 5) == 'url::')
|
||||
{
|
||||
$urlParms = explode('::', $url);
|
||||
$urlParms[3] = str_replace('[FROM]', $prevstart, $urlParms[3]);
|
||||
$link = $e107->url->getUrl($urlParms[1], $urlParms[2], $urlParms[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = str_replace('[FROM]', $prevstart, $url);
|
||||
}
|
||||
$prev = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['prev']}</a>";
|
||||
}
|
||||
if($current_page < $total_pages)
|
||||
{
|
||||
$nextstart = ($current_start + $perpage);
|
||||
if(substr($url, 0, 5) == 'url::')
|
||||
{
|
||||
$urlParms = explode('::', $url);
|
||||
$urlParms[3] = str_replace('[FROM]', $nextstart, $urlParms[3]);
|
||||
$link = $e107->url->getUrl($urlParms[1], $urlParms[2], $urlParms[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = str_replace('[FROM]', $nextstart, $url);
|
||||
}
|
||||
$next = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['next']}</a>";
|
||||
}
|
||||
$dropdown = "<select class='{$np_parms['dropdown_class']}' name='pageSelect' onchange='location.href=this.options[selectedIndex].value'>";
|
||||
for($i = 1; $i <= $total_pages; $i++)
|
||||
{
|
||||
$sel = '';
|
||||
if($current_page == $i)
|
||||
{
|
||||
$sel = " selected='selected' ";
|
||||
}
|
||||
$newstart = ($i-1)*$perpage;
|
||||
if(substr($url, 0, 5) == 'url::')
|
||||
{
|
||||
$urlParms = explode('::', $url);
|
||||
$urlParms[3] = str_replace('[FROM]', $newstart, $urlParms[3]);
|
||||
$link = $e107->url->getUrl($urlParms[1], $urlParms[2], $urlParms[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = str_replace('[FROM]', $newstart, $url);
|
||||
}
|
||||
$c = $i-1;
|
||||
$title = ($pagetitle[$c]) ? $pagetitle[$c] : $i;
|
||||
$dropdown .= "<option value='{$link}' {$sel}>{$title}</option>\n";
|
||||
}
|
||||
$dropdown .= '</select>';
|
||||
$ret = $np_parm['template'];
|
||||
$ret = str_replace('[DROPDOWN]', $dropdown, $ret);
|
||||
$ret = str_replace('[PREV]', $prev, $ret);
|
||||
$ret = str_replace('[NEXT]', $next, $ret);
|
||||
return $caption.$ret;
|
||||
}
|
||||
return '';
|
33
e107_core/shortcodes/single/picture.sc
Normal file
33
e107_core/shortcodes/single/picture.sc
Normal file
@@ -0,0 +1,33 @@
|
||||
global $loop_uid;
|
||||
if($parm == "" && is_numeric($loop_uid))
|
||||
{
|
||||
$parm = $loop_uid;
|
||||
}
|
||||
if(is_numeric($parm))
|
||||
{
|
||||
if(intval($parm) == USERID)
|
||||
{
|
||||
$image = USERPHOTO;
|
||||
}
|
||||
else
|
||||
{
|
||||
$row = get_user_data(intval($parm));
|
||||
$image=$row['user_sess'];
|
||||
}
|
||||
}
|
||||
elseif($parm)
|
||||
{
|
||||
$image=$parm;
|
||||
}
|
||||
else
|
||||
{
|
||||
$image = USERPHOTO;
|
||||
}
|
||||
if($image && file_exists(e_FILE."public/avatars/".$image))
|
||||
{
|
||||
return "<img src='".e_FILE_ABS."public/avatars/{$image}' alt='' />";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
21
e107_core/shortcodes/single/plugin.php
Normal file
21
e107_core/shortcodes/single/plugin.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
function plugin_shortcode($parm = '')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
list($menu,$return) = explode('|',$parm.'|');
|
||||
|
||||
$path = $tp -> toDB(dirname($menu));
|
||||
$name = $tp -> toDB(basename($menu));
|
||||
|
||||
if($path == '.')
|
||||
{
|
||||
$path = $menu;
|
||||
}
|
||||
/**
|
||||
* @todo: $mode not defined
|
||||
*/
|
||||
return e107::getMenu()->renderMenu($path,$name,$mode,$return);
|
||||
}
|
12
e107_core/shortcodes/single/print_item.sc
Normal file
12
e107_core/shortcodes/single/print_item.sc
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
if (defined("ICONPRINT") && file_exists(THEME."images/".ICONPRINT))
|
||||
{
|
||||
$icon = THEME_ABS."images/".ICONPRINT;
|
||||
}
|
||||
else
|
||||
{
|
||||
$icon = e_IMAGE_ABS."generic/printer.png";
|
||||
}
|
||||
$parms = explode("^",$parm);
|
||||
return "<a href='".e_HTTP."print.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
|
2
e107_core/shortcodes/single/profile.sc
Normal file
2
e107_core/shortcodes/single/profile.sc
Normal file
@@ -0,0 +1,2 @@
|
||||
$id = ($parm) ? $parm : USERID;
|
||||
return "<a href='".e_HTTP."user.php?id.{$id}'>".IMAGE_profile."</a>";
|
47
e107_core/shortcodes/single/search.sc
Normal file
47
e107_core/shortcodes/single/search.sc
Normal file
@@ -0,0 +1,47 @@
|
||||
global $sql,$sysprefs,$SEARCH_SHORTCODE;
|
||||
|
||||
include_lan(e_PLUGIN."search_menu/languages/".e_LANGUAGE.".php");
|
||||
$text = "";
|
||||
if (!isset($SEARCH_SHORTCODE)) {
|
||||
if (file_exists(THEME."search_template.php")) {
|
||||
include(THEME."search_template.php");
|
||||
} else {
|
||||
include(e_THEME."templates/search_template.php");
|
||||
}
|
||||
}
|
||||
$ref['all'] = 'all';
|
||||
$ref['news'] = '0';
|
||||
$ref['comments'] = 1;
|
||||
$ref['users'] = 2;
|
||||
$ref['downloads'] = 3;
|
||||
$ref['pages'] = 4;
|
||||
|
||||
$search_prefs = $sysprefs -> getArray('search_prefs');
|
||||
|
||||
foreach ($search_prefs['plug_handlers'] as $plug_dir => $active) {
|
||||
if (is_readable(e_PLUGIN.$plug_dir."/e_search.php")) {
|
||||
$ref[$plug_dir] = $plug_dir;
|
||||
}
|
||||
}
|
||||
|
||||
if($ref[$parm]!= ''){
|
||||
$page = $ref[$parm];
|
||||
}elseif($parm='all' && $ref[e_PAGE] != ''){
|
||||
$page = $ref[e_PAGE];
|
||||
}else{
|
||||
$page = 'all';
|
||||
}
|
||||
|
||||
$text .= "<form method='get' action='".e_HTTP."search.php'><div>\n";
|
||||
$text .= "<input type='hidden' name='t' value='$page' />\n";
|
||||
$text .= "<input type='hidden' name='r' value='0' />\n";
|
||||
|
||||
if (defined('SEARCH_SHORTCODE_REF') && SEARCH_SHORTCODE_REF != '') {
|
||||
$text .= "<input type='hidden' name='ref' value=\"".SEARCH_SHORTCODE_REF."\" />\n";
|
||||
}
|
||||
|
||||
$text .= $SEARCH_SHORTCODE;
|
||||
|
||||
$text .="\n</div></form>";
|
||||
|
||||
return $text;
|
12
e107_core/shortcodes/single/setstyle.php
Normal file
12
e107_core/shortcodes/single/setstyle.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
function setstyle_shortcode($parm)
|
||||
{
|
||||
global $style; // BC
|
||||
$style = $parm; // BC
|
||||
|
||||
e107::getRender()->eSetStyle = $parm;
|
||||
}
|
||||
|
||||
?>
|
23
e107_core/shortcodes/single/sitelinks.sc
Normal file
23
e107_core/shortcodes/single/sitelinks.sc
Normal file
@@ -0,0 +1,23 @@
|
||||
global $eMenuActive,$linkstyle;
|
||||
// PHP warnings FIX - Deprecated menus, $eMenuActive not set
|
||||
//if(!in_array('edynamic_menu',$eMenuActive) && !in_array('tree_menu',$eMenuActive) && !in_array('q_tree_menu',$eMenuActive))
|
||||
{
|
||||
$tmp = explode(":",$parm);
|
||||
$linktype = $tmp[0];
|
||||
$cat = (isset($tmp[1])) ? $tmp[1] : 1;
|
||||
$css_class = (isset($tmp[2])) ? $tmp[2] : false;
|
||||
if(!defined('LINKDISPLAY')) {
|
||||
define("LINKDISPLAY", ($linktype == "menu" ? 2 : 1));
|
||||
}
|
||||
|
||||
$sitelinks = e107::getSitelinks();
|
||||
|
||||
if(function_exists("linkstyle")){
|
||||
$style = linkstyle($linkstyle);
|
||||
}else{
|
||||
$style="";
|
||||
}
|
||||
return $sitelinks->get($cat, $style, $css_class);
|
||||
}
|
||||
|
||||
|
223
e107_core/shortcodes/single/sitelinks_alt.php
Normal file
223
e107_core/shortcodes/single/sitelinks_alt.php
Normal file
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_files/shortcode/sitelinks_alt.php,v $
|
||||
| $Revision$
|
||||
| $Date$
|
||||
| $Author$
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
class sitelinks_alt
|
||||
{
|
||||
function sitelinks_alt_shortcode($parm)
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
|
||||
global $pref;
|
||||
|
||||
$params = explode('+', $parm);
|
||||
|
||||
if (isset($params[0]) && $params[0] && $params[0] != 'no_icons' && $params[0] != 'default')
|
||||
{
|
||||
$icon = $params[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$icon = e_IMAGE."generic/arrow.png";
|
||||
}
|
||||
|
||||
$js_file = ($params[1] == 'noclick') ? 'nav_menu_alt.js' : 'nav_menu.js';
|
||||
|
||||
if (file_exists(THEME.$js_file))
|
||||
{
|
||||
$text = "<script type='text/javascript' src='".THEME_ABS.$js_file."'></script>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = "<script type='text/javascript' src='".e_FILE_ABS.$js_file."'></script>";
|
||||
}
|
||||
$text .= "<div class='menuBar' style='width:100%; white-space: nowrap'>";
|
||||
|
||||
// Setup Parent/Child Arrays ---->
|
||||
|
||||
$lnk = e107::getSitelinks();
|
||||
$lnk->getlinks(1);
|
||||
$linklist = $lnk->getLinkArray();
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
|
||||
// Loops thru parents.
|
||||
|
||||
|
||||
|
||||
foreach ($linklist['head_menu'] as $lk)
|
||||
{
|
||||
$lk['link_url'] = $tp->replaceConstants($lk['link_url'], TRUE, TRUE);
|
||||
if ($params[0] == 'no_icons')
|
||||
{
|
||||
$link_icon = 'no_icons';
|
||||
}
|
||||
else
|
||||
{
|
||||
$link_icon = $lk['link_button'] ? e_IMAGE.'icons/'.$lk['link_button'] : $icon;
|
||||
}
|
||||
|
||||
$main_linkid = $lk['link_id'];
|
||||
if (isset($linklist['sub_'.$main_linkid])) // Has Children.
|
||||
{
|
||||
|
||||
$text .= self::adnav_cat($lk['link_name'], '', $link_icon, 'l_'.$main_linkid);
|
||||
$text .= self::render_sub($linklist, $main_linkid, $params, $icon);
|
||||
}
|
||||
else // Display Parent only.
|
||||
{
|
||||
$text .= self::adnav_cat($lk['link_name'], $lk['link_url'], $link_icon, FALSE, $lk['link_open']);
|
||||
}
|
||||
}
|
||||
|
||||
$text .= "</div>";
|
||||
|
||||
return $text;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function adnav_cat($cat_title, $cat_link, $cat_img, $cat_id = FALSE, $cat_open = FALSE)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
$cat_link = (strpos($cat_link, '://') === FALSE && strpos($cat_link, 'mailto:') !== 0 ? e_HTTP.$cat_link : $cat_link);
|
||||
|
||||
if ($cat_open == 4 || $cat_open == 5)
|
||||
{
|
||||
$dimen = ($cat_open == 4) ? "600,400" : "800,600";
|
||||
$href = " href=\"javascript:open_window('".$cat_link."',".$dimen.")\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
$href = "href='".$cat_link."'";
|
||||
}
|
||||
|
||||
$text = "<a class='menuButton' ".$href." ";
|
||||
if ($cat_img != 'no_icons')
|
||||
{
|
||||
$text .= "style='background-image: url(".$cat_img."); background-repeat: no-repeat; background-position: 3px 1px; white-space: nowrap' ";
|
||||
}
|
||||
if ($cat_id)
|
||||
{
|
||||
$text .= "onclick=\"return buttonClick(event, '".$cat_id."');\" onmouseover=\"buttonMouseover(event, '".$cat_id."');\"";
|
||||
}
|
||||
if ($cat_open == 1)
|
||||
{
|
||||
$text .= " rel='external' ";
|
||||
}
|
||||
$text .= ">".$tp->toHTML($cat_title, "", "defs, no_hook")."</a>";
|
||||
return $text;
|
||||
}
|
||||
|
||||
function adnav_main($cat_title, $cat_link, $cat_img, $cat_id = FALSE, $params, $cat_open = FALSE)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
|
||||
$cat_link = (strpos($cat_link, '://') === FALSE) ? e_HTTP.$cat_link : $cat_link;
|
||||
$cat_link = $tp->replaceConstants($cat_link, TRUE, TRUE);
|
||||
|
||||
if ($cat_open == 4 || $cat_open == 5)
|
||||
{
|
||||
$dimen = ($cat_open == 4) ? "600,400" : "800,600";
|
||||
$href = " href=\"javascript:open_window('".$cat_link."',".$dimen.")\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
$href = "href='".$cat_link."'";
|
||||
}
|
||||
|
||||
$text = "<a class='menuItem' ".$href." ";
|
||||
if ($cat_id)
|
||||
{
|
||||
if (isset($params[2]) && $params[2] == 'link')
|
||||
{
|
||||
$text .= "onmouseover=\"menuItemMouseover(event, '".$cat_id."');\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= "onclick=\"return false;\" onmouseover=\"menuItemMouseover(event, '".$cat_id."');\"";
|
||||
}
|
||||
}
|
||||
if ($cat_open == 1)
|
||||
{
|
||||
$text .= " rel='external' ";
|
||||
}
|
||||
$text .= ">";
|
||||
if ($cat_img != 'no_icons')
|
||||
{
|
||||
$text .= "<span class='menuItemBuffer'>".$cat_img."</span>";
|
||||
}
|
||||
$text .= "<span class='menuItemText'>".$tp->toHTML($cat_title, "", "defs, no_hook")."</span>";
|
||||
if ($cat_id)
|
||||
{
|
||||
$text .= "<span class=\"menuItemArrow\">▶</span>";
|
||||
}
|
||||
$text .= "</a>";
|
||||
return $text;
|
||||
}
|
||||
|
||||
function render_sub($linklist, $id, $params, $icon)
|
||||
{
|
||||
$text = "<div id='l_".$id."' class='menu' onmouseover=\"menuMouseover(event)\">";
|
||||
foreach ($linklist['sub_'.$id] as $sub)
|
||||
{
|
||||
// Filter title for backwards compatibility ---->
|
||||
|
||||
if (substr($sub['link_name'], 0, 8) == "submenu.")
|
||||
{
|
||||
$tmp = explode(".", $sub['link_name']);
|
||||
$subname = $tmp[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$subname = $sub['link_name'];
|
||||
}
|
||||
|
||||
// Setup Child Icon --------->
|
||||
|
||||
if (!$sub['link_button'] && $params[0] == 'no_icons')
|
||||
{
|
||||
$sub_icon = 'no_icons';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sub_icon = "<img src='";
|
||||
$sub_icon .= ($sub['link_button']) ? e_IMAGE.'icons/'.$sub['link_button'] : $icon;
|
||||
$sub_icon .= "' alt='' style='border:0px; vertical-align:bottom; width: 16px; height: 16px' />";
|
||||
}
|
||||
if (isset($linklist['sub_'.$sub['link_id']]))
|
||||
{ // Has Children.
|
||||
$sub_ids[] = $sub['link_id'];
|
||||
$text .= self::adnav_main($subname, $sub['link_url'], $sub_icon, 'l_'.$sub['link_id'], $params, $sub['link_open']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= self::adnav_main($subname, $sub['link_url'], $sub_icon, null, $params, $sub['link_open']);
|
||||
}
|
||||
|
||||
}
|
||||
$text .= "</div>";
|
||||
|
||||
if (isset($sub_ids) && is_array($sub_ids))
|
||||
{
|
||||
foreach ($sub_ids as $sub_id)
|
||||
{
|
||||
$text .= self::render_sub($linklist, $sub_id, $params, $icon);
|
||||
}
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
11
e107_core/shortcodes/single/stylesheet.sc
Normal file
11
e107_core/shortcodes/single/stylesheet.sc
Normal file
@@ -0,0 +1,11 @@
|
||||
// $Id$
|
||||
|
||||
$css = file_get_contents(THEME."style.css");
|
||||
$search = array("url(images","url('images");
|
||||
$replace[0] = "url(".SITEURL.$THEMES_DIRECTORY.$pref['sitetheme']."/images";
|
||||
$replace[1] = "url('".SITEURL.$THEMES_DIRECTORY.$pref['sitetheme']."/images";
|
||||
$CSS = str_replace($search,$replace,$css);
|
||||
|
||||
return "\n<style>\n".$CSS."\n</style>\n";
|
||||
|
||||
?>
|
43
e107_core/shortcodes/single/sublinks.php
Normal file
43
e107_core/shortcodes/single/sublinks.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
// $Id$
|
||||
|
||||
function sublinks_shortcode($parm)
|
||||
{
|
||||
global $sql,$linkstyle;;
|
||||
|
||||
if($parm){
|
||||
list($page,$cat) = explode(":",$parm);
|
||||
}
|
||||
|
||||
$page = ($page) ? $page : e_PAGE;
|
||||
$cat = ($cat) ? $cat : 1;
|
||||
|
||||
require_once(e_HANDLER."sitelinks_class.php");
|
||||
$sublinks = new sitelinks;
|
||||
|
||||
if(function_exists("linkstyle")){
|
||||
$style = linkstyle($linkstyle);
|
||||
}else{
|
||||
$style="";
|
||||
}
|
||||
|
||||
$text = "\n\n<!-- Sublinks Start -->\n\n";
|
||||
$text .= $style['prelink'];
|
||||
$sql->db_Select("links", "link_id","link_url= '{$page}' AND link_category = {$cat} LIMIT 1");
|
||||
$row = $sql->db_Fetch();
|
||||
$parent = $row['link_id'];
|
||||
|
||||
$link_total = $sql->db_Select("links", "*", "link_class IN (".USERCLASS_LIST.") AND link_parent={$parent} ORDER BY link_order ASC");
|
||||
while($linkInfo = $sql->db_Fetch())
|
||||
{
|
||||
$text .= $sublinks->makeLink($linkInfo,TRUE, $style, false);
|
||||
}
|
||||
|
||||
$text .= $style['postlink'];
|
||||
$text .= "\n\n<!-- Sublinks End -->\n\n";
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
?>
|
160
e107_core/shortcodes/single/uploadfile.php
Normal file
160
e107_core/shortcodes/single/uploadfile.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id$
|
||||
*
|
||||
* Upload file shortcode
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package e107
|
||||
* @subpackage shortcodes
|
||||
* @version $Revision$
|
||||
* @todo uploadfile shortcode - JS/Flash upload, optional allow image resize (see news administration), optional move by filetype (processing) - similar to Media Manager
|
||||
*
|
||||
* Print out upload form elements and/or process submitted uploads.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Print out upload form elements and/or process submitted uploads.
|
||||
* Your <form> tag must include: enctype='multipart/form-data' - in order to work.
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* // Process uploaded file (sent by the form below), it'll print out message (if any)
|
||||
* if(isset($_POST['etrigger_uploadfiles']))
|
||||
* {
|
||||
* // NOTE: chmod permissions after upload are set to 0755
|
||||
* echo e107::getParser()->parseTemplate('{UPLOADFILE='.e_MEDIA.'public|process=1&upload_file_mask=jpg,jpeg,png,gif&upload_final_chmod=493}');
|
||||
* }
|
||||
*
|
||||
* // Render upload form
|
||||
* echo '<form action="'.e_SELF.'" enctype="multipart/form-data" method="post">';
|
||||
* echo e107::getParser()->parseTemplate('{UPLOADFILE='.e_MEDIA.'public|nowarn&trigger=etrigger_uploadfiles}');
|
||||
* echo '</form>';
|
||||
* </code>
|
||||
*
|
||||
* @todo Human readable *nix like permissions option (upload_final_chmod) e.g. 'rw-rw-r--' --> 0664, 'rwxrwxrwx' --> 0777
|
||||
*
|
||||
* @param string $parm upload_path|parameters (GET query format)
|
||||
* Available parameters:
|
||||
* - trigger [render] (string): name attribute of upload trigger button, default 'uploadfiles'
|
||||
* - name [render|processing] (string): name of upload (file) field, without array brackets ([]), default 'file_userfile'
|
||||
* - up_container [render] (string): the id attribute of upload container (containing upload field(s)), default 'up_container'
|
||||
* - up_row [render] (string): the id attribute of upload added fields (diuplicates), default 'upline'
|
||||
* - process [render|processing] ('0'|'1' boolean): main shortcode action, 0 - render markup, 1 - process uploaded files, default '0'
|
||||
* - upload_file_mask [processing] (string): 'file_mask' parameter of process_uploaded_files() - comma-separated list of file types which if defined limits the allowed file types to those which are
|
||||
* in both this list and the file specified by the 'filetypes' option. Enables restriction to, for example, image files. {@link process_uploaded_files()),
|
||||
* default is empty string
|
||||
* - upload_filetypes [processing] (string): 'filetypes' parameter of process_uploaded_files() - name of file containing list of valid file types, default is empty string
|
||||
* - upload_extra_file_types [processing] (string): 'extra_file_types' parameter of process_uploaded_files() - '0' (default) rejects totally unknown file extensions;
|
||||
* '1' accepts totally unknown file extensions which are in $options['filetypes'] file; comma-separated list of additional permitted file extensions
|
||||
* - upload_final_chmod [processing] (string): 'final_chmod' parameter of process_uploaded_files() - chmod() to be applied to uploaded files (0644 default).
|
||||
* NOTE: you need to provide number with numerci base of decimal (as a string) which will be auto-converted to octal number
|
||||
* Example: '493' --> 0755; '511' --> 0777
|
||||
* - upload_max_upload_size [processing] (string): 'max_upload_size' parameter of process_uploaded_files() - maximum size of uploaded files in bytes,
|
||||
* or as a string with a 'multiplier' letter (e.g. 16M) at the end, default is empty string
|
||||
* - upload_overwrite [processing] ('0'|'1' boolean): 'overwrite' parameter of process_uploaded_files() - maximum number of files which can be uploaded - default is '0' (unlimited)
|
||||
* - return_type [processing] ('0'|'message'|'result'): 'message' (default) - return messages (eMessage::render() method);
|
||||
* 'result' - return array generated by process_uploaded_files();
|
||||
* '0' - return empty string;
|
||||
* NOTE: upload messages are added to 'upload_shortcode' message namespace
|
||||
* <code>
|
||||
* // render messages manually (return_type=0)
|
||||
* echo e107::getMessage()->render('upload_shortcode');
|
||||
* // OR copy them to the default message namespace
|
||||
* e107::getMessage()->moveStack('upload_shortcode', 'default');
|
||||
* // Do something... and render all messages
|
||||
* echo e107::getMessage()->render();
|
||||
* <code>
|
||||
* @return mixed Based on 'return_type' parameter - string or uploaded array result
|
||||
*/
|
||||
function uploadfile_shortcode($parm)
|
||||
{
|
||||
if(!FILE_UPLOADS)
|
||||
{
|
||||
return LAN_UPLOAD_SERVEROFF;
|
||||
}
|
||||
if(USER_AREA === TRUE && !check_class(e107::getPref('upload_class')))
|
||||
{
|
||||
return LAN_DISABLED;
|
||||
}
|
||||
|
||||
$parm = explode('|', $parm, 2);
|
||||
|
||||
$path = $parm[0];
|
||||
if($path && !is_writable($path))
|
||||
{
|
||||
return LAN_UPLOAD_777." <b>".str_replace("../","",$path)."</b>";
|
||||
}
|
||||
|
||||
$parms = array();
|
||||
parse_str(varset($parm[1], ''), $parms);
|
||||
|
||||
$parms = array_merge(array(
|
||||
'trigger' => 'uploadfiles',
|
||||
'name' => 'file_userfile',
|
||||
'up_container' => 'up_container',
|
||||
'up_row' => 'upline',
|
||||
'process' => '0',
|
||||
'upload_file_mask' => '',
|
||||
'upload_filetypes' => '',
|
||||
'upload_extra_file_types' => '0',
|
||||
'upload_final_chmod' => '',
|
||||
'upload_max_upload_size' => '0',
|
||||
'upload_max_file_count' => '0',
|
||||
'upload_overwrite' => '0',
|
||||
'return_type' => 'message',
|
||||
), $parms);
|
||||
|
||||
// PROCESS UPLOADED FILES
|
||||
if($parms['process'])
|
||||
{
|
||||
e107_require_once(e_HANDLER.'upload_handler.php');
|
||||
$options = array(
|
||||
'file_mask' => $parms['upload_file_mask'],
|
||||
'filetypes' => $parms['upload_filetypes'],
|
||||
'extra_file_types' => $parms['upload_extra_file_types'] ? true : false,
|
||||
'final_chmod' => $parms['upload_final_chmod'] ? intval(intval($parms['upload_final_chmod']), 8) : 0644,
|
||||
'max_upload_size' => $parms['upload_max_upload_size'],
|
||||
'file_array_name' => $parms['name'],
|
||||
'max_file_count' => $parms['upload_max_file_count'],
|
||||
'overwrite' => $parms['upload_overwrite'] ? true : false,
|
||||
);
|
||||
|
||||
$uploaded = process_uploaded_files($path, false, $options);
|
||||
if($uploaded)
|
||||
{
|
||||
$emessage = e107::getMessage();
|
||||
foreach ($uploaded as $finfo)
|
||||
{
|
||||
$emessage->addStack($finfo['message'], 'upload_shortcode', $finfo['error'] ? E_MESSAGE_ERROR : E_MESSAGE_SUCCESS);
|
||||
}
|
||||
return($parms['return_type'] == 'message' ? $emessage->render('upload_shortcode') : '');
|
||||
}
|
||||
return($parms['return_type'] == 'result' ? $uploaded : '');
|
||||
}
|
||||
|
||||
// RENDER FORM
|
||||
$onclickt = !isset($parms['nowarn']) ? " onclick=\"return jsconfirm('".LAN_UPLOAD_CONFIRM."')\"" : '';
|
||||
$onclickd = " onclick=\"duplicateHTML('{$parms['up_row']}','{$parms['up_container']}');\"";
|
||||
$name = $parms['name'].'[]';
|
||||
|
||||
$text .="
|
||||
<!-- Upload Shortcode -->
|
||||
<div>
|
||||
<div class='field-spacer'>
|
||||
<button class='action duplicate' type='button' value='no-value'{$onclickd}><span>".LAN_UPLOAD_ADDFILE."</span></button>
|
||||
<button class='upload' type='submit' name='{$parms['trigger']}' value='no-value'{$onclickt}><span>".LAN_UPLOAD_FILES."</span></button>
|
||||
</div>
|
||||
<div id='{$parms['up_container']}'>
|
||||
<div id='{$parms['up_row']}' class='nowrap'>
|
||||
<input class='tbox file' type='file' name='{$name}' />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Upload Shortcode -->
|
||||
";
|
||||
|
||||
return $text;
|
||||
}
|
12
e107_core/shortcodes/single/url.sc
Executable file
12
e107_core/shortcodes/single/url.sc
Executable file
@@ -0,0 +1,12 @@
|
||||
// $Id$
|
||||
$e107 = e107::getInstance();
|
||||
list($section, $type, $parms) = explode('|', $parm, 3);
|
||||
if(strpos($parms, '=') !== false)
|
||||
{
|
||||
parse_str($parms, $p);
|
||||
}
|
||||
else
|
||||
{
|
||||
$p[$parms] = 1;
|
||||
}
|
||||
return $e107->url->getURL($section, $type, $p);
|
33
e107_core/shortcodes/single/user_avatar.sc
Normal file
33
e107_core/shortcodes/single/user_avatar.sc
Normal file
@@ -0,0 +1,33 @@
|
||||
global $loop_uid;
|
||||
if(intval($loop_uid) > 0 && trim($parm) == "")
|
||||
{
|
||||
$parm = $loop_uid;
|
||||
}
|
||||
|
||||
if(is_numeric($parm))
|
||||
{
|
||||
if($parm == USERID)
|
||||
{
|
||||
$image = USERIMAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$row = get_user_data(intval($parm));
|
||||
$image=$row['user_image'];
|
||||
}
|
||||
}
|
||||
elseif($parm)
|
||||
{
|
||||
$image=$parm;
|
||||
}
|
||||
else
|
||||
{
|
||||
$image = USERIMAGE;
|
||||
}
|
||||
if(!$image) { return; }
|
||||
require_once(e_HANDLER.'avatar_handler.php');
|
||||
$avatar = avatar($image);
|
||||
if($avatar)
|
||||
{
|
||||
return "<div class='spacer'><img src='".avatar($image)."' alt='' /></div><br />";
|
||||
}
|
145
e107_core/shortcodes/single/user_extended.sc
Normal file
145
e107_core/shortcodes/single/user_extended.sc
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id$
|
||||
*
|
||||
* Extended user field shortcode
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* USAGE: {USER_EXTENDED=<field_name>.[text|value|icon|text_value].<user_id>}
|
||||
* EXAMPLE: {USER_EXTENDED=user_gender.value.5} will show the value of the extended field user_gender for user #5
|
||||
*/
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_user_extended.php');
|
||||
$parms = explode('.', $parm);
|
||||
global $currentUser, $tp, $loop_uid, $e107, $sc_style;
|
||||
if(isset($loop_uid) && intval($loop_uid) == 0) { return ''; }
|
||||
$key = $parms[0].".".$parms[1];
|
||||
$sc_style['USER_EXTENDED']['pre'] = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : '');
|
||||
$sc_style['USER_EXTENDED']['post'] = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : '');
|
||||
include_once(e_HANDLER.'user_extended_class.php');
|
||||
$ueStruct = e107_user_extended::user_extended_getStruct();
|
||||
|
||||
$uid = intval(varset($parms[2],0));
|
||||
if($uid == 0)
|
||||
{
|
||||
if(isset($loop_uid) && intval($loop_uid) > 0)
|
||||
{
|
||||
$uid = $loop_uid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$uid = USERID;
|
||||
}
|
||||
}
|
||||
|
||||
$udata = get_user_data($uid);
|
||||
|
||||
$udata['user_class'] .= ($udata['user_class'] == '' ? '' : ',');
|
||||
$udata['user_class'] .= e_UC_PUBLIC.",".e_UC_MEMBER;
|
||||
if($udata['user_admin'] == 1)
|
||||
{
|
||||
$udata['user_class'].= ','.e_UC_ADMIN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Need to pick up the 'miscellaneous' category - anything which isn't in a named category. Have to control visibility on a field by field basis
|
||||
// And I don't think this should apply to icons
|
||||
/**
|
||||
* @todo - must be a better way of picking up the 'Miscellaneous' category
|
||||
*/
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_user.php');
|
||||
if (($parms[1] != 'icon') && ($parms[0] != LAN_USER_44))
|
||||
{
|
||||
$ret_cause = 0;
|
||||
if (!check_class($ueStruct["user_".$parms[0]]['user_extended_struct_applicable'], $udata['user_class'])) $ret_cause = 1;
|
||||
if (!check_class($ueStruct["user_".$parms[0]]['user_extended_struct_read'], $udata['user_class'])) $ret_cause = 2;
|
||||
if (($ueStruct["user_".$parms[0]]['user_extended_struct_read'] == e_UC_READONLY && (!ADMIN && $udata['user_id'] != USERID))) $ret_cause = 3;
|
||||
if ((!ADMIN && substr($ueStruct["user_".$parms[0]]['user_extended_struct_parms'], -1) == 1
|
||||
&& strpos($udata['user_hidden_fields'], "^user_".$parms[0]."^") !== FALSE && $uid != USERID)) $ret_cause = 4;
|
||||
if ($ret_cause != 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if($parms[1] == 'text_value')
|
||||
{
|
||||
$_value = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.value}");
|
||||
if($_value)
|
||||
{
|
||||
$__pre = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : '');
|
||||
$__post = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : '');
|
||||
$_text = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.text}");
|
||||
$_mid = (isset($sc_style['USER_EXTENDED'][$key]['mid']) ? $sc_style['USER_EXTENDED'][$key]['mid'] : '');
|
||||
return $__pre.$_text.$_mid.$_value.$__post;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($parms[1] == 'text')
|
||||
{
|
||||
$text_val = $ueStruct['user_'.$parms[0]]['user_extended_struct_text'];
|
||||
if($text_val)
|
||||
{
|
||||
return (defined($text_val) ? constant($text_val) : $text_val);
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ($parms[1] == 'icon')
|
||||
{
|
||||
if(defined(strtoupper($parms[0]).'_ICON'))
|
||||
{
|
||||
return constant(strtoupper($parms[0]).'_ICON');
|
||||
}
|
||||
elseif(is_readable(e_IMAGE."user_icons/user_{$parms[0]}.png"))
|
||||
{
|
||||
return "<img src='".e_IMAGE_ABS."user_icons/user_{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
|
||||
}
|
||||
elseif(is_readable(e_IMAGE."user_icons/{$parms[0]}.png"))
|
||||
{
|
||||
return "<img src='".e_IMAGE_ABS."user_icons/{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($parms[1] == 'value')
|
||||
{
|
||||
$uVal = str_replace(chr(1), '', $udata['user_'.$parms[0]]);
|
||||
switch ($ueStruct["user_".$parms[0]]['user_extended_struct_type'])
|
||||
{
|
||||
case EUF_DB_FIELD : // check for db_lookup type
|
||||
$tmp = explode(',',$ueStruct['user_'.$parms[0]]['user_extended_struct_values']);
|
||||
$sql_ue = new db; // Use our own DB object to avoid conflicts
|
||||
if($sql_ue->db_Select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'"))
|
||||
{
|
||||
$row = $sql_ue->db_Fetch();
|
||||
$ret_data = $row[$tmp[2]];
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret_data = FALSE;
|
||||
}
|
||||
break;
|
||||
case EUF_DATE : //check for 0000-00-00 in date field
|
||||
if($uVal == '0000-00-00') { $uVal = ''; }
|
||||
$ret_data = $uVal;
|
||||
break;
|
||||
case EUF_PREDEFINED : // Predefined field - have to look up display string in relevant file
|
||||
$ret_data = e107_user_extended::user_extended_display_text($ueStruct['user_'.$parms[0]]['user_extended_struct_values'],$uVal);
|
||||
break;
|
||||
default :
|
||||
$ret_data = $uVal;
|
||||
}
|
||||
if($ret_data != '')
|
||||
{
|
||||
return $tp->toHTML($ret_data, TRUE, 'no_make_clickable', "class:{$udata['user_class']}");
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
47
e107_core/shortcodes/single/usersearch.php
Normal file
47
e107_core/shortcodes/single/usersearch.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
// $Id$
|
||||
|
||||
function usersearch_shortcode($parm)
|
||||
{
|
||||
// FIXME - permissions, sql query
|
||||
if(!ADMIN || !e_AJAX_REQUEST)
|
||||
{
|
||||
return '<ul></ul>';
|
||||
}
|
||||
parse_str(str_replace('--', '&', $parm), $parm);
|
||||
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
$search_field = 'user_'.vartrue($parm['searchfld'], 'name');
|
||||
$info_field = $search_field == 'user_name' ? 'user_loginname' : 'user_name';
|
||||
$posted = $_POST[vartrue($parm['srcfld'], 'user_name')];
|
||||
|
||||
if(!$posted)
|
||||
{
|
||||
return '<ul></ul>';
|
||||
}
|
||||
|
||||
$allowed = array('user_id', 'user_name', 'user_loginname', 'user_customtitle', 'user_email');
|
||||
if(!in_array($search_field, $allowed))
|
||||
{
|
||||
$search_field = 'user_name';
|
||||
}
|
||||
|
||||
$ret = "<ul>";
|
||||
$qry = "
|
||||
SELECT u.user_id, u.user_name, u.user_loginname, u.user_customtitle, u.user_email FROM #user AS u
|
||||
WHERE {$search_field} LIKE '".$tp->toDb($posted)."%'
|
||||
";
|
||||
|
||||
if($sql->db_Select_gen($qry))
|
||||
{
|
||||
while($row = $sql->db_Fetch())
|
||||
{
|
||||
$ret .= "<li id='{$row['user_id']}'>{$row[$search_field]}<span class='informal'> [{$row['user_id']}] ".$row[$info_field]." </span></li>";
|
||||
}
|
||||
}
|
||||
$ret .= "</ul>";
|
||||
return $ret;
|
||||
}
|
||||
?>
|
87
e107_core/shortcodes/single/wmessage.php
Normal file
87
e107_core/shortcodes/single/wmessage.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
// $Id$
|
||||
|
||||
function wmessage_shortcode($parm)
|
||||
{
|
||||
|
||||
global $e107, $e107cache, $pref;
|
||||
$prefwmsc = varset($pref['wmessage_sc'], FALSE);
|
||||
if (($prefwmsc && $parm == 'header') || (!$prefwmsc && ($parm !='header')) )
|
||||
{ // Two places it might be invoked - allow one or the other
|
||||
return;
|
||||
}
|
||||
|
||||
if ($parm != 'force')
|
||||
{
|
||||
$full_url = 'news.php'; // Set a default in case
|
||||
$front_qry = '';
|
||||
$uc_array = explode(',', USERCLASS_LIST);
|
||||
if(varset($pref['frontpage']))
|
||||
{
|
||||
foreach ($pref['frontpage'] as $fk => $fp)
|
||||
{
|
||||
if (in_array($fk,$uc_array))
|
||||
{
|
||||
$full_url = $fp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
list($front_url, $front_qry) = explode('?', $full_url.'?'); // extra '?' ensure the array is filled
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($front_url, 'http') === FALSE) $front_url = SITEURL.$front_url;
|
||||
|
||||
|
||||
if (($parm == 'force') || ((e_SELF == $front_url) && (($parm == 'ignore_query') || (e_QUERY == $front_qry))))
|
||||
{
|
||||
// Actually want to display a welcome message here
|
||||
global $ns;
|
||||
|
||||
if($cacheData = $e107cache->retrieve('wmessage'))
|
||||
{
|
||||
echo $cacheData;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!defined('WMFLAG'))
|
||||
{
|
||||
|
||||
$qry = "
|
||||
SELECT * FROM #generic
|
||||
WHERE gen_type ='wmessage' AND gen_intdata IN (".USERCLASS_LIST.')';
|
||||
$wmessage = array();
|
||||
$wmcaption = '';
|
||||
if($e107->sql->db_Select_gen($qry))
|
||||
{
|
||||
while ($row = $e107->sql->db_Fetch())
|
||||
{
|
||||
$wmessage[] = $e107->tp->toHTML($row['gen_chardata'], TRUE, 'BODY, defs', 'admin');
|
||||
if(!$wmcaption)
|
||||
{
|
||||
$wmcaption = $e107->tp->toHTML($row['gen_ip'], TRUE, 'TITLE');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($wmessage) && $wmessage)
|
||||
{
|
||||
ob_start();
|
||||
if ($pref['wm_enclose'])
|
||||
{
|
||||
$ns->tablerender($wmcaption, implode("<br />",$wmessage), 'wm');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo ($wmcaption) ? $wmcaption.'<br />' : '';
|
||||
echo implode('<br />',$wmessage);
|
||||
}
|
||||
|
||||
$cache_data = ob_get_flush();
|
||||
$e107cache->set('wmessage', $cache_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user