mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 22:27:34 +02:00
Merge branch 'master' of https://github.com/e107inc/e107
This commit is contained in:
@@ -16,7 +16,7 @@ e107 is a free (open-source) content management system which allows you to easil
|
||||
### Reporting Bugs
|
||||
|
||||
Be sure you are using the most recent version prior to reporting an issue.
|
||||
Your may report any bugs or feature requests on Github (https://github.com/e107inc/e107/issues)
|
||||
You may report any bugs or feature requests on GitHub (https://github.com/e107inc/e107/issues)
|
||||
|
||||
### Pull-Requests
|
||||
|
||||
|
@@ -56,6 +56,11 @@ if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
|
||||
// e107::js('core', 'core/admin.jquery.js', 'jquery', 4);
|
||||
e107::js('core','bootstrap/js/bootstrap-tooltip.js');
|
||||
// e107::css('core','bootstrap/css/bootstrap.min.css');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
e107::js('inline', "
|
||||
$(function() {
|
||||
|
||||
@@ -134,7 +139,6 @@ if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
|
||||
e107::css('inline'," .column { width:100%; padding-bottom: 100px; }
|
||||
|
||||
|
||||
.regularMenu { border-bottom:1px dotted silver; margin-bottom:6px; padding-left:3px; padding-right:3px; padding-bottom:20px }
|
||||
#core-menumanager-main th {color: silver; font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:14px; font-weight: bold; line-height:24px; background-color:#2F2F2F }
|
||||
.portlet { margin: 0 1em 1em 0; }
|
||||
.portlet-header { margin: 0.3em; padding-bottom: 4px; padding-left: 0.2em; cursor:move }
|
||||
@@ -158,7 +162,9 @@ if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
|
||||
.icon-search {
|
||||
background-position: -48px 0;
|
||||
}
|
||||
|
||||
.icon-align-justify {
|
||||
background-position: -336px -48px;
|
||||
}
|
||||
|
||||
|
||||
/* A little bit of bootstrap styling - loading /bootstrap.css could break some themes */
|
||||
@@ -214,6 +220,13 @@ if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.btn-mini {
|
||||
padding: 0px 2px;
|
||||
font-size: 10.5px;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
}
|
||||
|
||||
|
||||
.tbox { text-align:left }
|
||||
|
||||
.menuOptions {
|
||||
@@ -302,15 +315,39 @@ if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
|
||||
|
||||
}
|
||||
|
||||
ul.unstyled, ol.unstyled {
|
||||
margin-left: 0px;
|
||||
list-style: none outside none;
|
||||
}
|
||||
|
||||
.pull-right { float: right }
|
||||
.pull-left { float: left }
|
||||
|
||||
.menuOption { opacity:0.2 }
|
||||
.menuOption:hover { opacity:1 }
|
||||
|
||||
.sortable li { border-radius: 4px }
|
||||
.sortable li:hover { background-color: silver; box-shadow:3px 3px 3px silver }
|
||||
|
||||
.regularMenu { cursor:move; border-bottom:1px dotted silver; margin-bottom:6px; padding-left:3px; padding-right:3px; padding-top:10px; padding-bottom:10px }
|
||||
|
||||
.ui-draggable { background-color: rgb(245, 245, 245); min-width:100px;}
|
||||
|
||||
",'jquery');
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if($_SERVER['E_ENV_MENUS'] == 'developer')
|
||||
|
||||
|
||||
|
||||
|
||||
if($_SERVER['E_DEV_MENU'] == 'true')
|
||||
{
|
||||
if(isset($_GET['configure']) || isset($_GET['iframe']))
|
||||
{
|
||||
@@ -325,10 +362,17 @@ if($_SERVER['E_ENV_MENUS'] == 'developer')
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SERVER['E_ENV_MENUS'] == 'developer')
|
||||
{
|
||||
// if($_SERVER['E_DEV_MENU'] == 'true')
|
||||
//{
|
||||
function e_help()
|
||||
{
|
||||
if($_SERVER['E_DEV_MENU'] != 'true')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$p = e107::getPref('e_menu_list'); // new storage for xxxxx_menu.php list.
|
||||
$sql = e107::getDb();
|
||||
|
||||
@@ -343,9 +387,24 @@ if($_SERVER['E_ENV_MENUS'] == 'developer')
|
||||
<div class='active tab-pane' id='plugins'>
|
||||
<ul>";
|
||||
|
||||
$c = 500; // start high to prevent overwriting of keys after we drag and drop.
|
||||
|
||||
foreach($p as $menu => $folder)
|
||||
{
|
||||
$text .= "<li id='{$folder}' class='draggable' style='cursor:move'>".str_replace("_menu","",$menu)."</li>";
|
||||
$text .= "<li id='{$menu}' class='draggable regularMenu' style='cursor:move'>";
|
||||
// $text .= str_replace("_menu","",$menu);
|
||||
|
||||
$defaults = array(
|
||||
'name' => $menu,
|
||||
'path' => $folder,
|
||||
'class' => '0'
|
||||
);
|
||||
|
||||
$text .= e_layout::renderMenuOptions($defaults,'layout','area',$c);
|
||||
|
||||
$text .= "</li>";
|
||||
$c++;
|
||||
|
||||
}
|
||||
|
||||
$text .= "</ul>
|
||||
@@ -358,7 +417,18 @@ if($_SERVER['E_ENV_MENUS'] == 'developer')
|
||||
$text .= "<ul>";
|
||||
while($row = $sql->fetch())
|
||||
{
|
||||
$text .= "<li id='".$row['page_id']."' class='draggable' style='cursor:move'>".$row['menu_name']."</li>";
|
||||
$text .= "<li id='".$row['page_id']."' class='draggable regularMenu' style='cursor:move'>";
|
||||
// $text .= $row['menu_name'];
|
||||
|
||||
$defaults = array(
|
||||
'name' => $row['menu_name'],
|
||||
'path' => $row['page_id'],
|
||||
'class' => '0'
|
||||
);
|
||||
|
||||
$text .= e_layout::renderMenuOptions($defaults,'layout','area',$c);
|
||||
|
||||
$text .= "</li>";
|
||||
}
|
||||
|
||||
$text .= "</ul>";
|
||||
@@ -370,76 +440,234 @@ if($_SERVER['E_ENV_MENUS'] == 'developer')
|
||||
|
||||
return array('caption'=>'Menu Items','text'=>$text);
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
// XXX Menu Manager Re-Write with drag and drop and multi-dimensional array as storage. ($pref)
|
||||
// TODO Get Drag & Drop Working with the iFrame
|
||||
// TODO Sorting, visibility, parameters and delete.
|
||||
// TODO Get THIS http://jsbin.com/odiqi3 working with iFrames!! XXX XXX
|
||||
|
||||
class e_layout
|
||||
{
|
||||
private $menuData = array();
|
||||
private $iframe = false;
|
||||
private $cnt = 0;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
$ns = e107::getRender();
|
||||
$this->convertMenuTable();
|
||||
// $this->convertMenuTable();
|
||||
|
||||
$this->menuData = e107::getPref('menu_layouts');
|
||||
|
||||
if(e_AJAX_REQUEST)
|
||||
{
|
||||
|
||||
if(varset($_POST['data']))
|
||||
{
|
||||
$this->processPost();
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(vartrue($_GET['configure'])) //ie Inside the IFRAME.
|
||||
{
|
||||
|
||||
global $HEADER,$FOOTER,$CUSTOMHEADER,$CUSTOMFOOTER,$style;
|
||||
|
||||
$this->HEADER = $HEADER;
|
||||
$this->FOOTER = $FOOTER;
|
||||
$this->CUSTOMHEADER = $CUSTOMHEADER;
|
||||
$this->CUSTOMFOOTER = $CUSTOMFOOTER;
|
||||
$this->style = $style;
|
||||
|
||||
|
||||
unset($HEADER,$FOOTER,$CUSTOMHEADER,$CUSTOMFOOTER,$style);
|
||||
|
||||
require_once(e_CORE."templates/admin_icons_template.php");
|
||||
|
||||
e107::js('url',"http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js");
|
||||
e107::js('url', "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/jquery-ui.css");
|
||||
|
||||
e107::js('inline','
|
||||
$(function()
|
||||
{
|
||||
// post the form back to this script.
|
||||
var saveData = function(areaid)
|
||||
{
|
||||
|
||||
var formid = "#form-" + areaid;
|
||||
var form = $(formid);
|
||||
var data = form.serialize();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "menus.php",
|
||||
data: data
|
||||
}).done(function( msg )
|
||||
{
|
||||
$(".menuOption").show();
|
||||
// alert("POSTED: "+ msg );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$(".sortable").sortable({
|
||||
connectWith: $("#area-1,#area-2,#area-3,#area-4,#area-5"),
|
||||
revert: true,
|
||||
cursor: "move",
|
||||
distance: 20,
|
||||
// containment: $(".sortable"),
|
||||
update: function(ev,ui)
|
||||
{
|
||||
var areaid = $(this).attr("id");
|
||||
saveData(areaid);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// $( ".draggable", window.top.document).click(function()
|
||||
// {
|
||||
// alert("hi there");
|
||||
// });
|
||||
|
||||
// http://jsfiddle.net/DT764/2/
|
||||
|
||||
|
||||
$( ".draggable", window.top.document).draggable({
|
||||
connectToSortable: ".sortable",
|
||||
helper: "clone",
|
||||
appendTo: $(this), // ".sortable", // "#area-1", //FIXME Needs to be a specific area.
|
||||
revert: "invalid",
|
||||
containment: "parent",
|
||||
delay: 0,
|
||||
revertDuration: 100,
|
||||
cursor: "move",
|
||||
iframeFix: true,
|
||||
containment: false,
|
||||
stop: function(e, ui) { //TODO Rename layout and area in the hidden fields to that of the where the menu was dropped.
|
||||
// Figure out positioning magic to determine if e.ui.position is in the iframe
|
||||
// var what = $(this).parent().attr("id");
|
||||
// $(".sortable").draggable( "disable" );
|
||||
// alert(what);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// $( "ul, li", window.top.document ).disableSelection();
|
||||
|
||||
|
||||
$( ".deleteMenu").on("click", function()
|
||||
{
|
||||
var deleteId = $(this).attr("data-delete");
|
||||
var area = $(this).attr("data-area");
|
||||
$("#"+deleteId).hide("slow", function(){
|
||||
$("#"+deleteId).remove();
|
||||
});
|
||||
|
||||
|
||||
// $("#"+deleteId).remove();
|
||||
// alert(deleteId + " " + area);
|
||||
|
||||
|
||||
saveData(area);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
');
|
||||
|
||||
|
||||
/*
|
||||
|
||||
e107::js('inline', "
|
||||
|
||||
win = document.getElementById('menu_iframe').contentWindow;
|
||||
win.jQuery(dragelement,parent.document).draggable({
|
||||
connectToSortable : $('#sortable')
|
||||
});
|
||||
|
||||
",'jquery');
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$this->curLayout = varsettrue($_GET['configure'], $pref['sitetheme_deflayout']);
|
||||
$this->renderLayout($this->curLayout);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else // Parent - ie. main admin page.
|
||||
{
|
||||
e107::css('inline',"
|
||||
.menuOption { display: none }
|
||||
|
||||
");
|
||||
|
||||
|
||||
$theme = e107::getPref('sitetheme');
|
||||
require_once(e_THEME.$theme."/theme.php");
|
||||
|
||||
$this->HEADER = $HEADER;
|
||||
$this->FOOTER = $FOOTER;
|
||||
$this->CUSTOMHEADER = $CUSTOMHEADER;
|
||||
$this->CUSTOMFOOTER = $CUSTOMFOOTER;
|
||||
$this->style = $style;
|
||||
|
||||
// XXX HELP _ i don't work with iFrames.
|
||||
// $("#sortable")
|
||||
//$("iframe").contents().find(".sortable")
|
||||
|
||||
e107::js('inline','
|
||||
$(function() {
|
||||
$( "#sortable" ).sortable({
|
||||
/*
|
||||
e107::js('inline','
|
||||
$(function()
|
||||
{
|
||||
$( ".sortable" ).sortable({
|
||||
revert: true
|
||||
});
|
||||
$( ".draggable" ).draggable({
|
||||
connectToSortable: "#sortable",
|
||||
helper: "clone",
|
||||
revert: "invalid",
|
||||
cursor: "move",
|
||||
// iframeFix: true,
|
||||
|
||||
start: function(ev,ui)
|
||||
{
|
||||
},
|
||||
drag: function(ev,ui)
|
||||
{
|
||||
|
||||
},
|
||||
stop: function(ev, ui)
|
||||
{
|
||||
|
||||
}
|
||||
});
|
||||
$("iframe").load(function(){
|
||||
|
||||
$( "ul, li" ).disableSelection();
|
||||
var frameid = $("#iframe-default").contents().find(".sortable").attr("id")
|
||||
|
||||
// Not Working.
|
||||
$("#menu_iframe").load(function(){
|
||||
$("#menu_iframe").contents().find("#sortable").droppable({
|
||||
accept: ".drag",
|
||||
drop: function( event, ui ) {
|
||||
var html = "<div class=\'droptrue\'>"+ ui.draggable.html() + "</div>";
|
||||
//alert(html);
|
||||
$(this).append(html);
|
||||
}
|
||||
});
|
||||
$( ".draggable" ).draggable({
|
||||
connectToSortable: "#" + frameid,
|
||||
helper: "clone",
|
||||
revert: "invalid",
|
||||
cursor: "move",
|
||||
iframeFix: true
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
');
|
||||
// $( "ul, li" ).disableSelection();
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
','jquery');
|
||||
*/
|
||||
|
||||
|
||||
$this->scanForNew();
|
||||
|
||||
@@ -449,43 +677,56 @@ class e_layout
|
||||
|
||||
|
||||
/**
|
||||
* Convert from e107_menu table to $pref format.
|
||||
* Save Menu Pref
|
||||
*/
|
||||
function convertMenuTable()
|
||||
protected function processPost()
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$sql->select('menus','*','menu_location !=0 ORDER BY menu_location,menu_order');
|
||||
$data = array();
|
||||
$cnf = e107::getConfig('core');
|
||||
$existing = $cnf->get('menu_layouts');
|
||||
|
||||
while($row = $sql->fetch())
|
||||
$data = $_POST['data'];
|
||||
$layout = $_POST['layout'];
|
||||
$area = $_POST['area'];
|
||||
|
||||
$save = array();
|
||||
|
||||
|
||||
foreach($_POST['data']['layout']['area'] as $v) // reset key values.
|
||||
{
|
||||
$layout = vartrue($row['menu_layout'],'default');
|
||||
$location = $row['menu_location'];
|
||||
$data[$layout][$location][] = array('name'=>$row['menu_name'],'class'=>$row['menu_class'],'path'=>$row['menu_path'],'pages'=>$row['menu_pages'],'parms'=>$row['menu_parms']);
|
||||
$save[] = $v;
|
||||
}
|
||||
|
||||
$this->menuData = ($data);
|
||||
// $save[$layout][$area] = $_POST['data']['layout']['area'];
|
||||
echo "\nLAYOUT=".$layout."\n";
|
||||
echo "AREA=".$area."\n";
|
||||
print_r($save);
|
||||
|
||||
e107::getConfig('core')->setPref('menu_layouts/'.$layout."/".$area, $save)->save();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Substitute all {MENU=X} and Render output.
|
||||
*/
|
||||
private function renderLayout($layout='')
|
||||
{
|
||||
$ALL = $this->getHeadFoot();
|
||||
|
||||
global $HEADER,$FOOTER,$style; // included by theme file in class2.
|
||||
$HEADER = $ALL['HEADER'];
|
||||
$FOOTER = $ALL['FOOTER'];
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
$head = preg_replace_callback("/\{MENU=([\d]{1,3})(:[\w\d]*)?\}/", array($this, 'renderMenuArea'), $HEADER[THEME_LAYOUT]);
|
||||
$foot = preg_replace_callback("/\{MENU=([\d]{1,3})(:[\w\d]*)?\}/", array($this, 'renderMenuArea'), $FOOTER[THEME_LAYOUT]);
|
||||
|
||||
global $style;
|
||||
|
||||
$style = $this->style;
|
||||
|
||||
echo $tp->parsetemplate($head);
|
||||
// echo "<div>MAIN CONTENT</div>";
|
||||
echo $tp->parsetemplate($foot);
|
||||
@@ -502,45 +743,128 @@ class e_layout
|
||||
*/
|
||||
private function renderMenuArea($matches)
|
||||
{
|
||||
|
||||
$frm = e107::getForm();
|
||||
$area = $matches[1];
|
||||
|
||||
// return print_a($this->menuData,true);
|
||||
$text = "<div class='menu-panel'>";
|
||||
$text .= "<div class='menu-panel-header' title=\"".MENLAN_34."\">Area ".$area."</div>";
|
||||
|
||||
$text .= "<div class='menu-panel-header' title=\"".MENLAN_34."\">Area ".$area."</div>\n";
|
||||
$text .= $frm->open('form-area-'.$area,'post',e_SELF);
|
||||
$text .= "<ul id='area-".$area."' class='sortable unstyled'>
|
||||
<li> </li>";
|
||||
|
||||
if(vartrue($this->menuData[THEME_LAYOUT]) && is_array($this->menuData[THEME_LAYOUT][$area]))
|
||||
{
|
||||
$text .= "<ul id='sortable' class='unstyled'>";
|
||||
|
||||
foreach($this->menuData[THEME_LAYOUT][$area] as $val)
|
||||
{
|
||||
$text .= $this->renderMenu($val);
|
||||
|
||||
$text .= $this->renderMenu($val, THEME_LAYOUT, $area,$count);
|
||||
$this->cnt++;
|
||||
}
|
||||
|
||||
$text .= "</ul>";
|
||||
}
|
||||
|
||||
$text .= "</ul>";
|
||||
$text .= "</div>";
|
||||
|
||||
// $text .= $frm->button('submit','submit','submit','submit');
|
||||
|
||||
$text .= $frm->hidden('layout',THEME_LAYOUT);
|
||||
$text .= $frm->hidden('area',$area);
|
||||
$text .= $frm->close();
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function renderMenu($row)
|
||||
private function renderMenu($row, $layout, $area, $count)
|
||||
{
|
||||
// return print_a($row,true);
|
||||
$TEMPLATE = '<li class="regularMenu" id="block-1-1"> '.$row['name'].' </li>'; // TODO perhaps a simple counter for the id
|
||||
$frm = e107::getForm();
|
||||
$uniqueId = "menu_".$frm->name2id($row['path']).'_'.$this->cnt;
|
||||
|
||||
$TEMPLATE = '<li class="regularMenu" id="'.$uniqueId.'"> '.$this->renderMenuOptions($row, $layout, $area, $this->cnt, $uniqueId).' </li>
|
||||
'; // TODO perhaps a simple counter for the id
|
||||
|
||||
return $TEMPLATE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param $row (array of data from $pref['menu_layouts']
|
||||
* @param $layout . eg. 'default' or 'home'
|
||||
* @param number $area as in {MENU=x}
|
||||
* @param incrementor number.
|
||||
*/
|
||||
public function renderMenuOptions($row, $layout, $area, $c , $uniqueId='xxx')
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
|
||||
// $text = "<i class='icon-align-justify'></i> ";
|
||||
$text .= str_replace("_menu","",$row['name']);
|
||||
|
||||
// $layout = 'layout';
|
||||
// $area = 'area';
|
||||
//TODO Delete, Config etc.
|
||||
|
||||
//$data[$layout][$location][] = array('name'=>$row['menu_name'],'class'=>$row['menu_class'],'path'=>$row['menu_path'],'pages'=>$row['menu_pages'],'parms'=>$row['menu_parms']);
|
||||
// $area = 'area_'.$area;
|
||||
|
||||
// 'layout' and 'area' will later be substituted.
|
||||
$text .= $frm->hidden('data[layout][area]['.$c.'][name]',$row['name'] );
|
||||
$text .= $frm->hidden('data[layout][area]['.$c.'][class]',$row['class'] );
|
||||
$text .= $frm->hidden('data[layout][area]['.$c.'][path]',$row['path'] );
|
||||
$text .= $frm->hidden('data[layout][area]['.$c.'][pages]',$row['pages'] );
|
||||
$text .= $frm->hidden('data[layout][area]['.$c.'][parms]',$row['parms'] );
|
||||
|
||||
$visibilityLink = e_SELF."?enc=".base64_encode('lay='.$layout.'&vis='.$c.'&iframe=1');
|
||||
|
||||
|
||||
$text .= "<a href='#' class='menuOption menu-btn menu-btn-mini menu-btn-danger deleteMenu pull-right' data-area='area-".$area."' data-delete='".$uniqueId."'>×</a>"; // $('.hello').remove();
|
||||
|
||||
$text .= '<a class="menuOption e-menumanager-option menu-btn pull-right" data-modal-caption="'.MENLAN_20.'" href="'.$visibilityLink.'" title="'.MENLAN_20.'"><i class="icon-search"></i></a>';
|
||||
|
||||
/*
|
||||
|
||||
|
||||
$text .= '<span class="menu-options-buttons">
|
||||
<a class="e-menumanager-option menu-btn" data-modal-caption="'.MENLAN_20.'" href="'.$visibilityLink.'" title="'.MENLAN_20.'"><i class="S16 e-search-16"></i></a>';
|
||||
|
||||
if($conf)
|
||||
{
|
||||
$text .= '<a class="menu-btn" target="_top" href="'.e_SELF.'?lay='.$layout.'&mode=conf&path='.urlencode($conf).'&id='.$menu_id.'"
|
||||
title="Configure menu"><i class="S16 e-configure-16"></i></a>';
|
||||
}
|
||||
|
||||
$editLink = e_SELF."?enc=".base64_encode('lay='.$layout.'&parmsId='.$menu_id.'&iframe=1');
|
||||
$text .= '<a data-modal-caption="Configure parameters" class="e-menumanager-option menu-btn e-tip" target="_top" href="'.$editLink.'" title="Configure parameters"><i class="S16 e-edit-16" ></i></a>';
|
||||
|
||||
$text .= '<a title="'.LAN_DELETE.'" id="remove-'.$menu_id.'-'.$menu_location.'" class="e-tip delete e-menumanager-delete menu-btn" href="'.e_SELF.'?configure='.$layout.'&mode=deac&id='.$menu_id.'"><i class="S16 e-delete-16"></i></a>
|
||||
|
||||
</span>';
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Scan Plugin folders for new _menu files.
|
||||
*/
|
||||
@@ -554,9 +878,23 @@ class e_layout
|
||||
|
||||
foreach($files as $file)
|
||||
{
|
||||
$valid_menu = false;
|
||||
|
||||
if (file_exists($file['path'].'/plugin.xml') || file_exists($file['path'].'/plugin.php'))
|
||||
{
|
||||
if (e107::isInstalled($parent_dir))
|
||||
{
|
||||
$valid_menu = TRUE; // Whether new or existing, include in list
|
||||
}
|
||||
}
|
||||
else // Just add the menu anyway
|
||||
{
|
||||
$valid_menu = TRUE;
|
||||
}
|
||||
|
||||
$path = trim(str_replace(e_PLUGIN,"",$file['path']),"/");
|
||||
|
||||
if(e107::isInstalled($path))
|
||||
if($valid_menu)
|
||||
{
|
||||
$fname = str_replace(".php","",$file['fname']);
|
||||
$data[$fname] = $path;
|
||||
@@ -579,11 +917,31 @@ class e_layout
|
||||
{
|
||||
$ns = e107::getRender();
|
||||
$tp = e107::getParser();
|
||||
$frm = e107::getForm();
|
||||
|
||||
$TEMPL = $this->getHeadFoot();
|
||||
|
||||
|
||||
$layouts = array_keys($TEMPL['HEADER']);
|
||||
|
||||
e107::js('inline','
|
||||
$(function()
|
||||
{
|
||||
$(".draggable").draggable({
|
||||
connectToSortable: $(".sortable"),
|
||||
helper: "clone",
|
||||
revert: "invalid",
|
||||
cursor: "move",
|
||||
iframeFix: true,
|
||||
refreshPositions: true
|
||||
|
||||
});
|
||||
})'
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
$text = '<ul class="nav nav-tabs">';
|
||||
|
||||
$active = ' class="active" ';
|
||||
@@ -604,7 +962,7 @@ class e_layout
|
||||
{
|
||||
$text .= '
|
||||
<div class="tab-pane '.$active.'" id="'.$title.'">
|
||||
<iframe id="menu_iframe" class="well" width="100%" scrolling="no" style="width: 100%; height: 6933px; border: 0px none;" src="'.e_ADMIN_ABS.'menus.php?configure='.$title.'"></iframe>
|
||||
<iframe id="iframe-'.$frm->name2id($title).'" class="well" width="100%" scrolling="no" style="width: 100%; height: 6933px; border: 0px none;" src="'.e_ADMIN_ABS.'menus.php?configure='.$title.'"></iframe>
|
||||
</div>';
|
||||
|
||||
$active = '';
|
||||
@@ -622,50 +980,46 @@ class e_layout
|
||||
|
||||
|
||||
|
||||
private function getHeadFoot($_MLAYOUT=null)
|
||||
private function getHeadFoot()
|
||||
{
|
||||
$theme = e107::getPref('sitetheme');
|
||||
|
||||
$H = array();
|
||||
$F = array();
|
||||
|
||||
require(e_THEME.$theme."/theme.php");
|
||||
|
||||
|
||||
if(is_string($HEADER))
|
||||
if(is_string($this->HEADER))
|
||||
{
|
||||
$H['default'] = $HEADER;
|
||||
$F['default'] = $FOOTER;
|
||||
$H['default'] = $this->HEADER;
|
||||
$F['default'] = $this->FOOTER;
|
||||
}
|
||||
else
|
||||
{
|
||||
$H = $HEADER;
|
||||
$F = $FOOTER;
|
||||
$H = $this->HEADER;
|
||||
$F = $this->FOOTER;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 0.6 / 0.7-1.x
|
||||
if(isset($CUSTOMHEADER) && isset($CUSTOMHEADER))
|
||||
if(isset($this->CUSTOMHEADER) && isset($this->CUSTOMHEADER))
|
||||
{
|
||||
if(!is_array($CUSTOMHEADER))
|
||||
if(!is_array($this->CUSTOMHEADER))
|
||||
{
|
||||
$H['legacyCustom'] = $CUSTOMHEADER;
|
||||
$F['legacyCustom'] = $CUSTOMFOOTER;
|
||||
$H['legacyCustom'] = $this->CUSTOMHEADER;
|
||||
$F['legacyCustom'] = $this->CUSTOMFOOTER;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($CUSTOMHEADER as $k=>$v)
|
||||
foreach($this->CUSTOMHEADER as $k=>$v)
|
||||
{
|
||||
$H[$k] = $v;
|
||||
}
|
||||
foreach($this->CUSTOMFOOTER as $k=>$v)
|
||||
{
|
||||
$F[$k] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_MLAYOUT)
|
||||
{
|
||||
// return array('HEADER'=>$H[$_MLAYOUT], 'FOOTER'=>$F[$_MLAYOUT]);
|
||||
}
|
||||
|
||||
|
||||
return array('HEADER'=>$H, 'FOOTER'=>$F);
|
||||
|
@@ -15,6 +15,81 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
class admin_shortcodes
|
||||
{
|
||||
|
||||
function cronUpdateRender($parm,$cacheData)
|
||||
{
|
||||
$mes = e107::getMessage();
|
||||
|
||||
if($cacheData == 'up-to-date')
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$installUrl = "#"; // TODO
|
||||
|
||||
|
||||
if($parm=='alert')
|
||||
{
|
||||
$text = 'A new update is ready to install! Click to unzip and install v'.$cacheData.'</a>.
|
||||
<a class="btn btn-success" href="'.$installUrl.'">Install</a>';
|
||||
|
||||
$mes->addInfo($text);
|
||||
return $mes->render();
|
||||
}
|
||||
|
||||
if($parm=='icon')
|
||||
{
|
||||
|
||||
return '<ul class="nav pill">
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle" title="Messages" role="button" data-toggle="dropdown" href="#">
|
||||
'.E_16_E107.' <b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li class="nav-header">Update Available</li>
|
||||
<li><a href="'.$installUrl.'">e107 v'.$cacheData.'</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
';
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// {ADMIN_COREUPDATE}
|
||||
function sc_admin_coreupdate($parm='')
|
||||
{
|
||||
$che = e107::getCache();
|
||||
$mes = e107::getMessage();
|
||||
|
||||
$che->setMD5(e_LANGUAGE);
|
||||
|
||||
$cacheData = $che->retrieve("releasecheck",3600, TRUE); // 2.0.1 | 'up-to-date' | false ;
|
||||
|
||||
$cacheData = 2.1; // XXX Remove to test for real.
|
||||
|
||||
if($cacheData)
|
||||
{
|
||||
return $this->cronUpdateRender($parm, $cacheData);
|
||||
}
|
||||
|
||||
|
||||
require_once(e_HANDLER."cron_class.php");
|
||||
$cron = new _system_cron();
|
||||
|
||||
if($result = $cron->checkCoreUpdate())
|
||||
{
|
||||
return $this->cronUpdateRender($parm, $cacheData);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function sc_admin_credits()
|
||||
{
|
||||
if (!ADMIN) { return ''; }
|
||||
@@ -61,9 +136,8 @@ class admin_shortcodes
|
||||
$ns = e107::getRender();
|
||||
$pref = e107::getPref();
|
||||
|
||||
if(function_exists('e_help')) // new in v2.x for non-admin-ui admin pages.
|
||||
if(function_exists('e_help') && ($tmp = e_help())) // new in v2.x for non-admin-ui admin pages.
|
||||
{
|
||||
$tmp = e_help();
|
||||
return $ns->tablerender($tmp['caption'],$tmp['text'],'e_help',true);
|
||||
}
|
||||
|
||||
|
@@ -125,7 +125,13 @@ class news_shortcodes extends e_shortcode
|
||||
{
|
||||
$NEWIMAGE = $param['image_nonew_small'];
|
||||
}
|
||||
return (!$news_item['news_allow_comments'] ? ''.($pref['comments_icon'] ? $NEWIMAGE : '')." <a title='Comments' href='".e107::getUrl()->create('news/view/item', $news_item)."'>".$param['commentlink'].intval($news_item['news_comment_total']).'</a>' : vartrue($param['commentoffstring'],'Disabled') );
|
||||
|
||||
if(deftrue('e_BOOTSTRAP')) // Should be done with CSS, not like above.
|
||||
{
|
||||
$NEWIMAGE = "";
|
||||
}
|
||||
|
||||
return (!$news_item['news_allow_comments'] ? ''.($pref['comments_icon'] ? $NEWIMAGE.' ' : '')."<a title='Comments' href='".e107::getUrl()->create('news/view/item', $news_item)."'>".$param['commentlink'].intval($news_item['news_comment_total']).'</a>' : vartrue($param['commentoffstring'],'Disabled') );
|
||||
}
|
||||
|
||||
function sc_trackback($parm)
|
||||
|
@@ -226,7 +226,9 @@ class user_shortcodes extends e_shortcode
|
||||
function sc_user_email_link($parm)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
return ($this->var['user_hideemail'] && !ADMIN) ? "<i>".LAN_USER_35."</i>" : $tp->parseTemplate("{email={$this->var['user_email']}-link}");
|
||||
return /* Condition */ ($this->var['user_hideemail'] && !ADMIN) ?
|
||||
/* Hidden and Not Admin */ "<i>".LAN_USER_35."</i>" :
|
||||
/* Not Hidden or Admin */ $tp->parseTemplate("{email={$this->var['user_email']}-link}");
|
||||
}
|
||||
|
||||
|
||||
@@ -234,7 +236,30 @@ class user_shortcodes extends e_shortcode
|
||||
function sc_user_email($parm)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
return ($this->var['user_hideemail'] && !ADMIN) ? "<i>".LAN_USER_35."</i>" : $tp->toHTML($this->var['user_email'],"no_replace");
|
||||
return /* Condition */ ($this->var['user_hideemail'] && !ADMIN) ?
|
||||
/* Hidden and Not Admin */ "<i>".LAN_USER_35."</i>" :
|
||||
/* Not Hidden or Admin */ "<span style='unicode-bidi:bidi-override; direction: rtl;'>" . strrev($tp->toHTML($this->var['user_email'],"no_replace")) . "</span>";
|
||||
########################################################
|
||||
# Security Note - 04 May 2013 #
|
||||
########################################################
|
||||
# #
|
||||
# The CSS code direction rtl is an effective way to #
|
||||
# prevent spam bots from scraping emails that are #
|
||||
# not hidden. #
|
||||
# #
|
||||
# You can find empirical support for this method at #
|
||||
# <http://superuser.com/a/235965>. #
|
||||
# #
|
||||
# {e_CORE}templates/user_template.php was modified to #
|
||||
# support this code. In $USER_FULL_TEMPLATE, the #
|
||||
# LAN_USER_60 value {USER_EMAIL_LINK} was changed to #
|
||||
# {USER_EMAIL}. I couldn't figure out how the two #
|
||||
# shortcodes were different, so I took precautions in #
|
||||
# hopes that the CSS direction won't break actual HTML #
|
||||
# tags. #
|
||||
# #
|
||||
# -- Deltik #
|
||||
########################################################
|
||||
}
|
||||
|
||||
|
||||
@@ -421,7 +446,7 @@ class user_shortcodes extends e_shortcode
|
||||
if (USERID == $this->var['user_id'])
|
||||
{
|
||||
//return "<a href='".$url->create('user/myprofile/edit')."'>".LAN_USER_38."</a>";
|
||||
return "<a href='usersettings.php'>".LAN_USER_38."</a>"; // TODO: repair dirty fix for usersettings
|
||||
return "<a href='".e_HTTP."usersettings.php'>".LAN_USER_38."</a>"; // TODO: repair dirty fix for usersettings
|
||||
}
|
||||
else if(ADMIN && getperms("4") && !$this->var['user_admin'])
|
||||
{
|
||||
|
@@ -142,7 +142,7 @@ $USER_FULL_TEMPLATE = "{SETIMAGE: w=250}
|
||||
<tr>
|
||||
<td {$main_colspan} class='forumheader3'>
|
||||
<div class='f-left'>{USER_EMAIL_ICON} ".LAN_USER_60."</div>
|
||||
<div class='f-right right'>{USER_EMAIL_LINK}</div>
|
||||
<div class='f-right right'>{USER_EMAIL}</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
458
e107_handlers/e_marketplace.php
Normal file
458
e107_handlers/e_marketplace.php
Normal file
@@ -0,0 +1,458 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Application store client
|
||||
*
|
||||
*/
|
||||
|
||||
class e_marketplace
|
||||
{
|
||||
/**
|
||||
* Protocol type, defaults to WSDL, fallback to 'xmlrpc' if soap extension not installed
|
||||
* @var e_marketplace_adapter_abstract
|
||||
*/
|
||||
protected $adapter = null;
|
||||
|
||||
|
||||
public function __construct($force = null)
|
||||
{
|
||||
if(null !== $force)
|
||||
{
|
||||
$className = 'e_marketplace_adapter_'.$force;
|
||||
$this->adapter = new $className();
|
||||
}
|
||||
elseif(!class_exists('SoapClient')) $this->adapter = new e_marketplace_adapter_xmlrpc();
|
||||
else
|
||||
{
|
||||
$this->adapter = new e_marketplace_adapter_wsdl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set authorization key
|
||||
*/
|
||||
public function generateAuthKey($username, $password)
|
||||
{
|
||||
$this->setAuthKey($this->makeAuthKey($username, $password, true));
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set authorization key
|
||||
*/
|
||||
public function setAuthKey($authkey)
|
||||
{
|
||||
$this->adapter->setAuthKey($authkey);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function hasAuthKey()
|
||||
{
|
||||
return $this->adapter->hasAuthKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* Make authorization key from user credentials
|
||||
*/
|
||||
public function makeAuthKey($username, $password = '', $plain = false)
|
||||
{
|
||||
$now = gmdate('y-m-d H');
|
||||
if($plain && !empty($password)) $password = md5($password);
|
||||
return sha1($username.$password.$now);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve currently used adapter
|
||||
* @param e_marketplace_adapter_abstract
|
||||
*/
|
||||
public function adapter()
|
||||
{
|
||||
return $this->adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve currently used adapter
|
||||
* @param e_marketplace_adapter_abstract
|
||||
*/
|
||||
public function call($method, $data, $apply = true)
|
||||
{
|
||||
return $this->adapter()->call($method, $data, $apply);
|
||||
}
|
||||
|
||||
/**
|
||||
* Direct adapter()->call() execution - experimental stage
|
||||
*/
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
if(strpos($method, 'get') === 0 || strpos($method, 'do') === 0)
|
||||
{
|
||||
return $this->adapter()->call($method, $arguments);
|
||||
}
|
||||
throw new Exception("Error Processing Request", 10);
|
||||
}
|
||||
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->adapter = null;
|
||||
//echo "Adapter destroyed", PHP_EOL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
abstract class e_marketplace_adapter_abstract
|
||||
{
|
||||
/**
|
||||
* e107.org download URL
|
||||
* @var string
|
||||
*/
|
||||
protected $downloadUrl = 'http://e107.org/e107_plugins/addons/request.php';
|
||||
|
||||
/**
|
||||
* e107.org authorization key
|
||||
* @var string
|
||||
*/
|
||||
protected $authKey = null;
|
||||
|
||||
abstract public function test($input);
|
||||
abstract public function call($method, $data, $apply);
|
||||
abstract public function fetch($method, &$result);
|
||||
|
||||
/**
|
||||
* Set authorization key
|
||||
*/
|
||||
public function setAuthKey($authkey)
|
||||
{
|
||||
$this->authKey = $authkey;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function hasAuthKey()
|
||||
{
|
||||
return ($this->authKey !== null) ? true : false;
|
||||
}
|
||||
public function getAuthKey()
|
||||
{
|
||||
return $this->authKey;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Download a Plugin or Theme to Temp, then test and move to plugin/theme folder and backup to system backup folder.
|
||||
* @param string $remotefile URL
|
||||
* @param string $type plugin or theme
|
||||
*/
|
||||
public function download($id, $type='theme')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$id = intval($id);
|
||||
$qry = 'id='.$id;
|
||||
$remotefile = $this->downloadUrl."?auth=".$this->getAuthKey()."&".$qry;
|
||||
|
||||
$localfile = md5($remotefile.time()).".zip";
|
||||
$status = "Downloading...";
|
||||
|
||||
$result = $this->getRemoteFile($remotefile, $localfile);
|
||||
|
||||
if(!file_exists(e_TEMP.$localfile))
|
||||
{
|
||||
$status = ADMIN_FALSE_ICON."<br /><a href='".$remotefile."'>Download Manually</a>";
|
||||
|
||||
if(E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
$status .= 'local='.$localfile;
|
||||
}
|
||||
|
||||
echo $status;
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$contents = file_get_contents(e_TEMP.$localfile);
|
||||
if(strlen($contents) < 400)
|
||||
{
|
||||
echo "<script>alert('".$tp->toJS($contents)."')</script>";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
chmod(e_TEMP.$localfile, 0755);
|
||||
require_once(e_HANDLER."pclzip.lib.php");
|
||||
|
||||
$archive = new PclZip(e_TEMP.$localfile);
|
||||
$unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_TEMP, PCLZIP_OPT_SET_CHMOD, 0755)); // Store in TEMP first.
|
||||
$dir = $this->getRootFolder($unarc);
|
||||
$destpath = ($type == 'theme') ? e_THEME : e_PLUGIN;
|
||||
$typeDiz = ucfirst($type);
|
||||
|
||||
@copy(e_TEMP.$localfile, e_BACKUP.$dir.".zip"); // Make a Backup in the system folder.
|
||||
|
||||
if($dir && is_dir($destpath.$dir))
|
||||
{
|
||||
$alert = $tp->toJS(ucfirst($type)." Already Installed".$destpath.$dir);
|
||||
echo "<script>alert('".$alert."')</script>";
|
||||
echo "Already Installed";
|
||||
@unlink(e_TEMP.$localfile);
|
||||
exit;
|
||||
}
|
||||
|
||||
if($dir == '')
|
||||
{
|
||||
echo "<script>alert('Couldn\'t detect the root folder in the zip.')</script>";
|
||||
@unlink(e_TEMP.$localfile);
|
||||
exit;
|
||||
}
|
||||
|
||||
if(is_dir(e_TEMP.$dir))
|
||||
{
|
||||
$status = "Unzipping...";
|
||||
if(!rename(e_TEMP.$dir,$destpath.$dir))
|
||||
{
|
||||
$alert = $tp->toJS("Couldn't Move ".e_TEMP.$dir." to ".$destpath.$dir." Folder");
|
||||
echo "<script>alert('".$alert."')</script>";
|
||||
@unlink(e_TEMP.$localfile);
|
||||
exit;
|
||||
}
|
||||
|
||||
$alert = $tp->toJS("Download Complete!");
|
||||
echo "<script>alert('".$alert."')</script>";
|
||||
|
||||
// $dir = basename($unarc[0]['filename']);
|
||||
// $plugPath = preg_replace("/[^a-z0-9-\._]/", "-", strtolower($dir));
|
||||
$status = "Done"; // ADMIN_TRUE_ICON;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$status = ADMIN_FALSE_ICON."<br /><a href='".$remotefile."'>Download Manually</a>";
|
||||
if(E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
$status .= print_a($unarc, true);
|
||||
}
|
||||
}
|
||||
|
||||
echo $status;
|
||||
@unlink(e_TEMP.$localfile);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Grab a remote file and save it in the /temp directory. requires CURL
|
||||
function getRemoteFile($remote_url, $local_file, $type='temp')
|
||||
{
|
||||
$path = ($type == 'media') ? e_MEDIA : e_TEMP;
|
||||
|
||||
$fp = fopen($path.$local_file, 'w'); // media-directory is the root.
|
||||
|
||||
$cp = curl_init($remote_url);
|
||||
curl_setopt($cp, CURLOPT_FILE, $fp);
|
||||
curl_setopt($cp, CURLOPT_REFERER, e_REQUEST_HTTP);
|
||||
curl_setopt($cp, CURLOPT_HEADER, 0);
|
||||
curl_setopt($cp, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
|
||||
curl_setopt($cp, CURLOPT_COOKIEFILE, e_SYSTEM.'cookies.txt');
|
||||
|
||||
$buffer = curl_exec($cp);
|
||||
|
||||
curl_close($cp);
|
||||
fclose($fp);
|
||||
|
||||
return ($buffer) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
class e_marketplace_adapter_wsdl extends e_marketplace_adapter_abstract
|
||||
{
|
||||
/**
|
||||
* e107.org WSDL URL
|
||||
* @var string
|
||||
*/
|
||||
protected $wsdl = 'http://e107.org/e107_plugins/addons/service.php?wsdl';
|
||||
|
||||
/**
|
||||
* Soap client instance
|
||||
* @var SoapClient
|
||||
*/
|
||||
protected $client = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
e107_ini_set('soap.wsdl_cache_enabled', 0);
|
||||
e107_ini_set('soap.wsdl_cache_ttl', 0);
|
||||
|
||||
$options = array(
|
||||
"trace" => true,
|
||||
'exception' => true,
|
||||
"uri" => "http://server.soap.e107.inc.com/",
|
||||
'cache_wsdl' => WSDL_CACHE_NONE,
|
||||
'connection_timeout' => 10,
|
||||
);
|
||||
|
||||
$this->client = new SoapClient($this->wsdl, $options);
|
||||
|
||||
if(function_exists('xdebug_disable'))
|
||||
{
|
||||
//xdebug_disable();
|
||||
}
|
||||
}
|
||||
|
||||
public function test($input)
|
||||
{
|
||||
try
|
||||
{
|
||||
$res = $this->client->get_echo($input);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$res = $e->getMessage();
|
||||
}
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic call method
|
||||
*/
|
||||
public function _call($method, $args, $apply = true)
|
||||
{
|
||||
$result = array(
|
||||
'data' => null,
|
||||
//'error'=> array('code' => 0, 'message' => null)
|
||||
);
|
||||
$ret = null;
|
||||
|
||||
// authorize on every call, service class decides what to do on every method call
|
||||
$auth = new stdClass;
|
||||
$auth->authKey = $this->getAuthKey();
|
||||
$header = new SoapHeader('http://e107.org/services/auth', 'checkAuthHeader', $auth);
|
||||
|
||||
try
|
||||
{
|
||||
$this->client->__setSoapHeaders(array($header));
|
||||
if(is_array($args) && $apply)
|
||||
{
|
||||
$ret = call_user_func_array(array($this->client, $method), $args);
|
||||
}
|
||||
else $ret = $this->client->$method($args);
|
||||
|
||||
if(isset($ret['exception']))
|
||||
{
|
||||
$result['error']['message'] = "API Exception [call::{$method}]: (#".$ret['exception']['code'].") ".$ret['exception']['message'];
|
||||
$result['error']['code'] = $ret['exception']['code'];
|
||||
unset($ret['exception']);
|
||||
}
|
||||
$result['data'] = $ret['data'];
|
||||
}
|
||||
catch(SoapFault $e)
|
||||
{
|
||||
$result['error']['message'] = "SoapFault Exception [call::{$method}]: (#".$e->getCode().") ".$e->getMessage();
|
||||
$result['error']['code'] = 'SOAP_'.$e->getCode();
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$result['error']['message'] = "Generic Exception [call::{$method}]: (#".$e->getCode().") ".$e->getMessage();
|
||||
$result['error']['code'] = 'GEN_'.$e->getCode();
|
||||
}
|
||||
if(E107_DEBUG_LEVEL)
|
||||
{
|
||||
print_a($this->client->__getLastRequest());
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public call method
|
||||
*/
|
||||
public function call($method, $data, $apply = true)
|
||||
{
|
||||
return $this->_call($method, $data, $apply);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the result, not needed for WSDL
|
||||
* SUBJECT OF REMOVAL
|
||||
*/
|
||||
public function fetch($method, &$result)
|
||||
{
|
||||
if(isset($result['error']))
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
|
||||
switch ($method)
|
||||
{
|
||||
case 'getList':
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->client = null;
|
||||
//echo "SOAP Client destroyed", PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
class e_marketplace_adapter_xmlrpc extends e_marketplace_adapter_abstract
|
||||
{
|
||||
/**
|
||||
* e107.org XML-rpc service
|
||||
* @var xmlClass
|
||||
*/
|
||||
protected $url = 'http://e107.org/e107_plugins/addons/xservice.php';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function test($input)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function call($method, $data, $apply = true)
|
||||
{
|
||||
$client = $this->client();
|
||||
|
||||
// settings based on current method
|
||||
$this->prepareClient($client);
|
||||
|
||||
// authorization data
|
||||
$data['auth'] = $this->getAuthKey();
|
||||
$data['action'] = $method;
|
||||
|
||||
// build the request query
|
||||
$qry = str_replace(array('s%5B', '%5D'), array('[', ']'), http_build_query($data, null, '&'));
|
||||
$url = $this->url.'?'.$qry;
|
||||
|
||||
// call it
|
||||
$result = $client->loadXMLfile($url,'advanced');
|
||||
//var_dump($url, $result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function fetch($method, &$result)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function prepareClient($method, &$client)
|
||||
{
|
||||
switch ($method)
|
||||
{
|
||||
case 'getList':
|
||||
$client->setOptArrayTags('plugin');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function client()
|
||||
{
|
||||
return e107::getXml(false);
|
||||
}
|
||||
}
|
@@ -413,7 +413,7 @@ class e_form
|
||||
if($localonly == true)
|
||||
{
|
||||
$text = "<input class='tbox' style='width:80%' id='{$idinput}' type='hidden' name='image' size='40' value='{$curVal}' maxlength='100' />";
|
||||
$text .= "<img src='".$img."' id='{$previnput}' class='img-rounded e-expandit e-tip avatar' style='cursor:pointer; width:".$pref['im_width']."px; height:".$pref['im_height']."px' title='Choose an avatar for yourself'/>"; // TODO LAN
|
||||
$text .= "<img src='".$img."' id='{$previnput}' class='img-rounded e-expandit e-tip avatar' style='cursor:pointer; width:".$pref['im_width']."px; height:".$pref['im_height']."px' title='Click on the avatar to change it'/>"; // TODO LAN
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -63,36 +63,26 @@ class e_menu
|
||||
return;
|
||||
}
|
||||
|
||||
$menu_layout_field = THEME_LAYOUT!=e107::getPref('sitetheme_deflayout') ? THEME_LAYOUT : "";
|
||||
|
||||
// e107::getCache()->CachePageMD5 = md5(e_LANGUAGE.$menu_layout_field); // Disabled by line 93 of Cache class.
|
||||
//FIXME add a function to the cache class for this.
|
||||
|
||||
$menu_data = e107::getCache()->retrieve_sys("menus_".USERCLASS_LIST."_".md5(e_LANGUAGE.$menu_layout_field));
|
||||
// $menu_data = e107::getCache()->retrieve_sys("menus_".USERCLASS_LIST);
|
||||
$menu_data = e107::getArrayStorage()->ReadArray($menu_data);
|
||||
$eMenuArea = array();
|
||||
// $eMenuList = array();
|
||||
// $eMenuActive = array(); // DEPRECATED
|
||||
if(!is_array($menu_data))
|
||||
// print_a($eMenuArea);
|
||||
if($_SERVER['E_DEV_MENU'] == 'true') // New in v2.x
|
||||
{
|
||||
$menu_qry = 'SELECT * FROM #menus WHERE menu_location > 0 AND menu_class IN ('.USERCLASS_LIST.') AND menu_layout = "'.$menu_layout_field.'" ORDER BY menu_location,menu_order';
|
||||
if(e107::getDb()->db_Select_gen($menu_qry))
|
||||
$layouts = e107::getPref('menu_layouts');
|
||||
if(!is_array($layouts))
|
||||
{
|
||||
while($row = e107::getDb()->db_Fetch())
|
||||
{
|
||||
$eMenuArea[$row['menu_location']][] = $row;
|
||||
}
|
||||
$converted = $this->convertMenuTable();
|
||||
e107::getConfig('core')->set('menu_layouts', $converted)->save();
|
||||
}
|
||||
$menu_data['menu_area'] = $eMenuArea;
|
||||
$menuData = e107::getArrayStorage()->WriteArray($menu_data, false);
|
||||
// e107::getCache()->set_sys('menus_'.USERCLASS_LIST, $menuData);
|
||||
e107::getCache()->set_sys('menus_'.USERCLASS_LIST.'_'.md5(e_LANGUAGE.$menu_layout_field), $menuData);
|
||||
|
||||
$eMenuArea = $this->getData(THEME_LAYOUT);
|
||||
}
|
||||
else
|
||||
else // the old v1.x way.
|
||||
{
|
||||
$eMenuArea = $menu_data['menu_area'];
|
||||
$eMenuArea = $this->getDataLegacy();
|
||||
}
|
||||
|
||||
|
||||
$total = array();
|
||||
foreach($eMenuArea as $area => $val)
|
||||
{
|
||||
@@ -110,9 +100,146 @@ class e_menu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
e107::getRender()->eMenuTotal = $total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from v1.x e107_menu table to v2.x $pref format.
|
||||
*/
|
||||
function convertMenuTable()
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
|
||||
$sql->select('menus','*','menu_location !=0 ORDER BY menu_location,menu_order');
|
||||
$data = array();
|
||||
|
||||
while($row = $sql->fetch())
|
||||
{
|
||||
$layout = vartrue($row['menu_layout'],'default');
|
||||
$location = $row['menu_location'];
|
||||
$data[$layout][$location][] = array('name'=>$row['menu_name'],'class'=> intval($row['menu_class']),'path'=>$row['menu_path'],'pages'=>$row['menu_pages'],'parms'=>$row['menu_parms']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* V2 Menu Re-Write - retrieve Menu data from $pref['menu_layouts']
|
||||
*/
|
||||
protected function getData($layout)
|
||||
{
|
||||
$pref = e107::getPref('menu_layouts');
|
||||
|
||||
if(!varset($pref[$layout]))
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
foreach($pref[$layout] as $area=>$v);
|
||||
{
|
||||
$c = 1;
|
||||
|
||||
foreach($v as $val)
|
||||
{
|
||||
$class = intval($val['class']);
|
||||
|
||||
if(!check_class($class))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$ret[$area][] = array(
|
||||
'menu_id' => $c,
|
||||
'menu_name' => $val['name'],
|
||||
'menu_location' => $area,
|
||||
'menu_class' => $class,
|
||||
'menu_order' => $c,
|
||||
'menu_pages' => $val['pages'],
|
||||
'menu_path' => $val['path'],
|
||||
'menu_layout' => '',
|
||||
'menu_parms' => $val['parms']
|
||||
|
||||
);
|
||||
|
||||
$c++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @DEPRECATED
|
||||
* Legacy Function to retrieve Menu data from tables. - ie. the old v1.x method.
|
||||
*/
|
||||
private function getDataLegacy()
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$menu_layout_field = THEME_LAYOUT!=e107::getPref('sitetheme_deflayout') ? THEME_LAYOUT : "";
|
||||
|
||||
// e107::getCache()->CachePageMD5 = md5(e_LANGUAGE.$menu_layout_field); // Disabled by line 93 of Cache class.
|
||||
//FIXME add a function to the cache class for this.
|
||||
|
||||
$menu_data = e107::getCache()->retrieve_sys("menus_".USERCLASS_LIST."_".md5(e_LANGUAGE.$menu_layout_field));
|
||||
// $menu_data = e107::getCache()->retrieve_sys("menus_".USERCLASS_LIST);
|
||||
$menu_data = e107::getArrayStorage()->ReadArray($menu_data);
|
||||
|
||||
$eMenuArea = array();
|
||||
// $eMenuList = array();
|
||||
// $eMenuActive = array(); // DEPRECATED
|
||||
|
||||
|
||||
if(!is_array($menu_data))
|
||||
{
|
||||
$menu_qry = 'SELECT * FROM #menus WHERE menu_location > 0 AND menu_class IN ('.USERCLASS_LIST.') AND menu_layout = "'.$menu_layout_field.'" ORDER BY menu_location,menu_order';
|
||||
|
||||
if($sql->gen($menu_qry))
|
||||
{
|
||||
while($row = $sql->fetch())
|
||||
{
|
||||
$eMenuArea[$row['menu_location']][] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$menu_data['menu_area'] = $eMenuArea;
|
||||
|
||||
$menuData = e107::getArrayStorage()->WriteArray($menu_data, false);
|
||||
|
||||
// e107::getCache()->set_sys('menus_'.USERCLASS_LIST, $menuData);
|
||||
e107::getCache()->set_sys('menus_'.USERCLASS_LIST.'_'.md5(e_LANGUAGE.$menu_layout_field), $menuData);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$eMenuArea = $menu_data['menu_area'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $eMenuArea;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check visibility of a menu against URL
|
||||
*
|
||||
|
@@ -18,6 +18,10 @@ if (!defined('e107_INIT')) { exit; }
|
||||
/*
|
||||
* Type defines
|
||||
* XXX - convert to eMessage class constants
|
||||
* @note 07 May 2013: These have been converted to eMessage class constants!
|
||||
* Example: eMessage::E_MESSAGE_SUCCESS is 'success'
|
||||
* -- Deltik
|
||||
* P.S. Now somebody needs to get rid of these universal constants...
|
||||
*/
|
||||
define('E_MESSAGE_INFO', 'info');
|
||||
define('E_MESSAGE_SUCCESS', 'success');
|
||||
@@ -39,6 +43,17 @@ define('E_MESSAGE_NODISPLAY', 'nodisplay'); // Appears to be needed by update_ro
|
||||
*/
|
||||
class eMessage
|
||||
{
|
||||
/**
|
||||
* Type defines
|
||||
*/
|
||||
const E_INFO = 'info';
|
||||
const E_SUCCESS = 'success';
|
||||
const E_WARNING = 'warning';
|
||||
const E_ERROR = 'error';
|
||||
const E_DEBUG = 'debug';
|
||||
const E_NODISPLAY = 'nodisplay';
|
||||
|
||||
|
||||
/**
|
||||
* System Message Array
|
||||
* in format [type][message_stack] = array(message[, ...])
|
||||
@@ -172,7 +187,7 @@ class eMessage
|
||||
* @param boolean $session
|
||||
* @return eMessage
|
||||
*/
|
||||
public function add($message, $type = E_MESSAGE_INFO, $session = false)
|
||||
public function add($message, $type = eMessage::E_INFO, $session = false)
|
||||
{
|
||||
if(empty($message)) return $this;
|
||||
|
||||
|
@@ -3485,7 +3485,7 @@ class e_admin_tree_model extends e_front_tree_model
|
||||
$idstr = implode(', ', $ids);
|
||||
|
||||
$sql = e107::getDb();
|
||||
$res = $sql->db_Delete($this->getModelTable(), $this->getFieldIdName().' IN ('.$idstr.')');
|
||||
$res = $sql->db_Delete($this->getModelTable(), $this->getFieldIdName().' IN (\''.$idstr.'\')');
|
||||
$this->_db_errno = $sql->getLastErrorNumber();
|
||||
$this->_db_errmsg = $sql->getLastErrorText();
|
||||
$modelCacheCheck = $this->getParam('clearModelCache');
|
||||
@@ -3493,7 +3493,7 @@ class e_admin_tree_model extends e_front_tree_model
|
||||
{
|
||||
if($sql->getLastErrorNumber())
|
||||
{
|
||||
$this->addMessageError('SQL Delete Error', $session_messages); //TODO - Lan
|
||||
$this->addMessageError('SQL Delete Error: ' . $sql->getLastQuery(), $session_messages); //TODO - Lan
|
||||
$this->addMessageDebug('SQL Error #'.$sql->getLastErrorNumber().': '.$sql->getLastErrorText());
|
||||
}
|
||||
}
|
||||
|
@@ -38,8 +38,9 @@ if(file_exists(THEME.'banner_template.php'))
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once (e_THEME.'templates/banner_template.php');
|
||||
require_once (e_PLUGIN.'banner/banner_template.php');
|
||||
}
|
||||
|
||||
$menu_pref = e107::getConfig('menu')->getPref('');
|
||||
|
||||
if(isset($campaign))
|
||||
|
@@ -311,7 +311,7 @@ class private_message
|
||||
{
|
||||
$ret .= str_replace(array('--GOOD--', '--FAIL--'), $aCount, LAN_PM_71).'<br />';
|
||||
}
|
||||
$sq->delete('private_msg', 'pm_id = '.$pmid);
|
||||
$sql->delete('private_msg', 'pm_id = '.$pmid);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -174,6 +174,7 @@ $ADMIN_HEADER = '<div class="navbar '.$inverse.' navbar-fixed-top">
|
||||
{ADMIN_NAVIGATION=no-main}
|
||||
</div>
|
||||
<div class="dropdown nav pull-right navbar-text ">
|
||||
<li>{ADMIN_COREUPDATE=icon}</li>
|
||||
{ADMIN_PM}
|
||||
{ADMIN_NAVIGATION=home}
|
||||
{ADMIN_NAVIGATION=language}
|
||||
@@ -213,7 +214,9 @@ $ADMIN_HEADER .= '<div class="container-fluid">
|
||||
{SETSTYLE=none}
|
||||
|
||||
</div>
|
||||
<div class="span10" id="right-panel" >';
|
||||
<div class="span10" id="right-panel" >
|
||||
{ADMIN_COREUPDATE=alert}
|
||||
';
|
||||
|
||||
|
||||
$ADMIN_FOOTER = '
|
||||
|
@@ -778,7 +778,7 @@ function render_email($userInfo, $preview = FALSE)
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(e_THEME.'templates/email_template.php');
|
||||
require_once(e_CORE.'templates/email_template.php');
|
||||
}
|
||||
|
||||
/* Inline images now handled automatically - just include in email template with an absolute link
|
||||
|
Reference in New Issue
Block a user