1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Merge pull request #28 from e107inc/master

.
This commit is contained in:
rica-carv
2016-11-29 17:16:44 +00:00
committed by GitHub
29 changed files with 1121 additions and 841 deletions

View File

@@ -83,7 +83,7 @@
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 2 hours"
ExpiresByType image/x-icon "access plus 1 year
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/jpg "access plus 1 week"

View File

@@ -258,7 +258,10 @@ class admin_start
e_PLUGIN."banner/config.php",
e_PLUGIN."forum/newforumposts_menu_config.php",
e_PLUGIN."forum/e_latest.php",
e_PLUGIN."forum/e_status.php"
e_PLUGIN."forum/e_status.php",
e_PLUGIN."online_extended_menu/online_extended_menu.php",
e_PLUGIN."online_extended_menu/images/user.png",
e_PLUGIN."online_extended_menu/languages/English.php"
);

View File

@@ -23,12 +23,22 @@ if (!defined('e107_INIT'))
require_once("../class2.php");
}
if (!getperms("A") && ($_GET['action'] != 'dialog'))
if (!getperms("A") && ($_GET['action'] != 'dialog') && ($_GET['action'] != 'youtube'))
{
e107::redirect('admin');
exit;
}
if($_GET['action'] == 'youtube' )
{
if(!getperms('A') && !getperms('A1'))
{
exit;
}
}
e107::js('core', 'plupload/plupload.full.js', 'jquery', 2);
e107::css('core', 'plupload/jquery.plupload.queue/css/jquery.plupload.queue.css', 'jquery');
e107::js('core', 'plupload/jquery.plupload.queue/jquery.plupload.queue.min.js', 'jquery', 2);
@@ -120,9 +130,9 @@ class media_admin extends e_admin_dispatcher
protected $adminMenu = array(
'main/list' => array('caption'=> LAN_IMA_M_01, 'perm' => 'A'),
// 'main/create' => array('caption'=> "Add New Media", 'perm' => 'A'), // Should be handled in Media-Import.
'main/import' => array('caption'=> LAN_IMA_M_02, 'perm' => 'A|A2'),
'cat/list' => array('caption'=> LAN_IMA_M_03, 'perm' => 'A'),
'cat/create' => array('caption'=> LAN_IMA_M_04, 'perm' => 'A'), // is automatic.
'main/import' => array('caption'=> LAN_IMA_M_02, 'perm' => 'A|A1'),
'cat/list' => array('caption'=> LAN_IMA_M_03, 'perm' => 'A|A2'),
'cat/create' => array('caption'=> LAN_IMA_M_04, 'perm' => 'A|A2'), // is automatic.
// 'main/settings' => array('caption'=> LAN_PREFS, 'perm' => 'A'), // legacy
'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'A'),
'main/avatar' => array('caption'=> LAN_IMA_M_05, 'perm' => 'A')
@@ -391,9 +401,9 @@ class media_form_ui extends e_admin_form_ui
//TODO GIF and PNG rotation.
if($sql->db_Select("core_media","media_url","media_id IN (".$ids.") AND media_type = 'image/jpeg' "))
if($sql->select("core_media","media_url","media_id IN (".$ids.") AND media_type = 'image/jpeg' "))
{
while($row = $sql->db_Fetch())
while($row = $sql->fetch())
{
$original = $tp->replaceConstants($row['media_url']);
@@ -479,9 +489,9 @@ class media_form_ui extends e_admin_form_ui
$img_import_w = 2816;
$img_import_h = 2112;
if($sql->db_Select("core_media","media_id,media_url","media_id IN (".$ids.") AND media_type = 'image/jpeg' "))
if($sql->select("core_media","media_id,media_url","media_id IN (".$ids.") AND media_type = 'image/jpeg' "))
{
while($row = $sql->db_Fetch())
while($row = $sql->fetch())
{
$path = $tp->replaceConstants($row['media_url']);

View File

@@ -235,6 +235,11 @@ if(!empty($_GET['iframe']))
$message = '';
if(!empty($_POST['language']))
{
$_POST['language'] = e107::getParser()->filter($_POST['language']);
}
// ----------------- delete tables ---------------------------------------------
if (isset($_POST['del_existing']) && $_POST['lang_choices'] && getperms('0'))
{
@@ -246,7 +251,7 @@ if(!empty($_GET['iframe']))
{
// echo $del_table." exists<br />";
$qry = "DROP TABLE ".MPREFIX."lan_".$lang."_".$del_table;
if (mysql_query($qry))
if ($sql->gen($qry))
{
$msg = $tp->lanVars(LANG_LAN_100, $_POST['lang_choices'].' '.$del_table);
$message .= $msg.'[!br!]';
@@ -304,7 +309,7 @@ if(!empty($_GET['iframe']))
if ($_POST['remove'])
{
// Remove table.
if (mysql_query("DROP TABLE ".MPREFIX."lan_".$lang."_".$value))
if ($sql->gen("DROP TABLE ".MPREFIX."lan_".$lang."_".$value))
{
$message .= $_POST['language'].' '.$value.' '.LAN_DELETED.'[!br!]'; // can be removed?
$mes->addSuccess($_POST['language'].' '.$value.' '.LAN_DELETED);

View File

@@ -718,6 +718,7 @@ class pluginManager{
if($mp->download($data['plugin_id'], $data['plugin_mode'], 'plugin'))
{
$this -> pluginCheck(true); // rescan the plugin directory
$text = e107::getPlugin()->install($data['plugin_folder']);
$mes->addInfo($text);

View File

@@ -322,7 +322,7 @@ $text = "
<tr>
<td><label for='siteurl'>".PRFLAN_3."</label></td>
<td>
".$frm->text('siteurl', $pref['siteurl'], 150, 'required=1&size=xxlarge')."
".$frm->text('siteurl', $pref['siteurl'], 150, 'size=xxlarge')."
".($pref['siteurl'] == SITEURL ? "" : "<div class='field-help'>".PRFLAN_159.": <strong>".SITEURL."</strong></div>")."
</td>
</tr>

View File

@@ -164,6 +164,17 @@ if($mode == 'download' && !empty($_GET['src']))
return true;
}
if(e_DEBUG === true)
{
echo "<b>DEBUG MODE ACTIVE (no downloading)</b><br />";
echo '$_GET: ';
print_a($_GET);
echo 'base64 decoded and parsed as $data:';
print_a($data);
return false;
}
$mp = $themec->getMarketplace();
$mes->addSuccess(TPVLAN_85);

View File

@@ -2343,15 +2343,22 @@ class users_ext
function field_deactivate()
{
global $ue, $ns, $tp, $sql, $admin_log;
$tp = e107::getParser();
$sql = e107::getDb();
$ue = e107::getUserExt();
$ret = "";
foreach(array_keys($_POST['deactivate']) as $f)
{
$f = $tp->filter($f);
if($ue->user_extended_remove($f, $f))
{
$ret .= EXTLAN_68." $f ".EXTLAN_72."<br />";
if(is_readable(e_CORE."sql/extended_".$f.".php")){
$ret .= (mysql_query("DROP TABLE ".MPREFIX."user_extended_".$f)) ? LAN_DELETED." user_extended_".$f."<br />" : LAN_DELETED_FAILED." user_extended_".$f."<br />";
if(is_readable(e_CORE."sql/extended_".$f.".php"))
{
$ret .= ($sql->gen("DROP TABLE ".MPREFIX."user_extended_".$f)) ? LAN_DELETED." user_extended_".$f."<br />" : LAN_DELETED_FAILED." user_extended_".$f."<br />";
}
}
else
@@ -2360,6 +2367,7 @@ class users_ext
}
}
e107::getLog()->add('EUF_12',implode(', ',$_POST['deactivate']),E_LOG_INFORMATIVE,'');
return $ret;
}
@@ -2378,7 +2386,7 @@ class users_ext
preg_match_all("/create(.*?)myisam;/si", $sql_data, $creation);
foreach($creation[0] as $tab){
$query = str_replace($search,$replace,$tab);
if(!mysql_query($query)){
if(!$sql->gen($query)){
$error = TRUE;
}
}
@@ -2386,7 +2394,7 @@ class users_ext
preg_match_all("/insert(.*?);/si", $sql_data, $inserts);
foreach($inserts[0] as $ins){
$qry = str_replace($search,$replace,$ins);
if(!mysql_query($qry)){
if(!$sql->gen($qry)){
$error = TRUE;
}
}

View File

@@ -33,9 +33,16 @@ if(array_key_exists($parm, $aColors))
}
else
{
if(preg_match("/(#[a-fA-F0-9]{3,6})/", $parm, $matches))
if(preg_match("/(#[a-fA-F0-9]{3,12})/", $parm, $matches))
{
return "<span class='{$class}' style='color:{$matches[1]};'>$code_text</span>";
}
if(preg_match("/([a-zA-Z]{3,20})/", $parm, $matches)) // support color names http://www.w3schools.com/colors/colors_names.asp
{
return "<span class='{$class}' style='color:{$matches[1]};'>$code_text</span>";
}
}

View File

@@ -1054,7 +1054,11 @@ class admin_shortcodes
<b>".FOOTLAN_8."</b>
<br />
".$install_date."
<br /><br />
<br />";
$text .= $this->getLastGitUpdate();
$text .= "<br />
<b>".FOOTLAN_9."</b>
<br />".
preg_replace("/PHP.*/i", "", $_SERVER['SERVER_SOFTWARE'])."<br />(".FOOTLAN_10.": ".$_SERVER['SERVER_NAME'].")
@@ -1084,6 +1088,22 @@ class admin_shortcodes
}
}
private function getLastGitUpdate()
{
$gitFetch = e_BASE.'.git/FETCH_HEAD';
if(file_exists($gitFetch))
{
$unix = filemtime($gitFetch);
$text = "<br /><b>Last Git Update</b><br />"; // NO LAN required. Developer-Only
$text.= ($unix) ? date('r',$unix) : "Never";
$text .= "<br />";
return $text;
}
}
function sc_admin_status($parm)
{
if(($parm == 'infopanel' || $parm == 'flexpanel') && e_PAGE != 'admin.php')

View File

@@ -22,20 +22,32 @@ class usersettings_shortcodes extends e_shortcode
function sc_username($parm) // This is the 'display name'
{
$pref = e107::getPref();
$dis_name_len = varset($pref['displayname_maxlength'], 15);
if(check_class($pref['displayname_class']) || $pref['allowEmailLogin'] == 1) // display if email is used for login.
{
$dis_name_len = varset($pref['displayname_maxlength'],15);
$options = array('title'=> LAN_USER_80, 'size' => 40);
$options = array(
'title' => LAN_USER_80,
'size' => 40,
);
return e107::getForm()->text('username', $this->var['user_name'], $dis_name_len, $options);
}
else
if($parm == 'show') // Show it, but as a readonly field.
{
return ($parm == 'show') ? $this->var['user_name'] : ''; // ; if it can't be changed then hide it.
}
$options = array(
'title' => LAN_USER_80,
'size' => 40,
'readonly' => true,
);
return e107::getForm()->text('username', $this->var['user_name'], $dis_name_len, $options);
}
// Hide it!
return '';
}
function sc_loginname($parm)
@@ -47,22 +59,21 @@ class usersettings_shortcodes extends e_shortcode
return; // hide login name when email-login is being used. (may contain social login info)
}
if (ADMIN && getperms("4"))
{
$log_name_length = varset($pref['loginname_maxlength'], 30);
$options = array(
'title' => ($pref['allowEmailLogin'] == 1) ? LAN_USER_82 : LAN_USER_80,
'size' => 40
'size' => 40,
);
if(ADMIN && getperms("4")) // Has write permission.
{
return e107::getForm()->text('loginname', $this->var['user_loginname'], $log_name_length, $options);
}
else
{
return $this->var['user_loginname'];
}
// No write permission.
$options['readonly'] = true;
return e107::getForm()->text('loginname', $this->var['user_loginname'], $log_name_length, $options);
}
@@ -80,15 +91,21 @@ class usersettings_shortcodes extends e_shortcode
function sc_realname($parm)
{
if(!empty($this->var['user_xup'])) // social login active.
$pref = e107::getPref();
$sc = e107::getScBatch('usersettings');
$options = array(
'title' => '',
'size' => 40,
'required' => $pref['signup_option_realname'],
);
if(!empty($sc->var['user_login']) && !empty($sc->var['user_xup'])) // social login active.
{
return $this->var['user_login'];
$options['readonly'] = true;
}
$pref = e107::getPref();
$options = array('title'=> '', 'size' => 40,'required'=>$pref['signup_option_realname']);
return e107::getForm()->text('realname',$this->var['user_login'], 100, $options);
return e107::getForm()->text('realname', $sc->var['user_login'], 100, $options);
}
@@ -147,13 +164,20 @@ class usersettings_shortcodes extends e_shortcode
function sc_email($parm)
{
if(!empty($this->var['user_xup'])) // social login active.
$sc = e107::getScBatch('usersettings');
$options = array(
'size' => 40,
'title' => '',
'required' => true,
);
if(!empty($sc->var['user_email']) && !empty($sc->var['user_xup'])) // social login active.
{
return $this->var['user_email'];
$options['readonly'] = true;
}
$options = array('size' => 40,'title'=>'','required'=>true);
return e107::getForm()->email('email', $this->var['user_email'], 100, $options);
return e107::getForm()->email('email', $sc->var['user_email'], 100, $options);
}

View File

@@ -372,7 +372,7 @@ abstract class e_marketplace_adapter_abstract
$remotefile = $this->downloadUrl."?auth=".$this->getAuthKey()."&".$qry;
$localfile = md5($remotefile.time()).".zip";
$mes->addSuccess("Downloading...");
$mes->addSuccess(TPVLAN_81);
// FIXME call the service, check status first, then download (if status OK), else retireve the error break and show it
@@ -394,7 +394,10 @@ abstract class e_marketplace_adapter_abstract
if(!file_exists(e_TEMP.$localfile))
{
$mes->addError( "Automated download not possible. Please <a href='".$remotefile."'>Download Manually</a>");
$srch = array("[", "]");
$repl = array("<a href='".$remotefile."'>", "</a>");
$mes->addError( TPVLAN_83." ".str_replace($srch, $repl, TPVLAN_84));
if(E107_DEBUG_LEVEL > 0)
{
@@ -407,12 +410,12 @@ abstract class e_marketplace_adapter_abstract
if($fl->unzipArchive($localfile,$type))
{
$mes->addSuccess("Download Complete!");
$mes->addSuccess(TPVLAN_82);
return true;
}
else
{
$mes->addSuccess( "<a href='".$remotefile."'>Download Manually</a>"); // flush(); usleep(50000);
$mes->addSuccess( "<a href='".$remotefile."'>".TPVLAN_84."</a>");
}
return false;
@@ -420,13 +423,6 @@ abstract class e_marketplace_adapter_abstract
// Grab a remote file and save it in the /temp directory. requires CURL
function getRemoteFile($remote_url, $local_file, $type='temp')
{
@@ -510,7 +506,7 @@ class e_marketplace_adapter_wsdl extends e_marketplace_adapter_abstract
}
catch (Exception $e)
{
e107::getMessage()->addError("Unable to connect. Please check firewall and/or internet connection.");
e107::getMessage()->addError(TPVLAN_90);
e107::getMessage()->addDebug($e->getMessage());
}

View File

@@ -789,7 +789,7 @@ class e_parse extends e_parser
$search = array('&#036;', '&quot;', '<', '>');
$replace = array('$', '"', '&lt;', '&gt;');
$text = str_replace($search, $replace, $text);
if (e107::wysiwyg() !== true)
if (e107::wysiwyg() !== true && is_string($text))
{
// fix for utf-8 issue with html_entity_decode(); ???
$text = urldecode($text);

View File

@@ -2798,6 +2798,8 @@ class e_form
/**
* Render a Breadcrumb in Bootstrap format.
* @param $array
* @param $array[url]
* @param $array[text]
*/
function breadcrumb($array)
{

View File

@@ -45,7 +45,7 @@ class e_jsmanager
// "http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js",
// "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"
// "http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"
"https://cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js",
"https://cdn.jsdelivr.net/jquery/2.2.4/jquery.min.js",
// jQuery Once filters out all elements that had the same filter applied on them before. It can be used to
// ensure that a function is only applied once to an element. jQuery Once is used in e107.behaviors.
"https://cdnjs.cloudflare.com/ajax/libs/jquery-once/2.1.1/jquery.once.min.js"
@@ -268,7 +268,7 @@ class e_jsmanager
if($this->isInAdmin()) // Include jquery-ui in the admin-area only - Jquery-UI to eventually be removed from e107 completely if possible.
{
$this->_libraries['jquery'] = array(
"https://cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js",
"https://cdn.jsdelivr.net/jquery/2.2.4/jquery.min.js",
// jQuery Once filters out all elements that had the same filter applied on them before. It can be used
// to ensure that a function is only applied once to an element. jQuery Once is used in e107.behaviors.
"https://cdnjs.cloudflare.com/ajax/libs/jquery-once/2.1.1/jquery.once.min.js",

View File

@@ -2198,14 +2198,14 @@ class e107plugin
if($result !== NULL)
{
$status = ($result) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Adding Link: {$linkName} with url [{$url}] and perm {$perm} ", $status);
$mes->add(EPL_ADLAN_233." {$linkName} URL: [{$url}] ".EPL_ADLAN_252." {$perm} ", $status);
}
}
if ($function == 'upgrade' && $remove) //remove inactive links on upgrade
{
$status = ($this->manage_link('remove', $url, $linkName,false, $options)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Removing Link: {$linkName} with url [{$url}]", $status);
$mes->add(EPL_ADLAN_234." {$linkName} URL: [{$url}]", $status);
}
break;
@@ -2213,7 +2213,7 @@ class e107plugin
case 'uninstall': //remove all links
$status = ($this->manage_link('remove', $url, $linkName, $perm, $options)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Removing Link: {$linkName} with url [{$url}]", $status);
$mes->add(EPL_ADLAN_234." {$linkName} URL: [{$url}]", $status);
break;
}
}
@@ -2315,7 +2315,8 @@ class e107plugin
$data['class'] = $this->getPerm(varset($v['@attributes']['perm']), 'member');
$status = e107::getMedia()->createCategory($data) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Adding Media Category: {$data['category']}", $status);
$message = str_replace('[x]', $data['category'], EPL_ADLAN_245);
$mes->add($message, $status);
e107::getMedia()->import($data['category'],e_PLUGIN.$folder, false,'min-size=20000');
$c++;
$i[$type]++;
@@ -2325,7 +2326,8 @@ class e107plugin
case 'uninstall': // Probably best to leave well alone
$status = e107::getMedia()->deleteAllCategories($folder)? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Deleting All Media Categories owned by : {$folder}", $status);
$message = str_replace('[x]', $folder, EPL_ADLAN_246);
$mes->add($message, $status);
break;
@@ -2467,14 +2469,14 @@ class e107plugin
//$status = $this->manage_extended_field('add', $name, $type, $attrib['default'], $source) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$status = $this->manage_extended_field('add', $name, $attrib, $source) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add('Adding Extended Field: '.$name.' ... ', $status);
$mes->add(EPL_ADLAN_249 .$name.' ... ', $status);
}
if ($function == 'upgrade' && $remove) //If upgrading, removing any inactive extended fields
{
$status = $this->manage_extended_field('remove', $name, $attrib, $source) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add('Removing Extended Field: '.$name.' ... ', $status);
$mes->add(EPL_ADLAN_250 .$name.' ... ', $status);
}
break;
@@ -2483,11 +2485,11 @@ class e107plugin
if (vartrue($this->unInstallOpts['delete_xfields'], FALSE))
{
$status = ($this->manage_extended_field('remove', $name, $attrib, $source)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add('Removing Extended Field: '.$name.' ... ', $status);
$mes->add(EPL_ADLAN_250 .$name.' ... ', $status);
}
else
{
$mes->add('Extended Field: '.$name.' left in place', E_MESSAGE_SUCCESS);
$mes->add(EPL_ADLAN_251 .$name, E_MESSAGE_SUCCESS);
}
break;
}

View File

@@ -26,6 +26,7 @@ class themeHandler
var $fl;
var $themeConfigObj = null;
var $noLog = FALSE;
private $curTheme = null;
private $approvedAdminThemes = array('bootstrap','bootstrap3');
@@ -80,6 +81,11 @@ class themeHandler
$unzippedTheme = $this->themeUpload();
}
if(!empty($_POST['curTheme']))
{
$this->curTheme = e107::getParser()->filter($_POST['curTheme']);
}
if(!empty($_POST['setUploadTheme']) && !empty($unzippedTheme))
{
$themeArray = $this->getThemes();
@@ -139,7 +145,7 @@ class themeHandler
if(isset($_POST['submit_adminstyle']))
{
$this->id = $_POST['curTheme'];
$this->id = $this->curTheme;
if($this->setAdminStyle())
{
eMessage::getInstance()->add(TPVLAN_43, E_MESSAGE_SUCCESS);
@@ -149,7 +155,7 @@ class themeHandler
if(isset($_POST['submit_style']))
{
$this->id = $_POST['curTheme'];
$this->id = $this->curTheme;
$this->setLayouts(); // Update the layouts in case they have been manually changed.
$this->SetCustomPages($_POST['custompages']);
@@ -161,7 +167,7 @@ class themeHandler
if(!empty($_POST['git_pull']))
{
$return = e107::getFile()->gitPull($_POST['curTheme'], 'theme');
$return = e107::getFile()->gitPull($this->curTheme, 'theme');
$mes->addSuccess($return);
}
@@ -1076,9 +1082,17 @@ class themeHandler
if($_GET['mode'] == 'online')
{
$srcData = array(
'id' => $theme['id'],
'url' => $theme['url'],
'mode' => $theme['mode'],
'price' => $theme['price']
);
$d = http_build_query($theme,false,'&');
$url = e_SELF."?src=".base64_encode($d);
$d = http_build_query($srcData,false,'&');
$base64 = base64_encode($d);
// e107::getDebug()->log($theme['name'].': '.strlen($base64));
$url = e_SELF."?src=".$base64;
$id = $frm->name2id($theme['name']);
$LAN_DOWNLOAD = ($theme['price'] > 0) ? LAN_PURCHASE."/".LAN_DOWN_THEME : LAN_DOWN_THEME;
@@ -1095,7 +1109,7 @@ class themeHandler
}
*/
$downloadUrl = e_SELF.'?mode=download&amp;action='.$action.'&amp;src='.base64_encode($d);//$url.'&amp;action=download';
$downloadUrl = e_SELF.'?mode=download&src='.base64_encode($d);//$url.'&amp;action=download';
$infoUrl = $url.'&amp;action=info';
$viewUrl = $theme['url'];

View File

@@ -1753,7 +1753,7 @@ class e_user extends e_user_model
$updateQry['user_image'] = $userdata['user_image'];
}
$updateQry['WHERE'] = "WHERE user_id=".$user['user_id']." LIMIT 1";
$updateQry['WHERE'] = "user_id=".$user['user_id']." LIMIT 1";
if($sql->update('user', $updateQry) !==false)
{

View File

@@ -273,6 +273,8 @@ define ("EPL_ADLAN_231", "Remove icons from Media-Manager");
define ("EPL_ADLAN_232", "Create Files");
define ("TPVLAN_81", "Downloading...");
define ("TPVLAN_82", "Download Complete!");
define ("EPL_ADLAN_233", "Adding Link:");
define ("EPL_ADLAN_234", "Removing Link:");
define ("EPL_ADLAN_235", "Automated download not possible.");
define ("EPL_ADLAN_236", "Please Download Manually");
define ("EPL_ADLAN_237", "Download");
@@ -284,6 +286,14 @@ define ("EPL_ADLAN_242","Removing Pref:");
define ("EPL_ADLAN_243","Updating Pref:");
define ("EPL_ADLAN_244","Only 5 Media Categories are permitted during installation.");
define ("EPL_ADLAN_245","Adding Media Category: [x]");
define ("EPL_ADLAN_246","Deleting All Media Categories owned by : [x]");
define ("EPL_ADLAN_249","Adding Extended Field: ");
define ("EPL_ADLAN_250","Removing Extended Field: ");
define ("EPL_ADLAN_251","Extended Field left in place: ");
define ("EPL_ADLAN_252","Perm: ");
define ("LAN_RELEASED", "Released");
define ("LAN_REPAIR_PLUGIN_SETTINGS", "Repair plugin settings");
define ("LAN_SYNC_WITH_GIT_REPO", "Sync with Git Repo");

View File

@@ -115,11 +115,12 @@ define("TPVLAN_CONV_15", "Give this stylesheet a name");
//marketplace
define("TPVLAN_81","Downloading...");
define("TPVLAN_82","Download Complete!");
define("TPVLAN_83","Automated download not possible.");
define("TPVLAN_84","Please Download Manually");
define("TPVLAN_83","Automated download not possible!");
define("TPVLAN_84","[Please Download Manually]");
define("TPVLAN_85","Connecting...");
define("TPVLAN_86","Could not change site theme.");
define("TPVLAN_87","Rendering Theme Config");
define("TPVLAN_88","Converter");
define("TPVLAN_89", "Apply dashboard preferences to all administrators");
define("TPVLAN_90","Unable to connect. Please check firewall and/or internet connection.");

View File

@@ -43,6 +43,13 @@ class forum_url // plugin-folder + '_url'
'redirect' => '{e_PLUGIN}forum/forum.php?f=track',
);
$config['markread'] = array(
'sef' => '^forum/markread/{forum_id}',
'regex' => 'forum/markread/([\d]*)',
'redirect' => '{e_PLUGIN}forum/forum.php?f=mfar&amp;id=$1',
'legacy' => '{e_PLUGIN}forum/forum.php?f=mfar&amp;id={forum_id}'
);
$config['post'] = array(
'regex' => '^forum/post/?',
'sef' => 'forum/post/',
@@ -55,6 +62,8 @@ class forum_url // plugin-folder + '_url'
'legacy' => '{e_PLUGIN}forum/forum_post.php?f=move&amp;id={thread_id}'
);
$config['split'] = array(
'sef' => 'forum/post/?f=split&amp;id={thread_id}&amp;post={post_id}',
'legacy' => '{e_PLUGIN}forum/forum_post.php?f=split&amp;id={thread_id}&amp;post={post_id}'

View File

@@ -1009,6 +1009,11 @@ class e107forum
$tmp['thread_sef'] = eHelper::title2sef($tmp['thread_name'],'dashl');
if(empty($tmp['forum_sef']))
{
e107::getDebug()->log("Forum ".$tmp['forum_name']." is missing a SEF URL. Please add one via the admin area. ");
}
return $tmp;
}
}
@@ -1510,6 +1515,7 @@ class e107forum
$ret = array();
while ($row = $sql->fetch())
{
if(!$row['forum_parent'])
{
$ret['parents'][] = $row;
@@ -1817,7 +1823,15 @@ class e107forum
";
if ($sql->gen($qry))
{
return $sql->fetch();
$row = $sql->fetch();
if(empty($row['forum_sef']))
{
e107::getDebug()->log("Forum ".$row['forum_name']." is missing a SEF URL. Please add one via the admin area. ");
}
return $row;
}
return FALSE;
}
@@ -1855,7 +1869,7 @@ class e107forum
$sql = e107::getDb();
$forumId = (int)$forumId;
$qry = "
SELECT t.*, f.forum_id, f.forum_sef, u.user_name, lpu.user_name AS lastpost_username, MAX(p.post_id) AS lastpost_id FROM `#forum_thread` as t
SELECT t.*, f.forum_id, f.forum_sef,f.forum_name, u.user_name, lpu.user_name AS lastpost_username, MAX(p.post_id) AS lastpost_id FROM `#forum_thread` as t
LEFT JOIN `#forum` AS f ON t.thread_forum_id = f.forum_id
LEFT JOIN `#forum_post` AS p ON t.thread_id = p.post_thread
LEFT JOIN `#user` AS u ON t.thread_user = u.user_id
@@ -1880,7 +1894,11 @@ class e107forum
{
while ($row = $sql->fetch())
{
// $row['thread_sef'] = eHelper::title2sef($row['thread_name']);
if(empty($row['forum_sef']))
{
e107::getDebug()->log("Forum ".$row['forum_name']." is missing a SEF URL. Please add one via the admin area. ");
}
$ret[] = $row;
}
}

View File

@@ -195,7 +195,9 @@ function step2()
{
$message = 'Creating table ' . ($rename ? $rename : $name);
if($sql->isTable($name) && $sql->isEmpty($name))
$curTable = ($rename ? $rename : $name);
if($sql->isTable($curTable) && $sql->isEmpty($curTable))
{
$mes -> addSuccess("Skipping table ".$name." (already exists)");
continue;

View File

@@ -281,7 +281,8 @@ if ($pages)
}
}
if($forum->checkPerm($forumId, 'thread')) //new thread access only.
//-- if($forum->checkPerm($forumId, 'thread')) //new thread access only.
if($forum->checkPerm($forumId, 'post')) //new thread access only.
{
$forumSCvars['ntUrl']= e107::url('forum','post')."?f=nt&amp;id=". $forumId;
/*--

View File

@@ -128,7 +128,7 @@ class forum_shortcodes extends e_shortcode
// To be reworked to get the $forum var
$trackPref = $forum->prefs->get('track');
if(!empty($trackPref))
if(!empty($trackPref) && $forum->checkPerm($this->var['forum_id'], 'post'))
{
$uInfo[2] = "<a href='".e107::url('forum','track')."'>".LAN_FORUM_0030."</a>";
}

View File

@@ -804,7 +804,7 @@ function sc_buttonsx()
// $url = e107::getUrl()->create('forum/thread/reply', array('id' => $thread->threadId));
$replyUrl = "<a class='btn btn-primary' href='".$url."'>".LAN_FORUM_2006."</a>";
}
if ($forum->checkPerm($this->var['thread_forum_id'], 'thread'))
if ($forum->checkPerm($this->var['thread_forum_id'], 'post'))
{
$ntUrl = e107::url('forum','post')."?f=nt&amp;id=". $this->var['thread_forum_id'];
// $ntUrl = e107::getUrl()->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id']));
@@ -829,7 +829,7 @@ function sc_buttonsx()
$text = '<div class="btn-group">
'.$replyUrl.'
'.($replyUrl?:LAN_FORUM_1003." ".LAN_FORUM_8013).'
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>

View File

@@ -80,16 +80,10 @@
global $forum;
$jumpList = $forum->forumGetAllowed('view');
$text = '<div class="btn-group">';
if(!empty($this->var['ntUrl']))
{
$text .= '<a href="' . $this->var['ntUrl'] . '" class="btn btn-primary">' . LAN_FORUM_1018 . '</a>';
}
$text .= '
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
$text .=
($this->var['ntUrl'] ? '<a href="'.$this->var['ntUrl'].'" class="btn btn-primary">'.LAN_FORUM_1018.'</a>' : LAN_FORUM_1001." ".LAN_FORUM_8013).
'<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
@@ -475,7 +469,7 @@
function sc_sub_forumtitle()
{
$forumName = e107::getParser()->toHTML($this->var['forum_name'], true);
return "<a href='" . e107::getUrl()->create('forum/forum/view', $this->var) . "'>{$forumName}</a>";
return "<a href='" . e107::url('forum', 'forum', $this->var) . "'>".$forumName."</a>";
}
@@ -523,7 +517,10 @@
}
return IMAGE_nonew;
--*/
return (USER && is_array($newflag_list) && in_array($this->var['forum_id'], $newflag_list)) ? "<a href='" . e107::getUrl()->create('forum/forum/mfar', 'id=' . $this->var['forum_id']) . "'>" . IMAGE_new . '</a>' : IMAGE_nonew;
// $url = e107::getUrl()->create('forum/forum/mfar', 'id=' . $this->var['forum_id']);
$url = e107::url('forum', 'markread', $this->var);
return (USER && is_array($newflag_list) && in_array($this->var['forum_id'], $newflag_list)) ? "<a href='" . $url . "'>" . IMAGE_new . '</a>' : IMAGE_nonew;
}

View File

@@ -1372,9 +1372,11 @@ $(document).ready(function()
}
else
{
var href = '';
var href = undefined;
}
if(href === "#" || e === null || href === undefined)
{
idt = $(e).next("div");

View File

@@ -48,18 +48,26 @@ if ((!ADMIN || !getperms("4")) && e_QUERY && e_QUERY != "update" )
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_user.php'); // Generic user-related language defines
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_usersettings.php');
$ue = e107::getUserExt(); // needed by shortcodes for now.
require_once (e_HANDLER.'ren_help.php');
require_once (e_HANDLER.'user_extended_class.php');
// require_once (e_HANDLER.'user_handler.php');
require_once(e_HANDLER.'validator_class.php');
$ue = new e107_user_extended;
$userMethods = e107::getUserSession();
require_once (e_HANDLER.'ren_help.php');
class usersettings_front // Begin Usersettings rewrite.
{
private $template = array();
private $sc = null;
/**
* usersettings_front constructor.
*/
function __construct()
{
if(deftrue('BOOTSTRAP')===3)
{
@@ -72,15 +80,33 @@ if(deftrue('BOOTSTRAP')===3)
$usersettings_shortcodes = e107::getScBatch('usersettings');
$usersettings_shortcodes->wrapper('usersettings/edit');
e107::css('inline', "
.usersettings-form .col-sm-9 .checkboxes { margin-left:20px }
");
}
else
{
include_once (e107::coreTemplatePath('usersettings')); //correct way to load a core template.
global $sc_style;
$USERSETTINGS_MESSAGE = '';
$USERSETTINGS_MESSAGE_CAPTION = '';
$USERSETTINGS_EDIT_CAPTION = '';
$USERSETTINGS_EDIT = '';
$coreTemplatePath = e107::coreTemplatePath('usersettings');
include_once($coreTemplatePath); //correct way to load a core template.
e107::scStyle($sc_style);
$usersettings_shortcodes = e107::getScBatch('usersettings');
}
$this->sc = $usersettings_shortcodes;
$this->template = array(
'message' => $USERSETTINGS_MESSAGE,
'message_caption' => $USERSETTINGS_MESSAGE_CAPTION,
'edit_caption' => $USERSETTINGS_EDIT_CAPTION,
'edit' => $USERSETTINGS_EDIT,
);
@@ -92,23 +118,51 @@ e107::js('footer-inline',"
}
");
}
/**
* @param $id
* @return mixed
*/
private function getTemplate($id)
{
return $this->template[$id];
}
/**
* @return bool
*/
public function init()
{
$pref = e107::getPref();
$tp = e107::getParser();
$ue = e107::getUserExt();
$mes = e107::getMessage();
$sql = e107::getDb();
$ns = e107::getRender();
$userMethods = e107::getUserSession();
$photo_to_delete = '';
$avatar_to_delete = '';
$ue_fields = '';
// $ue_fields = '';
$caption = '';
$promptPassword = false;
$error = FALSE;
$extraErrors = array();
$eufVals = array();
$savePassword = '';
$changedUserData = array();
$udata = array();
$allData = array();
$message = '';
$changedEUFData = array();
$inp = USERID; // Initially assume that user is modifying their own data.
$_uid = false; // FALSE if user modifying their own data; otherwise ID of data being modified
$adminEdit = FALSE; // FALSE if editing own data. TRUE if admin edit
$adminEdit = false; // @deprecated // FALSE if editing own data. TRUE if admin edit
/* todo subject of removal */
if(is_numeric(e_QUERY))
{ // Trying to edit specific user record
if (ADMIN)
@@ -125,7 +179,7 @@ $_usersettings_matches = Array
*/
$inp = intval(e_QUERY);
$usersettings_form_action = strstr('?', $_usersettings_matches[3]) ? e_SELF.'?'.e_QUERY : e_SELF;
// $usersettings_form_action = strstr('?', $_usersettings_matches[3]) ? e_SELF.'?'.e_QUERY : e_SELF;
$_uid = $inp;
$info = e107::user($inp);
@@ -148,10 +202,6 @@ if(!is_array($info) || ($info['user_admin'] == 1 && (!defined('ADMINPERMS') || A
require_once (HEADERF);
// Save user settings (changes only)
//-----------------------------------
@@ -178,12 +228,13 @@ if (isset($_POST['updatesettings']))
}
// Uploaded avatar and/or photo
if (varset($file_userfile['error']) != 4)
if (varset($_FILES['file_userfile']['error']) != UPLOAD_ERR_NO_FILE)
{
require_once (e_HANDLER.'upload_handler.php');
require_once (e_HANDLER.'resize_handler.php');
if ($uploaded = process_uploaded_files(e_AVATAR_UPLOAD, 'prefix+ap_'.$tp->leadingZeros($udata['user_id'],7).'_', array('overwrite' => TRUE, 'file_mask'=>'jpg,png,gif,jpeg', 'max_file_count' => 2)))
$opts = array('overwrite' => TRUE, 'file_mask'=>'jpg,png,gif,jpeg', 'max_file_count' => 2);
if ($uploaded = e107::getFile()->getUploaded(e_AVATAR_UPLOAD, 'prefix+ap_'.$tp->leadingZeros($udata['user_id'],7).'_', $opts))
{
foreach ($uploaded as $upload)
{
@@ -277,7 +328,7 @@ e107::getMessage()->addDebug("<h5>Posted Changes</h5>".print_a($changedUserData,
}
// Validate Extended User Fields.
$changedEUFData = array();
if (isset($_POST['ue']))
{
$eufVals = $ue->userExtendedValidateAll($_POST['ue'], varset($_POST['hide'],TRUE)); // Validate the extended user fields
@@ -308,7 +359,7 @@ e107::getMessage()->addDebug("<h5>Posted Changes</h5>".print_a($changedUserData,
{
if (US_DEBUG)
{
$admin_log->e_log_event(10, debug_backtrace(), "DEBUG", "Usersettings test", "Write back classes; old list: {$udata['user_class']}; new list: ".$nid, false, LOG_TO_ROLLING);
e107::getLog()->e_log_event(10, debug_backtrace(), "DEBUG", "Usersettings test", "Write back classes; old list: {$udata['user_class']}; new list: ".$nid, false, LOG_TO_ROLLING);
}
$changedUserData['user_class'] = $nid;
}
@@ -348,47 +399,51 @@ e107::getMessage()->addDebug("<h5>Posted Changes</h5>".print_a($changedUserData,
} // End - update setttings
elseif(isset($_POST['SaveValidatedInfo'])) // Next bit only valid if user editing their own data
{
if (!$adminEdit && !empty($_POST['updated_data']) && !empty($_POST['currentpassword']) && !empty($_POST['updated_key']))
{ // Got some data confirmed with password entry
/* if(!empty($_POST['updated_data']) && !empty($_POST['currentpassword']) && !empty($_POST['updated_key']))
{ // Got some data confirmed with password entry*/
$new_data = base64_decode($_POST['updated_data']);
// Should only happen if someone's fooling around
if (md5($new_data) != $_POST['updated_key'] || ($userMethods->hasReadonlyField($new_data) !==false))
if ($this->getValidationKey($new_data) !== $_POST['updated_key'] || ($userMethods->hasReadonlyField($new_data) !==false))
{
echo LAN_USET_42.'<br />';
exit();
return false;
}
if (isset($_POST['updated_extended']))
{
$new_extended = base64_decode($_POST['updated_extended']);
if (md5($new_extended) != $_POST['extended_key'])
if ($this->getValidationKey($new_extended) !== $_POST['extended_key'])
{ // Should only happen if someone's fooling around
echo LAN_USET_42.'<br />';
exit();
return false;
}
}
if ($userMethods->CheckPassword($_POST['currentpassword'], $udata['user_loginname'], $udata['user_password']) === false) // Use old data to validate
{ // Invalid password
echo "<br />".LAN_INCORRECT_PASSWORD."<br />";
if(!$adminEdit)
{
require_once (FOOTERF);
$mes->addError("<p>".LAN_INCORRECT_PASSWORD."</p>");
$mes->addError("<a class='btn btn-danger' href='".e107::getUrl()->create('user/myprofile/edit')."'>".LAN_BACK."</a>");
echo $mes->render();
return false;
}
else
{
require_once(e_ADMIN."footer.php");
}
exit();
}
$changedUserData = unserialize($new_data);
$changedUserData = e107::unserialize($new_data);
$savePassword = $_POST['currentpassword'];
if (!empty($new_extended)) $changedEUFData = unserialize($new_extended);
if(!empty($new_extended))
{
$changedEUFData = e107::unserialize($new_extended);
}
unset($new_data);
unset($new_extended);
if (isset($changedUserData['user_sess']))
{
$photo_to_delete = $udata['user_sess'];
@@ -397,7 +452,7 @@ elseif (isset($_POST['SaveValidatedInfo'])) // Next bit only valid if user editi
{
$avatar_to_delete = $udata['user_image'];
}
}
// }
}
unset($_POST['updatesettings']);
unset($_POST['SaveValidatedInfo']);
@@ -419,9 +474,9 @@ if ($dataToSave)
$changedUserData['user_password'] = $sql->escape($userMethods->HashPassword($savePassword, $loginname), false);
if (varset($pref['allowEmailLogin'], FALSE))
{
$user_prefs = e107::getArrayStorage()->unserialize($udata['user_prefs']);
$user_prefs = e107::unserialize($udata['user_prefs']);
$user_prefs['email_password'] = $userMethods->HashPassword($savePassword, $email);
$changedUserData['user_prefs'] = e107::getArrayStorage()->serialize($user_prefs);
$changedUserData['user_prefs'] = e107::serialize($user_prefs);
}
}
else
@@ -447,7 +502,7 @@ if ($dataToSave && !$promptPassword)
// We can update the basic user record now - can just update fields from $changedUserData
if (US_DEBUG) { $admin_log->e_log_event(10, debug_backtrace(), "DEBUG", "Usersettings test", "Changed data:<br /> ".var_export($changedUserData, true), false, LOG_TO_ROLLING); }
if (US_DEBUG) { e107::getLog()->e_log_event(10, debug_backtrace(), "DEBUG", "Usersettings test", "Changed data:<br /> ".var_export($changedUserData, true), false, LOG_TO_ROLLING); }
if (isset($changedUserData) && count($changedUserData))
{
$changedData['data'] = $changedUserData;
@@ -487,6 +542,7 @@ if ($dataToSave && !$promptPassword)
{
$message .= '<br />Error updating EUF';
}
}
// Now see if we need to log anything. First check the options and class membership
@@ -562,12 +618,12 @@ if ($dataToSave && !$promptPassword)
$log_action = USER_AUDIT_ADMIN; // If an admin did the mod, different heading
// Embed a message saying who changed the data
$changedUserData['message'] = str_replace(array('--ID--', '--LOGNAME--'), array(USERID, USERNAME), LAN_USET_18);
$admin_log->user_audit($log_action, $do_log, $udata['user_id'], $udata['user_loginname']);
e107::getLog()->user_audit($log_action, $do_log, $udata['user_id'], $udata['user_loginname']);
}
else
{
if (count($do_log) > 1) { $log_action = USER_AUDIT_NEW_SET; } // Log multiple entries to one record
$admin_log->user_audit($log_action, $do_log);
e107::getLog()->user_audit($log_action, $do_log);
}
}
} // End of audit logging
@@ -576,11 +632,11 @@ if ($dataToSave && !$promptPassword)
// Now tidy up
if ($photo_to_delete)
{ // Photo may be a flat file, or in the database
delete_file($photo_to_delete);
$this->deleteFile($photo_to_delete);
}
if ($avatar_to_delete)
{ // Avatar may be a flat file, or in the database
delete_file($avatar_to_delete);
$this->deleteFile($avatar_to_delete);
}
// If user has changed display name, update the record in the online table
@@ -609,6 +665,9 @@ if ($dataToSave && !$promptPassword)
}
$USERSETTINGS_MESSAGE =$this->getTemplate('message');
$USERSETTINGS_MESSAGE_CAPTION = $this->getTemplate('message_caption');
if(isset($USERSETTINGS_MESSAGE))
{
$message = str_replace("{MESSAGE}",$message,$USERSETTINGS_MESSAGE);
@@ -638,70 +697,122 @@ if (!$error && !$promptPassword)
}
if ($promptPassword) // User has to enter password to validate data
{
$this->renderPasswordForm($changedUserData,$changedEUFData);
return false;
}
if ($error)
{
// require_once (e_HANDLER.'message_handler.php');
$message = $this->compileErrors($extraErrors, $allData, $eufVals);
// if(!empty($message))
{
if(deftrue('BOOTSTRAP'))
{
echo e107::getMessage()->addError($message)->render();
}
else
{
$ns->tablerender($caption, $message);
}
}
}
elseif($dataToSave === true) // --- User data has been updated here if appropriate ---
{
$testSessionMessage = e107::getMessage()->get(E_MESSAGE_SUCCESS, 'default', true); // only success in the session
if($testSessionMessage) $message = implode('<br />', $testSessionMessage); // we got raw message - array
if(empty($message))
{
$message = LAN_USET_41; // probably only extended fields updated.
}
if(deftrue('BOOTSTRAP'))
{
echo e107::getMessage()->addSuccess($message)->render();
}
else
{
$ns->tablerender($caption, $message);
}
}
$this->renderForm($changedUserData);
return false;
}
/**
* @param $extraErrors
* @param $allData
* @param $eufVals
* @return string
*/
private function compileErrors($extraErrors, $allData, $eufVals)
{
$temp = array();
$userMethods = e107::getUserSession();
if (count($extraErrors))
{
$temp[] = implode('<br />', $extraErrors);
}
if (count($allData['errors']))
{
$temp[] = validatorClass::makeErrorList($allData,'USER_ERR_','%n - %x - %t: %v', '<br />', $userMethods->userVettingInfo);
}
if (vartrue($eufVals['errors']))
{
$temp[] = '<br />'.validatorClass::makeErrorList($eufVals,'USER_ERR_','%n - %x - %t: %v', '<br />', NULL);
}
// message_handler('P_ALERT', implode('<br />', $temp));
$errorMsg = implode('<br />', $temp);
return implode('<br />', $temp);
if(deftrue('BOOTSTRAP'))
}
/**
* @param $string
* @return string
*/
private function getValidationKey($string)
{
echo e107::getMessage()->addError($errorMsg)->render();
return crypt($string, e_TOKEN);
}
else
/**
* @param $changedUserData
* @param $changedEUFData
*/
private function renderPasswordForm($changedUserData, $changedEUFData )
{
$ns->tablerender($caption, $message);
}
// $adref = $_POST['adminreturn'];
}
// --- User data has been updated here if appropriate ---
$testSessionMessage = e107::getMessage()->get(E_MESSAGE_SUCCESS, 'default', true); // only success in the session
if($testSessionMessage) $message = implode('<br />', $testSessionMessage); // we got raw message - array
if (isset($message))
{
if(deftrue('BOOTSTRAP'))
{
echo e107::getMessage()->addInfo($message)->render();
}
else
{
$ns->tablerender($caption, $message);
}
}
$uuid = ($_uid ? $_uid : USERID); // If $_uid is set, its an admin changing another user's data
if ($promptPassword)
{ // User has to enter password to validate data
$updated_data = serialize($changedUserData);
$validation_key = md5($updated_data);
$ns = e107::getRender();
$updated_data = e107::serialize($changedUserData,'json');
$validation_key = $this->getValidationKey($updated_data);
$updated_data = base64_encode($updated_data);
$updated_extended = serialize($changedEUFData);
$extended_key = md5($updated_extended);
$updated_extended = e107::serialize($changedEUFData, 'json');
$extended_key = $this->getValidationKey($updated_extended);
$updated_extended = base64_encode($updated_extended);
$text = "<form method='post' action='".e_SELF.(e_QUERY ? "?".e_QUERY : '')."'>
<table><tr><td style='text-align:center'>";
$formTarget = e107::getUrl()->create('user/myprofile/edit');
$text = "<form method='post' action='".$formTarget."'>
<table><tr><td>";
foreach ($_POST as $k => $v)
{
if (is_array($v))
@@ -716,42 +827,55 @@ if ($promptPassword)
$text .= "<input type='hidden' name='{$k}' value='{$v}' />\n";
}
}
$text .= LAN_USET_21."</td></tr><tr><td>&nbsp;</td></tr>
<tr><td style='text-align:center'><input type='password' name='currentpassword' value='' size='30' />";
$text .= "<input type='hidden' name='updated_data' value='{$updated_data}' /><input type='hidden' name='updated_key' value='{$validation_key}' />
<input type='hidden' name='updated_extended' value='{$updated_extended}' /><input type='hidden' name='extended_key' value='{$extended_key}' />
$text .= LAN_USET_21."</td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>
<input type='password' class='form-control' name='currentpassword' value='' size='30' />";
$text .= "
<input type='hidden' name='updated_data' value='{$updated_data}' />
<input type='hidden' name='updated_key' value='{$validation_key}' />
<input type='hidden' name='updated_extended' value='{$updated_extended}' />
<input type='hidden' name='extended_key' value='{$extended_key}' />
</td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td style='text-align:center'><input type='submit' name='SaveValidatedInfo' value='".LAN_ENTER."' /></td></tr>
<tr><td style='text-align:center'>
".e107::getForm()->button('SaveValidatedInfo',1, 'submit', LAN_ENTER)."
</td></tr>
</table>
</form>";
$ns->tablerender(LAN_USET_39, $text);
if(!$adminEdit)
}
/**
* @param $changedUserData
*/
private function renderForm($changedUserData)
{
require_once (FOOTERF);
}
else
{
require_once(e_ADMIN."footer.php");
}
}
//--------------------------------------------------------
// Re-read the user data into curVal (ready for display)
//--------------------------------------------------------
$sql = e107::getDb();
$ns = e107::getRender();
$tp = e107::getParser();
$userMethods = e107::getUserSession();
$uuid = USERID;
$qry = "
SELECT u.*, ue.* FROM #user AS u
LEFT JOIN #user_extended AS ue ON ue.user_extended_id = u.user_id
WHERE u.user_id=".intval($uuid);
$sql->gen($qry);
$sql->gen($qry); // Re-read the user data into curVal (ready for display)
$curVal=$sql->fetch();
$curVal['user_class'] = varset($changedUserData['user_class'], $curVal['user_class']);
$curVal['userclass_list'] = $userMethods->addCommonClasses($curVal, FALSE);
if (vartrue($_POST))
if(!empty($_POST))
{ // Fix for all the values being lost when there was an error in a field - restore from the latest $_POST values
// (Password fields have intentionally been cleared). If no error, there's an unset($_POST) to disable this block
foreach ($_POST as $key => $val)
@@ -764,10 +888,7 @@ if (vartrue($_POST))
}
}
//require_once (e_HANDLER."form_handler.php");
//$rs = new form;
$text = '<form method="post" action="'.vartrue($usersettings_form_action,e_REQUEST_URI).'" id="dataform" class="form-horizontal" enctype="multipart/form-data" autocomplete="off">';
$text = '<form method="post" action="'.vartrue($usersettings_form_action,e_REQUEST_URI).'" id="dataform" class="usersettings-form form-horizontal" enctype="multipart/form-data" autocomplete="off">';
//$text = (is_numeric($_uid) ? $rs->form_open("post", e_SELF."?".e_QUERY, "dataform", "", " class='form-horizontal' role='form' enctype='multipart/form-data'") : $rs->form_open("post", e_SELF, "dataform", "", " class='form-horizontal' role='form' enctype='multipart/form-data'"));
@@ -779,7 +900,10 @@ if (e_QUERY == "update")
// e107::scStyle($sc_style);
e107::getScBatch('usersettings')->setVars($curVal);
$text .= $tp->parseTemplate($USERSETTINGS_EDIT, true, $usersettings_shortcodes); //ParseSC must be set to true so that custom plugin -shortcodes can be utilized.
$USERSETTINGS_EDIT = $this->getTemplate('edit');
$USERSETTINGS_EDIT_CAPTION = $this->getTemplate('edit_caption');
$text .= $tp->parseTemplate($USERSETTINGS_EDIT, true, $this->sc); //ParseSC must be set to true so that custom plugin -shortcodes can be utilized.
$text .= "<div><input type='hidden' name='_uid' value='{$uuid}' /></div>
@@ -790,36 +914,27 @@ $caption = (isset($USERSETTINGS_EDIT_CAPTION)) ? $USERSETTINGS_EDIT_CAPTION : LA
$ns->tablerender($caption, $text);
if(!$adminEdit)
{
require_once (FOOTERF);
}
else
{
require_once(e_ADMIN."footer.php");
}
// If a field is required, returns a red asterisk
function req($field)
//
/**'
* todo review and remove method if deemed appropriate
* Delete a file from the public directories. Return TRUE on success, FALSE on failure.
* Also deletes from database if appropriate.
* @param $fname
*/
private function deleteFile($fname)
{
$ret = "";
if ($field == 2)
{
$ret = "<span class='required'> *</span>";
}
return $ret;
}
// Delete a file from the public directories. Return TRUE on success, FALSE on failure.
// Also deletes from database if appropriate.
function delete_file($fname, $dir = 'avatars/')
{
return;
/*
$dir = 'avatars/';
$sql = e107::getDb();
$tp = e107::getParser();
@@ -839,3 +954,25 @@ function delete_file($fname, $dir = 'avatars/')
*/
}
}
$us = new usersettings_front;
require_once(HEADERF);
$us->init();
require_once (FOOTERF);
// If a field is required, returns a red asterisk
function req($field)
{
$ret = "";
if ($field == 2)
{
$ret = "<span class='required'> *</span>";
}
return $ret;
}