1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

link_owner now populated during plugin installation.

This commit is contained in:
Cameron 2015-02-06 00:14:55 -08:00
parent 7b1368b276
commit 7a43f181c1
2 changed files with 25 additions and 10 deletions

View File

@ -942,9 +942,11 @@ class e107plugin
'link_parent' => '0',
'link_open' => '0',
'link_class' => vartrue($linkclass,'0'),
'link_function' => (vartrue($options['link_function']) ? $this->plugFolder ."::".$options['link_function'] : "")
'link_function' => (vartrue($options['link_function']) ? $this->plugFolder ."::".$options['link_function'] : ""),
'link_sefurl' => vartrue($options['link_sef']),
'link_owner' => vartrue($options['link_owner'])
);
return $sql->insert('links', $linkData); // TODO: Add the _FIELD_DEFS array
return $sql->insert('links', $linkData);
}
else
{
@ -952,7 +954,14 @@ class e107plugin
}
}
if ($action == 'remove')
{ // Look up by URL if we can - should be more reliable. Otherwise try looking up by name (as previously)
{
//v2.x
if(vartrue($options['link_owner']) && $sql->select('links', 'link_id', "link_owner = '".$options['link_owner']."'"))
{
return $sql->delete('links', "link_owner = '".$options['link_owner']."' ");
}
// Look up by URL if we can - should be more reliable. Otherwise try looking up by name (as previously)
if (($path && $sql->select('links', 'link_id,link_order', "link_url = '{$path}'")) || $sql->select('links', 'link_id,link_order', "link_name = '{$link_name}'"))
{
$row = $sql->fetch();
@ -1517,7 +1526,7 @@ class e107plugin
if (varset($plug_vars['siteLinks']))
{
$this->XmlSiteLinks($function, $plug_vars['siteLinks']);
$this->XmlSiteLinks($function, $plug_vars);
}
if (varset($plug_vars['mainPrefs'])) //Core pref items <mainPrefs>
@ -1883,7 +1892,7 @@ class e107plugin
* @param array $array
* @return none
*/
function XmlSiteLinks($function, $array)
function XmlSiteLinks($function, $plug_vars)
{
$mes = e107::getMessage();
@ -1892,6 +1901,9 @@ class e107plugin
return;
}
// print_a($plug_vars);
$array = $plug_vars['siteLinks'];
foreach ($array['link'] as $link)
{
@ -1900,9 +1912,12 @@ class e107plugin
$remove = (varset($attrib['deprecate']) == 'true') ? TRUE : FALSE;
$url = vartrue($attrib['url']);
$perm = vartrue($attrib['perm'],'everyone');
$sef = vartrue($attrib['sef']);
$options = array(
'link_function'=>vartrue($attrib['function'])
'link_function' => vartrue($attrib['function']),
'link_owner' => vartrue($plug_vars['folder']),
'link_sef' => $sef
);
switch ($function)
@ -1932,7 +1947,7 @@ class e107plugin
case 'uninstall': //remove all links
$status = ($this->manage_link('remove', $url, $linkName)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$status = ($this->manage_link('remove', $url, $linkName, $perm, $options)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Removing Link: {$linkName} with url [{$url}]", $status);
break;
}
@ -2473,7 +2488,7 @@ class e107plugin
if (varset($plug_vars['siteLinks']))
{
$this->XmlSiteLinks($function, $plug_vars['siteLinks']);
$this->XmlSiteLinks($function, $plug_vars);
}
if (varset($plug_vars['userClasses']))

View File

@ -14,7 +14,7 @@
<link url="admin_config.php?mode=options" description="Configure Blank Prefs" icon="manage" >Blank Prefs</link>
</adminLinks>
<siteLinks>
<link url="{e_PLUGIN}_blank/_blank.php" perm='everyone'>LAN_PLUGIN__BLANK_LINK</link>
<link url="{e_PLUGIN}_blank/_blank.php" perm='everyone' sef='blank-plugin'>LAN_PLUGIN__BLANK_LINK</link>
</siteLinks>
<pluginPrefs>
<pref name="blank_pref_1">1</pref>