mirror of
https://github.com/e107inc/e107.git
synced 2025-08-08 07:36:32 +02:00
Updated {IMAGESELECTOR} to use ajax and replaceSC function. sitebutton shortcode added to work with it.
This commit is contained in:
@@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/prefs.php,v $
|
||||
| $Revision: 1.10 $
|
||||
| $Date: 2008-01-13 10:51:34 $
|
||||
| $Author: e107steved $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2008-01-16 10:52:30 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
require_once("../class2.php");
|
||||
@@ -85,12 +85,14 @@ if (isset($_POST['updateprefs']))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$e107cache->clear();
|
||||
save_prefs();
|
||||
$e107cache->clear('',TRUE);
|
||||
$saved = save_prefs();
|
||||
$sql -> db_Select_gen("TRUNCATE ".MPREFIX."online");
|
||||
if($saved)
|
||||
{
|
||||
header("location:".e_ADMIN."prefs.php?u");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if($sql->db_Select("plugin", "plugin_path", "plugin_installflag='1' AND plugin_path = 'alt_auth'"))
|
||||
@@ -192,8 +194,18 @@ $text = "<script type=\"text/javascript\">
|
||||
<td class='forumheader3'>".PRFLAN_4."</td>
|
||||
<td style='text-align:right' class='forumheader3'>";
|
||||
|
||||
$param = "sitebutton,".e_IMAGE.",".SITEBUTTON.",81px,30px,";
|
||||
$text .= $tp->parseTemplate("{IMAGESELECTOR={$param}}");
|
||||
$parms = "name=sitebutton";
|
||||
$parms .= "&path=".e_THEME.$pref['sitetheme']."/images/|".e_IMAGE;
|
||||
$parms .= "&filter=0";
|
||||
$parms .= "&fullpath=1";
|
||||
$parms .= "&default=".urlencode($pref['sitebutton']);
|
||||
$parms .= "&width=81px";
|
||||
$parms .= "&height=30px";
|
||||
$parms .= "&multiple=FALSE";
|
||||
$parms .= "&label=-- No Image --";
|
||||
$parms .= "&subdirs=1";
|
||||
|
||||
$text .= $tp->parseTemplate("{IMAGESELECTOR={$parms}}");
|
||||
|
||||
$text .= "
|
||||
</td>
|
||||
|
@@ -1,17 +1,19 @@
|
||||
// $Id: imageselector.sc,v 1.3 2008-01-16 00:39:03 e107coders Exp $
|
||||
// $Id: imageselector.sc,v 1.4 2008-01-16 10:52:33 e107coders Exp $
|
||||
|
||||
global $sql,$parm;
|
||||
global $sql,$parm,$tp;
|
||||
|
||||
if(strstr($parm,"=")){ // query style parms.
|
||||
parse_str($parm, $tmp);
|
||||
extract($tmp);
|
||||
}else{ // comma separated parms.
|
||||
list($name,$path,$default,$width,$height,$multiple,$label,$subdirs,$filter) = explode(",",$parm);
|
||||
}
|
||||
|
||||
else
|
||||
{ // comma separated parms.
|
||||
list($name,$path,$default,$width,$height,$multiple,$label,$subdirs,$filter,$fullpath) = explode(",",$parm);
|
||||
}
|
||||
|
||||
require_once(e_HANDLER."file_class.php");
|
||||
$fl = new e_file;
|
||||
|
||||
$paths = explode("|",$path);
|
||||
$recurse = ($subdirs) ? $subdirs : 0;
|
||||
$imagelist = array();
|
||||
@@ -25,26 +27,38 @@ global $sql,$parm;
|
||||
{
|
||||
sort($imagelist);
|
||||
}
|
||||
|
||||
if(!$fullpath && (count($paths) > 1))
|
||||
{
|
||||
$fullpath = TRUE;
|
||||
}
|
||||
|
||||
$multi = ($multiple == "TRUE" || $multiple == "1") ? "multiple='multiple' style='height:{$height}'" : "style='float:left'";
|
||||
$width = ($width) ? $width : "*";
|
||||
$height = ($height) ? $height : "*";
|
||||
$label = ($label) ? $label : " -- -- ";
|
||||
|
||||
$text .= "<select {$multi} class='tbox' name='$name' id='$name' onchange=\"preview_image('$name','$path','".e_IMAGE_ABS."generic/blank.gif');\">
|
||||
$text .= "<select {$multi} class='tbox' name='$name' id='$name' onchange=\"replaceSC('$name',this.form,'{$name}_prev');\">
|
||||
<option value=''>".$label."</option>\n";
|
||||
foreach($imagelist as $icon)
|
||||
{
|
||||
$dir = str_replace($paths,"",$icon['path']);
|
||||
$selected = ($default == $dir.$icon['fname']) ? " selected='selected'" : "";
|
||||
|
||||
if(!$filter || ($filter && ereg($filter,$dir.$icon['fname'])))
|
||||
{
|
||||
$text .= "<option value='".$dir.$icon['fname']."'".$selected.">".$dir.$icon['fname']."</option>\n";
|
||||
$pth = ($fullpath) ? $tp->createConstants($icon['path'],1) : $dir;
|
||||
$selected = ($default == $pth.$icon['fname']) ? " selected='selected'" : "";
|
||||
$text .= "<option value='".$pth.$icon['fname']."'".$selected.">".$dir.$icon['fname']."</option>\n";
|
||||
}
|
||||
}
|
||||
$text .= "</select>";
|
||||
|
||||
$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
|
||||
$text .= " <img id='{$name}_prev' src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' />\n";
|
||||
if($default[0]=="{")
|
||||
{
|
||||
$pvw_default = $tp->replaceConstants($default);
|
||||
}
|
||||
$text .= " <span id='{$name}_prev'><img src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' /></span>\n";
|
||||
|
||||
|
||||
return "\n\n<!-- Start Image Selector -->\n\n".$text."\n\n<!-- End Image Selector -->\n\n";
|
3
e107_files/shortcode/sitebutton.sc
Normal file
3
e107_files/shortcode/sitebutton.sc
Normal file
@@ -0,0 +1,3 @@
|
||||
global $tp;
|
||||
$path = ($_POST['sitebutton'] && $_POST['ajax_used']) ? $tp->replaceConstants($_POST['sitebutton']) : (strstr(SITEBUTTON, "http:") ? SITEBUTTON : e_IMAGE.SITEBUTTON);
|
||||
return "<a href='".SITEURL."'><img src='".$path."' alt=\"".SITENAME."\" style='border: 0px; width: 88px; height: 31px' /></a>";
|
Reference in New Issue
Block a user