mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Plugin Manager rewrite - finally using admin-ui.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -3525,7 +3525,7 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
if($qry && $sql->gen($qry, $debug))
|
if($qry && $sql->gen($qry, $debug))
|
||||||
{
|
{
|
||||||
while ($res = $sql->db_Fetch())
|
while ($res = $sql->fetch())
|
||||||
{
|
{
|
||||||
$tmp1 = array();
|
$tmp1 = array();
|
||||||
$tmp = array_values(preg_grep('#'.$srch.'#i', $res));
|
$tmp = array_values(preg_grep('#'.$srch.'#i', $res));
|
||||||
@@ -3860,12 +3860,18 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
$searchQry[] = $searchFilter;
|
$searchQry[] = $searchFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(E107_DEBUG_LEVEL == E107_DBG_SQLQUERIES)
|
||||||
|
{
|
||||||
|
e107::getMessage()->addDebug(print_a($searchQry,true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// main table should select everything
|
// main table should select everything
|
||||||
$tableSFieldsArr[] = $tablePath.'*';
|
$tableSFieldsArr[] = $tablePath.'*';
|
||||||
foreach($this->getFields() as $key => $var)
|
foreach($this->getFields() as $key => $var)
|
||||||
{
|
{
|
||||||
// disabled or system
|
// disabled or system
|
||||||
if((!empty($var['nolist']) && empty($var['filter'])) || empty($var['type']))
|
if((!empty($var['nolist']) && empty($var['filter'])) || empty($var['type']) || $var['data'] === false)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -3918,6 +3924,7 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
|
|
||||||
if(E107_DEBUG_LEVEL == E107_DBG_SQLQUERIES)
|
if(E107_DEBUG_LEVEL == E107_DBG_SQLQUERIES)
|
||||||
{
|
{
|
||||||
|
// e107::getDebug()->log(print_a($filter,true));
|
||||||
// e107::getMessage()->addInfo(print_a($filter,true));
|
// e107::getMessage()->addInfo(print_a($filter,true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5475,8 +5482,12 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function renderHelp()
|
public function renderHelp()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -192,7 +192,7 @@ class e_marketplace
|
|||||||
{
|
{
|
||||||
if(E107_DEBUG_LEVEL > 0)
|
if(E107_DEBUG_LEVEL > 0)
|
||||||
{
|
{
|
||||||
e107::getMessage()->addDebug("Calling e107.org using <b> ".$this->_adapter_name."</b> adapter");
|
e107::getDebug()->log("Calling e107.org using <b> ".$this->_adapter_name."</b> adapter");
|
||||||
}
|
}
|
||||||
return $this->adapter()->call($method, $data, $apply);
|
return $this->adapter()->call($method, $data, $apply);
|
||||||
}
|
}
|
||||||
@@ -227,6 +227,7 @@ class e_marketplace
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $data - e107.org plugin/theme feed data.
|
* @param $data - e107.org plugin/theme feed data.
|
||||||
|
* @return bool|string
|
||||||
*/
|
*/
|
||||||
public function getDownloadModal($type='plugin',$data)
|
public function getDownloadModal($type='plugin',$data)
|
||||||
{
|
{
|
||||||
@@ -234,6 +235,9 @@ class e_marketplace
|
|||||||
$url = false;
|
$url = false;
|
||||||
|
|
||||||
if($type === 'plugin')
|
if($type === 'plugin')
|
||||||
|
{
|
||||||
|
|
||||||
|
if(empty($data['plugin_id']))
|
||||||
{
|
{
|
||||||
|
|
||||||
$srcData = array(
|
$srcData = array(
|
||||||
@@ -243,13 +247,26 @@ class e_marketplace
|
|||||||
'plugin_mode' => $data['params']['mode'],
|
'plugin_mode' => $data['params']['mode'],
|
||||||
'plugin_url' => $data['url'],
|
'plugin_url' => $data['url'],
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$srcData = $data;
|
||||||
|
}
|
||||||
|
|
||||||
$d = http_build_query($srcData,false,'&');
|
$d = http_build_query($srcData,false,'&');
|
||||||
|
|
||||||
|
if(deftrue('e_DEBUG_PLUGMANAGER'))
|
||||||
|
{
|
||||||
|
$url = e_ADMIN.'plugin.php?mode=online&action=download&src='.base64_encode($d);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$url = e_ADMIN.'plugin.php?mode=download&src='.base64_encode($d);
|
$url = e_ADMIN.'plugin.php?mode=download&src='.base64_encode($d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if($type === 'theme')
|
if($type === 'theme')
|
||||||
{
|
{
|
||||||
$srcData = array(
|
$srcData = array(
|
||||||
|
@@ -4800,7 +4800,9 @@ class e_form
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return "<span class='label label-important label-danger'>Missing: ".$method."()</span>";
|
$className = get_class($this);
|
||||||
|
e107::getDebug()->log("Missing Method: ".$className."::".$meth." ".print_a($attributes,true));
|
||||||
|
return "<span class='label label-important label-danger'>Missing Method</span>";
|
||||||
}
|
}
|
||||||
// print_a($attributes);
|
// print_a($attributes);
|
||||||
// Inline Editing.
|
// Inline Editing.
|
||||||
|
@@ -71,7 +71,9 @@ class e_plugin
|
|||||||
|
|
||||||
public function clearCache()
|
public function clearCache()
|
||||||
{
|
{
|
||||||
e107::getCache()->clear(self::CACHETAG);
|
$this->init(true);
|
||||||
|
$this->initIDs();
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInstalled()
|
public function getInstalled()
|
||||||
@@ -90,6 +92,43 @@ class e_plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getCompat()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(isset($this->_data[$this->_plugdir]['@attributes']['compatibility']))
|
||||||
|
{
|
||||||
|
return $this->_data[$this->_plugdir]['@attributes']['compatibility'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInstallRequired()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(isset($this->_data[$this->_plugdir]['@attributes']['installRequired']))
|
||||||
|
{
|
||||||
|
return ($this->_data[$this->_plugdir]['@attributes']['installRequired'] === 'true') ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function getVersion()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(isset($this->_data[$this->_plugdir]['@attributes']['version']))
|
||||||
|
{
|
||||||
|
return $this->_data[$this->_plugdir]['@attributes']['version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getDate()
|
public function getDate()
|
||||||
{
|
{
|
||||||
if(isset($this->_data[$this->_plugdir]['@attributes']['date']))
|
if(isset($this->_data[$this->_plugdir]['@attributes']['date']))
|
||||||
@@ -100,21 +139,21 @@ class e_plugin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAuthor()
|
public function getAuthor($type='name')
|
||||||
{
|
{
|
||||||
if(!isset($this->_data[$this->_plugdir]['author']))
|
if(!isset($this->_data[$this->_plugdir]['author']['@attributes'][$type]))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return print_r($this->_data[$this->_plugdir]['author'],true);
|
return $this->_data[$this->_plugdir]['author']['@attributes'][$type];
|
||||||
|
|
||||||
return (string) $this->_data[$this->_plugdir]['author'];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getCategory()
|
public function getCategory()
|
||||||
{
|
{
|
||||||
if(!isset($this->_data[$this->_plugdir]['category']))
|
if(!isset($this->_data[$this->_plugdir]['category']))
|
||||||
@@ -163,7 +202,7 @@ class e_plugin
|
|||||||
return e107::getParser()->createConstants(e_PLUGIN_ABS.$this->_plugdir.'/'.$link[$key]);
|
return e107::getParser()->createConstants(e_PLUGIN_ABS.$this->_plugdir.'/'.$link[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "<img src='".e_PLUGIN_ABS.$this->_plugdir.'/'.$link[$key] ."' alt=\"".$caption."\" class='icon S".$size."' />";
|
return "<img src='".e_PLUGIN.$this->_plugdir.'/'.$link[$key] ."' alt=\"".$caption."\" class='icon S".$size."' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -185,7 +224,7 @@ class e_plugin
|
|||||||
|
|
||||||
public function getAdminUrl()
|
public function getAdminUrl()
|
||||||
{
|
{
|
||||||
if(isset($this->_data[$this->_plugdir]['administration']['configFile']))
|
if(!empty($this->_data[$this->_plugdir]['administration']['configFile']))
|
||||||
{
|
{
|
||||||
return e_PLUGIN_ABS.$this->_plugdir.'/'.$this->_data[$this->_plugdir]['administration']['configFile'];
|
return e_PLUGIN_ABS.$this->_plugdir.'/'.$this->_data[$this->_plugdir]['administration']['configFile'];
|
||||||
}
|
}
|
||||||
@@ -331,7 +370,8 @@ class e_plugin
|
|||||||
$ret['folder'] = $plugName; // remove the need for <folder> tag in plugin.xml.
|
$ret['folder'] = $plugName; // remove the need for <folder> tag in plugin.xml.
|
||||||
$ret['category'] = (isset($ret['category'])) ? $this->checkCategory($ret['category']) : "misc";
|
$ret['category'] = (isset($ret['category'])) ? $this->checkCategory($ret['category']) : "misc";
|
||||||
$ret['files'] = preg_grep('/^([^.])/', scandir(e_PLUGIN.$plugName,SCANDIR_SORT_ASCENDING));
|
$ret['files'] = preg_grep('/^([^.])/', scandir(e_PLUGIN.$plugName,SCANDIR_SORT_ASCENDING));
|
||||||
|
$ret['@attributes']['version'] = $this->_fixVersion($ret['@attributes']['version']);
|
||||||
|
$ret['@attributes']['compatibility'] = $this->_fixCompat($ret['@attributes']['compatibility']);
|
||||||
|
|
||||||
if(varset($ret['description']))
|
if(varset($ret['description']))
|
||||||
{
|
{
|
||||||
@@ -405,6 +445,8 @@ class e_plugin
|
|||||||
$eplug_latest = null;
|
$eplug_latest = null;
|
||||||
$eplug_icon = null;
|
$eplug_icon = null;
|
||||||
$eplug_icon_small = null;
|
$eplug_icon_small = null;
|
||||||
|
$eplug_compatible = null;
|
||||||
|
$eplug_version = null;
|
||||||
|
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
@@ -419,9 +461,9 @@ class e_plugin
|
|||||||
|
|
||||||
$ret['@attributes']['name'] = varset($eplug_name);
|
$ret['@attributes']['name'] = varset($eplug_name);
|
||||||
$ret['@attributes']['lan'] = varset($eplug_name);
|
$ret['@attributes']['lan'] = varset($eplug_name);
|
||||||
$ret['@attributes']['version'] = varset($eplug_version);
|
$ret['@attributes']['version'] = $this->_fixVersion($eplug_version);
|
||||||
$ret['@attributes']['date'] = varset($eplug_date);
|
$ret['@attributes']['date'] = varset($eplug_date);
|
||||||
$ret['@attributes']['compatibility'] = varset($eplug_compatible);
|
$ret['@attributes']['compatibility'] = $this->_fixCompat($eplug_compatible);
|
||||||
$ret['@attributes']['installRequired'] = ($eplug_conffile || is_array($eplug_table_names) || is_array($eplug_prefs) || $eplug_module || $eplug_userclass || $eplug_status || $eplug_latest) ? 'true' : '';
|
$ret['@attributes']['installRequired'] = ($eplug_conffile || is_array($eplug_table_names) || is_array($eplug_prefs) || $eplug_module || $eplug_userclass || $eplug_status || $eplug_latest) ? 'true' : '';
|
||||||
$ret['@attributes']['xhtmlcompliant'] = vartrue($eplug_compliant) ? 'true' : '';
|
$ret['@attributes']['xhtmlcompliant'] = vartrue($eplug_compliant) ? 'true' : '';
|
||||||
$ret['folder'] = $plugName; // (varset($eplug_folder)) ? $eplug_folder : $plugName;
|
$ret['folder'] = $plugName; // (varset($eplug_folder)) ? $eplug_folder : $plugName;
|
||||||
@@ -449,18 +491,22 @@ class e_plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// For BC.
|
// For BC.
|
||||||
$ret['administration']['icon'] = str_replace($plugName."/","",$eplug_icon);
|
$ret['administration']['icon'] = $this->_fixPath($eplug_icon,$plugName);
|
||||||
$ret['administration']['caption'] = varset($eplug_caption);
|
$ret['administration']['caption'] = varset($eplug_caption);
|
||||||
$ret['administration']['iconSmall'] = str_replace($plugName."/","",$eplug_icon_small);
|
$ret['administration']['iconSmall'] = $this->_fixPath($eplug_icon_small,$plugName);
|
||||||
$ret['administration']['configFile'] = varset($eplug_conffile);
|
$ret['administration']['configFile'] = varset($eplug_conffile);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(isset($eplug_conffile))
|
if(isset($eplug_conffile))
|
||||||
{
|
{
|
||||||
$ret['adminLinks']['link'][0]['@attributes']['url'] = varset($eplug_conffile);
|
$ret['adminLinks']['link'][0]['@attributes']['url'] = varset($eplug_conffile);
|
||||||
$ret['adminLinks']['link'][0]['@attributes']['description'] = LAN_CONFIGURE;
|
$ret['adminLinks']['link'][0]['@attributes']['description'] = LAN_CONFIGURE;
|
||||||
$ret['adminLinks']['link'][0]['@attributes']['icon'] = str_replace($plugName."/","",$eplug_icon);
|
$ret['adminLinks']['link'][0]['@attributes']['icon'] = $this->_fixPath($eplug_icon,$plugName); // str_replace($plugName."/","",$eplug_icon);
|
||||||
$ret['adminLinks']['link'][0]['@attributes']['iconSmall'] = str_replace($plugName."/","",$eplug_icon_small);
|
$ret['adminLinks']['link'][0]['@attributes']['iconSmall'] = $this->_fixPath($eplug_icon_small,$plugName);
|
||||||
$ret['adminLinks']['link'][0]['@attributes']['primary'] = 'true';
|
$ret['adminLinks']['link'][0]['@attributes']['primary'] = 'true';
|
||||||
}
|
}
|
||||||
if(!empty($eplug_link) && isset($eplug_link_name) && isset($eplug_link_url))
|
if(!empty($eplug_link) && isset($eplug_link_name) && isset($eplug_link_url))
|
||||||
@@ -484,6 +530,47 @@ class e_plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function _fixVersion($ver)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(empty($ver))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ver = str_replace('e107','',$ver);
|
||||||
|
|
||||||
|
|
||||||
|
return preg_replace('/([^\d\.])/','',$ver);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _fixCompat($ver)
|
||||||
|
{
|
||||||
|
$ver = $this->_fixVersion($ver);
|
||||||
|
$ver = str_replace('0.8','2.0',$ver);
|
||||||
|
if($ver == 7 || intval($ver) < 1)
|
||||||
|
{
|
||||||
|
$ver = "1.0";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ver;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function _fixPath($path, $plugName)
|
||||||
|
{
|
||||||
|
$pathFilter = array(
|
||||||
|
e_PLUGIN.$plugName.'/',
|
||||||
|
$plugName."/"
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
return str_replace($pathFilter,'', $path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private function checkCategory($cat)
|
private function checkCategory($cat)
|
||||||
{
|
{
|
||||||
if (!empty($cat) && in_array($cat, $this->_accepted_categories))
|
if (!empty($cat) && in_array($cat, $this->_accepted_categories))
|
||||||
|
@@ -1478,7 +1478,8 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ns = e107::getRender();
|
$ns = e107::getRender();
|
||||||
$ns->tablerender($title, $text, array('id'=>$id, 'style'=>'button_menu'));
|
$ns->setUniqueId($id);
|
||||||
|
$ns->tablerender($title, $text);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -96,7 +96,7 @@ class bootstrap3_admintheme
|
|||||||
|
|
||||||
echo "\n\n<!-- UniqueID: ".$data['uniqueId']." -->\n\n";
|
echo "\n\n<!-- UniqueID: ".$data['uniqueId']." -->\n\n";
|
||||||
echo "<!-- Style: ".$style." -->\n\n";
|
echo "<!-- Style: ".$style." -->\n\n";
|
||||||
echo "<!-- Mode: ".$mode." -->";
|
echo "<!-- Mode: ".(string) $mode." -->";
|
||||||
$class = '';
|
$class = '';
|
||||||
|
|
||||||
if(is_string($mode) && $mode == 'admin_help')
|
if(is_string($mode) && $mode == 'admin_help')
|
||||||
|
Reference in New Issue
Block a user