1
0
mirror of https://github.com/e107inc/e107.git synced 2025-05-01 09:48:19 +02:00

Merge pull request #17 from e107inc/master

.
This commit is contained in:
rica-carv 2016-06-23 17:16:55 +01:00 committed by GitHub
commit 8352cef989
32 changed files with 1868 additions and 177 deletions

View File

@ -97,6 +97,7 @@ class admin_start
$this->checkFileTypes();
$this->checkSuspiciousFiles();
$this->checkDeprecated();
$this->checkPasswordEncryption();
if($this->refresh == true)
{
@ -205,7 +206,20 @@ class admin_start
}
function checkPasswordEncryption()
{
$us = e107::getUserSession();
$mes = e107::getMessage();
if($us->passwordAPIExists() === true && $us->getDefaultHashType() !== PASSWORD_E107_PHP && e107::pref('core','password_CHAP')==0)
{
$message = "It is HIGHLY recommended that you [change your password encoding] to the PHP Default. (Password hashes will be automatically upgraded during user login.)";
$srch = array('[',']');
$repl = array("<a class='alert-link' href='".e_ADMIN."prefs.php#nav-core-prefs-security'>","</a>");
$mes->addWarning(str_replace($srch,$repl,$message));
}
}

View File

@ -1230,10 +1230,10 @@ $core_image = array (
array (
'English.php' => '5f81da7166965e4a08f4bf4de060f409',
),
'English.php' => 'c8c59cc8ea0426757eeb737f3a7f8754',
'English_front.php' => 'c8c59cc8ea0426757eeb737f3a7f8754',
),
'clock.js' => '98871f097e7b77f981df163421edb721',
'clock_menu.php' => '3168321679773a9b312516a5f68ebeb9',
'clock_menu.php' => '093e3d29e611974b9425713014cda36b',
'config.php' => '990e7bff8e3cfee87d7bdbb9738fb80b',
),
'comment_menu' =>
@ -4131,4 +4131,4 @@ $deprecated_image = array (
'upgrade.php' => '5e74e594b56732d62183c0300e222f2a',
);
?>
?>

View File

@ -53,9 +53,9 @@ if(!empty($_GET['iframe']))
protected $adminMenu = array(
'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => '0'),
'main/db' => array('caption'=> LAN_CREATE, 'perm' => 'P'),
'main/tools' => array('caption'=>LANG_LAN_21, 'perm'=>'P')
'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => '0'),
'main/db' => array('caption'=> LAN_CREATE, 'perm' => 'L'),
'main/tools' => array('caption'=>LANG_LAN_21, 'perm'=>'L')
// 'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'),
// 'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P')

View File

@ -1381,7 +1381,7 @@ $text .= "
<tr>
<td><label for='passwordencoding'>".PRFLAN_188.":</label></td>
<td>
";
$pwdEncodeOpts = array();
@ -1389,17 +1389,19 @@ $text .= "
if(function_exists('password_verify')) // ie. php 5.5 or higher
{
$pwdEncodeOpts[3] = "PHP Default (Preferred)";
}
$pwdEncodeOpts[1] = PRFLAN_190;
$pwdEncodeOpts[0] = PRFLAN_189;
$text .= (isset($pwdEncodeOpts[3]) && $pref['passwordEncoding']!=3) ? "<td class='has-warning'>" : "<td>";
$text .= $frm->select('passwordEncoding', $pwdEncodeOpts, varset($pref['passwordEncoding'], 0));
// $text .= $frm->radio_switch('passwordEncoding', varset($pref['passwordEncoding'], 0), PRFLAN_190, PRFLAN_189);
$text .= "
<div class='smalltext field-help'>".PRFLAN_191."</div>
<div class='smalltext field-help'></div>
</td>
</tr>
<tr>";
@ -1783,11 +1785,63 @@ $text .= "
"</div>";
}
$text .= "
".pref_submit('javascript')."
</fieldset>
";
$text .= pref_submit('javascript');
// [e_LANGUAGEDIR]/[e_LANGUAGE]/lan_library_manager.php
e107::lan('core', 'library_manager');
$text .= '<h4 class="caption">' . LAN_LIBRARY_MANAGER_25 . '</h4>';
$text .= '<table width="100%" class="table table-striped" cellpadding="0" cellspacing="0">';
$text .= '<thead>';
$text .= '<tr>';
$text .= '<th>' . LAN_LIBRARY_MANAGER_13 . '</th>';
$text .= '<th class="text-center">' . LAN_LIBRARY_MANAGER_21 . '</th>';
$text .= '<th class="text-center">' . LAN_LIBRARY_MANAGER_14 . '</th>';
$text .= '<th class="text-center">' . LAN_LIBRARY_MANAGER_18 . '</th>';
$text .= '<th>' . LAN_LIBRARY_MANAGER_19 . '</th>';
$text .= '<th></th>';
$text .= '</tr>';
$text .= '</thead>';
$text .= '<tbody>';
$libraries = e107::library('info');
foreach($libraries as $machineName => $library)
{
$details = e107::library('detect', $machineName);
if(empty($details['name']))
{
continue;
}
$name = libraryGetName($machineName, $details);
$provider = libraryGetProvider($details);
$status = libraryGetStatus($details);
$links = libraryGetLinks($details);
$text .= '<tr>';
$text .= '<td>' . $name . '</td>';
$text .= '<td class="text-center">' . $provider . '</td>';
$text .= '<td class="text-center">' . $details['version'] . '</td>';
$text .= '<td class="text-center">' . $status . '</td>';
$text .= '<td>' . $details['error_message'] . '</td>';
$text .= '<td>' . $links . '</td>';
$text .= '</tr>';
}
if(empty($libraries))
{
$text .= '<tr>';
$text .= '<td colspan="6">' . LAN_LIBRARY_MANAGER_26 . '</td>';
$text .= '</tr>';
}
$text .= '</tbody>';
$text .= '</table>';
$text .= "</fieldset>";
/*
e107::js('inline',"
@ -1940,3 +1994,109 @@ function prefs_adminmenu()
e107::getNav()->admin("Basic ".LAN_OPTIONS.'--id--prev_nav', 'core-prefs-main', $var);
}
/**
* Helper function to get library's name.
*/
function libraryGetName($machineName, $details)
{
$text = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_27, array($machineName));
return '<span data-toggle="tooltip" data-placement="top" title="' . $text . '">' . $details['name'] . '</span>';
}
/**
* Helper function to get links.
*/
function libraryGetLinks($details)
{
$homepage = libraryGetHomepage($details);
$download = libraryGetDownload($details);
if ($homepage && $download)
{
return $homepage . ' | ' . $download;
}
if($homepage)
{
return $homepage;
}
if($download)
{
return $download;
}
}
/**
* Helper function to get homepage link.
*/
function libraryGetHomepage($details)
{
if (empty($details['vendor_url']))
{
return false;
}
$href = $details['vendor_url'];
$title = $details['name'];
return '<a href="' . $href . '" title="' . $title . '" target="_blank">' . LAN_LIBRARY_MANAGER_15 . '</a>';
}
/**
* Helper function to get download link.
*/
function libraryGetDownload($details)
{
if (empty($details['download_url']))
{
return false;
}
$href = $details['download_url'];
$title = $details['name'];
return '<a href="' . $href . '" title="' . $title . '" target="_blank">' . LAN_LIBRARY_MANAGER_16 . '</a>';
}
/**
* Helper function to get provider.
*/
function libraryGetProvider($details)
{
$text = 'e107';
$provider = LAN_LIBRARY_MANAGER_24;
if(varset($details['plugin'], false) == true)
{
$text = $details['plugin'];
$provider = LAN_LIBRARY_MANAGER_22;
}
if(varset($details['theme'], false) == true)
{
$text = $details['theme'];
$provider = LAN_LIBRARY_MANAGER_23;
}
return '<span data-toggle="tooltip" data-placement="top" title="' . $text . '">' . $provider . '</span>';
}
/**
* Helper function to get status.
*/
function libraryGetStatus($details)
{
$tp = e107::getParser();
if($details['installed'] == true)
{
$icon = $tp->toGlyph('glyphicon-ok');
$text = LAN_OK;
return '<span class="text-success" data-toggle="tooltip" data-placement="top" title="' . $text . '">' . $icon . '</span>';
}
$icon = $tp->toGlyph('glyphicon-remove');
$text = $details['error'];
return '<span class="text-danger" data-toggle="tooltip" data-placement="top" title="' . $text . '">' . $icon . '</span>';
}

View File

@ -167,7 +167,15 @@ JS;
case 'loginas':
case 'unadmin':
$_POST['etrigger_'.$_POST['useraction']] = $_POST['userid'];
break;
break;
case 'logoutas':
$this->getRequest()
->setQuery(array())
->setMode('main')
->setAction('logoutas');
break;
// redirect to AdminObserver/AdminPage()
case 'admin':

View File

@ -2241,7 +2241,7 @@ class e_admin_controller
if(!$path && $this->getParam('modes'))
{
$modes = $this->getParam('modes');
if(vartue($modes[$mode]) && vartrue($modes[$mode]['url']))
if(vartrue($modes[$mode]) && vartrue($modes[$mode]['url']))
{
$path = e107::getParser()->replaceConstants($modes[$mode]['url'], 'abs');
}

View File

@ -1713,7 +1713,7 @@ class e107
* $name, or FALSE if the library $name is not registered.
* - In case of 'load': An associative array of the library information.
*/
public static function library($action, $library)
public static function library($action = '', $library = null)
{
$libraryHandler = e107::getLibrary();
@ -1726,6 +1726,10 @@ class e107
case 'load':
return $libraryHandler->load($library);
break;
case 'info':
return $libraryHandler->info($library);
break;
}
}

View File

@ -395,8 +395,9 @@ abstract class e_marketplace_adapter_abstract
$cp = e107::getFile()->initCurl($remote_url);
curl_setopt($cp, CURLOPT_FILE, $fp);
/* $cp = curl_init($remote_url);
curl_setopt($cp, CURLOPT_FILE, $fp);
//curl_setopt($ch, CURLOPT_VERBOSE, 1);
//curl_setopt($ch, CURLOPT_STDERR, $fp1);

View File

@ -385,7 +385,7 @@ class eIPHandler
if (!is_readable($fileName)) return; // @todo should we just die if no file - we know the IP is in the ban list.
$vals = file($fileName);
if ($vals === FALSE) return;
if ($vals === FALSE || count($vals) == 0) return;
if (substr($vals[0], 0, 5) != '<?php')
{
echo 'Invalid message file';
@ -455,7 +455,7 @@ class eIPHandler
if (!is_readable($fileName)) return $ret;
$vals = file($fileName);
if ($vals === FALSE) return $ret;
if ($vals === FALSE || count($vals) == 0) return $ret;
if (substr($vals[0], 0, 5) != '<?php')
{
echo 'Invalid list file';

View File

@ -89,7 +89,7 @@ class e_library_manager
$library['error'] = LAN_LIBRARY_MANAGER_09;
$replace_with = array($library['name']);
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_03, $replace_with);
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_03, $replace_with, true);
return $library;
}
@ -165,7 +165,7 @@ class e_library_manager
$library['error'] = LAN_LIBRARY_MANAGER_10;
$replace_with = array($library['name']);
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_04, $replace_with);
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_04, $replace_with, true);
return $library;
}
@ -188,7 +188,7 @@ class e_library_manager
$library['error'] = LAN_LIBRARY_MANAGER_11;
$replace_with = array($library['version'], $library['name']);
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_05, $replace_with);
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_05, $replace_with, true);
return $library;
}
@ -258,7 +258,7 @@ class e_library_manager
$variant['error'] = LAN_LIBRARY_MANAGER_09;
$replace_with = array($variant_name, $library['name']);
$variant['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_06, $replace_with);
$variant['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_06, $replace_with, true);
}
}
}
@ -433,7 +433,7 @@ class e_library_manager
* An associative array containing registered information for all libraries, the registered information for the
* library specified by $name, or FALSE if the library $name is not registered.
*/
private function &info($library = null)
public function &info($library = null)
{
// This static cache is re-used by detect() to save memory.
static $libraries;
@ -680,7 +680,7 @@ class e_library_manager
$library['error'] = LAN_LIBRARY_MANAGER_07;
$replace_with = array($dependency['name'], $library['name']);
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_01, $replace_with);
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_01, $replace_with, true);
}
elseif($this->checkIncompatibility($dependency_info, $dependency['version']))
{
@ -688,7 +688,7 @@ class e_library_manager
$library['error'] = LAN_LIBRARY_MANAGER_08;
$replace_with = array($dependency['version'], $library['name'], $library['name']);
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_02, $replace_with);
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_02, $replace_with, true);
}
// Remove the version string from the dependency, so load() can load the libraries directly.

View File

@ -829,7 +829,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
// 35 => array('#TODO', 'System Info', 'System Information', '', 20, '', ''),
36 => array(e_ADMIN_ABS.'credits.php', LAN_CREDITS, LAN_CREDITS, '', 20, E_16_E107, E_32_E107),
// 37 => array(e_ADMIN.'custom_field.php', ADLAN_161, ADLAN_162, 'U', 4, E_16_CUSTOMFIELD, E_32_CUSTOMFIELD),
38 => array(e_ADMIN_ABS.'comment.php', LAN_COMMENTMAN, LAN_COMMENTMAN, 'B', 5, E_16_COMMENT, E_32_COMMENT)
38 => array(e_ADMIN_ABS.'comment.php', LAN_COMMENTMAN, LAN_COMMENTMAN, 'B', 5, E_16_COMMENT, E_32_COMMENT),
);
if($mode == 'legacy')

View File

@ -159,6 +159,26 @@ class UserHandler
}
/**
* Return the code for the current default password hash-type
* @return int
*/
public function getDefaultHashType()
{
return $this->preferred;
}
/**
* Returns true if PHP5.5+ password API is found, otherwise return false.
* @return bool
*/
public function passwordAPIExists()
{
return $this->passwordAPI;
}
/**
* Given plaintext password and login name, generate password string to store in DB
*
@ -250,10 +270,10 @@ class UserHandler
/**
* If necessary, rehash the user password to the currently set algorythm.
* If necessary, rehash the user password to the currently set algorythm and updated database. .
* @param array $user - user fields. required: user_id, user_loginname, user_password
* @param string $password - plain text password.
* @return bool|int
* @return bool|str returns new password hash on success or false.
*/
public function rehashPassword($user, $password)
{
@ -265,10 +285,13 @@ class UserHandler
}
$sql = e107::getDb();
$newPasswordHash = $this->HashPassword($password, $user['user_loginname']);
$update = array(
'data' => array(
'user_password' => $this->HashPassword($password, $user['user_loginname']),
'user_password' => $newPasswordHash,
),
'WHERE' => "user_id = ".intval($user['user_id'])." LIMIT 1",
@ -276,10 +299,12 @@ class UserHandler
);
if($sql->update('user', $update)!==false)
{
return $newPasswordHash;
}
return $sql->update('user', $update);
return false;
}
@ -366,12 +391,9 @@ class UserHandler
return $rawPassword;
}
else
{
return false;
}
return false;
}
@ -652,6 +674,10 @@ class UserHandler
$_COOKIE[e107::getPref('cookie_name')] = $cookieval; // make it available to the global scope before the page is reloaded
}
}
// echo "Debug: making cookie: ".$cookieval ." from ".print_a($lode,true);
// exit;
}

View File

@ -182,7 +182,7 @@ define("ADLAN_159", "URL Configuration");
define("ADLAN_160", "Configure Site URLs");
define("ADLAN_161", "Custom Fields?");
define("ADLAN_162", "A newer version of your site-theme is available:");
define("ADLAN_163", "A newer version of an installed plugin is available:");
define("ADLAN_163", "A newer version of an installed plugin is available:");
// define("ADLAN_CL_1", "Settings");
define("ADLAN_CL_2", "Users");

View File

@ -271,7 +271,7 @@ define("PRFLAN_253", "Disable consolidated scripts browser cache:");
define("PRFLAN_254", "Email &amp; Contact Info");
define("PRFLAN_255", "File Uploading");
define("PRFLAN_256", "Advanced Options");
define("PRFLAN_257", "Javascript Framework");
define("PRFLAN_257", "Libraries");
define("PRFLAN_258", "Contact Form Visibility");
define("PRFLAN_259", "Register & Login");

View File

@ -5,14 +5,31 @@
* Language definitions for Library Manager.
*/
define('LAN_LIBRARY_MANAGER_01', 'The "[x]" library, which the "[y]" library depends on, is not installed.');
define('LAN_LIBRARY_MANAGER_02', 'The version "[x]" of the "[y]" library is not compatible with the "[z]" library.');
define('LAN_LIBRARY_MANAGER_03', 'The "[x]" library could not be found.');
define('LAN_LIBRARY_MANAGER_04', 'The version of the "[x]" library could not be detected.');
define('LAN_LIBRARY_MANAGER_05', 'The installed version "[x]" of the "[y]" library is not supported.');
define('LAN_LIBRARY_MANAGER_06', 'The "[x]" variant of the "[y]" library could not be found.');
define('LAN_LIBRARY_MANAGER_01', 'The [x] library, which the [y] library depends on, is not installed.');
define('LAN_LIBRARY_MANAGER_02', 'The version [x] of the [y] library is not compatible with the [z] library.');
define('LAN_LIBRARY_MANAGER_03', 'The [x] library could not be found.');
define('LAN_LIBRARY_MANAGER_04', 'The version of the [x] library could not be detected.');
define('LAN_LIBRARY_MANAGER_05', 'The installed version [x] of the [y] library is not supported.');
define('LAN_LIBRARY_MANAGER_06', 'The [x] variant of the [y] library could not be found.');
define('LAN_LIBRARY_MANAGER_07', 'missing dependency');
define('LAN_LIBRARY_MANAGER_08', 'incompatible dependency');
define('LAN_LIBRARY_MANAGER_09', 'not found');
define('LAN_LIBRARY_MANAGER_10', 'not detected');
define('LAN_LIBRARY_MANAGER_11', 'not supported');
define('LAN_LIBRARY_MANAGER_12', 'List');
define('LAN_LIBRARY_MANAGER_13', 'Library');
define('LAN_LIBRARY_MANAGER_14', 'Version');
define('LAN_LIBRARY_MANAGER_15', 'Homepage');
define('LAN_LIBRARY_MANAGER_16', 'Download');
define('LAN_LIBRARY_MANAGER_17', 'Installed');
define('LAN_LIBRARY_MANAGER_18', 'Status');
define('LAN_LIBRARY_MANAGER_19', 'Message');
define('LAN_LIBRARY_MANAGER_20', 'link');
define('LAN_LIBRARY_MANAGER_21', 'Provider');
define('LAN_LIBRARY_MANAGER_22', 'plugin');
define('LAN_LIBRARY_MANAGER_23', 'theme');
define('LAN_LIBRARY_MANAGER_24', 'core');
define('LAN_LIBRARY_MANAGER_25', 'Third-party libraries');
define('LAN_LIBRARY_MANAGER_26', 'No library found');
define('LAN_LIBRARY_MANAGER_27', 'Machine name: [x]');

View File

@ -10,7 +10,7 @@
<word>template</word>
</keywords>
<adminLinks>
<link url='admin_config.php' description='Configure Blank Plugin' icon='images/blank_32.png' iconSmall='images/blank_16.png' primary='true' >LAN_CONGIGURE</link>
<link url='admin_config.php' description='Configure Blank Plugin' icon='images/blank_32.png' iconSmall='images/blank_16.png' icon128="" primary='true' >LAN_CONGIGURE</link>
<link url="admin_config.php?mode=options" description="Configure Blank Prefs" icon="manage" >Blank Prefs</link>
</adminLinks>
<siteLinks>

View File

@ -21,7 +21,7 @@
//FIXME looks pretty much to be 0.6 compatible
if (!defined('e107_INIT')) { exit(); }
e107::lan('clock_menu',e_LANGUAGE);
e107::lan('clock_menu',false);
$menu_pref = e107::getConfig('menu')->getPref('');
@ -57,4 +57,4 @@ echo "
<script type=\"text/javascript\">\nwindow.setTimeout(\"tick('".$menu_pref['clock_dateprefix']."', '".$menu_pref['clock_format']."', '".$menu_pref['clock_datesuffix1']."', '".$menu_pref['clock_datesuffix2']."', '".$menu_pref['clock_datesuffix3']."', '".$menu_pref['clock_datesuffix4']."')\",150);\n</script>
<!-- ### end clock ### //-->\n\n";
?>
?>

View File

@ -104,7 +104,7 @@ if(isset($_GET['f']))
//var_dump (is_array($sc));
//--$fVars = new e_vars;
$gen = new convert;
//--$gen = new convert;
/*--
// Gonne directly to shortcode file

View File

@ -2097,6 +2097,7 @@ class e107forum
// Function eventually to be reworked (move full function to shortcode file, or make a new breadcrumb function, like in downloads, maybe?)
/*
* set bread crumb
* $forum_href override ONLY applies when template is missing FORUM_CRUMB
@ -2110,8 +2111,9 @@ class e107forum
$forumTitle = e107::pref('forum','title', LAN_PLUGIN_FORUM_NAME);
global $FORUM_CRUMB, $forumInfo, $threadInfo, $thread;
global $BREADCRUMB,$BACKLINK; // Eventually we should deprecate BACKLINK
//-- global $FORUM_CRUMB, $forumInfo, $threadInfo, $thread;
//-- global $BREADCRUMB,$BACKLINK; // Eventually we should deprecate BACKLINK
global $FORUM_CRUMB, $forumInfo, $threadInfo, $thread, $BREADCRUMB;
if(!$forumInfo && $thread) { $forumInfo = $thread->threadInfo; }
@ -2229,12 +2231,20 @@ class e107forum
/*
$BACKLINK = $BREADCRUMB;
$templateVar->BREADCRUMB = $BREADCRUMB;
$templateVar->BACKLINK = $BACKLINK;
$templateVar->FORUM_CRUMB = $FORUM_CRUMB;
*/
// Backlink shortcode is defined inside shortcode file....
//---- var_dump ($templateVar);
//---- echo "<hr>";
$templateVar['breadcrumb'] = $BREADCRUMB;
$templateVar['forum_crumb'] = $FORUM_CRUMB;
}

View File

@ -82,23 +82,27 @@ $page = (varset($_GET['p']) ? $_GET['p'] : 1);
$threadFrom = ($page - 1) * $view;
global $forum_info, $FORUM_CRUMB;
$fVars = new e_vars;
$sc = e107::getScBatch('viewforum', 'forum');
//----$fVars = new e_vars;
/*--
$fVars->STARTERTITLE = LAN_FORUM_1004;
$fVars->THREADTITLE = LAN_FORUM_1003;
$fVars->REPLYTITLE = LAN_FORUM_0003;
$fVars->LASTPOSTITLE = LAN_FORUM_0004;
$fVars->VIEWTITLE = LAN_FORUM_1005;
--*/
$forumId = (int)$_REQUEST['id'];
if(!$forumId && e_QUERY) // BC Fix for old links.
{
list($id,$from) = explode(".",e_QUERY);
$forumId = intval($id);
$forumId = intval($id);
$threadFrom = intval($from);
unset($id,$from);
unset($id,$from);
}
if (!$forum->checkPerm($forumId, 'view'))
@ -123,7 +127,7 @@ if (!$forum->checkPerm($forumId, 'view'))
}
$forumInfo = $forum->forumGet($forumId);
$threadsViewed = $forum->threadGetUserViewed();
//----$threadsViewed = $forum->threadGetUserViewed();
if (empty($FORUM_VIEW_START))
{
@ -194,16 +198,18 @@ if(!empty($forumInfo['forum_description']))
//define('MODERATOR', $forum_info['forum_moderators'] != '' && check_class($forum_info['forum_moderators']));
//$modArray = $forum->forum_getmods($forum_info['forum_moderators']);
// $thread???
$modArray = $forum->forumGetMods($thread->forum_info['forum_moderators']);
define('MODERATOR', (USER && is_array($modArray) && in_array(USERID, array_keys($modArray))));
$message = '';
//----$message = '';
if (MODERATOR)
{
if ($_POST)
{
require_once(e_PLUGIN.'forum/forum_mod.php');
$message = forum_thread_moderate($_POST);
//-- $message = forum_thread_moderate($_POST);
$forumSCvars['message']=forum_thread_moderate($_POST);
}
}
@ -237,12 +243,14 @@ require_once(HEADERF);
$text='';
// TODO - message batch shortcode
/*--
if ($message)
{
//$ns->tablerender('', $message, array('forum_viewforum', 'msg'));
//e107::getMessage()->add($thread->message);
$fVars->MESSAGE = $message;
}
--*/
$threadCount = $forumInfo['forum_threads'];
@ -262,24 +270,32 @@ if ($pages)
if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== false || strpos($FORUM_VIEW_END, 'THREADPAGES') !== false)
{
$url = e107::url('forum','forum',$forumInfo, array('query'=>array('p'=>'[FROM]')));
/*--
$parms = "total={$pages}&type=page&current={$page}&url=".$url."&caption=off";
$fVars->THREADPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
--*/
$forumSCvars['parms'] = "total={$pages}&type=page&current={$page}&url=".$url."&caption=off";
//-- ?????????? unset $ulrparms????
unset($urlparms);
}
}
if($forum->checkPerm($forumId, 'thread')) //new thread access only.
{
$forumSCvars['ntUrl']= e107::url('forum','post')."?f=nt&amp;id=". $forumId;
/*--
$ntUrl = e107::url('forum','post')."?f=nt&amp;id=". $forumId;
$fVars->NEWTHREADBUTTON = "<a href='".$ntUrl."'>".IMAGE_newthread.'</a>';
$fVars->NEWTHREADBUTTONX = newthreadjump($ntUrl);
}
if(!BOOTSTRAP)
{
$fVars->NEWTHREADBUTTONX = $fVars->NEWTHREADBUTTON;
}
--*/
}
if(substr($forumInfo['forum_name'], 0, 1) == '*')
{
@ -296,18 +312,26 @@ if(substr($forum_info['sub_parent'], 0, 1) == '*')
$forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1);
}
$forum->set_crumb(true, '', $fVars); // set $BREADCRUMB (and $BACKLINK)
//----$forum->set_crumb(true, '', $fVars); // set $BREADCRUMB (and $BACKLINK)
//-- Function eventually to be reworked (move full function to shortcode file, or make a new breadcrumb function, like in downloads, maybe?)
$forum->set_crumb(true, '', $forumSCvars); // set $BREADCRUMB (and $BACKLINK)
$modUser = array();
foreach ( $modArray as $user)
{
$modUser[] = "<a href='".e107::getUrl()->create('user/profile/view', $user)."'>".$user['user_name']."</a>";
}
/*--
$fVars->FORUMTITLE = $forumInfo['forum_name'];
$fVars->MODERATORS = LAN_FORUM_1009.': '.implode(', ', $modUser);
$fVars->BROWSERS = '';
--*/
$forumSCvars['forum_name']= $forumInfo['forum_name'];
$forumSCvars['modUser']= $modUser;
$forumSCvars['track_online']= varset($pref['track_online']);
/*--
if(varset($pref['track_online']))
{
$fVars->BROWSERS = $users.' '.($users == 1 ? LAN_FORUM_0059 : LAN_FORUM_0060).' ('.$member_users.' '.($member_users == 1 ? LAN_FORUM_0061 : LAN_FORUM_0062).", ".$guest_users." ".($guest_users == 1 ? LAN_FORUM_0063 : LAN_FORUM_0064).')';
@ -346,10 +370,10 @@ else // v1.x
</table>";
}
--*/
// ----------------- { VIEWABLE_BY } ---------------------------
/*--
if($users = $forum->getForumClassMembers($forumId))
{
$userList = array();
@ -391,13 +415,12 @@ else
{
$fVars->VIEWABLE_BY = '';
}
--*/
// ------------------------------------------------------------
///TODO XXX All these $fVars items need to be put into a shortcode class so they can be parsed with parms and wrappers. Big Job!
/*--
$fVars->SEARCH = "
<form method='get' class='form-inline input-append' action='".e_BASE."search.php'>
<p>
@ -407,8 +430,9 @@ $fVars->SEARCH = "
<input type='hidden' name='ref' value='forum' />
</p>
</form>";
--*/
/*--
// ----- Perm Display ---
$permDisplay = array();
@ -427,12 +451,11 @@ $fVars->SEARCH = "
$fVars->PERMS = implode("<span class='forum-perms-separator'><!-- --></span>", $permDisplay);
--*/
// -------------------------------
$sticky_threads = 0;
$stuck = false;
$reg_threads = 0;
@ -446,9 +469,12 @@ if(!empty($_GET['srch']))
}
$threadList = $forum->forumGetThreads($forumId, $threadFrom, $view, $threadFilter);
/*--
$subList = $forum->forumGetSubs(vartrue($forum_id));
$gen = new convert;
--*/
//------$gen = new convert;
$forumSCvars['forum_parent']= $forumInfo['forum_parent'];
/*--
$fVars->SUBFORUMS = '';
if(is_array($subList) && isset($subList[$forumInfo['forum_parent']][$forumId]))
{
@ -460,7 +486,7 @@ if(is_array($subList) && isset($subList[$forumInfo['forum_parent']][$forumId]))
}
$fVars->SUBFORUMS = $FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END;
}
--*/
if (count($threadList) )
{
foreach($threadList as $thread_info)
@ -513,8 +539,8 @@ else
$forum_view_forum .= "<tr><td class='forumheader alert alert-warning alert-block' colspan='6'>".LAN_FORUM_1008."</td></tr>";
}
$fVars->FORUMJUMP = forumjump();
$fVars->TOPLINK = "<a href='".e_SELF.'?'.e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_GO.'</a>'; // FIXME - TOPLINK not used anymore?
//--$fVars->FORUMJUMP = forumjump();
//--$fVars->TOPLINK = "<a href='".e_SELF.'?'.e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_GO.'</a>'; // FIXME - TOPLINK not used anymore?
if($container_only)
{
@ -523,13 +549,21 @@ if($container_only)
$forum_view_forum = '';
}
$forum_view_start = $tp->simpleParse($FORUM_VIEW_START, $fVars);
$forum_view_end = $tp->simpleParse($FORUM_VIEW_END, $fVars);
$sc->setVars($forumSCvars);
//var_dump ($FORUM_VIEW_START);
// var_dump ($FORUM_VIEW_SUB);
$forum_view_start = $tp->parseTemplate($FORUM_VIEW_START, false, $sc);
$forum_view_end = $tp->parseTemplate($FORUM_VIEW_END, false, $sc);
//$forum_view_start .= "<hr><hr>FVARS FORUM<hr><hr>".$tp->simpleParse($FORUM_VIEW_START, $fVars);
//$forum_view_end = $tp->simpleParse($FORUM_VIEW_END, $fVars);
if ($forum->prefs->get('enclose'))
{
// $forum_view_subs????
$ns->tablerender($forum->prefs->get('title'), $forum_view_start.$forum_view_subs.$forum_view_forum.$forum_view_end, array('forum_viewforum', 'main1'));
}
else
@ -546,10 +580,10 @@ echo "<script type=\"text/javascript\">
require_once(FOOTERF);
function parse_thread($thread_info)
{
//var_dump ($thread_info);
/* OLD CODE
global $forum, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE, $gen, $menu_pref, $threadsViewed;
$tp = e107::getParser();
$tVars = new e_vars;
@ -728,7 +762,7 @@ function parse_thread($thread_info)
$tVars['PAGES'] = '';
}
*/
/* OLD CODE
$tVars['PAGES'] = fpages($thread_info, $tVars['REPLIES']);
$tVars['PAGESX'] = fpages($thread_info, $tVars['REPLIES']);
@ -809,9 +843,45 @@ function parse_thread($thread_info)
$tVars['_WRAPPER_'] = 'forum_viewforum';
return $tp->parseTemplate($_TEMPLATE, true, $tVars);
*/
// NEW REWRITTEN CODE
global $sc, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE;
$tp = e107::getParser();
// Initial ideia, to have a separate shortcode var ($threadsc)....
// $threadsc = e107::getScBatch('viewforum', 'forum', 'viewforumthread');
// $threadsc->setVars($thread_info);
$sc->setVars($thread_info);
switch($thread_info['thread_sticky'])
{
case 1:
$_TEMPLATE = ($FORUM_VIEW_FORUM_STICKY ? $FORUM_VIEW_FORUM_STICKY : $FORUM_VIEW_FORUM);
break;
case 2:
$_TEMPLATE = ($FORUM_VIEW_FORUM_ANNOUNCE ? $FORUM_VIEW_FORUM_ANNOUNCE : $FORUM_VIEW_FORUM);
break;
default:
$_TEMPLATE = $FORUM_VIEW_FORUM;
break;
}
if(substr($_TEMPLATE,0,4) == '<tr>') // Inject id into table row. //XXX Find a better way to do this without placing in template. .
{
$threadId = $thread_info['thread_id'];
$_TEMPLATE = "<tr id='thread-{$threadId}'>".substr($_TEMPLATE,4);
}
return $tp->parseTemplate($_TEMPLATE, true, $sc);
}
/*----
function parse_sub($subInfo)
{
global $FORUM_VIEW_SUB, $gen, $newflag_list;
@ -873,6 +943,7 @@ function parse_sub($subInfo)
return $tp->parseTemplate($FORUM_VIEW_SUB, true, $tVars);
}
----*/
function forumjump()
{
@ -887,10 +958,10 @@ function forumjump()
return $text;
}
function fadminoptions($thread_info)
{
$tVars = new e_vars;
//-- $tVars here???
//---- $tVars = new e_vars;
$e107 = e107::getInstance();
$tp = e107::getParser();
@ -904,6 +975,7 @@ function fadminoptions($thread_info)
//FIXME - not fully working.
$moveUrl = e107::url('forum','move', $thread_info);
// What's the use of $splitUrl?????
$splitUrl = e107::url('forum','split', $thread_info);
$lockUnlock = ($thread_info['thread_active'] ) ? 'lock' : 'unlock';
@ -1014,9 +1086,6 @@ function fpages($thread_info, $replies)
{
$text = implode("",$opts); // ."</div>";
}
}
else
@ -1024,24 +1093,14 @@ function fpages($thread_info, $replies)
$text = '';
}
return $text;
}
function newthreadjump($url)
{
global $forum;
$jumpList = $forum->forumGetAllowed('view');
$text = '<div class="btn-group">
<a href="'.$url.'" class="btn btn-primary">'.LAN_FORUM_1018.'</a>
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
@ -1060,7 +1119,5 @@ function newthreadjump($url)
</div>';
return $text;
}
?>

View File

@ -46,7 +46,7 @@ if (!e107::isInstalled('forum'))
exit;
}
//---- orphan $highlight_search??????
$highlight_search = isset($_POST['highlight_search']);
if (!e_QUERY)
@ -129,8 +129,10 @@ if(!empty($_GET['f']))
}
//---- getScBatch here??????
e107::getScBatch('view', 'forum')->setScVar('thread', $thread);
//---- orphan $pm_installed??????
$pm_installed = e107::isInstalled('pm');
//Only increment thread views if not being viewed by thread starter
@ -166,6 +168,7 @@ if(count($postList))
), 250, '...'));
}
//---- Orphan $gen????
$gen = new convert;
if($thread->message)
{
@ -241,14 +244,19 @@ else
//TODO Clean up this mess!!
// get info for main thread -------------------------------------------------------------------------------------------------------------------------------------------------------------------
$tVars = new e_vars;
$forum->set_crumb(true, '', $tVars); // Set $BREADCRUMB (and BACKLINK)
//---- Moved here to enclose $tVars.....
$sc = e107::getScBatch('view', 'forum');
//---- $tVars = new e_vars;
//---- $forum->set_crumb(true, '', $tVars); // Set $BREADCRUMB (and BACKLINK)
$forum->set_crumb(true, '', $thread->threadInfo); // Set $BREADCRUMB (and BACKLINK)
//$tVars->BREADCRUMB = $crumbs['breadcrumb'];
//$tVars->BACKLINK = $tVars->BREADCRUMB;
//$tVars->FORUM_CRUMB = $crumbs['forum_crumb'];
$tVars->THREADNAME = $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off');
//---- $tVars->THREADNAME = $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off');
/*----
$prev = $forum->threadGetNextPrev('prev', $thread->threadId,$thread->threadInfo['forum_id'], $thread->threadInfo['thread_lastpost']);
$next = $forum->threadGetNextPrev('next', $thread->threadId,$thread->threadInfo['forum_id'], $thread->threadInfo['thread_lastpost']);
@ -264,6 +272,7 @@ $tVars->THREADNAME = $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_h
}
$tVars->NEXTPREV = implode(" | ", $options);
----*/
/*
$tVars->NEXTPREV = "<a class='btn btn-default btn-sm btn-small' href='" . $e107->url->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>&laquo; " . LAN_FORUM_2001 . "</a>";
@ -271,6 +280,7 @@ $tVars->NEXTPREV .= ' | '; // enabled to make it look better on v1 templates
$tVars->NEXTPREV .= "<a class='btn btn-default btn-sm btn-small' href='" . $e107->url->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>" . LAN_FORUM_2002 . " &raquo;</a>";
*/
/*----
if ($forum->prefs->get('track') && USER)
{
// BC Fix for old template.
@ -314,13 +324,16 @@ if ($forum->prefs->get('track') && USER)
";*/
/*----
$trackDiz = ($forum->prefs->get('trackemail',true)) ? LAN_FORUM_3040 : LAN_FORUM_3041;
$tVars->TRACK = "<a id='forum-track-button' href='#' title=\"".$trackDiz."\" data-token='".deftrue('e_TOKEN','')."' data-forum-insert='forum-track-button' data-forum-post='".$thread->threadInfo['thread_forum_id']."' data-forum-thread='".$thread->threadInfo['thread_id']."' data-forum-action='track' name='track' class='e-tip btn btn-default' >".$img."</a>
";
}
----*/
/*----
$modUser = array();
foreach ( $forum->modArray as $user)
{
@ -329,9 +342,11 @@ foreach ( $forum->modArray as $user)
$tVars->MODERATORS = LAN_FORUM_2003.": ". implode(', ', $modUser);
unset($modUser);
----*/
$tVars->THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_FORUM_2004 : '');
//---- $tVars->THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_FORUM_2004 : '');
/*----
if ($thread->pages > 1)
{
if(!$thread->page) $thread->page = 1;
@ -347,9 +362,11 @@ if ($thread->pages > 1)
$tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
/*
$parms = ($thread->pages).",1,{$thread->page},url::forum::thread::func=view&id={$thread->threadId}&page=[FROM],off";
$tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");*/
$tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
}
----*/
/*----
$tVars->BUTTONS = '';
if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active'])
{
@ -364,8 +381,8 @@ if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'thread'))
// $ntUrl = $e107->url->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id']));
$tVars->BUTTONS .= "<a href='" . $ntUrl . "'>" . IMAGE_newthread . "</a>";
}
----*/
/*----
$tVars->BUTTONSX = forumbuttons($thread);
function forumbuttons($thread)
@ -432,17 +449,20 @@ function forumbuttons($thread)
return $text;
}
----*/
//---- $tVars->POLL = vartrue($pollstr);
$tVars->POLL = vartrue($pollstr);
//---- $tVars->FORUMJUMP = forumjump();
$tVars->FORUMJUMP = forumjump();
//---- $tVars->MESSAGE = $thread->message;
$tVars->MESSAGE = $thread->message;
$sc->setVars($thread->threadInfo);
//$forum->set_crumb(true, '', $sc); // Set $BREADCRUMB (and BACKLINK)
$forstr = $tp->simpleParse($FORUMSTART, $tVars);
//---- $forstr = $tp->simpleParse($FORUMSTART, $tVars);
$forstr = $tp->parseTemplate($FORUMSTART, true, $sc);
unset($forrep);
if (!$FORUMREPLYSTYLE) $FORUMREPLYSTYLE = $FORUMTHREADSTYLE;
@ -450,7 +470,8 @@ $alt = false;
$i = $thread->page;
$sc = e107::getScBatch('view', 'forum');
//---- Moved upwards, to enclose $tVars...
//---- $sc = e107::getScBatch('view', 'forum');
@ -462,6 +483,7 @@ foreach ($postList as $c => $postInfo)
}
$loop_uid = (int)$postInfo['post_user'];
//---- Orphan $tnum????
$tnum = $i;
$i++;
@ -564,6 +586,7 @@ $forend = $tp->simpleParse($FORUMEND, $tVars);
$forumstring = $forstr . $forthr . vartrue($forrep) . $forend;
//If last post came after USERLV and not yet marked as read, mark the thread id as read
//---- Orphan $currentUser???
$threadsViewed = explode(',', $currentUser['user_plugin_forum_viewed']);
if ($thread->threadInfo['thread_lastpost'] > USERLV && !in_array($thread->threadId, $threadsViewed))
@ -610,6 +633,7 @@ function showmodoptions()
global $thread, $postInfo;
$e107 = e107::getInstance();
//---- Orphan $forum_id????
$forum_id = $thread->threadInfo['forum_id'];
if ($postInfo['thread_start'])
{
@ -650,6 +674,7 @@ function showmodoptions()
return $ret;
}
/*----
function forumjump()
{
global $forum;
@ -662,7 +687,7 @@ function forumjump()
$text .= "</select> <input class='btn btn-default button' type='submit' name='fjsubmit' value='" . LAN_GO . "' /></p></form>";
return $text;
}
----*/
function rpg($user_join, $user_forums)
{
global $FORUMTHREADSTYLE;

View File

@ -10,11 +10,12 @@ if (!defined('e107_INIT')) { exit; }
class forum_shortcodes extends e_shortcode
{
private $forum_rules;
private $forum_rules, $gen;
function __construct()
{
$this->forum_rules = forum_rules('check');
$this->gen = new convert;
}
// START OF $FVARS
@ -220,10 +221,10 @@ class forum_shortcodes extends e_shortcode
}
*/
$gen = new convert;
// $gen = new convert;
$text = LAN_FORUM_0018." ".USERNAME."<br />";
$lastvisit_datestamp = $gen->convert_date(USERLV, 'long');
$datestamp = $gen->convert_date(time(), "long");
$lastvisit_datestamp = $this->gen->convert_date(USERLV, 'long'); //FIXME Use e107::getParser()->toDate();
$datestamp = $this->gen->convert_date(time(), "long");
/*
if (!$total_new_threads)
@ -287,6 +288,8 @@ class forum_shortcodes extends e_shortcode
return $text;
}
function sc_foruminfo()
{
$sql = e107::getDb();
@ -321,17 +324,20 @@ class forum_shortcodes extends e_shortcode
return vartrue($status);
}
function sc_parentname()
{
return $this->var['forum_name'];
}
// Function to show the retrieval of parent ID, not really needed by core template
function sc_parentid()
{
return $this->var['forum_id'];
}
// START OF parse_forum function $FVARS
function sc_newflag()
@ -353,6 +359,7 @@ class forum_shortcodes extends e_shortcode
}
function sc_forumname()
{
// global $f;
@ -368,46 +375,54 @@ class forum_shortcodes extends e_shortcode
}
function sc_forumdescription()
{
// global $f, $restricted_string;
// global $f, $restricted_string;
global $restricted_string;
// $tp = e107::getParser();
// $tp = e107::getParser();
$this->var['forum_description'] = e107::getParser()->toHTML($this->var['forum_description'], true, 'no_hook');
return $this->var['forum_description'].($restricted_string ? "<br /><span class='smalltext'><i>$restricted_string</i></span>" : "");
}
function sc_threads()
{
return $this->var['forum_threads'];
}
function sc_replies()
{
return $this->var['forum_replies'];
}
function sc_threadsx()
{
// global $f;
// return "<span class='badge ".(($f['forum_threads']) ? "badge-info" : "")."'>".$f['forum_threads']."</span>";
// global $f;
// return "<span class='badge ".(($f['forum_threads']) ? "badge-info" : "")."'>".$f['forum_threads']."</span>";
return "<span class='badge ".(($this->var['forum_threads']) ? "badge-info" : "")."'>".$this->var['forum_threads']."</span>";
}
function sc_repliesx()
{
// global $f;
// return "<span class='badge ".(($f['forum_replies']) ? "badge-info" : "")."'>".$f['forum_replies']."</span>";
// global $f;
// return "<span class='badge ".(($f['forum_replies']) ? "badge-info" : "")."'>".$f['forum_replies']."</span>";
return "<span class='badge ".(($this->var['forum_replies']) ? "badge-info" : "")."'>".$this->var['forum_replies']."</span>";
}
function sc_forumsubforums()
{
// VAR_DUMP ($this->ret);
// return ($this->ret)?"<br /><div class='smalltext'>".LAN_FORUM_0069.": {$this->ret['text']}</div>":"";
return ($this->var['text'])?"<br /><div class='smalltext'>".LAN_FORUM_0069.": {$this->var['text']}</div>":"";
return (!empty($this->var['text'])) ? "<br /><div class='smalltext'>".LAN_FORUM_0069.": {$this->var['text']}</div>":"";
}
//----- ########################################################
//----- Functions sc_latspostuser, sc_lastpostdate & sc_lastpost to be rewritten, since they pratically use the same code???
//----- Also, viewforum_shortcodes uses similar shortcodes definitions......
/*-----
function sc_lastpostuser()
{
// global $f;
@ -541,42 +556,140 @@ $gen = new convert;
return '-';
//---- }
}
-----*/
function lastpostdata($mode='')
{
if (empty($this->var['forum_lastpost_info']))
{
return false;
}
global $forum;
list($lastpost_datestamp, $lastpost_thread) = explode('.', $this->var['forum_lastpost_info']);
// e107::getDebug()->log($this->var);
$lastpost = $forum->threadGetLastpost($lastpost_thread); //FIXME TODO inefficient to have SQL query here.
$urlData = array('forum_sef'=>$this->var['forum_sef'], 'thread_id'=>$lastpost['post_thread'],'thread_sef'=>$lastpost['thread_sef']);
$url = e107::url('forum', 'topic', $urlData)."?last=1#post-".$lastpost['post_id'];
if (!empty($this->var['user_name']))
{
$lastpost_name = "<a href='".e107::url('user/profile/view', array('name' => $this->var['user_name'], 'id' => $this->var['forum_lastpost_user']))."'>{$this->var['user_name']}</a>";
}
else
{
$lastpost_name = e107::getParser()->toHTML($this->var['forum_lastpost_user_anon']);
}
$relativeDate = e107::getParser()->toDate($lastpost_datestamp,'relative');
switch($mode)
{
// $fVars->LASTPOSTUSER = $lastpost_name;
case "user":
return $lastpost_name;
break;
// $fVars->LASTPOSTDATE .= "<a href='".$url."'>". $gen->computeLapse($lastpost_datestamp, time(), false, false, 'short')."</a>";
case "date":
return "<a href='".$url."'>". $relativeDate."</a>";
break;
// $fVars->LASTPOST = $lastpost_datestamp.'<br />'.$lastpost_name." <a href='".$e107->url->create('forum/thread/last', array('name' => $lastpost_name, 'id' => $lastpost_thread))."'>".IMAGE_post2.'</a>';
case 'post':
return $relativeDate.'<br />'.$lastpost_name." <a href='".$url."'>".IMAGE_post2.'</a>';
// code to be executed if n is different from all labels;
}
return false;
// return $lastpost_datestamp;
/*--
--*/
// $fVars->LASTPOST = $lastpost_datestamp.'<br />'.$lastpost_name." <a href='".$e107->url->create('forum/thread/last', array('name' => $lastpost_name, 'id' => $lastpost_thread))."'>".IMAGE_post2.'</a>';
/*----
$fVars->LASTPOSTUSER = $lastpost_name;
$fVars->LASTPOSTDATE .= "<a href='".$url."'>". $gen->computeLapse($lastpost_datestamp, time(), false, false, 'short')."</a>";
$fVars->LASTPOST = $lastpost_datestamp.'<br />'.$lastpost_name." <a href='".$e107->url->create('forum/thread/last', array('name' => $lastpost_name, 'id' => $lastpost_thread))."'>".IMAGE_post2.'</a>';
-----*/
/*----
else
{
$fVars->LASTPOSTUSER = "";
$fVars->LASTPOSTDATE = "-";
$fVars->LASTPOST = '-';
}
----*/
}
function sc_lastpostuser()
{
return $this->lastpostdata('user');
}
function sc_lastpostdate()
{
return $this->lastpostdata('date');
}
function sc_lastpost()
{
return $this->lastpostdata('post');
}
function sc_startertitle()
{
// global $thread;
$gen = new convert;
$author_name = ($this->var['user_name'] ? $this->var['user_name'] : $this->var['lastuser_anon']);
//-- $datestamp = $gen->convert_date($thread['thread_lastpost'], 'forum');
$datestamp = $gen->convert_date($this->var['thread_lastpost'], 'forum');
$datestamp = $this->gen->convert_date($this->var['thread_lastpost'], 'forum');
if(!$this->var['user_name'])
{
return $author_name.'<br />'.$datestamp;
}
//---- else
//---- {
// $e107 = e107::getInstance();
// return "<a href='".$e107->url->create('user/profile/view', array('id' => $thread['thread_lastuser'], 'name' => $sc->author_name))."'>{$sc->author_name}</a><br />".$sc->datestamp;
return "<a href='".e107::getUrl()->create('user/profile/view', array('id' => $this->var['thread_lastuser'], 'name' => $author_name))."'>{$author_name}</a><br />".$datestamp;
//---- }
}
function sc_newspostname()
{
// global $thread;
// $e107 = e107::getInstance();
// $tp = e107::getParser();
// global $thread;
// $e107 = e107::getInstance();
// $tp = e107::getParser();
// return empty($thread)?LAN_FORUM_0029:"<a href='".$e107->url->create('forum/thread/last', $thread)."'>".$tp->toHTML($thread['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>';
// Only $this->var???'
return empty($this->var)?LAN_FORUM_0029:"<a href='".e107::getUrl()->create('forum/thread/last', $this->var)."'>".e107::getParser()->toHTML($this->var['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>';
// return empty($thread)?LAN_FORUM_0029:"<a href='".$e107->url->create('forum/thread/last', $thread)."'>".$tp->toHTML($thread['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>';
// Only $this->var???'
return empty($this->var) ? LAN_FORUM_0029:"<a href='".e107::getUrl()->create('forum/thread/last', $this->var)."'>".e107::getParser()->toHTML($this->var['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>';
}
// END OF $NVARS
function sc_forum_breadcrumb()

View File

@ -425,11 +425,13 @@ class plugin_forum_post_shortcodes extends e_shortcode
$forumInfo = $this->var;
// return print_a($forumInfo,true);
$_tmp = new e_vars();
//---- $_tmp = new e_vars();
$_tmp = array();
// no reference of 'head' $threadInfo['head']['thread_name']
$eaction = ($this->var['action'] == 'edit');
$this->forum->set_crumb(true, ($this->var['action'] == 'nt' ? ($eaction ? LAN_FORUM_3023 : LAN_FORUM_1018) : ($eaction ? LAN_FORUM_3024 : $this->var['thread_name'])), $_tmp);
return $_tmp->BREADCRUMB;
//---- return $_tmp->BREADCRUMB;
return $_tmp['breadcrumb'];
}
function sc_noemotes()

View File

@ -24,6 +24,16 @@ class plugin_forum_view_shortcodes extends e_shortcode
$this->defaultImgAttachSize = e107::pref('forum','maxwidth',false); // don't resize here if set to 0.
}
function sc_breadcrumb()
{
return $this->var['breadcrumb'];
}
function sc_backlink()
{
return $this->var['breadcrumb'];
}
function sc_top($parm='')
{
$text = ($parm == 'caret') ? "<span class='caret'></span>" : LAN_FORUM_2030;
@ -632,7 +642,248 @@ class plugin_forum_view_shortcodes extends e_shortcode
}
//---- SHORTCODES CONVERTED FROM $tVars....
function sc_threadname()
{
return e107::getParser()->toHTML($this->var['thread_name'], true, 'no_hook, emotes_off');
}
function sc_nextprev()
{
global $forum, $thread;
$prev = $forum->threadGetNextPrev('prev', $thread->threadId,$this->var['forum_id'], $this->var['thread_lastpost']);
$next = $forum->threadGetNextPrev('next', $thread->threadId,$this->var['forum_id'], $this->var['thread_lastpost']);
$options = array();
if($prev !== false)
{
$options[] = "<a class='btn btn-default btn-sm btn-small' href='" . e107::url('forum','topic', $prev) . "'>&laquo; " . LAN_FORUM_2001 . "</a>";
}
if($next !== false)
{
$options[] = "<a class='btn btn-default btn-sm btn-small' href='" . e107::url('forum','topic', $next) . "'>" . LAN_FORUM_2002 . " &raquo;</a>";
}
//---- $tVars->NEXTPREV = implode(" | ", $options);
return implode(" | ", $options);
}
function sc_track()
{
global $forum;
if ($forum->prefs->get('track') && USER)
{
// BC Fix for old template.
if(!defined('IMAGE_track'))
{
define('IMAGE_track', '<img src="'.img_path('track.png').'" alt="'.LAN_FORUM_4009.'" title="'.LAN_FORUM_4009.'" class="icon S16 action" />');
}
if(!defined('IMAGE_untrack'))
{
define('IMAGE_untrack', '<img src="'.img_path('untrack.png').'" alt="'.LAN_FORUM_4010.'" title="'.LAN_FORUM_4010.'" class="icon S16 action" />');
}
$img = ($this->var['track_userid'] ? IMAGE_track : IMAGE_untrack);
/*
$url = $e107->url->create('forum/thread/view', array('id' => $thread->threadId), 'encode=0'); // encoding could break AJAX call
$url = e107::url('forum','index');
$tVars->TRACK .= "
<span id='forum-track-trigger-container'>
<a class='btn btn-default btn-sm btn-small e-ajax' data-target='forum-track-trigger' href='{$url}' id='forum-track-trigger'>{$img}</a>
</span>
<script type='text/javascript'>
e107.runOnLoad(function(){
$('forum-track-trigger').observe('click', function(e) {
e.stop();
new e107Ajax.Updater('forum-track-trigger-container', '{$url}', {
method: 'post',
parameters: { //send query parameters here
'track_toggle': 1
},
overlayPage: $(document.body)
});
});
}, document, true);
</script>
";*/
$trackDiz = ($forum->prefs->get('trackemail',true)) ? LAN_FORUM_3040 : LAN_FORUM_3041;
// $tVars->TRACK = "<a id='forum-track-button' href='#' title=\"".$trackDiz."\" data-token='".deftrue('e_TOKEN','')."' data-forum-insert='forum-track-button' data-forum-post='".$thread->threadInfo['thread_forum_id']."' data-forum-thread='".$thread->threadInfo['thread_id']."' data-forum-action='track' name='track' class='e-tip btn btn-default' >".$img."</a>";
return "<a id='forum-track-button' href='#' title=\"".$trackDiz."\" data-token='".deftrue('e_TOKEN','')."' data-forum-insert='forum-track-button' data-forum-post='".$this->var['thread_forum_id']."' data-forum-thread='".$this->var['thread_id']."' data-forum-action='track' name='track' class='e-tip btn btn-default' >".$img."</a>";
}
return '';
}
function sc_moderators()
{
global $forum;
$modUser = array();
foreach ( $forum->modArray as $user)
{
$modUser[] = "<a href='".e107::getUrl()->create('user/profile/view', $user)."'>".$user['user_name']."</a>";
}
//$tVars->MODERATORS = LAN_FORUM_2003.": ". implode(', ', $modUser);
return LAN_FORUM_2003.": ". implode(', ', $modUser);
//unset($modUser);
}
function sc_threadstatus()
{
//$tVars->THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_FORUM_2004 : '');
return (!$this->var['thread_active'] ? LAN_FORUM_2004 : '');
}
function sc_gotopages()
{
global $thread;
if ($thread->pages > 1)
{
if(!$thread->page) $thread->page = 1;
// $url = rawurlencode(e107::getUrl()->create('forum/thread/view', array('name' => $thread->threadInfo['thread_name'], 'id' => $thread->threadId, 'page' => '[FROM]')));
// $url = e_REQUEST_SELF."?p=[FROM]"; // SEF URL Friendly.
$url = e107::url('forum','topic', $this->var)."&amp;p=[FROM]";
$parms = "total={$thread->pages}&type=page&current={$thread->page}&url=".urlencode($url)."&caption=off&tmpl=default&navcount=4&glyphs=1";
//XXX FIXME - pull-down template not practical here. Can we force another?
// $tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
return e107::getParser()->parseTemplate("{NEXTPREV={$parms}}");
/*
$parms = ($thread->pages).",1,{$thread->page},url::forum::thread::func=view&id={$thread->threadId}&page=[FROM],off";
$tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");*/
}
}
function sc_buttons()
{
global $forum, $thread;
//----$tVars->BUTTONS = '';
if ($forum->checkPerm($this->var['thread_forum_id'], 'post') && $this->var['thread_active'])
{
// print_a($thread->threadInfo);
$url = e107::url('forum','post')."?f=rp&amp;id=".$this->var['thread_id']."&amp;post=".$thread->threadId;
// $url = $e107->url->create('forum/thread/reply', array('id' => $thread->threadId));
return "<a href='" . $url . "'>" . IMAGE_reply . "</a>";
}
if ($forum->checkPerm($this->var['thread_forum_id'], 'thread'))
{
$ntUrl = e107::url('forum','post')."?f=nt&amp;id=". $this->var['thread_forum_id'];
// $ntUrl = $e107->url->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id']));
return "<a href='" . $ntUrl . "'>" . IMAGE_newthread . "</a>";
}
return '';
}
//$tVars->BUTTONSX = forumbuttons($thread);
function sc_buttonsx()
{
global $forum, $thread;
if ($forum->checkPerm($this->var['thread_forum_id'], 'post') && $this->var['thread_active'])
{
$url = e107::url('forum','post')."?f=rp&amp;id=".$this->var['thread_id']."&amp;post=".$thread->threadId;
// $url = e107::getUrl()->create('forum/thread/reply', array('id' => $thread->threadId));
$replyUrl = "<a class='btn btn-primary' href='".$url."'>".LAN_FORUM_2006."</a>";
}
if ($forum->checkPerm($this->var['thread_forum_id'], 'thread'))
{
$ntUrl = e107::url('forum','post')."?f=nt&amp;id=". $this->var['thread_forum_id'];
// $ntUrl = e107::getUrl()->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id']));
$options[] = " <a href='".$ntUrl."'>".LAN_FORUM_2005."</a>";
}
// $options[] = "<a href='" . e107::getUrl()->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>".LAN_FORUM_1017." ".LAN_FORUM_2001."</a>";
// $options[] = "<a href='" . e107::getUrl()->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>".LAN_FORUM_1017." ".LAN_FORUM_2002."</a>";
//---- SIMILAR CODE AS SC_NEXTPREV!!!!!!!
$prev = $forum->threadGetNextPrev('prev', $thread->threadId,$this->var['forum_id'], $this->var['thread_lastpost']);
$next = $forum->threadGetNextPrev('next', $thread->threadId,$this->var['forum_id'], $this->var['thread_lastpost']);
if($prev !== false)
{
$options[] = "<a href='" . e107::url('forum','topic', $prev) . "'>".LAN_FORUM_1017." ".LAN_FORUM_2001."</a>";
}
if($next !== false)
{
$options[] = "<a href='" . e107::url('forum','topic', $next) . "'>".LAN_FORUM_1017." ".LAN_FORUM_2002."</a>";
}
$text = '<div class="btn-group">
'.$replyUrl.'
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
';
foreach($options as $key => $val)
{
$text .= '<li>'.$val.'</li>';
}
$jumpList = $forum->forumGetAllowed();
$text .= "<li class='divider'></li>";
foreach($jumpList as $key=>$val)
{
$text .= '<li><a href ="'.e107::url('forum','forum',$val).'">'.LAN_FORUM_1017." ".$val['forum_name'].'</a></li>';
}
$text .= '
</ul>
</div>';
return $text;
}
/*---- Function redeclared, this one came directly from forum_viewtopic.php.....
function sc_poll()
{
global $pollstr;
return vartrue($pollstr);
}
----*/
function sc_forumjump()
{
global $forum;
$jumpList = $forum->forumGetAllowed();
$text = "<form method='post' action='".e_SELF."'><p>".LAN_FORUM_1017.": <select name='forumjump' class='tbox'>";
//-- foreach ($jumpList as $key => $val)
foreach ($jumpList as $val)
{
$text .= "\n<option value='" . e107::url('forum','forum',$val) . "'>" . $val['forum_name'] . "</option>";
}
$text .= "</select> <input class='btn btn-default button' type='submit' name='fjsubmit' value='" . LAN_GO . "' /></p></form>";
return $text;
}
function sc_message()
{
global $thread;
return $thread->message;
}
}
?>

View File

@ -0,0 +1,892 @@
<?php
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
*
* Forum plugin - view shortcodess
*
*/
if (!defined('e107_INIT')) { exit; }
class plugin_forum_viewforum_shortcodes extends e_shortcode
{
private $gen;
function __construct()
{
$this->gen = new convert;
// $this->forum_rules = forum_rules('check');
}
// LEGACY shortcodes, to be deprecated & directly handled in template file???
function sc_startertitle() {return LAN_FORUM_1004;}
function sc_threadtitle() {return LAN_FORUM_1003;}
function sc_replytitle() {return LAN_FORUM_0003;}
function sc_lastpostitle() {return LAN_FORUM_0004;}
function sc_viewtitle() {return LAN_FORUM_1005;}
// End of LEGACY shortcodes...
function sc_message() {return $this->var['message'];}
function sc_threadpages() {return e107::getParser()->parseTemplate("{NEXTPREV={$this->var['parms']}}");}
function sc_newthreadbutton()
{
return "<a href='".$this->var['ntUrl']."'>".IMAGE_newthread.'</a>';
}
function sc_newthreadbuttonx()
{
if(!BOOTSTRAP)
{
return sc_newthreadbutton;
}
//--function newthreadjump($url)
//--{
global $forum;
$jumpList = $forum->forumGetAllowed('view');
$text = '<div class="btn-group">
<a href="'.$this->var['ntUrl'].'" class="btn btn-primary">'.LAN_FORUM_1018.'</a>
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
';
//-- foreach($jumpList as $key => $val)
foreach($jumpList as $val)
{
$text .= '<li><a href="'.e107::url('forum','forum',$val).'">'.LAN_FORUM_1017.': '.$val['forum_name'].'</a></li>';
}
$text .= '
</ul>
</div>';
return $text;
//}
}
function sc_breadcrumb()
{
// var_dump ($this->var);
return $this->var['breadcrumb'];
}
function sc_backlink()
{
return $this->var['breadcrumb'];
}
function sc_forum_crumb()
{
return $this->var['forum_crumb'];
}
function sc_forumtitle()
{
return $this->var['forum_name'];
}
function sc_moderators()
{
return $this->var['modUser'];
}
function sc_browsers()
{
if($this->var['track_online'])
{
return $users.' '.($users == 1 ? LAN_FORUM_0059 : LAN_FORUM_0060).' ('.$member_users.' '.($member_users == 1 ? LAN_FORUM_0061 : LAN_FORUM_0062).", ".$guest_users." ".($guest_users == 1 ? LAN_FORUM_0063 : LAN_FORUM_0064).')';
}
}
function sc_iconkey()
{
global $FORUM_VIEWFORUM_TEMPLATE;
/*--
if(defset('BOOTSTRAP')==3 && !empty($FORUM_VIEWFORUM_TEMPLATE['iconkey'])) // v2.x
{
return e107::getParser()->parseTemplate($FORUM_VIEWFORUM_TEMPLATE['iconkey'],true);
}
// v1.x
return "
<table class='table table-bordered' style='width:100%'>
<tr>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_new_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_0039."</td>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_nonew_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_0040."</td>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_sticky_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_1011."</td>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_announce_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_1013."</td>
</tr>
<tr>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_new_popular_small."</td>
<td style='width:2%' class='smallblacktext'>".LAN_FORUM_0039." ".LAN_FORUM_1010."</td>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_nonew_popular_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_0040." ".LAN_FORUM_1010."</td>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_stickyclosed_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_1012."</td>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_closed_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_1014."</td>
</tr>
</table>";
--*/
return (defset('BOOTSTRAP')==3 && !empty($FORUM_VIEWFORUM_TEMPLATE['iconkey']))?e107::getParser()->parseTemplate($FORUM_VIEWFORUM_TEMPLATE['iconkey'],true):"
<table class='table table-bordered' style='width:100%'>
<tr>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_new_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_0039."</td>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_nonew_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_0040."</td>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_sticky_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_1011."</td>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_announce_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_1013."</td>
</tr>
<tr>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_new_popular_small."</td>
<td style='width:2%' class='smallblacktext'>".LAN_FORUM_0039." ".LAN_FORUM_1010."</td>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_nonew_popular_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_0040." ".LAN_FORUM_1010."</td>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_stickyclosed_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_1012."</td>
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_closed_small."</td>
<td style='width:10%' class='smallblacktext'>".LAN_FORUM_1014."</td>
</tr>
</table>";
}
function sc_viewable_by()
{
global $forum, $forumId;
if($users = $forum->getForumClassMembers($forumId))
{
$userList = array();
$viewable = e107::getUserClass()->getFixedClassDescription($users);
if(is_array($users))
{
foreach($users as $user)
{
$userList[] = "<a href='".e107::getUrl()->create('user/profile/view', $user)."'>".$user['user_name']."</a>";
}
$viewable = implode(', ', $userList);;
}
elseif($users == 0)
{
$viewable = '' ;
}
/*--
else
{
$viewable = e107::getUserClass()->getFixedClassDescription($users);
}
--*/
}
/*--
if(!empty($viewable))
{
return "
<div class='panel panel-default' style='margin-top:10px'>
<div class='panel-heading'>Viewable by</div>
<div class='panel-body'>
".$viewable."
</div>
</div>
</div>
";
}
//else
//{
return '';
//}
--*/
//else
//{
//-- Possible candidate for wrapper????
return empty($viewable)?'':"<div class='panel panel-default' style='margin-top:10px'><div class='panel-heading'>Viewable by</div><div class='panel-body'>".$viewable."</div></div></div>";
}
function sc_search()
{
return "
<form method='get' class='form-inline input-append' action='".e_BASE."search.php'>
<p>
<input class='tbox' type='text' name='q' size='20' value='' maxlength='50' />
<button class='btn btn-default button' type='submit' name='s' >".LAN_SEARCH."</button>
<input type='hidden' name='r' value='0' />
<input type='hidden' name='ref' value='forum' />
</p>
</form>";
}
function sc_perms()
{
global $forum, $forumId;
// ----- Perm Display ---
$permDisplay = array();
$permDisplay['topics'] = ($forum->checkPerm($forumId, 'thread')) ? LAN_FORUM_0043 : LAN_FORUM_0044;
$permDisplay['post'] =LAN_FORUM_0046;
$permDisplay['edit'] = LAN_FORUM_0048;
if($forum->checkPerm($forumId, 'post'))
{
$permDisplay['post'] =LAN_FORUM_0045;
$permDisplay['edit'] = LAN_FORUM_0047;
}
/*--
else
{
$permDisplay['post'] =LAN_FORUM_0046;
$permDisplay['edit'] = LAN_FORUM_0048;
}
--*/
return implode("<span class='forum-perms-separator'><!-- --></span>", $permDisplay);
}
function sc_forumjump()
{
global $forum;
$jumpList = $forum->forumGetAllowed('view');
$text = "<form method='post' action='".e_SELF."'><p>".LAN_FORUM_1017.": <select name='forumjump' class='tbox'>";
//-- foreach($jumpList as $key => $val)
foreach($jumpList as $val)
{
$text .= "\n<option value='".e107::url('forum','forum',$val, 'full')."'>".$val['forum_name']."</option>";
}
$text .= "</select> <input class='btn btn-default button' type='submit' name='fjsubmit' value='".LAN_GO."' /></form>";
return $text;
}
// FIXME - TOPLINK not used anymore?
function sc_toplink()
{
return "<a href='".e_SELF.'?'.e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_GO.'</a>';
}
function sc_subforums()
{
// echo "subforums";
// Initial ideia, to have a separate shortcode var ($subsc)....
//global $forum, $forumId, $threadFrom, $view;
global $sc, $forum, $forumId;
// var_dump ($forumId);
// var_dump (vartrue($forumId));
//var_dump ($forum->forumGetSubs(vartrue($forum_id)));
// var_dump ($FORUM_VIEW_SUB);
// $tp = e107::getParser();
// Initial ideia, to have a separate shortcode var ($subsc)....
// $subsc = e107::getScBatch('viewforum', 'forum', 'viewsubforum');
//var_dump ($subsc);
//-- $forum_id ??????
//--$subList = $forum->forumGetSubs(vartrue($forum_id));
//--$subList = $forum->forumGetSubs(vartrue($forumId));
$subList = $forum->forumGetSubs(false);
// var_dump ($forum);
if(is_array($subList) && isset($subList[$this->var['forum_parent']][$forumId]))
{
//-- $newflag_list ??????
//-- $newflag_list = $forum->forumGetUnreadForums();
$sub_info = '';
global $FORUM_VIEW_SUB, $FORUM_VIEW_SUB_START, $FORUM_VIEW_SUB_END;
foreach($subList[$this->var['forum_parent']][$forumId] as $subInfo)
{
//---- global $FORUM_VIEW_SUB, $gen, $newflag_list;
// var_dump ($FORUM_VIEW_SUB);
//-- $tp = e107::getParser();
// $tVars = new e_vars;
//---- $forumName = $tp->toHTML($subInfo['forum_name'], true);
//---- $tVars['SUB_FORUMTITLE'] = "<a href='".e107::getUrl()->create('forum/forum/view', $subInfo)."'>{$forumName}</a>";
//---- $tVars['SUB_DESCRIPTION'] = $tp->toHTML($subInfo['forum_description'], false, 'no_hook');
//---- $tVars['SUB_THREADS'] = $subInfo['forum_threads'];
//---- $tVars['SUB_REPLIES'] = $subInfo['forum_replies'];
//---- $badgeReplies = ($subInfo['forum_replies']) ? "badge-info" : "";
//---- $badgeThreads = ($subInfo['forum_replies']) ? "badge-info" : "";
//---- $tVars['SUB_THREADSX'] = "<span class='badge {$badgeThreads}'>".$subInfo['forum_threads']."</span>";
//---- $tVars['SUB_REPLIESX'] = "<span class='badge {$badgeReplies}'>".$subInfo['forum_replies']."</span>";
// $tVars['REPLIESX'] = "<span class='badge badge-info'>".$thread_info['thread_total_replies']."</span>";
// $tVars['VIEWSX'] = "<span class='badge {$badge}'>".$thread_info['thread_views']."</span>";
/*----
if(USER && is_array($newflag_list) && in_array($subInfo['forum_id'], $newflag_list))
{
$tVars['NEWFLAG'] = "<a href='".e107::getUrl()->create('forum/forum/mfar', 'id='.$subInfo['forum_id'])."'>".IMAGE_new.'</a>';
}
else
{
$tVars['NEWFLAG'] = IMAGE_nonew;
}
----*/
/*----
if($subInfo['forum_lastpost_info'])
{
$tmp = explode('.', $subInfo['forum_lastpost_info']);
$lp_thread = "<a href='".e107::getUrl()->create('forum/thread/last', array('id' => $tmp[1]))."'>".IMAGE_post2.'</a>';
$lp_date = $gen->convert_date($tmp[0], 'forum');
if($subInfo['user_name'])
{
$lp_name = "<a href='".e107::getUrl()->create('user/profile/view', array('id' => $subInfo['forum_lastpost_user'], 'name' => $subInfo['user_name']))."'>{$subInfo['user_name']}</a>";
}
else
{
$lp_name = $subInfo['forum_lastpost_user_anon'];
}
$tVars['SUB_LASTPOST'] = $lp_date.'<br />'.$lp_name.' '.$lp_thread;
$tVars['SUB_LASTPOSTDATE'] = $gen->computeLapse($tmp[0], time(), false, false, 'short');
$tVars['SUB_LASTPOSTUSER'] = $lp_name;
}
else
{
$tVars['SUB_LASTPOST'] = '-';
$tVars['SUB_LASTPOSTUSER'] = '';
$tVars['SUB_LASTPOSTDATE'] = '';
}
----*/
//---- $tVars['_WRAPPER_'] = 'forum_viewforum';
//var_dump ($subInfo);
// Initial ideia, to have a separate shortcode var ($subsc)....
// $subsc->setVars($subInfo);
// Use setVars or addVars???
$sc->setVars($subInfo);
//echo "--------------------------------------";
// Initial ideia, to have a separate shortcode var ($subsc)....
// $sub_info .= e107::getParser()->parseTemplate($FORUM_VIEW_SUB, false, $subsc);
$sub_info .= e107::getParser()->parseTemplate($FORUM_VIEW_SUB, false, $sc);
//var_dump ($sc);
}
//var_dump ("----------->".$FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END."<-----------");
return $FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END;
}
return '';
}
// Initial ideia, to have a separate shortcode var ($subsc)....
/*------
}
class plugin_forum_viewsubforum_shortcodes extends plugin_forum_viewforum_shortcodes
//-- or ???
//--class plugin_forum_viewsubforum_shortcodes extends e_shortcode
{
function __construct()
{
// $this->forum_rules = forum_rules('check');
}
------*/
function sc_sub_forumtitle()
{
$forumName = e107::getParser()->toHTML($this->var['forum_name'], true);
return "<a href='".e107::getUrl()->create('forum/forum/view', $this->var)."'>{$forumName}</a>";
}
function sc_sub_description()
{
return e107::getParser()->toHTML($this->var['forum_description'], false, 'no_hook');
}
function sc_sub_threads()
{
return $this->var['forum_threads'];
}
function sc_sub_replies()
{
return $this->var['forum_replies'];
}
function sc_sub_threadsx()
{
$badgeThreads = ($this->var['forum_replies']) ? "badge-info" : "";
return "<span class='badge {$badgeThreads}'>".$this->var['forum_threads']."</span>";
}
function sc_sub_repliesx()
{
$badgeReplies = ($this->var['forum_replies']) ? "badge-info" : "";
return "<span class='badge {$badgeReplies}'>".$this->var['forum_replies']."</span>";
}
function sc_newflag()
{
//-- global $newflag_list;
global $forum;
$newflag_list = $forum->forumGetUnreadForums();
/*--
if(USER && is_array($newflag_list) && in_array($this->var['forum_id'], $newflag_list))
{
return "<a href='".e107::getUrl()->create('forum/forum/mfar', 'id='.$this->var['forum_id'])."'>".IMAGE_new.'</a>';
}
return IMAGE_nonew;
--*/
return (USER && is_array($newflag_list) && in_array($this->var['forum_id'], $newflag_list))?"<a href='".e107::getUrl()->create('forum/forum/mfar', 'id='.$this->var['forum_id'])."'>".IMAGE_new.'</a>':IMAGE_nonew;
}
function sc__wrapper_() { return 'forum_viewforum';}
function subinfo() {
$caller = debug_backtrace()[1]['function'];
if($this->var['forum_lastpost_info'])
{
// global $gen;
$tmp = explode('.', $this->var['forum_lastpost_info']);
$lp_thread = "<a href='".e107::getUrl()->create('forum/thread/last', array('id' => $tmp[1]))."'>".IMAGE_post2.'</a>';
$lp_date = $this->gen->convert_date($tmp[0], 'forum');
/*--
$lp_name = $this->var['forum_lastpost_user_anon'];
if($this->var['user_name'])
{
$lp_name = "<a href='".e107::getUrl()->create('user/profile/view', array('id' => $this->var['forum_lastpost_user'], 'name' => $this->var['user_name']))."'>{$this->var['user_name']}</a>";
}
--*/
/*--
else
{
$lp_name = $this->var['forum_lastpost_user_anon'];
}
--*/
$lp_name = ($this->var['user_name'])?"<a href='".e107::getUrl()->create('user/profile/view', array('id' => $this->var['forum_lastpost_user'], 'name' => $this->var['user_name']))."'>{$this->var['user_name']}</a>":$this->var['forum_lastpost_user_anon'];
/*----
$tVars['SUB_LASTPOST'] = $lp_date.'<br />'.$lp_name.' '.$lp_thread;
$tVars['SUB_LASTPOSTDATE'] = $gen->computeLapse($tmp[0], time(), false, false, 'short');
$tVars['SUB_LASTPOSTUSER'] = $lp_name;
----*/
return ($caller == 'sc_sub_lastpostuser'?$lp_name:($caller == 'sc_sub_lastpostdate'?$this->gen->computeLapse($tmp[0], time(), false, false, 'short'):($caller == 'sc_sub_lastpost'?$lp_date.'<br />'.$lp_name.' '.$lp_thread:'')));
}
/*----
else
{
$tVars['SUB_LASTPOST'] = '-';
$tVars['SUB_LASTPOSTUSER'] = '';
$tVars['SUB_LASTPOSTDATE'] = '';
}
----*/
return ($caller == 'sc_sub_lastpost'?'-':'');
}
function sc_sub_lastpostuser()
{
return $this->subinfo();
}
function sc_sub_lastpostdate()
{
return $this->subinfo();
}
function sc_sub_lastpost()
{
return $this->subinfo();
}
// Initial ideia, to have a separate shortcode var ($threadsc)....
/*------
}
class plugin_forum_viewforumthread_shortcodes extends plugin_forum_viewforum_shortcodes
//-- or ???
//--class plugin_forum_viewforumthread_shortcodes extends e_shortcode
{
function __construct()
{
// $this->forum_rules = forum_rules('check');
}
------*/
function sc_views()
{
return $this->var['thread_views'];
}
function sc_replies()
{
return ($this->var['thread_total_replies']?:"0");
}
function sc_viewsx()
{
/*--
if(!deftrue('BOOTSTRAP'))
{
return $this->sc_views;
}
$badge = ($this->var['thread_views'] > 0) ? "badge-info" : "";
return "<span class='badge {$badge}'>".$this->sc_views."</span>";
--*/
$badge = ($this->var['thread_views'] > 0) ? "badge-info" : "";
return deftrue('BOOTSTRAP')?"<span class='badge {$badge}'>".$this->sc_views()."</span>":$this->sc_views();
}
function sc_repliesx()
{
/*--
if(!deftrue('BOOTSTRAP'))
{
return $this->sc_replies;
}
$badge = ($this->var['thread_total_replies'] > 0) ? "badge-info" : "";
return "<span class='badge {$badge}'>".$this->sc_replies."</span>";
--*/
$badge = ($this->var['thread_total_replies'] > 0) ? "badge-info" : "";
return deftrue('BOOTSTRAP')?"<span class='badge {$badge}'>".$this->sc_replies()."</span>":$this->sc_replies();
}
// function sc__wrapper_() { return 'forum_viewforum';}
function threadlastpostdata() {
$caller = debug_backtrace()[1]['function'];
// if($this->var['thread_views'])
//($this->var['thread_total_replies']?:"0")
if($this->var['thread_views'] || $this->var['thread_total_replies']>0)
{
// global $gen;
//---- $lastpost_datestamp = $gen->convert_date($this->var['thread_lastpost'], 'forum');
$LASTPOST = $LASTPOSTUSER = LAN_FORUM_1015;
if($this->var['lastpost_username'])
{
// XXX hopefully & is not allowed in user name - it would break parsing of url parameters, change to array if something wrong happens
$url = e107::getUrl()->create('user/profile/view', "name={$this->var['lastpost_username']}&id={$this->var['thread_lastuser']}");
//---- $tVars['LASTPOST'] = "<a href='{$url}'>".$this->var['lastpost_username']."</a>";
//---- $tVars['LASTPOSTUSER'] = "<a href='{$url}'>".$this->var['lastpost_username']."</a>";
$LASTPOST = $LASTPOSTUSER = "<a href='{$url}'>".$this->var['lastpost_username']."</a>";
}
/*--
else
{
if(!$this->var['thread_lastuser'])
--*/
elseif(!$this->var['thread_lastuser'])
{
//---- $tVars['LASTPOST'] = $tp->toHTML($this->var['thread_lastuser_anon']);
//---- $tVars['LASTPOSTUSER'] = $tp->toHTML($this->var['thread_lastuser_anon']);
$LASTPOST = $LASTPOSTUSER = e107::getParser()->toHTML($this->var['thread_lastuser_anon']);
/*--
}
else
{
//---- $tVars['LASTPOST'] = LAN_FORUM_1015;
//---- $tVars['LASTPOSTUSER'] = LAN_FORUM_1015;
//--$LASTPOST = $LASTPOSTUSER = LAN_FORUM_1015;
}
--*/
}
//---- $tVars['LASTPOST'] .= '<br />'.$lastpost_datestamp;
$LASTPOST .= '<br />'.$this->gen->convert_date($this->var['thread_lastpost'], 'forum');
//---- $tVars['LASTPOSTUSER'] = $this->var['lastpost_username']; // $lastpost_name;
$LASTPOSTUSER = $this->var['lastpost_username'];
//----- ???????
$temp['thread_sef'] = eHelper::title2sef($this->var['thread_name'],'dashl');
$this->addVars($temp);
$urlData = array('forum_sef'=>$this->var['forum_sef'], 'thread_id'=>$this->var['thread_id'],'thread_sef'=>$this->var['thread_sef']);
$url = e107::url('forum', 'topic', $urlData);
$url .= (strpos($url,'?')!==false) ? '&' : '?';
$url .= "last=1#post-".$this->var['lastpost_id'];
//---- $tVars['LASTPOSTDATE'] .= "<a href='".$url."'>". $gen->computeLapse($thread_info['thread_lastpost'],time(), false, false, 'short')."</a>";
return ($caller == 'sc_lastpostuser'?$LASTPOSTUSER:($caller == 'sc_lastpostdate'?"<a href='".$url."'>".$this->gen->computeLapse($this->var['thread_lastpost'],time(), false, false, 'short')."</a>":($caller == 'sc_lastpost'?$LASTPOST:'')));
}
return ($caller == 'sc_lastpostuser'?'':'-');
}
function sc_lastpostuser()
{
return $this->threadlastpostdata();
}
function sc_lastpostdate()
{
return $this->threadlastpostdata();
}
function sc_lastpost()
{
return $this->threadlastpostdata();
}
function sc_threaddate()
{
// global $gen;
return $this->gen->convert_date($this->var['thread_datestamp'], 'forum');
}
function sc_threadtimelapse()
{
// global $gen;
return $this->gen->computeLapse($this->var['thread_datestamp'],time(), false, false, 'short'); // convert_date($thread_info['thread_datestamp'], 'forum');
}
function sc_icon()
{
global $forum;
// global $forum, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE, $gen, $menu_pref,
//$threadsViewed = $forum->threadGetUserViewed();
// $newflag = (USER && $this->var['thread_lastpost'] > USERLV && !in_array($this->var['thread_id'], $threadsViewed));
$newflag = (USER && $this->var['thread_lastpost'] > USERLV && !in_array($this->var['thread_id'], $forum->threadGetUserViewed()));
$ICON = ($newflag ? IMAGE_new : IMAGE_nonew);
//-- CANDIDATE FOR TERNARY IF
if ($this->var['thread_total_replies'] >= $forum->prefs->get('popular', 10))
{
$ICON = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular);
}
elseif(empty($this->var['thread_total_replies']) && defined('IMAGE_noreplies'))
{
$ICON = IMAGE_noreplies;
}
//-- CANDIDATE FOR TERNARY IF
if ($this->var['thread_sticky'] == 1)
{
$ICON = ($this->var['thread_active'] ? IMAGE_sticky : IMAGE_stickyclosed);
}
elseif($this->var['thread_sticky'] == 2)
{
$ICON = IMAGE_announce;
}
elseif(!$this->var['thread_active'])
{
$ICON = IMAGE_closed;
}
return $ICON;
}
function sc_threadtype()
{
//-- CANDIDATE FOR TERNARY IF
if ($this->var['thread_sticky'] == 1)
{
return '['.LAN_FORUM_1011.']<br />';
}
elseif($this->var['thread_sticky'] == 2)
{
return '['.LAN_FORUM_1013.']<br />';
}
return '';
}
function sc_threadname()
{
global $menu_pref, $forum;
$tp = e107::getParser();
$thread_name = strip_tags($tp->toHTML($this->var['thread_name'], false, 'no_hook, emotes_off'));
if(isset($this->var['thread_options']['poll']))
{
$thread_name = '['.LAN_FORUM_1016.'] ' . $thread_name;
}
// if (strtoupper($THREADTYPE) == strtoupper(substr($thread_name, 0, strlen($THREADTYPE))))
// {
// $thread_name = substr($thread_name, strlen($THREADTYPE));
// }
$title = '';
if ($forum->prefs->get('tooltip'))
{
$thread_thread = strip_tags($tp->toHTML($this->var['thread_thread'], true, 'no_hook'));
$tip_length = $forum->prefs->get('tiplength', 400);
if (strlen($thread_thread) > $tip_length)
{
//$thread_thread = substr($thread_thread, 0, $tip_length).' '.$menu_pref['newforumposts_postfix'];
$thread_thread = $tp->text_truncate($thread_thread, $tip_length, $menu_pref['newforumposts_postfix']); // Doesn't split entities
}
$thread_thread = str_replace("'", '&#39;', $thread_thread);
$title = "title='".$thread_thread."'";
}
/*--
else
{
$title = '';
}
--*/
// $tVars['THREADNAME'] = "<a {$title} href='".e107::getUrl()->create('forum/thread/view', array('id' => $threadId, 'name' => $thread_name))."'>{$thread_name}</a>";
// $url = e107::getUrl()->create('forum/thread/view', array('id' => $threadId, 'name' => $thread_name));
// $thread_info['thread_sef'] = eHelper::title2sef($this->var['thread_name'],'dashl');
$temp['thread_sef'] = eHelper::title2sef($this->var['thread_name'],'dashl');
$this->addVars($temp);
$url = e107::url('forum','topic', $this->var);
return "<a {$title} href='".$url."'>{$thread_name}</a>";
}
function sc_pages()
{
// $tVars['PAGES'] = fpages($thread_info, $tVars['REPLIES']);
return fpages($this->var, $this->sc_replies());
}
function sc_pagesx()
{
// $tVars['PAGESX'] = fpages($thread_info, $tVars['REPLIES']);
return $this->sc_pages();
}
function sc_admin_icons()
{
if (MODERATOR)
{
$threadId = $this->var['thread_id'];
$forumId = $this->var['thread_forum_id'];
// FIXME _URL_ thread name
// e107::getUrl()->create('forum/forum/view', "id={$thread_info['thread_forum_id']}")
// USED self instead
// $moveUrl = e107::url('forum','move', $this->var);
return "
<form method='post' action='".e_REQUEST_URI."' id='frmMod_{$forumId}_{$threadId}' style='margin:0;'><div class='forum-viewforum-admin-icons'>
<input type='image' ".IMAGE_admin_delete." name='deleteThread_{$threadId}' value='thread_action' onclick=\"return confirm_({$threadId})\" />
".($this->var['thread_sticky'] == 1 ? "<input type='image' ".IMAGE_admin_unstick." name='unstick_{$threadId}' value='thread_action' /> " : "<input type='image' ".IMAGE_admin_stick." name='stick_{$threadId}' value='thread_action' /> ")."
".($this->var['thread_active'] ? "<input type='image' ".IMAGE_admin_lock." name='lock_{$threadId}' value='thread_action' /> " : "<input type='image' ".IMAGE_admin_unlock." name='unlock_{$threadId}' value='thread_action' /> "). "
<a class='e-tip' title=\"".LAN_FORUM_5019."\" href='".e107::url('forum','move', $this->var)."'>".IMAGE_admin_move.'</a>
</div></form>
';
}
return '';
}
function sc_adminoptions()
{
/*--
if(!deftrue('BOOTSTRAP'))
{
return $this->sc_admin_icons;
}
if (MODERATOR)
{
return fadminoptions($this->var);
}
return '';
--*/
return (!deftrue('BOOTSTRAP')?$this->sc_admin_icons():((MODERATOR)?fadminoptions($this->var):''));
}
function sc_poster()
{
/*--
if ($this->var['user_name'])
{
return "<a href='".e107::getUrl()->create('user/profile/view', array('id' => $this->var['thread_user'], 'name' => $this->var['user_name']))."'>".$this->var['user_name']."</a>";
}
// else
// {
elseif($this->var['thread_user_anon'])
{
return e107::getParser()->toHTML($this->var['thread_user_anon']);
}
// else
// {
return LAN_FORUM_1015;
--*/
// else
// {
return (($this->var['user_name'])?"<a href='".e107::getUrl()->create('user/profile/view', array('id' => $this->var['thread_user'], 'name' => $this->var['user_name']))."'>".$this->var['user_name']."</a>":(($this->var['thread_user_anon'])?e107::getParser()->toHTML($this->var['thread_user_anon']):LAN_FORUM_1015));
// }
// }
}
////////////////////////////////////////////////
/*
function sc_sub_description()
{
return e107::getParser()->toHTML($this->var['forum_description'], false, 'no_hook');
}
function sc_sub_threadsx()
{
$badgeThreads = ($this->var['forum_replies']) ? "badge-info" : "";
return "<span class='badge {$badgeThreads}'>".$this->var['forum_threads']."</span>";
}
function sc_sub_repliesx()
{
$badgeReplies = ($this->var['forum_replies']) ? "badge-info" : "";
return "<span class='badge {$badgeReplies}'>".$this->var['forum_replies']."</span>";
}
function sc_newflag()
{
global $newflag_list;
if(USER && is_array($newflag_list) && in_array($this->var['forum_id'], $newflag_list))
{
return "<a href='".e107::getUrl()->create('forum/forum/mfar', 'id='.$this->var['forum_id'])."'>".IMAGE_new.'</a>';
}
return IMAGE_nonew;
}
*/
}
?>

View File

@ -259,6 +259,7 @@ class social_shortcodes extends e_shortcode
$twitterAccount = basename(XURL_TWITTER);
$btnClass = varset($parm['btnClass'], 'btn btn-default social-share');
// return print_a($hashtags,true);
@ -270,6 +271,8 @@ class social_shortcodes extends e_shortcode
continue;
}
$pUrl = str_replace("&","&amp;",$val['url']);
$shareUrl = $tp->lanVars($pUrl,$data);
@ -290,7 +293,7 @@ class social_shortcodes extends e_shortcode
$opt[$k] = "<a class='".$btnClass." ".$tooltip." ".$butSize."' target='_blank' title='".$val["title"]."' href='".$shareUrl."'>".$tp->toIcon($val["icon"], array('fw'=>1))."</a>";
$opt[$k] = "<a class='".$btnClass." ".$tooltip." ".$butSize." social-share-".$k."' target='_blank' title='".$val["title"]."' href='".$shareUrl."'>".$tp->toIcon($val["icon"], array('fw'=>1))."</a>";
}
// Show only Email, Facebook, Twitter and Google.

View File

@ -217,33 +217,107 @@ class wysiwyg
function tinymce_lang()
{
$lang = e_LANGUAGE; // 'English'; //Quick Fix e_LANGUAGE
$lang = e_LANGUAGE;
// Languages supported by TinyMce.
// Commented out languages are not found in e107's language_class.php.
$tinylang = array(
"Arabic" => "ar",
"Bulgarian" => "bg",
"Danish" => "da",
"Dutch" => "nl",
"English" => "en",
"Persian" => "fa",
"French" => "fr",
"German" => "de",
"Greek" => "el",
"Hebrew" => " ",
"Hungarian" => "hu",
"Italian" => "it",
"Japanese" => "ja",
"Korean" => "ko",
"Norwegian" => "nb",
"Polish" => "pl",
"Russian" => "ru",
"Slovak" => "sk",
"Spanish" => "es",
"Swedish" => "sv"
'Arabic' => 'ar',
// 'Arabic (Saudi Arabia)' => 'ar_SA',
'Armenian' => 'hy',
'Azerbaijani' => 'az',
'Basque' => 'eu',
'Belarusian' => 'be',
'Bengali' => 'bn_BD',
'Bosnian' => 'bs',
'Bulgarian' => 'bg_BG',
'Catalan' => 'ca',
'ChineseSimp' => 'zh_CN',
'ChineseTrad' => 'zh_TW',
'Croatian' => 'hr',
'Czech' => 'cs',
// 'Czech (Czech Republic)' => 'cs_CZ',
'Danish' => 'da',
// 'Divehi' => 'dv',
'Dutch' => 'nl',
'English' => 'en', // Default language file.
// 'English (Canada)' => 'en_CA',
// 'English (United Kingdom)' => 'en_GB',
'Esperanto' => 'eo',
'Estonian' => 'et',
'Faroese' => 'fo',
'Finnish' => 'fi',
'French' => 'fr_FR',
// 'French (Switzerland)' => 'fr_CH',
'Gaelic' => 'gd',
'Gallegan' => 'gl',
'Georgian' => 'ka_GE',
'German' => 'de',
// 'German (Austria)' => 'de_AT',
'Greek' => 'el',
'Hebrew' => 'he_IL',
'Hindi' => 'hi_IN',
'Hungarian' => 'hu_HU',
'Icelandic' => 'is_IS',
'Indonesian' => 'id',
'Irish' => 'ga',
'Italian' => 'it',
'Japanese' => 'ja',
// 'Kabyle' => 'kab',
'Kazakh' => 'kk',
'Khmer' => 'km_KH',
'Korean' => 'ko',
// 'Korean (Korea)' => 'ko_KR',
'Kurdish' => 'ku',
// 'Kurdish (Iraq)' => 'ku_IQ',
'Latvian' => 'lv',
'Lithuanian' => 'lt',
'Letzeburgesch' => 'lb',
'Macedonian' => 'mk_MK',
'Malayalam' => 'ml',
// 'Malayalam (India)' => 'ml_IN',
'Mongolian' => 'mn_MN',
'Norwegian' => 'nb_NO',
'Persian' => 'fa',
// 'Persian (Iran)' => 'fa_IR',
'Polish' => 'pl',
// 'Portuguese (Brazil)' => 'pt_BR',
'Portuguese' => 'pt_PT',
'Romanian' => 'ro',
'Russian' => 'ru',
// 'Russian (Russia)' => 'ru_RU',
'Serbian' => 'sr',
'Sinhala' => 'si_LK',
'Slovak' => 'sk',
'Slovenian' => 'sl_SI',
'Spanish' => 'es',
// 'Spanish (Mexico)' => 'es_MX',
'Swedish' => 'sv_SE',
'Tajik' => 'tg',
'Tamil' => 'ta',
// 'Tamil (India)' => 'ta_IN',
'Tatar' => 'tt',
'Thai' => 'th_TH',
'Turkish' => 'tr',
// 'Turkish (Turkey)' => 'tr_TR',
'Uighur' => 'ug',
'Ukrainian' => 'uk',
// 'Ukrainian (Ukraine)' => 'uk_UA',
'Vietnamese' => 'vi',
// 'Vietnamese (Viet Nam)' => 'vi_VN',
'Welsh' => 'cy',
);
if(!$tinylang[$lang])
if(!isset($tinylang[$lang]))
{
$tinylang[$lang] = "en";
$tinylang[$lang] = "en";
}
// If language file is not present, use default.
$jsFile = e_PLUGIN . 'tinymce4/langs/' . $tinylang[$lang] . '.js';
if($tinylang[$lang] != 'en' && !file_exists($jsFile))
{
$tinylang[$lang] = "en";
}
return $tinylang[$lang];
@ -839,7 +913,7 @@ class wysiwyg
function getTemplates()
{
$templatePath = (is_readable(THEME."templates/tinymce/".$template)) ? THEME."templates/tinymce/".$template : e_PLUGIN."tinymce4/templates/".$template;
// $templatePath = (is_readable(THEME."templates/tinymce/".$template)) ? THEME."templates/tinymce/".$template : e_PLUGIN."tinymce4/templates/".$template;

View File

@ -14,7 +14,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
var $item = $(this);
// Fix for changeDate() not being fired when value manually altered.
$item.on("change", function () {
$item.on("change keyup", function () {
var $this = $(this);
var useUnix = $this.attr("data-date-unix");
@ -53,7 +53,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
});
});
$(context).find('input.e-date').once('datetimepicker-init').each(function () {
$(context).find('input.e-datetime').once('datetimepicker-init').each(function () {
var $item = $(this);
$item.datetimepicker({

View File

@ -168,6 +168,24 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
}
};
/**
* Behavior to initialize tooltips on elements with data-toggle="tooltip" attribute.
*
* @type {{attach: e107.behaviors.bootstrapTooltip.attach}}
*/
e107.behaviors.bootstrapTooltip = {
attach: function (context, settings)
{
if(typeof $.fn.tooltip !== 'undefined')
{
$(context).find('[data-toggle="tooltip"]').once('bootstrap-tooltip').each(function ()
{
$(this).tooltip();
});
}
}
};
/**
* Behavior to attach a click event to elements with .e-expandit class.
*

View File

@ -40,7 +40,7 @@ define("e_UC_NOBODY", 255);*/
if($_SERVER['QUERY_STRING'] != "debug")
{
error_reporting(0); // suppress all errors unless debugging.
error_reporting(0); // suppress all errors unless debugging.
}
else
{
@ -1400,8 +1400,10 @@ if($this->pdo == true)
}
}
elseif(file_exists("e107.htaccess"))
{
$error = e107::getParser()->toHtml(LANINS_144,true);
{
$srch = array('[b]','[/b]');
$repl = array('<b>','</b>');
$error = str_replace($srch,$repl, LANINS_144); // too early to use e107::getParser() so use str_replace();
}
return $error;
}
@ -1551,14 +1553,26 @@ if($this->pdo == true)
eRouter::clearCache();
$this->logLine('Core URL config set to default state');
$us = e107::getUserSession();
if($us->passwordAPIExists() === true)
{
$this->previous_steps['prefs']['passwordEncoding'] = PASSWORD_E107_PHP;
$pwdEncoding = PASSWORD_E107_PHP;
}
else
{
$pwdEncoding = PASSWORD_E107_MD5; // default already in default_install.xml
}
// Set prefs, save
e107::getConfig('core')->setPref($this->previous_steps['prefs']);
e107::getConfig('core')->save(FALSE,TRUE, FALSE); // save preferences made during install.
$this->logLine('Core prefs set to install choices');
// Create the admin user - replacing any that may be been included in the XML.
$us = e107::getUserSession();
$hash = $us->HashPassword($this->previous_steps['admin']['password'],$this->previous_steps['admin']['user'],PASSWORD_E107_PHP);
$hash = $us->HashPassword($this->previous_steps['admin']['password'],$this->previous_steps['admin']['user'], $pwdEncoding);
$ip = $_SERVER['REMOTE_ADDR'];
$userp = "1, '{$this->previous_steps['admin']['display']}', '{$this->previous_steps['admin']['user']}', '', '".$hash."', '', '{$this->previous_steps['admin']['email']}', '', '', 0, ".time().", 0, 0, 0, 0, 0, '{$ip}', 0, '', 0, 1, '', '', '0', '', ".time().", ''";

View File

@ -346,13 +346,15 @@ e107::getMessage()->addDebug("<h5>Posted Changes</h5>".print_a($changedUserData,
}
}
} // End - update setttings
elseif (isset($_POST['SaveValidatedInfo']))
{ // Next bit only valid if user editing their own data
elseif (isset($_POST['SaveValidatedInfo'])) // Next bit only valid if user editing their own data
{
if (!$adminEdit && !empty($_POST['updated_data']) && !empty($_POST['currentpassword']) && !empty($_POST['updated_key']))
{ // Got some data confirmed with password entry
$new_data = base64_decode($_POST['updated_data']);
if (md5($new_data) != $_POST['updated_key'])
{ // Should only happen if someone's fooling around
// Should only happen if someone's fooling around
if (md5($new_data) != $_POST['updated_key'] || isset($new_data['user_admin']) || isset($new_data['user_perms']))
{
echo LAN_USET_42.'<br />';
exit();
}