mirror of
https://github.com/e107inc/e107.git
synced 2025-01-29 10:38:08 +01:00
Plugin Manager rewrite - finally using admin-ui.
This commit is contained in:
parent
372141dddf
commit
3a81c1097a
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();
|
||||
if($qry && $sql->gen($qry, $debug))
|
||||
{
|
||||
while ($res = $sql->db_Fetch())
|
||||
while ($res = $sql->fetch())
|
||||
{
|
||||
$tmp1 = array();
|
||||
$tmp = array_values(preg_grep('#'.$srch.'#i', $res));
|
||||
@ -3860,12 +3860,18 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
$searchQry[] = $searchFilter;
|
||||
}
|
||||
|
||||
if(E107_DEBUG_LEVEL == E107_DBG_SQLQUERIES)
|
||||
{
|
||||
e107::getMessage()->addDebug(print_a($searchQry,true));
|
||||
}
|
||||
|
||||
|
||||
// main table should select everything
|
||||
$tableSFieldsArr[] = $tablePath.'*';
|
||||
foreach($this->getFields() as $key => $var)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
@ -3918,7 +3924,8 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
|
||||
if(E107_DEBUG_LEVEL == E107_DBG_SQLQUERIES)
|
||||
{
|
||||
// e107::getMessage()->addInfo(print_a($filter,true));
|
||||
// e107::getDebug()->log(print_a($filter,true));
|
||||
// e107::getMessage()->addInfo(print_a($filter,true));
|
||||
}
|
||||
|
||||
if($isfilter)
|
||||
@ -5475,8 +5482,12 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function renderHelp()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5962,7 +5973,7 @@ class e_admin_form_ui extends e_form
|
||||
|
||||
// if going through confirm screen - no JS confirm
|
||||
$controller->setFieldAttr('options', 'noConfirm', $controller->deleteConfirmScreen);
|
||||
|
||||
|
||||
$this->listTotal = $tree[$id]->getTotal();
|
||||
|
||||
|
||||
|
@ -192,7 +192,7 @@ class e_marketplace
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -227,6 +227,7 @@ class e_marketplace
|
||||
|
||||
/**
|
||||
* @param $data - e107.org plugin/theme feed data.
|
||||
* @return bool|string
|
||||
*/
|
||||
public function getDownloadModal($type='plugin',$data)
|
||||
{
|
||||
@ -236,18 +237,34 @@ class e_marketplace
|
||||
if($type === 'plugin')
|
||||
{
|
||||
|
||||
$srcData = array(
|
||||
'plugin_id' => $data['params']['id'],
|
||||
'plugin_folder' => $data['folder'],
|
||||
'plugin_price' => $data['price'],
|
||||
'plugin_mode' => $data['params']['mode'],
|
||||
'plugin_url' => $data['url'],
|
||||
);
|
||||
|
||||
if(empty($data['plugin_id']))
|
||||
{
|
||||
|
||||
$srcData = array(
|
||||
'plugin_id' => $data['params']['id'],
|
||||
'plugin_folder' => $data['folder'],
|
||||
'plugin_price' => $data['price'],
|
||||
'plugin_mode' => $data['params']['mode'],
|
||||
'plugin_url' => $data['url'],
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$srcData = $data;
|
||||
}
|
||||
|
||||
$d = http_build_query($srcData,false,'&');
|
||||
$url = e_ADMIN.'plugin.php?mode=download&src='.base64_encode($d);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($type === 'theme')
|
||||
|
@ -4782,7 +4782,7 @@ class e_form
|
||||
break;
|
||||
|
||||
case 'method': // Custom Function
|
||||
$method = $attributes['field']; // prevents table alias in method names. ie. u.my_method.
|
||||
$method = $attributes['field']; // prevents table alias in method names. ie. u.my_method.
|
||||
$_value = $value;
|
||||
|
||||
if(!empty($attributes['data']) && $attributes['data'] == 'array') // FIXME @SecretR - please move this to where it should be.
|
||||
@ -4800,7 +4800,9 @@ class e_form
|
||||
}
|
||||
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);
|
||||
// Inline Editing.
|
||||
|
@ -71,7 +71,9 @@ class e_plugin
|
||||
|
||||
public function clearCache()
|
||||
{
|
||||
e107::getCache()->clear(self::CACHETAG);
|
||||
$this->init(true);
|
||||
$this->initIDs();
|
||||
return $this;
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
if(isset($this->_data[$this->_plugdir]['@attributes']['date']))
|
||||
@ -100,21 +139,21 @@ class e_plugin
|
||||
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 print_r($this->_data[$this->_plugdir]['author'],true);
|
||||
|
||||
return (string) $this->_data[$this->_plugdir]['author'];
|
||||
return $this->_data[$this->_plugdir]['author']['@attributes'][$type];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function getCategory()
|
||||
{
|
||||
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 "<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()
|
||||
{
|
||||
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'];
|
||||
}
|
||||
@ -331,7 +370,8 @@ class e_plugin
|
||||
$ret['folder'] = $plugName; // remove the need for <folder> tag in plugin.xml.
|
||||
$ret['category'] = (isset($ret['category'])) ? $this->checkCategory($ret['category']) : "misc";
|
||||
$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']))
|
||||
{
|
||||
@ -405,6 +445,8 @@ class e_plugin
|
||||
$eplug_latest = null;
|
||||
$eplug_icon = null;
|
||||
$eplug_icon_small = null;
|
||||
$eplug_compatible = null;
|
||||
$eplug_version = null;
|
||||
|
||||
|
||||
ob_start();
|
||||
@ -419,9 +461,9 @@ class e_plugin
|
||||
|
||||
$ret['@attributes']['name'] = 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']['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']['xhtmlcompliant'] = vartrue($eplug_compliant) ? 'true' : '';
|
||||
$ret['folder'] = $plugName; // (varset($eplug_folder)) ? $eplug_folder : $plugName;
|
||||
@ -449,18 +491,22 @@ class e_plugin
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 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']['iconSmall'] = str_replace($plugName."/","",$eplug_icon_small);
|
||||
$ret['administration']['iconSmall'] = $this->_fixPath($eplug_icon_small,$plugName);
|
||||
$ret['administration']['configFile'] = varset($eplug_conffile);
|
||||
|
||||
|
||||
|
||||
if(isset($eplug_conffile))
|
||||
{
|
||||
$ret['adminLinks']['link'][0]['@attributes']['url'] = varset($eplug_conffile);
|
||||
$ret['adminLinks']['link'][0]['@attributes']['description'] = LAN_CONFIGURE;
|
||||
$ret['adminLinks']['link'][0]['@attributes']['icon'] = str_replace($plugName."/","",$eplug_icon);
|
||||
$ret['adminLinks']['link'][0]['@attributes']['iconSmall'] = str_replace($plugName."/","",$eplug_icon_small);
|
||||
$ret['adminLinks']['link'][0]['@attributes']['icon'] = $this->_fixPath($eplug_icon,$plugName); // str_replace($plugName."/","",$eplug_icon);
|
||||
$ret['adminLinks']['link'][0]['@attributes']['iconSmall'] = $this->_fixPath($eplug_icon_small,$plugName);
|
||||
$ret['adminLinks']['link'][0]['@attributes']['primary'] = 'true';
|
||||
}
|
||||
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)
|
||||
{
|
||||
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->tablerender($title, $text, array('id'=>$id, 'style'=>'button_menu'));
|
||||
$ns->setUniqueId($id);
|
||||
$ns->tablerender($title, $text);
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class bootstrap3_admintheme
|
||||
|
||||
echo "\n\n<!-- UniqueID: ".$data['uniqueId']." -->\n\n";
|
||||
echo "<!-- Style: ".$style." -->\n\n";
|
||||
echo "<!-- Mode: ".$mode." -->";
|
||||
echo "<!-- Mode: ".(string) $mode." -->";
|
||||
$class = '';
|
||||
|
||||
if(is_string($mode) && $mode == 'admin_help')
|
||||
|
Loading…
x
Reference in New Issue
Block a user