1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

BC Fixes for download installation, sitelinks expanding menus, bbcode image sizes.

This commit is contained in:
Cameron 2014-01-20 06:20:58 -08:00
parent c0ea76bbe6
commit 6577f6d380
5 changed files with 105 additions and 86 deletions

View File

@ -593,13 +593,13 @@ function update_706_to_800($type='')
$just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing whether an update is needed
if (!$just_check)
{
foreach(vartrue($setCorePrefs) as $k=>$v)
{
$pref[$k] = $v;
}
}
// if (!$just_check)
// {
// foreach(vartrue($setCorePrefs) as $k=>$v)
// {
// $pref[$k] = $v;
// }
// }
if (!$just_check)
{
@ -859,62 +859,6 @@ function update_706_to_800($type='')
$do_save = TRUE;
}
/*
* Deprecated by db-verify-class
*
if ($sql->db_Table_exists('newsfeed'))
{ // Need to extend field newsfeed_url varchar(250) NOT NULL default ''
if ($sql->db_Query("SHOW FIELDS FROM ".MPREFIX."newsfeed LIKE 'newsfeed_url'"))
{
$row = $sql -> db_Fetch();
if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(250)')
{
if ($just_check) return update_needed('Update newsfeed field definition');
$status = $sql->gen("ALTER TABLE `".MPREFIX."newsfeed` MODIFY `newsfeed_url` VARCHAR(250) NOT NULL DEFAULT '' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
//$updateMessages[] = LAN_UPDATE_40;
$log->logMessage(LAN_UPDATE_21."newsfeed",$status);
// catch_error($sql);
}
}
}
//TODO use generic function for this update.
if ($sql->db_Table_exists('download'))
{ // Need to extend field download_url varchar(255) NOT NULL default ''
if ($sql->db_Query("SHOW FIELDS FROM ".MPREFIX."download LIKE 'download_url'"))
{
$row = $sql -> db_Fetch();
if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(255)')
{
if ($just_check) return update_needed('Update download table field definition');
$sql->gen("ALTER TABLE `#download` MODIFY `download_url` VARCHAR(255) NOT NULL DEFAULT '' ");
//$updateMessages[] = LAN_UPDATE_52; //FIXME
$log->logMessage(LAN_UPDATE_52, E_MESSAGE_SUCCESS);
catch_error($sql);
}
}
}
//TODO use generic function for this update.
if ($sql->db_Table_exists('download_mirror'))
{ // Need to extend field download_url varchar(255) NOT NULL default ''
if ($sql->gen("SHOW FIELDS FROM ".MPREFIX."download_mirror LIKE 'mirror_url'"))
{
$row = $sql -> db_Fetch();
if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(255)')
{
if ($just_check) return update_needed('Update download mirror table field definition');
$sql->gen("ALTER TABLE `".MPREFIX."download_mirror` MODIFY `mirror_url` VARCHAR(255) NOT NULL DEFAULT '' ");
$log->logMessage(LAN_UPDATE_53, E_MESSAGE_SUCCESS);
catch_error($sql);
}
}
}
*/
// Check need for user timezone before we delete the field
if (varsettrue($pref['signup_option_timezone']))
{
@ -1404,8 +1348,19 @@ function update_706_to_800($type='')
// -------------------------------
if (!e107::isInstalled('download') && $sql->gen("SELECT * FROM #links WHERE link_url LIKE 'download.php%' AND link_class != '".e_UC_NOBODY."' LIMIT 1"))
{
if ($just_check) return update_needed('Download Plugin needs to be installed.');
e107::getSingleton('e107plugin')->install('download',array('nolinks'=>true));
}
// ---------------------------------
$med = e107::getMedia();
// Media Category Update

View File

@ -136,8 +136,8 @@ class bb_img extends e_bb_base
$w = e107::getBB()->resizeWidth(); // varies depending on the class set by external script. see admin->media-manager->prefs
$h = e107::getBB()->resizeHeight();
if(strpos($code_text,"://")==false && ($w || $h)) // local file.
// No resizing on v1.x legacy images.
if(strpos($code_text,"://")==false && ($w || $h) && strpos($code_text,"{e_IMAGE}custom")===false && strpos($code_text,"{e_IMAGE}newpost_images")===false) // local file.
{
$code_text = $tp->thumbUrl($code_text,'w='.$w.'&h='.$h);
}

View File

@ -108,15 +108,16 @@ class e107plugin
var $plug_vars;
var $current_plug;
var $parsed_plugin;
var $parsed_plugin = array();
var $plugFolder;
var $plugConfigFile;
var $unInstallOpts;
var $module = array();
private $options = array();
function e107plugin()
function __construct()
{
$parsed_plugin = array();
//$parsed_plugin = array();
}
/**
@ -497,10 +498,15 @@ class e107plugin
$getinfo_results = array();
}
$path = (!is_numeric($id)) ? $id : false;
$id = (int) $id;
$qry = "plugin_id = ".$id;
$qry .= ($path != false) ? " OR plugin_path = '".$path."' " : "";
if (!isset($getinfo_results[$id]) || $force == true)
{
if ($sql->select('plugin', '*', "plugin_id = ".$id))
if ($sql->select('plugin', '*', $qry))
{
$getinfo_results[$id] = $sql->fetch();
}
@ -1296,11 +1302,7 @@ class e107plugin
*/
function install_plugin_xml($id, $function = '', $options = FALSE)
{
if(!is_numeric($id))
{
$id = $this->getId($id); // use path instead.
}
$pref = e107::getPref();
$sql = e107::getDb();
$mes = e107::getMessage();
@ -1308,9 +1310,20 @@ class e107plugin
$error = array(); // Array of error messages
$canContinue = TRUE; // Clear flag if must abort part way through
$id = (int) $id;
$plug = $this->getinfo($id); // Get plugin info from DB
if(is_array($id))
{
$plug = $id;
$id = $plug['plugin_id'];
}
else
{
$id = (int) $id;
$plug = $this->getinfo($id); // Get plugin info from DB
}
$this->current_plug = $plug;
$txt = '';
$path = e_PLUGIN.$plug['plugin_path'].'/';
@ -1779,6 +1792,12 @@ class e107plugin
function XmlSiteLinks($function, $array)
{
$mes = e107::getMessage();
if(vartrue($this->options['nolinks']))
{
return;
}
foreach ($array['link'] as $link)
{
@ -2268,7 +2287,16 @@ class e107plugin
$mes = e107::getMessage();
$mySQLprefix = MPREFIX; // Fix for some plugin.php files.
$plug = $this->getinfo($id);
if(is_array($id))
{
$plug = $id;
$id = $plug['plugin_id'];
}
else
{
$plug = $this->getinfo($id);
}
$_path = e_PLUGIN.$plug['plugin_path'].'/';
$plug['plug_action'] = 'install';
@ -2357,40 +2385,64 @@ class e107plugin
}
/**
* Installs a plugin by ID
* BC Alias for install();
*/
public function install_plugin($id)
{
global $sysprefs, $mySQLprefix;
return $this->install($id);
}
/**
* Installs a plugin by ID or folder name
*
* @param int $id
* @param array $options (currently only 'nolinks' - set to true to prevent sitelink creation during install)
*/
function install_plugin($id)
function install($id, $options = array())
{
global $sysprefs, $mySQLprefix;
$ns = e107::getRender();
$sql = e107::getDb();
$tp = e107::getParser();
$this->options = $options;
$text = '';
// install plugin ...
$id = (int) $id;
$plug = $this->getinfo($id);
if(!is_array($plug))
{
return "'{$id}' is missing from the plugin db table";
}
$plug['plug_action'] = 'install';
if (!vartrue($plug['plugin_installflag']))
{
$_path = e_PLUGIN.$plug['plugin_path'].'/';
if (file_exists($_path.'plugin.xml'))
{
$text = $this->install_plugin_xml($id, 'install');
$text = $this->install_plugin_xml($plug, 'install');
}
elseif (file_exists($_path.'plugin.php'))
{
$text = $this->install_plugin_php($id);
$text = $this->install_plugin_php($plug);
}
}
else
{
$text = EPL_ADLAN_21;
}
return $text;
}

View File

@ -24,8 +24,11 @@ class rater {
// return "Table=".$table." itmeId=".$id." Votes=".$votes." score=".$score;
parse_str($options,$options);
//
if(is_string($options))
{
parse_str($options,$options);
}
$label = varset($options['label'],RATELAN_5);
$readonly = $this->checkrated($table, $id) ? '1' : '0';

View File

@ -280,6 +280,14 @@ class sitelinks
$linkInfo['link_url'] = $tp->parseTemplate($linkInfo['link_url'], TRUE); // shortcode in URL support - dynamic urls for multilanguage.
}
// By default links are not highlighted.
if (isset($linkInfo['link_expand']) && $linkInfo['link_expand'])
{
// $href = " href=\"javascript:expandit('sub_".$linkInfo['link_id']."')\"";
$css_class .= " e-expandit";
}
$linkstart = $style['linkstart'];
$linkadd = ($style['linkclass']) ? " class='".$style['linkclass']."'" : "";
$linkadd = ($css_class) ? " class='".$css_class."'" : $linkadd;
@ -293,7 +301,8 @@ class sitelinks
// Check if its expandable first. It should override its URL.
if (isset($linkInfo['link_expand']) && $linkInfo['link_expand'])
{
$href = " href=\"javascript:expandit('sub_".$linkInfo['link_id']."')\"";
// $href = " href=\"javascript:expandit('sub_".$linkInfo['link_id']."')\"";
$href = "href='#sub_".$linkInfo['link_id']."'";
}
elseif ($linkInfo['link_url'])
{