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

Merge pull request #45 from e107inc/master

.
This commit is contained in:
rica-carv
2017-05-02 21:03:37 +01:00
committed by GitHub
66 changed files with 1636 additions and 853 deletions

View File

@@ -25,14 +25,14 @@ engines:
enabled: false
CleanCode/StaticAccess:
enabled: false
CleanCode/BooleanArgumentFlag:
enabled: false
UnusedFormalParameter:
enabled: false
Design/TooManyFields:
enabled: false
CleanCode/BooleanArgumentFlag:
enabled: false
CleanCode/ElseExpression:
enabled: false
config:
file_extensions: "php"
rulesets: "cleancode,unusedcode,codesize"

View File

@@ -749,6 +749,8 @@ define('SITECONTACTINFO', $tp->toHTML($pref['sitecontactinfo'], true, 'emotes_of
define('SITEEMAIL', vartrue($pref['replyto_email'],$pref['siteadminemail']));
define('USER_REGISTRATION', vartrue($pref['user_reg'],false)); // User Registration System Active or Not.
define('e_DEVELOPER', $developerMode);
define('e_VERSION', varset($pref['version'],''));
unset($developerMode);
if(!empty($pref['xurl']) && is_array($pref['xurl']))
@@ -2669,7 +2671,7 @@ class e_http_header
{
$this->setHeader("X-Powered-By: e107", true); // no less secure than e107-specific html.
}
if($this->compression_server_support == true)
{
$this->setHeader('Vary: Accept-Encoding');

View File

@@ -13,6 +13,8 @@
### Security
ServerSignature Off
#Header unset Pragma
# secure htaccess file
<Files .htaccess>
order allow,deny
@@ -42,6 +44,7 @@
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
SetEnv HTTP_MOD_REWRITE_MEDIA On
SetEnv HTTP_MOD_REWRITE_STATIC On
</IfModule>
### enable rewrites
@@ -65,6 +68,9 @@
RewriteRule ^media\/img\/([-A-Za-z0-9+/]*={0,3})\.(jpg|gif|png)?$ thumb.php?id=$1 [NC,L]
ReWriteRule ^theme\/img\/(a)?([\d]*)x(a)?([\d]*)\/(.*)?$ thumb.php?src=e_THEME/$5&$1w=$2&$3h=$4 [NC,L]
### Rewrite for Static Scripts
ReWriteRule ^static\/[0-9]*\/(.*)$ $1 [NC,L]
### send 404 on missing files in these folders
RewriteCond %{REQUEST_URI} !^/(e107_images|e107_files)/
@@ -99,6 +105,13 @@
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/xml text/xml application/rss+xml
</ifmodule>
<FilesMatch "\.(js|css|ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4|eot|otf|ttc|ttf|woff|woff2)$">
Header set Cache-Control "public"
Header unset Cookie
Header unset Set-Cookie
# Header set Access-Control-Allow-Origin "http://mydomain.com"
</FilesMatch>
### Enable when developing locally.
### SetEnv E_DEV true

View File

@@ -144,18 +144,18 @@ class admin_start
e_PLUGIN."pm/sendpm.sc",
e_PLUGIN."pm/shortcodes/",
e_PLUGIN."social/e_header.php",
e_PLUGIN."download/url/url.php",
e_PLUGIN."download/url/sef_url.php",
// e_PLUGIN."download/url/url.php",
// e_PLUGIN."download/url/sef_url.php",
);
$this->checkCoreVersion();
if(!empty($_POST['delete-deprecated']))
{
$this->deleteDeprecated();
}
unset($_SESSION['lancheck']);
e107::getDb()->db_Mark_Time('Check Paths');
@@ -253,6 +253,28 @@ class admin_start
}
private function checkCoreVersion()
{
$e107info = array();
require(e_ADMIN."ver.php");
if(!empty($e107info['e107_version']) && (e_VERSION !== $e107info['e107_version']))
{
e107::getConfig()->set('version', $e107info['e107_version'])->save(false,true,false);
// When version has changed, clear plugin/theme version cache.
e107::getPlug()->clearCache();
e107::getTheme()->clearCache();
e107::getDebug()->log("Updating core version pref");
}
}
private function checkCoreUpdate()
{
// auto db update
@@ -577,11 +599,13 @@ TMPO;
if(@unlink($file))
{
$mes->addSuccess("Deleted ".$file);
$message = e107::getParser()->lanVars(LAN_UI_FILE_DELETED, array('x'=>$file));
$mes->addSuccess($message);
}
else
{
$mes->addError("Unable to delete ".$file.". Please remove the file manually.");
$message = e107::getParser()->lanVars(LAN_UI_FILE_DELETED_FAILED, array('x'=>$file));
$mes->addError($message);
}
}

View File

@@ -359,89 +359,18 @@ class system_tools
// Developer Mode ONly.. No LANS.
private function githubSyncProcess()
{
$result = e107::getFile()->unzipGithubArchive('core');
// Delete any existing file.
if(file_exists(e_TEMP."e107-master.zip"))
{
unlink(e_TEMP."e107-master.zip");
}
$result = e107::getFile()->getRemoteFile('https://codeload.github.com/e107inc/e107/zip/master', 'e107-master.zip', 'temp');
if($result == false)
if($result === false)
{
e107::getMessage()->addError( DBLAN_118 );
return null;
}
$success = $result['success'];
$error = $result['error'];
$localfile = 'e107-master.zip';
chmod(e_TEMP.$localfile, 0755);
require_once(e_HANDLER."pclzip.lib.php");
// $base = realpath(dirname(__FILE__));
$newFolders = array(
'e107-master/e107_admin/' => e_BASE.e107::getFolder('ADMIN'),
'e107-master/e107_core/' => e_BASE.e107::getFolder('CORE'),
'e107-master/e107_docs/' => e_BASE.e107::getFolder('DOCS'),
'e107-master/e107_handlers/' => e_BASE.e107::getFolder('HANDLERS'),
'e107-master/e107_images/' => e_BASE.e107::getFolder('IMAGES'),
'e107-master/e107_languages/' => e_BASE.e107::getFolder('LANGUAGES'),
'e107-master/e107_media/' => e_BASE.e107::getFolder('MEDIA'),
'e107-master/e107_plugins/' => e_BASE.e107::getFolder('PLUGINS'),
'e107-master/e107_system/' => e_BASE.e107::getFolder('SYSTEM'),
'e107-master/e107_themes/' => e_BASE.e107::getFolder('THEMES'),
'e107-master/e107_web/' => e_BASE.e107::getFolder('WEB'),
'e107-master/' => e_BASE
);
$srch = array_keys($newFolders);
$repl = array_values($newFolders);
$archive = new PclZip(e_TEMP.$localfile);
$unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_TEMP, PCLZIP_OPT_SET_CHMOD, 0755)); // Store in TEMP first.
$error = array();
$success = array();
$skipped = array();
// print_a($unarc);
$excludes = array('e107-master/','e107-master/install.php','e107-master/favicon.ico');
foreach($unarc as $k=>$v)
{
if(in_array($v['stored_filename'],$excludes))
{
continue;
}
$oldPath = $v['filename'];
$newPath = str_replace($srch,$repl, $v['stored_filename']);
$message = e107::getParser()->lanVars(DBLAN_121, array('x'=>$oldPath, 'y'=>$newPath));
if($v['folder'] ==1 && is_dir($newPath))
{
// $skipped[] = $newPath. " (already exists)";
continue;
}
if(!rename($oldPath,$newPath))
{
$error[] = $message;
}
else
{
$success[] = $message;
}
// echo $message."<br />";
}
// $message = e107::getParser()->lanVars(DBLAN_121, array('x'=>$oldPath, 'y'=>$newPath));
if(!empty($success))
{
@@ -458,9 +387,6 @@ class system_tools
e107::getMessage()->addError(print_a($error,true));
}
e107::getRender()->tablerender(DBLAN_10.SEP.DBLAN_112, e107::getMessage()->render());
}

View File

@@ -469,8 +469,8 @@ class eurl_admin_ui extends e_admin_controller_ui
if(!empty($_POST['eurl_profile']))
{
e107::getConfig()->set('url_profiles', $_POST['eurl_profile']);
unset($locations['download']);
unset($config['download']);
// unset($locations['download']);
// unset($config['download']);
}
e107::getConfig()

View File

@@ -212,11 +212,11 @@ class adminstyle_flexpanel extends adminstyle_infopanel
// --------------------- Website Status ---------------------------
$ns->setStyle('flexpanel');
/* $ns->setStyle('flexpanel');
$ns->setUniqueId('core-infopanel_website_status');
$coreInfoPanelWebsiteStatus = $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderWebsiteStatus(), "core-infopanel_website_status", true);
$coreInfoPanelWebsiteStatus = '';// 'hi';/// "<div id='core-infopanel_website_status'>".$this->renderAddonDashboards()."</div>"; $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderAddonDashboards(), "core-infopanel_website_status", true);
$info = $this->getMenuPosition('core-infopanel_website_status');
$panels[$info['area']][$info['weight']] .= $coreInfoPanelWebsiteStatus;
$panels[$info['area']][$info['weight']] .= $coreInfoPanelWebsiteStatus;*/
// --------------------- Latest Comments --------------------------
@@ -254,6 +254,26 @@ class adminstyle_flexpanel extends adminstyle_infopanel
}
}
// --------------------- Plugin Addon Dashboards ---------------------- eg. e107_plugin/user/e_dashboard.php
$dashboards = $this->getAddonDashboards();
if(!empty($dashboards))
{
$ns->setStyle('flexpanel');
foreach($dashboards as $val)
{
$id = $val['mode'];
$ns->setUniqueId($id);
$inc = $ns->tablerender($val['caption'], $val['text'], $val['mode'], true);
$info = $this->getMenuPosition($id);
$panels[$info['area']][$info['weight']] .= $inc;
}
}
// Sorting panels.
foreach($panels as $key => $value)
{
@@ -292,7 +312,7 @@ class adminstyle_flexpanel extends adminstyle_infopanel
{
$user_pref = $this->getUserPref();
if(varset($user_pref['core-flexpanel-order'][$id]))
if(!empty($user_pref['core-flexpanel-order'][$id]))
{
return $user_pref['core-flexpanel-order'][$id];
}
@@ -311,6 +331,14 @@ class adminstyle_flexpanel extends adminstyle_infopanel
return $positions[$layout][$id];
}
if(strpos($id,'plug-infopanel-') === 0) // addon dashboards default to area 2.
{
$default = array(
'area' => 'menu-area-02',
'weight' => 1000,
);
}
return $default;
}

View File

@@ -264,7 +264,7 @@ class adminstyle_infopanel
$text3 .= $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderWebsiteStatus(),"",true);
// $text3 .= $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderWebsiteStatus(),"",true);
@@ -364,7 +364,7 @@ class adminstyle_infopanel
}
}
/*
private function renderChart()
{
@@ -374,51 +374,62 @@ class adminstyle_infopanel
{
return $this->renderStats('log');
}
/* elseif(e107::isInstalled('awstats'))
{
return $this->renderStats('awstats');
}*/
else
{
return $this->renderStats('demo');
}
}
}*/
function renderWebsiteStatus()
{
$tp = e107::getParser();
return;
/* $tp = e107::getParser();
$tab = array();
$tab['e-stats'] = array('caption'=>$tp->toGlyph('fa-signal').' '.LAN_STATS, 'text'=>$this->renderChart());
$tab['e-online'] = array('caption'=>$tp->toGlyph('fa-user').' '.LAN_ONLINE.' ('.$this->renderOnlineUsers('count').')', 'text'=>$this->renderOnlineUsers());
return e107::getForm()->tabs($tab);
return e107::getForm()->tabs($tab);*/
}
function renderAddonDashboards()
function getAddonDashboards()
{
$panel = array();
$ns = e107::getRender();
$arr = array();
$text = '';
if($plugs = e107::getAddonConfig('e_dashboard',null, 'chart'))
{
foreach($plugs as $plug => $val)
{
$adg = e107::getAddon($plug,'e_dashboard');
if(!empty($adg->chartCaption))
{
$cap = $adg->chartCaption;
}
else
{
$cap = defset('LAN_PLUGIN_'.strtoupper($plug).'_NAME', ucfirst($plug));
}
foreach($val as $k=>$item)
{
if(!empty($item))
{
// $var[] = $item;
$renderMode = 'plug-infopanel-'.$plug;
$renderMode = 'plug-infopanel-'.$plug."-".intval($k);
if(isset($item[$k]['text']))
if(!isset($item['text']))
{
foreach ($item as $key => $v) // make sure the ids are unique.
{
$newkey = eHelper::dasherize($plug.'-'.$k.'-'.$key);
@@ -427,12 +438,16 @@ class adminstyle_infopanel
}
$t = e107::getForm()->tabs($item);
$cap = defset('LAN_PLUGIN_'.strtoupper($plug).'_NAME', ucfirst($plug));
$text .= $ns->tablerender($cap, $t, $renderMode, true);
// $text .= $ns->tablerender($cap, $t, $renderMode, true);
$arr[] = array('caption'=>$cap, 'text'=>$t, 'mode'=>$renderMode);
}
else
{
$text .= $ns->tablerender($item['caption'], $item['text'], $renderMode, true);
// $text .= $ns->tablerender($item['caption'], $item['text'], $renderMode, true);
$arr[] = array('caption'=>$item['caption'], 'text'=>$item['text'], 'mode'=>$renderMode);
}
}
}
@@ -440,129 +455,29 @@ class adminstyle_infopanel
}
}
return $arr;
}
function renderAddonDashboards()
{
$ns = e107::getRender();
$arr = $this->getAddonDashboards();
$text = '';
foreach($arr as $val)
{
$text .= $ns->tablerender($val['caption'], $val['text'], $val['mode'], true);
}
return $text;
}
function renderOnlineUsers($data=false)
{
$ol = e107::getOnline();
$tp = e107::getParser();
$multilan = e107::getPref('multilanguage');
$panelOnline = "
<table class='table table-condensed table-striped' >
<colgroup>
<col style='width: 10%' />
<col style='width: 25%' />
<col style='width: 10%' />
<col style='width: 40%' />
<col style='width: auto' />";
$panelOnline .= (!empty($multilan)) ? "<col style='width: auto' />" : "";
$panelOnline .= "
</colgroup>
<thead>
<tr class='first'>
<th>".LAN_TIMESTAMP."</th>
<th>".LAN_USER."</th>
<th>".LAN_IP."</th>
<th>".LAN_PAGE."</th>
<th class='center'>".LAN_AGENT."</th>";
$panelOnline .= (!empty($multilan)) ? "<th class='center'>".LAN_LANG."</th>" : "";
$panelOnline .= "
</tr>
</thead>
<tbody>";
$online = $ol->userList() + $ol->guestList();
if($data == 'count')
{
return count($online);
}
// echo "Users: ".print_a($online);
$lng = e107::getLanguage();
foreach ($online as $val)
{
$panelOnline .= "
<tr>
<td class='nowrap'>".e107::getDateConvert()->convert_date($val['user_currentvisit'],'%H:%M:%S')."</td>
<td>".$this->renderOnlineName($val['online_user_id'])."</td>
<td>".e107::getIPHandler()->ipDecode($val['user_ip'])."</td>
<td><a class='e-tip' href='".$val['user_location']."' title='".$val['user_location']."'>".$tp->html_truncate(basename($val['user_location']),50,"...")."</a></td>
<td class='center'><a class='e-tip' href='#' title='".$val['user_agent']."'>".$this->browserIcon($val)."</a></td>";
$panelOnline .= (!empty($multilan)) ? "<td class='center'><a class='e-tip' href='#' title=\"".$lng->convert($val['user_language'])."\">".$val['user_language']."</a></td>" : "";
$panelOnline .= "
</tr>
";
}
$panelOnline .= "</tbody></table>";
return $panelOnline;
}
function browserIcon($row)
{
$types = array(
"ie" => "MSIE",
'chrome' => 'Chrome',
'firefox' => 'Firefox',
'seamonkey' => 'Seamonkey',
// 'Chromium/xyz
'safari' => "Safari",
'opera' => "Opera"
);
if($row['user_bot'] === true)
{
return "<i class='browser e-bot-16'></i>";
}
foreach($types as $icon=>$b)
{
if(strpos($row['user_agent'], $b)!==false)
{
return "<i class='browsers e-".$icon."-16' ></i>";
}
}
return "<i class='browsers e-firefox-16'></i>"; // FIXME find a default icon.
}
function renderOnlineName($val)
{
if($val==0)
{
return LAN_GUEST;
}
return $val;
}
function renderLatestComments()
{
$sql = e107::getDb();
@@ -768,202 +683,11 @@ class adminstyle_infopanel
return $text;
}
private function getStats($type)
{
/*
if(file_exists(e_PLUGIN."awstats/awstats.graph.php"))
{
require_once(e_PLUGIN."awstats/awstats.graph.php");
$stat = new awstats;
if($data = $stat->getData())
{
return $data;
}
// return;
}
*/ if($type == 'demo')
{
$data = array();
$months = e107::getDate()->terms('month');
$data['labels'] = array($months[0], //"January",
$months[1], //"February",
$months[2], //"March",
$months[3], //"April",
$months[4], //"May",
$months[5], //"June",
$months[6] //"July"
);
$data['datasets'][] = array(
'fillColor' => "rgba(220,220,220,0.5)",
'strokeColor' => "rgba(220,220,220,1)",
'pointColor ' => "rgba(220,220,220,1)",
'pointStrokeColor' => "#fff",
'data' => array(65,59,90,81,56,55,40),
'title' => ADLAN_168// "Visits"
);
$data['datasets'][] = array(
'fillColor' => "rgba(151,187,205,0.5)",
'strokeColor' => "rgba(151,187,205,1)",
'pointColor ' => "rgba(151,187,205,1)",
'pointStrokeColor' => "#fff",
'data' => array(28,48,40,19,96,27,100),
'title' => ADLAN_169 //"Unique Visits"
);
return $data;
}
$sql = e107::getDB();
$td = date("Y-m-j", time());
$dayarray[$td] = array();
$pagearray = array();
$qry = "
SELECT * from #logstats WHERE log_id REGEXP('[[:digit:]]+\-[[:digit:]]+\-[[:digit:]]+')
ORDER BY CONCAT(LEFT(log_id,4), SUBSTRING(log_id, 6, 2), LPAD(SUBSTRING(log_id, 9), 2, '0'))
DESC LIMIT 0,9
";
if($amount = $sql->gen($qry))
{
$array = $sql->db_getList();
$ttotal = 0;
$utotal = 0;
foreach($array as $key => $value)
{
extract($value);
$log_id = substr($log_id, 0, 4).'-'.substr($log_id, 5, 2).'-'.str_pad(substr($log_id, 8), 2, '0', STR_PAD_LEFT);
if(is_array($log_data)) {
$entries[0] = $log_data['host'];
$entries[1] = $log_data['date'];
$entries[2] = $log_data['os'];
$entries[3] = $log_data['browser'];
$entries[4] = $log_data['screen'];
$entries[5] = $log_data['referer'];
}
else
{
$entries = explode(chr(1), $log_data);
}
$dayarray[$log_id]['daytotal'] = $entries[0];
$dayarray[$log_id]['dayunique'] = $entries[1];
unset($entries[0]);
unset($entries[1]);
foreach($entries as $entry)
{
if($entry)
{
list($url, $total, $unique) = explode("|", $entry);
if(strstr($url, "/"))
{
$urlname = preg_replace("/\.php|\?.*/", "", substr($url, (strrpos($url, "/")+1)));
}
else
{
$urlname = preg_replace("/\.php|\?.*/", "", $url);
}
$dayarray[$log_id][$urlname] = array('url' => $url, 'total' => $total, 'unique' => $unique);
if (!isset($pagearray[$urlname]['total'])) $pagearray[$urlname]['total'] = 0;
if (!isset($pagearray[$urlname]['unique'])) $pagearray[$urlname]['unique'] = 0;
$pagearray[$urlname]['total'] += $total;
$pagearray[$urlname]['unique'] += $unique;
$ttotal += $total;
$utotal += $unique;
}
}
}
}
$logfile = e_LOG.'logp_'.date('z.Y', time()).'.php'; // was logi_ ??
if(is_readable($logfile))
{
require($logfile);
}
if(vartrue($pageInfo))
{
foreach($pageInfo as $fkey => $fvalue)
{
$dayarray[$td][$fkey]['total'] += $fvalue['ttl'];
$dayarray[$td][$fkey]['unique'] += $fvalue['unq'];
$dayarray[$td]['daytotal'] += $fvalue['ttl'];
$dayarray[$td]['dayunique'] += $fvalue['unq'];
$pagearray[$fkey]['total'] += $fvalue['ttl'];
$pagearray[$fkey]['unique'] += $fvalue['unq'];
$ttotal += $fvalue['ttl'];
$utotal += $fvalue['unq'];
}
}
$visitors = array();
$unique = array();
ksort($dayarray);
foreach($dayarray as $k=>$v)
{
$unix = strtotime($k);
$visitors[] = intval(vartrue($v['daytotal']));
$unique[] = intval(vartrue($v['dayunique']));
$label[] = "'".date("D",$unix)."'";
}
$data = array();
$data['labels'] = $label;
//visitors
$data['datasets'][] = array(
'fillColor' => "rgba(220,220,220,0.5)",
'strokeColor' => "rgba(220,220,220,1)",
'pointColor ' => "rgba(220,220,220,1)",
'pointStrokeColor' => "#fff",
'data' => $visitors
);
//Unique Visitors
$data['datasets'][] = array(
'fillColor' => "rgba(151,187,205,0.5)",
'strokeColor' => "rgba(151,187,205,1)",
'pointColor ' => "rgba(151,187,205,1)",
'pointStrokeColor' => "#fff",
'data' => $unique
);
return $data;
}
private function renderStats($type)
/* private function renderStats($type)
{
$data = $this->getStats($type);
@@ -994,7 +718,7 @@ class adminstyle_infopanel
return $text;
}
}*/
}
?>

View File

@@ -37,7 +37,7 @@ $FLEXPANEL_LAYOUT = '
</div>
</div>
<div class="row">
<div class="row row-flex">
<div class="col-sm-4">
<div class="draggable-panels" id="menu-area-03">
{MENU_AREA_03}
@@ -65,7 +65,7 @@ $FLEXPANEL_LAYOUT = '
</div>
</div>
<div class="row">
<div class="row row-flex">
<div class="col-sm-6">
<div class="draggable-panels" id="menu-area-07">
{MENU_AREA_07}

View File

@@ -314,6 +314,7 @@ class lancheck
private $deprecatedFiles = array('lan_download.php', 'lan_parser_functions.php', 'lan_prefs.php', 'admin/lan_download.php', 'admin/lan_modcomment.php');
private $installed_languages = array();
function __construct()
{
@@ -346,8 +347,12 @@ class lancheck
$pref = e107::getPref();
// Check current theme also (but do NOT add to generated zip)
$this->core_themes[] = $pref['sitetheme'];
$this->core_themes = array_unique($this->core_themes);
if(deftrue('e_DEBUG'))
{
$this->core_themes[] = $pref['sitetheme'];
$this->core_themes = array_unique($this->core_themes);
}
if(E107_DEBUG_LEVEL > 0)
{
@@ -649,11 +654,11 @@ class lancheck
if(is_readable(e_ADMIN."ver.php"))
{
include(e_ADMIN."ver.php");
// include(e_ADMIN."ver.php");
}
require_once(e_HANDLER.'pclzip.lib.php');
list($ver, $tmp) = explode(" ", $e107info['e107_version']);
list($ver, $tmp) = explode(" ", e_VERSION);
if(!$locale = $this->findLocale($language))
{
$ret['error'] = TRUE;
@@ -791,63 +796,34 @@ class lancheck
return $pzip;
}
/**
* List the installed language packs.
* @return
* Get Installed Language-Pack Meta Data.
* @return array
*/
function showLanguagePacks()
function getLocalLanguagePacks()
{
$frm = e107::getForm();
$ns = e107::getRender();
$tp = e107::getParser();
$this->installed_languages = e107::getLanguage()->installed();
if(is_readable(e_ADMIN."ver.php"))
{
include(e_ADMIN."ver.php");
list($ver, $tmp) = explode(" ", $e107info['e107_version']);
}
$xml = e107::getXml();
$lans = e107::getLanguage()->installed();
$arr = array();
$release_diz = defined("LANG_LAN_30") ? LANG_LAN_30 : "Release Date";
$compat_diz = defined("LANG_LAN_31") ? LANG_LAN_31 : "Compatibility";
$lan_pleasewait = (deftrue('LAN_PLEASEWAIT')) ? $tp->toJS(LAN_PLEASEWAIT) : "Please Wait";
$text = "<form id='lancheck' method='post' action='".e_REQUEST_URI."'>
<table class='table table-striped'>";
$text .= "<thead>
<tr>
<th>".ADLAN_132."</th>
<th>".$release_diz."</th>
<th>".$compat_diz."</th>
<th>".LAN_STATUS."</td>
<th style='width:25%;white-space:nowrap'>".LAN_OPTIONS."</td>
</tr>
</thead>
";
require_once(e_HANDLER."xml_class.php");
$xm = new XMLParse();
foreach($lans as $language)
foreach($this->installed_languages as $language)
{
if($language == "English")
{
continue;
}
$metaFile = e_LANGUAGEDIR.$language."/".$language.".xml";
if(is_readable($metaFile))
{
$rawData = file_get_contents($metaFile);
$rawData = $xml->loadXMLfile($metaFile,true);
if($rawData)
{
$array = $xm->parse($rawData);
$value = $array['e107Language']['attributes'];
$value = $rawData['@attributes'];
}
else
{
@@ -865,148 +841,68 @@ class lancheck
);
}
$errFound = (isset($_SESSION['lancheck'][$language]['total']) && $_SESSION['lancheck'][$language]['total'] > 0) ? TRUE : FALSE;
$value['type'] = 'local';
$text .= "<tr>
<td >".$language."</td>
<td>".$value['date']."</td>
<td>".$value['compatibility']."</td>
<td>".($ver != $value['compatibility'] || $errFound ? ADMIN_FALSE_ICON : ADMIN_TRUE_ICON )."</td>
<td>";
// $text .= "<input type='submit' name='language_sel[{$language}]' value=\"".LAN_CHECK_2."\" class='btn btn-primary' />";
$text .= "<a href='".e_REQUEST_URI."&amp;sub=verify&amp;lan=".$language."' class='btn btn-primary' >".LAN_CHECK_2."</a>";
$text .= "
<input type='submit' name='ziplang[{$language}]' value=\"".LANG_LAN_23."\" class='btn btn-default' onclick=\"this.value = '".$lan_pleasewait."'\" /></td>
</tr>";
$arr[$language] = $value;
}
$text .= "
</tr></table>";
$text .= "<table class='table table-striped'>";
$text .= "<thead><tr><th>".LAN_OPTIONS."</th></tr></thead><tbody>";
$srch = array("[","]");
$repl = array("<a rel='external' href='https://github.com/orgs/e107translations/teams'>","</a>");
$diz = (deftrue("LANG_LAN_28")) ? LANG_LAN_28 : "Check this box if you are a member of the [e107 translation team].";
$checked = varset($_COOKIE['e107_certified']) == 1 ? true : false;
$text .= "<tr><td>";
$text .= $frm->checkbox('contribute_pack',1,$checked,array('label'=>str_replace($srch,$repl,$diz)));
;
$text .= "</td>
</tr>
<tr>
<td>";
// $echecked = varset($_SESSION['lancheck-errors-only']) == 1 ? true : false;
// $text .= $frm->checkbox('errorsonly',1,$echecked,array('label'=>$lan_displayerrors));
$text .= " </td>
</tr>";
// $text .= "
// <tr>
// <td>".$frm->checkbox('non-core-plugs-themes',1,$echecked,array('label'=>$lan_displayerrors))."</td>
// </tr>
// ";
$text .= "</tbody></table>";
$text .= "</form>";
$text .= "<div class='smalltext center' style='padding-top:50px'>".LANG_LAN_AGR."</div>";
$text .= $this->onlineLanguagePacks();
return $text;
return;
return $arr;
}
private function onlineLanguagePacks()
/**
* Get Online Language-Pack Meta Data.
* @return array|bool
*/
public function getOnlineLanguagePacks()
{
$xml = e107::getXml();
$feed = e107::getPref('xmlfeed_languagepacks');
$feed = 'https://e107.org/languagepacks.xml';
$text = '';
$languages = array();
if($rawData = $xml -> loadXMLfile($feed, TRUE))
{
if(!varset($rawData['language']))
if(empty($rawData['language']))
{
return FALSE;
return false;
}
$text .= "<div class='block-text'>".LANG_LAN_35."</div>";
$text .= "<table class='table adminlist'>";
foreach($rawData['language'] as $val)
{
$att = $val['@attributes'];
$name = $att['folder'];
$languages[$name] = array(
'name' => $att['name'],
'author' => $att['author'],
'authorURL' => $att['authorURL'],
'folder' => $att['folder'],
'version' => $att['version'],
'date' => $att['date'],
$id = $att['name'];
$languages[$id] = array(
'name' => $att['name'],
'author' => $att['author'],
'infoURL' => $att['infourl'],
// 'folder' => $att['folder'],
'version' => $att['version'],
'date' => $att['date'],
'compatibility' => $att['compatibility'],
'url' => $att['url']
'url' => $att['url'],
'type' => 'online'
);
}
ksort($languages);
$text .= "<thead>
<tr>
<th>".LAN_NAME."</th>
<th>".LAN_VERSION."</th>
<th>".LAN_AUTHOR."</th>
<th>".LANG_LAN_111."</th>
<th>".LANG_LAN_112."</th>
<th>".LAN_DOWNLOAD."</th>
</tr>
</thead>
<tbody>";
foreach($languages as $value)
{
$text .= "<tr>
<td>".$value['name']."</td>
<td>".$value['version']."</td>
<td><a href='".$value['authorURL']."'>".$value['author']."</a></td>
<td>".$value['date']."</td>
<td>".$value['compatibility']."</td>
<td><a href='".$value['url']."'>".LANG_LAN_114."</a></td>
</tr>";
}
$text .= "</tbody></table>";
}
return $text;
return $languages;
}
function check_all($mode='render', $lan=null)
{
// global $ns,$tp;
@@ -1081,14 +977,14 @@ class lancheck
}
$message = "
<form id='lancheck' method='post' action='".e_ADMIN."language.php?tools'>
<form id='lancheck' method='post' action='".e_ADMIN."language.php?mode=main&action=tools'>
<div>\n";
$icon = ($_SESSION['lancheck'][$lan]['total']>0) ? ADMIN_FALSE_ICON : ADMIN_TRUE_ICON;
$errors_diz = (deftrue('LAN_CHECK_23')) ? LAN_CHECK_23 : "Errors Found";
$message .= $errors_diz.": ".$_SESSION['lancheck'][$lan]['total'];
$just_go_diz = (deftrue('LAN_CHECK_20')) ? LAN_CHECK_20 : "Generate Language Pack";
@@ -1361,7 +1257,7 @@ class lancheck
$style = ($er) ? "forumheader2" : "forumheader3";
$text .= "<td class='{$style}' style='width:50%'><div class='smalltext'>";
$text .= $bom_error . $utf_error;
$text .= (!$er && !$bom_error && !$utf_error) ? "<img src='".e_IMAGE."fileinspector/integrity_pass.png' alt='".LAN_OK."' />" : $er."<br />";
$text .= (!$er && !$bom_error && !$utf_error) ? ADMIN_TRUE_ICON : $er."<br />";
$text .= "</div></td>";
}
else
@@ -1421,16 +1317,16 @@ class lancheck
if($eng_line == $trans_line && !empty($eng_line))
{
$warning[] = "<span class='text-warning'>".$def. ": Identical string (warning only) </span>";
$warning[] = "<span class='text-warning'>".$def. ": ".LAN_CHECK_29."</span>";
}
if((strpos($eng_line,"[link=")!==FALSE && strpos($trans_line,"[link=")===FALSE) || (strpos($eng_line,"[b]")!==FALSE && strpos($trans_line,"[b]")===FALSE))
{
$error[] = $def. ": Missing bbcodes";
$error[] = $def. ": ".LAN_CHECK_30;
}
elseif((strpos($eng_line,"[")!==FALSE && strpos($trans_line,"[")===FALSE) || (strpos($eng_line,"]")!==FALSE && strpos($trans_line, "]")===FALSE))
{
$error[] = $def. ": Missing [ and/or ] character(s)";
$error[] = $def. ": ".LAN_CHECK_31;
}
if((strpos($eng_line,"--LINK--")!==false && strpos($trans_line,"--LINK--")===false))
@@ -1455,7 +1351,7 @@ class lancheck
if(($stripped == $trans_line))
{
// echo "<br /><br />".$def. "<br />".$stripped."<br />".$trans_line;
$error[] = $def. ": Missing HTML tags" ;
$error[] = $def. ": ".LAN_CHECK_32;
}
}
@@ -1722,7 +1618,7 @@ class lancheck
$style = ($er) ? "forumheader2" : "forumheader3";
$text .= "<td class='{$style}' style='width:50%'><div class='smalltext'>";
$text .= $bom_error . $utf_error;
$text .= (!$er && !$bom_error && !$utf_error) ? "<img src='".e_IMAGE."fileinspector/integrity_pass.png' alt='".LAN_OK."' />" : $er."<br />";
$text .= (!$er && !$bom_error && !$utf_error) ? ADMIN_TRUE_ICON : $er."<br />";
$text .= "</div></td>";
}
else

View File

@@ -54,7 +54,8 @@ if(!empty($_GET['iframe']))
);
protected $adminMenuAliases = array(
'main/edit' => 'main/list'
'main/edit' => 'main/list',
// 'main/download' => 'main/tools'
);
protected $adminMenuIcon = 'e-language-24';
@@ -123,12 +124,31 @@ if(!empty($_GET['iframe']))
);
protected $installedLanguages = array();
protected $localPacks = array();
protected $onlinePacks = array();
public function init()
{
$this->installedLanguages = e107::getLanguage()->installed();
$this->prefs['sitelanguage']['writeParms']['optArray'] = $this->installedLanguages;
$this->prefs['adminlanguage']['writeParms']['optArray'] = $this->installedLanguages;
e107::css('inline', "
.language-name { padding-left:15px }
");
}
private function loadPackInfo()
{
$lck = e107::getSingleton('lancheck', e_ADMIN."lancheck.php");
$this->onlinePacks = $lck->getOnlineLanguagePacks();
$this->localPacks = $lck->getLocalLanguagePacks();
}
@@ -153,8 +173,11 @@ if(!empty($_GET['iframe']))
return $text;
}
function toolsPage()
function ToolsPage()
{
$this->loadPackInfo();
$pref = e107::getPref();
$lck = e107::getSingleton('lancheck', e_ADMIN."lancheck.php");
@@ -172,24 +195,234 @@ if(!empty($_GET['iframe']))
}
$text = $lck->showLanguagePacks();
return $this->renderLanguagePacks();
//e107::getRender()->tablerender(ADLAN_132.SEP.LANG_LAN_32, $text);
//return;
}
// e107::getRender()->tablerender(ADLAN_132.SEP."Core Language-Pack Developer", );
function DownloadPage()
{
$this->loadPackInfo();
$lan = $this->getId();
if(empty($lan))
{
return LAN_ERROR;
}
if(empty($this->onlinePacks[$lan]['url']))
{
return LAN_ERROR;
}
$result = e107::getFile()->unzipGithubArchive($this->onlinePacks[$lan]['url']);
if(!empty($result['success']))
{
e107::getMessage()->addSuccess(print_a($result['success'],true));
$_SESSION['lancheck'][$lan]['total'] = 0; // reset errors to zero.
}
if(!empty($result['error']))
{
e107::getMessage()->addError(print_a($result['error'],true));
}
$this->addTitle(LANG_LAN_114);
$this->addTitle($lan);
return e107::getMessage()->render();
}
/**
* List the installed language packs.
* @return string
*/
private function renderLanguagePacks()
{
$frm = e107::getForm();
$ns = e107::getRender();
$tp = e107::getParser();
// if(is_readable(e_ADMIN."ver.php"))
{
// include(e_ADMIN."ver.php");
list($ver, $tmp) = explode(" ", e_VERSION);
}
$lck = e107::getSingleton('lancheck', e_ADMIN."lancheck.php");
$release_diz = defset("LANG_LAN_30","Release Date");
$compat_diz = defset("LANG_LAN_31", "Compatibility");
$lan_pleasewait = (deftrue('LAN_PLEASEWAIT')) ? $tp->toJS(LAN_PLEASEWAIT) : "Please Wait";
$text = "<form id='lancheck' method='post' action='".e_REQUEST_URI."'>
<table class='table adminlist table-striped'>
<colgroup>
<col style='width:20%' />
<col style='width:20%' />
<col style='width:20%' />
<col style='width:15%' />
<col style='width:25%' />
</colgroup>";
$text .= "<thead>
<tr>
<th>".ADLAN_132."</th>
<th class='text-center'>".$release_diz."</th>
<th class='text-center'>".$compat_diz."</th>
<th class='text-center'>".LAN_STATUS."</td>
<th class='text-right' style='white-space:nowrap'>".LAN_OPTIONS."</td>
</tr>
</thead>
";
$text .= "<tr><th colspan='5'>".LAN_INSTALLED."</th></tr>";
// $onlinePacks = $lck->getOnlineLanguagePacks();
// $localPacks = $lck->getLocalLanguagePacks();
foreach($this->localPacks as $language=>$value)
{
$errFound = (isset($_SESSION['lancheck'][$language]['total']) && $_SESSION['lancheck'][$language]['total'] > 0) ? TRUE : FALSE;
$text .= "<tr>
<td><span class='language-name'>".$language."</a></td>
<td class='text-center'>".$value['date']."</td>
<td class='text-center'>".$value['compatibility']."</td>
<td class='text-center'>".( $errFound ? ADMIN_FALSE_ICON : ADMIN_TRUE_ICON )."</td>
<td class='text-right'>";
// $text .= "<input type='submit' name='language_sel[{$language}]' value=\"".LAN_CHECK_2."\" class='btn btn-primary' />";
$text .= "<a href='".e_REQUEST_URI."&amp;sub=verify&amp;lan=".$language."' class='btn btn-default' >".$tp->toGlyph('fa-search').LAN_CHECK_2."</a>";
/* $text .= "
<input type='submit' name='ziplang[{$language}]' value=\"".LANG_LAN_23."\" class='btn btn-default' onclick=\"this.value = '".$lan_pleasewait."'\" />";
*/
$text .= "</td>
</tr>";
}
$text .= "<tr><th colspan='5'>".defset('LANG_LAN_151','Available')."</th></tr>"; // don't translate this.
$text .= $this->renderOnlineLanguagePacks();
$text .= "
</tr></table>";
$creditLan = defset('LANG_LAN_152', "Courtesy of the [e107 translation team]"); // don't translate this.
$srch = array("[","]");
$repl = array("<a rel='external' href='https://github.com/orgs/e107translations/teams'>","</a>");
$text .= "<div class='nav navbar'><small class='navbar-text'>".str_replace($srch,$repl,$creditLan)."</small></div>";
/*
$text .= "<table class='table table-striped'>";
$text .= "<thead><tr><th>".LAN_OPTIONS."</th></tr></thead><tbody>";
$srch = array("[","]");
$repl = array("<a rel='external' href='https://github.com/orgs/e107translations/teams'>","</a>");
$diz = (deftrue("LANG_LAN_28")) ? LANG_LAN_28 : "Check this box if you are a member of the [e107 translation team].";
$checked = varset($_COOKIE['e107_certified']) == 1 ? true : false;
$text .= "<tr><td>";
$text .= $frm->checkbox('contribute_pack',1,$checked,array('label'=>str_replace($srch,$repl,$diz)));
;
$text .= "</td>
</tr>
<tr>
<td>";
$text .= " </td>
</tr>";
$text .= "</tbody></table>";
*/
$text .= "</form>";
// $text .= "<div class='text-right text-muted' style='padding-top:50px'><small>".LANG_LAN_AGR."</small></div>";
return $text;
}
private function renderOnlineLanguagePacks()
{
$text = '';
$tp = e107::getParser();
foreach($this->onlinePacks as $lan=>$value)
{
if(!empty($this->localPacks[$lan]))
{
if($this->localPacks[$lan]['compatibility'] == $value['compatibility'] && !deftrue('e_DEBUG'))
{
continue;
}
// $status = $tp->toGlyph('fa-star');
$class = 'btn-primary';
}
else
{
$status = "&nbsp;";
$class = 'btn-default';
}
$text .= "<tr>
<td><span class='language-name'><a rel='external' href='".$value['infoURL']."' title=\"".LAN_MOREINFO."\">".$value['name']."</a></span></td>";
/* $text .= "
<td>".$value['version']."</td>
<td><a href='".$value['authorURL']."'>".$value['author']."</a></td>";*/
$url = 'language.php?mode=main&action=download&id='.$value['name']; // $value['url']
$text .= "
<td class='text-center'>".$value['date']."</td>
<td class='text-center'>".$value['compatibility']."</td>
<td class='text-center'>".$status."</td>
<td class='text-right'><a class='btn ".$class."' href='".$url."'><i class='fa fa-arrow-down'></i> ".ADLAN_121."</a></td>
</tr>";
}
return $text;
}
private function getTables()
{
// grab default language lists.

View File

@@ -144,7 +144,7 @@ class plugin_notify_admin_ui extends e_admin_ui
$data = e107::callMethod($val."_notify", 'config');
$config_category = str_replace("_menu","",ucfirst($val))." Events";
$config_category = str_replace("_menu","",ucfirst($val))." ".LAN_NOTIFY_01;
foreach($data as $v)
{
@@ -313,7 +313,7 @@ class plugin_notify_admin_ui extends e_admin_ui
$tp = e107::getParser();
$frm = e107::getForm();
$uc = e107::getUserClass();
$uc->fixed_classes['email'] = 'Email Address =>';
$uc->fixed_classes['email'] = NM_LAN_3;
$uc->text_class_link['email'] = 'email';
@@ -593,7 +593,7 @@ class notify_config
$data = e107::callMethod($val."_notify", 'config');
$config_category = str_replace("_menu","",ucfirst($val))." Events";
$config_category = str_replace("_menu","",ucfirst($val))." ".LAN_NOTIFY_01;
foreach($data as $v)
{
@@ -893,7 +893,7 @@ class notify_config
$tp = e107::getParser();
$frm = e107::getForm();
$uc = e107::getUserClass();
$uc->fixed_classes['email'] = 'Email Address =>';
$uc->fixed_classes['email'] = NM_LAN_3;
$uc->text_class_link['email'] = 'email';

View File

@@ -322,7 +322,7 @@ class plugin_ui extends e_admin_ui
return array('caption'=>"Updates to be Installed", 'text'=>$text);
return array('caption'=>EPL_ADLAN_247, 'text'=>$text);
}

View File

@@ -235,12 +235,15 @@ class e107Update
{
return false;
}
$frm = e107::getForm();
$tp = e107::getParser();
$text = "";
uksort($list, "strnatcasecmp");
foreach($list as $path=>$val)
{
$name = !empty($val['@attributes']['lan']) ? $tp->toHtml($val['@attributes']['lan'],false,'TITLE') : $val['@attributes']['name'];

View File

@@ -283,7 +283,7 @@ class users_admin_ui extends e_admin_ui
'user_login' => array('title' => LAN_USER_03, 'tab'=>0, 'type' => 'text', 'inline'=>true, 'data'=>'str', 'width' => 'auto'), // Real name (no real vetting)
'user_customtitle' => array('title' => LAN_USER_04, 'tab'=>0, 'type' => 'text', 'inline'=>true, 'data'=>'str', 'width' => 'auto'), // No real vetting
'user_password' => array('title' => LAN_PASSWORD, 'tab'=>0, 'type' => 'method', 'data'=>'safestr', 'width' => 'auto'), //TODO add md5 option to form handler?
'user_sess' => array('title' => USRLAN_175, 'tab'=>0, 'noedit'=>true, 'type' => 'text', 'width' => 'auto'), // Photo
'user_sess' => array('title' => LAN_SESSION, 'tab'=>0, 'noedit'=>true, 'type' => 'text', 'width' => 'auto'), // Photo
'user_image' => array('title' => LAN_USER_07, 'tab'=>0, 'type' => 'dropdown', 'data'=>'str', 'width' => 'auto'), // Avatar
'user_email' => array('title' => LAN_EMAIL, 'tab'=>0, 'type' => 'text', 'inline'=>true, 'data'=>'str', 'width' => 'auto', 'writeParms'=>array('size'=>'xxlarge')),
'user_hideemail' => array('title' => LAN_USER_10, 'tab'=>0, 'type' => 'boolean', 'data'=>'int', 'width' => 'auto', 'thclass'=>'center', 'class'=>'center', 'filter'=>true, 'batch'=>true, 'readParms'=>'trueonly=1'),

View File

@@ -14,6 +14,7 @@
* $Author: e107coders $
*/
e107::coreLan('user');
class core_system_xup_controller extends eController
{
@@ -82,11 +83,11 @@ class core_system_xup_controller extends eController
public function actionTest()
{
echo '<h3>Social Login Tester</h3>';
echo '<h3>'.LAN_XUP_ERRM_07.'</h3>';
if(getperms('0'))
{
echo e107::getMessage()->addError("Please logout of e107 before testing the new-user login/signup procedure.")->render();
echo e107::getMessage()->addError(LAN_XUP_ERRM_08)->render();
return;
}
@@ -109,7 +110,7 @@ class core_system_xup_controller extends eController
}
echo 'Logged in: '.(e107::getUser()->isUser() && !empty($profileData) ? '<span class="label label-success">true</span>' : '<span class="label label-danger">false</span>');
echo ' '.LAN_XUP_ERRM_11.' '.(e107::getUser()->isUser() && !empty($profileData) ? '<span class="label label-success">true</span>' : '<span class="label label-danger">false</span>');
$testUrl = SITEURL."?route=system/xup/test";
@@ -120,8 +121,8 @@ class core_system_xup_controller extends eController
if($var['enabled'] == 1)
{
echo '<h3>'.$key.'</h3><ul>';
echo '<li><a class="btn btn-default" href="'.e107::getUrl()->create('system/xup/login?provider='.$key.'&back='.base64_encode($testUrl)).'">Test login only with '.$key.'</a></li>';
echo '<li><a class="btn btn-default" href="'.e107::getUrl()->create('system/xup/signup?provider='.$key.'&back='.base64_encode($testUrl)).'">Test signup/login with '.$key.'</a></li>';
echo '<li><a class="btn btn-default" href="'.e107::getUrl()->create('system/xup/login?provider='.$key.'&back='.base64_encode($testUrl)).'">'.e107::getParser()->lanVars(LAN_XUP_ERRM_09, array('x'=>$key)).'</a></li>';
echo '<li><a class="btn btn-default" href="'.e107::getUrl()->create('system/xup/signup?provider='.$key.'&back='.base64_encode($testUrl)).'">'.e107::getParser()->lanVars(LAN_XUP_ERRM_10, array('x'=>$key)).'</a></li>';
echo "</ul>";
}
@@ -129,7 +130,7 @@ class core_system_xup_controller extends eController
// print_a($var);
}
echo '<br /><br /><a class="btn btn-default" href="'.e107::getUrl()->create('system/xup/test?lgt').'">Test logout</a>';
echo '<br /><br /><a class="btn btn-default" href="'.e107::getUrl()->create('system/xup/test?lgt').'">'.LAN_XUP_ERRM_12.'</a>';
/*
echo '<h3>Facebook</h3>';

View File

@@ -1022,14 +1022,14 @@ class admin_shortcodes
{
global $ns, $pref, $themename, $themeversion, $themeauthor, $themedate, $themeinfo, $mySQLdefaultdb;
if (file_exists(e_ADMIN.'ver.php'))
// if (file_exists(e_ADMIN.'ver.php'))
{
include(e_ADMIN.'ver.php');
// include(e_ADMIN.'ver.php');
}
if($parm == "version")
{
return $e107info['e107_version'];
return e_VERSION;
}
$obj = e107::getDateConvert();
@@ -1057,7 +1057,7 @@ class admin_shortcodes
<br />
<b>e107</b>
<br />
".FOOTLAN_3." ".$e107info['e107_version']."
".FOOTLAN_3." ".e_VERSION."
<br /><br />
<b>".FOOTLAN_20."</b>
<br />
@@ -1838,7 +1838,7 @@ Inverse 10 <span class="badge badge-inverse">10</span>
{
$template = $$tmpl;
return $template['start']. '<li><a tabindex="0" href="'.e_ADMIN_ABS.'e107_update.php" class="hide e-popover text-primary" role="button" data-container="body" data-toggle="popover" data-placement="bottom" data-trigger="bottom" title="'.$tp->toAttribute(LAN_UPDATE_AVAILABLE).'" data-content="'.$tp->toAttribute(ADLAN_120).'"><span class="text-info">'.$tp->toGlyph('fa-database').'</span></a></li>' .$template['end'];
return $template['start']. '<li><a tabindex="0" href="'.e_ADMIN_ABS.'e107_update.php" class="hide e-popover text-primary" role="button" data-container="body" data-toggle="popover" data-placement="right" data-trigger="bottom" data-content="'.$tp->toAttribute(ADLAN_120).'"><span class="text-info">'.$tp->toGlyph('fa-database').'</span></a></li>' .$template['end'];
}

View File

@@ -396,6 +396,7 @@ City, State, Country
<core name="user_reg_secureveri">1</core>
<core name="user_reg_veri">1</core>
<core name="user_tracking">cookie</core>
<core name="version">2.1.6</core>
<core name="wm_enclose">1</core>
<core name="wmessage_sc">0</core>
<core name="wysiwyg">1</core>

View File

@@ -1578,7 +1578,16 @@ class e_admin_dispatcher
if(!$selected) $selected = $request->getMode().'/'.$request->getAction();
$selected = vartrue($this->adminMenuAliases[$selected], $selected);
$icon = (deftrue('e_CURRENT_PLUGIN')) ? e107::getPlugin()->getIcon(e_CURRENT_PLUGIN, 32, '') : e107::getParser()->toIcon($this->adminMenuIcon);
$icon = '';
if(!empty($this->adminMenuIcon))
{
$icon = e107::getParser()->toIcon($this->adminMenuIcon);
}
elseif(deftrue('e_CURRENT_PLUGIN'))
{
$icon = e107::getPlugin()->getIcon(e_CURRENT_PLUGIN, 32, '');
}
return e107::getNav()->admin($icon."<span>".$this->menuTitle."</span>", $selected, $var);
}

View File

@@ -55,7 +55,6 @@ class db_verify
function __construct()
{
$sql = e107::getDb();
$sql->gen('SET SQL_QUOTE_SHOW_CREATE = 1');
@@ -74,8 +73,6 @@ class db_verify
}
$this->sqlLanguageTables = $this->getSqlLanguages();
// $this->loadCreateTableData();
@@ -84,6 +81,13 @@ class db_verify
}
public function clearCache()
{
return e107::getCache()->clear(self::cachetag, true);
}
private function load()
{
$mes = e107::getMessage();
@@ -232,6 +236,7 @@ class db_verify
}
}
}
}

View File

@@ -3889,6 +3889,11 @@ class e107
define('e_MOD_REWRITE_MEDIA', (getenv('HTTP_MOD_REWRITE_MEDIA')=='On' || getenv('REDIRECT_HTTP_MOD_REWRITE_MEDIA')=='On' ? true : false));
}
if(!defined('e_MOD_REWRITE_STATIC')) // Allow e107_config.php to override.
{
define('e_MOD_REWRITE_STATIC', (getenv('HTTP_MOD_REWRITE_STATIC')=='On' || getenv('REDIRECT_HTTP_MOD_REWRITE_STATIC')=='On' ? true : false));
}
// Define the domain name and subdomain name.
if(is_numeric(str_replace(".","",$_SERVER['HTTP_HOST'])))
{

View File

@@ -2529,6 +2529,11 @@ class e_parse extends e_parser
if($raw) $url = $this->createConstants($url, 'mix');
$baseurl = ($full ? SITEURL : e_HTTP).'thumb.php?';
if(defined('e_HTTP_STATIC'))
{
$baseurl = e_HTTP_STATIC.'thumb.php?';
}
$thurl = 'src='.urlencode($url).'&amp;';
@@ -2722,6 +2727,11 @@ class e_parse extends e_parser
{
$base = (!empty($options['ebase'])) ? '{e_BASE}' : e_HTTP;
}
if(defined('e_HTTP_STATIC'))
{
$base = e_HTTP_STATIC;
}
// $base = (!empty($options['full'])) ? SITEURL : e_HTTP;
if(!empty($options['x']) && !empty($options['ext'])) // base64 encoded. Build URL for: RewriteRule ^media\/img\/([-A-Za-z0-9+/]*={0,3})\.(jpg|gif|png)?$ thumb.php?id=$1
@@ -5114,6 +5124,8 @@ class e_emotefilter
return;
}
$base = deftrue('e_HTTP_STATIC', SITEURLBASE);
foreach($this->emotes as $key => $value)
{
@@ -5130,8 +5142,10 @@ class e_emotefilter
$key = str_replace("!", "_", $key);
$filename = e_IMAGE."emotes/" . $pref['emotepack'] . "/" . $key;
$fileloc = SITEURLBASE.e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" . $key;
$fileloc = $base.e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" . $key;
$alt = str_replace(array('.png','.gif', '.jpg'),'', $key);

View File

@@ -81,19 +81,19 @@ class e107_event
'user_signup_activated' => NU_LAN_3,
'login' => NU_LAN_4,
'logout' => NU_LAN_5,
'user_xup_login' => 'User social login',
'user_xup_signup' => 'User social signup',
'user_xup_login' => NU_LAN_6,
'user_xup_signup' => NU_LAN_7,
'user_ban_flood' => NS_LAN_2,
'user_ban_failed_login' => 'IP banned for multiple failed login attempts',
'user_profile_display' => "User views profile",
'user_profile_edit' => "User edits profile"
'user_ban_failed_login' => NS_LAN_3,
'user_profile_display' => NU_LAN_8,
'user_profile_edit' => NU_LAN_9
),
'administrators' => array(
'admin_password_update' => "Administrator updates their password",
'admin_user_created' => 'Administrator creates a new user',
'admin_user_activated' => "Administrator activates a new user"
'admin_password_update' => NA_LAN_1,
'admin_user_created' => NA_LAN_2,
'admin_user_activated' => NA_LAN_3
),
@@ -102,7 +102,7 @@ class e107_event
'admin_news_created' => NN_LAN_3,
'admin_news_updated' => NN_LAN_4,
'admin_news_deleted' => NN_LAN_5,
'admin_news_notify' => "News notification triggered", // TODO LAN
'admin_news_notify' => NN_LAN_6,
'user_news_submit' => NN_LAN_2,
),
@@ -348,4 +348,4 @@ class e107_event
}
}
?>
?>

View File

@@ -1511,4 +1511,143 @@ class e_file
return $limits;
}
public function unzipGithubArchive($url='core')
{
switch($url)
{
case "core":
$localfile = 'e107-master.zip';
$remotefile = 'https://codeload.github.com/e107inc/e107/zip/master';
$excludes = array('e107-master/install.php','e107-master/favicon.ico');
$excludeMatch = false;
break;
// language.
// eg. https://github.com/e107translations/Spanish/archive/v2.1.5.zip
default:
$localfile = str_replace('https://github.com/e107translations/','',$url); // 'e107-master.zip';
$localfile = str_replace('/archive/v','-',$localfile); //remove dirs.
$remotefile = $url;
$excludes = array();
$excludeMatch = array('alt_auth','tagwords','faqs');
}
// Delete any existing file.
if(file_exists(e_TEMP.$localfile))
{
unlink(e_TEMP.$localfile);
}
$result = $this->getRemoteFile($remotefile, $localfile, 'temp');
if($result === false)
{
return false;
}
chmod(e_TEMP.$localfile, 0755);
require_once(e_HANDLER."pclzip.lib.php");
$zipBase = str_replace('.zip','',$localfile); // eg. e107-master
$excludes[] = $zipBase;
$newFolders = array(
$zipBase.'/e107_admin/' => e_BASE.e107::getFolder('ADMIN'),
$zipBase.'/e107_core/' => e_BASE.e107::getFolder('CORE'),
$zipBase.'/e107_docs/' => e_BASE.e107::getFolder('DOCS'),
$zipBase.'/e107_handlers/' => e_BASE.e107::getFolder('HANDLERS'),
$zipBase.'/e107_images/' => e_BASE.e107::getFolder('IMAGES'),
$zipBase.'/e107_languages/' => e_BASE.e107::getFolder('LANGUAGES'),
$zipBase.'/e107_media/' => e_BASE.e107::getFolder('MEDIA'),
$zipBase.'/e107_plugins/' => e_BASE.e107::getFolder('PLUGINS'),
$zipBase.'/e107_system/' => e_BASE.e107::getFolder('SYSTEM'),
$zipBase.'/e107_themes/' => e_BASE.e107::getFolder('THEMES'),
$zipBase.'/e107_web/' => e_BASE.e107::getFolder('WEB'),
$zipBase.'/' => e_BASE
);
$srch = array_keys($newFolders);
$repl = array_values($newFolders);
$archive = new PclZip(e_TEMP.$localfile);
$unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_TEMP, PCLZIP_OPT_SET_CHMOD, 0755)); // Store in TEMP first.
$error = array();
$success = array();
// $skipped = array();
foreach($unarc as $k=>$v)
{
if($this->matchFound($v['stored_filename'],$excludeMatch))
{
continue;
}
if(in_array($v['stored_filename'],$excludes))
{
continue;
}
$oldPath = $v['filename'];
$newPath = str_replace($srch,$repl, $v['stored_filename']);
/*
$success[] = $newPath;
continue;*/
if($v['folder'] ==1 && is_dir($newPath))
{
// $skipped[] = $newPath. " (already exists)";
continue;
}
if(!rename($oldPath,$newPath))
{
$error[] = $newPath;
}
else
{
$success[] = $newPath;
}
}
return array('success'=>$success, 'error'=>$error);
}
private function matchFound($file,$array)
{
if(empty($array))
{
return false;
}
foreach($array as $term)
{
if(strpos($file,$term)!==false)
{
return true;
}
}
return false;
}
}

View File

@@ -1255,7 +1255,8 @@ class e_jsmanager
$path = $path[1];
if(strpos($path, 'http') !== 0)
{
$path = $tp->replaceConstants($path, 'abs').'?external=1&amp;'.$this->getCacheId();
$path = $tp->replaceConstants($path, 'abs').'?external=1'; // &amp;'.$this->getCacheId();
$path = $this->url($path);
}
echo $pre.'<link rel="stylesheet" media="'.$media.'" type="text/css" href="'.$path.'" />'.$post;
@@ -1274,7 +1275,8 @@ class e_jsmanager
if($post) $post = "\n".$post;
$path = $path[0];
$path = $tp->replaceConstants($path, 'abs').'?external=1&amp;'.$this->getCacheId();
$path = $tp->replaceConstants($path, 'abs').'?external=1'; // &amp;'.$this->getCacheId();
$path = $this->url($path);
echo $pre.'<script type="text/javascript" src="'.$path.'"></script>'.$post;
echo "\n";
continue;
@@ -1325,7 +1327,8 @@ class e_jsmanager
{
continue;
}
$path = $tp->replaceConstants($path, 'abs').'?'.$this->getCacheId();
$path = $tp->replaceConstants($path, 'abs'); // .'?'.$this->getCacheId();
$path = $this->url($path);
}
elseif($this->isValidUrl($path) === false)
{
@@ -1365,7 +1368,8 @@ class e_jsmanager
if(!e107::getPref('e_jslib_nocombine')) continue;
}
$path = $tp->replaceConstants($path, 'abs').'?'.$this->getCacheId();
$path = $tp->replaceConstants($path, 'abs'); //.'?'.$this->getCacheId();
$path = $this->url($path, 'js');
}
if($isExternal === true && $this->isValidUrl($path) == false)
@@ -1396,6 +1400,55 @@ class e_jsmanager
}
private function url($path,$cacheId = true)
{
if((e_MOD_REWRITE_STATIC === true || defined('e_HTTP_STATIC')) && $this->isInAdmin() !== true)
{
$srch = array(
e_PLUGIN_ABS,
e_THEME_ABS,
e_WEB_ABS
);
$http = deftrue('e_HTTP_STATIC', e_HTTP);
$base = (e_MOD_REWRITE_STATIC === true) ? 'static/'.$this->getCacheId().'/' : '';
$repl = array(
$http.$base.e107::getFolder('plugins'),
$http.$base.e107::getFolder('themes'),
$http.$base.e107::getFolder('web')
);
$folder = str_replace($srch,$repl,$path);
if(e_MOD_REWRITE_STATIC === true)
{
return trim($folder);
}
$path = $folder;
}
if(strpos($path,'?')!==false)
{
$path .= "&amp;".$this->getCacheId();
}
else
{
$path .= "?".$this->getCacheId();
}
return $path;
}
/**
* Check CDN Url is valid.
* Experimental.
@@ -1488,11 +1541,11 @@ class e_jsmanager
if($type == 'js')
{
echo "<script type='text/javascript' src='".e_WEB_ABS."cache/".$fileName."'></script>\n\n";
echo "<script type='text/javascript' src='".$this->url(e_WEB_ABS."cache/".$fileName,'js','cache')."'></script>\n\n";
}
else
{
echo "<link type='text/css' href='".e_WEB_ABS."cache/".$fileName."' rel='stylesheet' property='stylesheet' />\n\n";
echo "<link type='text/css' href='".$this->url(e_WEB_ABS."cache/".$fileName,'cache')."' rel='stylesheet' property='stylesheet' />\n\n";
if(!empty($this->_cache_list['css_inline']))
{
echo $this->_cache_list['css_inline'];

View File

@@ -189,14 +189,14 @@ class e_db_mysql
if($this->pdo)
{
if(strpos($mySQLserver,':')!==false)
if(strpos($mySQLserver,':')!==false && substr_count($mySQLserver, ':')===1)
{
list($this->mySQLserver,$this->mySQLport) = explode(':',$mySQLserver,2);
}
if($this->mySQLserver === 'localhost')
// if($this->mySQLserver === 'localhost') // problematic.
{
$this->mySQLserver = '127.0.0.1'; // faster by almost 1 second
// $this->mySQLserver = '127.0.0.1'; // faster by almost 1 second
}
try
@@ -285,14 +285,14 @@ class e_db_mysql
$this->mySQLpassword = $mySQLpassword;
$this->mySQLerror = false;
if(strpos($mySQLserver,':')!==false)
if(strpos($mySQLserver,':')!==false && substr_count($mySQLserver, ':')===1)
{
list($this->mySQLserver,$this->mySQLport) = explode(':',$mySQLserver,2);
}
if($this->mySQLserver === 'localhost')
// if($this->mySQLserver === 'localhost') // problematic.
{
$this->mySQLserver = '127.0.0.1'; // faster by almost 1 second.
// $this->mySQLserver = '127.0.0.1'; // faster by almost 1 second.
}

View File

@@ -894,13 +894,13 @@ class e107plugin
protected $core_plugins = array(
"_blank","admin_menu","alt_auth","banner","blogcalendar_menu",
"_blank","admin_menu","banner","blogcalendar_menu",
"chatbox_menu", "clock_menu","comment_menu",
"contact", "download","faqs", "featurebox", "forum","gallery",
"contact", "download", "featurebox", "forum","gallery",
"gsitemap","import", "linkwords", "list_new", "log", "login_menu",
"metaweblog", "newforumposts_main", "news", "newsfeed",
"newsletter","online", "page", "pm","poll",
"rss_menu","search_menu","siteinfo", "social", "tagwords", "tinymce4",
"rss_menu","search_menu","siteinfo", "social", "tagcloud", "tinymce4",
"trackback","tree_menu","user"
);
@@ -1050,10 +1050,9 @@ class e107plugin
{
return FALSE;
}
// require_once(e_HANDLER."db_verify_class.php");
$dbv = e107::getSingleton('db_verify', e_HANDLER."db_verify_class.php");
$dbv = e107::getObject('db_verify', null, e_HANDLER."db_verify_class.php");
$plg = e107::getPlug();
@@ -1075,6 +1074,7 @@ class e107plugin
if($dbv->errors())
{
$mes->addDebug("Plugin Update(s) Required - db structure change [".$path."]");
$needed[$path] = $data;
}
}
@@ -1119,7 +1119,7 @@ class e107plugin
{
$log->addDebug("Plugin: <strong>{$path}</strong> requires an update.");
}
return count($needed) ? $needed : FALSE;
}

View File

@@ -875,11 +875,11 @@ class xmlClass
public function e107Export($xmlprefs, $tables, $plugPrefs, $options = array())
{
// error_reporting(0);
$e107info = array();
require_once(e_ADMIN."ver.php");
// $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";
$text .= "<e107Export version=\"".e_VERSION."\" timestamp=\"".time()."\" >\n";
$default = array();
$excludes = array();

View File

@@ -290,6 +290,7 @@ define("LAN_NOTWRITABLE"," is not writable, you need to CHMOD 777 the file or fo
define("LAN_NOTREADABLE", "Not Readable");
define("LAN_MISSING", "Missing");
define("LAN_UNUSED", "Unused");
define("LAN_SESSION", "Session");
define("LAN_TOOLTIP", "Tooltip");
define("LAN_TIME","Time");
@@ -470,6 +471,8 @@ define("LAN_UI_DELETE_WARNING", "You are about to delete [x] records. Please con
define("LAN_UI_BATCH_CREATELINK", "Create Link");
define("LAN_UI_DELETED", "[x] record(s) successfully deleted!");
define("LAN_UI_DELETED_FAILED", "[x] records not found and not deleted!");
define("LAN_UI_FILE_DELETED", "[x] file successfully deleted!");
define("LAN_UI_FILE_DELETED_FAILED", "Unable to delete [x]! Please remove the file manually.");
define("LAN_UI_BATCH_EXPORT", "Export");
define("LAN_UI_USING_DATABASE_TABLE", "Using [x] database table");

View File

@@ -25,7 +25,10 @@ define("LAN_CHECK_26", "Front");
define("LAN_CHECK_PAGE_TITLE", "Languages");
define("LAN_CHECK_27", "Number of language-pack errors found");
define("LAN_CHECK_28", "Identical");
//define("LAN_CHECK_29", "Missing");
define("LAN_CHECK_29", "Identical string (warning only)");
define("LAN_CHECK_30", "Missing bbcodes");
define("LAN_CHECK_31", "Missing [ and/or ] character(s)");
define("LAN_CHECK_32", "Missing HTML tags");
define("LANG_LAN_23", "Create Language-Pack (zip)");
define("LANG_LAN_30", "Release Date");

View File

@@ -65,4 +65,9 @@ define("LANG_LAN_144", "Must be re-enabled");
define("LANG_LAN_148", "Normal Mode");
define("LANG_LAN_149", "Value");
define("LANG_LAN_150", "[b]Search ENTIRE core before commenting out ANY LAN from ANY language file.[/b]");
?>
define("LANG_LAN_151", "Available");
define("LANG_LAN_152", "Courtesy of the [e107 translations team]");
?>

View File

@@ -6,6 +6,10 @@
*
*/
define("NA_LAN_1", "Administrator updates their password");
define("NA_LAN_2", "Administrator creates a new user");
define("NA_LAN_3", "Administrator activates a new user");
define("NT_LAN_1", "Notify");
define("NT_LAN_2", "Receive email notification on");
//define("NT_LAN_3", "Off");
@@ -18,18 +22,25 @@ define("NU_LAN_2", "User signup");
define("NU_LAN_3", "User account verification");
define("NU_LAN_4", "User login");
define("NU_LAN_5", "User logout");
define("NU_LAN_6", "User social login");
define("NU_LAN_7", "User social signup");
define("NU_LAN_8", "User views profile");
define("NU_LAN_9", "User edits profile");
define("NS_LAN_1", "Security Events");
define("NS_LAN_2", "IP banned for flooding site");
define("NS_LAN_3", "IP banned for multiple failed login attempts");
define("NN_LAN_1", "News Events");
define("NN_LAN_2", "News item submitted by user");
define("NN_LAN_3", "News item posted by admin");
define("NN_LAN_4", "News item edited by admin");
define("NN_LAN_5", "News item deleted by admin");
define("NN_LAN_6", "News notification triggered");
define("NM_LAN_1", "Mail Events");
define("NM_LAN_2", "Bulk email run complete");
define("NM_LAN_3", "Email Address =>");
define("NF_LAN_1", "File Events");
define("NF_LAN_2", "File uploaded by user");

View File

@@ -288,7 +288,8 @@ define ("EPL_ADLAN_244","Only 5 Media Categories are permitted during installati
define ("EPL_ADLAN_245","Adding Media Category: [x]");
define ("EPL_ADLAN_246","Deleting All Media Categories owned by : [x]");
define ("EPL_ADLAN_247","Updates to be Installed");
define ("EPL_ADLAN_249","Adding Extended Field: ");
define ("EPL_ADLAN_250","Removing Extended Field: ");
define ("EPL_ADLAN_251","Extended Field left in place: ");

View File

@@ -176,7 +176,7 @@ define("USRLAN_171", "Random password");
define("USRLAN_172", "User account has been created with the following:");
// define("USRLAN_173", "Login name set");
// define("USRLAN_174", "User name --NAME-- created");
define("USRLAN_175", "Session");
// define("USRLAN_175", "Session"); // Moved to lan_admin.php
define("USRLAN_179", "User banned: ");
define("USRLAN_180", "IP address of {IP} appears on whitelist; IP not banned.");

View File

@@ -123,7 +123,12 @@ define("LAN_XUP_ERRM_03", "Log in Failed! Wrong provider.");
define("LAN_XUP_ERRM_04", "Signup failed! User already signed in.");
define("LAN_XUP_ERRM_05", "Signup failed! User already exists. Please use 'login' instead.");
define("LAN_XUP_ERRM_06", "Signup failed! Can't access user email - registration without an email is impossible.");
define("LAN_XUP_ERRM_07", "Social Login Tester");
define("LAN_XUP_ERRM_08", "Please logout of e107 before testing the new-user login/signup procedure.");
define("LAN_XUP_ERRM_09", "Test login only with [x]");
define("LAN_XUP_ERRM_10", "Test signup/login with [x]");
define("LAN_XUP_ERRM_11", "Logged in:");
define("LAN_XUP_ERRM_12", "Test logout");
// Error messages for when user data is missing. Done this way so that other code can override the default messages

View File

@@ -145,7 +145,7 @@ class alt_auth_admin extends alt_auth_base
if ($v['optional'] == FALSE) $ret .= '*&nbsp;';
$ret .= $v['prompt'].':';
$ret .= "</td><td$log>";
$ret .= "</td><td class='form-inline' $log>";
// $fieldname = $tableType.'_'.$v['optname'];
$fieldname = $tableType.'_xf_'.$f; // Name of the input box
$value = varset($v['default'],'');
@@ -367,14 +367,14 @@ class alt_auth_admin extends alt_auth_base
*/
public function alt_auth_test_form($prefix, $frm)
{
$text = $frm -> form_open('post', e_SELF, 'testform');
$text .= "<table class='table adminform'>
<tr><td colspan='2' class='forumheader2' style='text-align:center;'>".LAN_ALT_42."</td></tr>";
$text = '';
if (isset($_POST['testauth']))
if(!empty($_POST['testauth']))
{
// Try and connect to DB/server, and maybe validate user name
require_once(e_PLUGIN.'alt_auth/'.$prefix.'_auth.php');
e107::getDebug()->log('Loading: alt_auth/'.$prefix.'_auth.php');
$_login = new auth_login;
$log_result = AUTH_UNKNOWN;
$pass_vars = array();
@@ -389,16 +389,27 @@ class alt_auth_admin extends alt_auth_base
$log_result = $_login->login($val_name, $_POST['passtovalidate'], $pass_vars, ($val_name == ''));
}
$text .= "<tr><td>".LAN_ALT_48;
$text = "<table class='table'>
<colgroup>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tr><th colspan='2'>".LAN_ALT_48."</th></tr>";
$text .= "<tr><td>";
if ($val_name)
{
$text .= "<br />".LAN_ALT_49.$val_name.'<br />'.LAN_ALT_50;
$text .= LAN_ALT_49.": ".$val_name.'<br />'.LAN_ALT_50.": ";
if (varset($_POST['passtovalidate'],'')) $text .= str_repeat('*',strlen($_POST['passtovalidate'])); else $text .= LAN_ALT_51;
}
$text .= "</td><td $log>";
$text .= "</td><td>";
$err = '';
switch ($log_result)
{
case AUTH_SUCCESS :
$text .= "<div class='alert alert-success' style='margin:0'>";
$text .= LAN_ALT_58;
if (count($pass_vars))
{
@@ -408,45 +419,75 @@ class alt_auth_admin extends alt_auth_base
$text .= '<br />&nbsp;&nbsp;'.$k.'=>'.$v;
}
}
$text .= "</div>";
break;
case AUTH_NOUSER :
$text .= LAN_ALT_52.LAN_ALT_55;
$err = LAN_ALT_52.LAN_ALT_55;
break;
case AUTH_BADPASSWORD :
$text .= LAN_ALT_52.LAN_ALT_56;
$err = LAN_ALT_52.LAN_ALT_56;
break;
case AUTH_NOCONNECT :
$text .= LAN_ALT_52.LAN_ALT_54;
$err = LAN_ALT_52.LAN_ALT_54;
break;
case AUTH_UNKNOWN :
$text .= LAN_ALT_52.LAN_ALT_53;
$err = LAN_ALT_52.LAN_ALT_53;
break;
case AUTH_NOT_AVAILABLE :
$text .= LAN_ALT_52.LAN_ALT_57;
$err = LAN_ALT_52.LAN_ALT_57;
break;
case LOGIN_CONTINUE:
$err = "wrong encoding?";
break;
default :
$text .= "Coding error";
$err = "Coding error";
var_dump($log_result);
}
if (isset($_login ->ErrorText)) $text .= '<br />'.$_login ->ErrorText;
$text .= "</td></tr>";
if(!empty($err))
{
$text .= "<div class='alert alert-danger' style='margin:0'>".$err."</div>";
}
if(!empty($_login ->ErrorText))
{
$text .= "<div class='alert alert-danger' style='margin:0'>".$_login ->ErrorText."</div>";
}
$text .= "</td></tr></table>";
// $text = "<div class='alert'>".$text."</div>";
}
$text .= $frm -> form_open('post', e_SELF, 'testform');
$text .= "<table class='table adminlist'>
<colgroup>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tr><th colspan='2'>".LAN_ALT_42."</th></tr>";
$text .= "<tr><td $log>".LAN_ALT_33."</td><td $log>";
$text .= $frm->form_text('nametovalidate', 35, '', 120);
// $text .= $frm->form_text('nametovalidate', 35, '', 120);
$text .= e107::getForm()->text('nametovalidate','',35);
$text .= "</td></tr>";
$text .= "<tr><td $log>".LAN_ALT_34."</td><td $log>";
$text .= $frm->form_password('passtovalidate', 35, '', 120);
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
// $text .= $frm->form_button("submit", 'testauth', LAN_ALT_47);
$text .= e107::getForm()->admin_button('testauth', LAN_ALT_47,'other');
$text .= "</td></tr>";
$text .= "</table>";
$text .= "<div class='buttons-bar center'>";
// $text .= $frm->form_button("submit", 'testauth', LAN_ALT_47);
$text .= e107::getForm()->admin_button('testauth', LAN_ALT_47,'other');
$text .= "</div>";
$text .= $frm->form_close();
return $text;
return e107::getMessage()->render().$text;
}
@@ -507,7 +548,14 @@ function alt_auth_adminmenu()
$var['main']['text'] = LAN_ALT_31;
$var['main']['link'] = e_PLUGIN.'alt_auth/alt_auth_conf.php';
show_admin_menu('alt auth', ALT_AUTH_ACTION, $var);
$icon = e107::getParser()->toIcon(e_PLUGIN.'alt_auth/images/alt_auth_32.png');
$caption = $icon."<span>alt auth</span>";
show_admin_menu($caption, ALT_AUTH_ACTION, $var);
$var = array();
foreach($authlist as $a)
{
@@ -517,6 +565,9 @@ function alt_auth_adminmenu()
$var[$a]['link'] = e_PLUGIN."alt_auth/{$a}_conf.php";
}
}
show_admin_menu(LAN_ALT_29, ALT_AUTH_ACTION, $var);
}
?>

View File

@@ -107,16 +107,29 @@ else
$authExtended = array();
}
if(isset($message))
if(e107::getDb()->getPDO() === false)
{
e107::getRender()->tablerender('', "<div style='text-align:center'><b>".$message."</b></div>");
$mess = "PDO is required to use alt-auth. To enable add: <code>define('e_PDO', true);</code> to e107_config.php.<br />
<small>Warning: If PDO is not correctly configured on your server then your site may fail to connect with the database.</small>";
echo e107::getMessage()->addInfo($mess)->render();
}
if(!empty($message))
{
echo e107::getMessage()->addSuccess($message)->render();
}
$altAuthAdmin = new alt_auth_admin();
$text = "
<div>
<form method='post' action='".e_SELF."'>

View File

@@ -80,12 +80,13 @@ class auth_login extends alt_auth_base
public function login($uname, $pword, &$newvals, $connect_only = FALSE)
{
//Attempt to open connection to sql database
if(!$res = mysql_connect($this->conf['e107db_server'], $this->conf['e107db_username'], $this->conf['e107db_password']))
/* if(!$res = mysql_connect($this->conf['e107db_server'], $this->conf['e107db_username'], $this->conf['e107db_password']))
{
$this->makeErrorText('Cannot connect to remote server');
return AUTH_NOCONNECT;
}
//Select correct db
if(!mysql_select_db($this->conf['e107db_database'], $res))
{
@@ -94,7 +95,22 @@ class auth_login extends alt_auth_base
return AUTH_NOCONNECT;
}
if ($connect_only) return AUTH_SUCCESS; // Test mode may just want to connect to the DB
*/
$dsn = 'mysql:dbname=' . $this->conf['e107db_database'] . ';host=' . $this->conf['e107db_server'];
try
{
$dbh = new PDO($dsn, $this->conf['e107db_username'], $this->conf['e107db_password']);
}
catch (PDOException $e)
{
$this->makeErrorText('Cannot connect to remote DB; PDOException message: ' . $e->getMessage());
return AUTH_NOCONNECT;
}
$sel_fields = array();
// Make an array of the fields we want from the source DB
foreach($this->conf as $k => $v)
@@ -118,20 +134,20 @@ class auth_login extends alt_auth_base
//Get record containing supplied login name
$qry = 'SELECT '.implode(',',$sel_fields)." FROM ".$this->conf['e107db_prefix']."user WHERE {$user_field} = '{$uname}' AND `user_ban` = 0";
// echo "Query: {$qry}<br />";
if(!$r1 = mysql_query($qry))
if(!$r1 = $dbh->query($qry))
{
mysql_close($res);
$this->makeErrorText('Lookup query failed');
e107::getMessage()->addDebug($qry);
return AUTH_NOCONNECT;
}
if (!$row = mysql_fetch_array($r1))
if (!$row = $r1->fetch(PDO::FETCH_BOTH))
{
mysql_close($res);
$this->makeErrorText('User not found');
return AUTH_NOUSER;
}
mysql_close($res); // Finished with 'foreign' DB now
// mysql_close($res); // Finished with 'foreign' DB now
// Got something from the DB - see whether password valid
require_once(e_PLUGIN.'alt_auth/extended_password_handler.php'); // This auto-loads the 'standard' password handler as well

View File

@@ -48,35 +48,59 @@ class alt_auth_e107db extends alt_auth_admin
$parm = $this->altAuthGetParams('e107db');
$frm = new form;
$text = $frm -> form_open('post', e_SELF);
$text .= "<table class='table adminform'>
$tab1 = "<table class='table adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>";
$text .= "<tr><td>".LAN_ALT_26."</td><td>";
$text .= E107DB_LAN_1;
$text .= "</td></tr>";
$tab1 .= "<tr><td>".LAN_ALT_26."</td><td>";
$tab1 .= E107DB_LAN_1;
$tab1 .= "</td></tr>";
$text .= $this->alt_auth_get_db_fields('e107db', $frm, $parm, 'server|uname|pwd|db|prefix|classfilt');
$tab1 .= $this->alt_auth_get_db_fields('e107db', $frm, $parm, 'server|uname|pwd|db|prefix|classfilt');
$text .= "<tr><td>".E107DB_LAN_9."</td><td>";
$text .= $this->altAuthGetPasswordSelector('e107db_password_method', $frm, $parm['e107db_password_method'], FALSE);
$tab1 .= "<tr><td>".E107DB_LAN_9."</td><td>";
$tab1 .= $this->altAuthGetPasswordSelector('e107db_password_method', $frm, $parm['e107db_password_method'], FALSE);
$text .= "</td></tr>";
$tab1 .= "</td></tr></table>";
$text .= "<tr><td colspan='2'><br />".E107DB_LAN_11."</td></tr>";
$text .= $this->alt_auth_get_field_list('e107db',$frm, $parm, TRUE);
$text .= "</table><div class='buttons-bar center'>";
$tab2 = "
<table class='table adminform'>
<colgroup>
<col class='col-label' />
<col class='col-control' />
</colgroup>
";
$tab2 .= "<tr><td colspan='2'><br />".E107DB_LAN_11."</td></tr>";
$tab2 .= $this->alt_auth_get_field_list('e107db',$frm, $parm, TRUE);
$tab2 .= "</table>";
$tabs = array(
'tab1' => array('caption'=>'Database', 'text'=>$tab1),
'tab2' => array('caption'=>'Data', 'text'=>$tab2),
);
$text = $frm -> form_open('post', e_SELF);
$text .= e107::getForm()->tabs($tabs);
$text .= "<div class='buttons-bar center'>";
$text .= e107::getForm()->admin_button("update", LAN_UPDATE,'update');
// $text .= $frm -> form_button("submit", "update", LAN_ALT_UPDATESET);
$text .= '</div>';
$text .= $frm -> form_close();
$ns->tablerender(E107DB_LAN_10, $text);
echo e107::getMessage()->render();
$ns->tablerender(LAN_ALT_40.LAN_ALT_41,$this->alt_auth_test_form('e107db',$frm));
}

View File

@@ -43,7 +43,7 @@ require_once(e_HANDLER.'user_handler.php');
// @todo make these class constants
define('PASSWORD_PHPBB_SALT',2);
/*define('PASSWORD_PHPBB_SALT',2);
define('PASSWORD_MAMBO_SALT',3);
define('PASSWORD_JOOMLA_SALT',4);
define('PASSWORD_GENERAL_MD5',5);
@@ -51,12 +51,13 @@ define('PASSWORD_PLAINTEXT',6);
define('PASSWORD_GENERAL_SHA1',7);
define('PASSWORD_WORDPRESS_SALT', 8);
define('PASSWORD_MAGENTO_SALT', 9);
define('PASSWORD_PHPFUSION_SHA256', 10);
// Supported formats:
define('PASSWORD_PHPBB_ID', '$H$'); // PHPBB salted
define('PASSWORD_ORIG_ID', '$P$'); // 'Original' code
define('PASSWORD_WORDPRESS_ID', '$P$'); // WordPress 2.8
*/
@@ -65,6 +66,21 @@ class ExtendedPasswordHandler extends UserHandler
private $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; // Holds a string of 64 characters for base64 conversion
var $random_state = ''; // A (hopefully) random number
const PASSWORD_E107_MD5 = 0;
const PASSWORD_E107_SALT = 1;
const PASSWORD_PHPBB_SALT = 2;
const PASSWORD_MAMBO_SALT = 3;
const PASSWORD_JOOMLA_SALT = 4;
const PASSWORD_GENERAL_MD5 = 5;
const PASSWORD_PLAINTEXT = 6;
const PASSWORD_GENERAL_SHA1 = 7;
const PASSWORD_WORDPRESS_SALT = 8;
const PASSWORD_MAGENTO_SALT = 9;
const PASSWORD_PHPFUSION_SALT = 10;
const PASSWORD_PHPBB_ID = '$H$'; // PHPBB salted
const PASSWORD_ORIG_ID = '$P$'; // 'Original' code
const PASSWORD_WORDPRESS_ID = '$P$'; // WordPress 2.8
/**
* Constructor - just call parent
@@ -129,7 +145,7 @@ class ExtendedPasswordHandler extends UserHandler
* Given a plaintext password and the complete password/hash function (which includes any salt), calculate hash
* Returns FALSE on error
*/
private function crypt_private($password, $stored_password, $password_type = PASSWORD_PHPBB_SALT)
private function crypt_private($password, $stored_password, $password_type = self::PASSWORD_PHPBB_SALT)
{
$output = '*0';
if (substr($stored_password, 0, 2) == $output)
@@ -140,11 +156,11 @@ class ExtendedPasswordHandler extends UserHandler
$prefix = '';
switch ($password_type)
{
case PASSWORD_PHPBB_SALT :
$prefix = PASSWORD_PHPBB_ID;
case self::PASSWORD_PHPBB_SALT :
$prefix = self::PASSWORD_PHPBB_ID;
break;
case PASSWORD_WORDPRESS_SALT :
$prefix = PASSWORD_WORDPRESS_ID;
case self::PASSWORD_WORDPRESS_SALT :
$prefix = self::PASSWORD_WORDPRESS_ID;
break;
default :
$prefix = '';
@@ -195,7 +211,10 @@ class ExtendedPasswordHandler extends UserHandler
public function getPasswordTypes($includeExtended = TRUE)
{
$vals = array();
$vals = array('md5' => IMPORTDB_LAN_7,'e107_salt' => IMPORTDB_LAN_8); // Methods supported in core
$vals = array(
'md5' => IMPORTDB_LAN_7,
'e107_salt' => IMPORTDB_LAN_8); // Methods supported in core
if ($includeExtended)
{
$vals = array_merge($vals,array(
@@ -207,6 +226,7 @@ class ExtendedPasswordHandler extends UserHandler
'phpbb3_salt' => IMPORTDB_LAN_12,
'wordpress_salt' => IMPORTDB_LAN_13,
'magento_salt' => IMPORTDB_LAN_14,
'phpfusion_salt' => "PHPFusion",
));
}
return $vals;
@@ -219,20 +239,21 @@ class ExtendedPasswordHandler extends UserHandler
public function passwordMapping($ptype)
{
$maps = array(
'plaintext' => PASSWORD_PLAINTEXT,
'joomla_salt' => PASSWORD_JOOMLA_SALT,
'mambo_salt' => PASSWORD_MAMBO_SALT,
'smf_sha1' => PASSWORD_GENERAL_SHA1,
'sha1' => PASSWORD_GENERAL_SHA1,
'mambo' => PASSWORD_GENERAL_MD5,
'phpbb2' => PASSWORD_GENERAL_MD5,
'e107' => PASSWORD_GENERAL_MD5,
'md5' => PASSWORD_GENERAL_MD5,
'e107_salt' => PASSWORD_E107_SALT,
'phpbb2_salt' => PASSWORD_PHPBB_SALT,
'phpbb3_salt' => PASSWORD_PHPBB_SALT,
'wordpress_salt' => PASSWORD_WORDPRESS_SALT,
'magento_salt' => PASSWORD_MAGENTO_SALT,
'plaintext' => self::PASSWORD_PLAINTEXT,
'joomla_salt' => self::PASSWORD_JOOMLA_SALT,
'mambo_salt' => self::PASSWORD_MAMBO_SALT,
'smf_sha1' => self::PASSWORD_GENERAL_SHA1,
'sha1' => self::PASSWORD_GENERAL_SHA1,
'mambo' => self::PASSWORD_GENERAL_MD5,
'phpbb2' => self::PASSWORD_GENERAL_MD5,
'e107' => self::PASSWORD_GENERAL_MD5,
'md5' => self::PASSWORD_GENERAL_MD5,
'e107_salt' => self::PASSWORD_E107_SALT,
'phpbb2_salt' => self::PASSWORD_PHPBB_SALT,
'phpbb3_salt' => self::PASSWORD_PHPBB_SALT,
'wordpress_salt' => self::PASSWORD_WORDPRESS_SALT,
'magento_salt' => self::PASSWORD_MAGENTO_SALT,
'phpfusion_salt' => self::PASSWORD_PHPFUSION_SALT,
);
if (isset($maps[$ptype])) return $maps[$ptype];
return FALSE;
@@ -256,18 +277,19 @@ class ExtendedPasswordHandler extends UserHandler
{
switch ($password_type)
{
case PASSWORD_GENERAL_MD5 :
case PASSWORD_E107_MD5 :
case self::PASSWORD_GENERAL_MD5 :
case self::PASSWORD_E107_MD5 :
$pwHash = md5($pword);
break;
case PASSWORD_GENERAL_SHA1 :
case self::PASSWORD_GENERAL_SHA1 :
if (strlen($stored_hash) != 40) return PASSWORD_INVALID;
$pwHash = sha1($pword);
break;
case PASSWORD_JOOMLA_SALT :
case PASSWORD_MAMBO_SALT :
case self::PASSWORD_JOOMLA_SALT :
case self::PASSWORD_MAMBO_SALT :
if ((strpos($stored_hash, ':') === false) || (strlen($stored_hash) < 40))
{
return PASSWORD_INVALID;
@@ -279,7 +301,7 @@ class ExtendedPasswordHandler extends UserHandler
break;
case PASSWORD_MAGENTO_SALT :
case self::PASSWORD_MAGENTO_SALT :
$hash = $salt = '';
if ((strpos($stored_hash, ':') !== false))
{
@@ -299,13 +321,13 @@ class ExtendedPasswordHandler extends UserHandler
$stored_hash = $hash;
break;
case PASSWORD_E107_SALT :
case self::PASSWORD_E107_SALT :
//return e107::getUserSession()->CheckPassword($password, $login_name, $stored_hash);
return parent::CheckPassword($password, $login_name, $stored_hash);
return parent::CheckPassword($pword, $login_name, $stored_hash);
break;
case PASSWORD_PHPBB_SALT :
case PASSWORD_WORDPRESS_SALT :
case self::PASSWORD_PHPBB_SALT :
case self::PASSWORD_WORDPRESS_SALT :
if (strlen($stored_hash) != 34) return PASSWORD_INVALID;
$pwHash = $this->crypt_private($pword, $stored_hash, $password_type);
if ($pwHash[0] == '*')
@@ -315,14 +337,45 @@ class ExtendedPasswordHandler extends UserHandler
$stored_hash = substr($stored_hash,12);
break;
case PASSWORD_PLAINTEXT :
case self::PASSWORD_PHPFUSION_SALT:
list($hash, $salt) = explode(':', $stored_hash);
if (strlen($hash) !== 32)
{
$pwHash = hash_hmac('sha256',$pword, $salt);
}
else
{
e107::getMessage()->addDebug("PHPFusion Md5 Hash Detected ");
$pwHash = md5(md5($pword));
}
$stored_hash = $hash;
break;
case self::PASSWORD_PLAINTEXT :
$pwHash = $pword;
break;
default :
return PASSWORD_INVALID;
}
if(deftrue('e_DEBUG'))
{
e107::getMessage()->addDebug("Stored Hash: ".$stored_hash);
if(!empty($salt))
{
e107::getMessage()->addDebug("Stored Salt: ".$salt);
}
e107::getMessage()->addDebug("Generated Hash: ".$pwHash);
}
if ($stored_hash != $pwHash) return PASSWORD_INVALID;
return PASSWORD_VALID;
}

View File

@@ -92,7 +92,17 @@ class auth_login extends alt_auth_base
require_once(e_PLUGIN.'alt_auth/extended_password_handler.php'); // This auto-loads the 'standard' password handler as well
$pass_check = new ExtendedPasswordHandler();
if(empty($this->conf['importdb_password_method']))
{
$this->makeErrorText('importdb_password_method not set');
}
$passMethod = $pass_check->passwordMapping($this->conf['importdb_password_method']);
e107::getMessage()->addInfo("Testing with Password Method: ".$this->conf['importdb_password_method']);
if ($passMethod === FALSE)
{
$this->makeErrorText('Password error - invalid method');
@@ -100,6 +110,9 @@ class auth_login extends alt_auth_base
}
$pwFromDB = $row['user_password']; // Password stored in DB
e107::getMessage()->addDebug("Stored Password: ".$pwFromDB);
if ($pass_check->checkPassword($pword, $uname, $pwFromDB, $passMethod) !== PASSWORD_VALID)
{
$this->makeErrorText('Password incorrect');

View File

@@ -72,8 +72,8 @@ define('LAN_ALT_45', 'Username lookup successful');
define('LAN_ALT_46', 'Uername lookup failed');
define('LAN_ALT_47', 'Test');
define('LAN_ALT_48', 'Previous validation');
define('LAN_ALT_49', 'Username = ');
define('LAN_ALT_50', 'Password = ');
define('LAN_ALT_49', 'Username');
define('LAN_ALT_50', 'Password');
define('LAN_ALT_51', '(blank)');
define('LAN_ALT_52', 'Authentication failed - ');
define('LAN_ALT_53', 'unknown cause');

View File

@@ -22,14 +22,14 @@
* @version $Id$;
*/
define('E107DB_LAN_1', 'E107 format database');
define('E107DB_LAN_1', 'e107 format database');
define('E107DB_LAN_9', 'Password Method:');
define('E107DB_LAN_10', 'Configure E107 db auth');
define('E107DB_LAN_10', 'Configure e107 db auth');
define('E107DB_LAN_11', 'Check the box against any field you wish to be transferred to the local database:');
define('IMPORTDB_LAN_7', 'MD5 (E107 original)');
define('IMPORTDB_LAN_8', 'E107 salted (option 2.0 on)');
define('IMPORTDB_LAN_7', 'MD5 (e107 original)');
define('IMPORTDB_LAN_8', 'e107 salted (option 2.0 on)');
define('LAN_AUTHENTICATE_HELP','This authentication method is to be used with a second E107 database, which may use a different password format to this system. The

View File

@@ -61,8 +61,6 @@ class auth_login extends alt_auth_base
private function makeErrorText($extra = '')
{
$this->ErrorText = $extra;
//global $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $sql;
//$sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
}
@@ -83,7 +81,7 @@ class auth_login extends alt_auth_base
{
/* Begin - Deltik's PDO Workaround (part 1/2) */
$dsn = 'mysql:dbname=' . $this->conf['otherdb_database'] . ';host=' . $this->conf['otherdb_server'];
try
{
$dbh = new PDO($dsn, $this->conf['otherdb_username'], $this->conf['otherdb_password']);
@@ -121,11 +119,13 @@ class auth_login extends alt_auth_base
$sel_fields[] = $v;
}
}
$sel_fields[] = $this->conf['otherdb_password_field'];
$user_field = $this->conf['otherdb_user_field'];
if (isset($this->conf['otherdb_salt_field']))
if(!empty($this->conf['otherdb_password_salt']))
{
$sel_fields[] = $this->conf['otherdb_salt_field'];
$sel_fields[] = $this->conf['otherdb_password_salt'];
}
//Get record containing supplied login name
@@ -136,6 +136,7 @@ class auth_login extends alt_auth_base
if (!$r1 = $dbh->query($qry))
{
$this->makeErrorText('Lookup query failed');
e107::getMessage()->addDebug($qry);
return AUTH_NOCONNECT;
}
if (!$row = $r1->fetch(PDO::FETCH_BOTH))
@@ -173,7 +174,12 @@ class auth_login extends alt_auth_base
}
$pwFromDB = $row[$this->conf['otherdb_password_field']]; // Password stored in DB
if ($salt_field) $pwFromDB .= ':'.$row[$salt_field];
$salt_field = $this->conf['otherdb_password_salt'];
if(!empty($salt_field))
{
$pwFromDB .= ':'.$row[$salt_field];
}
if ($pass_check->checkPassword($pword, $uname, $pwFromDB, $passMethod) !== PASSWORD_VALID)
{

View File

@@ -51,28 +51,55 @@ class alt_auth_otherdb extends alt_auth_admin
$frm = new form;
$text = $frm -> form_open("post", e_SELF);
$text .= "<table class='table adminform'>";
$text .= "<tr><td>".LAN_ALT_26."</td><td>";
$text .= OTHERDB_LAN_15;
$text .= "</td></tr>";
$text .= $this->alt_auth_get_db_fields('otherdb', $frm, $parm, 'server|uname|pwd|db|table|ufield|pwfield|salt');
$text .= "<tr><td>".OTHERDB_LAN_9."</td><td>";
$tab1 = "<table class='table adminform'>
<colgroup>
<col class='col-label' />
<col class='col-control' />
</colgroup>
";
$tab1 .= "<tr><td>".LAN_ALT_26."</td><td>";
$tab1 .= OTHERDB_LAN_15;
$tab1 .= "</td></tr>";
$tab1 .= $this->alt_auth_get_db_fields('otherdb', $frm, $parm, 'server|uname|pwd|db|table|ufield|pwfield|salt');
$tab1 .= "<tr><td>".OTHERDB_LAN_9."</td><td>";
$text .= $this->altAuthGetPasswordSelector('otherdb_password_method', $frm, $parm['otherdb_password_method'], TRUE);
$tab1 .= $this->altAuthGetPasswordSelector('otherdb_password_method', $frm, $parm['otherdb_password_method'], TRUE);
$text .= "</td></tr>";
$tab1 .= "</td></tr>
</table>
";
$text .= "<tr><td class='forumheader2' colspan='2'>".LAN_ALT_27."</td></tr>";
$tab2 = "
<table class='table adminform'>
<colgroup>
<col class='col-label' />
<col class='col-control' />
</colgroup>
";
$text .= $this->alt_auth_get_field_list('otherdb',$frm, $parm, FALSE);
$tab2 .= "<tr><td class='forumheader2' colspan='2'>".LAN_ALT_27."</td></tr>";
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
$tab2 .= $this->alt_auth_get_field_list('otherdb',$frm, $parm, FALSE);
$tab2 .= '</table>';
$tabs = array(
'tab1' => array('caption'=>'Database', 'text'=>$tab1),
'tab2' => array('caption'=>'Data', 'text'=>$tab2),
);
$text .= e107::getForm()->tabs($tabs);
$text .= "<div class='buttons-bar center'>";
$text .= e107::getForm()->admin_button("update", LAN_UPDATE,'update');
$text .= '</td></tr>';
$text .= '</div>';
$text .= '</table>';
$text .= $frm -> form_close();
$ns -> tablerender(OTHERDB_LAN_10, $text);
@@ -84,15 +111,15 @@ class alt_auth_otherdb extends alt_auth_admin
$otherdbAdmin = new alt_auth_otherdb();
if(vartrue($_POST['update']))
if(!empty($_POST['update']))
{
$message = $otherdbAdmin->alt_auth_post_options('otherdb');
}
if(vartrue($message))
if(!empty($message))
{
e107::getRender()->tablerender('',"<div style='text-align:center;'>".$message.'</div>');
echo e107::getMessage()->addSuccess($message)->render();
}

View File

@@ -40,6 +40,14 @@ class download_setup
}
function upgrade_required()
{
return false;
}
// IMPORTANT : This function below is for modifying the CONTENT of the tables only, NOT the table-structure.
// To Modify the table-structure, simply modify your {plugin}_sql.php file and an update will be detected automatically.
/*
@@ -55,52 +63,86 @@ class download_setup
* {
* $this->upgrade_from_1();
* }
*/
*/
$config = e107::getPref('url_config');
if(!empty($config['download']))
{
e107::getConfig()
->removePref('url_config/download')
->removePref('url_locations/download')
->save(false,true);
if(file_exists(e_PLUGIN."download/url/url.php"))
{
@unlink(e_PLUGIN."download/url/url.php");
@unlink(e_PLUGIN."download/url/sef_url.php");
}
$bld = new eRouter;
$bld->buildGlobalConfig();
}
return $this->upgradeFilePaths($needed);
}
private function upgradeFilePaths($needed)
{
$sql = e107::getDb();
$mes = e107::getMessage();
$qry = "SELECT * FROM #download WHERE download_image !='' AND SUBSTRING(download_image, 1, 3) != '{e_' ";
if($sql->db_Select_gen($qry))
if($sql->gen($qry))
{
if($needed == TRUE){ return "Incorrect download image paths"; } // Signal that an update is required.
if($needed == TRUE){ return "Incorrect download image paths"; } // Signal that an update is required.
if($sql->db_Update("download","download_image = CONCAT('{e_FILE}downloadimages/',download_image) WHERE download_image !='' "))
{
$mes->addSuccess("Updated Download-Image paths");
$mes->addSuccess("Updated Download-Image paths");
}
else
{
$mes->addError("Failed to update Download-Image paths");
$mes->addError("Failed to update Download-Image paths");
}
if($sql->db_Update("download"," download_thumb = CONCAT('{e_FILE}downloadthumbs/',download_thumb) WHERE download_thumb !='' "))
{
$mes->addSuccess("Updated Download-Thumbnail paths");
$mes->addSuccess("Updated Download-Thumbnail paths");
}
else
{
$mes->addError("Failed to update Download-Thumbnail paths");
}
$mes->addError("Failed to update Download-Thumbnail paths");
}
}
$qry = "SELECT * FROM #download_category WHERE download_category_icon !='' AND SUBSTRING(download_category_icon, 1, 3) != '{e_' ";
if($sql->db_Select_gen($qry))
if($sql->gen($qry))
{
// Signal that an update is required.
if($needed == TRUE){ return "Downloads-Category icon paths need updating"; } // Must have a value if an update is needed. Text used for debug purposes.
if($needed == TRUE){ return "Downloads-Category icon paths need updating"; } // Must have a value if an update is needed. Text used for debug purposes.
if($sql->db_Update("download_category","download_category_icon = CONCAT('{e_IMAGE}icons/',download_category_icon) WHERE download_category_icon !='' "))
{
$mes->addSuccess("Updated Download-Image paths");
$mes->addSuccess("Updated Download-Image paths");
}
else
{
$mes->addError("Failed to update Download-Image paths");
}
$mes->addError("Failed to update Download-Image paths");
}
}
if($needed == TRUE){ return FALSE; }
if($needed == TRUE){ return FALSE; }
}
}

View File

@@ -637,7 +637,8 @@ class download_shortcodes extends e_shortcode
{
$tp = e107::getParser();
$url = e107::url('download', 'get', $this->var);
$url = e107::url('download', 'image', $this->var);
//$url = e_PLUGIN_ABS . "download/request.php?download." . $this->var['download_id'];
if($this->var['download_thumb'])
{

View File

@@ -105,7 +105,7 @@ class download_url // plugin-folder + '_url'
$config['item'] = array(
'regex' => '^{alias}/([\d]*)/(.*)$',
'redirect' => '{e_PLUGIN}download/download.php?action=view&id=$1',
'sef' => '{alias}/{download_id}/{download_sef}'
'sef' => '{alias}/{download_id}/{download_sef}',
);
$config['get'] = array(
@@ -114,6 +114,11 @@ class download_url // plugin-folder + '_url'
'redirect' => '{e_PLUGIN}download/request.php?id=$1', // file-path of what to load when the regex returns true.
);
$config['image'] = array(
'regex' => '^{alias}/image/([\d]*)/(.*)$',
'sef' => '{alias}/image/{download_id}/{download_sef}',
'redirect' => '{e_PLUGIN}download/request.php?download.$1', // file-path of what to load when the regex returns true.
);
$config['index'] = array(
'regex' => '{alias}/?(.*)$',

View File

@@ -638,7 +638,8 @@ class download
$subText .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_END, TRUE, $sc);
$dl_text .= $ns->tablerender($dl_title, $subText, 'download-list', true);
// $dl_text .= $ns->tablerender($dl_title, $subText, 'download-list', true);
$dl_text .= $subText;
}
}// End of subcategory display

View File

@@ -1,16 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<e107Plugin name="Downloads" lan="LAN_PLUGIN_DOWNLOAD_NAME" version="1.0" date="2012-08-01" compatibility="2.0" installRequired="true">
<e107Plugin name="Downloads" lan="LAN_PLUGIN_DOWNLOAD_NAME" version="1.1" date="2017-04-27" compatibility="2.0" installRequired="true">
<author name="e107 Inc." url="http://e107.org" />
<description lan="LAN_PLUGIN_DOWNLOAD_DIZ">This plugin is a fully featured File-download system</description>
<category>content</category>
<adminLinks>
<link url='admin_download.php' description='LAN_CONFIGURE' icon='images/downloads_32.png' iconSmall='images/downloads_16.png' primary='true' >DOWLAN_CAPTION</link>
<link url='admin_download.php' description='' icon='manage' iconSmall=''>DOWLAN_29</link>
<link url='admin_download.php?create' description='' icon='add' iconSmall=''>DOWLAN_30</link>
<link url='admin_download.php?cat' description='' icon='images/downloads_32.png' iconSmall=''>DOWLAN_31</link>
<link url='admin_download.php?opt' description='' icon='settings' iconSmall=''>DOWLAN_32</link>
<link url='admin_download.php?limits' description='' icon='images/downloads_32.png' iconSmall=''>DOWLAN_112</link>
<link url='admin_download.php?mirror' description='' icon='images/downloads_32.png' iconSmall=''>DOWLAN_128</link>
</adminLinks>
<siteLinks>
<link url="{e_PLUGIN}download/download.php" sef='index' perm="everyone">LAN_PLUGIN_DOWNLOAD_NAME</link>

View File

@@ -13,7 +13,6 @@ $id = FALSE;
if (!is_numeric(e_QUERY) && empty($_GET['id']))
{
if ($sql->select('download', 'download_id', "download_url='".$tp->toDB(e_QUERY)."'"))
@@ -36,6 +35,7 @@ if (!is_numeric(e_QUERY) && empty($_GET['id']))
if(strstr(e_QUERY, "mirror"))
{ // Download from mirror
list($action, $download_id, $mirror_id) = explode(".", e_QUERY);
@@ -104,7 +104,6 @@ if(vartrue($_GET['id'])) // SEF URL
if (preg_match("#.*\.[a-z,A-Z]{3,4}#", e_QUERY))
{
if(strstr(e_QUERY, "pub_"))
@@ -137,7 +136,7 @@ if ($type == "file")
{
$row = $sql->fetch();
$row['download_url'] = $tp->replaceConstants($row['download_url']);
$row['download_url'] = $tp->replaceConstants($row['download_url'],'abs');
if (check_class($row['download_category_class']) && check_class($row['download_class']))
{
@@ -325,15 +324,15 @@ else
if (file_exists(e_FILE."download/{$image}"))
{
$disp = "<div style='text-align:center'><img class='img-responsive img-fluid' src='".e_FILE."download/{$image}' alt='' /></div>";
$disp = "<div style='text-align:center'><img class='img-responsive img-fluid' src='".e_FILE_ABS."download/{$image}' alt='' /></div>";
}
else if(file_exists(e_FILE."downloadimages/{$image}"))
{
$disp = "<div style='text-align:center'><img class='img-responsive img-fluid' src='".e_FILE."downloadimages/{$image}' alt='' /></div>";
$disp = "<div style='text-align:center'><img class='img-responsive img-fluid' src='".e_FILE_ABS."downloadimages/{$image}' alt='' /></div>";
}
else
{
$image = $tp->replaceConstants($image);
$image = $tp->replaceConstants($image,'abs');
$disp = "<div style='text-align:center'><img class='img-responsive img-fluid' src='".$image."' alt='' /></div>";
}
@@ -350,7 +349,7 @@ else
}
elseif(is_file(e_FILE."downloadimages/{$image}"))
{
echo "<img src='".e_FILE."downloadimages/{$image}' alt='' />";
echo "<img src='".e_FILE_ABS."downloadimages/{$image}' alt='' />";
}
else
{

View File

@@ -148,7 +148,7 @@ e107::css('inline', 'td.last.options { padding-right:20px } ');
'main/datasets' => array('caption'=> ADSTAT_LAN_63, 'perm' => 'P'),
'main/rempage' => array('caption'=> ADSTAT_LAN_26, 'perm' => 'P'),
'main/history' => array('caption'=> ADSTAT_LAN_69, 'perm' => 'P'),
'main/rebuild' => array('caption'=>'Rebuild Statistic Summaries', 'perm'=> 'P'),
'main/rebuild' => array('caption'=> ADSTAT_LAN_87, 'perm'=> 'P'),
);
@@ -159,7 +159,7 @@ e107::css('inline', 'td.last.options { padding-right:20px } ');
'main/edit' => 'main/list'
);
protected $menuTitle = 'Statistic Logging';
protected $menuTitle = ADSTAT_L3;
}
@@ -196,7 +196,7 @@ e107::css('inline', 'td.last.options { padding-right:20px } ');
class logstats_ui extends e_admin_ui
{
protected $pluginTitle = 'Statistic Logging';
protected $pluginTitle = ADSTAT_L3;
protected $pluginName = 'log';
// protected $eventName = 'log-logstats'; // remove comment to enable event triggers in admin.
protected $table = 'logstats';
@@ -741,7 +741,7 @@ e107::css('inline', 'td.last.options { padding-right:20px } ');
if(!empty($_SESSION['stats_log_files_total']))
{
$text .= $frm->progressBar('rebuild-progress',0,array("btn-label"=>"Rebuild Stats", 'url'=>e_REQUEST_URI));
$text .= $frm->progressBar('rebuild-progress',0,array("btn-label"=> ADSTAT_LAN_88, 'url'=>e_REQUEST_URI));
}
$text .= $frm->close();
@@ -1112,7 +1112,7 @@ e107::css('inline', 'td.last.options { padding-right:20px } ');
if($date == 'pageTotal')
{
return $this->button('rebuildTotal', 1, 'delete', 'Rebuild');
return $this->button('rebuildTotal', 1, 'delete', ADSTAT_LAN_89);
}
@@ -1129,7 +1129,7 @@ e107::css('inline', 'td.last.options { padding-right:20px } ');
if(is_readable($file))
{
return $this->button('rebuild', $datestamp, 'delete', 'Rebuild');
return $this->button('rebuild', $datestamp, 'delete', ADSTAT_LAN_89);
}
else
{

View File

@@ -614,11 +614,13 @@ class logConsolidate
if($this->collatePageInfo($pageTotal, $datestamp))
{
$mes->addSuccess( "Data saved to database with id: ".$datestamp);
$message = e107::getParser()->lanVars(ADSTAT_LAN_90, array('x'=>$datestamp));
$mes->addSuccess($message);
}
else
{
$mes->addError( "Couldn't save data to database with id: ".$datestamp);
$message = e107::getParser()->lanVars(ADSTAT_LAN_91, array('x'=>$datestamp));
$mes->addError($message);
}
}
@@ -844,4 +846,4 @@ class logConsolidate
?>
?>

View File

@@ -69,7 +69,7 @@ define("ADSTAT_L49", "sort alphabetically");
define("ADSTAT_L50", "All-time stats");
define("ADSTAT_L51", "Current month stats");
define("ADSTAT_L52", "Previous month stats");
define("ADSTAT_L53", "");
define("ADSTAT_L53", "Information");
define("ADSTAT_L54", "");
define("ADSTAT_L55", "");
define("ADSTAT_L56", "");
@@ -78,4 +78,4 @@ define("ADSTAT_L58", "");
define("ADSTAT_L59", "");
define("ADSTAT_L60", "");
?>
?>

View File

@@ -96,6 +96,10 @@ define ('ADSTAT_LAN_83', 'Following log ID entries removed:');
define ('ADSTAT_LAN_84', 'This proceedure will overwrite the log statistic summaries in your database. (raw log files are left unchanged) Once replaced, the data cannot be recovered. Please backup or export your database first');
define ('ADSTAT_LAN_85', '[x] log files have been found. Click the button below to process these files.');
define ('ADSTAT_LAN_86', 'Total Hits');
define ('ADSTAT_LAN_87', 'Rebuild Statistic Summaries');
define ('ADSTAT_LAN_88', 'Rebuild Stats');
define ('ADSTAT_LAN_89', 'Rebuild');
define ('ADSTAT_LAN_90', "Data saved to database with id: [x]");
define ('ADSTAT_LAN_91', "Couldn't save data to database with id: [x]");
?>
?>

View File

@@ -1662,7 +1662,7 @@ class siteStats
<table class='table table-striped fborder' style='width: 100%;'>
<tr>
<th class='fcaption' style='width: 30%;'>".ADSTAT_L18."</th>
<th class='fcaption' style='width: 70%;'>Information</th>
<th class='fcaption' style='width: 70%;'>".ADSTAT_L53."</th>
</tr>\n";
foreach($recentArray as $key => $info)
@@ -2044,4 +2044,4 @@ class siteStats
?>
?>

View File

@@ -102,7 +102,7 @@ $pmManager = new pmbox_manager($pm_prefs);
$template = e107::getTemplate('pm', 'pm_menu');
//if(!isset($pm_menu_template))
if(!isset($PM_MENU_TEMPLATE))
if(!isset($template))
{
//FIXME URL Breaks
/*
@@ -122,7 +122,7 @@ if(!isset($PM_MENU_TEMPLATE))
*/
// $pm_menu_template = "
$PM_MENU_TEMPLATE = "
$template = "
<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>".PM_INBOX_ICON."</a>
<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>".LAN_PLUGIN_PM_INBOX."</a>
{PM_NEWPM_ANIMATE}
@@ -146,7 +146,7 @@ if(!isset($PM_MENU_TEMPLATE))
$sc->wrapper('pm_menu');
// $txt = "\n".$tp->parseTemplate($pm_menu_template, TRUE, $sc);
$txt = "\n".$tp->parseTemplate($PM_MENU_TEMPLATE, TRUE, $sc);
$txt = "\n".$tp->parseTemplate($template, TRUE, $sc);
if($pm_inbox['inbox']['new'] > 0 && $pm_prefs['popup'] && strpos(e_SELF, 'pm.php') === FALSE && $_COOKIE['pm-alert'] != 'ON')
{

View File

@@ -645,10 +645,11 @@ if(!class_exists('plugin_pm_pm_shortcodes'))
$pm_outbox = $this->pmManager->pm_getInfo('outbox');
if($pm_outbox['outbox']['filled'] < 100)
{
$link = $this->url('action/new');
return "<a class='btn btn-mini btn-xs btn-default' href='{$link}'>".PM_SEND_LINK."</a>";
// $link = $this->url('action/new');
// return "<a class='btn btn-mini btn-xs btn-default' href='{$link}'>".LAN_PLUGIN_PM_NEW."</a>";
return $this->url('action/new');
}
return '';
// return '';
}

View File

@@ -25,10 +25,15 @@
if (!defined('e107_INIT')) { exit; }
define('PM_INBOX_ICON', "<img src='".e_PLUGIN_ABS."pm/images/mail_get.png' class='icon S16' alt='".LAN_PLUGIN_PM_INBOX."' title='".LAN_PLUGIN_PM_INBOX."' />");
define('PM_OUTBOX_ICON', "<img src='".e_PLUGIN_ABS."pm/images/mail_send.png' class='icon S16' alt='".LAN_PLUGIN_PM_OUTBOX."' title='".LAN_PLUGIN_PM_OUTBOX."' />");
define('PM_SEND_LINK', LAN_PLUGIN_PM_NEW);
define('NEWPM_ANIMATION', "<img src='".e_PLUGIN_ABS."pm/images/newpm.gif' alt='' />");
//define('PM_INBOX_ICON', "<img src='".e_PLUGIN_ABS."pm/images/mail_get.png' class='icon S16' alt='".LAN_PLUGIN_PM_INBOX."' title='".LAN_PLUGIN_PM_INBOX."' />");
define('PM_INBOX_ICON', e107::getParser()->toGlyph('fa-inbox'));
//define('PM_OUTBOX_ICON', "<img src='".e_PLUGIN_ABS."pm/images/mail_send.png' class='icon S16' alt='".LAN_PLUGIN_PM_OUTBOX."' title='".LAN_PLUGIN_PM_OUTBOX."' />");
// Icon candidate to stacked fontawesome icons...
define('PM_OUTBOX_ICON', e107::getParser()->toGlyph('fa-inbox').e107::getParser()->toGlyph('fa-arrow-up'));
//define('PM_SEND_LINK', LAN_PLUGIN_PM_NEW);
//define('NEWPM_ANIMATION', "<img src='".e_PLUGIN_ABS."pm/images/newpm.gif' alt='' />");
// Icon candidate to animated fontawesome icons...
define('NEWPM_ANIMATION', e107::getParser()->toGlyph('fa-envelope'));
/*
$sc_style['PM_SEND_PM_LINK']['pre'] = "<br /><br />";
$sc_style['PM_SEND_PM_LINK']['post'] = "";
@@ -45,7 +50,8 @@ $sc_style['PM_NEWPM_ANIMATE']['post'] = "</a>";
$sc_style['PM_BLOCKED_SENDERS_MANAGE']['pre'] = "<br />[ <a href='".e_PLUGIN_ABS."pm/pm.php?blocked'>";
$sc_style['PM_BLOCKED_SENDERS_MANAGE']['post'] = '</a> ]';
*/
$PM_MENU_WRAPPER['PM_SEND_PM_LINK']= "<br /><br />{---}";
//$PM_MENU_WRAPPER['PM_SEND_PM_LINK']= "<br /><br />{---}";
$PM_MENU_WRAPPER['PM_SEND_PM_LINK']= "<a class='btn btn-mini btn-xs btn-default' href='{---}'>".LAN_PLUGIN_PM_NEW."</a>";
$PM_MENU_WRAPPER['PM_INBOX_FILLED']=$PM_MENU_WRAPPER['PM_OUTBOX_FILLED']= "[{---}%]";
$PM_MENU_WRAPPER['PM_NEWPM_ANIMATE']= "<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>{---}</a>";
$PM_MENU_WRAPPER['PM_BLOCKED_SENDERS_MANAGE']= "<br />[ <a href='".e_PLUGIN_ABS."pm/pm.php?blocked'>{---}</a> ]";

View File

@@ -666,13 +666,13 @@ class rssCreate
<link rel='self' href='".$tp->toRss(e107::url('rss_menu','atom', array('rss_url'=>$this->contentType, 'rss_topicid'=>$this->topicid),'full'))."' />\n";
// Optional
include(e_ADMIN."ver.php");
// include(e_ADMIN."ver.php");
echo "
<category term='e107'/>\n
<contributor>\n
<name>e107</name>\n
</contributor>\n
<generator uri='http://e107.org/' version='".$e107info['e107_version']."'>e107</generator>\n";
<generator uri='http://e107.org/' version='".e_VERSION."'>e107</generator>\n";
//<icon>/icon.jpg</icon>\n
echo "
<logo>".(strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", SITEBUTTON))."</logo>\n

View File

@@ -932,7 +932,22 @@ class wysiwyg
private function getSnippets()
{
$files = e107::getFile()->get_files(e_PLUGIN."tinymce4/snippets");
$customPath = THEME."templates/tinymce/snippets";
if(is_dir($customPath))
{
$path = $customPath;
$base = THEME_ABS."templates/tinymce/snippets";
}
else
{
$path = e_PLUGIN."tinymce4/snippets";
$base = e_PLUGIN_ABS."tinymce4/snippets";
}
$files = e107::getFile()->get_files($path);
$ret = array();
foreach($files as $f)
@@ -942,7 +957,9 @@ class wysiwyg
preg_match('/<!--[^\w]*Title:[\s]([^\r\n]*)[\s]*Info: ?([^\r\n]*)/is', $content, $m);
if(!empty($m[1]))
{
$url = e_PLUGIN_ABS."tinymce4/snippets/".$f['fname'];
// $url = e_PLUGIN_ABS."tinymce4/snippets/".$f['fname'];
$url = $base."/".$f['fname'];
$ret[] = array('title'=>trim($m[1]), 'url'=>$url, 'description'=>trim($m[2]));
}
}

View File

@@ -14,22 +14,263 @@ if (!defined('e107_INIT')) { exit; }
class user_dashboard // plugin-folder + '_url'
{
private $title;
private $title;
public $chartCaption = LAN_WEBSITE_STATUS;
function chart()
{
$config = array();
$tp = e107::getParser();
$config[] = array(
'text' => $this->registered('thismonth'),
'caption' => $this->title,
0 => array( 'text' => $this->renderChart(), 'caption' => $tp->toGlyph('fa-signal').' '.LAN_STATS),
1 => array('caption' =>$tp->toGlyph('fa-user').' '.LAN_ONLINE.' ('.$this->renderOnlineUsers('count').')', 'text'=>$this->renderOnlineUsers()),
2 => array( 'text' => $this->registered('user_new_thismonth'), 'caption' => $this->title),
);
return $config;
}
private function renderChart()
{
if (e107::isInstalled('log'))
{
return $this->renderStats('log');
}
else
{
return $this->renderStats('demo');
}
}
private function getStats($type)
{
if($type == 'demo')
{
$data = array();
$months = e107::getDate()->terms('month');
$data['labels'] = array($months[0], //"January",
$months[1], //"February",
$months[2], //"March",
$months[3], //"April",
$months[4], //"May",
$months[5], //"June",
$months[6] //"July"
);
$data['datasets'][] = array(
'fillColor' => "rgba(220,220,220,0.5)",
'strokeColor' => "rgba(220,220,220,1)",
'pointColor ' => "rgba(220,220,220,1)",
'pointStrokeColor' => "#fff",
'data' => array(65,59,90,81,56,55,40),
'title' => ADLAN_168// "Visits"
);
$data['datasets'][] = array(
'fillColor' => "rgba(151,187,205,0.5)",
'strokeColor' => "rgba(151,187,205,1)",
'pointColor ' => "rgba(151,187,205,1)",
'pointStrokeColor' => "#fff",
'data' => array(28,48,40,19,96,27,100),
'title' => ADLAN_169 //"Unique Visits"
);
return $data;
}
$sql = e107::getDB();
$td = date("Y-m-j", time());
$dayarray[$td] = array();
$pagearray = array();
$qry = "
SELECT * from #logstats WHERE log_id REGEXP('[[:digit:]]+\-[[:digit:]]+\-[[:digit:]]+')
ORDER BY CONCAT(LEFT(log_id,4), SUBSTRING(log_id, 6, 2), LPAD(SUBSTRING(log_id, 9), 2, '0'))
DESC LIMIT 0,9
";
if($amount = $sql->gen($qry))
{
$array = $sql->db_getList();
$ttotal = 0;
$utotal = 0;
foreach($array as $key => $value)
{
extract($value);
$log_id = substr($log_id, 0, 4).'-'.substr($log_id, 5, 2).'-'.str_pad(substr($log_id, 8), 2, '0', STR_PAD_LEFT);
if(is_array($log_data)) {
$entries[0] = $log_data['host'];
$entries[1] = $log_data['date'];
$entries[2] = $log_data['os'];
$entries[3] = $log_data['browser'];
$entries[4] = $log_data['screen'];
$entries[5] = $log_data['referer'];
}
else
{
$entries = explode(chr(1), $log_data);
}
$dayarray[$log_id]['daytotal'] = $entries[0];
$dayarray[$log_id]['dayunique'] = $entries[1];
unset($entries[0]);
unset($entries[1]);
foreach($entries as $entry)
{
if($entry)
{
list($url, $total, $unique) = explode("|", $entry);
if(strstr($url, "/"))
{
$urlname = preg_replace("/\.php|\?.*/", "", substr($url, (strrpos($url, "/")+1)));
}
else
{
$urlname = preg_replace("/\.php|\?.*/", "", $url);
}
$dayarray[$log_id][$urlname] = array('url' => $url, 'total' => $total, 'unique' => $unique);
if (!isset($pagearray[$urlname]['total'])) $pagearray[$urlname]['total'] = 0;
if (!isset($pagearray[$urlname]['unique'])) $pagearray[$urlname]['unique'] = 0;
$pagearray[$urlname]['total'] += $total;
$pagearray[$urlname]['unique'] += $unique;
$ttotal += $total;
$utotal += $unique;
}
}
}
}
$logfile = e_LOG.'logp_'.date('z.Y', time()).'.php'; // was logi_ ??
if(is_readable($logfile))
{
require($logfile);
}
if(vartrue($pageInfo))
{
foreach($pageInfo as $fkey => $fvalue)
{
$dayarray[$td][$fkey]['total'] += $fvalue['ttl'];
$dayarray[$td][$fkey]['unique'] += $fvalue['unq'];
$dayarray[$td]['daytotal'] += $fvalue['ttl'];
$dayarray[$td]['dayunique'] += $fvalue['unq'];
$pagearray[$fkey]['total'] += $fvalue['ttl'];
$pagearray[$fkey]['unique'] += $fvalue['unq'];
$ttotal += $fvalue['ttl'];
$utotal += $fvalue['unq'];
}
}
$visitors = array();
$unique = array();
ksort($dayarray);
foreach($dayarray as $k=>$v)
{
$unix = strtotime($k);
$visitors[] = intval(vartrue($v['daytotal']));
$unique[] = intval(vartrue($v['dayunique']));
$label[] = "'".date("D",$unix)."'";
}
$data = array();
$data['labels'] = $label;
//visitors
$data['datasets'][] = array(
'fillColor' => "rgba(220,220,220,0.5)",
'strokeColor' => "rgba(220,220,220,1)",
'pointColor ' => "rgba(220,220,220,1)",
'pointStrokeColor' => "#fff",
'data' => $visitors
);
//Unique Visitors
$data['datasets'][] = array(
'fillColor' => "rgba(151,187,205,0.5)",
'strokeColor' => "rgba(151,187,205,1)",
'pointColor ' => "rgba(151,187,205,1)",
'pointStrokeColor' => "#fff",
'data' => $unique
);
return $data;
}
private function renderStats($type)
{
$data = $this->getStats($type);
$cht = e107::getChart();
$cht->setType('line');
$cht->setOptions(array(
'annotateDisplay' => true,
'annotateFontSize' => 8
));
$cht->setData($data,'canvas');
$text = $cht->render('canvas');
if($type == 'demo')
{
$text .= "<div class='center'><small>".ADLAN_170."<a class='btn btn-xs btn-mini' href='".e_ADMIN."plugin.php?avail'>".ADLAN_171."</a></small></div>";
}
else
{
$text .= "<div class='center'><small>
<span style='color:rgba(220,220,220,0.5)'>&diams;</span>".ADLAN_168."&nbsp;&nbsp;
<span style='color:rgba(151,187,205,1)'>&diams;</span>".ADLAN_169."
</small></div>";
}
return $text;
}
/**
* TODO Switch to line-filled graph and add unactivated users also.
* @param string $when
@@ -120,7 +361,7 @@ class user_dashboard // plugin-folder + '_url'
$cht->setData($data);
// redraw to fix sizing issue.
e107::js('footer-inline', "
/* e107::js('footer-inline', "
$('a[data-toggle=\"tab\"]').on('shown.bs.tab', function (e) {
@@ -129,14 +370,135 @@ class user_dashboard // plugin-folder + '_url'
})
");
");*/
return "<div class='height:50%'>".$cht->render($id, $width, $height)."</div>";
// return "<div class='height:50%'>".$cht->render('projection', 320, 380)."</div>";
}
}
function renderOnlineUsers($data=false)
{
$ol = e107::getOnline();
$tp = e107::getParser();
$multilan = e107::getPref('multilanguage');
$panelOnline = "
<table class='table table-condensed table-striped' >
<colgroup>
<col style='width: 10%' />
<col style='width: 25%' />
<col style='width: 10%' />
<col style='width: 40%' />
<col style='width: auto' />";
$panelOnline .= (!empty($multilan)) ? "<col style='width: auto' />" : "";
$panelOnline .= "
</colgroup>
<thead>
<tr class='first'>
<th>".LAN_TIMESTAMP."</th>
<th>".LAN_USER."</th>
<th>".LAN_IP."</th>
<th>".LAN_PAGE."</th>
<th class='center'>".LAN_AGENT."</th>";
$panelOnline .= (!empty($multilan)) ? "<th class='center'>".LAN_LANG."</th>" : "";
$panelOnline .= "
</tr>
</thead>
<tbody>";
$online = $ol->userList() + $ol->guestList();
if($data == 'count')
{
return count($online);
}
// echo "Users: ".print_a($online);
$lng = e107::getLanguage();
foreach ($online as $val)
{
$panelOnline .= "
<tr>
<td class='nowrap'>".e107::getDateConvert()->convert_date($val['user_currentvisit'],'%H:%M:%S')."</td>
<td>".$this->renderOnlineName($val['online_user_id'])."</td>
<td>".e107::getIPHandler()->ipDecode($val['user_ip'])."</td>
<td><a class='e-tip' href='".$val['user_location']."' title='".$val['user_location']."'>".$tp->html_truncate(basename($val['user_location']),50,"...")."</a></td>
<td class='center'><a class='e-tip' href='#' title='".$val['user_agent']."'>".$this->browserIcon($val)."</a></td>";
$panelOnline .= (!empty($multilan)) ? "<td class='center'><a class='e-tip' href='#' title=\"".$lng->convert($val['user_language'])."\">".$val['user_language']."</a></td>" : "";
$panelOnline .= "
</tr>
";
}
$panelOnline .= "</tbody></table>";
return $panelOnline;
}
function browserIcon($row)
{
$types = array(
"ie" => "MSIE",
'chrome' => 'Chrome',
'firefox' => 'Firefox',
'seamonkey' => 'Seamonkey',
// 'Chromium/xyz
'safari' => "Safari",
'opera' => "Opera"
);
if($row['user_bot'] === true)
{
return "<i class='browser e-bot-16'></i>";
}
foreach($types as $icon=>$b)
{
if(strpos($row['user_agent'], $b)!==false)
{
return "<i class='browsers e-".$icon."-16' ></i>";
}
}
return "<i class='browsers e-firefox-16'></i>"; // FIXME find a default icon.
}
private function renderOnlineName($val)
{
if($val==0)
{
return LAN_GUEST;
}
return $val;
}
}

View File

@@ -1540,6 +1540,8 @@ footer {
body#admin-menus > .container-fluid > .row,
body#admin-menus .admin-left-panel,
/* Flex Classes */
.row-flex,
.row-flex > div[class*='col-'] {
display: -webkit-box;
@@ -1548,9 +1550,39 @@ body#admin-menus .admin-left-panel,
display: -webkit-flex;
display: flex;
flex:1 1 auto;
}
.row-flex-wrap {
-webkit-flex-flow: row wrap;
align-content: flex-start;
flex:0;
}
.row-flex > div[class*='col-'], .container-flex > div[class*='col-'] {
margin:-.2px;
}
.row-flex .draggable-panels {
width: 100%;
margin-bottom: 15px;
}
.flex-col {
display: flex;
display: -webkit-flex;
flex: 1 100%;
flex-flow: column nowrap;
}
.flex-grow {
display: flex;
-webkit-flex: 2;
flex: 2;
}
.row-flex .panel { height: 100%; }
body#admin-menus > .container-fluid > .row {
height: 92vh;
}
@@ -1563,11 +1595,6 @@ flex-flow: column nowrap;
margin:-.2px; /* hack adjust for wrapping */
}
.container-flex > div[class*='col-'] div,
.row-flex > div[class*='col-'] div {
width:100%;
}
body#admin-menus #sc-admin-help,
body#admin-menus #sc-admin-help .panel-body,
.flex-col {
@@ -1583,6 +1610,16 @@ body#admin-menus #sc-admin-help .panel-body,
flex: 2;
}
body#admin-menus .admin-left-panel .panel {
max-height: 50%;
}
body#admin-menus .admin-left-panel .admin-menu {
overflow-y: auto;
display: flex;
display: -webkit-flex;
flex: 1 100%;
flex-flow: column nowrap;
}
body#admin-menus #sc-admin-help {
overflow-y:hidden;
}
@@ -1682,3 +1719,5 @@ td img.thumbnail { margin-bottom:0 }
}

View File

@@ -281,6 +281,7 @@ $ADMIN_FOOTER = '
* see function e107::getNav()->admin() in e107_admin/header.php
*/
$E_ADMIN_MENU['start'] = '
<div class="nav-panel-body">
<ul id="admin-ui-nav-menu" class="plugin-navigation nav nav-pills nav-stacked">
';
@@ -320,6 +321,7 @@ $E_ADMIN_MENU['end_sub'] = '
$E_ADMIN_MENU['end'] = '
</ul>
</div>
';
$E_ADMIN_MENU['divider'] = '<li role="separator" class="divider"></li>';

View File

@@ -43,11 +43,13 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
var $placeholders = $('.draggable-placeholder');
var $draggablePanels = $(e107.settings.flexPanel.selector);
$placeholders.css('margin', '15px');
/*$placeholders.css('margin', '15px');*/
$placeholders.css('background-color', '#337ab7');
$draggablePanels.css('min-height', '20px');
$draggablePanels.css('min-height', '80px');
$draggablePanels.css('border', '1px dashed #CCCCCC');
$draggablePanels.css('background-color', 'rgba(0,0,0,0.1)');
$draggablePanels.css('margin-bottom', '30px');
$panel.sortable("refreshPositions");
@@ -58,6 +60,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
$draggablePanels.css('min-height', '0');
$draggablePanels.css('border', 'none');
$draggablePanels.css('margin-bottom', '0');
$draggablePanels.css('background-color', 'transparent');
e107.callbacks.flexPanelSavePanelOrder();
}

View File

@@ -64,9 +64,7 @@
if($file = $eUrl->getInclude())
{
include_once(HEADERF);
include_once($file);
include_once(FOOTERF);
exit;
}