1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 12:20:44 +02:00

Fix for plugin repair (in debug mode) Fix for Login page signup link when registration is disabled.

This commit is contained in:
Cameron
2016-04-30 12:02:02 -07:00
parent d3383a71b6
commit d098589456
5 changed files with 69 additions and 25 deletions

View File

@@ -164,7 +164,7 @@ class pluginmanager_form extends e_form
if ($this->plug['plugin_installflag'] && e_DEBUG == true) if ($this->plug['plugin_installflag'] && e_DEBUG == true)
{ {
$text .= "<a class='btn btn-default' href='".e_SELF."?refresh.".$this->plug['plugin_id']."' title='".'Repair plugin settings'."'> ".ADMIN_REPAIRPLUGIN_ICON."</a>"; $text .= "<a class='btn btn-default' href='".e_SELF."?repair.".$this->plug['plugin_id']."' title='".'Repair plugin settings'."'> ".ADMIN_REPAIRPLUGIN_ICON."</a>";
} }
@@ -344,6 +344,12 @@ class pluginManager{
$this -> pluginUninstall(); $this -> pluginUninstall();
$this -> pluginCheck(true); // forced $this -> pluginCheck(true); // forced
} }
if($this->action == "repair")
{
$this -> pluginRepair();
$this->action = 'refresh';
}
if($this->action == "refresh") if($this->action == "refresh")
{ {
@@ -376,10 +382,8 @@ class pluginManager{
$this -> action = "installed"; $this -> action = "installed";
} }
if($this->action == "refresh")
{
$this -> pluginRefresh();
}
if($this->action == "upload") if($this->action == "upload")
{ {
$this -> pluginUpload(); $this -> pluginUpload();
@@ -1084,9 +1088,9 @@ class pluginManager{
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
function pluginRefresh() function pluginRepair()
{ {
global $plug; // global $plug;
$plug = e107::getSingleton('e107plugin')->getinfo($this->id); $plug = e107::getSingleton('e107plugin')->getinfo($this->id);
@@ -2345,7 +2349,10 @@ class pluginBuilder
{ {
$createData = str_replace("`".MPREFIX, '`', $data[1]); $createData = str_replace("`".MPREFIX, '`', $data[1]);
$createData .= ";"; $createData .= ";";
file_put_contents($file,$createData); if(!file_exists($file))
{
file_put_contents($file,$createData);
}
} }
} }
@@ -2567,9 +2574,17 @@ class pluginBuilder
if($content = file_get_contents($source)) if($content = file_get_contents($source))
{ {
$content = str_replace($srch, $this->pluginName, $content); $content = str_replace($srch, $this->pluginName, $content);
if(file_put_contents($destination,$content))
if(!file_exists($destination))
{ {
$result[] = LAN_CREATED." : ".$addon; if(file_put_contents($destination,$content))
{
$result[] = LAN_CREATED." : ".$addon;
}
}
else
{
$result[] = "Skipped (already exists) : ".$addon;
} }
} }
else else

View File

@@ -180,16 +180,15 @@ class login_shortcodes extends e_shortcode
function sc_login_table_signup_link($parm='') function sc_login_table_signup_link($parm='')
{ {
if(empty($this->userReg)) if($this->userReg === 1)
{ {
return null; return "<a href='".e_SIGNUP."'>".LAN_LOGIN_11."</a>";
} }
return "<a href='".e_SIGNUP."'>".LAN_LOGIN_11."</a>"; return null;
} }
function sc_login_table_fpw_link($parm='') function sc_login_table_fpw_link($parm='')
{ {
if(empty($this->userReg)) if(empty($this->userReg))

View File

@@ -1423,6 +1423,8 @@ class e107plugin
$mes = e107::getMessage(); $mes = e107::getMessage();
$event = e107::getEvent(); $event = e107::getEvent();
$mes->addDebug("Running ".$function);
$error = array(); // Array of error messages $error = array(); // Array of error messages
$canContinue = TRUE; // Clear flag if must abort part way through $canContinue = TRUE; // Clear flag if must abort part way through
@@ -1563,7 +1565,7 @@ class e107plugin
$this->XmlAdminLinks($function, $plug_vars['adminLinks']); $this->XmlAdminLinks($function, $plug_vars['adminLinks']);
} }
if (varset($plug_vars['siteLinks'])) if (!empty($plug_vars['siteLinks']))
{ {
$this->XmlSiteLinks($function, $plug_vars); $this->XmlSiteLinks($function, $plug_vars);
} }
@@ -2024,8 +2026,13 @@ class e107plugin
{ {
return; return;
} }
// print_a($plug_vars); if($function == 'refresh')
{
$mes->addDebug("Checking Plugin Site-links");
$mes->addDebug(print_a($plug_vars['siteLinks'],true));
}
$array = $plug_vars['siteLinks']; $array = $plug_vars['siteLinks'];
@@ -2050,9 +2057,17 @@ class e107plugin
{ {
case 'upgrade': case 'upgrade':
case 'install': case 'install':
case 'refresh':
if (!$remove) // Add any non-deprecated link if (!$remove) // Add any non-deprecated link
{ {
if($function == 'refresh')
{
$perm = 'nobody';
}
$result = $this->manage_link('add', $url, $linkName, $perm, $options); $result = $this->manage_link('add', $url, $linkName, $perm, $options);
if($result !== NULL) if($result !== NULL)
{ {
@@ -2068,8 +2083,6 @@ class e107plugin
} }
break; break;
case 'refresh': // Probably best to leave well alone
break;
case 'uninstall': //remove all links case 'uninstall': //remove all links
@@ -2705,14 +2718,17 @@ class e107plugin
if (file_exists($_path.'plugin.xml')) if (file_exists($_path.'plugin.xml'))
{ {
$text = $this->install_plugin_xml($plug, 'refresh'); $this->install_plugin_xml($plug, 'refresh');
} }
else else
{ {
e107::getMessage()->addDebug("Missing xml file at : ".$_path."plugin.xml");
$text = EPL_ADLAN_21; $text = EPL_ADLAN_21;
} }
e107::getMessage()->addDebug("Running Refresh of ".$_path);
$this->save_addon_prefs(); $this->save_addon_prefs();
return $text; return $text;

View File

@@ -838,14 +838,16 @@ class e_parse_shortcode
// XXX remove all globals, $sc_style removed // XXX remove all globals, $sc_style removed
global $pref, $e107cache, $menu_pref, $parm, $sql; global $pref, $e107cache, $menu_pref, $parm, $sql;
$parmArray = false; $parmArray = false;
$fullShortcodeKey = null; $fullShortcodeKey = null;
$noDebugLog = false;
if ($this->eVars) if ($this->eVars)
{ {
if ($this->eVars->isVar($matches[1])) if ($this->eVars->isVar($matches[1]))
{ {
$match1 = $matches[1]; // php7 fix. $match1 = $matches[1]; // php7 fix.
// e107::getDebug()->log("Using eVars ".$match1);
return $this->eVars->$match1; return $this->eVars->$match1;
} }
} }
@@ -923,6 +925,7 @@ class e_parse_shortcode
{ {
$debugArr = array('class_original'=>get_class($this->addedCodes), 'class_override'=>$this->addonOverride[$_method], 'function'=>$_method); $debugArr = array('class_original'=>get_class($this->addedCodes), 'class_override'=>$this->addonOverride[$_method], 'function'=>$_method);
e107::getDebug()->logCode(4, $code, null, print_a($debugArr,true)); e107::getDebug()->logCode(4, $code, null, print_a($debugArr,true));
$noDebugLog = true;
} }
@@ -1201,7 +1204,7 @@ class e_parse_shortcode
$sql->db_Mark_Time("(After SC {$code})"); $sql->db_Mark_Time("(After SC {$code})");
} }
if (E107_DBG_BBSC || E107_DBG_SC || E107_DBG_TIMEDETAILS) if (($noDebugLog != true) && (E107_DBG_BBSC || E107_DBG_SC || E107_DBG_TIMEDETAILS))
{ {
global $db_debug; global $db_debug;

View File

@@ -13,12 +13,23 @@
class theme_shortcodes extends e_shortcode class theme_shortcodes extends e_shortcode
{ {
public $override = true;
function __construct() function __construct()
{ {
} }
function sc_news_summary()
{
$sc = e107::getScBatch('news');
$data = $sc->getScVar('news_item');
return "<span class='label label-danger'>".e107::getParser()->toHTML($data['news_summary'],'BODY')."</span>";
}
function sc_bootstrap_branding() function sc_bootstrap_branding()
{ {
$pref = e107::pref('theme', 'branding'); $pref = e107::pref('theme', 'branding');