1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-15 10:02:02 +02:00

MySQL error message fix. Custom Page userclass fix. Media-manager import fix for files contained '%'. XML DB export fix. Other News custom caption fix. FB Like menu without app_id fix.

This commit is contained in:
Cameron 2016-05-30 15:19:19 -07:00
parent 6da6065ac5
commit 60f1d78dce
9 changed files with 88 additions and 18 deletions

View File

@ -484,7 +484,7 @@ class page_admin_ui extends e_admin_ui
// Options Tab.
'page_datestamp' => array('title'=> LAN_DATE, 'tab' => 1, 'type' => 'datestamp', 'data'=>'int', 'width' => 'auto','writeParms'=>'auto=1&type=datetime'),
'page_class' => array('title'=> LAN_VISIBILITY, 'tab' => 1, 'type' => 'userclass', 'data'=>'int', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true),
'page_class' => array('title'=> LAN_VISIBILITY, 'tab' => 1, 'type' => 'userclass', 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true),
'page_rating_flag' => array('title'=> LAN_RATING, 'tab' => 1, 'type' => 'boolean', 'data'=>'int', 'width' => '5%', 'thclass' => 'center', 'class' => 'center' ),
'page_comment_flag' => array('title'=> LAN_COMMENTS, 'tab' => 1, 'type' => 'boolean', 'data'=>'int', 'width' => '5%', 'thclass' => 'center', 'class' => 'center' ),
'page_password' => array('title'=> LAN_PASSWORD, 'tab' => 1, 'type' => 'text', 'data'=>'str', 'width' => 'auto', 'writeParms'=>array('password'=>1, 'nomask'=>1, 'size' => 40, 'class' => 'tbox e-password', 'generate' => 1, 'strength' => 1, 'required'=>0)),
@ -562,7 +562,7 @@ class page_admin_ui extends e_admin_ui
'menu_name' => array('title'=> CUSLAN_64, 'type' => 'text', 'inline'=>false, 'width' => '10%','nolist'=>false, "help"=>"Will be listed in the Menu-Manager under this name. Must use ASCII characters only."),
'menu_template' => array('title'=> CUSLAN_67, 'type' => 'dropdown', 'width' => '15%', 'filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
'menu_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'data'=>'int', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true),
'menu_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true),
// 'page_author' => array('title'=> LAN_AUTHOR, 'tab' => 0, 'type' => 'user', 'data'=>'int','width' => 'auto', 'thclass' => 'left'),
'page_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data'=>'int', 'width' => 'auto','writeParms'=>'auto=1&readonly=1'),

View File

@ -1639,6 +1639,7 @@ function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE)
{
$xml->convertFilePaths = TRUE;
$xml->modifiedPrefsOnly = true;
$xml->filePathDestination = EXPORT_PATH;
$xml->filePathPrepend = array(
'news_thumbnail' => "{e_IMAGE}newspost_images/"
@ -1669,7 +1670,7 @@ function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE)
{
$mes->add(DBLAN_109." ".$newfile, E_MESSAGE_SUCCESS);
}
else
elseif(!file_exists($newfile))
{
$mes->add(DBLAN_110." ".$newfile, E_MESSAGE_ERROR);
}

View File

@ -1632,6 +1632,9 @@ class media_admin_ui extends e_admin_ui
list($fileName,$bla) = explode("?", $fileName);
}
$fileName = str_replace('%','',$fileName);
// remove script extensions.
if(substr($fileName,-4) == ".php" || substr($fileName,-4) == ".htm" || substr($fileName,-5) == ".html" || substr($fileName,-4) == ".asp")
{

View File

@ -188,7 +188,8 @@ class e_db_mysql
catch(PDOException $ex)
{
$this->mySQLlastErrText = $ex->getMessage();
// echo "<pre>".print_r($ex,true)."</pre>"; // Useful for Debug.
$this->mySQLlastErrNum = $ex->getCode();
return 'e1';
}
@ -275,7 +276,8 @@ class e_db_mysql
catch(PDOException $ex)
{
$this->mySQLlastErrText = $ex->getMessage();
echo "<pre>".print_r($ex,true)."</pre>"; // Useful for Debug.
$this->mySQLLastErrNum = $ex->getCode();
e107::getDebug()->log($ex); // Useful for Debug.
return false;
}
@ -334,6 +336,7 @@ class e_db_mysql
catch (PDOException $e)
{
$this->mySQLlastErrText = $e->getMessage();
$this->mySQLlastErrNum = $e->getCode();
return false;
}
@ -474,6 +477,8 @@ class e_db_mysql
{
try
{
// var_dump($rli);
// var_dump($this->mySQLaccess);
$sQryRes = is_null($rli) ? $this->mySQLaccess->query($query) : $rli->query($query);
}

View File

@ -1451,7 +1451,7 @@ class e_parse_shortcode
$pid = $this->editableCodes['pid'];
$id = intval($var[$pid]);
$attributes = "contenteditable='true' class='e-editable-front' data-edit-id='".$id."' data-edit-sc='".$lcode."' ";
$attributes = "title='".LAN_EDIT."' contenteditable='true' class='e-editable-front' data-edit-id='".$id."' data-edit-sc='".$lcode."' ";
return ($container == 'div') ? "<div ".$attributes." >".$text."</div>" : "<span ".$attributes." >".$text."</span>";

View File

@ -209,6 +209,8 @@ class xmlClass
public $convertFilePaths = FALSE;
public $modifiedPrefsOnly = false;
public $filePathDestination = FALSE;
public $convertFileTypes = array("jpg", "gif", "png", "jpeg");
@ -951,16 +953,19 @@ class xmlClass
$val = $this->filePathPrepend[$key].$val;
}
if(is_array($val))
{
// $val = "<![CDATA[".e107::serialize($val,false)."]]>";
$val = e107::serialize($val,false);
}
if($this->convertFilePaths)
{
$types = implode("|",$this->convertFileTypes);
$val = preg_replace_callback("#({e_.*?\.(".$types."))#i", array($this,'replaceFilePaths'), $val);
}
if(is_array($val))
{
return "<![CDATA[".e107::getArrayStorage()->WriteArray($val,FALSE)."]]>";
}
if((strpos($val,"<")!==FALSE) || (strpos($val,">")!==FALSE) || (strpos($val,"&")!==FALSE))
{
@ -982,20 +987,43 @@ class xmlClass
public function e107Export($xmlprefs, $tables, $debug = FALSE)
{
error_reporting(0);
$e107info = array();
require_once(e_ADMIN."ver.php");
$text = "<?xml version='1.0' encoding='utf-8' ?".">\n";
$text .= "<e107Export version=\"".$e107info['e107_version']."\" timestamp=\"".time()."\" >\n";
$default = array();
$excludes = array();
if($this->modifiedPrefsOnly == true)
{
$xmlArray = e107::getSingleton('xmlClass')->loadXMLfile(e_CORE."xml/default_install.xml",'advanced');
$default = e107::getSingleton('xmlClass')->e107ImportPrefs($xmlArray,'core');
$excludes = array('social_login','replyto_email','replyto_name','siteadminemail','lan_global_list','menuconfig_list','plug_installed','shortcode_legacy_list','siteurl','cookie_name','install_date');
}
if(varset($xmlprefs)) // Export Core Preferences.
{
$text .= "\t<prefs>\n";
foreach($xmlprefs as $type)
{
$theprefs = e107::getConfig($type)->getPref();
$prefsorted = ksort($theprefs);
ksort($theprefs);
foreach($theprefs as $key=>$val)
{
if($type == 'core' && $this->modifiedPrefsOnly == true && (($val == $default[$key]) || in_array($key,$excludes) || substr($key,0,2) == 'e_'))
{
continue;
}
elseif($debug == true)
{
echo "<div>Original/Modiied <b>".$key."</b>";
var_dump($default[$key],$val);
echo "</div>";
}
if(isset($val))
{
$text .= "\t\t<".$type." name=\"".$key."\">".$this->e107ExportValue($val)."</".$type.">\n";
@ -1013,8 +1041,16 @@ class xmlClass
$eTable= str_replace(MPREFIX,"",$tbl);
e107::getDB()->select($eTable, "*");
$text .= "\t<dbTable name=\"".$eTable."\">\n";
while($row = e107::getDB()-> db_Fetch())
$count = 1;
while($row = e107::getDB()->fetch())
{
if($this->convertFilePaths == true && $eTable == 'core_media' && substr($row['media_url'],0,8) != '{e_MEDIA')
{
continue;
}
$text .= "\t\t<item>\n";
foreach($row as $key=>$val)
{
@ -1022,6 +1058,7 @@ class xmlClass
}
$text .= "\t\t</item>\n";
$count++;
}
$text .= "\t</dbTable>\n";

View File

@ -32,7 +32,14 @@ $ix = new news;
if(!empty($parm))
{
parse_str($parm, $parms);
if(is_string($parm))
{
parse_str($parm, $parms);
}
else
{
$parms = $parm;
}
}
if(!$OTHERNEWS2_STYLE)
@ -49,7 +56,16 @@ if(!$OTHERNEWS2_STYLE)
if(!empty($parms['caption']))
{
$template['caption'] = e107::getParser()->toHtml($parms['caption'],true,'TITLE');
if(isset($parms['caption'][e_LANGUAGE]))
{
$template['caption'] = e107::getParser()->toHtml($parms['caption'][e_LANGUAGE], true,'TITLE');
}
else
{
$template['caption'] = e107::getParser()->toHtml($parms['caption'], true,'TITLE');
}
}
}
else //v1.x

View File

@ -10,11 +10,12 @@
//@see https://developers.facebook.com/docs/plugins/like-button
e107::lan('social',false, true);
$pref = e107::pref('social');
if(deftrue('SOCIAL_FACEBOOK_INIT') )
{
e107::js('footer-inline', SOCIAL_FACEBOOK_INIT); // defined in e_header.php
$pref = e107::pref('social');
$action = vartrue($pref['facebook_like_menu_action'], 'like'); // or 'recommend';
$layout = vartrue($pref['facebook_like_menu_layout'], 'standard'); // standard, button_count, button or box_count.
@ -29,8 +30,15 @@ if(deftrue('SOCIAL_FACEBOOK_INIT') )
e107::getRender()->tablerender('Facebook',$text,'facebook-like-menu');
}elseif(ADMIN)
}
elseif(deftrue('XURL_FACEBOOK'))
{
$width = vartrue($pref['facebook_like_menu_width'], 350);
$text .= '<iframe src="//www.facebook.com/plugins/likebox.php?href='.urlencode(XURL_FACEBOOK).'&amp;width='.$width.'&amp;height=200&amp;colorscheme=light&amp;show_faces=true&amp;header=false&amp;stream=false&amp;show_border=false" scrolling="no" style="border:none; overflow:hidden; width:350px;height:200px;" allowtransparency="true" frameborder="0"></iframe>';
e107::getRender()->tablerender('Facebook',$text,'facebook-like-menu');
}
elseif(ADMIN)
{
$text = "<div class='alert alert-danger'>".LAN_SOCIAL_100."</div>";
e107::getRender()->tablerender('Facebook',$text,'twitter-menu');
e107::getRender()->tablerender('Facebook',$text,'facebook-like-menu');
}

View File

@ -241,7 +241,7 @@ class e_install
$this->debug = true;
}
if(defined('PDO::ATTR_DRIVER_NAME')) // TODO Uncomment when ready.
if(defined('PDO::ATTR_DRIVER_NAME'))
{
$this->pdo = true;
define('e_PDO', true);